github.com/jonasnick/go-ethereum@v0.7.12-0.20150216215225-22176f05d387/cmd/mist/assets/qml/first_run.qml (about)

     1  import QtQuick 2.0
     2  import Ethereum 1.0
     3  
     4  // Which ones do we actually need?
     5  import QtQuick.Controls 1.0;
     6  import QtQuick.Layouts 1.0;
     7  import QtQuick.Dialogs 1.0;
     8  import QtQuick.Window 2.1;
     9  import QtQuick.Controls.Styles 1.1
    10  import QtQuick.Dialogs 1.1
    11  
    12  ApplicationWindow {
    13      id: wizardRoot
    14      width: 500
    15      height: 400
    16      title: "Ethereal first run setup"
    17  
    18      Column {
    19          spacing: 5
    20          anchors.leftMargin: 10
    21          anchors.left: parent.left
    22  
    23          Text {
    24              visible: true
    25              text: "<h2>Ethereal setup</h2>"
    26          }
    27  
    28          Column {
    29              id: restoreColumn
    30              spacing: 5
    31              Text {
    32                  visible: true
    33                  font.pointSize: 14
    34                  text: "Restore your Ethereum account"
    35                  id: restoreLabel
    36              }
    37  
    38              TextField {
    39                  id: txPrivKey
    40                  width: 480
    41                  placeholderText: "Private key or mnemonic words"
    42                  focus: true
    43                  onTextChanged: {
    44                      if(this.text.length == 64){
    45                          detailLabel.text = "Private (hex) key detected."
    46                          actionButton.enabled = true
    47                      }
    48                      else if(this.text.split(" ").length == 24){
    49                          detailLabel.text = "Mnemonic key detected."
    50                          actionButton.enabled = true
    51                      }else{
    52                          detailLabel.text = ""
    53                          actionButton.enabled = false
    54                      }
    55                  }
    56              }
    57              Row {
    58                  spacing: 10
    59                  Button {
    60                      id: actionButton
    61                      text: "Restore"
    62                      enabled: false
    63                      onClicked: {
    64                          var success = lib.importAndSetPrivKey(txPrivKey.text)
    65                          if(success){
    66                              importedDetails.visible = true
    67                              restoreColumn.visible = false
    68                              newKey.visible = false
    69                              wizardRoot.height = 120
    70                          }
    71                      }
    72                  }
    73                  Text {
    74                      id: detailLabel
    75                      font.pointSize: 12
    76                      anchors.topMargin: 10
    77                  }
    78              }
    79          }
    80          Column {
    81              id: importedDetails
    82              visible: false
    83              Text {
    84                  text: "<b>Your account has been imported. Please close the application and restart it again to let the changes take effect.</b>"
    85                  wrapMode: Text.WordWrap
    86                  width: 460
    87              }
    88          }
    89          Column {
    90              spacing: 5
    91              id: newDetailsColumn
    92              visible: false
    93              Text {
    94                  font.pointSize: 14
    95                  text: "Your account details"
    96              }
    97              Label {
    98                  text: "Address"
    99              }
   100              TextField {
   101                  id: addressInput
   102                  readOnly:true
   103                  width: 480
   104              }
   105              Label {
   106                  text: "Private key"
   107              }
   108              TextField {
   109                  id: privkeyInput
   110                  readOnly:true
   111                  width: 480
   112              }
   113              Label {
   114                  text: "Mnemonic words"
   115              }
   116              TextField {
   117                  id: mnemonicInput
   118                  readOnly:true
   119                  width: 480
   120              }
   121              Label {
   122                  text: "<b>A new account has been created. Please take the time to write down the <i>24 words</i>. You can use those to restore your account at a later date.</b>"
   123                  wrapMode: Text.WordWrap
   124                  width: 480
   125              }
   126              Label {
   127                  text: "Please restart the application once you have completed the steps above."
   128                  wrapMode: Text.WordWrap
   129                  width: 480
   130              }
   131          }
   132  
   133      }
   134      Button {
   135          anchors.right: parent.right
   136          anchors.bottom: parent.bottom
   137          anchors.rightMargin: 10
   138          anchors.bottomMargin: 10
   139          id: newKey
   140          text: "I don't have an account yet"
   141          onClicked: {
   142              var res = lib.createAndSetPrivKey()
   143              mnemonicInput.text = res[0]
   144              addressInput.text = res[1]
   145              privkeyInput.text = res[2]
   146  
   147              // Hide restore
   148              restoreColumn.visible = false
   149  
   150              // Show new details
   151              newDetailsColumn.visible = true
   152              newKey.visible = false
   153          }
   154      }
   155  }