Commit 9dacd46f authored by Benjamin Port's avatar Benjamin Port
Browse files

KCM Icons fix theme selected when we hit delete theme

Summary: CUrrently when we delete a theme the next one is selected. With this fix we stay on the currently selected one and to simplify code don't allow to delete the currently selected theme

Reviewers: mart, ervin, #plasma, crossi, ngraham, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: bport, ngraham, broulik, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D24847
parent 38ba4507
......@@ -83,12 +83,11 @@ bool IconsModel::setData(const QModelIndex &index, const QVariant &value, int ro
item.pendingDeletion = pendingDeletion;
emit dataChanged(index, index, {PendingDeletionRole});
// move to the next non-pending theme
// if we delete current selected theme move to the next non-pending theme
const auto nonPending = match(index, PendingDeletionRole, false);
if (!nonPending.isEmpty()) {
if (m_settings->theme() == index.data(ThemeNameRole) && !nonPending.isEmpty()) {
m_settings->setTheme(nonPending.first().data(ThemeNameRole).toString());
}
emit pendingDeletionsChanged();
return true;
}
......
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