Summary:
New tabs should be placed after the currently active tab when using
middle click.
Test Plan:
Open new tab from the places panel using middle click, verify that the
Open new tab from the folders panel using middle click, verify that the
tab is opened after the current tab
Open new tab by middle clicking on the Back button, verify that the tab
is opened after the current tab
Open new tab by middle clicking on the Forward button, verify that the tab
is opened after the current tab
FEATURE: 403690
Reviewers: #dolphin, ngraham, elvisangelaccio
Reviewed By: #dolphin, ngraham, elvisangelaccio
Subscribers: kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D19201
#include "dolphincontextmenu.h"
#include "dolphinnewfilemenu.h"
#include "dolphinrecenttabsmenu.h"
#include "dolphincontextmenu.h"
#include "dolphinnewfilemenu.h"
#include "dolphinrecenttabsmenu.h"
-#include "dolphintabwidget.h"
#include "dolphinviewcontainer.h"
#include "dolphintabpage.h"
#include "middleclickactioneventfilter.h"
#include "dolphinviewcontainer.h"
#include "dolphintabpage.h"
#include "middleclickactioneventfilter.h"
m_tabWidget->openNewActivatedTab();
}
m_tabWidget->openNewActivatedTab();
}
-void DolphinMainWindow::openNewTab(const QUrl& url)
+void DolphinMainWindow::openNewTab(const QUrl& url, DolphinTabWidget::TabPlacement tabPlacement)
- m_tabWidget->openNewTab(url);
+ m_tabWidget->openNewTab(url, QUrl(), tabPlacement);
+}
+
+void DolphinMainWindow::openNewTabAfterCurrentTab(const QUrl& url)
+{
+ m_tabWidget->openNewTab(url, QUrl(), DolphinTabWidget::AfterCurrentTab);
+}
+
+void DolphinMainWindow::openNewTabAfterLastTab(const QUrl& url)
+{
+ m_tabWidget->openNewTab(url, QUrl(), DolphinTabWidget::AfterLastTab);
}
void DolphinMainWindow::openInNewTab()
}
void DolphinMainWindow::openInNewTab()
foreach (const KFileItem& item, list) {
const QUrl& url = DolphinView::openItemAsFolderUrl(item);
if (!url.isEmpty()) {
foreach (const KFileItem& item, list) {
const QUrl& url = DolphinView::openItemAsFolderUrl(item);
if (!url.isEmpty()) {
- m_tabWidget->openNewTab(url, QUrl(), DolphinTabWidget::AfterCurrentTab);
+ openNewTabAfterCurrentTab(url);
// if no new tab has been created from the selection
// open the current directory in a new tab
if (!tabCreated) {
// if no new tab has been created from the selection
// open the current directory in a new tab
if (!tabCreated) {
- m_tabWidget->openNewTab(m_activeViewContainer->url(), QUrl(), DolphinTabWidget::AfterCurrentTab);
+ openNewTabAfterCurrentTab(m_activeViewContainer->url());
{
KUrlNavigator* urlNavigator = activeViewContainer()->urlNavigator();
const int index = urlNavigator->historyIndex() + 1;
{
KUrlNavigator* urlNavigator = activeViewContainer()->urlNavigator();
const int index = urlNavigator->historyIndex() + 1;
- openNewTab(urlNavigator->locationUrl(index));
+ openNewTabAfterCurrentTab(urlNavigator->locationUrl(index));
}
void DolphinMainWindow::goForwardInNewTab()
{
KUrlNavigator* urlNavigator = activeViewContainer()->urlNavigator();
const int index = urlNavigator->historyIndex() - 1;
}
void DolphinMainWindow::goForwardInNewTab()
{
KUrlNavigator* urlNavigator = activeViewContainer()->urlNavigator();
const int index = urlNavigator->historyIndex() - 1;
- openNewTab(urlNavigator->locationUrl(index));
+ openNewTabAfterCurrentTab(urlNavigator->locationUrl(index));
}
void DolphinMainWindow::goUpInNewTab()
{
const QUrl currentUrl = activeViewContainer()->urlNavigator()->locationUrl();
}
void DolphinMainWindow::goUpInNewTab()
{
const QUrl currentUrl = activeViewContainer()->urlNavigator()->locationUrl();
- openNewTab(KIO::upUrl(currentUrl));
+ openNewTabAfterCurrentTab(KIO::upUrl(currentUrl));
}
void DolphinMainWindow::goHomeInNewTab()
{
}
void DolphinMainWindow::goHomeInNewTab()
{
- openNewTab(Dolphin::homeUrl());
+ openNewTabAfterCurrentTab(Dolphin::homeUrl());
}
void DolphinMainWindow::compareFiles()
}
void DolphinMainWindow::compareFiles()
break;
case DolphinContextMenu::OpenParentFolderInNewTab:
break;
case DolphinContextMenu::OpenParentFolderInNewTab:
- openNewTab(KIO::upUrl(item.url()));
+ openNewTabAfterLastTab(KIO::upUrl(item.url()));
break;
case DolphinContextMenu::None:
break;
case DolphinContextMenu::None:
connect(foldersPanel, &FoldersPanel::folderActivated,
this, &DolphinMainWindow::changeUrl);
connect(foldersPanel, &FoldersPanel::folderMiddleClicked,
connect(foldersPanel, &FoldersPanel::folderActivated,
this, &DolphinMainWindow::changeUrl);
connect(foldersPanel, &FoldersPanel::folderMiddleClicked,
- this, &DolphinMainWindow::openNewTab);
+ this, &DolphinMainWindow::openNewTabAfterCurrentTab);
connect(foldersPanel, &FoldersPanel::errorMessage,
this, &DolphinMainWindow::showErrorMessage);
connect(foldersPanel, &FoldersPanel::errorMessage,
this, &DolphinMainWindow::showErrorMessage);
connect(m_placesPanel, &PlacesPanel::placeActivated,
this, &DolphinMainWindow::slotPlaceActivated);
connect(m_placesPanel, &PlacesPanel::placeMiddleClicked,
connect(m_placesPanel, &PlacesPanel::placeActivated,
this, &DolphinMainWindow::slotPlaceActivated);
connect(m_placesPanel, &PlacesPanel::placeMiddleClicked,
- this, &DolphinMainWindow::openNewTab);
+ this, &DolphinMainWindow::openNewTabAfterCurrentTab);
connect(m_placesPanel, &PlacesPanel::errorMessage,
this, &DolphinMainWindow::showErrorMessage);
connect(this, &DolphinMainWindow::urlChanged,
connect(m_placesPanel, &PlacesPanel::errorMessage,
this, &DolphinMainWindow::showErrorMessage);
connect(this, &DolphinMainWindow::urlChanged,
connect(navigator, &KUrlNavigator::editableStateChanged,
this, &DolphinMainWindow::slotEditableStateChanged);
connect(navigator, &KUrlNavigator::tabRequested,
connect(navigator, &KUrlNavigator::editableStateChanged,
this, &DolphinMainWindow::slotEditableStateChanged);
connect(navigator, &KUrlNavigator::tabRequested,
- this, &DolphinMainWindow::openNewTab);
+ this, &DolphinMainWindow::openNewTabAfterLastTab);
}
void DolphinMainWindow::updateSplitAction()
}
void DolphinMainWindow::updateSplitAction()
#ifndef DOLPHIN_MAINWINDOW_H
#define DOLPHIN_MAINWINDOW_H
#ifndef DOLPHIN_MAINWINDOW_H
#define DOLPHIN_MAINWINDOW_H
+#include "dolphintabwidget.h"
#include <config-baloo.h>
#include <kio/fileundomanager.h>
#include <ksortablelist.h>
#include <config-baloo.h>
#include <kio/fileundomanager.h>
#include <ksortablelist.h>
/**
* Opens a new tab in the background showing the URL \a url.
*/
/**
* Opens a new tab in the background showing the URL \a url.
*/
- void openNewTab(const QUrl& url);
+ void openNewTab(const QUrl& url, DolphinTabWidget::TabPlacement tabPlacement);
+
+ /**
+ * Opens a new tab and places it after the current tab
+ */
+ void openNewTabAfterCurrentTab(const QUrl& url);
+
+ /**
+ * Opens a new tab and places it as the last tab
+ */
+ void openNewTabAfterLastTab(const QUrl& url);
/**
* Opens the selected folder in a new tab.
/**
* Opens the selected folder in a new tab.
const QUrl& url = openItemAsFolderUrl(item);
if (!url.isEmpty()) { // Open folders in new tabs
const QUrl& url = openItemAsFolderUrl(item);
if (!url.isEmpty()) { // Open folders in new tabs
- emit tabRequested(url);
+ emit tabRequested(url, DolphinTabWidget::AfterLastTab);
} else {
items.append(item);
}
} else {
items.append(item);
}
const KFileItem& item = m_model->fileItem(index);
const QUrl& url = openItemAsFolderUrl(item);
if (!url.isEmpty()) {
const KFileItem& item = m_model->fileItem(index);
const QUrl& url = openItemAsFolderUrl(item);
if (!url.isEmpty()) {
- emit tabRequested(url);
+ emit tabRequested(url, DolphinTabWidget::AfterCurrentTab);
} else if (isTabsForFilesEnabled()) {
} else if (isTabsForFilesEnabled()) {
- emit tabRequested(item.url());
+ emit tabRequested(item.url(), DolphinTabWidget::AfterCurrentTab);
#ifndef DOLPHINVIEW_H
#define DOLPHINVIEW_H
#ifndef DOLPHINVIEW_H
#define DOLPHINVIEW_H
+#include "dolphintabwidget.h"
#include "dolphin_export.h"
#include <KFileItem>
#include "dolphin_export.h"
#include <KFileItem>
/**
* Is emitted if a new tab should be opened for the URL \a url.
*/
/**
* Is emitted if a new tab should be opened for the URL \a url.
*/
- void tabRequested(const QUrl& url);
+ void tabRequested(const QUrl& url, DolphinTabWidget::TabPlacement tabPlacement);
/**
* Is emitted if the view mode (IconsView, DetailsView,
/**
* Is emitted if the view mode (IconsView, DetailsView,