#include <KLocalizedString>
#include <KMessageBox>
#include <KMimeTypeEditor>
+#include <KNS3/KMoreToolsMenuFactory>
#include <KPluginFactory>
#include <KRun>
#include <KSharedConfig>
connect(&DolphinNewFileMenuObserver::instance(), &DolphinNewFileMenuObserver::errorMessage,
this, &DolphinPart::slotErrorMessage);
- connect(m_view, &DolphinView::directoryLoadingCompleted, this, static_cast<void(DolphinPart::*)()>(&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);
connect(m_view, &DolphinView::requestContextMenu,
this, &DolphinPart::slotOpenContextMenu);
connect(m_view, &DolphinView::selectionChanged,
- m_extension, static_cast<void(DolphinPartBrowserExtension::*)(const KFileItemList&)>(&DolphinPartBrowserExtension::selectionInfo));
+ m_extension, QOverload<const KFileItemList&>::of(&KParts::BrowserExtension::selectionInfo));
connect(m_view, &DolphinView::selectionChanged,
this, &DolphinPart::slotSelectionChanged);
connect(m_view, &DolphinView::requestItemInfo,
#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);
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<QAction*> actions = searchTools.actions();
+ if (!(actions.isEmpty())) {
+ actions.first()->trigger();
+ } else {
+ KRun::run(QStringLiteral("kfind"), {url()}, widget());
+ }
}
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<QUrl>() << url());
}
void DolphinPart::updateStatusBar()
void DolphinPart::createDirectory()
{
m_newFileMenu->setViewShowsHiddenFiles(m_view->hiddenFilesShown());
- m_newFileMenu->setPopupFiles(url());
+ m_newFileMenu->setPopupFiles(QList<QUrl>() << url());
m_newFileMenu->createDirectory();
}