diff options
| author | Frank Reininghaus <[email protected]> | 2009-11-09 17:50:21 +0000 |
|---|---|---|
| committer | Frank Reininghaus <[email protected]> | 2009-11-09 17:50:21 +0000 |
| commit | 7ff8c0d89aecc356d66b2aed25804b5ff22fbff9 (patch) | |
| tree | 8107029e9aa3036d38e80e9e1ab63822af7794c9 /src/dolphinmainwindow.cpp | |
| parent | 89b18a8b33a9007b5482b849906bfb166e7da3bb (diff) | |
When the Back, Forward and Up buttons in the toolbar are clicked with
the middle mouse button, open the URL in a new tab.
FEATURE: 190549
svn path=/trunk/KDE/kdebase/apps/; revision=1046785
Diffstat (limited to 'src/dolphinmainwindow.cpp')
| -rw-r--r-- | src/dolphinmainwindow.cpp | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 5d990ab55..e55be1d30 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -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 |
