File indexing completed on 2024-05-19 04:58:48

0001 /* ============================================================
0002 * Falkon - Qt web browser
0003 * Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com>
0004 *
0005 * This program is free software: you can redistribute it and/or modify
0006 * it under the terms of the GNU General Public License as published by
0007 * the Free Software Foundation, either version 3 of the License, or
0008 * (at your option) any later version.
0009 *
0010 * This program is distributed in the hope that it will be useful,
0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013 * GNU General Public License for more details.
0014 *
0015 * You should have received a copy of the GNU General Public License
0016 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0017 * ============================================================ */
0018 #ifndef HISTORYMANAGER_H
0019 #define HISTORYMANAGER_H
0020 
0021 #include <QWidget>
0022 #include <QPointer>
0023 #include <QUrl>
0024 
0025 #include "qzcommon.h"
0026 
0027 namespace Ui
0028 {
0029 class HistoryManager;
0030 }
0031 
0032 class QTreeWidgetItem;
0033 
0034 class BrowserWindow;
0035 
0036 class FALKON_EXPORT HistoryManager : public QWidget
0037 {
0038     Q_OBJECT
0039 
0040 public:
0041     explicit HistoryManager(BrowserWindow* window, QWidget* parent = nullptr);
0042     ~HistoryManager() override;
0043 
0044     void setMainWindow(BrowserWindow* window);
0045 
0046     void restoreState(const QByteArray &state);
0047     QByteArray saveState();
0048 
0049 public Q_SLOTS:
0050     void search(const QString &searchText);
0051 
0052 private Q_SLOTS:
0053     void urlActivated(const QUrl &url);
0054     void urlCtrlActivated(const QUrl &url);
0055     void urlShiftActivated(const QUrl &url);
0056 
0057     void openUrl(const QUrl &url = QUrl());
0058     void openUrlInNewTab(const QUrl &url = QUrl());
0059     void openUrlInNewWindow(const QUrl &url = QUrl());
0060     void openUrlInNewPrivateWindow(const QUrl &url = QUrl());
0061 
0062     void createContextMenu(const QPoint &pos);
0063 
0064     void copyUrl();
0065     void copyTitle();
0066     void clearHistory();
0067 
0068 private:
0069     void keyPressEvent(QKeyEvent *event) override;
0070 
0071     BrowserWindow* getWindow();
0072 
0073     Ui::HistoryManager* ui;
0074     QPointer<BrowserWindow> m_window;
0075 };
0076 
0077 #endif // HISTORYMANAGER_H