Newer
Older
width: 400
height: 200
minimumWidth: 400
minimumHeight: 200
maximumWidth: 800
maximumHeight: 400
standardButtons: StandardButton.Ok | StandardButton.Cancel
onAccepted: xdgUrlHandler.process()
onRejected: Qt.quit()
}
MessageDialog {
id: infoDialog
title: root.title
onAccepted: Qt.quit()
}
MessageDialog {
id: errorDialog
title: root.title
Component.onCompleted: {
xdgUrlHandler.finished.connect(function(result) {
result = JSON.parse(result);
'success_download': 'Download successfull',
'success_install': 'Installation successfull',
'error_validation': 'Validation error',
'error_network': 'Network error',
'error_filetype': 'File type error',
'error_save': 'Saving file failed',
'error_install': 'Installation failed'
infoDialog.text
= (metadata.command === 'install' ? 'Install' : 'Download')
+ ': ' + metadata.filename
+ '\n\n'
+ messages[result.success];
infoDialog.detailedText
= 'The file has stored into: ' + result.destination;
errorDialog.text
= (metadata.command === 'install' ? 'Install' : 'Download')
+ ': ' + metadata.filename
+ '\n\n'
+ messages[result.error];
errorDialog.detailedText = result.detail;
errorDialog.open();
}
});
if (xdgUrlHandler.isValid()) {
var metadata = JSON.parse(xdgUrlHandler.getMetadata());
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();
}
else {
errorDialog.text = 'Invalid XDG-URL';