]> cloud.milkyroute.net Git - dolphin.git/commitdiff
When the Back, Forward and Up buttons in the toolbar are clicked with
authorFrank Reininghaus <frank78ac@googlemail.com>
Mon, 9 Nov 2009 17:50:21 +0000 (17:50 +0000)
committerFrank Reininghaus <frank78ac@googlemail.com>
Mon, 9 Nov 2009 17:50:21 +0000 (17:50 +0000)
the middle mouse button, open the URL in a new tab.

FEATURE: 190549

svn path=/trunk/KDE/kdebase/apps/; revision=1046785

src/dolphinmainwindow.cpp
src/dolphinmainwindow.h

index 5d990ab554693b167e7348bf33ff8d7a2b164a0b..e55be1d3063d1a69aafc53a310abc7576a3c25ac 100644 (file)
@@ -753,6 +753,32 @@ void DolphinMainWindow::goUp()
     m_activeViewContainer->urlNavigator()->goUp();
 }
 
+void DolphinMainWindow::goBack(Qt::MouseButtons buttons)
+{
+    // The default case (left button pressed) is handled in goBack().
+    if(buttons == Qt::MidButton) {
+        KUrlNavigator* urlNavigator = activeViewContainer()->urlNavigator();
+        openNewTab(urlNavigator->historyUrl(urlNavigator->historyIndex() + 1));
+    }
+}
+
+void DolphinMainWindow::goForward(Qt::MouseButtons buttons)
+{
+    // The default case (left button pressed) is handled in goForward().
+    if(buttons == Qt::MidButton) {
+        KUrlNavigator* urlNavigator = activeViewContainer()->urlNavigator();
+        openNewTab(urlNavigator->historyUrl(urlNavigator->historyIndex() - 1));
+    }
+}
+
+void DolphinMainWindow::goUp(Qt::MouseButtons buttons)
+{
+    // The default case (left button pressed) is handled in goUp().
+    if(buttons == Qt::MidButton) {
+        openNewTab(activeViewContainer()->url().upUrl());
+    }
+}
+
 void DolphinMainWindow::goHome()
 {
     clearStatusBar();
@@ -1226,6 +1252,7 @@ void DolphinMainWindow::setupActions()
 
     // setup 'Go' menu
     KAction* backAction = KStandardAction::back(this, SLOT(goBack()), actionCollection());
+    connect(backAction, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(goBack(Qt::MouseButtons)));
     KShortcut backShortcut = backAction->shortcut();
     backShortcut.setAlternate(Qt::Key_Backspace);
     backAction->setShortcut(backShortcut);
@@ -1243,8 +1270,12 @@ void DolphinMainWindow::setupActions()
     m_recentTabsMenu->addSeparator();
     m_recentTabsMenu->setEnabled(false);
 
-    KStandardAction::forward(this, SLOT(goForward()), actionCollection());
-    KStandardAction::up(this, SLOT(goUp()), actionCollection());
+    KAction* forwardAction = KStandardAction::forward(this, SLOT(goForward()), actionCollection());
+    connect(forwardAction, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(goForward(Qt::MouseButtons)));
+
+    KAction* upAction = KStandardAction::up(this, SLOT(goUp()), actionCollection());
+    connect(upAction, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(goUp(Qt::MouseButtons)));
+
     KStandardAction::home(this, SLOT(goHome()), actionCollection());
 
     // setup 'Tools' menu
index 399b6a2a372cdf82e4fa1776c94f99e985c565ec..d72c6b93828168d214cfcc1ff73c991a9ff78cfa 100644 (file)
@@ -259,6 +259,24 @@ private slots:
     /** Goes up one hierarchy of the current URL. */
     void goUp();
 
+    /**
+     * Open the previous URL in the URL history in a new tab
+     * if the middle mouse button is clicked.
+     */
+    void goBack(Qt::MouseButtons buttons);
+
+    /**
+     * Open the next URL in the URL history in a new tab
+     * if the middle mouse button is clicked.
+     */
+    void goForward(Qt::MouseButtons buttons);
+
+    /**
+     * Open the URL one hierarchy above the current URL in a new tab
+     * if the middle mouse button is clicked.
+     */
+    void goUp(Qt::MouseButtons buttons);
+
     /** Goes to the home URL. */
     void goHome();