simple snapshot confirmation

This commit is contained in:
howard-stearns 2016-08-04 15:52:39 -07:00
parent 5a0db63a6f
commit fed775ff83
2 changed files with 10 additions and 2 deletions

View file

@ -96,7 +96,7 @@ void WindowScriptingInterface::alert(const QString& message) {
/// \param const QString& message message to display /// \param const QString& message message to display
/// \return QScriptValue `true` if 'Yes' was clicked, `false` otherwise /// \return QScriptValue `true` if 'Yes' was clicked, `false` otherwise
QScriptValue WindowScriptingInterface::confirm(const QString& message) { QScriptValue WindowScriptingInterface::confirm(const QString& message) {
return QScriptValue((QMessageBox::Yes == OffscreenUi::question("", message))); return QScriptValue((QMessageBox::Yes == OffscreenUi::question("", message, QMessageBox::Yes | QMessageBox::No)));
} }
/// Display a prompt with a text box /// Display a prompt with a text box

View file

@ -20,6 +20,13 @@ var button = toolBar.addButton({
alpha: 0.9, alpha: 0.9,
}); });
function confirmShare(data) {
if (!Window.confirm("Share snapshot " + data.localPath + "?")) { // This dialog will be more elaborate...
return;
}
Window.alert("Pretending to upload. That code will go here.");
}
function onClicked() { function onClicked() {
// update button states // update button states
resetOverlays = Menu.isOptionChecked("Overlays"); resetOverlays = Menu.isOptionChecked("Overlays");
@ -56,7 +63,8 @@ function resetButtons(path, notify) {
button.writeProperty("defaultState", 1); button.writeProperty("defaultState", 1);
button.writeProperty("hoverState", 3); button.writeProperty("hoverState", 3);
Window.snapshotTaken.disconnect(resetButtons); Window.snapshotTaken.disconnect(resetButtons);
} confirmShare({localPath: path});
}
button.clicked.connect(onClicked); button.clicked.connect(onClicked);