From c28496c854a41baf865fc6e34b9d0453034ee84b Mon Sep 17 00:00:00 2001 From: Yoann Laissus Date: Sat, 3 Apr 2010 23:09:25 +0200 Subject: - Add the control modifier support for back, next and home actions and for the UrlTreeView - Use SettingsOpenTab to open a link in a new tab with the bookmark toolbar --- src/bookmarks/bookmarksmanager.cpp | 2 +- src/mainwindow.cpp | 25 ++++++++++++------------- src/mainwindow.h | 6 +++--- src/urltreeview.cpp | 2 +- 4 files changed, 17 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp index 95adf387..6a5417fc 100644 --- a/src/bookmarks/bookmarksmanager.cpp +++ b/src/bookmarks/bookmarksmanager.cpp @@ -66,7 +66,7 @@ void BookmarkOwner::openBookmark(const KBookmark & bookmark, { if (keyboardModifiers & Qt::ControlModifier || mouseButtons == Qt::MidButton) { - emit openUrl(bookmark.url(), Rekonq::NewCurrentTab); + emit openUrl(bookmark.url(), Rekonq::SettingOpenTab); } else { diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 6701ea2e..2c31de05 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -93,6 +93,7 @@ #include #include +#include MainWindow::MainWindow() @@ -287,7 +288,7 @@ void MainWindow::setupActions() a->setShortcut( fullScreenShortcut ); a = actionCollection()->addAction( KStandardAction::Home ); - connect(a, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(homePage(Qt::MouseButtons))); + connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(homePage(Qt::MouseButtons, Qt::KeyboardModifiers))); KStandardAction::preferences(this, SLOT(preferences()), actionCollection()); a = KStandardAction::redisplay(m_view, SLOT(webReload()), actionCollection()); @@ -347,7 +348,7 @@ void MainWindow::setupActions() // ========================= History related actions ============================== a = actionCollection()->addAction( KStandardAction::Back ); - connect(a, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(openPrevious(Qt::MouseButtons))); + connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(openPrevious(Qt::MouseButtons, Qt::KeyboardModifiers))); m_historyBackMenu = new KMenu(this); a->setMenu(m_historyBackMenu); @@ -355,7 +356,7 @@ void MainWindow::setupActions() connect(m_historyBackMenu, SIGNAL(triggered(QAction *)), this, SLOT(openActionUrl(QAction *))); a = actionCollection()->addAction( KStandardAction::Forward ); - connect(a, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(openNext(Qt::MouseButtons))); + connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(openNext(Qt::MouseButtons, Qt::KeyboardModifiers))); // ============================== General Tab Actions ==================================== a = new KAction(KIcon("tab-new"), i18n("New &Tab"), this); @@ -960,9 +961,9 @@ void MainWindow::viewPageSource() } -void MainWindow::homePage(Qt::MouseButtons btn) +void MainWindow::homePage(Qt::MouseButtons mouseButtons, Qt::KeyboardModifiers keyboardModifiers) { - if(btn == Qt::MidButton) + if(mouseButtons == Qt::MidButton || keyboardModifiers == Qt::ControlModifier) Application::instance()->loadUrl( KUrl(ReKonfig::homePage()), Rekonq::SettingOpenTab ); else currentTab()->view()->load( QUrl(ReKonfig::homePage()) ); @@ -1006,15 +1007,14 @@ void MainWindow::browserLoading(bool v) } -void MainWindow::openPrevious(Qt::MouseButtons btn) +void MainWindow::openPrevious(Qt::MouseButtons mouseButtons, Qt::KeyboardModifiers keyboardModifiers) { QWebHistory *history = currentTab()->view()->history(); if (history->canGoBack()) { - if(btn == Qt::MidButton) + if(mouseButtons == Qt::MidButton || keyboardModifiers == Qt::ControlModifier) { - KUrl back = history->backItem().url(); - Application::instance()->loadUrl(back, Rekonq::SettingOpenTab); + Application::instance()->loadUrl(history->backItem().url(), Rekonq::SettingOpenTab); } else { @@ -1027,15 +1027,14 @@ void MainWindow::openPrevious(Qt::MouseButtons btn) } -void MainWindow::openNext(Qt::MouseButtons btn) +void MainWindow::openNext(Qt::MouseButtons mouseButtons, Qt::KeyboardModifiers keyboardModifiers) { QWebHistory *history = currentTab()->view()->history(); if (history->canGoForward()) { - if(btn == Qt::MidButton) + if(mouseButtons == Qt::MidButton || keyboardModifiers == Qt::ControlModifier) { - KUrl next = history->forwardItem().url(); - Application::instance()->loadUrl(next, Rekonq::SettingOpenTab); + Application::instance()->loadUrl(history->forwardItem().url(), Rekonq::SettingOpenTab); } else { diff --git a/src/mainwindow.h b/src/mainwindow.h index 4ccd7bf3..d1509066 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -87,7 +87,7 @@ private: void setupPanels(); public slots: - void homePage(Qt::MouseButtons = Qt::LeftButton); + void homePage(Qt::MouseButtons = Qt::LeftButton, Qt::KeyboardModifiers = Qt::NoModifier); /** * Notifies a message in a popup @@ -122,8 +122,8 @@ private slots: void updateWindowTitle(const QString &title = QString()); // history related - void openPrevious(Qt::MouseButtons = Qt::LeftButton); - void openNext(Qt::MouseButtons = Qt::LeftButton); + void openPrevious(Qt::MouseButtons = Qt::LeftButton, Qt::KeyboardModifiers = Qt::NoModifier); + void openNext(Qt::MouseButtons = Qt::LeftButton, Qt::KeyboardModifiers = Qt::NoModifier); // Find Action slots void find(const QString &); diff --git a/src/urltreeview.cpp b/src/urltreeview.cpp index 507a7973..b8be9dd2 100644 --- a/src/urltreeview.cpp +++ b/src/urltreeview.cpp @@ -95,7 +95,7 @@ void UrlTreeView::mouseReleaseEvent(QMouseEvent *event) if(!index.isValid()) return; - if(event->button() == Qt::MidButton) + if(event->button() == Qt::MidButton || event->modifiers() == Qt::ControlModifier) validOpenUrl(qVariantValue< KUrl >(index.data(Qt::UserRole)), Rekonq::NewCurrentTab); else if(event->button() == Qt::LeftButton) -- cgit v1.2.1 From 5229b51d6199227e7c7351e167d47c50cbc39f8d Mon Sep 17 00:00:00 2001 From: Yoann Laissus Date: Sat, 3 Apr 2010 23:13:10 +0200 Subject: Use SettingsOpenTab for UrlTreeView to --- src/urltreeview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/urltreeview.cpp b/src/urltreeview.cpp index b8be9dd2..aeaef2f7 100644 --- a/src/urltreeview.cpp +++ b/src/urltreeview.cpp @@ -96,7 +96,7 @@ void UrlTreeView::mouseReleaseEvent(QMouseEvent *event) return; if(event->button() == Qt::MidButton || event->modifiers() == Qt::ControlModifier) - validOpenUrl(qVariantValue< KUrl >(index.data(Qt::UserRole)), Rekonq::NewCurrentTab); + validOpenUrl(qVariantValue< KUrl >(index.data(Qt::UserRole)), Rekonq::SettingOpenTab); else if(event->button() == Qt::LeftButton) { -- cgit v1.2.1 From 500ebf552c119a2b47a952e89ed2e68ec3951477 Mon Sep 17 00:00:00 2001 From: Yoann Laissus Date: Sat, 3 Apr 2010 23:30:48 +0200 Subject: Useless import --- src/mainwindow.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 2c31de05..c49df102 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -93,7 +93,6 @@ #include #include -#include MainWindow::MainWindow() -- cgit v1.2.1