summaryrefslogtreecommitdiff
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
parentFix focus handling on views (diff)
downloadrekonq-847153eead1f136dda86629994b1f32eeebb459c.tar.xz
Fix/add missing rekonq actions & shortcuts
-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
-rw-r--r--src/webwindow/rekonqui.rc12
-rw-r--r--src/webwindow/webwindow.cpp32
-rw-r--r--src/webwindow/webwindow.h4
7 files changed, 69 insertions, 27 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);
diff --git a/src/webwindow/rekonqui.rc b/src/webwindow/rekonqui.rc
index ef6294a4..798f6d4e 100644
--- a/src/webwindow/rekonqui.rc
+++ b/src/webwindow/rekonqui.rc
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE gui SYSTEM "kpartgui.dtd">
-<gui name="rekonq" version="64">
+<gui name="rekonq" version="65">
<!--- =========== Rekonq Menu ============= -->
<Menu name="rekonqMenu" noMerge="1">
@@ -29,7 +29,6 @@
<Action name="webapp_shortcut" />
<Action name="web_inspector" />
<Action name="page_source" />
- <Action name="net_analyzer" />
<Action name="set_editable" />
<Separator/>
<Action name="useragent" />
@@ -38,9 +37,9 @@
</Menu>
<Separator/>
- <Action name="show_history_panel" />
<Action name="show_bookmarks_toolbar" />
- <Action name="show_bookmarks_panel" />
+ <Action name="open_downloads_page" />
+ <Separator/>
<Action name="fullscreen" />
<Separator/>
@@ -69,11 +68,10 @@
<Action name="open_location" />
<Separator/>
<Action name="new_tab" />
- <Action name="close_tab" />
+ <Action name="new_window" />
<Separator/>
<Action name="file_save_as" />
<Separator/>
- <Action name="file_print_preview" />
<Action name="file_print" />
<Separator/>
<Action name="file_quit" />
@@ -123,7 +121,6 @@
<Action name="private_browsing" />
<Action name="clear_private_data" />
<Action name="page_source" />
- <Action name="net_analyzer" />
<Action name="set_editable" />
<Separator/>
<Action name="useragent" />
@@ -132,7 +129,6 @@
<!-- ============ SETTINGS menu =========== -->
<Menu name="settings" noMerge="1"><text>&amp;Settings</text>
- <Action name="options_show_menubar" />
<Merge name="StandardToolBarMenuHandler" />
<Merge/>
<Separator/>
diff --git a/src/webwindow/webwindow.cpp b/src/webwindow/webwindow.cpp
index 188b4eed..5bb89dc4 100644
--- a/src/webwindow/webwindow.cpp
+++ b/src/webwindow/webwindow.cpp
@@ -160,6 +160,9 @@ WebWindow::~WebWindow()
void WebWindow::setupActions()
{
+ // this let shortcuts work..
+ actionCollection()->addAssociatedWidget(this);
+
KAction *a;
// ========================= History related actions ==============================
@@ -212,6 +215,16 @@ void WebWindow::setupActions()
actionCollection()->addAction(QL1S("show_bookmarks_toolbar"), a);
connect(a, SIGNAL(toggled(bool)), this, SLOT(toggleBookmarksToolbar(bool)));
+ // Open Downloads page
+ a = new KAction(KIcon("download"), i18n("Downloads"), this);
+ a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_J));
+ actionCollection()->addAction(QL1S("open_downloads_page"), a);
+ connect(a, SIGNAL(triggered(bool)), this, SLOT(openDownloadsPage()));
+
+ // Open Home Page
+ a = actionCollection()->addAction(KStandardAction::Home);
+ connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(openHomePage(Qt::MouseButtons, Qt::KeyboardModifiers)));
+
// find action
a = KStandardAction::find(m_findBar, SLOT(show()), actionCollection());
KShortcut findShortcut = KStandardShortcut::find();
@@ -903,3 +916,22 @@ void WebWindow::checkFocus()
else
_tab->view()->setFocus();
}
+
+
+void WebWindow::openDownloadsPage()
+{
+ rApp->loadUrl( QUrl("about:downloads"), Rekonq::NewTab );
+}
+
+
+void WebWindow::openHomePage(Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
+{
+ KUrl homeUrl = ReKonfig::useNewTabPage()
+ ? KUrl(QL1S("about:home"))
+ : KUrl(ReKonfig::homePage());
+
+ if (buttons == Qt::MidButton || modifiers == Qt::ControlModifier)
+ rApp->loadUrl(homeUrl, Rekonq::NewTab);
+ else
+ load(homeUrl);
+}
diff --git a/src/webwindow/webwindow.h b/src/webwindow/webwindow.h
index 2a729a1a..d955e814 100644
--- a/src/webwindow/webwindow.h
+++ b/src/webwindow/webwindow.h
@@ -126,6 +126,10 @@ private Q_SLOTS:
// bookmarks bar
void toggleBookmarksToolbar(bool);
+ // special pages
+ void openDownloadsPage();
+ void openHomePage(Qt::MouseButtons, Qt::KeyboardModifiers);
+
// Tools Menu slots
void viewPageSource();