Commit d2a77e1c authored by Fushan Wen's avatar Fushan Wen 💬 Committed by Nate Graham
Browse files

app/SettingsBase: Fix systemsettings unable to start when missing plugin

Switch to alternate view if the current view is missing on startup.

BUG: 451054
FIXED-IN: 5.24.3


(cherry picked from commit 7d6bfd80)
parent 9a35fd4c
Pipeline #146679 passed with stage
in 1 minute and 12 seconds
......@@ -351,11 +351,25 @@ void SettingsBase::changePlugin()
} else if (auto *view = loadCurrentView()) {
activeView = view;
} else if (!m_loadedViews.empty()) { // Otherwise we activate the failsafe
qCWarning(SYSTEMSETTINGS_APP_LOG) << "System Settings was unable to load" << viewToUse;
activeView = m_loadedViews.cbegin().value();
} else {
qCWarning(SYSTEMSETTINGS_APP_LOG) << "System Settings was unable to load any views, and hence has nothing to display.";
close();
return; // Halt now!
// Current view is missing on startup, try to load alternate view.
qCWarning(SYSTEMSETTINGS_APP_LOG) << "System Settings was unable to load" << viewToUse;
if (viewToUse == QStringLiteral("systemsettings_icon_mode")) {
BaseConfig::setActiveView(QStringLiteral("systemsettings_sidebar_mode"));
} else if (m_mode != BaseMode::InfoCenter) {
BaseConfig::setActiveView(QStringLiteral("systemsettings_icon_mode"));
}
if (auto *view = loadCurrentView()) {
activeView = view;
activeView->saveState();
} else {
qCWarning(SYSTEMSETTINGS_APP_LOG) << "System Settings was unable to load any views, and hence has nothing to display.";
close();
return; // Halt now!
}
}
if (stackedWidget->indexOf(activeView->mainWidget()) == -1) {
......
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