summaryrefslogtreecommitdiff
path: root/src/tabwindow
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-10-25 19:39:10 +0200
committerAndrea Diamantini <adjam7@gmail.com>2012-12-10 02:48:05 +0100
commit847153eead1f136dda86629994b1f32eeebb459c (patch)
treed30cba1d2a902bd65eb8878f160511999ed9e2ee /src/tabwindow
parentFix focus handling on views (diff)
downloadrekonq-847153eead1f136dda86629994b1f32eeebb459c.tar.xz
Fix/add missing rekonq actions & shortcuts
Diffstat (limited to 'src/tabwindow')
-rw-r--r--src/tabwindow/tabbar.cpp13
-rw-r--r--src/tabwindow/tabbar.h3
-rw-r--r--src/tabwindow/tabwindow.cpp29
-rw-r--r--src/tabwindow/tabwindow.h3
4 files changed, 29 insertions, 19 deletions
diff --git a/src/tabwindow/tabbar.cpp b/src/tabwindow/tabbar.cpp
index feb3fd8d..725d1372 100644
--- a/src/tabwindow/tabbar.cpp
+++ b/src/tabwindow/tabbar.cpp
@@ -177,17 +177,6 @@ void TabBar::detachTab()
}
-void TabBar::reopenLastClosedTab()
-{
- KAction *a = qobject_cast<KAction *>(sender());
- if (a)
- {
- int index = a->data().toInt();
- emit restoreClosedTab(index);
- }
-}
-
-
void TabBar::contextMenu(int tab, const QPoint &pos)
{
TabWindow *w = qobject_cast<TabWindow *>(parent());
@@ -254,7 +243,7 @@ void TabBar::contextMenu(int tab, const QPoint &pos)
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, SLOT(reopenLastClosedTab()));
+ connect(a, SIGNAL(triggered(bool)), this, SIGNAL(restoreLastClosedTab()));
menu.addAction(a);
if (count() > 1)
diff --git a/src/tabwindow/tabbar.h b/src/tabwindow/tabbar.h
index 3eaa4d81..64fed413 100644
--- a/src/tabwindow/tabbar.h
+++ b/src/tabwindow/tabbar.h
@@ -70,7 +70,7 @@ Q_SIGNALS:
void closeOtherTabs(int);
void reloadTab(int);
void detachTab(int);
- void restoreClosedTab(int);
+ void restoreLastClosedTab();
void tabLayoutChanged();
private Q_SLOTS:
@@ -79,7 +79,6 @@ private Q_SLOTS:
void closeOtherTabs();
void reloadTab();
void detachTab();
- void reopenLastClosedTab();
void pinTab();
void unpinTab();
diff --git a/src/tabwindow/tabwindow.cpp b/src/tabwindow/tabwindow.cpp
index 1fe069fd..f54fd130 100644
--- a/src/tabwindow/tabwindow.cpp
+++ b/src/tabwindow/tabwindow.cpp
@@ -93,7 +93,8 @@ TabWindow::TabWindow(bool withTab, bool PrivateBrowsingMode, QWidget *parent)
connect(tabBar, SIGNAL(closeOtherTabs(int)), this, SLOT(closeOtherTabs(int)));
connect(tabBar, SIGNAL(reloadTab(int)), this, SLOT(reloadTab(int)));
connect(tabBar, SIGNAL(detachTab(int)), this, SLOT(detachTab(int)));
- connect(tabBar, SIGNAL(restoreClosedTab(int)), this, SLOT(restoreClosedTab(int)));
+
+ connect(tabBar, SIGNAL(restoreLastClosedTab()), this, SLOT(restoreLastClosedTab()));
connect(tabBar, SIGNAL(tabLayoutChanged()), this, SLOT(updateNewTabButtonPosition()));
@@ -107,6 +108,20 @@ TabWindow::TabWindow(bool withTab, bool PrivateBrowsingMode, QWidget *parent)
connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));
+ // ----------------------------------------------------------------------------------------------
+ KActionCollection *tabActionColl = new KActionCollection(this);
+ tabActionColl->addAssociatedWidget(this);
+
+ a = new KAction(KIcon("tab-new"), i18n("Open Last Closed Tab"), this);
+ a->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_T));
+ tabActionColl->addAction(QL1S("open_last_closed_tab"), a);
+ connect(a, SIGNAL(triggered(bool)), this, SLOT(restoreLastClosedTab()));
+
+ a = new KAction(KIcon("tab-close"), i18n("&Close Tab"), this);
+ a->setShortcuts(KStandardShortcut::close());
+ tabActionColl->addAction(QL1S("close_tab"), a);
+ connect(a, SIGNAL(triggered(bool)), this, SLOT(closeTab()));
+
// NOTE: we usually create TabWindow with AT LEAST one tab, but
// in one important case...
if (withTab)
@@ -332,6 +347,12 @@ void TabWindow::tabLoadFinished(bool ok)
return;
QLabel *label = qobject_cast<QLabel* >(tabBar()->tabButton(index, QTabBar::LeftSide));
+ if (!label)
+ {
+ label = new QLabel(this);
+ tabBar()->setTabButton(index, QTabBar::LeftSide, 0);
+ tabBar()->setTabButton(index, QTabBar::LeftSide, label);
+ }
QMovie *movie = label->movie();
if (movie)
@@ -507,16 +528,16 @@ void TabWindow::reloadAllTabs()
}
-void TabWindow::restoreClosedTab(int i)
+void TabWindow::restoreLastClosedTab()
{
if (m_recentlyClosedTabs.isEmpty())
return;
- TabHistory history = m_recentlyClosedTabs.takeAt(i);
+ TabHistory history = m_recentlyClosedTabs.takeAt(0);
QUrl u = QUrl(history.url);
- loadUrl(u, Rekonq::NewTab, &history);
+ loadUrl(u, Rekonq::NewFocusedTab, &history);
// just to get sure...
m_recentlyClosedTabs.removeAll(history);
diff --git a/src/tabwindow/tabwindow.h b/src/tabwindow/tabwindow.h
index 459621c1..65c3e945 100644
--- a/src/tabwindow/tabwindow.h
+++ b/src/tabwindow/tabwindow.h
@@ -100,7 +100,8 @@ private Q_SLOTS:
void detachTab(int index = -1, TabWindow *toWindow = 0);
void reloadTab(int index = -1);
void reloadAllTabs();
- void restoreClosedTab(int i);
+
+ void restoreLastClosedTab();
void setFullScreen(bool);