┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dolphinmainwindow.cpp25
-rw-r--r--src/dolphinmainwindow.h9
-rw-r--r--src/settings/contextmenu/contextmenusettingspage.cpp19
3 files changed, 28 insertions, 25 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 9e25f94e8..baf94ef3e 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -256,11 +256,12 @@ DolphinMainWindow::DolphinMainWindow()
QTimer::singleShot(0, this, &DolphinMainWindow::updateOpenPreferredSearchToolAction);
- m_fileItemActions.setParentWidget(this);
- connect(&m_fileItemActions, &KFileItemActions::error, this, [this](const QString &errorMessage) {
- showErrorMessage(errorMessage);
- });
+ setupFileItemActions();
+ m_serviceMenuConfigWatcher = KConfigWatcher::create(KSharedConfig::openConfig(QStringLiteral("kservicemenurc")));
+ connect(m_serviceMenuConfigWatcher.data(), &KConfigWatcher::configChanged, this, [this](const KConfigGroup & /*group*/, const QByteArrayList & /*names*/) {
+ setupFileItemActions();
+ });
connect(GeneralSettings::self(), &GeneralSettings::splitViewChanged, this, &DolphinMainWindow::slotSplitViewChanged);
}
@@ -1541,7 +1542,7 @@ void DolphinMainWindow::slotWriteStateChanged(bool isFolderWritable)
void DolphinMainWindow::openContextMenu(const QPoint &pos, const KFileItem &item, const KFileItemList &selectedItems, const QUrl &url)
{
- QPointer<DolphinContextMenu> contextMenu = new DolphinContextMenu(this, item, selectedItems, url, &m_fileItemActions);
+ QPointer<DolphinContextMenu> contextMenu = new DolphinContextMenu(this, item, selectedItems, url, m_fileItemActions);
contextMenu->exec(pos);
// Delete the menu, unless it has been deleted in its own nested event loop already.
@@ -2591,6 +2592,19 @@ void DolphinMainWindow::setupDockWidgets()
});
}
+void DolphinMainWindow::setupFileItemActions()
+{
+ if (m_fileItemActions) {
+ delete m_fileItemActions;
+ }
+
+ m_fileItemActions = new KFileItemActions(this);
+ m_fileItemActions->setParentWidget(this);
+ connect(m_fileItemActions, &KFileItemActions::error, this, [this](const QString &errorMessage) {
+ showErrorMessage(errorMessage);
+ });
+}
+
void DolphinMainWindow::updateFileAndEditActions()
{
const KFileItemList list = m_activeViewContainer->view()->selectedItems();
@@ -2743,6 +2757,7 @@ void DolphinMainWindow::updateGoActions()
void DolphinMainWindow::refreshViews()
{
+ setupFileItemActions();
m_tabWidget->refreshViews();
if (GeneralSettings::modifiedStartupSettings()) {
diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h
index 2c8d444ad..a05fa1227 100644
--- a/src/dolphinmainwindow.h
+++ b/src/dolphinmainwindow.h
@@ -14,6 +14,7 @@
#include "dolphintabwidget.h"
#include "selectionmode/bottombar.h"
#include <KActionMenu>
+#include <KConfigWatcher>
#include <KFileItemActions>
#include <kio/fileundomanager.h>
#include <kxmlguiwindow.h>
@@ -694,6 +695,11 @@ private:
*/
void setupDockWidgets();
+ /**
+ * Initializes or re-initializes the KFileItemActions instance.
+ */
+ void setupFileItemActions();
+
void updateFileAndEditActions();
void updateViewActions();
void updateGoActions();
@@ -790,7 +796,8 @@ private:
DiskSpaceUsageMenu *m_diskSpaceUsageMenu;
QMenu m_searchTools;
- KFileItemActions m_fileItemActions;
+ KConfigWatcher::Ptr m_serviceMenuConfigWatcher;
+ KFileItemActions *m_fileItemActions = nullptr;
QTimer *m_sessionSaveTimer;
QFutureWatcher<void> *m_sessionSaveWatcher;
diff --git a/src/settings/contextmenu/contextmenusettingspage.cpp b/src/settings/contextmenu/contextmenusettingspage.cpp
index 9f9c5c68e..bfc4f8dbc 100644
--- a/src/settings/contextmenu/contextmenusettingspage.cpp
+++ b/src/settings/contextmenu/contextmenusettingspage.cpp
@@ -39,8 +39,6 @@ const bool ShowDeleteDefault = false;
const char VersionControlServicePrefix[] = "_version_control_";
const char DeleteService[] = "_delete";
const char CopyToMoveToService[] = "_copy_to_move_to";
-
-bool laterSelected = false;
}
ContextMenuSettingsPage::ContextMenuSettingsPage(QWidget *parent, const KActionCollection *actions, const QStringList &actionIds)
@@ -200,23 +198,6 @@ void ContextMenuSettingsPage::applySettings()
if (m_enabledVcsPlugins != enabledPlugins) {
VersionControlSettings::setEnabledPlugins(enabledPlugins);
VersionControlSettings::self()->save();
-
- if (!laterSelected) {
- KMessageBox::ButtonCode promptRestart =
- KMessageBox::questionTwoActions(window(),
- 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 (promptRestart == KMessageBox::ButtonCode::PrimaryAction) {
- Dolphin::openNewWindow();
- qApp->quit();
- } else {
- laterSelected = true;
- }
- }
}
}