Skip to content

Commit

Permalink
Use DialogBox
Browse files Browse the repository at this point in the history
  • Loading branch information
vicr123 committed Jun 9, 2024
1 parent 0c6eb58 commit 10a301a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 9 deletions.
35 changes: 26 additions & 9 deletions libtheterminal/com/vicr123/theterminal/libtheterminal/Terminal.qml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Item {
const processes = controller.runningProcesses();
if (processes.length > 0) {
quitWithRunningProcessesDialog.informativeText = qsTr("Closing this terminal will also close %n processes: %1", "", processes.length).arg(processes.join(", "));
quitWithRunningProcessesDialog.visible = true
quitWithRunningProcessesDialog.open()
return;
}

Expand Down Expand Up @@ -218,16 +218,33 @@ Item {
}
}

MessageDialog {
DialogBox {
id: quitWithRunningProcessesDialog
text: "Close terminal with running processes?"
buttons: MessageDialog.Ok | MessageDialog.Cancel
onButtonClicked: (button, role) => {
switch (button) {
case MessageDialog.Ok:
messageText: "Close terminal with running processes?"
// buttons: MessageDialog.Ok | MessageDialog.Cancel
// onButtonClicked: (button, role) => {
// switch (button) {
// case MessageDialog.Ok:
// root.close();
// break;
// }
// }

buttons: [
DialogBox.CancelButton {
onClicked: quitWithRunningProcessesDialog.close();
icon.name: "go-previous"
},
DialogBox.Button {
text: qsTr("Close Anyway")
destructive: true
icon.name: "window-close"
onClicked: () => {
quitWithRunningProcessesDialog.close();
root.close();
break;
}
}
}

]
}
}
6 changes: 6 additions & 0 deletions libtheterminal/translations/en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,11 @@
<numerusform></numerusform>
</translation>
</message>
<message>
<location filename="../com/vicr123/theterminal/libtheterminal/Terminal.qml" line="239"/>
<location filename="../../../build-theterminal-Desktop_ARM-Debug/libtheterminal/com/vicr123/theterminal/libtheterminal/Terminal.qml" line="239"/>
<source>Close Anyway</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

0 comments on commit 10a301a

Please sign in to comment.