mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:17:35 +00:00
Taskbar/QuickLaunchWidget: Ensure config backwards compatibility
The QuickLaunchWidget can now also parse the old config format, so that we stay compatible with the old format. After loading, it deletes the old config values and saves them in the new format.
This commit is contained in:
parent
620b3bd492
commit
7f501d4d8a
2 changed files with 16 additions and 0 deletions
|
@ -355,6 +355,21 @@ void QuickLaunchWidget::load_entries(bool save)
|
|||
entries.append(entry.release_nonnull());
|
||||
}
|
||||
|
||||
// backwards compatibility since the group and value-format changed
|
||||
auto old_keys = Config::list_keys(CONFIG_DOMAIN, OLD_CONFIG_GROUP_ENTRIES);
|
||||
if (!old_keys.is_empty()) {
|
||||
for (auto& name : old_keys) {
|
||||
auto path = Config::read_string(CONFIG_DOMAIN, OLD_CONFIG_GROUP_ENTRIES, name);
|
||||
auto entry = QuickLaunchEntry::create_from_path(path);
|
||||
if (!entry)
|
||||
continue;
|
||||
|
||||
entries.append(entry.release_nonnull());
|
||||
}
|
||||
|
||||
Config::remove_group(CONFIG_DOMAIN, OLD_CONFIG_GROUP_ENTRIES);
|
||||
}
|
||||
|
||||
m_entries.clear();
|
||||
add_entries(move(entries), save);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue