Commit 2af8d35e authored by Elvis Angelaccio's avatar Elvis Angelaccio
Browse files

Stop crashing when all read-write plugins are disabled

CreateDialog assumes that `m_supportedMimeTypes` is never empty, it will crash otherwise.

If that's the case (i.e. when all the read-write plugins have been disabled),
we just disable the Compress menu item and the New action (as the
CreateDialog would just be useless).

For the New action, we also need to check whether the settings have been
changed and update its enabled status accordingly.

BUG: 390690
FIXED-IN: 17.12.3
parent cec095d6
......@@ -75,11 +75,7 @@ QList<QAction*> CompressFileItemAction::actions(const KFileItemListProperties& f
QAction *compressMenuAction = new QAction(i18nc("@action:inmenu Compress submenu in Dolphin context menu", "Compress"), parentWidget);
// #189177: disable compress menu in read-only folders.
if (!fileItemInfos.supportsWriting()) {
compressMenuAction->setEnabled(fileItemInfos.supportsWriting() && !m_pluginManager->availableWritePlugins().isEmpty());
actions << compressMenuAction;
return actions;
......@@ -167,6 +167,8 @@ bool MainWindow::loadPart()
connect(m_part, SIGNAL(busy()), this, SLOT(updateActions()), Qt::QueuedConnection);
connect(m_part, QOverload<>::of(&KParts::ReadOnlyPart::completed), this, &MainWindow::addPartUrl);
return true;
......@@ -193,7 +195,8 @@ void MainWindow::setupActions()
void MainWindow::updateActions()
Interface *iface = qobject_cast<Interface*>(m_part);
Kerfuffle::PluginManager pluginManager;
m_newAction->setEnabled(!iface->isBusy() && !pluginManager.availableWritePlugins().isEmpty());
......@@ -278,6 +281,7 @@ void MainWindow::showSettings()
connect(dialog, &KConfigDialog::settingsChanged, this, &MainWindow::writeSettings);
connect(dialog, &KConfigDialog::settingsChanged, this, &MainWindow::updateActions);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment