From fed775ff83b5211350931a2be98f8623aa622db0 Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Thu, 4 Aug 2016 15:52:39 -0700 Subject: [PATCH] simple snapshot confirmation --- interface/src/scripting/WindowScriptingInterface.cpp | 2 +- scripts/system/snapshot.js | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/interface/src/scripting/WindowScriptingInterface.cpp b/interface/src/scripting/WindowScriptingInterface.cpp index fb7be86096..026818ec82 100644 --- a/interface/src/scripting/WindowScriptingInterface.cpp +++ b/interface/src/scripting/WindowScriptingInterface.cpp @@ -96,7 +96,7 @@ void WindowScriptingInterface::alert(const QString& message) { /// \param const QString& message message to display /// \return QScriptValue `true` if 'Yes' was clicked, `false` otherwise 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 diff --git a/scripts/system/snapshot.js b/scripts/system/snapshot.js index 87ea3f29ec..92ce36e935 100644 --- a/scripts/system/snapshot.js +++ b/scripts/system/snapshot.js @@ -20,6 +20,13 @@ var button = toolBar.addButton({ 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() { // update button states resetOverlays = Menu.isOptionChecked("Overlays"); @@ -56,7 +63,8 @@ function resetButtons(path, notify) { button.writeProperty("defaultState", 1); button.writeProperty("hoverState", 3); Window.snapshotTaken.disconnect(resetButtons); -} + confirmShare({localPath: path}); + } button.clicked.connect(onClicked);