From 847153eead1f136dda86629994b1f32eeebb459c Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 25 Oct 2012 19:39:10 +0200 Subject: Fix/add missing rekonq actions & shortcuts --- src/webwindow/rekonqui.rc | 12 ++++-------- src/webwindow/webwindow.cpp | 32 ++++++++++++++++++++++++++++++++ src/webwindow/webwindow.h | 4 ++++ 3 files changed, 40 insertions(+), 8 deletions(-) (limited to 'src/webwindow') 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 @@ - + @@ -29,7 +29,6 @@ - @@ -38,9 +37,9 @@ - - + + @@ -69,11 +68,10 @@ - + - @@ -123,7 +121,6 @@ - @@ -132,7 +129,6 @@ &Settings - 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(); -- cgit v1.2.1