mirror of
https://invent.kde.org/system/dolphin
synced 2024-10-28 03:21:56 +00:00
Change in "Open in new tab" feature in Dolphin
Summary: This patch proposes a change to the "open in new tab" feature. The "open in new tab" feature will try to open selected items (files or folders) in a new tab, however, if there are no valid items to be opened in a new tab then nothing will happen, making it look like a bug. This patch adds the functionality that when there are no valid items(files or folders) to be opened in a new tab the current folder will be opened. Test Plan: 1. Select a file(pdf, text, image etc) in Dolphin 2. Click on the "Open in new tab" toolbar button Expected: since the file is not a valid target to open in a new tab, the current directory should be opened (as is the case where selection is empty) Actual: Nothing happens after the button is pressed Reviewed By: #dolphin, elvisangelaccio Differential Revision: https://phabricator.kde.org/D6182
This commit is contained in:
parent
c85ca11455
commit
ec9f4ed17c
|
@ -306,16 +306,21 @@ void DolphinMainWindow::openNewTab(const QUrl& url)
|
||||||
void DolphinMainWindow::openInNewTab()
|
void DolphinMainWindow::openInNewTab()
|
||||||
{
|
{
|
||||||
const KFileItemList& list = m_activeViewContainer->view()->selectedItems();
|
const KFileItemList& list = m_activeViewContainer->view()->selectedItems();
|
||||||
if (list.isEmpty()) {
|
bool tabCreated = false;
|
||||||
openNewTab(m_activeViewContainer->url());
|
|
||||||
} else {
|
foreach (const KFileItem& item, list) {
|
||||||
foreach (const KFileItem& item, list) {
|
const QUrl& url = DolphinView::openItemAsFolderUrl(item);
|
||||||
const QUrl& url = DolphinView::openItemAsFolderUrl(item);
|
if (!url.isEmpty()) {
|
||||||
if (!url.isEmpty()) {
|
openNewTab(url);
|
||||||
openNewTab(url);
|
tabCreated = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if no new tab has been created from the selection
|
||||||
|
// open the current directory in a new tab
|
||||||
|
if (!tabCreated) {
|
||||||
|
openNewTab(m_activeViewContainer->url());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DolphinMainWindow::openInNewWindow()
|
void DolphinMainWindow::openInNewWindow()
|
||||||
|
|
Loading…
Reference in a new issue