diff --git a/src/LEZAccountFilterModel.cpp b/src/LEZAccountFilterModel.cpp index c43046f..4562985 100644 --- a/src/LEZAccountFilterModel.cpp +++ b/src/LEZAccountFilterModel.cpp @@ -31,7 +31,7 @@ bool LEZAccountFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex& s int LEZAccountFilterModel::rowForAddress(const QString& address) const { for (int i = 0; i < rowCount(); ++i) { - if (data(index(i, 0), LEZWalletAccountModel::AddressRole).toString() == address) + if (data(index(i, 0), LEZWalletAccountModel::AccountIdRole).toString() == address) return i; } return -1; diff --git a/src/LEZWalletAccountModel.cpp b/src/LEZWalletAccountModel.cpp index 35b9c1b..b9df171 100644 --- a/src/LEZWalletAccountModel.cpp +++ b/src/LEZWalletAccountModel.cpp @@ -21,7 +21,7 @@ QVariant LEZWalletAccountModel::data(const QModelIndex& index, int role) const const LEZWalletAccountEntry& e = m_entries.at(index.row()); switch (role) { case NameRole: return e.name; - case AddressRole: return e.address; + case AccountIdRole: return e.accountId; case BalanceRole: return e.balance; case IsPublicRole: return e.isPublic; default: return QVariant(); @@ -32,7 +32,7 @@ QHash LEZWalletAccountModel::roleNames() const { return { { NameRole, "name" }, - { AddressRole, "address" }, + { AccountIdRole, "accountId" }, { BalanceRole, "balance" }, { IsPublicRole, "isPublic" } }; @@ -48,13 +48,13 @@ void LEZWalletAccountModel::replaceFromJsonArray(const QJsonArray& arr) e.balance = QString(); if (v.isObject()) { const QJsonObject obj = v.toObject(); - e.address = obj.value(QStringLiteral("account_id")).toString(); + e.accountId = obj.value(QStringLiteral("account_id")).toString(); e.isPublic = obj.value(QStringLiteral("is_public")).toBool(true); } else { - e.address = v.toString(); + e.accountId = v.toString(); e.isPublic = true; } - e.name = QStringLiteral("Account %1").arg(e.address.left(4)); + e.name = QString(); m_entries.append(e); } endResetModel(); @@ -62,10 +62,10 @@ void LEZWalletAccountModel::replaceFromJsonArray(const QJsonArray& arr) emit countChanged(); } -void LEZWalletAccountModel::setBalanceByAddress(const QString& address, const QString& balance) +void LEZWalletAccountModel::setBalanceByAccountId(const QString& accountId, const QString& balance) { for (int i = 0; i < m_entries.size(); ++i) { - if (m_entries.at(i).address == address) { + if (m_entries.at(i).accountId == accountId) { if (m_entries.at(i).balance != balance) { m_entries[i].balance = balance; QModelIndex idx = index(i, 0); diff --git a/src/LEZWalletAccountModel.h b/src/LEZWalletAccountModel.h index 6092c8f..8efb086 100644 --- a/src/LEZWalletAccountModel.h +++ b/src/LEZWalletAccountModel.h @@ -6,7 +6,7 @@ struct LEZWalletAccountEntry { QString name; - QString address; + QString accountId; QString balance; bool isPublic = true; }; @@ -17,7 +17,7 @@ class LEZWalletAccountModel : public QAbstractListModel { public: enum Role { NameRole = Qt::UserRole + 1, - AddressRole, + AccountIdRole, BalanceRole, IsPublicRole }; @@ -30,7 +30,7 @@ public: QHash roleNames() const override; void replaceFromJsonArray(const QJsonArray& arr); - void setBalanceByAddress(const QString& address, const QString& balance); + void setBalanceByAccountId(const QString& accountId, const QString& balance); int count() const { return m_entries.size(); } signals: diff --git a/src/LEZWalletBackend.cpp b/src/LEZWalletBackend.cpp index f32ca99..d1789d1 100644 --- a/src/LEZWalletBackend.cpp +++ b/src/LEZWalletBackend.cpp @@ -188,11 +188,11 @@ void LEZWalletBackend::updateBalances() bool anyFailed = false; for (int i = 0; i < m_accountModel->count(); ++i) { const QModelIndex idx = m_accountModel->index(i, 0); - const QString addr = m_accountModel->data(idx, LEZWalletAccountModel::AddressRole).toString(); + const QString addr = m_accountModel->data(idx, LEZWalletAccountModel::AccountIdRole).toString(); const bool isPub = m_accountModel->data(idx, LEZWalletAccountModel::IsPublicRole).toBool(); const QString bal = getBalance(addr, isPub); if (!bal.isEmpty()) - m_accountModel->setBalanceByAddress(addr, bal); + m_accountModel->setBalanceByAccountId(addr, bal); else anyFailed = true; } diff --git a/src/qml/controls/AccountComboBox.qml b/src/qml/controls/AccountComboBox.qml index 8c81196..8d42c27 100644 --- a/src/qml/controls/AccountComboBox.qml +++ b/src/qml/controls/AccountComboBox.qml @@ -18,7 +18,7 @@ ComboBox { rightPadding: 12 implicitHeight: 40 textRole: "name" - valueRole: "address" + valueRole: "accountId" background: Rectangle { radius: Theme.spacing.radiusSmall @@ -47,7 +47,7 @@ ComboBox { selectByMouse: true font.pixelSize: Theme.typography.secondaryText color: Theme.palette.text - text: root.currentValue ? ("Account " + Base58.encode(root.currentValue).substring(0, 6)) : root.displayText + text: root.currentValue ? ("Account " + Base58.encode(root.currentValue).substring(0, 4)) : root.displayText verticalAlignment: Text.AlignVCenter clip: true } diff --git a/src/qml/controls/AccountDelegate.qml b/src/qml/controls/AccountDelegate.qml index 698d346..9c4be1f 100644 --- a/src/qml/controls/AccountDelegate.qml +++ b/src/qml/controls/AccountDelegate.qml @@ -35,7 +35,7 @@ ItemDelegate { spacing: Theme.spacing.small LogosText { - text: model.name ?? "" + text: model.name || ("Account " + Base58.encode(model.accountId ?? "").slice(0, 4)) font.pixelSize: Theme.typography.secondaryText font.bold: true } @@ -70,7 +70,7 @@ ItemDelegate { id: addressLabel Layout.fillWidth: true verticalAlignment: Text.AlignVCenter - text: Base58.encode(model.address ?? "") + text: Base58.encode(model.accountId ?? "") font.pixelSize: Theme.typography.secondaryText color: Theme.palette.textMuted elide: Text.ElideMiddle @@ -79,8 +79,8 @@ ItemDelegate { Layout.preferredHeight: 40 Layout.preferredWidth: 40 onCopyText: model.isPublic - ? root.copyRequested(Base58.encode(model.address ?? "")) - : root.copyPublicKeysRequested(model.address ?? "") + ? root.copyRequested(Base58.encode(model.accountId ?? "")) + : root.copyPublicKeysRequested(model.accountId ?? "") visible: addressLabel.text icon.color: Theme.palette.textMuted } diff --git a/src/qml/popups/CreateAccountDialog.qml b/src/qml/popups/CreateAccountDialog.qml index d07c3f2..365a62d 100644 --- a/src/qml/popups/CreateAccountDialog.qml +++ b/src/qml/popups/CreateAccountDialog.qml @@ -64,7 +64,7 @@ Popup { LogosText { text: tabBar.currentIndex === 0 - ? qsTr("Address visible. Balance on-chain.") + ? qsTr("Account ID visible. Balance on-chain.") : qsTr("Private balance and activity.") font.pixelSize: Theme.typography.secondaryText color: Theme.palette.textSecondary diff --git a/src/qml/views/TransferPanel.qml b/src/qml/views/TransferPanel.qml index d212e95..73d2f98 100644 --- a/src/qml/views/TransferPanel.qml +++ b/src/qml/views/TransferPanel.qml @@ -107,7 +107,7 @@ Rectangle { LogosTextField { id: manualFromField Layout.fillWidth: true - placeholderText: qsTr("Paste or type from address") + placeholderText: qsTr("Paste or type from account ID") visible: fromFilterCount === 0 } @@ -142,7 +142,7 @@ Rectangle { LogosTextField { id: toField Layout.fillWidth: true - placeholderText: (d.isPublicTab || d.isDeshieldedTab) ? qsTr("Recipient address") : qsTr("Recipient private keys (JSON)") + placeholderText: (d.isPublicTab || d.isDeshieldedTab) ? qsTr("Recipient account ID") : qsTr("Recipient public keys (JSON)") visible: !d.useOwnedAccountForTo }