]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Middle clicking the 'Home' button should open home folder in a new tab
authorJekyll Wu <adaptee@gmail.com>
Mon, 9 Jan 2012 05:54:57 +0000 (13:54 +0800)
committerJekyll Wu <adaptee@gmail.com>
Tue, 10 Jan 2012 12:06:26 +0000 (20:06 +0800)
The general idea is to make it behave consistently with other navigating
buttons.

BUG: 278194
FIXED-IN:4.8.0
REVIEW:103659

src/dolphinmainwindow.cpp
src/dolphinmainwindow.h

index 3f527d9a5c2b178a535738f6bbb90d63cb6f8106..4502e703f8c960e546883c453a25348c468f93c4 100644 (file)
@@ -1024,6 +1024,14 @@ void DolphinMainWindow::goUp(Qt::MouseButtons buttons)
     }
 }
 
+void DolphinMainWindow::goHome(Qt::MouseButtons buttons)
+{
+    // The default case (left button pressed) is handled in goHome().
+    if (buttons == Qt::MidButton) {
+        openNewTab(GeneralSettings::self()->homeUrl());
+    }
+}
+
 void DolphinMainWindow::compareFiles()
 {
     // The method is only invoked if exactly 2 files have
@@ -1690,7 +1698,8 @@ void DolphinMainWindow::setupActions()
     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());
+    KAction* homeAction = KStandardAction::home(this, SLOT(goHome()), actionCollection());
+    connect(homeAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goHome(Qt::MouseButtons)));
 
     // setup 'Tools' menu
     KAction* showFilterBar = actionCollection()->addAction("show_filter_bar");
index 998b6fc254d3d39264f5d5ec79870b6ab4811b7e..c2a548906966c302a4b9183c6142b603cd5e53e5 100644 (file)
@@ -301,6 +301,11 @@ private slots:
      */
     void goUp(Qt::MouseButtons buttons);
 
+    /**
+     * Open the home URL in a new tab
+     */
+    void goHome(Qt::MouseButtons buttons);
+
     /** Opens Kompare for 2 selected files. */
     void compareFiles();