Skip to content

Commit

Permalink
Addressbook: Fix asset selector behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
syl committed Jun 14, 2022
1 parent 1051b1f commit c5ab16c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions atomic_defi_design/Dex/Addressbook/AddAddressForm.qml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Dex.Rectangle
Dex.API.app.portfolio_pg.global_cfg_mdl.all_proxy.match(
Dex.API.app.portfolio_pg.global_cfg_mdl.all_proxy.index(0, 0),
Qt.UserRole + 1, addressType, 1, Qt.MatchExactly)[0]
addressTypeComboBox.currentItem = addressTypeIndex
addressTypeComboBox.currentIndex = addressTypeIndex.row
}
else
{
Expand Down Expand Up @@ -197,7 +197,7 @@ Dex.Rectangle
enableAssetModal.open()
}
else if (isConvertMode)
Dex.API.app.wallet_pg.convert_address(addressValueField.text, addressType, API.app.wallet_pg.validate_address_data.to_address_format);
Dex.API.app.wallet_pg.convert_address(addressValueField.text, addressType, Dex.API.app.wallet_pg.validate_address_data.to_address_format);
else
Dex.API.app.wallet_pg.validate_address(addressValueField.text, addressType)
}
Expand All @@ -216,8 +216,8 @@ Dex.Rectangle
return
}

addressValueField.text = API.app.wallet_pg.converted_address
API.app.wallet_pg.validate_address_data = {}
addressValueField.text = Dex.API.app.wallet_pg.converted_address
Dex.API.app.wallet_pg.validate_address_data = {}
invalidAddressValueLabel.text = ""
}

Expand Down
9 changes: 5 additions & 4 deletions atomic_defi_design/Dex/Addressbook/AddressTypeSelector.qml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Qaterial 1.0 as Qaterial

import Dex.Themes 1.0 as Dex
import Dex.Components 1.0 as Dex
import "../Components" as Dex
import "../Constants" as Dex

Dex.ComboBoxWithSearchBar
Expand All @@ -17,9 +18,10 @@ Dex.ComboBoxWithSearchBar
property var assetStandards: availableNetworkStandards

popupForceMaxHeight: true
popupMaxHeight: 265
popupMaxHeight: 220
model: showAssetStandards ? assetStandards : Dex.API.app.portfolio_pg.global_cfg_mdl.all_proxy
textRole: showAssetStandards ? "" : "ticker"
searchBar.visible: !showAssetStandards

delegate: ItemDelegate
{
Expand Down Expand Up @@ -60,9 +62,8 @@ Dex.ComboBoxWithSearchBar
}
}

onShowAssetStandardsChanged: if (showAssetStandards) {currentIndex = 0; _contentRow.ticker = assetStandards[currentIndex]; _contentRow.name = assetStandards[currentIndex]; _contentRow.type = assetStandards[currentIndex]}
else {currentIndex = 1; _contentRow.ticker = Dex.API.app.portfolio_pg.global_cfg_mdl.all_proxy.data(control.currentItem, Qt.UserRole + 1); _contentRow.name = Dex.API.app.portfolio_pg.global_cfg_mdl.all_proxy.data(control.currentItem, Qt.UserRole + 3); _contentRow.type = Dex.API.app.portfolio_pg.global_cfg_mdl.all_proxy.data(control.currentItem, Qt.UserRole + 9)}
onCurrentIndexChanged: currentItem = Dex.API.app.portfolio_pg.global_cfg_mdl.all_proxy.index(currentIndex, 0)
onCurrentIndexChanged: if (!showAssetStandards && currentIndex === 0) currentIndex = 1
onShowAssetStandardsChanged: if (showAssetStandards) currentIndex = 0; else currentIndex = 1
onSearchBarTextChanged: Dex.API.app.portfolio_pg.global_cfg_mdl.all_proxy.setFilterFixedString(patternStr)
onVisibleChanged: if (!visible) { Dex.API.app.portfolio_pg.global_cfg_mdl.all_proxy.setFilterFixedString(""); searchBar.text = ""; }
Component.onDestruction: Dex.API.app.portfolio_pg.global_cfg_mdl.all_proxy.setFilterFixedString("")
Expand Down

0 comments on commit c5ab16c

Please sign in to comment.