mirror of
https://github.com/logos-blockchain/logos-execution-zone-wallet-ui.git
synced 2026-07-30 06:33:29 +00:00
filter accounts in dropdown From and To depending on transfer type
This commit is contained in:
parent
48fab40a3c
commit
8fa1d2f440
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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 }
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user