File indexing completed on 2024-05-12 05:14:45

0001 /*
0002  *  find.h  -  search facility
0003  *  Program:  kalarm
0004  *  SPDX-FileCopyrightText: 2005-2019 David Jarvie <djarvie@kde.org>
0005  *
0006  *  SPDX-License-Identifier: GPL-2.0-or-later
0007  */
0008 
0009 #pragma once
0010 
0011 #include <QObject>
0012 #include <QPointer>
0013 #include <QStringList>
0014 #include <QModelIndex>
0015 
0016 class QCheckBox;
0017 class KFindDialog;
0018 class KFind;
0019 class KSeparator;
0020 class EventListView;
0021 
0022 
0023 class Find : public QObject
0024 {
0025     Q_OBJECT
0026 public:
0027     explicit Find(EventListView* parent);
0028     ~Find() override;
0029     void        display();
0030     void        findNext(bool forward)     { findNext(forward, false, false); }
0031 
0032 Q_SIGNALS:
0033     void        active(bool);
0034 
0035 private Q_SLOTS:
0036     void        slotFind();
0037     void        slotKFindDestroyed()       { Q_EMIT active(false); }
0038     void        slotSelectionChanged();
0039 
0040 private:
0041     void        findNext(bool forward, bool checkEnd, bool fromCurrent);
0042     QModelIndex nextItem(const QModelIndex&, bool forward) const;
0043 
0044     EventListView*     mListView;        // parent list view
0045     QPointer<KFindDialog>  mDialog;
0046     QCheckBox*         mArchived;
0047     QCheckBox*         mLive;
0048     KSeparator*        mActiveArchivedSep;
0049     QCheckBox*         mMessageType;
0050     QCheckBox*         mFileType;
0051     QCheckBox*         mCommandType;
0052     QCheckBox*         mEmailType;
0053     QCheckBox*         mAudioType;
0054     KFind*             mFind {nullptr};
0055     QStringList        mHistory;         // list of history items for Find dialog
0056     QString            mLastPattern;     // pattern used in last search
0057     QString            mStartID;         // ID of first alarm searched if 'from cursor' was selected
0058     long               mOptions {0};     // OR of find dialog options
0059     bool               mNoCurrentItem;   // there is no current item for the purposes of searching
0060     bool               mFound {false};   // true if any matches have been found
0061 };
0062 
0063 // vim: et sw=4: