X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/349eb6cf5e2971b286efb08cabac5c027c023629..e1b325a867ede95c5815ca11998017c67fc78ea9:/src/dolphinpart.cpp diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp index 6d630b1e0..a7f0d85cd 100644 --- a/src/dolphinpart.cpp +++ b/src/dolphinpart.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -46,6 +45,7 @@ #include #include +#include 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); @@ -388,7 +389,8 @@ void DolphinPart::slotOpenContextMenu(const QPoint &pos, const KFileItem &_item, const bool supportsMoving = capabilities.supportsMoving(); if (capabilities.supportsDeleting()) { - const bool showDeleteAction = (KSharedConfig::openConfig()->group("KDE").readEntry("ShowDeleteCommand", false) || !item.isLocalFile()); + const bool showDeleteAction = + (KSharedConfig::openConfig()->group(QStringLiteral("KDE")).readEntry("ShowDeleteCommand", false) || !item.isLocalFile()); const bool showMoveToTrashAction = capabilities.isLocal() && supportsMoving; if (showDeleteAction && showMoveToTrashAction) { @@ -460,13 +462,13 @@ void DolphinPart::openSelectionDialog(const QString &title, const QString &text, dialog->setWindowTitle(title); dialog->setLabelText(text); - const KConfigGroup group = KSharedConfig::openConfig("dolphinpartrc")->group("Select Dialog"); + const KConfigGroup group = KSharedConfig::openConfig("dolphinpartrc")->group(QStringLiteral("Select Dialog")); dialog->setComboBoxEditable(true); dialog->setComboBoxItems(group.readEntry("History", QStringList())); 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(); @@ -475,7 +477,7 @@ void DolphinPart::openSelectionDialog(const QString &title, const QString &text, // Need to evaluate this again here, because the captured value is const // (even if the const were removed from 'const KConfigGroup group =' above). - KConfigGroup group = KSharedConfig::openConfig("dolphinpartrc")->group("Select Dialog"); + KConfigGroup group = KSharedConfig::openConfig("dolphinpartrc")->group(QStringLiteral("Select Dialog")); // Limit the size of the saved history. group.writeEntry("History", items.mid(0, 10)); group.sync(); @@ -526,17 +528,10 @@ void DolphinPart::slotOpenTerminal() void DolphinPart::slotFindFile() { - QMenu searchTools; - KMoreToolsMenuFactory("dolphin/search-tools").fillMenuFromGroupingNames(&searchTools, {"files-find"}, QUrl::fromLocalFile(localFilePathOrHome())); - QList 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()