kwinrules: Show error when detected window is unmanaged
BUG: 340477
This commit is contained in:
parent
bf7e7b2130
commit
1829dce1a9
3 changed files with 25 additions and 2 deletions
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue