From f1feb3ae65adaf5e88b4ef720456837c4125d02f Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 3 Mar 2015 14:54:53 +0100 Subject: [PATCH] allows users to change the account name --- mix/qml/StateDialog.qml | 15 ++++++++++----- mix/qml/StateListModel.qml | 4 +--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/mix/qml/StateDialog.qml b/mix/qml/StateDialog.qml index 38a59a8a7..6a41043aa 100644 --- a/mix/qml/StateDialog.qml +++ b/mix/qml/StateDialog.qml @@ -12,14 +12,13 @@ Window { id: modalStateDialog modality: Qt.ApplicationModal - width: 555 + width: 570 height: 480 title: qsTr("Edit State") visible: false color: StateDialogStyle.generic.backgroundColor property alias stateTitle: titleField.text - //property alias stateBalance: balanceField.value property alias isDefault: defaultCheckBox.checked property int stateIndex property var stateTransactions: [] @@ -41,7 +40,8 @@ Window { accountsModel.clear(); stateAccounts = []; for (var k = 0; k < item.accounts.length; k++) - { accountsModel.append(item.accounts[k]); + { + accountsModel.append(item.accounts[k]); stateAccounts.push(item.accounts[k]); } @@ -125,13 +125,13 @@ Window { var account = stateListModel.newAccount("1000000", QEther.Ether); stateAccounts.push(account); accountsModel.append(account); - } } } TableView { + id: accountsView Layout.fillWidth: true model: accountsModel TableViewColumn { @@ -142,8 +142,13 @@ Window { Rectangle { height: 25 - DefaultLabel { + width: parent.width + DefaultTextField { anchors.verticalCenter: parent.verticalCenter + onTextChanged: { + if (styleData.row > -1) + stateAccounts[styleData.row].name = text; + } text: { return styleData.value } diff --git a/mix/qml/StateListModel.qml b/mix/qml/StateListModel.qml index 64b32af6f..4b83c54d7 100644 --- a/mix/qml/StateListModel.qml +++ b/mix/qml/StateListModel.qml @@ -192,7 +192,7 @@ Item { function newAccount(_balance, _unit) { var secret = clientModel.newAddress(); - var name = qsTr("Account") + " - " + secret.substring(0, 5); + var name = qsTr("Account") + "-" + secret.substring(0, 4); return { name: name, secret: secret, balance: QEtherHelper.createEther(_balance, _unit) }; } @@ -205,8 +205,6 @@ Item { item.accounts.push(newAccount("1000000", QEther.Ether)); - console.log(JSON.stringify(item.accounts)); - //add all stdc contracts for (var i = 0; i < contractLibrary.model.count; i++) { var contractTransaction = defaultTransactionItem();