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

Dialogs

parent 2bef82cd
No related branches found
No related tags found
No related merge requests found
import QtQuick 2.0
import QtQuick.Controls 1.1
import QtQuick.Dialogs 1.1
ApplicationWindow {
id: root
title: Qt.application.name
Component.onCompleted: {
MessageDialog {
id: confirmDialog
title: root.title
text: ''
icon: StandardIcon.Question
standardButtons: StandardButton.Ok | StandardButton.Cancel
onAccepted: xdgUrlHandler.process()
onRejected: Qt.quit()
}
MessageDialog {
id: infoDialog
title: root.title
text: ''
icon: StandardIcon.Information
onAccepted: Qt.quit()
}
MessageDialog {
id: errorDialog
title: root.title
text: ''
icon: StandardIcon.Warning
onAccepted: Qt.quit()
}
Component.onCompleted: {
xdgUrlHandler.finished.connect(function(result) {
result = JSON.parse(result);
var messages = {
'download_success': 'Download finished',
'install_success': 'Installation finished',
'validation_error': 'Invalid XDG-URL',
'network_error': 'Download failed',
'filetype_error': 'Incorrect file type',
'save_error': 'Saving file failed',
'install_error': 'Installation failed'
};
if (result.success) {
infoDialog.text = messages[result.success];
infoDialog.open();
}
else if (result.error) {
errorDialog.text = messages[result.error];
errorDialog.open();
}
});
if (xdgUrlHandler.isValid()) {
confirmDialog.text = 'Do you want to continue?';
confirmDialog.open();
}
else {
errorDialog.text = 'Invalid XDG-URL';
errorDialog.open();
}
}
}
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