diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2012-11-11 09:40:36 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2012-12-10 02:48:06 +0100 |
commit | 4f1dae7834becb7d7105a0cc9945d9a0c04383b8 (patch) | |
tree | be823d81fe7ab1cc199b11bc5b32823d3cc9bdf7 /src/tabwindow/tabbar.cpp | |
parent | Clean up previous commit about adblock and fix enable/disable feature (diff) | |
download | rekonq-4f1dae7834becb7d7105a0cc9945d9a0c04383b8.tar.xz |
WARNING: BIG COMMIT
This commit reviews and partially fix the Q/K action mess
in rekonq code.
We now store actions in different actioncollections
(one for each tab && one for each window).
Related to this code review, you can find also fixes for
some triggered actions NOT working (well) before:
- fullscreen
- bookmark all tabs
- new (clean) tab
Diffstat (limited to 'src/tabwindow/tabbar.cpp')
-rw-r--r-- | src/tabwindow/tabbar.cpp | 49 |
1 files changed, 17 insertions, 32 deletions
diff --git a/src/tabwindow/tabbar.cpp b/src/tabwindow/tabbar.cpp index 725d1372..70dcd3b1 100644 --- a/src/tabwindow/tabbar.cpp +++ b/src/tabwindow/tabbar.cpp @@ -177,56 +177,55 @@ void TabBar::detachTab() } -void TabBar::contextMenu(int tab, const QPoint &pos) +void TabBar::contextMenu(int tabIndex, const QPoint &pos) { TabWindow *w = qobject_cast<TabWindow *>(parent()); - KAction *a; + QAction *a; KMenu menu; - a = new KAction(KIcon("tab-new"), i18n("New &Tab"), this); - connect(a, SIGNAL(triggered(bool)), w, SLOT(newCleanTab())); + a = w->actionByName(QL1S("new_tab")); menu.addAction(a); menu.addSeparator(); // ---------------------------------------------------------------- a = new KAction(KIcon("tab-duplicate"), i18n("Clone"), this); - a->setData(tab); + a->setData(tabIndex); connect(a, SIGNAL(triggered(bool)), this, SLOT(cloneTab())); menu.addAction(a); a = new KAction(KIcon("view-refresh"), i18n("Reload"), this); connect(a, SIGNAL(triggered(bool)), this, SLOT(reloadTab())); - a->setData(tab); + a->setData(tabIndex); menu.addAction(a); if (count() > 1) { a = new KAction(KIcon("tab-detach"), i18n("Detach"), this); connect(a, SIGNAL(triggered(bool)), this, SLOT(detachTab())); - a->setData(tab); + a->setData(tabIndex); menu.addAction(a); } - if (tabData(tab).toBool()) + if (tabData(tabIndex).toBool()) { a = new KAction(i18n("Unpin Tab"), this); connect(a, SIGNAL(triggered(bool)), this, SLOT(unpinTab())); - a->setData(tab); + a->setData(tabIndex); menu.addAction(a); } else { a = new KAction(i18n("Pin Tab"), this); connect(a, SIGNAL(triggered(bool)), this, SLOT(pinTab())); - a->setData(tab); + a->setData(tabIndex); menu.addAction(a); } menu.addSeparator(); // ---------------------------------------------------------------- a = new KAction(KIcon("tab-close"), i18n("&Close"), this); - a->setData(tab); + a->setData(tabIndex); connect(a, SIGNAL(triggered(bool)), this, SLOT(closeTab())); menu.addAction(a); @@ -234,26 +233,19 @@ void TabBar::contextMenu(int tab, const QPoint &pos) { a = new KAction(KIcon("tab-close-other"), i18n("Close &Other Tabs"), this); connect(a, SIGNAL(triggered(bool)), this, SLOT(closeOtherTabs())); - a->setData(tab); + a->setData(tabIndex); menu.addAction(a); } menu.addSeparator(); - a = new KAction(KIcon("tab-new"), i18n("Open Last Closed Tab"), this); - a->setData(0); // last closed tab has index 0! - connect(a, SIGNAL(triggered(bool)), this, SIGNAL(restoreLastClosedTab())); + a = w->actionByName(QL1S("open_last_closed_tab")); menu.addAction(a); if (count() > 1) { - a = new KAction(KIcon("bookmark-new"), i18n("Bookmarks all tabs"), this); - menu.addAction(a); - } - else - { - a = new KAction(KIcon("bookmark-new"), i18n("Bookmark"), this); + a = w->actionByName(QL1S("bookmark_all_tabs")); menu.addAction(a); } @@ -265,26 +257,19 @@ void TabBar::emptyAreaContextMenu(const QPoint &pos) { TabWindow *w = qobject_cast<TabWindow *>(parent()); - KAction *a; + QAction *a; KMenu menu; - a = new KAction(KIcon("tab-new"), i18n("New &Tab"), this); - connect(a, SIGNAL(triggered(bool)), w, SLOT(newCleanTab())); + a = w->actionByName(QL1S("new_tab")); menu.addAction(a); - a = new KAction(KIcon("tab-new"), i18n("Open Last Closed Tab"), this); - a->setData(0); // last closed tab has index 0! + a = w->actionByName(QL1S("open_last_closed_tab")); menu.addAction(a); if (count() > 1) { - a = new KAction(KIcon("bookmark-new"), i18n("Bookmarks all tabs"), this); - menu.addAction(a); - } - else - { - a = new KAction(KIcon("bookmark-new"), i18n("Bookmark"), this); + a = w->actionByName(QL1S("bookmark_all_tabs")); menu.addAction(a); } |