Commit 019da1ff authored by Ismael Asensio's avatar Ismael Asensio
Browse files

IconMode: Load all of the KCMs in their category

When opening systemsettings with a specific KCM, it currently
just loads that KCM and the first one in the category.

Load instead all of the KCMs in the category.

This makes it consistent with the regular use of icon mode,
where the user navigates through full categories, and also
with the sidebar mode.

A different behavior is just confusing.
parent 04c25409
Pipeline #179166 passed with stage
in 59 seconds
......@@ -151,23 +151,28 @@ void IconMode::changeModuleWithArgs(const QModelIndex &activeModule, const QStri
const bool openCategoryFirst = activeModule.parent().isValid();
const QModelIndex categoryIndex = activeModule.parent();
const bool hasCategory = categoryIndex.isValid();
const bool hasChildren = d->categoryView->model()->rowCount(activeModule) > 1;
// avoid double titles by setting the right face type before loading the module
if (openCategoryFirst || d->categoryView->model()->rowCount(activeModule) > 1) {
} else {
// We have no children or any other items in the category, so we load a single KCM
if (!hasCategory && !hasChildren) {
d->moduleView->loadModule(activeModule, args);
if (openCategoryFirst) {
d->moduleView->loadModule(activeModule.parent(), {});
d->moduleView->loadModule(activeModule, args);
// In the case of Appearance -> GlobalTheme we will load its children items
// Otherwise, load the modules that belong into that category
const QModelIndex rootIndex = hasCategory ? categoryIndex : activeModule;
for (int row = 0; row < d->categoryView->model()->rowCount(rootIndex); row++) {
const QModelIndex subpageItem = d->categoryView->model()->index(row, 0, rootIndex);
const QStringList &effectiveArgs = activeModule.row() == row ? args : QStringList(); // Only set args for the active module
for (int done = 1 /* starting from 1 to avoid double global theme */; activeModule.model()->rowCount(activeModule) > done; done = 1 + done) {
QModelIndex subpageItem = activeModule.model()->index(done, 0, activeModule);
d->moduleView->loadModule(subpageItem, args);
d->moduleView->loadModule(subpageItem, effectiveArgs);
MenuItem *item =<MenuItem *>();
Supports Markdown
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