summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-01-17 11:20:50 +0100
committerAndrea Diamantini <adjam7@gmail.com>2012-01-17 11:20:50 +0100
commit71af427f0e43589997b1da85b2d77074c564cfaa (patch)
treed9a48aedf00045b6d3f3bd309f592e356e74aa5b /src
parentCheck if action senders exist before using them (diff)
downloadrekonq-71af427f0e43589997b1da85b2d77074c564cfaa.tar.xz
Remove "closed tabs menu" from available actions in mainwindow
This because it is just a "working" action designed for the tabbar. Now it works (and updates) properly there and in the tabbar empty space. Please open a new wish if you want a closed tabs menu action to add to the mainwindow BUG:291232
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cpp6
-rw-r--r--src/tabbar.cpp24
-rw-r--r--src/tabbar.h6
-rw-r--r--src/webtab.h2
4 files changed, 20 insertions, 18 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index f2ee25be..87b92a70 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -114,6 +114,7 @@ MainWindow::MainWindow()
, m_loadStopReloadAction(0)
, m_historyBackMenu(0)
, m_historyForwardMenu(0)
+ , m_tabListMenu(0)
, m_bookmarksBar(0)
, m_popup(new QLabel(this))
, m_hidePopupTimer(new QTimer(this))
@@ -458,11 +459,6 @@ void MainWindow::setupActions()
actionCollection()->addAction(QL1S("open_last_closed_tab"), a);
connect(a, SIGNAL(triggered(bool)), m_view, SLOT(openClosedTab()));
- // Closed Tabs Menu
- KActionMenu *closedTabsMenu = new KActionMenu(KIcon("tab-new"), i18n("Closed Tabs"), this);
- closedTabsMenu->setDelayed(false);
- actionCollection()->addAction(QL1S("closed_tab_menu"), closedTabsMenu);
-
// shortcuts for quickly switching to a tab
QSignalMapper *tabSignalMapper = new QSignalMapper(this);
for (int i = 1; i <= 9; i++)
diff --git a/src/tabbar.cpp b/src/tabbar.cpp
index 4834095a..c0cfa896 100644
--- a/src/tabbar.cpp
+++ b/src/tabbar.cpp
@@ -304,7 +304,7 @@ void TabBar::mousePressEvent(QMouseEvent *event)
void TabBar::contextMenu(int tab, const QPoint &pos)
{
- setupHistoryActions();
+ KActionMenu *closedTabsMenu = setupHistoryActions();
m_actualIndex = tab;
@@ -318,7 +318,7 @@ void TabBar::contextMenu(int tab, const QPoint &pos)
menu.addAction(mainWindow->actionByName(QL1S("detach_tab")));
}
menu.addAction(mainWindow->actionByName(QL1S("open_last_closed_tab")));
- menu.addAction(mainWindow->actionByName(QL1S("closed_tab_menu")));
+ menu.addAction(closedTabsMenu);
menu.addSeparator();
menu.addAction(mainWindow->actionByName(QL1S("close_tab")));
if (count() > 1)
@@ -337,14 +337,14 @@ void TabBar::contextMenu(int tab, const QPoint &pos)
void TabBar::emptyAreaContextMenu(const QPoint &pos)
{
- setupHistoryActions();
+ KActionMenu *closedTabsMenu = setupHistoryActions();
KMenu menu;
MainWindow *mainWindow = rApp->mainWindow();
menu.addAction(mainWindow->actionByName(QL1S("new_tab")));
menu.addAction(mainWindow->actionByName(QL1S("open_last_closed_tab")));
- menu.addAction(mainWindow->actionByName(QL1S("closed_tab_menu")));
+ menu.addAction(closedTabsMenu);
menu.addSeparator();
menu.addAction(mainWindow->actionByName(QL1S("reload_all_tabs")));
@@ -374,7 +374,7 @@ void TabBar::tabRemoved(int index)
}
-void TabBar::setupHistoryActions()
+KActionMenu *TabBar::setupHistoryActions()
{
MainWindow *w = rApp->mainWindow();
MainView *mv = qobject_cast<MainView *>(parent());
@@ -384,18 +384,15 @@ void TabBar::setupHistoryActions()
bool closedTabsAvailable = (mv->recentlyClosedTabs().size() > 0);
openLastClosedTabAction->setEnabled(closedTabsAvailable);
- // update closed tabs menu
- KActionMenu *am = qobject_cast<KActionMenu *>(w->actionByName(QL1S("closed_tab_menu")));
- if (!am)
- return;
-
+ KActionMenu *am = new KActionMenu(KIcon("tab-new"), i18n("Closed Tabs"), this);
+ am->setDelayed(false);
am->setEnabled(closedTabsAvailable);
if (am->menu())
am->menu()->clear();
if (!closedTabsAvailable)
- return;
+ return am;
for (int i = 0; i < mv->recentlyClosedTabs().count(); ++i)
{
@@ -405,6 +402,8 @@ void TabBar::setupHistoryActions()
connect(a, SIGNAL(triggered()), mv, SLOT(openClosedTab()));
am->addAction(a);
}
+
+ return am;
}
@@ -491,6 +490,7 @@ void TabBar::setAnimatedTabHighlighting(bool enabled)
}
}
+
void TabBar::dropEvent(QDropEvent* event)
{
if (event->mimeData()->hasUrls())
@@ -519,6 +519,7 @@ void TabBar::dropEvent(QDropEvent* event)
KTabBar::dropEvent(event);
}
+
void TabBar::dragEnterEvent(QDragEnterEvent* event)
{
if (event->mimeData()->hasUrls() || event->mimeData()->hasText())
@@ -527,6 +528,7 @@ void TabBar::dragEnterEvent(QDragEnterEvent* event)
KTabBar::dragEnterEvent(event);
}
+
bool TabBar::isURLValid(const QString &url)
{
QString editedURL = url;
diff --git a/src/tabbar.h b/src/tabbar.h
index c536039b..3e29b248 100644
--- a/src/tabbar.h
+++ b/src/tabbar.h
@@ -43,6 +43,9 @@
// Forward Declarations
class TabPreviewPopup;
class TabHighlightEffect;
+
+class KActionMenu;
+
class QPropertyAnimation;
@@ -107,7 +110,8 @@ private Q_SLOTS:
bool isURLValid(const QString &url);
private:
- void setupHistoryActions();
+ KActionMenu *setupHistoryActions();
+
friend class MainView;
/**
diff --git a/src/webtab.h b/src/webtab.h
index 0ba17d9e..ccbd7a83 100644
--- a/src/webtab.h
+++ b/src/webtab.h
@@ -98,7 +98,7 @@ public:
private Q_SLOTS:
void updateProgress(int progress);
void resetProgress();
-
+
void createWalletBar(const QString &, const QUrl &);
void showRSSInfo(const QPoint &pos);
void showSearchEngine(const QPoint &pos);