]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinpart.cpp
Merge branch 'release/22.04'
[dolphin.git] / src / dolphinpart.cpp
index 935602540b70ec746b347ea834cdbeaf6e9517ba..0f10a7769fe2513688f4da5b9ca0869d81bf9dfa 100644 (file)
@@ -11,7 +11,6 @@
 #include "dolphinpart_ext.h"
 #include "dolphinremoveaction.h"
 #include "kitemviews/kfileitemmodel.h"
-#include "kitemviews/private/kfileitemmodeldirlister.h"
 #include "views/dolphinnewfilemenuobserver.h"
 #include "views/dolphinremoteencoding.h"
 #include "views/dolphinview.h"
@@ -22,6 +21,7 @@
 #include <KAuthorized>
 #include <KConfigGroup>
 #include <KDialogJobUiDelegate>
+#include <KDirLister>
 #include <KFileItemListProperties>
 #include <KIconLoader>
 #include <KJobWidgets>
@@ -32,7 +32,7 @@
 #include <KPluginFactory>
 #include <KIO/CommandLauncherJob>
 #include <KSharedConfig>
-#include <KToolInvocation>
+#include <KTerminalLauncherJob>
 
 #include <QActionGroup>
 #include <QApplication>
@@ -68,7 +68,7 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent,
     connect(&DolphinNewFileMenuObserver::instance(), &DolphinNewFileMenuObserver::errorMessage,
             this, &DolphinPart::slotErrorMessage);
 
-    connect(m_view, &DolphinView::directoryLoadingCompleted, this, QOverload<>::of(&KParts::ReadOnlyPart::completed));
+    connect(m_view, &DolphinView::directoryLoadingCompleted, this, &KParts::ReadOnlyPart::completed);
     connect(m_view, &DolphinView::directoryLoadingCompleted, this, &DolphinPart::updatePasteAction);
     connect(m_view, &DolphinView::directoryLoadingProgress, this, &DolphinPart::updateProgress);
     connect(m_view, &DolphinView::errorMessage, this, &DolphinPart::slotErrorMessage);
@@ -94,7 +94,7 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent,
     connect(m_view, &DolphinView::requestContextMenu,
             this, &DolphinPart::slotOpenContextMenu);
     connect(m_view, &DolphinView::selectionChanged,
-            m_extension, QOverload<const KFileItemList&>::of(&KParts::BrowserExtension::selectionInfo));
+            m_extension, &KParts::BrowserExtension::selectionInfo);
     connect(m_view, &DolphinView::selectionChanged,
             this, &DolphinPart::slotSelectionChanged);
     connect(m_view, &DolphinView::requestItemInfo,
@@ -146,8 +146,6 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent,
 
     // TODO there was a "always open a new window" (when clicking on a directory) setting in konqueror
     // (sort of spacial navigation)
-
-    loadPlugins(this, this, componentName());
 }
 
 DolphinPart::~DolphinPart()
@@ -201,9 +199,6 @@ void DolphinPart::createActions()
     createGoAction("go_network_folders", "folder-remote",
                    i18nc("@action:inmenu Go", "&Network Folders"), QStringLiteral("remote:/"),
                    goActionGroup);
-    createGoAction("go_settings", "preferences-system",
-                   i18nc("@action:inmenu Go", "Sett&ings"), QStringLiteral("settings:/"),
-                   goActionGroup);
     createGoAction("go_trash", "user-trash",
                    i18nc("@action:inmenu Go", "Trash"), QStringLiteral("trash:/"),
                    goActionGroup);
@@ -390,8 +385,8 @@ void DolphinPart::createNewWindow(const QUrl& url)
 
 void DolphinPart::slotOpenContextMenu(const QPoint& pos,
                                       const KFileItem& _item,
-                                      const QUrl &,
-                                      const QList<QAction*>& customActions)
+                                      const KFileItemList &selectedItems,
+                                      const QUrl &)
 {
     KParts::BrowserExtension::PopupFlags popupFlags = KParts::BrowserExtension::DefaultPopupItems
                                                       | KParts::BrowserExtension::ShowProperties
@@ -407,13 +402,11 @@ void DolphinPart::slotOpenContextMenu(const QPoint& pos,
             item.setUrl(url()); // ensure we use the view url, not the canonical path (#213799)
     }
 
-    // TODO: We should change the signature of the slots (and signals) for being able
-    //       to tell for which items we want a popup.
     KFileItemList items;
-    if (m_view->selectedItems().isEmpty()) {
+    if (selectedItems.isEmpty()) {
         items.append(item);
     } else {
-        items = m_view->selectedItems();
+        items = selectedItems;
     }
 
     KFileItemListProperties capabilities(items);
@@ -421,7 +414,6 @@ void DolphinPart::slotOpenContextMenu(const QPoint& pos,
     KParts::BrowserExtension::ActionGroupMap actionGroups;
     QList<QAction *> editActions;
     editActions += m_view->versionControlActions(m_view->selectedItems());
-    editActions += customActions;
 
     if (!_item.isNull()) { // only for context menu on one or more items
         const bool supportsMoving = capabilities.supportsMoving();
@@ -570,7 +562,9 @@ QString DolphinPart::localFilePathOrHome() const
 
 void DolphinPart::slotOpenTerminal()
 {
-    KToolInvocation::invokeTerminal(QString(), localFilePathOrHome());
+    auto job = new KTerminalLauncherJob(QString());
+    job->setWorkingDirectory(localFilePathOrHome());
+    job->start();
 }
 
 void DolphinPart::slotFindFile()
@@ -594,7 +588,6 @@ void DolphinPart::updateNewMenu()
 {
     // As requested by KNewFileMenu :
     m_newFileMenu->checkUpToDate();
-    m_newFileMenu->setViewShowsHiddenFiles(m_view->hiddenFilesShown());
     // And set the files that the menu apply on :
     m_newFileMenu->setPopupFiles(QList<QUrl>() << url());
 }
@@ -611,7 +604,6 @@ void DolphinPart::updateProgress(int percent)
 
 void DolphinPart::createDirectory()
 {
-    m_newFileMenu->setViewShowsHiddenFiles(m_view->hiddenFilesShown());
     m_newFileMenu->setPopupFiles(QList<QUrl>() << url());
     m_newFileMenu->createDirectory();
 }