From 11fb9344c0fac2544479dbd7a9913eba740b74b5 Mon Sep 17 00:00:00 2001 From: Felix Ernst Date: Tue, 22 Aug 2023 12:15:22 +0000 Subject: Allow to not ask again confirmation when opening 5 or more files or terminal at once BUG: 473513 --- src/dolphinmainwindow.cpp | 7 ++++--- src/views/dolphinview.cpp | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 68704b89a..afb86e152 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1189,11 +1189,12 @@ void DolphinMainWindow::openTerminalHere() {}, #endif KGuiItem(i18ncp("@action:button", "Open %1 Terminal", "Open %1 Terminals", urls.count()), QStringLiteral("utilities-terminal")), - KStandardGuiItem::cancel()); + KStandardGuiItem::cancel(), + QStringLiteral("ConfirmOpenManyTerminals")); #if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) - if (answer != KMessageBox::PrimaryAction) { + if (answer != KMessageBox::PrimaryAction && answer != KMessageBox::Continue) { #else - if (answer != KMessageBox::Yes) { + if (answer != KMessageBox::Yes && answer != KMessageBox::Continue) { #endif return; } diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index e0d01d1e8..1d01b4c98 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -1093,11 +1093,12 @@ void DolphinView::slotItemsActivated(const KItemSet &indexes) {}, #endif KGuiItem(i18ncp("@action:button", "Open %1 Item", "Open %1 Items", indexes.count()), QStringLiteral("document-open")), - KStandardGuiItem::cancel()); + KStandardGuiItem::cancel(), + QStringLiteral("ConfirmOpenManyFolders")); #if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) - if (answer != KMessageBox::PrimaryAction) { + if (answer != KMessageBox::PrimaryAction && answer != KMessageBox::Continue) { #else - if (answer != KMessageBox::Yes) { + if (answer != KMessageBox::Yes && answer != KMessageBox::Continue) { #endif return; } -- cgit v1.3 From 46d2d147bf0bcbfc6c8a69e1c49e0590b679b7b4 Mon Sep 17 00:00:00 2001 From: Méven Car Date: Thu, 24 Aug 2023 10:27:02 +0200 Subject: Special case file opening with middle click for executable scripts Since the first action would launch the script, we can use the first application associated to open the file. --- src/dolphinviewcontainer.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index ffd0d9b5e..2811a1ee4 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -745,8 +745,23 @@ void DolphinViewContainer::slotfileMiddleClickActivated(const KFileItem &item) { KService::List services = KApplicationTrader::queryByMimeType(item.mimetype()); - if (services.length() >= 2) { - auto service = services.at(1); + int indexOfAppToOpenFileWith = 1; + + // executable scripts + auto mimeType = item.currentMimeType(); + if (item.isLocalFile() && mimeType.inherits(QStringLiteral("application/x-executable")) && mimeType.inherits(QStringLiteral("text/plain")) + && QFileInfo(item.localPath()).isExecutable()) { + KConfigGroup cfgGroup(KSharedConfig::openConfig(QStringLiteral("kiorc")), "Executable scripts"); + const QString value = cfgGroup.readEntry("behaviourOnLaunch", "alwaysAsk"); + + // in case KIO::WidgetsOpenOrExecuteFileHandler::promptUserOpenOrExecute would not open the file + if (value != QLatin1String("open")) { + indexOfAppToOpenFileWith = 0; + } + } + + if (services.length() >= indexOfAppToOpenFileWith + 1) { + auto service = services.at(indexOfAppToOpenFileWith); KIO::ApplicationLauncherJob *job = new KIO::ApplicationLauncherJob(service, this); job->setUrls({item.url()}); -- cgit v1.3 From 1318f16fd7b84de79c04eb468d61e1c9b7b52e15 Mon Sep 17 00:00:00 2001 From: Méven Car Date: Mon, 28 Aug 2023 10:32:35 +0200 Subject: Clean obsolete ifdefs since dolphin requires KF 5.101+ --- src/dolphincontextmenu.cpp | 8 ---- src/dolphinmainwindow.cpp | 30 --------------- src/dolphinpart.cpp | 8 ---- src/dolphinviewcontainer.cpp | 16 +------- src/kitemviews/kfileitemmodel.cpp | 12 ------ src/panels/folders/treeviewcontextmenu.cpp | 30 +-------------- .../contextmenu/contextmenusettingspage.cpp | 9 ----- src/settings/dolphinsettingsdialog.cpp | 12 ------ src/settings/viewpropertiesdialog.cpp | 8 ---- src/tests/kfileitemmodeltest.cpp | 3 -- src/trash/dolphintrash.cpp | 19 +-------- src/views/dolphinview.cpp | 45 +--------------------- 12 files changed, 5 insertions(+), 195 deletions(-) (limited to 'src') diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index 4addf53cd..99db5584c 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -171,11 +171,7 @@ void DolphinContextMenu::addDirectoryItemContextMenu() // set up 'Create New' menu DolphinNewFileMenu *newFileMenu = new DolphinNewFileMenu(m_mainWindow->actionCollection(), m_mainWindow); newFileMenu->checkUpToDate(); -#if KIO_VERSION >= QT_VERSION_CHECK(5, 97, 0) newFileMenu->setWorkingDirectory(m_fileInfo.url()); -#else - newFileMenu->setPopupFiles(QList() << m_fileInfo.url()); -#endif newFileMenu->setEnabled(selectedItemsProps.supportsWriting()); connect(newFileMenu, &DolphinNewFileMenu::fileCreated, newFileMenu, &DolphinNewFileMenu::deleteLater); connect(newFileMenu, &DolphinNewFileMenu::directoryCreated, newFileMenu, &DolphinNewFileMenu::deleteLater); @@ -281,11 +277,7 @@ void DolphinContextMenu::addViewportContextMenu() // Set up and insert 'Create New' menu KNewFileMenu *newFileMenu = m_mainWindow->newFileMenu(); newFileMenu->checkUpToDate(); -#if KIO_VERSION >= QT_VERSION_CHECK(5, 97, 0) newFileMenu->setWorkingDirectory(m_baseUrl); -#else - newFileMenu->setPopupFiles(QList() << m_baseUrl); -#endif addMenu(newFileMenu->menu()); // Show "open with" menu items even if the dir is empty, because there are legitimate diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index afb86e152..38843f82c 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -42,12 +42,7 @@ #include #include #include -#include -#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0) #include -#else -#include -#endif #include #include #include @@ -69,9 +64,7 @@ #include #include #include - #include -#include #include #include @@ -676,20 +669,12 @@ void DolphinMainWindow::readProperties(const KConfigGroup &group) void DolphinMainWindow::updateNewMenu() { m_newFileMenu->checkUpToDate(); -#if KIO_VERSION >= QT_VERSION_CHECK(5, 97, 0) m_newFileMenu->setWorkingDirectory(activeViewContainer()->url()); -#else - m_newFileMenu->setPopupFiles(QList() << activeViewContainer()->url()); -#endif } void DolphinMainWindow::createDirectory() { -#if KIO_VERSION >= QT_VERSION_CHECK(5, 97, 0) m_newFileMenu->setWorkingDirectory(activeViewContainer()->url()); -#else - m_newFileMenu->setPopupFiles(QList() << activeViewContainer()->url()); -#endif m_newFileMenu->createDirectory(); } @@ -1177,25 +1162,14 @@ void DolphinMainWindow::openTerminalHere() if (urls.count() > 5) { QString question = i18np("Are you sure you want to open 1 terminal window?", "Are you sure you want to open %1 terminal windows?", urls.count()); -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) const int answer = KMessageBox::warningTwoActions( this, question, {}, -#else - const int answer = KMessageBox::warningYesNo( - this, - question, - {}, -#endif KGuiItem(i18ncp("@action:button", "Open %1 Terminal", "Open %1 Terminals", urls.count()), QStringLiteral("utilities-terminal")), KStandardGuiItem::cancel(), QStringLiteral("ConfirmOpenManyTerminals")); -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) if (answer != KMessageBox::PrimaryAction && answer != KMessageBox::Continue) { -#else - if (answer != KMessageBox::Yes && answer != KMessageBox::Continue) { -#endif return; } } @@ -1265,11 +1239,7 @@ void DolphinMainWindow::handleUrl(const QUrl &url) activeViewContainer()->setUrl(url); } else { m_lastHandleUrlOpenJob = new KIO::OpenUrlJob(url); -#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0) m_lastHandleUrlOpenJob->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this)); -#else - m_lastHandleUrlOpenJob->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this)); -#endif m_lastHandleUrlOpenJob->setShowOpenOrExecuteDialog(true); connect(m_lastHandleUrlOpenJob, &KIO::OpenUrlJob::mimeTypeFound, this, [this, url](const QString &mimetype) { diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp index f8da1c353..aac278035 100644 --- a/src/dolphinpart.cpp +++ b/src/dolphinpart.cpp @@ -548,11 +548,7 @@ void DolphinPart::updateNewMenu() // As requested by KNewFileMenu : m_newFileMenu->checkUpToDate(); // And set the files that the menu apply on : -#if KIO_VERSION >= QT_VERSION_CHECK(5, 97, 0) m_newFileMenu->setWorkingDirectory(url()); -#else - m_newFileMenu->setPopupFiles(QList() << url()); -#endif } void DolphinPart::updateStatusBar() @@ -567,11 +563,7 @@ void DolphinPart::updateProgress(int percent) void DolphinPart::createDirectory() { -#if KIO_VERSION >= QT_VERSION_CHECK(5, 97, 0) m_newFileMenu->setWorkingDirectory(url()); -#else - m_newFileMenu->setPopupFiles(QList() << url()); -#endif m_newFileMenu->createDirectory(); } diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index 2811a1ee4..63d5bd27b 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -23,20 +23,16 @@ #if HAVE_KACTIVITIES #include #endif +#include #include #include -#include -#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0) #include -#else -#include -#endif -#include #include #include #include #include #include +#include #include #include @@ -731,11 +727,7 @@ void DolphinViewContainer::slotItemActivated(const KFileItem &item) } KIO::OpenUrlJob *job = new KIO::OpenUrlJob(item.targetUrl(), item.mimetype()); -#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0) job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this)); -#else - job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this)); -#endif job->setShowOpenOrExecuteDialog(true); connect(job, &KIO::OpenUrlJob::finished, this, &DolphinViewContainer::slotOpenUrlFinished); job->start(); @@ -766,11 +758,7 @@ void DolphinViewContainer::slotfileMiddleClickActivated(const KFileItem &item) KIO::ApplicationLauncherJob *job = new KIO::ApplicationLauncherJob(service, this); job->setUrls({item.url()}); -#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0) job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this)); -#else - job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this)); -#endif connect(job, &KIO::OpenUrlJob::finished, this, &DolphinViewContainer::slotOpenUrlFinished); job->start(); } diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index bbe725dfd..40c76c7ef 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -263,11 +263,7 @@ void KFileItemModel::setShowTrashMime(bool show) void KFileItemModel::setShowHiddenFiles(bool show) { -#if KIO_VERSION < QT_VERSION_CHECK(5, 100, 0) - m_dirLister->setShowingDotFiles(show); -#else m_dirLister->setShowHiddenFiles(show); -#endif setShowTrashMime(show); m_dirLister->emitChanges(); if (show) { @@ -277,11 +273,7 @@ void KFileItemModel::setShowHiddenFiles(bool show) bool KFileItemModel::showHiddenFiles() const { -#if KIO_VERSION < QT_VERSION_CHECK(5, 100, 0) - return m_dirLister->showingDotFiles(); -#else return m_dirLister->showHiddenFiles(); -#endif } void KFileItemModel::setShowDirectoriesOnly(bool enabled) @@ -624,9 +616,7 @@ bool KFileItemModel::setExpanded(int index, bool expanded) m_expandedDirs.remove(targetUrl); m_dirLister->stop(url); -#if KIO_VERSION >= QT_VERSION_CHECK(5, 92, 0) m_dirLister->forgetDirs(url); -#endif const int parentLevel = expandedParentsCount(index); const int itemCount = m_itemData.count(); @@ -642,9 +632,7 @@ bool KFileItemModel::setExpanded(int index, bool expanded) const QUrl url = itemData->item.url(); m_expandedDirs.remove(targetUrl); m_dirLister->stop(url); // TODO: try to unit-test this, see https://bugs.kde.org/show_bug.cgi?id=332102#c11 -#if KIO_VERSION >= QT_VERSION_CHECK(5, 92, 0) m_dirLister->forgetDirs(url); -#endif expandedChildren.append(targetUrl); } ++childIndex; diff --git a/src/panels/folders/treeviewcontextmenu.cpp b/src/panels/folders/treeviewcontextmenu.cpp index e063ca85e..45e146a2e 100644 --- a/src/panels/folders/treeviewcontextmenu.cpp +++ b/src/panels/folders/treeviewcontextmenu.cpp @@ -22,13 +22,8 @@ #include #include -#include -#if KIO_VERSION >= QT_VERSION_CHECK(5, 100, 0) #include -#else -#include -#include -#endif +#include #include #include @@ -197,39 +192,16 @@ void TreeViewContextMenu::rename() void TreeViewContextMenu::moveToTrash() { -#if KIO_VERSION >= QT_VERSION_CHECK(5, 100, 0) using Iface = KIO::AskUserActionInterface; auto *deleteJob = new KIO::DeleteOrTrashJob(QList{m_fileItem.url()}, Iface::Trash, Iface::DefaultConfirmation, m_parent); deleteJob->start(); -#else - const QList list{m_fileItem.url()}; - KIO::JobUiDelegate uiDelegate; - uiDelegate.setWindow(m_parent); - if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Trash, KIO::JobUiDelegate::DefaultConfirmation)) { - KIO::Job *job = KIO::trash(list); - KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Trash, list, QUrl(QStringLiteral("trash:/")), job); - KJobWidgets::setWindow(job, m_parent); - job->uiDelegate()->setAutoErrorHandlingEnabled(true); - } -#endif } void TreeViewContextMenu::deleteItem() { -#if KIO_VERSION >= QT_VERSION_CHECK(5, 100, 0) using Iface = KIO::AskUserActionInterface; auto *deleteJob = new KIO::DeleteOrTrashJob(QList{m_fileItem.url()}, Iface::Delete, Iface::DefaultConfirmation, m_parent); deleteJob->start(); -#else - const QList list{m_fileItem.url()}; - KIO::JobUiDelegate uiDelegate; - uiDelegate.setWindow(m_parent); - if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Delete, KIO::JobUiDelegate::DefaultConfirmation)) { - KIO::Job *job = KIO::del(list); - KJobWidgets::setWindow(job, m_parent); - job->uiDelegate()->setAutoErrorHandlingEnabled(true); - } -#endif } void TreeViewContextMenu::showProperties() diff --git a/src/settings/contextmenu/contextmenusettingspage.cpp b/src/settings/contextmenu/contextmenusettingspage.cpp index 03e55ba32..fa3d0b256 100644 --- a/src/settings/contextmenu/contextmenusettingspage.cpp +++ b/src/settings/contextmenu/contextmenusettingspage.cpp @@ -206,24 +206,15 @@ void ContextMenuSettingsPage::applySettings() VersionControlSettings::self()->save(); if (!laterSelected) { -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) KMessageBox::ButtonCode promptRestart = KMessageBox::questionTwoActions(window(), -#else - KMessageBox::ButtonCode promptRestart = - KMessageBox::questionYesNo(window(), -#endif i18nc("@info", "Dolphin must be restarted to apply the " "updated version control system settings."), i18nc("@info", "Restart now?"), KGuiItem(QApplication::translate("KStandardGuiItem", "&Restart"), QStringLiteral("dialog-restart")), KGuiItem(QApplication::translate("KStandardGuiItem", "&Later"), QStringLiteral("dialog-later"))); -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) if (promptRestart == KMessageBox::ButtonCode::PrimaryAction) { -#else - if (promptRestart == KMessageBox::ButtonCode::Yes) { -#endif Dolphin::openNewWindow(); qApp->quit(); } else { diff --git a/src/settings/dolphinsettingsdialog.cpp b/src/settings/dolphinsettingsdialog.cpp index 45aa7b65a..3a2ad31e9 100644 --- a/src/settings/dolphinsettingsdialog.cpp +++ b/src/settings/dolphinsettingsdialog.cpp @@ -160,29 +160,17 @@ void DolphinSettingsDialog::closeEvent(QCloseEvent *event) return; } -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) const auto response = KMessageBox::warningTwoActionsCancel(this, -#else - const auto response = KMessageBox::warningYesNoCancel(this, -#endif i18n("You have unsaved changes. Do you want to apply the changes or discard them?"), i18n("Warning"), KStandardGuiItem::save(), KStandardGuiItem::discard(), KStandardGuiItem::cancel()); switch (response) { -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) case KMessageBox::PrimaryAction: -#else - case KMessageBox::Yes: -#endif applySettings(); Q_FALLTHROUGH(); -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) case KMessageBox::SecondaryAction: -#else - case KMessageBox::No: -#endif event->accept(); break; case KMessageBox::Cancel: diff --git a/src/settings/viewpropertiesdialog.cpp b/src/settings/viewpropertiesdialog.cpp index f7bd754b1..c630f8113 100644 --- a/src/settings/viewpropertiesdialog.cpp +++ b/src/settings/viewpropertiesdialog.cpp @@ -333,11 +333,7 @@ void ViewPropertiesDialog::applyViewProperties() const bool applyToSubFolders = m_applyToSubFolders && m_applyToSubFolders->isChecked(); if (applyToSubFolders) { const QString text(i18nc("@info", "The view properties of all sub-folders will be changed. Do you want to continue?")); -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) if (KMessageBox::questionTwoActions(this, text, {}, KStandardGuiItem::cont(), KStandardGuiItem::cancel()) == KMessageBox::SecondaryAction) { -#else - if (KMessageBox::questionYesNo(this, text, {}, KStandardGuiItem::cont(), KStandardGuiItem::cancel()) == KMessageBox::No) { -#endif return; } @@ -367,11 +363,7 @@ void ViewPropertiesDialog::applyViewProperties() if (applyToAllFolders) { const QString text(i18nc("@info", "The view properties of all folders will be changed. Do you want to continue?")); -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) if (KMessageBox::questionTwoActions(this, text, {}, KStandardGuiItem::cont(), KStandardGuiItem::cancel()) == KMessageBox::SecondaryAction) { -#else - if (KMessageBox::questionYesNo(this, text, {}, KStandardGuiItem::cont(), KStandardGuiItem::cancel()) == KMessageBox::No) { -#endif return; } diff --git a/src/tests/kfileitemmodeltest.cpp b/src/tests/kfileitemmodeltest.cpp index 38d2544aa..753960a08 100644 --- a/src/tests/kfileitemmodeltest.cpp +++ b/src/tests/kfileitemmodeltest.cpp @@ -2479,9 +2479,6 @@ void KFileItemModelTest::testInsertAfterExpand() // Insert additional files into "a/b/" m_testDir->createFile("a/b/2"); -#if KIO_VERSION < QT_VERSION_CHECK(5, 92, 0) - QEXPECT_FAIL("", "Requires new API from frameworks", Abort); -#endif QVERIFY(!itemsInsertedSpy.wait(5000)); diff --git a/src/trash/dolphintrash.cpp b/src/trash/dolphintrash.cpp index b37a7430d..007f48a33 100644 --- a/src/trash/dolphintrash.cpp +++ b/src/trash/dolphintrash.cpp @@ -13,13 +13,8 @@ #include #include -#include -#if KIO_VERSION >= QT_VERSION_CHECK(5, 100, 0) #include -#else -#include -#include -#endif +#include Trash::Trash() : m_trashDirLister(new KDirLister()) @@ -62,22 +57,10 @@ static void notifyEmptied() void Trash::empty(QWidget *window) { -#if KIO_VERSION >= QT_VERSION_CHECK(5, 100, 0) using Iface = KIO::AskUserActionInterface; auto *emptyJob = new KIO::DeleteOrTrashJob(QList{}, Iface::EmptyTrash, Iface::DefaultConfirmation, window); QObject::connect(emptyJob, &KIO::Job::result, notifyEmptied); emptyJob->start(); -#else - KIO::JobUiDelegate uiDelegate; - uiDelegate.setWindow(window); - bool confirmed = uiDelegate.askDeleteConfirmation(QList(), KIO::JobUiDelegate::EmptyTrash, KIO::JobUiDelegate::DefaultConfirmation); - if (confirmed) { - KIO::Job *job = KIO::emptyTrash(); - KJobWidgets::setWindow(job, window); - job->uiDelegate()->setAutoErrorHandlingEnabled(true); - QObject::connect(job, &KIO::Job::result, notifyEmptied); - } -#endif } bool Trash::isEmpty() diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 1d01b4c98..d525df4c6 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -49,10 +49,8 @@ #include -#include -#if KIO_VERSION >= QT_VERSION_CHECK(5, 100, 0) #include -#endif +#include #include #include @@ -758,43 +756,22 @@ void DolphinView::trashSelectedItems() { const QList list = simplifiedSelectedUrls(); -#if KIO_VERSION >= QT_VERSION_CHECK(5, 100, 0) using Iface = KIO::AskUserActionInterface; auto *trashJob = new KIO::DeleteOrTrashJob(list, Iface::Trash, Iface::DefaultConfirmation, this); connect(trashJob, &KJob::result, this, &DolphinView::slotTrashFileFinished); m_selectNextItem = true; trashJob->start(); -#else - KIO::JobUiDelegate uiDelegate; - uiDelegate.setWindow(window()); - if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Trash, KIO::JobUiDelegate::DefaultConfirmation)) { - KIO::Job *job = KIO::trash(list); - KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Trash, list, QUrl(QStringLiteral("trash:/")), job); - KJobWidgets::setWindow(job, this); - connect(job, &KIO::Job::result, this, &DolphinView::slotTrashFileFinished); - } -#endif } void DolphinView::deleteSelectedItems() { const QList list = simplifiedSelectedUrls(); -#if KIO_VERSION >= QT_VERSION_CHECK(5, 100, 0) using Iface = KIO::AskUserActionInterface; auto *trashJob = new KIO::DeleteOrTrashJob(list, Iface::Delete, Iface::DefaultConfirmation, this); connect(trashJob, &KJob::result, this, &DolphinView::slotTrashFileFinished); m_selectNextItem = true; trashJob->start(); -#else - KIO::JobUiDelegate uiDelegate; - uiDelegate.setWindow(window()); - if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Delete, KIO::JobUiDelegate::DefaultConfirmation)) { - KIO::Job *job = KIO::del(list); - KJobWidgets::setWindow(job, this); - connect(job, &KIO::Job::result, this, &DolphinView::slotDeleteFileFinished); - } -#endif } void DolphinView::cutSelectedItemsToClipboard() @@ -1081,25 +1058,14 @@ void DolphinView::slotItemsActivated(const KItemSet &indexes) if (indexes.count() > 5) { QString question = i18np("Are you sure you want to open 1 item?", "Are you sure you want to open %1 items?", indexes.count()); -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) const int answer = KMessageBox::warningTwoActions( this, question, {}, -#else - const int answer = - KMessageBox::warningYesNo(this, - question, - {}, -#endif KGuiItem(i18ncp("@action:button", "Open %1 Item", "Open %1 Items", indexes.count()), QStringLiteral("document-open")), KStandardGuiItem::cancel(), QStringLiteral("ConfirmOpenManyFolders")); -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) if (answer != KMessageBox::PrimaryAction && answer != KMessageBox::Continue) { -#else - if (answer != KMessageBox::Yes && answer != KMessageBox::Continue) { -#endif return; } } @@ -2025,13 +1991,8 @@ void DolphinView::slotRoleEditingFinished(int index, const QByteArray &role, con if (!hiddenFilesShown() && newName.startsWith(QLatin1Char('.')) && !oldItem.name().startsWith(QLatin1Char('.'))) { KGuiItem yesGuiItem(i18nc("@action:button", "Rename and Hide"), QStringLiteral("view-hidden")); -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) const auto code = KMessageBox::questionTwoActions(this, -#else - const auto code = - KMessageBox::questionYesNo(this, -#endif oldItem.isFile() ? i18n("Adding a dot to the beginning of this file's name will hide it from view.\n" "Do you still want to rename it?") : i18n("Adding a dot to the beginning of this folder's name will hide it from view.\n" @@ -2041,11 +2002,7 @@ void DolphinView::slotRoleEditingFinished(int index, const QByteArray &role, con KStandardGuiItem::cancel(), QStringLiteral("ConfirmHide")); -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) if (code == KMessageBox::SecondaryAction) { -#else - if (code == KMessageBox::No) { -#endif return; } } -- cgit v1.3 From b45c57332f17fa82eb816179f20a84e392e51060 Mon Sep 17 00:00:00 2001 From: Méven Car Date: Mon, 28 Aug 2023 13:59:02 +0200 Subject: Confirmations setting: Add checkbox for ConfirmOpenManyFolders and ConfirmOpenManyTerminals We have to special handle the values saved as it is interpreted by KMessageBox --- src/settings/dolphin_generalsettings.kcfg | 10 ++++++++++ src/settings/interface/confirmationssettingspage.cpp | 18 +++++++++++++++++- src/settings/interface/confirmationssettingspage.h | 2 ++ 3 files changed, 29 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/settings/dolphin_generalsettings.kcfg b/src/settings/dolphin_generalsettings.kcfg index aedc24ea4..9bb202b71 100644 --- a/src/settings/dolphin_generalsettings.kcfg +++ b/src/settings/dolphin_generalsettings.kcfg @@ -142,4 +142,14 @@ + + + + false + + + + false + + diff --git a/src/settings/interface/confirmationssettingspage.cpp b/src/settings/interface/confirmationssettingspage.cpp index 61c3a14b6..491f8261f 100644 --- a/src/settings/interface/confirmationssettingspage.cpp +++ b/src/settings/interface/confirmationssettingspage.cpp @@ -60,9 +60,12 @@ ConfirmationsSettingsPage::ConfirmationsSettingsPage(QWidget *parent) new QCheckBox(i18nc("@option:check Ask for confirmation when", "Closing windows with a program running in the Terminal panel"), this); #endif + m_confirmOpenManyFolders = new QCheckBox(i18nc("@option:check Ask for confirmation in Dolphin when", "Opening many folders at once"), this); + m_confirmOpenManyTerminals = new QCheckBox(i18nc("@option:check Ask for confirmation in Dolphin when", "Opening many terminals at once"), this); + QHBoxLayout *executableScriptLayout = new QHBoxLayout(); QLabel *executableScriptLabel = new QLabel(i18nc("@title:group", "When opening an executable file:"), this); - confirmLabelKde->setWordWrap(true); + executableScriptLabel->setWordWrap(true); executableScriptLayout->addWidget(executableScriptLabel); m_confirmScriptExecution = new QComboBox(this); @@ -81,6 +84,9 @@ ConfirmationsSettingsPage::ConfirmationsSettingsPage(QWidget *parent) topLayout->addWidget(m_confirmClosingTerminalRunningProgram); #endif + topLayout->addWidget(m_confirmOpenManyFolders); + topLayout->addWidget(m_confirmOpenManyTerminals); + topLayout->addSpacing(Dolphin::VERTICAL_SPACER_HEIGHT); topLayout->addLayout(executableScriptLayout); @@ -93,6 +99,8 @@ ConfirmationsSettingsPage::ConfirmationsSettingsPage(QWidget *parent) connect(m_confirmDelete, &QCheckBox::toggled, this, &ConfirmationsSettingsPage::changed); connect(m_confirmScriptExecution, QOverload::of(&QComboBox::currentIndexChanged), this, &ConfirmationsSettingsPage::changed); connect(m_confirmClosingMultipleTabs, &QCheckBox::toggled, this, &ConfirmationsSettingsPage::changed); + connect(m_confirmOpenManyFolders, &QCheckBox::toggled, this, &ConfirmationsSettingsPage::changed); + connect(m_confirmOpenManyTerminals, &QCheckBox::toggled, this, &ConfirmationsSettingsPage::changed); #if HAVE_TERMINAL connect(m_confirmClosingTerminalRunningProgram, &QCheckBox::toggled, this, &ConfirmationsSettingsPage::changed); @@ -128,6 +136,8 @@ void ConfirmationsSettingsPage::applySettings() GeneralSettings *settings = GeneralSettings::self(); settings->setConfirmClosingMultipleTabs(m_confirmClosingMultipleTabs->isChecked()); + settings->setConfirmOpenManyFolders(!m_confirmOpenManyFolders->isChecked()); + settings->setConfirmOpenManyTerminals(!m_confirmOpenManyTerminals->isChecked()); #if HAVE_TERMINAL settings->setConfirmClosingTerminalRunningProgram(m_confirmClosingTerminalRunningProgram->isChecked()); @@ -169,6 +179,12 @@ void ConfirmationsSettingsPage::loadSettings() m_confirmClosingMultipleTabs->setChecked(GeneralSettings::confirmClosingMultipleTabs()); + // KMessageBox for its dontshowAgain settings are true => Yes, false => No, No value => ask + // we use default = false to not write false into the rc file, but have no value + // the UI has inversed meaning compared to the interpretation + m_confirmOpenManyFolders->setChecked(!GeneralSettings::confirmOpenManyFolders()); + m_confirmOpenManyTerminals->setChecked(!GeneralSettings::confirmOpenManyTerminals()); + #if HAVE_TERMINAL m_confirmClosingTerminalRunningProgram->setChecked(GeneralSettings::confirmClosingTerminalRunningProgram()); #endif diff --git a/src/settings/interface/confirmationssettingspage.h b/src/settings/interface/confirmationssettingspage.h index 56dd1a78c..d9413d754 100644 --- a/src/settings/interface/confirmationssettingspage.h +++ b/src/settings/interface/confirmationssettingspage.h @@ -43,6 +43,8 @@ private: QCheckBox *m_confirmClosingMultipleTabs; QComboBox *m_confirmScriptExecution; + QCheckBox *m_confirmOpenManyFolders; + QCheckBox *m_confirmOpenManyTerminals; }; #endif -- cgit v1.3 From 0cbc912319f503e94f13b8f06bd83f6e945dd26f Mon Sep 17 00:00:00 2001 From: Méven Car Date: Mon, 28 Aug 2023 10:13:21 +0200 Subject: Use KMessageBox::warningContinueCancel when appropriate This will prevent saving the "Cancel" + "don't show again" result, which is meaningless. --- src/dolphinmainwindow.cpp | 2 +- src/settings/dolphin_generalsettings.kcfg | 4 ++-- src/settings/interface/confirmationssettingspage.cpp | 8 ++++---- src/views/dolphinview.cpp | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 38843f82c..637cd55af 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1162,7 +1162,7 @@ void DolphinMainWindow::openTerminalHere() if (urls.count() > 5) { QString question = i18np("Are you sure you want to open 1 terminal window?", "Are you sure you want to open %1 terminal windows?", urls.count()); - const int answer = KMessageBox::warningTwoActions( + const int answer = KMessageBox::warningContinueCancel( this, question, {}, diff --git a/src/settings/dolphin_generalsettings.kcfg b/src/settings/dolphin_generalsettings.kcfg index 9bb202b71..2abd7da49 100644 --- a/src/settings/dolphin_generalsettings.kcfg +++ b/src/settings/dolphin_generalsettings.kcfg @@ -145,11 +145,11 @@ - false + true - false + true diff --git a/src/settings/interface/confirmationssettingspage.cpp b/src/settings/interface/confirmationssettingspage.cpp index 491f8261f..5f1abb4cd 100644 --- a/src/settings/interface/confirmationssettingspage.cpp +++ b/src/settings/interface/confirmationssettingspage.cpp @@ -136,8 +136,8 @@ void ConfirmationsSettingsPage::applySettings() GeneralSettings *settings = GeneralSettings::self(); settings->setConfirmClosingMultipleTabs(m_confirmClosingMultipleTabs->isChecked()); - settings->setConfirmOpenManyFolders(!m_confirmOpenManyFolders->isChecked()); - settings->setConfirmOpenManyTerminals(!m_confirmOpenManyTerminals->isChecked()); + settings->setConfirmOpenManyFolders(m_confirmOpenManyFolders->isChecked()); + settings->setConfirmOpenManyTerminals(m_confirmOpenManyTerminals->isChecked()); #if HAVE_TERMINAL settings->setConfirmClosingTerminalRunningProgram(m_confirmClosingTerminalRunningProgram->isChecked()); @@ -182,8 +182,8 @@ void ConfirmationsSettingsPage::loadSettings() // KMessageBox for its dontshowAgain settings are true => Yes, false => No, No value => ask // we use default = false to not write false into the rc file, but have no value // the UI has inversed meaning compared to the interpretation - m_confirmOpenManyFolders->setChecked(!GeneralSettings::confirmOpenManyFolders()); - m_confirmOpenManyTerminals->setChecked(!GeneralSettings::confirmOpenManyTerminals()); + m_confirmOpenManyFolders->setChecked(GeneralSettings::confirmOpenManyFolders()); + m_confirmOpenManyTerminals->setChecked(GeneralSettings::confirmOpenManyTerminals()); #if HAVE_TERMINAL m_confirmClosingTerminalRunningProgram->setChecked(GeneralSettings::confirmClosingTerminalRunningProgram()); diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index d525df4c6..d0d524196 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -1058,7 +1058,7 @@ void DolphinView::slotItemsActivated(const KItemSet &indexes) if (indexes.count() > 5) { QString question = i18np("Are you sure you want to open 1 item?", "Are you sure you want to open %1 items?", indexes.count()); - const int answer = KMessageBox::warningTwoActions( + const int answer = KMessageBox::warningContinueCancel( this, question, {}, -- cgit v1.3 From 079f903bc8691866b4aa3c3e41204a47e735c062 Mon Sep 17 00:00:00 2001 From: Méven Car Date: Mon, 28 Aug 2023 14:39:00 +0200 Subject: Fix a bunch of clazy warnings --- src/dolphincontextmenu.cpp | 2 -- src/dolphinmainwindow.cpp | 5 +++-- src/dolphinpart.h | 2 +- src/dolphintabwidget.h | 4 +++- src/kitemviews/kitemlistcontroller.h | 7 ++----- src/kitemviews/kitemlistview.h | 4 ++-- src/kitemviews/private/kitemlistheaderwidget.cpp | 2 +- src/kitemviews/private/kitemlistrubberband.h | 2 +- src/search/dolphinquery.cpp | 2 +- src/selectionmode/backgroundcolorhelper.cpp | 2 +- src/selectionmode/bottombarcontentscontainer.cpp | 8 ++++---- .../contextmenu/contextmenusettingspage.cpp | 1 - src/settings/viewmodes/viewsettingstab.h | 3 --- src/views/dolphinitemlistview.cpp | 2 +- src/views/dolphinview.cpp | 24 ++++++++-------------- src/views/dolphinview.h | 2 ++ 16 files changed, 31 insertions(+), 41 deletions(-) (limited to 'src') diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index 99db5584c..705f8e4a5 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -7,7 +7,6 @@ #include "dolphincontextmenu.h" #include "dolphin_contextmenusettings.h" -#include "dolphin_generalsettings.h" #include "dolphinmainwindow.h" #include "dolphinnewfilemenu.h" #include "dolphinplacesmodelsingleton.h" @@ -16,7 +15,6 @@ #include "global.h" #include "trash/dolphintrash.h" #include "views/dolphinview.h" -#include "views/viewmodecontroller.h" #include #include diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 637cd55af..e3373efe2 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1144,7 +1144,8 @@ void DolphinMainWindow::openTerminalHere() { QList urls = {}; - for (const KFileItem &item : m_activeViewContainer->view()->selectedItems()) { + const auto selectedItems = m_activeViewContainer->view()->selectedItems(); + for (const KFileItem &item : selectedItems) { QUrl url = item.targetUrl(); if (item.isFile()) { url.setPath(QFileInfo(url.path()).absolutePath()); @@ -1174,7 +1175,7 @@ void DolphinMainWindow::openTerminalHere() } } - for (const QUrl &url : urls) { + for (const QUrl &url : std::as_const(urls)) { openTerminalJob(url); } } diff --git a/src/dolphinpart.h b/src/dolphinpart.h index 94f83d0ef..af0acb171 100644 --- a/src/dolphinpart.h +++ b/src/dolphinpart.h @@ -29,7 +29,7 @@ class DolphinPart : public KParts::ReadOnlyPart // Used by konqueror. Technically it means "we want undo enabled if // there are things in the undo history and the current part is a dolphin part". // Even though it's konqueror doing the undo... - Q_PROPERTY(bool supportsUndo READ supportsUndo) + Q_PROPERTY(bool supportsUndo READ supportsUndo CONSTANT) Q_PROPERTY(QString currentViewMode READ currentViewMode WRITE setCurrentViewMode) diff --git a/src/dolphintabwidget.h b/src/dolphintabwidget.h index 75c6e3471..5bc708b38 100644 --- a/src/dolphintabwidget.h +++ b/src/dolphintabwidget.h @@ -123,7 +123,9 @@ public Q_SLOTS: * Opens a new tab in the background showing the URL \a primaryUrl and the * optional URL \a secondaryUrl. */ - void openNewTab(const QUrl &primaryUrl, const QUrl &secondaryUrl = QUrl(), NewTabPosition position = NewTabPosition::FollowSetting); + void openNewTab(const QUrl &primaryUrl, + const QUrl &secondaryUrl = QUrl(), + DolphinTabWidget::NewTabPosition position = DolphinTabWidget::NewTabPosition::FollowSetting); /** * Opens each directory in \p dirs in a separate tab unless it is already open. diff --git a/src/kitemviews/kitemlistcontroller.h b/src/kitemviews/kitemlistcontroller.h index 122ef836d..0576fc7fd 100644 --- a/src/kitemviews/kitemlistcontroller.h +++ b/src/kitemviews/kitemlistcontroller.h @@ -49,11 +49,8 @@ class QTouchEvent; class DOLPHIN_EXPORT KItemListController : public QObject { Q_OBJECT - Q_PROPERTY(KItemModelBase *model READ model WRITE setModel) - Q_PROPERTY(KItemListView *view READ view WRITE setView) - Q_PROPERTY(SelectionBehavior selectionBehavior READ selectionBehavior WRITE setSelectionBehavior) - Q_PROPERTY(AutoActivationBehavior autoActivationBehavior READ autoActivationBehavior WRITE setAutoActivationBehavior) - Q_PROPERTY(MouseDoubleClickAction mouseDoubleClickAction READ mouseDoubleClickAction WRITE setMouseDoubleClickAction) + Q_PROPERTY(KItemModelBase *model READ model WRITE setModel NOTIFY modelChanged) + Q_PROPERTY(KItemListView *view READ view WRITE setView NOTIFY viewChanged) public: enum SelectionBehavior { NoSelection, SingleSelection, MultiSelection }; diff --git a/src/kitemviews/kitemlistview.h b/src/kitemviews/kitemlistview.h index 6c3d3648d..ff51af922 100644 --- a/src/kitemviews/kitemlistview.h +++ b/src/kitemviews/kitemlistview.h @@ -53,8 +53,8 @@ class DOLPHIN_EXPORT KItemListView : public QGraphicsWidget { Q_OBJECT - Q_PROPERTY(qreal scrollOffset READ scrollOffset WRITE setScrollOffset) - Q_PROPERTY(qreal itemOffset READ itemOffset WRITE setItemOffset) + Q_PROPERTY(qreal scrollOffset READ scrollOffset WRITE setScrollOffset NOTIFY scrollOffsetChanged) + Q_PROPERTY(qreal itemOffset READ itemOffset WRITE setItemOffset NOTIFY itemOffsetChanged) public: explicit KItemListView(QGraphicsWidget *parent = nullptr); diff --git a/src/kitemviews/private/kitemlistheaderwidget.cpp b/src/kitemviews/private/kitemlistheaderwidget.cpp index 850f49406..82e5dde97 100644 --- a/src/kitemviews/private/kitemlistheaderwidget.cpp +++ b/src/kitemviews/private/kitemlistheaderwidget.cpp @@ -136,7 +136,7 @@ void KItemListHeaderWidget::setSidePadding(qreal width) { if (m_sidePadding != width) { m_sidePadding = width; - sidePaddingChanged(width); + Q_EMIT sidePaddingChanged(width); update(); } } diff --git a/src/kitemviews/private/kitemlistrubberband.h b/src/kitemviews/private/kitemlistrubberband.h index fd1416b56..64ce9ba29 100644 --- a/src/kitemviews/private/kitemlistrubberband.h +++ b/src/kitemviews/private/kitemlistrubberband.h @@ -18,7 +18,7 @@ class DOLPHIN_EXPORT KItemListRubberBand : public QObject { Q_OBJECT - Q_PROPERTY(QPointF endPosition MEMBER m_endPos READ endPosition WRITE setEndPosition) + Q_PROPERTY(QPointF endPosition MEMBER m_endPos READ endPosition WRITE setEndPosition NOTIFY endPositionChanged) public: explicit KItemListRubberBand(QObject *parent = nullptr); diff --git a/src/search/dolphinquery.cpp b/src/search/dolphinquery.cpp index f9e5da84f..ed2a6a766 100644 --- a/src/search/dolphinquery.cpp +++ b/src/search/dolphinquery.cpp @@ -49,7 +49,7 @@ QStringList splitOutsideQuotes(const QString &text) // - Groups with two leading quotes must close both on them (filename:""abc xyz" tuv") // - Groups enclosed in quotes // - Words separated by spaces - const QRegularExpression subTermsRegExp("(\\S*?\"\"[^\"]+\"[^\"]+\"+|\\S*?\"[^\"]+\"+|(?<=\\s|^)\\S+(?=\\s|$))"); + static const QRegularExpression subTermsRegExp("(\\S*?\"\"[^\"]+\"[^\"]+\"+|\\S*?\"[^\"]+\"+|(?<=\\s|^)\\S+(?=\\s|$))"); auto subTermsMatchIterator = subTermsRegExp.globalMatch(text); QStringList textParts; diff --git a/src/selectionmode/backgroundcolorhelper.cpp b/src/selectionmode/backgroundcolorhelper.cpp index 74f5bda1a..fa3e55ac4 100644 --- a/src/selectionmode/backgroundcolorhelper.cpp +++ b/src/selectionmode/backgroundcolorhelper.cpp @@ -46,7 +46,7 @@ void BackgroundColorHelper::controlBackgroundColor(QWidget *widget) BackgroundColorHelper::BackgroundColorHelper() { updateBackgroundColor(); - QObject::connect(qApp, &QGuiApplication::paletteChanged, [=]() { + QObject::connect(qApp, &QGuiApplication::paletteChanged, qApp, [=]() { slotPaletteChanged(); }); } diff --git a/src/selectionmode/bottombarcontentscontainer.cpp b/src/selectionmode/bottombarcontentscontainer.cpp index d53d2e4b9..d571b0302 100644 --- a/src/selectionmode/bottombarcontentscontainer.cpp +++ b/src/selectionmode/bottombarcontentscontainer.cpp @@ -166,7 +166,7 @@ void BottomBarContentsContainer::addCopyContents() auto *copyButton = new QPushButton(this); // We claim to have PasteContents already so triggering the copy action next won't instantly hide the bottom bar. - connect(copyButton, &QAbstractButton::clicked, [this]() { + connect(copyButton, &QAbstractButton::clicked, this, [this]() { if (GeneralSettings::showPasteBarAfterCopying()) { m_contents = BottomBar::Contents::PasteContents; // prevents hiding } @@ -174,7 +174,7 @@ void BottomBarContentsContainer::addCopyContents() // Connect the copy action as a second step. m_mainAction = ActionWithWidget(m_actionCollection->action(KStandardAction::name(KStandardAction::Copy)), copyButton); // Finally connect the lambda that actually changes the contents to the PasteContents. - connect(copyButton, &QAbstractButton::clicked, [this]() { + connect(copyButton, &QAbstractButton::clicked, this, [this]() { if (GeneralSettings::showPasteBarAfterCopying()) { resetContents(BottomBar::Contents::PasteContents); // resetContents() needs to be connected last because // it instantly deletes the button and then the other slots won't be called. @@ -244,7 +244,7 @@ void BottomBarContentsContainer::addCutContents() auto *cutButton = new QPushButton(this); // We claim to have PasteContents already so triggering the cut action next won't instantly hide the bottom bar. - connect(cutButton, &QAbstractButton::clicked, [this]() { + connect(cutButton, &QAbstractButton::clicked, this, [this]() { if (GeneralSettings::showPasteBarAfterCopying()) { m_contents = BottomBar::Contents::PasteContents; // prevents hiding } @@ -252,7 +252,7 @@ void BottomBarContentsContainer::addCutContents() // Connect the cut action as a second step. m_mainAction = ActionWithWidget(m_actionCollection->action(KStandardAction::name(KStandardAction::Cut)), cutButton); // Finally connect the lambda that actually changes the contents to the PasteContents. - connect(cutButton, &QAbstractButton::clicked, [this]() { + connect(cutButton, &QAbstractButton::clicked, this, [this]() { if (GeneralSettings::showPasteBarAfterCopying()) { resetContents(BottomBar::Contents::PasteContents); // resetContents() needs to be connected last because // it instantly deletes the button and then the other slots won't be called. diff --git a/src/settings/contextmenu/contextmenusettingspage.cpp b/src/settings/contextmenu/contextmenusettingspage.cpp index fa3d0b256..ea780550a 100644 --- a/src/settings/contextmenu/contextmenusettingspage.cpp +++ b/src/settings/contextmenu/contextmenusettingspage.cpp @@ -7,7 +7,6 @@ #include "contextmenusettingspage.h" #include "dolphin_contextmenusettings.h" -#include "dolphin_generalsettings.h" #include "dolphin_versioncontrolsettings.h" #include "global.h" #include "settings/serviceitemdelegate.h" diff --git a/src/settings/viewmodes/viewsettingstab.h b/src/settings/viewmodes/viewsettingstab.h index fd4cc85a7..5181e8018 100644 --- a/src/settings/viewmodes/viewsettingstab.h +++ b/src/settings/viewmodes/viewsettingstab.h @@ -32,9 +32,6 @@ public: void applySettings() override; void restoreDefaults() override; -Q_SIGNALS: - void changed(); - private Q_SLOTS: void slotDefaultSliderMoved(int value); diff --git a/src/views/dolphinitemlistview.cpp b/src/views/dolphinitemlistview.cpp index 0efea844c..418c9bfe8 100644 --- a/src/views/dolphinitemlistview.cpp +++ b/src/views/dolphinitemlistview.cpp @@ -22,7 +22,7 @@ DolphinItemListView::DolphinItemListView(QGraphicsWidget *parent) : KFileItemListView(parent) , m_zoomLevel(0) { - updateFont(); + DolphinItemListView::updateFont(); updateGridSize(); } diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index d0d524196..a91d76358 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -1419,6 +1419,14 @@ void DolphinView::slotItemCreated(const QUrl &url) } } +void DolphinView::onDirectoryLoadingCompleted() +{ + // the model should now contain all the items created by the job + updateSelectionState(); + m_selectJobCreatedItems = false; + m_selectedUrls.clear(); +} + void DolphinView::slotJobResult(KJob *job) { if (job->error() && job->error() != KIO::ERR_USER_CANCELED) { @@ -1434,21 +1442,7 @@ void DolphinView::slotJobResult(KJob *job) updateSelectionState(); if (!m_selectedUrls.isEmpty()) { // not all urls were found, the model may not be up to date - // TODO KF6 replace with Qt::singleShotConnection - QMetaObject::Connection *const connection = new QMetaObject::Connection; - *connection = connect( - m_model, - &KFileItemModel::directoryLoadingCompleted, - this, - [this, connection]() { - // the model should now contain all the items created by the job - updateSelectionState(); - m_selectJobCreatedItems = false; - m_selectedUrls.clear(); - QObject::disconnect(*connection); - delete connection; - }, - Qt::UniqueConnection); + connect(m_model, &KFileItemModel::directoryLoadingCompleted, this, &DolphinView::onDirectoryLoadingCompleted, Qt::UniqueConnection); } else { m_selectJobCreatedItems = false; m_selectedUrls.clear(); diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h index f851724c2..05b9e009c 100644 --- a/src/views/dolphinview.h +++ b/src/views/dolphinview.h @@ -824,6 +824,8 @@ private Q_SLOTS: void slotTwoClicksRenamingTimerTimeout(); + void onDirectoryLoadingCompleted(); + private: void loadDirectory(const QUrl &url, bool reload = false); -- cgit v1.3 From 012f8a224ab83ba4337bdb99bf7c8566e365c14e Mon Sep 17 00:00:00 2001 From: Oliver Beard Date: Tue, 22 Aug 2023 21:10:42 +0100 Subject: k[standard]itemlistwidget: Account for view focus in selection highlight --- src/kitemviews/kitemlistwidget.cpp | 8 ++++---- src/kitemviews/kstandarditemlistwidget.cpp | 13 ++++++++----- src/kitemviews/kstandarditemlistwidget.h | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/kitemviews/kitemlistwidget.cpp b/src/kitemviews/kitemlistwidget.cpp index c8b3d2c3c..cc3cf0dfa 100644 --- a/src/kitemviews/kitemlistwidget.cpp +++ b/src/kitemviews/kitemlistwidget.cpp @@ -111,11 +111,11 @@ void KItemListWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *o } if (m_selected && m_editedRole.isEmpty()) { - const QStyle::State activeState(isActiveWindow() ? QStyle::State_Active : 0); + const QStyle::State activeState(isActiveWindow() && widget->hasFocus() ? QStyle::State_Active : 0); drawItemStyleOption(painter, widget, activeState | QStyle::State_Enabled | QStyle::State_Selected | QStyle::State_Item); } - if (m_current && m_editedRole.isEmpty()) { + if (m_current && m_editedRole.isEmpty() && widget->hasFocus()) { QStyleOptionFocusRect focusRectOption; initStyleOption(&focusRectOption); focusRectOption.rect = textFocusRect().toRect(); @@ -135,8 +135,8 @@ void KItemListWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *o m_hoverCache->fill(Qt::transparent); QPainter pixmapPainter(m_hoverCache); - const QStyle::State activeState(isActiveWindow() ? QStyle::State_Active : 0); - drawItemStyleOption(&pixmapPainter, widget, activeState | QStyle::State_Enabled | QStyle::State_MouseOver | QStyle::State_Item); + const QStyle::State activeState(isActiveWindow() && widget->hasFocus() ? QStyle::State_Active | QStyle::State_Enabled : 0); + drawItemStyleOption(&pixmapPainter, widget, activeState | QStyle::State_MouseOver | QStyle::State_Item); } const qreal opacity = painter->opacity(); diff --git a/src/kitemviews/kstandarditemlistwidget.cpp b/src/kitemviews/kstandarditemlistwidget.cpp index c4eab6d74..24a986419 100644 --- a/src/kitemviews/kstandarditemlistwidget.cpp +++ b/src/kitemviews/kstandarditemlistwidget.cpp @@ -386,7 +386,7 @@ void KStandardItemListWidget::paint(QPainter *painter, const QStyleOptionGraphic } painter->setFont(m_customizedFont); - painter->setPen(textColor()); + painter->setPen(textColor(widget)); const TextInfo *textInfo = m_textInfo.value("text"); if (!textInfo) { @@ -645,7 +645,7 @@ void KStandardItemListWidget::setTextColor(const QColor &color) } } -QColor KStandardItemListWidget::textColor() const +QColor KStandardItemListWidget::textColor(QWidget *widget) const { if (!isSelected()) { if (m_isHidden) { @@ -655,7 +655,7 @@ QColor KStandardItemListWidget::textColor() const } } - const QPalette::ColorGroup group = isActiveWindow() ? QPalette::Active : QPalette::Inactive; + const QPalette::ColorGroup group = isActiveWindow() && widget->hasFocus() ? QPalette::Active : QPalette::Inactive; const QPalette::ColorRole role = isSelected() ? QPalette::HighlightedText : normalTextColorRole(); return styleOption().palette.color(group, role); } @@ -1015,8 +1015,11 @@ void KStandardItemListWidget::updatePixmapCache() iconName = QStringLiteral("unknown"); } const QStringList overlays = values["iconOverlays"].toStringList(); - m_pixmap = - pixmapForIcon(iconName, overlays, maxIconHeight, m_layout != IconsLayout && isActiveWindow() && isSelected() ? QIcon::Selected : QIcon::Normal); + const bool hasFocus = scene()->views()[0]->parentWidget()->hasFocus(); + m_pixmap = pixmapForIcon(iconName, + overlays, + maxIconHeight, + m_layout != IconsLayout && isActiveWindow() && isSelected() && hasFocus ? QIcon::Selected : QIcon::Normal); } else if (m_pixmap.width() / m_pixmap.devicePixelRatio() != maxIconWidth || m_pixmap.height() / m_pixmap.devicePixelRatio() != maxIconHeight) { // A custom pixmap has been applied. Assure that the pixmap diff --git a/src/kitemviews/kstandarditemlistwidget.h b/src/kitemviews/kstandarditemlistwidget.h index 5bfb7df29..d146a02fb 100644 --- a/src/kitemviews/kstandarditemlistwidget.h +++ b/src/kitemviews/kstandarditemlistwidget.h @@ -139,7 +139,7 @@ protected: virtual QPalette::ColorRole normalTextColorRole() const; void setTextColor(const QColor &color); - QColor textColor() const; + QColor textColor(QWidget *widget) const; void setOverlay(const QPixmap &overlay); QPixmap overlay() const; -- cgit v1.3 From fae5fec96454fbc848f5402b1d1d758bd7ff2d8d Mon Sep 17 00:00:00 2001 From: Méven Car Date: Sat, 2 Sep 2023 11:30:25 +0200 Subject: Add focusOut and focusIn event support for KFileItemListView and update selected widget on focus change --- src/kitemviews/kfileitemlistview.cpp | 25 +++++++++++++++++++++++++ src/kitemviews/kfileitemlistview.h | 4 ++++ src/kitemviews/kfileitemlistwidget.cpp | 11 +++++++++++ src/kitemviews/kfileitemlistwidget.h | 3 +++ src/kitemviews/kitemlistcontainer.cpp | 16 ++++++++++++++++ src/kitemviews/kitemlistcontainer.h | 2 ++ src/kitemviews/kitemlistview.cpp | 12 ++++++++++++ src/kitemviews/kitemlistwidget.cpp | 4 ++-- src/kitemviews/kstandarditemlistwidget.cpp | 9 +++++---- src/kitemviews/kstandarditemlistwidget.h | 5 ++--- 10 files changed, 82 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/kitemviews/kfileitemlistview.cpp b/src/kitemviews/kfileitemlistview.cpp index 2ff5c9fb9..954e6ab88 100644 --- a/src/kitemviews/kfileitemlistview.cpp +++ b/src/kitemviews/kfileitemlistview.cpp @@ -326,6 +326,31 @@ void KFileItemListView::resizeEvent(QGraphicsSceneResizeEvent *event) triggerVisibleIndexRangeUpdate(); } +void KFileItemListView::focusInEvent(QFocusEvent *event) +{ + Q_UNUSED(event) + updateSelectedWidgets(); +} + +void KFileItemListView::focusOutEvent(QFocusEvent *event) +{ + Q_UNUSED(event) + updateSelectedWidgets(); +} + +void KFileItemListView::updateSelectedWidgets() +{ + const auto visibleWidgets = visibleItemListWidgets(); + for (KItemListWidget *widget : visibleWidgets) { + if (widget->isSelected()) { + auto w = qobject_cast(widget); + if (w) { + w->forceUpdate(); + } + } + } +} + void KFileItemListView::slotItemsRemoved(const KItemRangeList &itemRanges) { KStandardItemListView::slotItemsRemoved(itemRanges); diff --git a/src/kitemviews/kfileitemlistview.h b/src/kitemviews/kfileitemlistview.h index b4be0093e..4c48c52ab 100644 --- a/src/kitemviews/kfileitemlistview.h +++ b/src/kitemviews/kfileitemlistview.h @@ -98,6 +98,8 @@ protected: void onTransactionBegin() override; void onTransactionEnd() override; void resizeEvent(QGraphicsSceneResizeEvent *event) override; + void focusInEvent(QFocusEvent *event) override; + void focusOutEvent(QFocusEvent *event) override; protected Q_SLOTS: void slotItemsRemoved(const KItemRangeList &itemRanges) override; @@ -127,6 +129,8 @@ private: QSize availableIconSize() const; private: + void updateSelectedWidgets(); + KFileItemModelRolesUpdater *m_modelRolesUpdater; QTimer *m_updateVisibleIndexRangeTimer; QTimer *m_updateIconSizeTimer; diff --git a/src/kitemviews/kfileitemlistwidget.cpp b/src/kitemviews/kfileitemlistwidget.cpp index 771403b70..9802ca7d1 100644 --- a/src/kitemviews/kfileitemlistwidget.cpp +++ b/src/kitemviews/kfileitemlistwidget.cpp @@ -203,6 +203,17 @@ void KFileItemListWidget::hoverSequenceStarted() view->setHoverSequenceState(itemUrl, 0); } +void KFileItemListWidget::forceUpdate() +{ + updateAdditionalInfoTextColor(); + // icon layout does not include the icons in the item selection rectangle + // so its icon does not need updating + if (listView()->itemLayout() != KStandardItemListView::ItemLayout::IconsLayout) { + invalidateIconCache(); + } + update(); +} + void KFileItemListWidget::hoverSequenceIndexChanged(int sequenceIndex) { KFileItemListView *view = listView(); diff --git a/src/kitemviews/kfileitemlistwidget.h b/src/kitemviews/kfileitemlistwidget.h index 27fcf7f29..7f33c5487 100644 --- a/src/kitemviews/kfileitemlistwidget.h +++ b/src/kitemviews/kfileitemlistwidget.h @@ -35,6 +35,9 @@ public: static KItemListWidgetInformant *createInformant(); + /// Force-update the displayed icon + void forceUpdate(); + protected: virtual void hoverSequenceStarted() override; virtual void hoverSequenceIndexChanged(int sequenceIndex) override; diff --git a/src/kitemviews/kitemlistcontainer.cpp b/src/kitemviews/kitemlistcontainer.cpp index 3893ceaea..f89a6c8ce 100644 --- a/src/kitemviews/kitemlistcontainer.cpp +++ b/src/kitemviews/kitemlistcontainer.cpp @@ -175,6 +175,22 @@ void KItemListContainer::wheelEvent(QWheelEvent *event) smoothScroller->handleWheelEvent(event); } +void KItemListContainer::focusInEvent(QFocusEvent *event) +{ + KItemListView *view = m_controller->view(); + if (view) { + QApplication::sendEvent(view, event); + } +} + +void KItemListContainer::focusOutEvent(QFocusEvent *event) +{ + KItemListView *view = m_controller->view(); + if (view) { + QApplication::sendEvent(view, event); + } +} + void KItemListContainer::slotScrollOrientationChanged(Qt::Orientation current, Qt::Orientation previous) { Q_UNUSED(previous) diff --git a/src/kitemviews/kitemlistcontainer.h b/src/kitemviews/kitemlistcontainer.h index 6bb28469e..40b075376 100644 --- a/src/kitemviews/kitemlistcontainer.h +++ b/src/kitemviews/kitemlistcontainer.h @@ -50,6 +50,8 @@ protected: void resizeEvent(QResizeEvent *event) override; void scrollContentsBy(int dx, int dy) override; void wheelEvent(QWheelEvent *event) override; + void focusInEvent(QFocusEvent *event) override; + void focusOutEvent(QFocusEvent *event) override; private Q_SLOTS: void slotScrollOrientationChanged(Qt::Orientation current, Qt::Orientation previous); diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp index 7a3cbbcb6..5363fa253 100644 --- a/src/kitemviews/kitemlistview.cpp +++ b/src/kitemviews/kitemlistview.cpp @@ -961,6 +961,18 @@ bool KItemListView::event(QEvent *event) updateFont(); break; + case QEvent::FocusIn: + focusInEvent(static_cast(event)); + event->accept(); + return true; + break; + + case QEvent::FocusOut: + focusOutEvent(static_cast(event)); + event->accept(); + return true; + break; + default: // Forward all other events to the controller and handle them there if (!m_editingRole && m_controller && m_controller->processEvent(event, transform())) { diff --git a/src/kitemviews/kitemlistwidget.cpp b/src/kitemviews/kitemlistwidget.cpp index cc3cf0dfa..cfaf89175 100644 --- a/src/kitemviews/kitemlistwidget.cpp +++ b/src/kitemviews/kitemlistwidget.cpp @@ -115,12 +115,12 @@ void KItemListWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *o drawItemStyleOption(painter, widget, activeState | QStyle::State_Enabled | QStyle::State_Selected | QStyle::State_Item); } - if (m_current && m_editedRole.isEmpty() && widget->hasFocus()) { + if (m_current && m_editedRole.isEmpty()) { QStyleOptionFocusRect focusRectOption; initStyleOption(&focusRectOption); focusRectOption.rect = textFocusRect().toRect(); focusRectOption.state = QStyle::State_Enabled | QStyle::State_Item | QStyle::State_KeyboardFocusChange; - if (m_selected) { + if (m_selected && widget->hasFocus()) { focusRectOption.state |= QStyle::State_Selected; } diff --git a/src/kitemviews/kstandarditemlistwidget.cpp b/src/kitemviews/kstandarditemlistwidget.cpp index 24a986419..01b135038 100644 --- a/src/kitemviews/kstandarditemlistwidget.cpp +++ b/src/kitemviews/kstandarditemlistwidget.cpp @@ -386,7 +386,7 @@ void KStandardItemListWidget::paint(QPainter *painter, const QStyleOptionGraphic } painter->setFont(m_customizedFont); - painter->setPen(textColor(widget)); + painter->setPen(textColor(*widget)); const TextInfo *textInfo = m_textInfo.value("text"); if (!textInfo) { @@ -645,7 +645,7 @@ void KStandardItemListWidget::setTextColor(const QColor &color) } } -QColor KStandardItemListWidget::textColor(QWidget *widget) const +QColor KStandardItemListWidget::textColor(const QWidget &widget) const { if (!isSelected()) { if (m_isHidden) { @@ -655,7 +655,7 @@ QColor KStandardItemListWidget::textColor(QWidget *widget) const } } - const QPalette::ColorGroup group = isActiveWindow() && widget->hasFocus() ? QPalette::Active : QPalette::Inactive; + const QPalette::ColorGroup group = isActiveWindow() && widget.hasFocus() ? QPalette::Active : QPalette::Inactive; const QPalette::ColorRole role = isSelected() ? QPalette::HighlightedText : normalTextColorRole(); return styleOption().palette.color(group, role); } @@ -1436,9 +1436,10 @@ void KStandardItemListWidget::updateDetailsLayoutTextCache() void KStandardItemListWidget::updateAdditionalInfoTextColor() { QColor c1; + const bool hasFocus = scene()->views()[0]->parentWidget()->hasFocus(); if (m_customTextColor.isValid()) { c1 = m_customTextColor; - } else if (isSelected() && (m_layout != DetailsLayout || m_highlightEntireRow)) { + } else if (isSelected() && hasFocus && (m_layout != DetailsLayout || m_highlightEntireRow)) { // The detail text colour needs to match the main text (HighlightedText) for the same level // of readability. We short circuit early here to avoid interpolating with another colour. m_additionalInfoTextColor = styleOption().palette.color(QPalette::HighlightedText); diff --git a/src/kitemviews/kstandarditemlistwidget.h b/src/kitemviews/kstandarditemlistwidget.h index d146a02fb..c4f80af1d 100644 --- a/src/kitemviews/kstandarditemlistwidget.h +++ b/src/kitemviews/kstandarditemlistwidget.h @@ -139,7 +139,7 @@ protected: virtual QPalette::ColorRole normalTextColorRole() const; void setTextColor(const QColor &color); - QColor textColor(QWidget *widget) const; + QColor textColor(const QWidget &widget) const; void setOverlay(const QPixmap &overlay); QPixmap overlay() const; @@ -181,6 +181,7 @@ protected: QPointF pos; QStaticText staticText; }; + void updateAdditionalInfoTextColor(); public Q_SLOTS: void finishRoleEditing(); @@ -200,8 +201,6 @@ private: void updateCompactLayoutTextCache(); void updateDetailsLayoutTextCache(); - void updateAdditionalInfoTextColor(); - void drawPixmap(QPainter *painter, const QPixmap &pixmap); void drawSiblingsInformation(QPainter *painter); -- cgit v1.3 From 741bea8324240073a502b9918dc0ff557ca27c37 Mon Sep 17 00:00:00 2001 From: Méven Car Date: Sat, 2 Sep 2023 14:58:24 +0200 Subject: fix test in FreeBsd KItemListControllerExpandTest::testDirExpand --- src/tests/kitemlistcontrollerexpandtest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/tests/kitemlistcontrollerexpandtest.cpp b/src/tests/kitemlistcontrollerexpandtest.cpp index 20bc0cc0c..368ec67ce 100644 --- a/src/tests/kitemlistcontrollerexpandtest.cpp +++ b/src/tests/kitemlistcontrollerexpandtest.cpp @@ -180,7 +180,7 @@ void KItemListControllerExpandTest::testDirExpand() [this]() { return m_spyDirectoryLoadingCompleted->count() == 6; }, - 100)); + 300)); QCOMPARE(m_model->count(), 18); QCOMPARE(m_selectionManager->currentItem(), 12); -- cgit v1.3 From 9ba09040134f743ca3a2082589cc943c2d4bf175 Mon Sep 17 00:00:00 2001 From: Amol Godbole Date: Mon, 4 Sep 2023 00:24:38 -0500 Subject: KFileItemModel: Delay emitting currentDirectoryRemoved() signal The KCoreDirLister object is modified before KCoreDirListerCache::deleteDir() returns because the signal currentDirectoryRemoved() is emitted. This prevents removal of the deleted lister from dirData.listersCurrentlyHolding in KCoreDirListerCache::forgetDirs() when the tab is closed, which causes the crash described in the bug. Hence, the signal currentDirectoryRemoved() is delayed to ensure this does not occur. BUG: 473377 --- src/kitemviews/kfileitemmodel.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index 40c76c7ef..f42f2c193 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -1197,7 +1197,12 @@ void KFileItemModel::slotItemsDeleted(const KFileItemList &items) for (const KFileItem &item : items) { if (item.url() == currentDir) { - Q_EMIT currentDirectoryRemoved(); + // #473377: Delay emitting currentDirectoryRemoved() to avoid modifying KCoreDirLister + // before KCoreDirListerCache::deleteDir() returns. + QTimer::singleShot(0, this, [this] { + Q_EMIT currentDirectoryRemoved(); + }); + return; } -- cgit v1.3 From c4bb3db0229bef8adee1daa183892cebba5efe72 Mon Sep 17 00:00:00 2001 From: Amol Godbole Date: Mon, 4 Sep 2023 07:39:13 +0000 Subject: Restore the URL when DolphinSearchBox is cleared Currently, the URL navigator is not updated when the search box is cleared. This MR restores the URL, by closing and reopening the box. The call for emitting closeRequest() on pressing Esc has been replaced with emitCloseRequest(). The wait duration before starting a search has been reduced to 500ms to increase responsiveness. Also, the bugfix for BUG: 423328 is slightly incorrect and causes the search term to not be displayed when opening a saved search for the first time. As a better solution for this bug, DolphinSearchBox::setText() now updates the text only if the text has changed. BUG: 473775 --- src/dolphinviewcontainer.cpp | 6 ++++++ src/dolphinviewcontainer.h | 1 + src/search/dolphinsearchbox.cpp | 25 ++++++++++++++++--------- src/search/dolphinsearchbox.h | 5 +++++ 4 files changed, 28 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index 63d5bd27b..66a9a116a 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -84,6 +84,7 @@ DolphinViewContainer::DolphinViewContainer(const QUrl &url, QWidget *parent) m_searchBox = new DolphinSearchBox(this); m_searchBox->hide(); connect(m_searchBox, &DolphinSearchBox::activated, this, &DolphinViewContainer::activate); + connect(m_searchBox, &DolphinSearchBox::openRequest, this, &DolphinViewContainer::openSearchBox); connect(m_searchBox, &DolphinSearchBox::closeRequest, this, &DolphinViewContainer::closeSearchBox); connect(m_searchBox, &DolphinSearchBox::searchRequest, this, &DolphinViewContainer::startSearching); connect(m_searchBox, &DolphinSearchBox::focusViewRequest, this, &DolphinViewContainer::requestFocus); @@ -891,6 +892,11 @@ void DolphinViewContainer::startSearching() } } +void DolphinViewContainer::openSearchBox() +{ + setSearchModeEnabled(true); +} + void DolphinViewContainer::closeSearchBox() { setSearchModeEnabled(false); diff --git a/src/dolphinviewcontainer.h b/src/dolphinviewcontainer.h index 0c8b184fe..52fd688f6 100644 --- a/src/dolphinviewcontainer.h +++ b/src/dolphinviewcontainer.h @@ -382,6 +382,7 @@ private Q_SLOTS: * Gets the search URL from the searchbox and starts searching. */ void startSearching(); + void openSearchBox(); void closeSearchBox(); /** diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp index 9df417c4f..a09f25293 100644 --- a/src/search/dolphinsearchbox.cpp +++ b/src/search/dolphinsearchbox.cpp @@ -60,7 +60,9 @@ DolphinSearchBox::~DolphinSearchBox() void DolphinSearchBox::setText(const QString &text) { - m_searchInput->setText(text); + if (m_searchInput->text() != text) { + m_searchInput->setText(text); + } } QString DolphinSearchBox::text() const @@ -201,7 +203,7 @@ void DolphinSearchBox::keyReleaseEvent(QKeyEvent *event) QWidget::keyReleaseEvent(event); if (event->key() == Qt::Key_Escape) { if (m_searchInput->text().isEmpty()) { - Q_EMIT closeRequest(); + emitCloseRequest(); } else { m_searchInput->clear(); } @@ -261,7 +263,11 @@ void DolphinSearchBox::slotConfigurationChanged() void DolphinSearchBox::slotSearchTextChanged(const QString &text) { if (text.isEmpty()) { - m_startSearchTimer->stop(); + // Restore URL when search box is cleared by closing and reopening the box. + emitCloseRequest(); + QTimer::singleShot(0, this, [this] { + Q_EMIT openRequest(); + }); } else { m_startSearchTimer->start(); } @@ -270,6 +276,10 @@ void DolphinSearchBox::slotSearchTextChanged(const QString &text) void DolphinSearchBox::slotReturnPressed() { + if (m_searchInput->text().isEmpty()) { + return; + } + emitSearchRequest(); Q_EMIT focusViewRequest(); } @@ -443,10 +453,10 @@ void DolphinSearchBox::init() loadSettings(); // The searching should be started automatically after the user did not change - // the text within one second + // the text for a while m_startSearchTimer = new QTimer(this); m_startSearchTimer->setSingleShot(true); - m_startSearchTimer->setInterval(1000); + m_startSearchTimer->setInterval(500); connect(m_startSearchTimer, &QTimer::timeout, this, &DolphinSearchBox::emitSearchRequest); } @@ -496,10 +506,7 @@ void DolphinSearchBox::updateFromQuery(const DolphinQuery &query) setSearchPath(QUrl::fromLocalFile(QDir::homePath())); } - // If the input box has focus, do not update to avoid messing with user typing - if (!m_searchInput->hasFocus()) { - setText(query.text()); - } + setText(query.text()); if (query.hasContentSearch()) { m_contentButton->setChecked(true); diff --git a/src/search/dolphinsearchbox.h b/src/search/dolphinsearchbox.h index 4ccb7ac10..b73c2899f 100644 --- a/src/search/dolphinsearchbox.h +++ b/src/search/dolphinsearchbox.h @@ -111,6 +111,11 @@ Q_SIGNALS: */ void closeRequest(); + /** + * Is emitted when the search box should be opened. + */ + void openRequest(); + /** * Is emitted, if the searchbox has been activated by * an user interaction -- cgit v1.3 From 385146a1e8bd6762af9945756cc27e5a46b4f98a Mon Sep 17 00:00:00 2001 From: Amol Godbole Date: Sun, 3 Sep 2023 12:15:31 -0500 Subject: KItemListView: Fix inconsistencies in requiredWidth calculation Commits d3839617 and 3bf471e0 introduced a few changes to requiredWidth calculation. This commit makes the calculation of requiredWidth consistent across KItemListView. --- src/kitemviews/kitemlistview.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp index 5363fa253..38d21ff5e 100644 --- a/src/kitemviews/kitemlistview.cpp +++ b/src/kitemviews/kitemlistview.cpp @@ -361,7 +361,7 @@ void KItemListView::setGeometry(const QRectF &rect) if (m_headerWidget->automaticColumnResizing()) { applyAutomaticColumnWidths(); } else { - const qreal requiredWidth = columnWidthsSum(); + const qreal requiredWidth = columnWidthsSum() + 2 * m_headerWidget->sidePadding(); const QSizeF dynamicItemSize(qMax(newSize.width(), requiredWidth), m_itemSize.height()); m_layouter->setItemSize(dynamicItemSize); } @@ -2280,7 +2280,7 @@ QHash KItemListView::preferredColumnWidths(const KItemRangeLi void KItemListView::applyColumnWidthsFromHeader() { // Apply the new size to the layouter - const qreal requiredWidth = columnWidthsSum() + m_headerWidget->sidePadding(); + const qreal requiredWidth = columnWidthsSum() + 2 * m_headerWidget->sidePadding(); const QSizeF dynamicItemSize(qMax(size().width(), requiredWidth), m_itemSize.height()); m_layouter->setItemSize(dynamicItemSize); @@ -2375,9 +2375,9 @@ void KItemListView::applyAutomaticColumnWidths() qreal firstColumnWidth = m_headerWidget->columnWidth(firstRole); QSizeF dynamicItemSize = m_itemSize; - qreal requiredWidth = columnWidthsSum() + m_headerWidget->sidePadding() - + m_headerWidget->sidePadding(); // Adding the padding a second time so we have the same padding symmetrically on both sides of the view. - // This improves UX, looks better and increases the chances of users figuring out that the padding area can be used for deselecting and dropping files. + qreal requiredWidth = columnWidthsSum() + 2 * m_headerWidget->sidePadding(); // Adding the padding a second time so we have the same padding + // symmetrically on both sides of the view. This improves UX, looks better and increases the chances of users figuring out that the padding + // area can be used for deselecting and dropping files. const qreal availableWidth = size().width(); if (requiredWidth < availableWidth) { // Stretch the first column to use the whole remaining width -- cgit v1.3 From 0e4d428e84099bf5d76e81640a2417d5457d83a4 Mon Sep 17 00:00:00 2001 From: Amol Godbole Date: Sun, 3 Sep 2023 12:33:21 -0500 Subject: DolphinView: Reset scrollbars before changing view mode When view modes are changed, the scrollbars are not reset. This can cause the scroll area to be moved out of view after changing the view mode, making the view unusable. This commit resets the scrollbars. BUG: 393152 --- src/views/dolphinview.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index a91d76358..d0db814e4 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -279,6 +279,10 @@ bool DolphinView::isActive() const void DolphinView::setViewMode(Mode mode) { if (mode != m_mode) { + // Reset scrollbars before changing the view mode. + m_container->horizontalScrollBar()->setValue(0); + m_container->verticalScrollBar()->setValue(0); + ViewProperties props(viewPropertiesUrl()); props.setViewMode(mode); -- cgit v1.3 From 3aa8cf00ee90b0414fa9b17f01eaade4507c4642 Mon Sep 17 00:00:00 2001 From: Méven Car Date: Wed, 6 Sep 2023 14:24:22 +0200 Subject: Add open containing folder options for files in recentlyused:/ --- src/dolphincontextmenu.cpp | 35 +++++++++++++++++++++-------------- src/dolphincontextmenu.h | 5 ++++- 2 files changed, 25 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index 705f8e4a5..2eff1017f 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -75,6 +75,8 @@ void DolphinContextMenu::addAllActions() m_context |= SearchContext; } else if (scheme.contains(QLatin1String("timeline"))) { m_context |= TimelineContext; + } else if (scheme == QStringLiteral("recentlyused")) { + m_context |= RecentlyUsedContext; } if (!m_fileInfo.isNull() && !m_selectedItems.isEmpty()) { @@ -182,6 +184,23 @@ void DolphinContextMenu::addDirectoryItemContextMenu() addSeparator(); } +void DolphinContextMenu::addOpenParentFolderActions() +{ + addAction(QIcon::fromTheme(QStringLiteral("document-open-folder")), i18nc("@action:inmenu", "Open Path"), [this]() { + m_mainWindow->changeUrl(KIO::upUrl(m_fileInfo.url())); + m_mainWindow->activeViewContainer()->view()->markUrlsAsSelected({m_fileInfo.url()}); + m_mainWindow->activeViewContainer()->view()->markUrlAsCurrent(m_fileInfo.url()); + }); + + addAction(QIcon::fromTheme(QStringLiteral("tab-new")), i18nc("@action:inmenu", "Open Path in New Tab"), [this]() { + m_mainWindow->openNewTab(KIO::upUrl(m_fileInfo.url())); + }); + + addAction(QIcon::fromTheme(QStringLiteral("window-new")), i18nc("@action:inmenu", "Open Path in New Window"), [this]() { + Dolphin::openNewWindow({m_fileInfo.url()}, m_mainWindow, Dolphin::OpenNewWindowFlag::Select); + }); +} + void DolphinContextMenu::addItemContextMenu() { Q_ASSERT(!m_fileInfo.isNull()); @@ -194,22 +213,10 @@ void DolphinContextMenu::addItemContextMenu() // single files if (m_fileInfo.isDir()) { addDirectoryItemContextMenu(); - } else if (m_context & TimelineContext || m_context & SearchContext) { + } else if (m_context & TimelineContext || m_context & SearchContext || m_context & RecentlyUsedContext) { addOpenWithActions(); - addAction(QIcon::fromTheme(QStringLiteral("document-open-folder")), i18nc("@action:inmenu", "Open Path"), [this]() { - m_mainWindow->changeUrl(KIO::upUrl(m_fileInfo.url())); - m_mainWindow->activeViewContainer()->view()->markUrlsAsSelected({m_fileInfo.url()}); - m_mainWindow->activeViewContainer()->view()->markUrlAsCurrent(m_fileInfo.url()); - }); - - addAction(QIcon::fromTheme(QStringLiteral("tab-new")), i18nc("@action:inmenu", "Open Path in New Tab"), [this]() { - m_mainWindow->openNewTab(KIO::upUrl(m_fileInfo.url())); - }); - - addAction(QIcon::fromTheme(QStringLiteral("window-new")), i18nc("@action:inmenu", "Open Path in New Window"), [this]() { - Dolphin::openNewWindow({m_fileInfo.url()}, m_mainWindow, Dolphin::OpenNewWindowFlag::Select); - }); + addOpenParentFolderActions(); addSeparator(); } else { diff --git a/src/dolphincontextmenu.h b/src/dolphincontextmenu.h index 04b0697d0..f60be558e 100644 --- a/src/dolphincontextmenu.h +++ b/src/dolphincontextmenu.h @@ -95,6 +95,9 @@ private: void addAdditionalActions(const KFileItemListProperties &props); private: + void addDirectoryItemContextMenu(); + void addOpenParentFolderActions(); + struct Entry { int type; QString name; @@ -110,6 +113,7 @@ private: TrashContext = 2, TimelineContext = 4, SearchContext = 8, + RecentlyUsedContext = 16, }; DolphinMainWindow *m_mainWindow; @@ -126,7 +130,6 @@ private: KFileCopyToMenu m_copyToMenu; DolphinRemoveAction *m_removeAction; // Action that represents either 'Move To Trash' or 'Delete' - void addDirectoryItemContextMenu(); KFileItemActions *m_fileItemActions; }; -- cgit v1.3 From 6eb8f9b47a59be9351c5742ec5c765878555a624 Mon Sep 17 00:00:00 2001 From: Méven Car Date: Wed, 6 Sep 2023 19:10:21 +0200 Subject: DolphinContextMenu: Use targetUrl in addOpenParentFolderActions Amends 3aa8cf00ee90b0414fa9b17f01eaade4507c4642 --- src/dolphincontextmenu.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index 2eff1017f..83329dd71 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -187,17 +187,19 @@ void DolphinContextMenu::addDirectoryItemContextMenu() void DolphinContextMenu::addOpenParentFolderActions() { addAction(QIcon::fromTheme(QStringLiteral("document-open-folder")), i18nc("@action:inmenu", "Open Path"), [this]() { - m_mainWindow->changeUrl(KIO::upUrl(m_fileInfo.url())); - m_mainWindow->activeViewContainer()->view()->markUrlsAsSelected({m_fileInfo.url()}); - m_mainWindow->activeViewContainer()->view()->markUrlAsCurrent(m_fileInfo.url()); + const QUrl url = m_fileInfo.targetUrl(); + const QUrl parentUrl = KIO::upUrl(url); + m_mainWindow->changeUrl(parentUrl); + m_mainWindow->activeViewContainer()->view()->markUrlsAsSelected({url}); + m_mainWindow->activeViewContainer()->view()->markUrlAsCurrent(url); }); addAction(QIcon::fromTheme(QStringLiteral("tab-new")), i18nc("@action:inmenu", "Open Path in New Tab"), [this]() { - m_mainWindow->openNewTab(KIO::upUrl(m_fileInfo.url())); + m_mainWindow->openNewTab(KIO::upUrl(m_fileInfo.targetUrl())); }); addAction(QIcon::fromTheme(QStringLiteral("window-new")), i18nc("@action:inmenu", "Open Path in New Window"), [this]() { - Dolphin::openNewWindow({m_fileInfo.url()}, m_mainWindow, Dolphin::OpenNewWindowFlag::Select); + Dolphin::openNewWindow({m_fileInfo.targetUrl()}, m_mainWindow, Dolphin::OpenNewWindowFlag::Select); }); } -- cgit v1.3 From f900801540af7d8c54b75ba7476ebed05529aa59 Mon Sep 17 00:00:00 2001 From: Heiko Becker Date: Sat, 9 Sep 2023 10:26:33 +0200 Subject: GIT_SILENT Update Appstream for new release (cherry picked from commit 6fe9932a17e0973a804a69a467b3e8c8386ed25a) --- src/org.kde.dolphin.appdata.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/org.kde.dolphin.appdata.xml b/src/org.kde.dolphin.appdata.xml index a23b9ddc2..83840d35f 100644 --- a/src/org.kde.dolphin.appdata.xml +++ b/src/org.kde.dolphin.appdata.xml @@ -494,10 +494,10 @@ dolphin + - -- cgit v1.3 From a85863befd616fe86669ac363d74fa7f466ca523 Mon Sep 17 00:00:00 2001 From: Eric Armbruster Date: Wed, 6 Sep 2023 06:34:13 +0200 Subject: Add open in split view action This action is shown only if a single folder is selected. The action opens the selected folder in the inactive split view (and opens the split view if necessary). FEATURE: 465500 --- src/dolphincontextmenu.cpp | 4 +++ src/dolphinmainwindow.cpp | 35 +++++++++++++++++++++- src/dolphinmainwindow.h | 5 ++++ src/dolphintabpage.h | 4 +-- src/panels/places/placespanel.cpp | 10 +++++++ src/panels/places/placespanel.h | 2 ++ .../contextmenu/contextmenusettingspage.cpp | 4 +++ src/settings/dolphin_contextmenusettings.kcfg | 4 +++ src/settings/dolphinsettingsdialog.cpp | 1 + 9 files changed, 66 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index 83329dd71..4dc54946f 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -165,6 +165,10 @@ void DolphinContextMenu::addDirectoryItemContextMenu() addAction(m_mainWindow->actionCollection()->action(QStringLiteral("open_in_new_window"))); } + if (ContextMenuSettings::showOpenInSplitView()) { + addAction(m_mainWindow->actionCollection()->action(QStringLiteral("open_in_split_view"))); + } + // Insert 'Open With' entries addOpenWithActions(); diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index e3373efe2..744ad8f0a 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -497,6 +497,32 @@ void DolphinMainWindow::openInNewWindow() } } +void DolphinMainWindow::openInSplitView(const QUrl &url) +{ + QUrl newSplitViewUrl = url; + + if (newSplitViewUrl.isEmpty()) { + const KFileItemList list = m_activeViewContainer->view()->selectedItems(); + if (list.count() == 1) { + const KFileItem &item = list.first(); + newSplitViewUrl = DolphinView::openItemAsFolderUrl(item); + } + } + + if (newSplitViewUrl.isEmpty()) { + return; + } + + DolphinTabPage *tabPage = m_tabWidget->currentTabPage(); + if (tabPage->splitViewEnabled()) { + tabPage->switchActiveView(); + tabPage->activeViewContainer()->setUrl(newSplitViewUrl); + } else { + tabPage->setSplitViewEnabled(true, WithAnimation, newSplitViewUrl); + updateViewActions(); + } +} + void DolphinMainWindow::showTarget() { const KFileItem link = m_activeViewContainer->view()->selectedItems().at(0); @@ -885,7 +911,6 @@ void DolphinMainWindow::toggleSplitView() { DolphinTabPage *tabPage = m_tabWidget->currentTabPage(); tabPage->setSplitViewEnabled(!tabPage->splitViewEnabled(), WithAnimation); - updateViewActions(); } @@ -1985,6 +2010,13 @@ void DolphinMainWindow::setupActions() openInNewWindow->setText(i18nc("@action:inmenu", "Open in New Window")); openInNewWindow->setIcon(QIcon::fromTheme(QStringLiteral("window-new"))); connect(openInNewWindow, &QAction::triggered, this, &DolphinMainWindow::openInNewWindow); + + QAction *openInSplitViewAction = actionCollection()->addAction(QStringLiteral("open_in_split_view")); + openInSplitViewAction->setText(i18nc("@action:inmenu", "Open in Split View")); + openInSplitViewAction->setIcon(QIcon::fromTheme(QStringLiteral("view-right-new"))); + connect(openInSplitViewAction, &QAction::triggered, this, [this]() { + openInSplitView(QUrl()); + }); } void DolphinMainWindow::setupDockWidgets() @@ -2160,6 +2192,7 @@ void DolphinMainWindow::setupDockWidgets() connect(m_placesPanel, &PlacesPanel::newWindowRequested, this, [this](const QUrl &url) { Dolphin::openNewWindow({url}, this); }); + connect(m_placesPanel, &PlacesPanel::openInSplitViewRequested, this, &DolphinMainWindow::openInSplitView); connect(m_placesPanel, &PlacesPanel::errorMessage, this, &DolphinMainWindow::showErrorMessage); connect(this, &DolphinMainWindow::urlChanged, m_placesPanel, &PlacesPanel::setUrl); connect(placesDock, &DolphinDockWidget::visibilityChanged, &DolphinUrlNavigatorsController::slotPlacesPanelVisibilityChanged); diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index 5bb17e79a..b45c846b8 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -476,6 +476,11 @@ private Q_SLOTS: */ void openInNewWindow(); + /** + * Opens the selected folder in the other inactive split view, enables split view if necessary. + */ + void openInSplitView(const QUrl &url); + /** * Show the target of the selected symlink */ diff --git a/src/dolphintabpage.h b/src/dolphintabpage.h index 0c691830e..4a8bd365a 100644 --- a/src/dolphintabpage.h +++ b/src/dolphintabpage.h @@ -138,6 +138,8 @@ public: */ void setActive(bool active); + void switchActiveView(); + Q_SIGNALS: void activeViewChanged(DolphinViewContainer *viewContainer); void activeViewUrlChanged(const QUrl &url); @@ -170,8 +172,6 @@ private Q_SLOTS: */ void slotViewUrlRedirection(const QUrl &oldUrl, const QUrl &newUrl); - void switchActiveView(); - private: /** * Creates a new view container and does the default initialization. diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp index 3c3f7bb87..e3d133ff0 100644 --- a/src/panels/places/placespanel.cpp +++ b/src/panels/places/placespanel.cpp @@ -47,6 +47,15 @@ PlacesPanel::PlacesPanel(QWidget *parent) connect(m_configureTrashAction, &QAction::triggered, this, &PlacesPanel::slotConfigureTrash); addAction(m_configureTrashAction); + m_openInSplitView = new QAction(QIcon::fromTheme(QStringLiteral("view-right-new")), i18nc("@action:inmenu", "Open in Split View")); + m_openInSplitView->setPriority(QAction::HighPriority); + connect(m_openInSplitView, &QAction::triggered, this, [this]() { + const QUrl url = currentIndex().data(KFilePlacesModel::UrlRole).toUrl(); + Q_EMIT openInSplitViewRequested(url); + }); + + addAction(m_openInSplitView); + connect(this, &PlacesPanel::contextMenuAboutToShow, this, &PlacesPanel::slotContextMenuAboutToShow); connect(this, &PlacesPanel::iconSizeChanged, this, [](const QSize &newSize) { @@ -188,6 +197,7 @@ void PlacesPanel::slotContextMenuAboutToShow(const QModelIndex &index, QMenu *me const Solid::Device device = placesModel->deviceForIndex(index); m_configureTrashAction->setVisible(url.scheme() == QLatin1String("trash")); + m_openInSplitView->setVisible(url.isValid()); // show customContextMenuActions only on the view's context menu if (!url.isValid() && !device.isValid()) { diff --git a/src/panels/places/placespanel.h b/src/panels/places/placespanel.h index 2eb309483..cbd5fc224 100644 --- a/src/panels/places/placespanel.h +++ b/src/panels/places/placespanel.h @@ -51,6 +51,7 @@ Q_SIGNALS: void storageTearDownRequested(const QString &mountPath); void storageTearDownExternallyRequested(const QString &mountPath); void storageTearDownSuccessful(); + void openInSplitViewRequested(const QUrl &url); protected: void showEvent(QShowEvent *event) override; @@ -75,6 +76,7 @@ private: QPersistentModelIndex m_indexToTearDown; QAction *m_configureTrashAction; + QAction *m_openInSplitView; QAction *m_lockPanelsAction; }; diff --git a/src/settings/contextmenu/contextmenusettingspage.cpp b/src/settings/contextmenu/contextmenusettingspage.cpp index ea780550a..23ddfba31 100644 --- a/src/settings/contextmenu/contextmenusettingspage.cpp +++ b/src/settings/contextmenu/contextmenusettingspage.cpp @@ -122,6 +122,8 @@ bool ContextMenuSettingsPage::entryVisible(const QString &id) return ContextMenuSettings::showOpenInNewTab(); } else if (id == "open_in_new_window") { return ContextMenuSettings::showOpenInNewWindow(); + } else if (id == "open_in_split_view") { + return ContextMenuSettings::showOpenInSplitView(); } else if (id == "copy_location") { return ContextMenuSettings::showCopyLocation(); } else if (id == "duplicate") { @@ -148,6 +150,8 @@ void ContextMenuSettingsPage::setEntryVisible(const QString &id, bool visible) ContextMenuSettings::setShowOpenInNewTab(visible); } else if (id == "open_in_new_window") { ContextMenuSettings::setShowOpenInNewWindow(visible); + } else if (id == "open_in_split_view") { + return ContextMenuSettings::setShowOpenInSplitView(visible); } else if (id == "copy_location") { ContextMenuSettings::setShowCopyLocation(visible); } else if (id == "duplicate") { diff --git a/src/settings/dolphin_contextmenusettings.kcfg b/src/settings/dolphin_contextmenusettings.kcfg index 63ca079af..6e45d9bcd 100644 --- a/src/settings/dolphin_contextmenusettings.kcfg +++ b/src/settings/dolphin_contextmenusettings.kcfg @@ -30,6 +30,10 @@ true + + + true + true diff --git a/src/settings/dolphinsettingsdialog.cpp b/src/settings/dolphinsettingsdialog.cpp index 3a2ad31e9..d05d5a814 100644 --- a/src/settings/dolphinsettingsdialog.cpp +++ b/src/settings/dolphinsettingsdialog.cpp @@ -68,6 +68,7 @@ DolphinSettingsDialog::DolphinSettingsDialog(const QUrl &url, QWidget *parent, K QStringLiteral("view_mode"), QStringLiteral("open_in_new_tab"), QStringLiteral("open_in_new_window"), + QStringLiteral("open_in_split_view"), QStringLiteral("copy_location"), QStringLiteral("duplicate"), QStringLiteral("open_terminal_here"), -- cgit v1.3 From 5c33e0211ff09f37adb5b48c59cf15b67c0059dc Mon Sep 17 00:00:00 2001 From: Méven Car Date: Sun, 10 Sep 2023 14:58:36 +0200 Subject: Copy Location: Make sure to export path with native separators --- src/views/dolphinview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index d0db814e4..21e23d5ac 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -2283,7 +2283,7 @@ void DolphinView::copyPathToClipboard() if (clipboard == nullptr) { return; } - clipboard->setText(path); + clipboard->setText(QDir::toNativeSeparators(path)); } void DolphinView::slotIncreaseZoom() -- cgit v1.3