X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/1be2704214a9685fe85fdf65f30e4921eba0f2c9..68bb0ec22a:/src/dolphinmainwindow.cpp diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 1dcae7ec4..de8601d4e 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -50,7 +50,6 @@ #include #include #include -#include #include #include #include @@ -58,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -290,7 +290,7 @@ void DolphinMainWindow::updateFilterBarAction(bool show) void DolphinMainWindow::openNewMainWindow() { - KRun::run(QStringLiteral("dolphin %u"), QList(), this); + Dolphin::openNewWindow({}, this); } void DolphinMainWindow::openNewActivatedTab() @@ -331,7 +331,7 @@ void DolphinMainWindow::openInNewWindow() } if (!newWindowUrl.isEmpty()) { - KRun::run(QStringLiteral("dolphin %u"), {newWindowUrl}, this); + Dolphin::openNewWindow({newWindowUrl}, this); } } @@ -524,6 +524,13 @@ void DolphinMainWindow::toggleSplitView() updateViewActions(); } +void DolphinMainWindow::toggleSplitStash() +{ + DolphinTabPage* tabPage = m_tabWidget->currentTabPage(); + tabPage->setSplitViewEnabled(false); + tabPage->setSplitViewEnabled(true, QUrl("stash:/")); +} + void DolphinMainWindow::reloadView() { clearStatusBar(); @@ -765,11 +772,9 @@ void DolphinMainWindow::openContextMenu(const QPoint& pos, changeUrl(KIO::upUrl(item.url())); break; - case DolphinContextMenu::OpenParentFolderInNewWindow: { - - KRun::run(QStringLiteral("dolphin %u"), {KIO::upUrl(item.url())}, this); + case DolphinContextMenu::OpenParentFolderInNewWindow: + Dolphin::openNewWindow({KIO::upUrl(item.url())}, this); break; - } case DolphinContextMenu::OpenParentFolderInNewTab: openNewTab(KIO::upUrl(item.url())); @@ -869,10 +874,8 @@ void DolphinMainWindow::updateControlMenu() helpMenu->addSeparator(); helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::ReportBug))); helpMenu->addSeparator(); -#if KCONFIGWIDGETS_VERSION >= QT_VERSION_CHECK(5, 26, 0) helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::Donate))); helpMenu->addSeparator(); -#endif helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::SwitchApplicationLanguage))); helpMenu->addSeparator(); helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::AboutApp))); @@ -1012,12 +1015,8 @@ void DolphinMainWindow::setupActions() SLOT(undo()), actionCollection()); - // need to remove shift+del from cut action, else the shortcut for deletejob - // doesn't work - QAction* cut = KStandardAction::cut(this, SLOT(cut()), actionCollection()); - auto cutShortcuts = cut->shortcuts(); - cutShortcuts.removeAll(QKeySequence(Qt::SHIFT | Qt::Key_Delete)); - actionCollection()->setDefaultShortcuts(cut, cutShortcuts); + + KStandardAction::cut(this, SLOT(cut()), actionCollection()); KStandardAction::copy(this, SLOT(copy()), actionCollection()); QAction* paste = KStandardAction::paste(this, SLOT(paste()), actionCollection()); // The text of the paste-action is modified dynamically by Dolphin @@ -1044,6 +1043,15 @@ void DolphinMainWindow::setupActions() actionCollection()->setDefaultShortcut(split, Qt::Key_F3); connect(split, &QAction::triggered, this, &DolphinMainWindow::toggleSplitView); + QAction* stashSplit = actionCollection()->addAction(QStringLiteral("split_stash")); + actionCollection()->setDefaultShortcut(stashSplit, Qt::CTRL | Qt::Key_S); + stashSplit->setText(i18nc("@action:intoolbar Stash", "Stash")); + stashSplit->setToolTip(i18nc("@info", "Opens the stash virtual directory in a split window")); + stashSplit->setIcon(QIcon::fromTheme(QStringLiteral("folder-visiting"))); + stashSplit->setCheckable(false); + stashSplit->setVisible(KProtocolInfo::isKnownProtocol("stash")); + connect(stashSplit, &QAction::triggered, this, &DolphinMainWindow::toggleSplitStash); + QAction* reload = actionCollection()->addAction(QStringLiteral("reload")); reload->setText(i18nc("@action:inmenu View", "Reload")); actionCollection()->setDefaultShortcut(reload, Qt::Key_F5); @@ -1304,7 +1312,7 @@ void DolphinMainWindow::updateEditActions() KActionCollection* col = actionCollection(); QAction* renameAction = col->action(QStringLiteral("rename")); QAction* moveToTrashAction = col->action(QStringLiteral("move_to_trash")); - QAction* deleteAction = col->action(QStringLiteral("delete")); + QAction* deleteAction = col->action(KStandardAction::name(KStandardAction::DeleteFile)); QAction* cutAction = col->action(KStandardAction::name(KStandardAction::Cut)); QAction* deleteWithTrashShortcut = col->action(QStringLiteral("delete_shortcut")); // see DolphinViewActionHandler