]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/views/dolphinview.cpp
Special case file opening with middle click for executable scripts
[dolphin.git] / src / views / dolphinview.cpp
index 1cc8a5f29df24a30e24b501e7f1470481b2237f7..1d01b4c98451b2164f4c9bde3f6009a06afc127c 100644 (file)
@@ -92,6 +92,7 @@ DolphinView::DolphinView(const QUrl &url, QWidget *parent)
     , m_currentItemUrl()
     , m_scrollToCurrentItem(false)
     , m_restoredContentsPosition()
+    , m_controlWheelAccumulatedDelta(0)
     , m_selectedUrls()
     , m_clearSelectionBeforeSelectingNewItems(false)
     , m_markFirstNewlySelectedItemAsCurrent(false)
@@ -1092,11 +1093,12 @@ void DolphinView::slotItemsActivated(const KItemSet &indexes)
                                       {},
 #endif
             KGuiItem(i18ncp("@action:button", "Open %1 Item", "Open %1 Items", indexes.count()), QStringLiteral("document-open")),
-            KStandardGuiItem::cancel());
+            KStandardGuiItem::cancel(),
+            QStringLiteral("ConfirmOpenManyFolders"));
 #if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
-        if (answer != KMessageBox::PrimaryAction) {
+        if (answer != KMessageBox::PrimaryAction && answer != KMessageBox::Continue) {
 #else
-        if (answer != KMessageBox::Yes) {
+        if (answer != KMessageBox::Yes && answer != KMessageBox::Continue) {
 #endif
             return;
         }
@@ -1135,6 +1137,7 @@ void DolphinView::slotItemMiddleClicked(int index)
     const KFileItem &item = m_model->fileItem(index);
     const QUrl &url = openItemAsFolderUrl(item);
     const auto modifiers = QGuiApplication::keyboardModifiers();
+    const QString &archiveProtocol = KProtocolManager::protocolForArchiveMimetype(item.mimetype());
     if (!url.isEmpty()) {
         // keep in sync with KUrlNavigator::slotNavigatorButtonClicked
         if (modifiers & Qt::ShiftModifier) {
@@ -1142,13 +1145,15 @@ void DolphinView::slotItemMiddleClicked(int index)
         } else {
             Q_EMIT tabRequested(url);
         }
-    } else if (isTabsForFilesEnabled()) {
+    } else if (!archiveProtocol.isEmpty() && isTabsForFilesEnabled()) {
         // keep in sync with KUrlNavigator::slotNavigatorButtonClicked
         if (modifiers & Qt::ShiftModifier) {
             Q_EMIT activeTabRequested(item.url());
         } else {
             Q_EMIT tabRequested(item.url());
         }
+    } else {
+        Q_EMIT fileMiddleClickActivated(item);
     }
 }
 
@@ -2063,9 +2068,9 @@ void DolphinView::slotRoleEditingFinished(int index, const QByteArray &role, con
             KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Rename, {oldUrl}, newUrl, job);
             job->uiDelegate()->setAutoErrorHandlingEnabled(true);
 
-            forceUrlsSelection(newUrl, {newUrl});
-
             if (!newNameExistsAlready) {
+                forceUrlsSelection(newUrl, {newUrl});
+
                 // Only connect the result signal if there is no item with the new name
                 // in the model yet, see bug 328262.
                 connect(job, &KJob::result, this, &DolphinView::slotRenamingResult);
@@ -2418,3 +2423,5 @@ bool DolphinView::tryShowNameToolTip(QHelpEvent *event)
     }
     return false;
 }
+
+#include "moc_dolphinview.cpp"