Skip to content
Snippets Groups Projects
Commit fa0c9db9 authored by akiraohgaki's avatar akiraohgaki
Browse files

Dialog text

parent 9fe4c9f0
No related branches found
No related tags found
No related merge requests found
...@@ -15,9 +15,9 @@ Window { ...@@ -15,9 +15,9 @@ Window {
MessageDialog { MessageDialog {
id: confirmDialog id: confirmDialog
title: root.title title: root.title
icon: StandardIcon.Question
text: '' text: ''
detailedText: '' detailedText: ''
icon: StandardIcon.Question
standardButtons: StandardButton.Ok | StandardButton.Cancel standardButtons: StandardButton.Ok | StandardButton.Cancel
onAccepted: xdgUrlHandler.process() onAccepted: xdgUrlHandler.process()
onRejected: Qt.quit() onRejected: Qt.quit()
...@@ -26,27 +26,28 @@ Window { ...@@ -26,27 +26,28 @@ Window {
MessageDialog { MessageDialog {
id: infoDialog id: infoDialog
title: root.title title: root.title
icon: StandardIcon.Information
text: '' text: ''
detailedText: '' detailedText: ''
icon: StandardIcon.Information
onAccepted: Qt.quit() onAccepted: Qt.quit()
} }
MessageDialog { MessageDialog {
id: errorDialog id: errorDialog
title: root.title title: root.title
icon: StandardIcon.Warning
text: '' text: ''
detailedText: '' detailedText: ''
icon: StandardIcon.Warning
onAccepted: Qt.quit() onAccepted: Qt.quit()
} }
Component.onCompleted: { Component.onCompleted: {
xdgUrlHandler.finished.connect(function(result) { xdgUrlHandler.finished.connect(function(result) {
result = JSON.parse(result); result = JSON.parse(result);
var metadata = JSON.parse(xdgUrlHandler.getMetadata());
var messages = { var messages = {
'download_success': 'Download finished', 'download_success': 'Download successfull',
'install_success': 'Installation finished', 'install_success': 'Installation successfull',
'validation_error': 'Invalid XDG-URL', 'validation_error': 'Invalid XDG-URL',
'network_error': 'Download failed', 'network_error': 'Download failed',
'filetype_error': 'Incorrect file type', 'filetype_error': 'Incorrect file type',
...@@ -54,20 +55,39 @@ Window { ...@@ -54,20 +55,39 @@ Window {
'install_error': 'Installation failed' 'install_error': 'Installation failed'
}; };
if (result.success) { if (result.success) {
infoDialog.text = messages[result.success]; infoDialog.text
infoDialog.detailedText = xdgUrlHandler.getXdgUrl(); = (metadata.command === 'install' ? 'Install' : 'Download')
+ ': ' + metadata.filename
+ '\n\n'
+ messages[result.success];
infoDialog.detailedText
= 'The file has stored into: ' + result.destination;
infoDialog.open(); infoDialog.open();
} }
else if (result.error) { else if (result.error) {
errorDialog.text = messages[result.error]; errorDialog.text
errorDialog.detailedText = xdgUrlHandler.getXdgUrl(); = (metadata.command === 'install' ? 'Install' : 'Download')
+ ': ' + metadata.filename
+ '\n\n'
+ messages[result.error];
errorDialog.detailedText = result.detail;
errorDialog.open(); errorDialog.open();
} }
}); });
if (xdgUrlHandler.isValid()) { if (xdgUrlHandler.isValid()) {
confirmDialog.text = 'Do you want to continue?'; var metadata = JSON.parse(xdgUrlHandler.getMetadata());
confirmDialog.detailedText = xdgUrlHandler.getXdgUrl(); confirmDialog.text
= (metadata.command === 'install' ? 'Install' : 'Download')
+ ': ' + metadata.filename
+ '\n\n'
+ 'Do you want to continue?';
confirmDialog.detailedText
= 'URL: ' + metadata.url
+ '\n\n'
+ 'File: ' + metadata.filename
+ '\n\n'
+ 'Type: ' + metadata.type;
confirmDialog.open(); confirmDialog.open();
} }
else { else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment