summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mainview.cpp10
-rw-r--r--src/mainwindow.cpp22
-rw-r--r--src/tabbar.cpp37
-rw-r--r--src/tabbar.h2
4 files changed, 48 insertions, 23 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 166c1a1b..a3f56958 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -115,7 +115,7 @@ void MainView::postLaunch()
break;
QString title = line;
QString url = title;
- HistoryItem item(url, QDateTime::currentDateTime(), title);
+ HistoryItem item(url, QDateTime(), title);
m_recentlyClosedTabs.removeAll(item);
m_recentlyClosedTabs.prepend(item);
}
@@ -503,7 +503,7 @@ void MainView::closeTab(int index, bool del)
{
QString title = tab->view()->title();
QString url = tab->url().prettyUrl();
- HistoryItem item(url, QDateTime::currentDateTime(), title);
+ HistoryItem item(url, QDateTime(), title);
m_recentlyClosedTabs.removeAll(item);
m_recentlyClosedTabs.prepend(item);
}
@@ -649,6 +649,7 @@ void MainView::openClosedTabs()
{
Application::instance()->loadUrl( KUrl(item.url), Rekonq::SettingOpenTab);
}
+ m_recentlyClosedTabs.clear();
}
void MainView::openClosedTab()
@@ -657,6 +658,11 @@ void MainView::openClosedTab()
if (action)
{
Application::instance()->loadUrl(action->data().toUrl(), Rekonq::SettingOpenTab);
+
+ QString title = action->text();
+ title = title.remove('&');
+ HistoryItem item(action->data().toString(), QDateTime(), title );
+ m_recentlyClosedTabs.removeAll(item);
}
}
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 90a650cf..2d0ed7dd 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -656,6 +656,7 @@ void MainWindow::preferences()
void MainWindow::updateActions()
{
+ kDebug() << "updating actions..";
bool rekonqPage = currentTab()->page()->isOnRekonqPage();
QAction *historyBackAction = actionByName(KStandardAction::name(KStandardAction::Back));
@@ -666,27 +667,6 @@ void MainWindow::updateActions()
QAction *historyForwardAction = actionByName(KStandardAction::name(KStandardAction::Forward));
historyForwardAction->setEnabled(currentTab()->view()->history()->canGoForward());
-
- QAction *openClosedTabsAction = actionByName( QL1S("open_closed_tabs") );
- openClosedTabsAction->setEnabled(mainView()->recentlyClosedTabs().size() > 0);
-
- // update closed tabs menu
- KActionMenu *am = dynamic_cast<KActionMenu *>(actionByName( QL1S("closed_tab_menu") ));
- if (!am)
- return;
-
- am->setEnabled(mainView()->recentlyClosedTabs().size() > 0);
-
- if (am->menu())
- am->menu()->clear();
-
- foreach (const HistoryItem &item, mainView()->recentlyClosedTabs())
- {
- KAction *a = new KAction(Application::icon(item.url), item.title, this);
- a->setData(item.url);
- connect(a, SIGNAL(triggered()), m_view, SLOT(openClosedTab()));
- am->addAction(a);
- }
}
diff --git a/src/tabbar.cpp b/src/tabbar.cpp
index 09aa814d..a1bbf2b8 100644
--- a/src/tabbar.cpp
+++ b/src/tabbar.cpp
@@ -46,6 +46,7 @@
#include <KGlobalSettings>
#include <KPassivePopup>
#include <KMenu>
+#include <KActionMenu>
// Qt Includes
#include <QString>
@@ -284,6 +285,8 @@ void TabBar::mousePressEvent(QMouseEvent *event)
void TabBar::contextMenu(int tab, const QPoint &pos)
{
+ setupHistoryActions();
+
m_actualIndex = tab;
KMenu menu;
@@ -308,6 +311,8 @@ void TabBar::contextMenu(int tab, const QPoint &pos)
void TabBar::emptyAreaContextMenu(const QPoint &pos)
{
+ setupHistoryActions();
+
KMenu menu;
MainWindow *mainWindow = Application::instance()->mainWindow();
@@ -342,3 +347,35 @@ void TabBar::tabRemoved(int index)
m_currentTabPreviewIndex = -1;
}
}
+
+
+void TabBar::setupHistoryActions()
+{
+ MainWindow *w = Application::instance()->mainWindow();
+ MainView *mv = qobject_cast<MainView *>(parent());
+
+ QAction *openClosedTabsAction = w->actionByName( QL1S("open_closed_tabs") );
+ openClosedTabsAction->setEnabled( mv->recentlyClosedTabs().size() > 0 );
+
+ // update closed tabs menu
+ KActionMenu *am = qobject_cast<KActionMenu *>( w->actionByName( QL1S("closed_tab_menu") ));
+ if (!am)
+ return;
+
+ bool isEnabled = ( mv->recentlyClosedTabs().size() > 0 );
+ am->setEnabled(isEnabled);
+
+ if (am->menu())
+ am->menu()->clear();
+
+ if(!isEnabled)
+ return;
+
+ foreach (const HistoryItem &item, mv->recentlyClosedTabs())
+ {
+ KAction *a = new KAction(Application::icon(item.url), item.title, this);
+ a->setData(item.url);
+ connect(a, SIGNAL(triggered()), mv, SLOT(openClosedTab()));
+ am->addAction(a);
+ }
+}
diff --git a/src/tabbar.h b/src/tabbar.h
index 488de4b2..49c0e3ca 100644
--- a/src/tabbar.h
+++ b/src/tabbar.h
@@ -94,6 +94,8 @@ private slots:
void showTabPreview();
private:
+ void setupHistoryActions();
+
friend class MainView;
/**