#include <KLocalizedString>
#include <KMessageBox>
#include <KMimeTypeEditor>
-#include <KMoreToolsMenuFactory>
#include <KPluginFactory>
#include <KPluginMetaData>
#include <KSharedConfig>
#include <QTextDocument>
#include <KPluginFactory>
+#include <QAction>
K_PLUGIN_CLASS_WITH_JSON(DolphinPart, "dolphinpart.json")
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);
args.setMimeType(item.mimetype());
}
- // Ideally, konqueror should be changed to not require trustedSource for directory views,
- // since the idea was not to need BrowserArguments for non-browser stuff...
- KParts::BrowserArguments browserArgs;
- browserArgs.trustedSource = true;
- Q_EMIT m_extension->openUrlRequest(item.targetUrl(), args, browserArgs);
+ Q_EMIT m_extension->openUrlRequest(item.targetUrl(), args);
}
void DolphinPart::slotItemsActivated(const KFileItemList &items)
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) {
actionGroups.insert(QStringLiteral("editactions"), editActions);
- Q_EMIT m_extension->popupMenu(pos, items, KParts::OpenUrlArguments(), KParts::BrowserArguments(), popupFlags, actionGroups);
+ Q_EMIT m_extension->popupMenu(pos, items, KParts::OpenUrlArguments(), popupFlags, actionGroups);
}
void DolphinPart::slotDirectoryRedirection(const QUrl &oldUrl, const QUrl &newUrl)
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();
// 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();
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()