mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
Merge branch 'master' of https://github.com/pejakm/QupZilla into pejakm-master
This commit is contained in:
commit
08dae0e4ce
@ -458,6 +458,12 @@ void QupZilla::setupMenu()
|
||||
m_menuClosedTabs = new QMenu(tr("Closed Tabs"));
|
||||
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();
|
||||
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->addSeparator();
|
||||
|
||||
if (loadHistory) {
|
||||
QSqlQuery query;
|
||||
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_menuHistoryRecent);
|
||||
m_menuHistory->addMenu(m_menuHistoryMost);
|
||||
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()
|
||||
{
|
||||
m_menuHelp->clear();
|
||||
|
@ -178,6 +178,8 @@ private slots:
|
||||
void showNavigationToolbar();
|
||||
void showStatusbar();
|
||||
void showClearPrivateData();
|
||||
void aboutToShowHistoryRecentMenu();
|
||||
void aboutToShowHistoryMostMenu();
|
||||
void showPreferences();
|
||||
void showBookmarkImport();
|
||||
|
||||
@ -233,6 +235,8 @@ private:
|
||||
Menu* m_menuBookmarks;
|
||||
Menu* m_menuHistory;
|
||||
QMenu* m_menuClosedTabs;
|
||||
QMenu* m_menuHistoryRecent;
|
||||
QMenu* m_menuHistoryMost;
|
||||
QMenu* m_menuEncoding;
|
||||
QAction* m_menuBookmarksAction;
|
||||
#ifdef Q_WS_MAC
|
||||
|
@ -194,6 +194,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
|
||||
ui->activateLastTab->setChecked(settings.value("ActivateLastTabWhenClosingActual", false).toBool());
|
||||
ui->dontQuitOnTab->setChecked(settings.value("dontQuitWithOneTab", false).toBool());
|
||||
ui->askWhenClosingMultipleTabs->setChecked(settings.value("AskOnClosing", false).toBool());
|
||||
ui->closedInsteadOpened->setChecked(settings.value("closedInsteadOpenedTabs", false).toBool());
|
||||
settings.endGroup();
|
||||
//AddressBar
|
||||
settings.beginGroup("AddressBar");
|
||||
@ -684,6 +685,7 @@ void Preferences::saveSettings()
|
||||
settings.setValue("ActivateLastTabWhenClosingActual", ui->activateLastTab->isChecked());
|
||||
settings.setValue("dontQuitWithOneTab", ui->dontQuitOnTab->isChecked());
|
||||
settings.setValue("AskOnClosing", ui->askWhenClosingMultipleTabs->isChecked());
|
||||
settings.setValue("closedInsteadOpenedTabs", ui->closedInsteadOpened->isChecked());
|
||||
settings.endGroup();
|
||||
|
||||
//DOWNLOADS
|
||||
|
@ -642,14 +642,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="4">
|
||||
<item row="9" column="0" colspan="4">
|
||||
<widget class="QLabel" name="label_25">
|
||||
<property name="text">
|
||||
<string><b>Address Bar behaviour</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<item row="13" column="1">
|
||||
<spacer name="verticalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@ -662,21 +662,21 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="9" column="1" colspan="3">
|
||||
<item row="10" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="selectAllOnFocus">
|
||||
<property name="text">
|
||||
<string>Select all text by double clicking in address bar</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1" colspan="3">
|
||||
<item row="12" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="addCountryWithAlt">
|
||||
<property name="text">
|
||||
<string>Add .co.uk domain by pressing ALT key</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<item row="8" column="1">
|
||||
<spacer name="verticalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@ -696,7 +696,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1" colspan="3">
|
||||
<item row="11" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="selectAllOnClick">
|
||||
<property name="text">
|
||||
<string>Select all text by clicking in address bar</string>
|
||||
@ -730,6 +730,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QCheckBox" name="closedInsteadOpened">
|
||||
<property name="text">
|
||||
<string>Closed tabs list instead of opened in tab bar</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="stackedWidgetPage4">
|
||||
|
@ -131,7 +131,7 @@ TabWidget::TabWidget(QupZilla* mainClass, QWidget* parent)
|
||||
m_menuTabs = new QMenu(this);
|
||||
m_buttonListTabs->setMenu(m_menuTabs);
|
||||
m_buttonListTabs->setPopupMode(QToolButton::InstantPopup);
|
||||
m_buttonListTabs->setToolTip(tr("Show list of opened tabs"));
|
||||
m_buttonListTabs->setToolTip(tr("List of tabs"));
|
||||
m_buttonListTabs->setAutoRaise(true);
|
||||
m_buttonListTabs->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
@ -142,7 +142,7 @@ TabWidget::TabWidget(QupZilla* mainClass, QWidget* parent)
|
||||
m_buttonAddTab->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
connect(m_buttonAddTab, SIGNAL(clicked()), p_QupZilla, SLOT(addTab()));
|
||||
connect(m_menuTabs, SIGNAL(aboutToShow()), this, SLOT(aboutToShowTabsMenu()));
|
||||
connect(m_menuTabs, SIGNAL(aboutToShow()), this, SLOT(aboutToShowClosedTabsMenu()));
|
||||
|
||||
loadSettings();
|
||||
}
|
||||
@ -153,6 +153,7 @@ void TabWidget::loadSettings()
|
||||
settings.beginGroup("Browser-Tabs-Settings");
|
||||
m_hideTabBarWithOneTab = settings.value("hideTabsWithOneTab", false).toBool();
|
||||
m_dontQuitWithOneTab = settings.value("dontQuitWithOneTab", false).toBool();
|
||||
m_closedInsteadOpened = settings.value("closedInsteadOpenedTabs", false).toBool();
|
||||
settings.endGroup();
|
||||
settings.beginGroup("Web-URL-Settings");
|
||||
m_urlOnNewTab = settings.value("newTabUrl", "qupzilla:speeddial").toUrl();
|
||||
@ -535,6 +536,34 @@ bool TabWidget::canRestoreTab()
|
||||
return m_closedTabsManager->isClosedTabAvailable();
|
||||
}
|
||||
|
||||
void TabWidget::aboutToShowClosedTabsMenu()
|
||||
{
|
||||
if (!m_closedInsteadOpened) {
|
||||
aboutToShowTabsMenu();
|
||||
}
|
||||
else {
|
||||
m_menuTabs->clear();
|
||||
int i = 0;
|
||||
foreach(ClosedTabsManager::Tab tab, this->closedTabsManager()->allClosedTabs()) {
|
||||
QString title = tab.title;
|
||||
if (title.length() > 40) {
|
||||
title.truncate(40);
|
||||
title += "..";
|
||||
}
|
||||
m_menuTabs->addAction(_iconForUrl(tab.url), title, this, SLOT(restoreClosedTab()))->setData(i);
|
||||
i++;
|
||||
}
|
||||
m_menuTabs->addSeparator();
|
||||
if (i == 0) {
|
||||
m_menuTabs->addAction(tr("Empty"))->setEnabled(false);
|
||||
}
|
||||
else {
|
||||
m_menuTabs->addAction(tr("Restore All Closed Tabs"), this, SLOT(restoreAllClosedTabs()));
|
||||
m_menuTabs->addAction(tr("Clear list"), this, SLOT(clearClosedTabsList()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QList<WebTab*> TabWidget::allTabs(bool withPinned)
|
||||
{
|
||||
QList<WebTab*> allTabs;
|
||||
|
@ -84,6 +84,7 @@ public slots:
|
||||
void restoreClosedTab();
|
||||
void restoreAllClosedTabs();
|
||||
void clearClosedTabsList();
|
||||
void aboutToShowClosedTabsMenu();
|
||||
|
||||
void moveAddTabButton(int posX);
|
||||
void showButtons();
|
||||
@ -102,6 +103,7 @@ private:
|
||||
|
||||
bool m_hideTabBarWithOneTab;
|
||||
bool m_dontQuitWithOneTab;
|
||||
bool m_closedInsteadOpened;
|
||||
QUrl m_urlOnNewTab;
|
||||
QupZilla* p_QupZilla;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user