]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinpart.cpp
Add Filelight menu to Tools menu
[dolphin.git] / src / dolphinpart.cpp
index 4ba1f074202797df724f1c0b3cfeb85a2841747c..a7f0d85cd2e939c7d266699370b1ee7cc0514d17 100644 (file)
@@ -28,7 +28,6 @@
 #include <KLocalizedString>
 #include <KMessageBox>
 #include <KMimeTypeEditor>
-#include <KMoreToolsMenuFactory>
 #include <KPluginFactory>
 #include <KPluginMetaData>
 #include <KSharedConfig>
@@ -46,6 +45,7 @@
 #include <QTextDocument>
 
 #include <KPluginFactory>
+#include <QAction>
 
 K_PLUGIN_CLASS_WITH_JSON(DolphinPart, "dolphinpart.json")
 
@@ -140,8 +140,9 @@ DolphinPart::~DolphinPart()
 void DolphinPart::createActions()
 {
     // Edit menu
-
-    m_newFileMenu = new DolphinNewFileMenu(actionCollection()->action(QStringLiteral("create_dir")), this);
+    QAction *newDirAction = actionCollection()->action(QStringLiteral("create_dir"));
+    QAction *newFileAction = actionCollection()->action(QStringLiteral("create_file"));
+    m_newFileMenu = new DolphinNewFileMenu(newDirAction, newFileAction, this);
     m_newFileMenu->setParentWidget(widget());
     connect(m_newFileMenu->menu(), &QMenu::aboutToShow, this, &DolphinPart::updateNewMenu);
 
@@ -467,7 +468,7 @@ void DolphinPart::openSelectionDialog(const QString &title, const QString &text,
 
     dialog->setTextValue(QStringLiteral("*"));
 
-    connect(dialog, &QDialog::accepted, this, [=]() {
+    connect(dialog, &QDialog::accepted, this, [=, this]() {
         const QString pattern = dialog->textValue();
         if (!pattern.isEmpty()) {
             QStringList items = dialog->comboBoxItems();
@@ -527,17 +528,10 @@ void DolphinPart::slotOpenTerminal()
 
 void DolphinPart::slotFindFile()
 {
-    QMenu searchTools;
-    KMoreToolsMenuFactory("dolphin/search-tools").fillMenuFromGroupingNames(&searchTools, {"files-find"}, QUrl::fromLocalFile(localFilePathOrHome()));
-    QList<QAction *> actions = searchTools.actions();
-    if (!(actions.isEmpty())) {
-        actions.first()->trigger();
-    } else {
-        KIO::CommandLauncherJob *job = new KIO::CommandLauncherJob(QStringLiteral("kfind"), {url().toString()}, this);
-        job->setDesktopName(QStringLiteral("org.kde.kfind"));
-        job->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, widget()));
-        job->start();
-    }
+    KIO::CommandLauncherJob *job = new KIO::CommandLauncherJob(QStringLiteral("kfind"), {url().toString()}, this);
+    job->setDesktopName(QStringLiteral("org.kde.kfind"));
+    job->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, widget()));
+    job->start();
 }
 
 void DolphinPart::updateNewMenu()