mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
[Code] Moved history menu into separate HistoryMenu class
This commit is contained in:
parent
d8f71fad8b
commit
a9bce8c775
@ -68,6 +68,7 @@
|
||||
#include "qtwin.h"
|
||||
#include "bookmarkstools.h"
|
||||
#include "bookmarksmenu.h"
|
||||
#include "historymenu.h"
|
||||
|
||||
#include <QKeyEvent>
|
||||
#include <QSplitter>
|
||||
@ -542,29 +543,9 @@ void BrowserWindow::setupMenu()
|
||||
/****************
|
||||
* History Menu *
|
||||
****************/
|
||||
m_menuHistory = new Menu(tr("Hi&story"));
|
||||
m_menuHistory->addAction(qIconProvider->standardIcon(QStyle::SP_ArrowBack), tr("&Back"),
|
||||
MENU_RECEIVER, SLOT(goBack()))->setShortcut(actionShortcut(QKeySequence::Back, Qt::ALT + Qt::Key_Left, QKeySequence::Forward, Qt::ALT + Qt::Key_Right));
|
||||
m_menuHistory->addAction(qIconProvider->standardIcon(QStyle::SP_ArrowForward), tr("&Forward"),
|
||||
MENU_RECEIVER, SLOT(goNext()))->setShortcut(actionShortcut(QKeySequence::Forward, Qt::ALT + Qt::Key_Right, QKeySequence::Back, Qt::ALT + Qt::Key_Left));
|
||||
m_menuHistory->addAction(qIconProvider->fromTheme("go-home"), tr("&Home"), MENU_RECEIVER, SLOT(goHome()))->setShortcut(QKeySequence("Alt+Home"));
|
||||
m_menuHistory->addAction(QIcon::fromTheme("view-history", QIcon(":/icons/menu/history.png")), tr("Show &All History"), MENU_RECEIVER, SLOT(showHistoryManager()))->setShortcut(QKeySequence("Ctrl+Shift+H"));
|
||||
m_menuHistory->addSeparator();
|
||||
connect(m_menuHistory, SIGNAL(aboutToShow()), MENU_RECEIVER, SLOT(aboutToShowHistoryMenu()));
|
||||
connect(m_menuHistory, SIGNAL(aboutToHide()), MENU_RECEIVER, SLOT(aboutToHideHistoryMenu()));
|
||||
|
||||
m_menuClosedTabs = new QMenu(tr("Closed Tabs"));
|
||||
connect(m_menuClosedTabs, SIGNAL(aboutToShow()), MENU_RECEIVER, SLOT(aboutToShowClosedTabsMenu()));
|
||||
|
||||
m_menuHistoryRecent = new Menu(tr("Recently Visited"), m_menuHistory);
|
||||
connect(m_menuHistoryRecent, SIGNAL(aboutToShow()), MENU_RECEIVER, SLOT(aboutToShowHistoryRecentMenu()));
|
||||
|
||||
m_menuHistoryMost = new Menu(tr("Most Visited"), m_menuHistory);
|
||||
connect(m_menuHistoryMost, SIGNAL(aboutToShow()), MENU_RECEIVER, SLOT(aboutToShowHistoryMostMenu()));
|
||||
|
||||
m_menuHistory->addMenu(m_menuHistoryRecent);
|
||||
m_menuHistory->addMenu(m_menuHistoryMost);
|
||||
m_menuHistory->addMenu(m_menuClosedTabs);
|
||||
m_menuHistory = new HistoryMenu();
|
||||
m_menuHistory->setMainWindow(this);
|
||||
|
||||
/******************
|
||||
* Bookmarks Menu *
|
||||
@ -883,7 +864,7 @@ void BrowserWindow::loadSettings()
|
||||
#endif
|
||||
}
|
||||
|
||||
void BrowserWindow::goNext()
|
||||
void BrowserWindow::goForward()
|
||||
{
|
||||
weView()->forward();
|
||||
}
|
||||
@ -1008,96 +989,6 @@ void BrowserWindow::aboutToHideFileMenu()
|
||||
m_actionCloseWindow->setEnabled(true);
|
||||
}
|
||||
|
||||
void BrowserWindow::aboutToShowHistoryMenu()
|
||||
{
|
||||
TabbedWebView* view = weView();
|
||||
if (!view) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_menuHistory->actions().at(0)->setEnabled(view->history()->canGoBack());
|
||||
m_menuHistory->actions().at(1)->setEnabled(view->history()->canGoForward());
|
||||
}
|
||||
|
||||
void BrowserWindow::aboutToHideHistoryMenu()
|
||||
{
|
||||
m_menuHistory->actions().at(0)->setEnabled(true);
|
||||
m_menuHistory->actions().at(1)->setEnabled(true);
|
||||
}
|
||||
|
||||
void BrowserWindow::aboutToShowClosedTabsMenu()
|
||||
{
|
||||
m_menuClosedTabs->clear();
|
||||
int i = 0;
|
||||
foreach (const ClosedTabsManager::Tab &tab, m_tabWidget->closedTabsManager()->allClosedTabs()) {
|
||||
QString title = tab.title;
|
||||
if (title.length() > 40) {
|
||||
title.truncate(40);
|
||||
title += "..";
|
||||
}
|
||||
m_menuClosedTabs->addAction(_iconForUrl(tab.url), title, MENU_RECEIVER, SLOT(restoreClosedTab()))->setData(i);
|
||||
i++;
|
||||
}
|
||||
m_menuClosedTabs->addSeparator();
|
||||
if (i == 0) {
|
||||
m_menuClosedTabs->addAction(tr("Empty"))->setEnabled(false);
|
||||
}
|
||||
else {
|
||||
m_menuClosedTabs->addAction(tr("Restore All Closed Tabs"), MENU_RECEIVER, SLOT(restoreAllClosedTabs()));
|
||||
m_menuClosedTabs->addAction(tr("Clear list"), MENU_RECEIVER, SLOT(clearClosedTabsList()));
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWindow::aboutToShowHistoryRecentMenu()
|
||||
{
|
||||
m_menuHistoryRecent->clear();
|
||||
QSqlQuery query;
|
||||
query.exec("SELECT title, url FROM history ORDER BY date DESC LIMIT 15");
|
||||
while (query.next()) {
|
||||
const QUrl url = query.value(1).toUrl();
|
||||
QString title = query.value(0).toString();
|
||||
if (title.length() > 40) {
|
||||
title.truncate(40);
|
||||
title += "..";
|
||||
}
|
||||
|
||||
Action* act = new Action(_iconForUrl(url), title);
|
||||
act->setData(url);
|
||||
connect(act, SIGNAL(triggered()), MENU_RECEIVER, SLOT(loadActionUrl()));
|
||||
connect(act, SIGNAL(ctrlTriggered()), MENU_RECEIVER, SLOT(loadActionUrlInNewNotSelectedTab()));
|
||||
m_menuHistoryRecent->addAction(act);
|
||||
}
|
||||
|
||||
if (m_menuHistoryRecent->isEmpty()) {
|
||||
m_menuHistoryRecent->addAction(tr("Empty"))->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWindow::aboutToShowHistoryMostMenu()
|
||||
{
|
||||
m_menuHistoryMost->clear();
|
||||
|
||||
const QVector<HistoryEntry> &mostList = mApp->history()->mostVisited(10);
|
||||
|
||||
foreach (const HistoryEntry &entry, mostList) {
|
||||
QString title = entry.title;
|
||||
if (title.length() > 40) {
|
||||
title.truncate(40);
|
||||
title += "..";
|
||||
}
|
||||
|
||||
Action* act = new Action(_iconForUrl(entry.url), title);
|
||||
act->setData(entry.url);
|
||||
connect(act, SIGNAL(triggered()), MENU_RECEIVER, SLOT(loadActionUrl()));
|
||||
connect(act, SIGNAL(ctrlTriggered()), MENU_RECEIVER, SLOT(loadActionUrlInNewNotSelectedTab()));
|
||||
m_menuHistoryMost->addAction(act);
|
||||
}
|
||||
|
||||
if (m_menuHistoryMost->isEmpty()) {
|
||||
m_menuHistoryMost->addAction(tr("Empty"))->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWindow::aboutToShowViewMenu()
|
||||
{
|
||||
m_actionShowToolbar->setChecked(m_navigationBar->isVisible());
|
||||
@ -1374,17 +1265,6 @@ void BrowserWindow::loadActionUrlInNewTab(QObject* obj)
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWindow::loadActionUrlInNewNotSelectedTab(QObject* obj)
|
||||
{
|
||||
if (!obj) {
|
||||
obj = sender();
|
||||
}
|
||||
|
||||
if (QAction* action = qobject_cast<QAction*>(obj)) {
|
||||
m_tabWidget->addView(action->data().toUrl(), Qz::NT_NotSelectedTab);
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWindow::loadAddress(const QUrl &url)
|
||||
{
|
||||
if (weView()->webTab()->isPinned()) {
|
||||
|
@ -36,6 +36,7 @@ class TabWidget;
|
||||
class TabbedWebView;
|
||||
class LineEdit;
|
||||
class SearchToolBar;
|
||||
class HistoryMenu;
|
||||
class BookmarksMenu;
|
||||
class BookmarksToolbar;
|
||||
class AutoFill;
|
||||
@ -116,14 +117,20 @@ signals:
|
||||
void setWebViewMouseTracking(bool state);
|
||||
|
||||
public slots:
|
||||
void goHome();
|
||||
void goHomeInNewTab();
|
||||
void goBack();
|
||||
void goForward();
|
||||
|
||||
void setWindowTitle(const QString &t);
|
||||
void toggleFullScreen();
|
||||
|
||||
void showWebInspector(bool toggle = true);
|
||||
void showBookmarksToolbar();
|
||||
void showHistoryManager();
|
||||
|
||||
void loadActionUrl(QObject* obj = 0);
|
||||
void loadActionUrlInNewTab(QObject* obj = 0);
|
||||
void loadActionUrlInNewNotSelectedTab(QObject* obj = 0);
|
||||
|
||||
void bookmarkPage();
|
||||
void bookmarkAllTabs();
|
||||
@ -135,10 +142,6 @@ public slots:
|
||||
|
||||
private slots:
|
||||
void postLaunch();
|
||||
void goNext();
|
||||
void goBack();
|
||||
void goHome();
|
||||
void goHomeInNewTab();
|
||||
void stop();
|
||||
void reload();
|
||||
void reloadByPassCache();
|
||||
@ -148,9 +151,6 @@ private slots:
|
||||
|
||||
void aboutToShowFileMenu();
|
||||
void aboutToHideFileMenu();
|
||||
void aboutToShowHistoryMenu();
|
||||
void aboutToHideHistoryMenu();
|
||||
void aboutToShowClosedTabsMenu();
|
||||
void aboutToShowViewMenu();
|
||||
void aboutToHideViewMenu();
|
||||
void aboutToShowEditMenu();
|
||||
@ -161,7 +161,6 @@ private slots:
|
||||
|
||||
void searchOnPage();
|
||||
void showCookieManager();
|
||||
void showHistoryManager();
|
||||
void showBookmarksManager();
|
||||
void showRSSManager();
|
||||
void showDownloadManager();
|
||||
@ -169,8 +168,6 @@ private slots:
|
||||
void showNavigationToolbar();
|
||||
void showStatusbar();
|
||||
void showClearPrivateData();
|
||||
void aboutToShowHistoryRecentMenu();
|
||||
void aboutToShowHistoryMostMenu();
|
||||
void showPreferences();
|
||||
void showBookmarkImport();
|
||||
|
||||
@ -275,10 +272,7 @@ private:
|
||||
QMenu* m_menuView;
|
||||
QMenu* m_toolbarsMenu;
|
||||
BookmarksMenu* m_menuBookmarks;
|
||||
Menu* m_menuHistory;
|
||||
QMenu* m_menuClosedTabs;
|
||||
Menu* m_menuHistoryRecent;
|
||||
Menu* m_menuHistoryMost;
|
||||
HistoryMenu* m_menuHistory;
|
||||
QMenu* m_menuEncoding;
|
||||
QAction* m_menuBookmarksAction;
|
||||
|
||||
|
@ -40,6 +40,8 @@ BookmarksMenu::BookmarksMenu(QWidget* parent)
|
||||
|
||||
void BookmarksMenu::setMainWindow(BrowserWindow* window)
|
||||
{
|
||||
Q_ASSERT(window);
|
||||
|
||||
m_window = window;
|
||||
}
|
||||
|
||||
|
253
src/lib/history/historymenu.cpp
Normal file
253
src/lib/history/historymenu.cpp
Normal file
@ -0,0 +1,253 @@
|
||||
/* ============================================================
|
||||
* QupZilla - WebKit based browser
|
||||
* Copyright (C) 2014 David Rosca <nowrep@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* ============================================================ */
|
||||
#include "historymenu.h"
|
||||
#include "iconprovider.h"
|
||||
#include "browserwindow.h"
|
||||
#include "tabbedwebview.h"
|
||||
#include "mainapplication.h"
|
||||
#include "closedtabsmanager.h"
|
||||
#include "tabwidget.h"
|
||||
#include "history.h"
|
||||
#include "qzsettings.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QWebHistory>
|
||||
#include <QSqlQuery>
|
||||
|
||||
static QKeySequence actionShortcut(QKeySequence shortcut, QKeySequence fallback, QKeySequence shortcutRTL, QKeySequence fallbackRTL)
|
||||
{
|
||||
if (QApplication::isRightToLeft() && (!shortcutRTL.isEmpty() || !fallbackRTL.isEmpty())) {
|
||||
return (shortcutRTL.isEmpty() ? fallbackRTL : shortcutRTL);
|
||||
}
|
||||
|
||||
return (shortcut.isEmpty() ? fallback : shortcut);
|
||||
}
|
||||
|
||||
static QString truncatedTitle(const QString &title)
|
||||
{
|
||||
if (title.length() > 40) {
|
||||
return title.left(40) + QLatin1String("..");
|
||||
}
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
HistoryMenu::HistoryMenu(QWidget* parent)
|
||||
: Menu(parent)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
void HistoryMenu::setMainWindow(BrowserWindow* window)
|
||||
{
|
||||
m_window = window;
|
||||
}
|
||||
|
||||
void HistoryMenu::goBack()
|
||||
{
|
||||
if (m_window) {
|
||||
m_window->goBack();
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryMenu::goForward()
|
||||
{
|
||||
if (m_window) {
|
||||
m_window->goForward();
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryMenu::goHome()
|
||||
{
|
||||
if (m_window) {
|
||||
m_window->goHome();
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryMenu::showHistoryManager()
|
||||
{
|
||||
if (m_window) {
|
||||
m_window->showHistoryManager();
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryMenu::aboutToShow()
|
||||
{
|
||||
// Set enabled states for Back/Forward actions according to current WebView
|
||||
TabbedWebView* view = m_window->weView();
|
||||
|
||||
if (view) {
|
||||
actions().at(0)->setEnabled(view->history()->canGoBack());
|
||||
actions().at(1)->setEnabled(view->history()->canGoForward());
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryMenu::aboutToHide()
|
||||
{
|
||||
// Enable Back/Forward actions to ensure shortcuts are working
|
||||
actions().at(0)->setEnabled(true);
|
||||
actions().at(1)->setEnabled(true);
|
||||
}
|
||||
|
||||
void HistoryMenu::aboutToShowRecentlyVisited()
|
||||
{
|
||||
m_menuRecentlyVisited->clear();
|
||||
|
||||
QSqlQuery query;
|
||||
query.exec("SELECT title, url FROM history ORDER BY date DESC LIMIT 15");
|
||||
|
||||
while (query.next()) {
|
||||
const QUrl url = query.value(1).toUrl();
|
||||
const QString title = truncatedTitle(query.value(0).toString());
|
||||
|
||||
Action* act = new Action(_iconForUrl(url), title);
|
||||
act->setData(url);
|
||||
connect(act, SIGNAL(triggered()), this, SLOT(historyEntryActivated()));
|
||||
connect(act, SIGNAL(ctrlTriggered()), this, SLOT(historyEntryCtrlActivated()));
|
||||
connect(act, SIGNAL(shiftTriggered()), this, SLOT(historyEntryShiftActivated()));
|
||||
m_menuRecentlyVisited->addAction(act);
|
||||
}
|
||||
|
||||
if (m_menuRecentlyVisited->isEmpty()) {
|
||||
m_menuRecentlyVisited->addAction(tr("Empty"))->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryMenu::aboutToShowMostVisited()
|
||||
{
|
||||
m_menuMostVisited->clear();
|
||||
|
||||
const QVector<HistoryEntry> mostVisited = mApp->history()->mostVisited(10);
|
||||
|
||||
foreach (const HistoryEntry &entry, mostVisited) {
|
||||
Action* act = new Action(_iconForUrl(entry.url), truncatedTitle(entry.title));
|
||||
act->setData(entry.url);
|
||||
connect(act, SIGNAL(triggered()), this, SLOT(historyEntryActivated()));
|
||||
connect(act, SIGNAL(ctrlTriggered()), this, SLOT(historyEntryCtrlActivated()));
|
||||
connect(act, SIGNAL(shiftTriggered()), this, SLOT(historyEntryShiftActivated()));
|
||||
m_menuMostVisited->addAction(act);
|
||||
}
|
||||
|
||||
if (m_menuMostVisited->isEmpty()) {
|
||||
m_menuMostVisited->addAction(tr("Empty"))->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryMenu::aboutToShowClosedTabs()
|
||||
{
|
||||
m_menuClosedTabs->clear();
|
||||
|
||||
if (!m_window) {
|
||||
return;
|
||||
}
|
||||
|
||||
TabWidget* tabWidget = m_window->tabWidget();
|
||||
const QLinkedList<ClosedTabsManager::Tab> closedTabs = tabWidget->closedTabsManager()->allClosedTabs();
|
||||
int i = 0;
|
||||
|
||||
foreach (const ClosedTabsManager::Tab &tab, closedTabs) {
|
||||
const QString title = truncatedTitle(tab.title);
|
||||
QAction* act = m_menuClosedTabs->addAction(_iconForUrl(tab.url), title, tabWidget, SLOT(restoreClosedTab()));
|
||||
act->setData(i++);
|
||||
}
|
||||
|
||||
m_menuClosedTabs->addSeparator();
|
||||
|
||||
if (m_menuClosedTabs->isEmpty()) {
|
||||
m_menuClosedTabs->addAction(tr("Empty"))->setEnabled(false);
|
||||
}
|
||||
else {
|
||||
m_menuClosedTabs->addAction(tr("Restore All Closed Tabs"), tabWidget, SLOT(restoreAllClosedTabs()));
|
||||
m_menuClosedTabs->addAction(tr("Clear list"), tabWidget, SLOT(clearClosedTabsList()));
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryMenu::historyEntryActivated()
|
||||
{
|
||||
if (QAction* action = qobject_cast<QAction*>(sender())) {
|
||||
openUrl(action->data().toUrl());
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryMenu::historyEntryCtrlActivated()
|
||||
{
|
||||
if (QAction* action = qobject_cast<QAction*>(sender())) {
|
||||
openUrlInNewTab(action->data().toUrl());
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryMenu::historyEntryShiftActivated()
|
||||
{
|
||||
if (QAction* action = qobject_cast<QAction*>(sender())) {
|
||||
openUrlInNewWindow(action->data().toUrl());
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryMenu::openUrl(const QUrl &url)
|
||||
{
|
||||
if (m_window) {
|
||||
m_window->loadAddress(url);
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryMenu::openUrlInNewTab(const QUrl &url)
|
||||
{
|
||||
if (m_window) {
|
||||
m_window->tabWidget()->addView(url, qzSettings->newTabPosition);
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryMenu::openUrlInNewWindow(const QUrl &url)
|
||||
{
|
||||
mApp->makeNewWindow(Qz::BW_NewWindow, url);
|
||||
}
|
||||
|
||||
void HistoryMenu::init()
|
||||
{
|
||||
setTitle(tr("Hi&story"));
|
||||
|
||||
QAction* act = addAction(qIconProvider->standardIcon(QStyle::SP_ArrowBack), tr("&Back"), this, SLOT(goBack()));
|
||||
act->setShortcut(actionShortcut(QKeySequence::Back, Qt::ALT + Qt::Key_Left, QKeySequence::Forward, Qt::ALT + Qt::Key_Right));
|
||||
|
||||
act = addAction(qIconProvider->standardIcon(QStyle::SP_ArrowForward), tr("&Forward"), this, SLOT(goForward()));
|
||||
act->setShortcut(actionShortcut(QKeySequence::Forward, Qt::ALT + Qt::Key_Right, QKeySequence::Back, Qt::ALT + Qt::Key_Left));
|
||||
|
||||
act = addAction(qIconProvider->fromTheme("go-home"), tr("&Home"), this, SLOT(goHome()));
|
||||
act->setShortcut(QKeySequence(Qt::ALT + Qt::Key_Home));
|
||||
|
||||
act = addAction(QIcon::fromTheme("view-history", QIcon(":/icons/menu/history.png")), tr("Show &All History"), this, SLOT(showHistoryManager()));
|
||||
act->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_H));
|
||||
|
||||
addSeparator();
|
||||
|
||||
connect(this, SIGNAL(aboutToShow()), this, SLOT(aboutToShow()));
|
||||
connect(this, SIGNAL(aboutToHide()), this, SLOT(aboutToHide()));
|
||||
|
||||
m_menuRecentlyVisited = new Menu(tr("Recently Visited"), this);
|
||||
connect(m_menuRecentlyVisited, SIGNAL(aboutToShow()), this, SLOT(aboutToShowRecentlyVisited()));
|
||||
|
||||
m_menuMostVisited = new Menu(tr("Most Visited"), this);
|
||||
connect(m_menuMostVisited, SIGNAL(aboutToShow()), this, SLOT(aboutToShowMostVisited()));
|
||||
|
||||
m_menuClosedTabs = new Menu(tr("Closed Tabs"));
|
||||
connect(m_menuClosedTabs, SIGNAL(aboutToShow()), this, SLOT(aboutToShowClosedTabs()));
|
||||
|
||||
addMenu(m_menuRecentlyVisited);
|
||||
addMenu(m_menuMostVisited);
|
||||
addMenu(m_menuClosedTabs);
|
||||
}
|
69
src/lib/history/historymenu.h
Normal file
69
src/lib/history/historymenu.h
Normal file
@ -0,0 +1,69 @@
|
||||
/* ============================================================
|
||||
* QupZilla - WebKit based browser
|
||||
* Copyright (C) 2014 David Rosca <nowrep@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* ============================================================ */
|
||||
#ifndef HISTORYMENU_H
|
||||
#define HISTORYMENU_H
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
#include "enhancedmenu.h"
|
||||
#include "qzcommon.h"
|
||||
|
||||
class BrowserWindow;
|
||||
|
||||
class QUPZILLA_EXPORT HistoryMenu : public Menu
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit HistoryMenu(QWidget* parent = 0);
|
||||
|
||||
void setMainWindow(BrowserWindow* window);
|
||||
|
||||
signals:
|
||||
|
||||
private slots:
|
||||
void goBack();
|
||||
void goForward();
|
||||
void goHome();
|
||||
void showHistoryManager();
|
||||
|
||||
void aboutToShow();
|
||||
void aboutToHide();
|
||||
|
||||
void aboutToShowRecentlyVisited();
|
||||
void aboutToShowMostVisited();
|
||||
void aboutToShowClosedTabs();
|
||||
|
||||
void historyEntryActivated();
|
||||
void historyEntryCtrlActivated();
|
||||
void historyEntryShiftActivated();
|
||||
|
||||
void openUrl(const QUrl &url);
|
||||
void openUrlInNewTab(const QUrl &url);
|
||||
void openUrlInNewWindow(const QUrl &url);
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
||||
QPointer<BrowserWindow> m_window;
|
||||
Menu* m_menuRecentlyVisited;
|
||||
Menu* m_menuMostVisited;
|
||||
Menu* m_menuClosedTabs;
|
||||
};
|
||||
|
||||
#endif // HISTORYMENU_H
|
@ -257,7 +257,8 @@ SOURCES += \
|
||||
bookmarks/bookmarksexport/bookmarksexporter.cpp \
|
||||
bookmarks/bookmarksexport/bookmarksexportdialog.cpp \
|
||||
bookmarks/bookmarksexport/htmlexporter.cpp \
|
||||
app/browserwindow.cpp
|
||||
app/browserwindow.cpp \
|
||||
history/historymenu.cpp
|
||||
|
||||
|
||||
HEADERS += \
|
||||
@ -455,7 +456,8 @@ HEADERS += \
|
||||
bookmarks/bookmarksexport/bookmarksexportdialog.h \
|
||||
bookmarks/bookmarksexport/htmlexporter.h \
|
||||
app/browserwindow.h \
|
||||
app/qzcommon.h
|
||||
app/qzcommon.h \
|
||||
history/historymenu.h
|
||||
|
||||
FORMS += \
|
||||
preferences/autofillmanager.ui \
|
||||
|
Loading…
Reference in New Issue
Block a user