[Pkg-privacy-commits] [tails-installer] 53/210: Make the user confirm he actually wants to write the image

Intrigeri intrigeri at moszumanska.debian.org
Wed May 24 15:26:27 UTC 2017


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to tag 3.90.0
in repository tails-installer.

commit 0217c59eb8f22fc2b0012dec4323f610beeb7c44
Author: Martin Briza <mbriza at redhat.com>
Date:   Wed Apr 8 10:24:43 2015 +0200

    Make the user confirm he actually wants to write the image
    
    Also fixed positioning in the button
---
 liveusb/components/AdwaitaButton.qml  | 17 +++++++++++------
 liveusb/components/DownloadDialog.qml | 26 ++++++++++++++++++++------
 liveusb/components/ImageDetails.qml   |  1 -
 3 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/liveusb/components/AdwaitaButton.qml b/liveusb/components/AdwaitaButton.qml
index fce73ae..e4b90af 100644
--- a/liveusb/components/AdwaitaButton.qml
+++ b/liveusb/components/AdwaitaButton.qml
@@ -11,13 +11,18 @@ Button {
         background: AdwaitaRectangle {
             color: root.color
             border.color: control.enabled ? "#777777" : "#c2c2c2"
-            width: implicitWidth + 16
         }
-        label: Text {
-            color: control.enabled ? root.textColor : "gray"
-            verticalAlignment: Text.AlignVCenter
-            horizontalAlignment: Text.AlignHCenter
-            text: control.text
+        label: Item {
+            implicitWidth: labelText.width + 16
+            Text {
+                x: 8
+                id: labelText
+                color: control.enabled ? root.textColor : "gray"
+                text: control.text
+                height: parent.height
+                horizontalAlignment: Text.AlignHCenter
+                verticalAlignment: Text.AlignVCenter
+            }
         }
     }
 }
diff --git a/liveusb/components/DownloadDialog.qml b/liveusb/components/DownloadDialog.qml
index 141d9c6..77fdb4d 100644
--- a/liveusb/components/DownloadDialog.qml
+++ b/liveusb/components/DownloadDialog.qml
@@ -133,7 +133,10 @@ Dialog {
                     Layout.preferredWidth: implicitWidth * 2.3
                     model: liveUSBData.usbDriveNames
                     currentIndex: liveUSBData.currentDrive
-                    onCurrentIndexChanged: liveUSBData.currentDrive = currentIndex
+                    onCurrentIndexChanged: {
+                        liveUSBData.currentDrive = currentIndex
+                        acceptButton.pressedOnce = false
+                    }
                     enabled: !liveUSBData.currentImage.writer.running
                 }
             }
@@ -157,7 +160,10 @@ Dialog {
                                 height: 20
                                 width: 20
                                 text: liveUSBData.optionNames[index]
-                                onCheckedChanged: liveUSBData.setOption(index, checked)
+                                onCheckedChanged: {
+                                    liveUSBData.setOption(index, checked)
+                                    acceptButton.pressedOnce = false
+                                }
                             }
                         }
                     }
@@ -184,12 +190,12 @@ Dialog {
                     bottom: parent.bottom
                     rightMargin: 6
                 }
-                width: implicitWidth * 1.2
                 text: "Cancel"
                 enabled: !liveUSBData.currentImage.writer.running
                 onClicked: {
                     liveUSBData.currentImage.download.cancel()
                     liveUSBData.currentImage.writer.cancel()
+                    pressedOnce = false
                     root.close()
                 }
             }
@@ -200,12 +206,20 @@ Dialog {
                     top: parent.top
                     bottom: parent.bottom
                 }
+                property bool pressedOnce: false
                 color: "red"
                 textColor: enabled ? "white" : palette.text
-                width: implicitWidth * 1.2
                 enabled: liveUSBData.currentImage.readyToWrite && !liveUSBData.currentImage.writer.running
-                text: "Write to disk"
-                onClicked: liveUSBData.currentImage.write()
+                text: pressedOnce ? "Are you sure?" : "Write to disk"
+                onClicked: {
+                    if(pressedOnce) {
+                        liveUSBData.currentImage.write()
+                        pressedOnce = false
+                    }
+                    else {
+                        pressedOnce = true
+                    }
+                }
             }
         }
     }
diff --git a/liveusb/components/ImageDetails.qml b/liveusb/components/ImageDetails.qml
index 82f1e7b..4b82ced 100644
--- a/liveusb/components/ImageDetails.qml
+++ b/liveusb/components/ImageDetails.qml
@@ -44,7 +44,6 @@ Item {
             text: "Write to USB disk"
             color: "#729fcf"
             textColor: "white"
-            width: implicitWidth + 16
             onClicked: {
                 dlDialog.visible = true
                 liveUSBData.currentImage.get()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/tails-installer.git



More information about the Pkg-privacy-commits mailing list