Commit 78dca836 authored by Timothée Giet's avatar Timothée Giet

core, improve GCDialog closing behavior

now when closing a GCDialog with the cross or the esc key,
if there's a button2 (typically a "no" answer), it clicks that button
else if there's only a button1 (typically an "ok" button), it clicks that button,
else if there's no button it just closes as before
parent cd500ffe
......@@ -81,7 +81,8 @@ Rectangle {
Loader {
id: replaceFileDialog
sourceComponent: GCDialog {
parent: activity.main
parent: activity
isDestructible: false
message: qsTr("A file with this name already exists. Do you want to replace it?")
button1Text: qsTr("Yes")
button2Text: qsTr("No")
......
......@@ -235,12 +235,19 @@ Item {
}
Keys.onEscapePressed: {
stop();
buttonCancel.close();
}
// The cancel button
GCButtonCancel {
id: buttonCancel
onClose: parent.stop()
onClose: {
if(button2.visible)
button2.clicked();
else if(button1.visible)
button1.clicked();
else
parent.stop();
}
}
}
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