Skip to content

Commit

Permalink
Improve disabled repo handling.
Browse files Browse the repository at this point in the history
When removing repos, drop them from the disabled-repos list as well as the enabled-repos so they no longer appear in the repo list. When an action empties the list, remove the setting instead of setting it to '@invalid()'.
  • Loading branch information
abranson committed Nov 1, 2019
1 parent 17978ef commit e3a96e4
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions libssu/ssurepomanager.cpp
Expand Up @@ -133,17 +133,15 @@ int SsuRepoManager::remove(const QString &repo)

QStringList sections;
sections << "enabled-repos" << "disabled-repos";
foreach(QString section, sections) {
for (const QString &section: sections) {
if (ssuSettings->contains(section)) {
QStringList repos = ssuSettings->value(section).toStringList();
if (repos.contains(repo)) {
repos.removeAll(repo);
repos.removeDuplicates();
if (repos.size() > 0)
ssuSettings->setValue(section, repos);
else
ssuSettings->remove(section);
}
repos.removeAll(repo);
repos.removeDuplicates();
if (repos.size() > 0)
ssuSettings->setValue(section, repos);
else
ssuSettings->remove(section);
}
}
ssuSettings->sync();
Expand Down

0 comments on commit e3a96e4

Please sign in to comment.