From edc50f102d74ebc624acb94f2d7ad0989bae25c5 Mon Sep 17 00:00:00 2001
From: David Rowe <david@ctrlaltstudio.com>
Date: Wed, 9 Mar 2016 11:55:09 +1300
Subject: [PATCH] Fix "duplicate bookmark" dialog

---
 interface/resources/qml/dialogs/MessageDialog.qml |  9 ++++++---
 tests/ui/qml/main.qml                             | 13 +++++++++++++
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/interface/resources/qml/dialogs/MessageDialog.qml b/interface/resources/qml/dialogs/MessageDialog.qml
index 9809708c37..28a36d5a75 100644
--- a/interface/resources/qml/dialogs/MessageDialog.qml
+++ b/interface/resources/qml/dialogs/MessageDialog.qml
@@ -84,7 +84,7 @@ ModalWindow {
 
         RalewaySemibold {
             id: mainTextContainer
-            onHeightChanged: d.resize(); onWidthChanged: d.resize();
+            onTextChanged: d.resize();
             wrapMode: Text.WordWrap
             size: hifi.fontSizes.menuItem
             color: hifi.colors.baseGrayHighlight
@@ -100,7 +100,7 @@ ModalWindow {
 
         RalewaySemibold {
             id: informativeTextContainer
-            onHeightChanged: d.resize(); onWidthChanged: d.resize();
+            onTextChanged: d.resize();
             wrapMode: Text.WordWrap
             size: hifi.fontSizes.menuItem
             color: hifi.colors.baseGrayHighlight
@@ -194,7 +194,10 @@ ModalWindow {
             }
         ]
 
-        Component.onCompleted: updateIcon()
+        Component.onCompleted: {
+            updateIcon();
+            d.resize();
+        }
         onStateChanged: d.resize()
     }
 
diff --git a/tests/ui/qml/main.qml b/tests/ui/qml/main.qml
index 273eb1df47..d8083b7bbd 100644
--- a/tests/ui/qml/main.qml
+++ b/tests/ui/qml/main.qml
@@ -161,6 +161,19 @@ ApplicationWindow {
                                        });
                 }
             }
+            Button {
+                text: "Duplicate Bookmark"
+                onClicked: {
+                    desktop.messageBox({
+                                           title: "Duplicate Bookmark",
+                                           icon: hifi.icons.warning,
+                                           text: "The bookmark name you entered alread exists in yoru list.",
+                                           informativeText: "Would you like to overwrite it?",
+                                           buttons: OriginalDialogs.StandardButton.Yes + OriginalDialogs.StandardButton.No,
+                                           defaultButton: OriginalDialogs.StandardButton.Yes
+                                       });
+                }
+            }
             /*
             // There is no such desktop.queryBox() function; may need to update test to cover QueryDialog.qml?
             Button {