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
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
}

4
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();

Loading…
Cancel
Save