From 33d7f5ce602255464cf1b56941e9bf83813236b5 Mon Sep 17 00:00:00 2001 From: link2xt Date: Thu, 5 Nov 2020 23:29:48 +0300 Subject: Display account addresses on accounts page --- qml/AccountsPage.qml | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/qml/AccountsPage.qml b/qml/AccountsPage.qml index 3278031..ca27df8 100644 --- a/qml/AccountsPage.qml +++ b/qml/AccountsPage.qml @@ -14,7 +14,19 @@ Kirigami.Page { text: "Add account" onTriggered: { let accountId = dcAccounts.addAccount() - accountsModel.insert(accountsModel.count, { number: accountId }) + let context = dcAccounts.getAccount(accountId); + + let title; + if (context.isConfigured()) { + title = context.getConfig("addr"); + } else { + title = `Unconfigured ${accountId}` + } + + accountsModel.insert(accountsModel.count, { + number: accountId, + title: title + }) } } @@ -53,7 +65,19 @@ Kirigami.Page { accountsModel.clear() for (let i = 0; i < accountsList.length; i++) { - accountsModel.insert(i, { number: accountsList[i] }) + let accountId = accountsList[i]; + let title; + let context = dcAccounts.getAccount(accountId); + if (context.isConfigured()) { + title = context.getConfig("addr"); + } else { + title = `Unconfigured ${accountId}` + } + + accountsModel.insert(i, { + number: accountId, + title: title + }) } } @@ -71,7 +95,7 @@ Kirigami.Page { Label { Layout.fillWidth: true - text: model.number + text: model.title horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } -- cgit v1.2.3-70-g09d2