+void DolphinMainWindow::slotDoubleClickViewBackground(Qt::MouseButton button)
+{
+ if (button != Qt::MouseButton::LeftButton) {
+ // only handle left mouse button for now
+ return;
+ }
+
+ GeneralSettings *settings = GeneralSettings::self();
+ QString clickAction = settings->doubleClickViewAction();
+
+ DolphinView *view = activeViewContainer()->view();
+ if (view == nullptr || clickAction == "none") {
+ return;
+ }
+
+ if (clickAction == customCommand) {
+ // run custom command set by the user
+ QString path = view->url().toLocalFile();
+ QString clickCustomAction = settings->doubleClickViewCustomAction();
+ clickCustomAction.replace("{path}", path.prepend('"').append('"'));
+
+ m_job = new KIO::CommandLauncherJob(clickCustomAction);
+ m_job->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
+ m_job->start();
+
+ } else {
+ // get the action set by the user and trigger it
+ const KActionCollection *actions = actionCollection();
+ QAction *action = actions->action(clickAction);
+ if (action == nullptr) {
+ qCWarning(DolphinDebug) << QStringLiteral("Double-click view: action `%1` was not found").arg(clickAction);
+ return;
+ }
+ action->trigger();
+ }
+}
+