]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
Dolphin: Remove unused code, fix clazy warnings
[dolphin.git] / src / dolphinmainwindow.cpp
index 0d31df2da08bacff1ffdcb61758020d6a8c182f8..449d7b4ffca0d75063156773eb070027b6715a20 100644 (file)
@@ -48,7 +48,6 @@
 #include <KJobWidgets>
 #include <KLocalizedString>
 #include <KMessageBox>
-#include <KMoreToolsMenuFactory>
 #include <KProtocolInfo>
 #include <KProtocolManager>
 #include <KShell>
@@ -1127,15 +1126,20 @@ void DolphinMainWindow::toggleShowMenuBar()
 QPointer<QAction> DolphinMainWindow::preferredSearchTool()
 {
     m_searchTools.clear();
-    KMoreToolsMenuFactory("dolphin/search-tools").fillMenuFromGroupingNames(&m_searchTools, {"files-find"}, m_activeViewContainer->url());
-    QList<QAction *> actions = m_searchTools.actions();
-    if (actions.isEmpty()) {
-        return nullptr;
-    }
-    QAction *action = actions.first();
-    if (action->isSeparator()) {
+
+    KService::Ptr kfind = KService::serviceByDesktopName(QStringLiteral("org.kde.kfind"));
+
+    if (!kfind) {
         return nullptr;
     }
+
+    auto *action = new QAction(QIcon::fromTheme(kfind->icon()), kfind->name(), this);
+
+    connect(action, &QAction::triggered, this, [kfind] {
+        auto *job = new KIO::ApplicationLauncherJob(kfind);
+        job->start();
+    });
+
     return action;
 }
 
@@ -1305,7 +1309,7 @@ void DolphinMainWindow::slotWriteStateChanged(bool isFolderWritable)
 void DolphinMainWindow::openContextMenu(const QPoint &pos, const KFileItem &item, const KFileItemList &selectedItems, const QUrl &url)
 {
     QPointer<DolphinContextMenu> contextMenu = new DolphinContextMenu(this, item, selectedItems, url, &m_fileItemActions);
-    contextMenu.data()->exec(pos);
+    contextMenu->exec(pos);
 
     // Delete the menu, unless it has been deleted in its own nested event loop already.
     if (contextMenu) {
@@ -2135,6 +2139,7 @@ void DolphinMainWindow::setupDockWidgets()
         DolphinDockWidget *terminalDock = new DolphinDockWidget(i18nc("@title:window Shell terminal", "Terminal"));
         terminalDock->setLocked(lock);
         terminalDock->setObjectName(QStringLiteral("terminalDock"));
+        terminalDock->setContentsMargins(0, 0, 0, 0);
         m_terminalPanel = new TerminalPanel(terminalDock);
         m_terminalPanel->setCustomContextMenuActions({lockLayoutAction});
         terminalDock->setWidget(m_terminalPanel);