diff --git a/src/LEZWalletBackend.cpp b/src/LEZWalletBackend.cpp index 5eda5f3..e4b007c 100644 --- a/src/LEZWalletBackend.cpp +++ b/src/LEZWalletBackend.cpp @@ -46,10 +46,13 @@ LEZWalletBackend::LEZWalletBackend(LogosAPI* logosAPI, QObject* parent) : LEZWalletBackendSimpleSource(parent), m_accountModel(new LEZWalletAccountModel(this)), m_filteredAccountModel(new LEZAccountFilterModel(this)), + m_privateAccountModel(new LEZAccountFilterModel(this)), m_logosAPI(logosAPI ? logosAPI : new LogosAPI("lez_wallet_ui", this)), m_logos(new LogosModules(m_logosAPI)) { m_filteredAccountModel->setSourceModel(m_accountModel); + m_privateAccountModel->setFilterByPublic(false); + m_privateAccountModel->setSourceModel(m_accountModel); // Initialise PROP defaults via the generated setters. setIsWalletOpen(false); diff --git a/src/LEZWalletBackend.h b/src/LEZWalletBackend.h index 259b971..d6658ed 100644 --- a/src/LEZWalletBackend.h +++ b/src/LEZWalletBackend.h @@ -19,6 +19,7 @@ class LEZWalletBackend : public LEZWalletBackendSimpleSource { Q_OBJECT Q_PROPERTY(LEZWalletAccountModel* accountModel READ accountModel CONSTANT) Q_PROPERTY(LEZAccountFilterModel* filteredAccountModel READ filteredAccountModel CONSTANT) + Q_PROPERTY(LEZAccountFilterModel* privateAccountModel READ privateAccountModel CONSTANT) public: explicit LEZWalletBackend(LogosAPI* logosAPI = nullptr, QObject* parent = nullptr); @@ -26,6 +27,7 @@ public: LEZWalletAccountModel* accountModel() const { return m_accountModel; } LEZAccountFilterModel* filteredAccountModel() const { return m_filteredAccountModel; } + LEZAccountFilterModel* privateAccountModel() const { return m_privateAccountModel; } public slots: // Overrides of the pure-virtual slots generated from the .rep. @@ -56,6 +58,7 @@ private: LEZWalletAccountModel* m_accountModel; LEZAccountFilterModel* m_filteredAccountModel; + LEZAccountFilterModel* m_privateAccountModel; LogosAPI* m_logosAPI; LogosModules* m_logos; diff --git a/src/qml/ExecutionZoneWalletView.qml b/src/qml/ExecutionZoneWalletView.qml index 5b27095..aa49340 100644 --- a/src/qml/ExecutionZoneWalletView.qml +++ b/src/qml/ExecutionZoneWalletView.qml @@ -11,6 +11,8 @@ Rectangle { readonly property var backend: logos.module("lez_wallet_ui") readonly property var accountModel: logos.model("lez_wallet_ui", "accountModel") + readonly property var publicAccountModel: logos.model("lez_wallet_ui", "filteredAccountModel") + readonly property var privateAccountModel: logos.model("lez_wallet_ui", "privateAccountModel") property bool ready: false Connections { @@ -134,6 +136,8 @@ Rectangle { DashboardView { id: dashboardView accountModel: root.accountModel + publicAccountModel: root.publicAccountModel + privateAccountModel: root.privateAccountModel onCreatePublicAccountRequested: { if (!backend) { console.warn("backend is null"); return } diff --git a/src/qml/views/DashboardView.qml b/src/qml/views/DashboardView.qml index 49565b6..f8361f6 100644 --- a/src/qml/views/DashboardView.qml +++ b/src/qml/views/DashboardView.qml @@ -10,6 +10,8 @@ Rectangle { // --- Public API: input properties (set by parent / MainView) --- property var accountModel: null + property var publicAccountModel: null + property var privateAccountModel: null property string transferResult: "" property bool transferResultIsError: false @@ -48,7 +50,8 @@ Rectangle { id: transferPanel Layout.fillWidth: true Layout.fillHeight: true - fromAccountModel: root.accountModel + publicAccountModel: root.publicAccountModel + privateAccountModel: root.privateAccountModel transferResult: root.transferResult transferResultIsError: root.transferResultIsError diff --git a/src/qml/views/TransferPanel.qml b/src/qml/views/TransferPanel.qml index adcd2d4..a5b4046 100644 --- a/src/qml/views/TransferPanel.qml +++ b/src/qml/views/TransferPanel.qml @@ -11,7 +11,8 @@ Rectangle { id: root // --- Public API: data in --- - property var fromAccountModel: null + property var publicAccountModel: null + property var privateAccountModel: null property string transferResult: "" property bool transferResultIsError: false @@ -24,6 +25,7 @@ Rectangle { signal copyRequested(string copyText) readonly property int fromFilterCount: fromCombo.count + readonly property int toFilterCount: toCombo.count QtObject { id: d @@ -33,7 +35,7 @@ Rectangle { readonly property bool isShieldedTab: transferTypeBar.currentIndex === 2 readonly property bool showOwnedOption: isPrivateTab || isShieldedTab readonly property bool toAddressValid: showOwnedOption && useOwnedAccountForTo - ? (fromFilterCount > 0 && toCombo.currentIndex >= 0) + ? (toFilterCount > 0 && toCombo.currentIndex >= 0) : (toField && toField.text.trim().length > 0) readonly property bool sendEnabled: amountField && manualFromField && amountField.text.length > 0 && d.toAddressValid @@ -101,7 +103,7 @@ Rectangle { AccountComboBox { id: fromCombo Layout.fillWidth: true - model: fromAccountModel + model: d.isPrivateTab ? root.privateAccountModel : root.publicAccountModel visible: fromFilterCount > 0 onCopyRequested: (text) => root.copyRequested(text) } @@ -138,8 +140,8 @@ Rectangle { AccountComboBox { id: toCombo Layout.fillWidth: true - model: fromAccountModel - visible: d.showOwnedOption && d.useOwnedAccountForTo && fromFilterCount > 0 + model: d.isPublicTab ? root.publicAccountModel : root.privateAccountModel + visible: d.showOwnedOption && d.useOwnedAccountForTo && toFilterCount > 0 onCopyRequested: (text) => root.copyRequested(text) } }