File indexing completed on 2024-06-23 05:20:50
0001 /* ============================================================ 0002 * 0003 * This file is a part of the rekonq project 0004 * 0005 * Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com> 0006 * Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr> 0007 * 0008 * 0009 * This program is free software; you can redistribute it and/or 0010 * modify it under the terms of the GNU General Public License as 0011 * published by the Free Software Foundation; either version 2 of 0012 * the License or (at your option) version 3 or any later version 0013 * accepted by the membership of KDE e.V. (or its successor approved 0014 * by the membership of KDE e.V.), which shall act as a proxy 0015 * defined in Section 14 of version 3 of the license. 0016 * 0017 * This program is distributed in the hope that it will be useful, 0018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0020 * GNU General Public License for more details. 0021 * 0022 * You should have received a copy of the GNU General Public License 0023 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0024 * 0025 * ============================================================ */ 0026 0027 0028 #ifndef GUI_FINDBAR_H 0029 #define GUI_FINDBAR_H 0030 0031 #include <QPointer> 0032 #include <QWidget> 0033 0034 class QCheckBox; 0035 class QLineEdit; 0036 class QString; 0037 class QWebView; 0038 0039 namespace Gui { 0040 0041 class FindBar : public QWidget 0042 { 0043 Q_OBJECT 0044 0045 public: 0046 explicit FindBar(QWidget *parent); 0047 enum FindDirection { Forward = 0, Backward }; 0048 0049 bool matchCase() const; 0050 void notifyMatch(bool match); 0051 bool highlightAllState() const; 0052 0053 void setVisible(bool visible); 0054 void setAssociatedWebView(QWebView *webView); 0055 0056 protected: 0057 void keyPressEvent(QKeyEvent *event); 0058 0059 private slots: 0060 void findText(const QString &search); 0061 void matchCaseUpdate(); 0062 void findNext(); 0063 void findPrevious(); 0064 void updateHighlight(); 0065 void resetAssociatedWebView(); 0066 0067 signals: 0068 void searchString(const QString &); 0069 0070 private: 0071 void find(FindDirection dir); 0072 0073 private: 0074 QLineEdit *m_lineEdit; 0075 QCheckBox *m_matchCase; 0076 QCheckBox *m_highlightAll; 0077 0078 QString _lastStringSearched; 0079 QPointer<QWebView> m_associatedWebView; 0080 }; 0081 0082 } 0083 0084 #endif