File indexing completed on 2024-04-28 15:51:44

0001 /*
0002     SPDX-FileCopyrightText: 2007 Pino Toscano <pino@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef _FINDBAR_H_
0008 #define _FINDBAR_H_
0009 
0010 #include <qwidget.h>
0011 
0012 class QAction;
0013 class SearchLineWidget;
0014 
0015 namespace Okular
0016 {
0017 class Document;
0018 }
0019 
0020 class FindBar : public QWidget
0021 {
0022     Q_OBJECT
0023 
0024 public:
0025     explicit FindBar(Okular::Document *document, QWidget *parent = nullptr);
0026     ~FindBar() override;
0027 
0028     QString text() const;
0029     Qt::CaseSensitivity caseSensitivity() const;
0030 
0031     void focusAndSetCursor();
0032     bool maybeHide();
0033     void startSearch(const QString &findText);
0034 
0035 Q_SIGNALS:
0036     void forwardKeyPressEvent(QKeyEvent *);
0037     void onCloseButtonPressed();
0038 
0039 public Q_SLOTS:
0040     void findNext();
0041     void findPrev();
0042     void resetSearch();
0043 
0044 private Q_SLOTS:
0045     void caseSensitivityChanged();
0046     void fromCurrentPageChanged();
0047     void findAsYouTypeChanged();
0048     void closeAndStopSearch();
0049 
0050 private:
0051     SearchLineWidget *m_search;
0052     QAction *m_caseSensitiveAct;
0053     QAction *m_fromCurrentPageAct;
0054     QAction *m_findAsYouTypeAct;
0055     bool eventFilter(QObject *target, QEvent *event) override;
0056     bool m_active;
0057 };
0058 
0059 #endif