Commit bbd7fcb3 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

[Splash KCM] Use InlineMessage for testing error

When testing a splash screen fails, a message box appears.
This changes it to an InlineLabel and also makes process handling asynchronous to not block
the settings dialog process and instead disables the controls within.

Differential Revision:
parent 5f10e0d8
......@@ -29,7 +29,6 @@
#include <QVBoxLayout>
#include <QPushButton>
#include <QMessageBox>
#include <QStandardItemModel>
#include <QQmlContext>
#include <QDir>
......@@ -195,18 +194,34 @@ int KCMSplashScreen::selectedPluginIndex() const
return -1;
bool KCMSplashScreen::testing() const
return m_testProcess;
void KCMSplashScreen::test(const QString &plugin)
if (plugin.isEmpty() || plugin == QLatin1String("None")) {
if (plugin.isEmpty() || plugin == QLatin1String("None") || m_testProcess) {
QProcess proc;
QStringList arguments;
arguments << plugin << QStringLiteral("--test");
if (proc.execute(QStringLiteral("ksplashqml"), arguments)) {
QMessageBox::critical(nullptr, i18n("Error"), i18n("Failed to successfully test the splash screen."));
m_testProcess = new QProcess(this);
connect(m_testProcess, &QProcess::errorOccurred, this, [this](QProcess::ProcessError error) {
emit testingFailed();
connect(m_testProcess, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this,
[this](int exitCode, QProcess::ExitStatus exitStatus) {
m_testProcess = nullptr;
emit testingChanged();
emit testingChanged();
m_testProcess->start(QStringLiteral("ksplashqml"), {plugin, QStringLiteral("--test")});
#include "kcm.moc"
......@@ -34,6 +34,7 @@ class KCMSplashScreen : public KQuickAddons::ConfigModule
Q_PROPERTY(QStandardItemModel *splashModel READ splashModel CONSTANT)
Q_PROPERTY(QString selectedPlugin READ selectedPlugin WRITE setSelectedPlugin NOTIFY selectedPluginChanged)
Q_PROPERTY(int selectedPluginIndex READ selectedPluginIndex NOTIFY selectedPluginIndexChanged)
Q_PROPERTY(bool testing READ testing NOTIFY testingChanged)
enum Roles {
......@@ -52,6 +53,8 @@ public:
int selectedPluginIndex() const;
bool testing() const;
void loadModel();
public Q_SLOTS:
......@@ -65,11 +68,16 @@ Q_SIGNALS:
void selectedPluginChanged();
void selectedPluginIndexChanged();
void testingChanged();
void testingFailed();
QStandardItemModel *m_model;
Plasma::Package m_package;
QString m_selectedPlugin;
QProcess *m_testProcess = nullptr;
KConfig m_config;
KConfigGroup m_configGroup;
......@@ -26,9 +26,28 @@ import org.kde.kcm 1.1 as KCM
KCM.GridViewKCM {
KCM.ConfigModule.quickHelp: i18n("This module lets you choose the splash screen theme.")
enabled: !kcm.testing
view.model: kcm.splashModel
//NOTE: pay attention to never break this binding
view.currentIndex: kcm.selectedPluginIndex
// putting the InlineMessage as header item causes it to show up initially despite visible false
header: ColumnLayout {
Kirigami.InlineMessage {
id: testingFailedLabel
Layout.fillWidth: true
showCloseButton: true
type: Kirigami.MessageType.Error
text: i18n("Failed to test the splash screen.")
Connections {
target: kcm
onTestingFailed: testingFailedLabel.visible = true
view.delegate: KCM.GridDelegate {
id: delegate
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