Commit 6d93f65b authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

ksplash kcm: Do not allow deleting currently selected splash screen

Instead output a warning and unmark the entry for deletion.
Forbidding to select an entry that is marked for deletion or forbidding
to delete the selected entry would lead to edge cases and using
the error message we can better explain to the user what is going on.
parent 0562277f
......@@ -144,6 +144,12 @@ void KCMSplashScreen::save()
PackageStructure *structure = PackageLoader::self()->loadPackageStructure(QStringLiteral("Plasma/LookAndFeel"));
const QStringList pendingDeletionPlugins = pendingDeletions();
for (const QString &plugin : pendingDeletionPlugins) {
if (plugin == m_data->settings()->theme()) {
Q_EMIT error(i18n("You cannot delete the currently selected splash screen"));
m_model->setData(m_model->index(pluginIndex(plugin), 0), false, Roles::PendingDeletionRole);
KJob *uninstallJob = Package(structure).uninstall(plugin, m_packageRoot);
connect(uninstallJob, &KJob::result, this, [this, uninstallJob, plugin]() {
if (uninstallJob->error()) {
Supports Markdown
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