X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/954e8c47906c12edaaf6e6aebdd41516eceb0d44..40cc5f665d:/src/panels/folders/folderspanel.cpp diff --git a/src/panels/folders/folderspanel.cpp b/src/panels/folders/folderspanel.cpp index 73c3137d3..d9cc6128c 100644 --- a/src/panels/folders/folderspanel.cpp +++ b/src/panels/folders/folderspanel.cpp @@ -15,6 +15,7 @@ #include "kitemviews/kitemlistcontainer.h" #include "kitemviews/kitemlistcontroller.h" #include "kitemviews/kitemlistselectionmanager.h" +#include "kitemviews/private/kitemlistroleeditor.h" #include "treeviewcontextmenu.h" #include "views/draganddrophelper.h" @@ -131,6 +132,7 @@ void FoldersPanel::showEvent(QShowEvent* event) // This assures that no performance and memory overhead is given when the folders panel is not // used at all and stays invisible. KFileItemListView* view = new KFileItemListView(); + view->setScanDirectories(false); view->setWidgetCreator(new KItemListWidgetCreator()); view->setSupportsItemExpanding(true); // Set the opacity to 0 initially. The opacity will be increased after the loading of the initial tree @@ -187,7 +189,19 @@ void FoldersPanel::slotItemActivated(int index) { const KFileItem item = m_model->fileItem(index); if (!item.isNull()) { - emit folderActivated(item.url()); + const auto modifiers = QGuiApplication::keyboardModifiers(); + // keep in sync with KUrlNavigator::slotNavigatorButtonClicked + if (modifiers & Qt::ControlModifier && modifiers & Qt::ShiftModifier) { + Q_EMIT folderInNewActiveTab(item.url()); + } else if (modifiers & Qt::ControlModifier) { + Q_EMIT folderInNewTab(item.url()); + } else if (modifiers & Qt::ShiftModifier) { + // The shift modifier is not considered because it is used to expand the tree view without actually + // opening the folder + return; + } else { + Q_EMIT folderActivated(item.url()); + } } } @@ -195,7 +209,13 @@ void FoldersPanel::slotItemMiddleClicked(int index) { const KFileItem item = m_model->fileItem(index); if (!item.isNull()) { - emit folderMiddleClicked(item.url()); + const auto modifiers = QGuiApplication::keyboardModifiers(); + // keep in sync with KUrlNavigator::slotNavigatorButtonClicked + if (modifiers & Qt::ShiftModifier) { + Q_EMIT folderInNewActiveTab(item.url()); + } else { + Q_EMIT folderInNewTab(item.url()); + } } } @@ -235,7 +255,11 @@ void FoldersPanel::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* eve KIO::DropJob *job = DragAndDropHelper::dropUrls(destItem.mostLocalUrl(), &dropEvent, this); if (job) { - connect(job, &KIO::DropJob::result, this, [this](KJob *job) { if (job->error()) emit errorMessage(job->errorString()); }); + connect(job, &KIO::DropJob::result, this, [this](KJob *job) { + if (job->error() && job->error() != KIO::ERR_USER_CANCELED) { + Q_EMIT errorMessage(job->errorString()); + } + }); } } } @@ -244,7 +268,8 @@ void FoldersPanel::slotRoleEditingFinished(int index, const QByteArray& role, co { if (role == "text") { const KFileItem item = m_model->fileItem(index); - const QString newName = value.toString(); + const EditResult retVal = value.value(); + const QString newName = retVal.newName; if (!newName.isEmpty() && newName != item.text() && newName != QLatin1Char('.') && newName != QLatin1String("..")) { const QUrl oldUrl = item.url(); QUrl newUrl = oldUrl.adjusted(QUrl::RemoveFilename); @@ -323,7 +348,7 @@ void FoldersPanel::loadTree(const QUrl& url, FoldersPanel::NavigationBehaviour n const int index = m_model->index(url); if (jumpHome) { - emit folderActivated(baseUrl); + Q_EMIT folderActivated(baseUrl); } else if (index >= 0) { updateCurrentItem(index); } else if (url == baseUrl) {