1 /* ============================================================ 2 * Falkon - Qt web browser 3 * Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com> 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * ============================================================ */ 18 #ifndef HISTORYMANAGER_H 19 #define HISTORYMANAGER_H 20 21 #include <QWidget> 22 #include <QPointer> 23 #include <QUrl> 24 25 #include "qzcommon.h" 26 27 namespace Ui 28 { 29 class HistoryManager; 30 } 31 32 class QTreeWidgetItem; 33 34 class BrowserWindow; 35 36 class FALKON_EXPORT HistoryManager : public QWidget 37 { 38 Q_OBJECT 39 40 public: 41 explicit HistoryManager(BrowserWindow* window, QWidget* parent = 0); 42 ~HistoryManager(); 43 44 void setMainWindow(BrowserWindow* window); 45 46 void restoreState(const QByteArray &state); 47 QByteArray saveState(); 48 49 public Q_SLOTS: 50 void search(const QString &searchText); 51 52 private Q_SLOTS: 53 void urlActivated(const QUrl &url); 54 void urlCtrlActivated(const QUrl &url); 55 void urlShiftActivated(const QUrl &url); 56 57 void openUrl(const QUrl &url = QUrl()); 58 void openUrlInNewTab(const QUrl &url = QUrl()); 59 void openUrlInNewWindow(const QUrl &url = QUrl()); 60 void openUrlInNewPrivateWindow(const QUrl &url = QUrl()); 61 62 void createContextMenu(const QPoint &pos); 63 64 void copyUrl(); 65 void copyTitle(); 66 void clearHistory(); 67 68 private: 69 void keyPressEvent(QKeyEvent *event) override; 70 71 BrowserWindow* getWindow(); 72 73 Ui::HistoryManager* ui; 74 QPointer<BrowserWindow> m_window; 75 }; 76 77 #endif // HISTORYMANAGER_H 78