Commit 7fca6ede authored by Eike Hein's avatar Eike Hein

Fix removing first item in languages list

Summary:
Instead, we want to disallow removing when the count drops to 1.

BUG:401473

Reviewers: #plasma, davidedmundson, broulik

Reviewed By: #plasma, davidedmundson

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D17218
parent 7fbcd969
......@@ -220,10 +220,14 @@ ScrollViewKCM {
onTriggered: kcm.selectedTranslationsModel.move(index, 0)
},
Kirigami.Action {
enabled: !model.IsMissing
property bool removing: false
enabled: removing || !model.IsMissing && languagesList.count > 1
iconName: "list-remove"
tooltip: i18nc("@info:tooltip", "Remove")
onTriggered: kcm.selectedTranslationsModel.remove(model.LanguageCode)
onTriggered: {
removing = true; // Don't crash by re-evaluating `enabled` during destruction.
kcm.selectedTranslationsModel.remove(model.LanguageCode);
}
}]
}
}
......
......@@ -213,7 +213,7 @@ void SelectedTranslationsModel::remove(const QString &languageCode)
int index = m_selectedLanguages.indexOf(languageCode);
if (index < 1) {
if (index < 0 || m_selectedLanguages.count() < 2) {
return;
}
......
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