Browse Source

allows users to change the account name

cl-refactor
yann300 10 years ago
parent
commit
f1feb3ae65
  1. 15
      mix/qml/StateDialog.qml
  2. 4
      mix/qml/StateListModel.qml

15
mix/qml/StateDialog.qml

@ -12,14 +12,13 @@ Window {
id: modalStateDialog id: modalStateDialog
modality: Qt.ApplicationModal modality: Qt.ApplicationModal
width: 555 width: 570
height: 480 height: 480
title: qsTr("Edit State") title: qsTr("Edit State")
visible: false visible: false
color: StateDialogStyle.generic.backgroundColor color: StateDialogStyle.generic.backgroundColor
property alias stateTitle: titleField.text property alias stateTitle: titleField.text
//property alias stateBalance: balanceField.value
property alias isDefault: defaultCheckBox.checked property alias isDefault: defaultCheckBox.checked
property int stateIndex property int stateIndex
property var stateTransactions: [] property var stateTransactions: []
@ -41,7 +40,8 @@ Window {
accountsModel.clear(); accountsModel.clear();
stateAccounts = []; stateAccounts = [];
for (var k = 0; k < item.accounts.length; k++) for (var k = 0; k < item.accounts.length; k++)
{ accountsModel.append(item.accounts[k]); {
accountsModel.append(item.accounts[k]);
stateAccounts.push(item.accounts[k]); stateAccounts.push(item.accounts[k]);
} }
@ -125,13 +125,13 @@ Window {
var account = stateListModel.newAccount("1000000", QEther.Ether); var account = stateListModel.newAccount("1000000", QEther.Ether);
stateAccounts.push(account); stateAccounts.push(account);
accountsModel.append(account); accountsModel.append(account);
} }
} }
} }
TableView TableView
{ {
id: accountsView
Layout.fillWidth: true Layout.fillWidth: true
model: accountsModel model: accountsModel
TableViewColumn { TableViewColumn {
@ -142,8 +142,13 @@ Window {
Rectangle Rectangle
{ {
height: 25 height: 25
DefaultLabel { width: parent.width
DefaultTextField {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
onTextChanged: {
if (styleData.row > -1)
stateAccounts[styleData.row].name = text;
}
text: { text: {
return styleData.value return styleData.value
} }

4
mix/qml/StateListModel.qml

@ -192,7 +192,7 @@ Item {
function newAccount(_balance, _unit) function newAccount(_balance, _unit)
{ {
var secret = clientModel.newAddress(); 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) }; return { name: name, secret: secret, balance: QEtherHelper.createEther(_balance, _unit) };
} }
@ -205,8 +205,6 @@ Item {
item.accounts.push(newAccount("1000000", QEther.Ether)); item.accounts.push(newAccount("1000000", QEther.Ether));
console.log(JSON.stringify(item.accounts));
//add all stdc contracts //add all stdc contracts
for (var i = 0; i < contractLibrary.model.count; i++) { for (var i = 0; i < contractLibrary.model.count; i++) {
var contractTransaction = defaultTransactionItem(); var contractTransaction = defaultTransactionItem();

Loading…
Cancel
Save