VerticalTabs: Show detach tab action in context menu

It's not possible to detach tabs by dragging them to empty space
as with main tabbar.
remotes/origin/Falkon/3.0
David Rosca 8 years ago
parent 06e4ef4a58
commit 802e447c0c
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
  1. 5
      src/lib/tabwidget/tabcontextmenu.cpp
  2. 5
      src/lib/tabwidget/tabcontextmenu.h
  3. 3
      src/plugins/VerticalTabs/tablistview.cpp
  4. 2
      src/plugins/VerticalTabs/tabtreeview.cpp

@ -43,6 +43,7 @@ TabContextMenu::TabContextMenu(int index, BrowserWindow *window, Options options
connect(this, SIGNAL(closeToRight(int)), tabWidget, SLOT(closeToRight(int)));
connect(this, SIGNAL(closeToLeft(int)), tabWidget, SLOT(closeToLeft(int)));
connect(this, SIGNAL(duplicateTab(int)), tabWidget, SLOT(duplicateTab(int)));
connect(this, SIGNAL(detachTab(int)), tabWidget, SLOT(detachTab(int)));
connect(this, SIGNAL(loadTab(int)), tabWidget, SLOT(loadTab(int)));
connect(this, SIGNAL(unloadTab(int)), tabWidget, SLOT(unloadTab(int)));
@ -121,6 +122,10 @@ void TabContextMenu::init()
addAction(QIcon::fromTheme("tab-duplicate"), tr("&Duplicate Tab"), this, SLOT(duplicateTab()));
if (m_options & ShowDetachTabAction && (mApp->windowCount() > 1 || tabWidget->count() > 1)) {
addAction(QIcon::fromTheme("tab-detach"), tr("D&etach Tab"), this, SLOT(detachTab()));
}
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()));

@ -35,6 +35,7 @@ public:
HorizontalTabs = 1 << 0,
VerticalTabs = 1 << 1,
ShowCloseOtherTabsActions = 1 << 2,
ShowDetachTabAction = 1 << 3,
DefaultOptions = HorizontalTabs | ShowCloseOtherTabsActions
};
@ -50,6 +51,7 @@ signals:
void closeToRight(int index);
void closeToLeft(int index);
void duplicateTab(int index);
void detachTab(int index);
void loadTab(int index);
void unloadTab(int index);
@ -58,6 +60,7 @@ private slots:
void stopTab() { emit stopTab(m_clickedTab); }
void closeTab() { emit tabCloseRequested(m_clickedTab); }
void duplicateTab() { emit duplicateTab(m_clickedTab); }
void detachTab() { emit detachTab(m_clickedTab); }
void loadTab() { emit loadTab(m_clickedTab); }
void unloadTab() { emit unloadTab(m_clickedTab); }
@ -76,4 +79,6 @@ private:
Options m_options = InvalidOption;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(TabContextMenu::Options)
#endif // TABCONTEXTMENU_H

@ -208,7 +208,8 @@ bool TabListView::viewportEvent(QEvent *event)
const QModelIndex index = indexAt(ce->pos());
WebTab *tab = index.data(TabModel::WebTabRole).value<WebTab*>();
const int tabIndex = tab ? tab->tabIndex() : -1;
TabContextMenu menu(tabIndex, m_window, TabContextMenu::HorizontalTabs);
TabContextMenu::Options options = TabContextMenu::HorizontalTabs | TabContextMenu::ShowDetachTabAction;
TabContextMenu menu(tabIndex, m_window, options);
menu.exec(ce->globalPos());
break;
}

@ -304,7 +304,7 @@ bool TabTreeView::viewportEvent(QEvent *event)
const QModelIndex index = indexAt(ce->pos());
WebTab *tab = index.data(TabModel::WebTabRole).value<WebTab*>();
const int tabIndex = tab ? tab->tabIndex() : -1;
TabContextMenu::Options options = TabContextMenu::VerticalTabs;
TabContextMenu::Options options = TabContextMenu::VerticalTabs | TabContextMenu::ShowDetachTabAction;
if (m_tabsInOrder) {
options |= TabContextMenu::ShowCloseOtherTabsActions;
}

Loading…
Cancel
Save