X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/d6beab23ec4fae5d8ccbe53604d096ab2c135e49..cdccbf471a88a34d7673712f6f6bead559dcc5be:/src/dolphinmainwindow.cpp diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 05fbb41b2..cb94e8657 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -8,6 +8,7 @@ #include "dolphinmainwindow.h" +#include "admin/workerintegration.h" #include "dolphin_generalsettings.h" #include "dolphinbookmarkhandler.h" #include "dolphincontextmenu.h" @@ -40,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -81,6 +83,7 @@ #include #include #include +#include #include @@ -781,8 +784,14 @@ void DolphinMainWindow::updateNewMenu() void DolphinMainWindow::createDirectory() { - m_newFileMenu->setWorkingDirectory(activeViewContainer()->url()); - m_newFileMenu->createDirectory(); + // When creating directory, namejob is being run. In network folders, + // this job can take long time, so instead of starting multiple namejobs, + // just check if we are already running one. This prevents opening multiple + // dialogs. BUG:481401 + if (!m_newFileMenu->isCreateDirectoryRunning()) { + m_newFileMenu->setWorkingDirectory(activeViewContainer()->url()); + m_newFileMenu->createDirectory(); + } } void DolphinMainWindow::quit() @@ -1487,6 +1496,7 @@ void DolphinMainWindow::updateHamburgerMenu() } menu->addAction(ac->action(QStringLiteral("show_hidden_files"))); menu->addAction(ac->action(QStringLiteral("sort"))); + menu->addAction(ac->action(QStringLiteral("group"))); menu->addAction(ac->action(QStringLiteral("additional_info"))); if (!GeneralSettings::showStatusBar() || !GeneralSettings::showZoomSlider()) { menu->addAction(ac->action(QStringLiteral("zoom"))); @@ -1856,6 +1866,8 @@ void DolphinMainWindow::setupActions() // setup 'View' menu // (note that most of it is set up in DolphinViewActionHandler) + Admin::WorkerIntegration::createActAsAdminAction(actionCollection(), this); + m_splitViewAction = actionCollection()->add(QStringLiteral("split_view")); m_splitViewMenuAction = actionCollection()->addAction(QStringLiteral("split_view_menu")); @@ -2305,7 +2317,7 @@ void DolphinMainWindow::setupDockWidgets() placesDock->setLocked(lock); placesDock->setObjectName(QStringLiteral("placesDock")); placesDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); - + m_placesPanel = new PlacesPanel(placesDock); m_placesPanel->setCustomContextMenuActions({lockLayoutAction}); placesDock->setWidget(m_placesPanel); @@ -2586,6 +2598,7 @@ void DolphinMainWindow::connectViewSignals(DolphinViewContainer *container) connect(view, &DolphinView::goForwardRequested, this, &DolphinMainWindow::goForward); connect(view, &DolphinView::urlActivated, this, &DolphinMainWindow::handleUrl); connect(view, &DolphinView::goUpRequested, this, &DolphinMainWindow::goUp); + connect(view, &DolphinView::doubleClickViewBackground, this, &DolphinMainWindow::slotDoubleClickViewBackground); connect(container->urlNavigatorInternalWithHistory(), &KUrlNavigator::urlChanged, this, &DolphinMainWindow::changeUrl); connect(container->urlNavigatorInternalWithHistory(), &KUrlNavigator::historyChanged, this, &DolphinMainWindow::updateHistory); @@ -2902,4 +2915,38 @@ bool DolphinMainWindow::isItemVisibleInAnyView(const QString &urlOfItem) return m_tabWidget->isItemVisibleInAnyView(QUrl::fromUserInput(urlOfItem)); } +void DolphinMainWindow::slotDoubleClickViewBackground(Qt::MouseButton button) +{ + Q_UNUSED(button) // might be of use later + + 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(); + } +} + #include "moc_dolphinmainwindow.cpp"