X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/642a427d03c0bf42fd45dac877a70d4fe56e89aa..37df39b93bf23b89ca760d4dd793788833d9a3e1:/src/dolphinpart.cpp diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp index f5d4f95b6..7e7425121 100644 --- a/src/dolphinpart.cpp +++ b/src/dolphinpart.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -76,7 +77,7 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL connect(&DolphinNewFileMenuObserver::instance(), &DolphinNewFileMenuObserver::errorMessage, this, &DolphinPart::slotErrorMessage); - connect(m_view, &DolphinView::directoryLoadingCompleted, this, static_cast(&DolphinPart::completed)); + connect(m_view, &DolphinView::directoryLoadingCompleted, this, QOverload<>::of(&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); @@ -98,7 +99,7 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL connect(m_view, &DolphinView::requestContextMenu, this, &DolphinPart::slotOpenContextMenu); connect(m_view, &DolphinView::selectionChanged, - m_extension, static_cast(&DolphinPartBrowserExtension::selectionInfo)); + m_extension, QOverload::of(&KParts::BrowserExtension::selectionInfo)); connect(m_view, &DolphinView::selectionChanged, this, &DolphinPart::slotSelectionChanged); connect(m_view, &DolphinView::requestItemInfo, @@ -222,7 +223,7 @@ void DolphinPart::createActions() #ifndef Q_OS_WIN if (KAuthorized::authorize(QStringLiteral("shell_access"))) { m_openTerminalAction = actionCollection()->addAction(QStringLiteral("open_terminal")); - m_openTerminalAction->setIcon(QIcon::fromTheme(QStringLiteral("utilities-terminal"))); + m_openTerminalAction->setIcon(QIcon::fromTheme(QStringLiteral("dialog-scripts"))); m_openTerminalAction->setText(i18nc("@action:inmenu Tools", "Open &Terminal")); connect(m_openTerminalAction, &QAction::triggered, this, &DolphinPart::slotOpenTerminal); actionCollection()->setDefaultShortcut(m_openTerminalAction, Qt::Key_F4); @@ -532,28 +533,21 @@ void DolphinPart::setNameFilter(const QString& nameFilter) void DolphinPart::slotOpenTerminal() { - QString dir(QDir::homePath()); - - QUrl u(url()); - - // If the given directory is not local, it can still be the URL of an - // ioslave using UDS_LOCAL_PATH which to be converted first. - KIO::StatJob* statJob = KIO::mostLocalUrl(u); - KJobWidgets::setWindow(statJob, widget()); - statJob->exec(); - u = statJob->mostLocalUrl(); - - //If the URL is local after the above conversion, set the directory. - if (u.isLocalFile()) { - dir = u.toLocalFile(); - } - - KToolInvocation::invokeTerminal(QString(), dir); + KToolInvocation::invokeTerminal(QString(), KParts::ReadOnlyPart::localFilePath()); } void DolphinPart::slotFindFile() { - KRun::run(QStringLiteral("kfind"), {url()}, widget()); + QMenu searchTools; + KMoreToolsMenuFactory("dolphin/search-tools").fillMenuFromGroupingNames( + &searchTools, { "files-find" }, QUrl::fromLocalFile(KParts::ReadOnlyPart::localFilePath()) + ); + QList actions = searchTools.actions(); + if (!(actions.isEmpty())) { + actions.first()->trigger(); + } else { + KRun::run(QStringLiteral("kfind"), {url()}, widget()); + } } void DolphinPart::updateNewMenu() @@ -562,7 +556,7 @@ void DolphinPart::updateNewMenu() m_newFileMenu->checkUpToDate(); m_newFileMenu->setViewShowsHiddenFiles(m_view->hiddenFilesShown()); // And set the files that the menu apply on : - m_newFileMenu->setPopupFiles(url()); + m_newFileMenu->setPopupFiles(QList() << url()); } void DolphinPart::updateStatusBar() @@ -579,7 +573,7 @@ void DolphinPart::updateProgress(int percent) void DolphinPart::createDirectory() { m_newFileMenu->setViewShowsHiddenFiles(m_view->hiddenFilesShown()); - m_newFileMenu->setPopupFiles(url()); + m_newFileMenu->setPopupFiles(QList() << url()); m_newFileMenu->createDirectory(); }