Commit fc144999 authored by David Redondo's avatar David Redondo 🏎
Browse files

[Colors KCM] Only move to next scheme if the selected one is marked for deletion

Summary:
No need to select another scheme if the scheme that is to be removed is not
selected.

Test Plan: Mark a scheme other than the selected one for deletion

Reviewers: #plasma, mart

Reviewed By: #plasma, mart

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D26522
parent 2cac0513
......@@ -85,10 +85,12 @@ bool ColorsModel::setData(const QModelIndex &index, const QVariant &value, int r
item.pendingDeletion = pendingDeletion;
emit dataChanged(index, index, {PendingDeletionRole});
// move to the next non-pending theme
const auto nonPending = match(index, PendingDeletionRole, false);
if (!nonPending.isEmpty()) {
setSelectedScheme(nonPending.first().data(SchemeNameRole).toString());
if (index.row() == selectedSchemeIndex() && pendingDeletion) {
// move to the next non-pending theme
const auto nonPending = match(index, PendingDeletionRole, false);
if (!nonPending.isEmpty()) {
setSelectedScheme(nonPending.first().data(SchemeNameRole).toString());
}
}
emit pendingDeletionsChanged();
......
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