mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
History menu submenus for recently visited and most visited
This commit is contained in:
parent
79762d8b41
commit
4a4111161c
@ -458,6 +458,12 @@ void QupZilla::setupMenu()
|
|||||||
m_menuClosedTabs = new QMenu(tr("Closed Tabs"));
|
m_menuClosedTabs = new QMenu(tr("Closed Tabs"));
|
||||||
connect(m_menuClosedTabs, SIGNAL(aboutToShow()), this, SLOT(aboutToShowClosedTabsMenu()));
|
connect(m_menuClosedTabs, SIGNAL(aboutToShow()), this, SLOT(aboutToShowClosedTabsMenu()));
|
||||||
|
|
||||||
|
m_menuHistoryRecent = new QMenu(tr("Recently Visited"));
|
||||||
|
connect(m_menuHistoryRecent, SIGNAL(aboutToShow()), this, SLOT(aboutToShowHistoryRecentMenu()));
|
||||||
|
|
||||||
|
m_menuHistoryMost = new QMenu(tr("Most Visited"));
|
||||||
|
connect(m_menuHistoryMost, SIGNAL(aboutToShow()), this, SLOT(aboutToShowHistoryMostMenu()));
|
||||||
|
|
||||||
aboutToShowToolsMenu();
|
aboutToShowToolsMenu();
|
||||||
aboutToShowHelpMenu();
|
aboutToShowHelpMenu();
|
||||||
|
|
||||||
@ -761,25 +767,8 @@ void QupZilla::aboutToShowHistoryMenu(bool loadHistory)
|
|||||||
m_menuHistory->addAction(QIcon(":/icons/menu/history.png"), tr("Show &All History"), this, SLOT(showHistoryManager()))->setShortcut(QKeySequence("Ctrl+Shift+H"));
|
m_menuHistory->addAction(QIcon(":/icons/menu/history.png"), tr("Show &All History"), this, SLOT(showHistoryManager()))->setShortcut(QKeySequence("Ctrl+Shift+H"));
|
||||||
m_menuHistory->addSeparator();
|
m_menuHistory->addSeparator();
|
||||||
|
|
||||||
if (loadHistory) {
|
m_menuHistory->addMenu(m_menuHistoryRecent);
|
||||||
QSqlQuery query;
|
m_menuHistory->addMenu(m_menuHistoryMost);
|
||||||
query.exec("SELECT title, url FROM history ORDER BY date DESC LIMIT 10");
|
|
||||||
while (query.next()) {
|
|
||||||
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()), this, SLOT(loadActionUrl()));
|
|
||||||
connect(act, SIGNAL(middleClicked()), this, SLOT(loadActionUrlInNewNotSelectedTab()));
|
|
||||||
m_menuHistory->addAction(act);
|
|
||||||
}
|
|
||||||
m_menuHistory->addSeparator();
|
|
||||||
}
|
|
||||||
m_menuHistory->addMenu(m_menuClosedTabs);
|
m_menuHistory->addMenu(m_menuClosedTabs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -816,6 +805,58 @@ void QupZilla::aboutToShowClosedTabsMenu()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QupZilla::aboutToShowHistoryRecentMenu()
|
||||||
|
{
|
||||||
|
m_menuHistoryRecent->clear();
|
||||||
|
QSqlQuery query;
|
||||||
|
if (query.isNull(false)) {
|
||||||
|
query.exec("SELECT title, url FROM history ORDER BY date DESC LIMIT 15");
|
||||||
|
while (query.next()) {
|
||||||
|
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()), this, SLOT(loadActionUrl()));
|
||||||
|
connect(act, SIGNAL(middleClicked()), this, SLOT(loadActionUrlInNewNotSelectedTab()));
|
||||||
|
m_menuHistoryRecent->addAction(act);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_menuHistoryRecent->addAction(tr("Empty"))->setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QupZilla::aboutToShowHistoryMostMenu()
|
||||||
|
{
|
||||||
|
m_menuHistoryMost->clear();
|
||||||
|
QSqlQuery query;
|
||||||
|
if (query.isNull(false)) {
|
||||||
|
query.exec("SELECT title, url FROM history ORDER BY count DESC LIMIT 15");
|
||||||
|
while (query.next()) {
|
||||||
|
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()), this, SLOT(loadActionUrl()));
|
||||||
|
connect(act, SIGNAL(middleClicked()), this, SLOT(loadActionUrlInNewNotSelectedTab()));
|
||||||
|
m_menuHistoryMost->addAction(act);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_menuHistoryMost->addAction(tr("Empty"))->setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void QupZilla::aboutToShowHelpMenu()
|
void QupZilla::aboutToShowHelpMenu()
|
||||||
{
|
{
|
||||||
m_menuHelp->clear();
|
m_menuHelp->clear();
|
||||||
|
@ -178,6 +178,8 @@ private slots:
|
|||||||
void showNavigationToolbar();
|
void showNavigationToolbar();
|
||||||
void showStatusbar();
|
void showStatusbar();
|
||||||
void showClearPrivateData();
|
void showClearPrivateData();
|
||||||
|
void aboutToShowHistoryRecentMenu();
|
||||||
|
void aboutToShowHistoryMostMenu();
|
||||||
void showPreferences();
|
void showPreferences();
|
||||||
void showBookmarkImport();
|
void showBookmarkImport();
|
||||||
|
|
||||||
@ -233,6 +235,8 @@ private:
|
|||||||
Menu* m_menuBookmarks;
|
Menu* m_menuBookmarks;
|
||||||
Menu* m_menuHistory;
|
Menu* m_menuHistory;
|
||||||
QMenu* m_menuClosedTabs;
|
QMenu* m_menuClosedTabs;
|
||||||
|
QMenu* m_menuHistoryRecent;
|
||||||
|
QMenu* m_menuHistoryMost;
|
||||||
QMenu* m_menuEncoding;
|
QMenu* m_menuEncoding;
|
||||||
QAction* m_menuBookmarksAction;
|
QAction* m_menuBookmarksAction;
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
|
Loading…
Reference in New Issue
Block a user