Commit 1829dce1 authored by Ismael Asensio's avatar Ismael Asensio

kwinrules: Show error when detected window is unmanaged

BUG: 340477
parent bf7e7b21
......@@ -91,9 +91,10 @@ ScrollViewKCM {
Layout.fillWidth: true
}
QQC2.Button {
id: detectButton
text: i18n("Detect Window Properties")
icon.name: "edit-find"
enabled: !propertySheet.sheetOpen
enabled: !propertySheet.sheetOpen && !errorSheet.sheetOpen
onClicked: {
overlayModel.onlySuggestions = true;
rulesModel.detectWindowProperties(Math.max(delaySpin.value * 1000,
......@@ -102,7 +103,7 @@ ScrollViewKCM {
}
QQC2.SpinBox {
id: delaySpin
enabled: !propertySheet.sheetOpen
enabled: detectButton.enabled
Layout.preferredWidth: Kirigami.Units.gridUnit * 8
from: 0
to: 30
......@@ -120,6 +121,23 @@ ScrollViewKCM {
overlayModel.onlySuggestions = true;
propertySheet.sheetOpen = true;
}
function onShowErrorMessage(message) {
errorLabel.text = message
errorSheet.open()
}
}
Kirigami.OverlaySheet {
id: errorSheet
header: Kirigami.Heading {
text: i18n("Error")
}
Kirigami.Heading {
id: errorLabel
level: 3
wrapMode: Text.WordWrap
Layout.fillWidth: true
}
}
Kirigami.OverlaySheet {
......
......@@ -829,6 +829,9 @@ void RulesModel::selectX11Window()
QDBusPendingReply<QVariantMap> reply = *self;
self->deleteLater();
if (!reply.isValid()) {
if (reply.error().name() == QLatin1String("org.kde.KWin.Error.InvalidWindow")) {
emit showErrorMessage(i18n("Could not detect window properties. The window is not managed by KWin."));
}
return;
}
const QVariantMap windowInfo = reply.value();
......
......@@ -81,7 +81,9 @@ public:
signals:
void descriptionChanged();
void warningMessageChanged();
void showSuggestions();
void showErrorMessage(const QString &message);
void virtualDesktopsUpdated();
......
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