1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

TabContextMenu: Add Load Tab action

This commit is contained in:
David Rosca 2018-01-28 21:53:38 +01:00
parent 13e81d0b21
commit b5d872f64e
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
4 changed files with 16 additions and 1 deletions

View File

@ -44,6 +44,7 @@ TabContextMenu::TabContextMenu(int index, Qt::Orientation orientation, BrowserWi
connect(this, SIGNAL(closeToRight(int)), m_tabWidget, SLOT(closeToRight(int)));
connect(this, SIGNAL(closeToLeft(int)), m_tabWidget, SLOT(closeToLeft(int)));
connect(this, SIGNAL(duplicateTab(int)), m_tabWidget, SLOT(duplicateTab(int)));
connect(this, SIGNAL(loadTab(int)), m_tabWidget, SLOT(loadTab(int)));
connect(this, SIGNAL(unloadTab(int)), m_tabWidget, SLOT(unloadTab(int)));
init();
@ -123,7 +124,9 @@ void TabContextMenu::init()
addAction(webTab->isPinned() ? tr("Un&pin Tab") : tr("&Pin Tab"), this, SLOT(pinTab()));
addAction(webTab->isMuted() ? tr("Un&mute Tab") : tr("&Mute Tab"), this, SLOT(muteTab()));
if (webTab->isRestored()) {
if (!webTab->isRestored()) {
addAction(tr("Load Tab"), this, SLOT(loadTab()));
} else {
addAction(tr("Unload Tab"), this, SLOT(unloadTab()));
}

View File

@ -39,6 +39,7 @@ signals:
void closeToRight(int index);
void closeToLeft(int index);
void duplicateTab(int index);
void loadTab(int index);
void unloadTab(int index);
private slots:
@ -46,6 +47,7 @@ private slots:
void stopTab() { emit stopTab(m_clickedTab); }
void closeTab() { emit tabCloseRequested(m_clickedTab); }
void duplicateTab() { emit duplicateTab(m_clickedTab); }
void loadTab() { emit loadTab(m_clickedTab); }
void unloadTab() { emit unloadTab(m_clickedTab); }
void pinTab();

View File

@ -672,6 +672,15 @@ int TabWidget::duplicateTab(int index)
return id;
}
void TabWidget::loadTab(int index)
{
if (!validIndex(index)) {
return;
}
weTab(index)->tabActivated();
}
void TabWidget::unloadTab(int index)
{
if (!validIndex(index)) {

View File

@ -116,6 +116,7 @@ public slots:
void closeToRight(int index);
void closeToLeft(int index);
void detachTab(int index);
void loadTab(int index);
void unloadTab(int index);
void restoreClosedTab(QObject* obj = 0);
void restoreAllClosedTabs();