Browse Source

CURA-3397 Enable/disable "keep" and "discard" buttons according to the choice

Lipu Fei 8 years ago
parent
commit
c9254a3095
1 changed files with 19 additions and 1 deletions
  1. 19 1
      resources/qml/DiscardOrKeepProfileChangesDialog.qml

+ 19 - 1
resources/qml/DiscardOrKeepProfileChangesDialog.qml

@@ -146,7 +146,25 @@ UM.Dialog
                 ]
                 width: 300
                 currentIndex: UM.Preferences.getValue("cura/choice_on_profile_override")
-                onCurrentIndexChanged: UM.Preferences.setValue("cura/choice_on_profile_override", currentIndex)
+                onCurrentIndexChanged:
+                {
+                    UM.Preferences.setValue("cura/choice_on_profile_override", currentIndex)
+                    if (currentIndex == 1) {
+                        // 1 == "Discard and never ask again", so only enable the "Discard" button
+                        discardButton.enabled = true
+                        keepButton.enabled = false
+                    }
+                    else if (currentIndex == 2) {
+                        // 2 == "Keep and never ask again", so only enable the "Keep" button
+                        keepButton.enabled = true
+                        discardButton.enabled = false
+                    }
+                    else {
+                        // 0 == "Always ask me this", so show both
+                        keepButton.enabled = true
+                        discardButton.enabled = true
+                    }
+                }
             }
         }