fix: Use mixcase address when sharing the address

This commit is contained in:
Alex Jbanca 2025-02-17 15:31:52 +02:00 committed by Alex Jbanca
parent 4856a1ab76
commit e4df7d48eb
6 changed files with 27 additions and 4 deletions

View File

@ -15,6 +15,7 @@ QtObject:
proc setup*(self: Item, proc setup*(self: Item,
name: string, name: string,
address: string, address: string,
mixedcaseAddress: string,
path: string, path: string,
colorId: string, colorId: string,
walletType: string, walletType: string,
@ -33,6 +34,7 @@ QtObject:
self.QObject.setup self.QObject.setup
self.WalletAccountItem.setup(name, self.WalletAccountItem.setup(name,
address, address,
mixedcaseAddress,
colorId, colorId,
emoji, emoji,
walletType, walletType,
@ -55,6 +57,7 @@ QtObject:
proc newItem*( proc newItem*(
name: string = "", name: string = "",
address: string = "", address: string = "",
mixedcaseAddress: string = "",
path: string = "", path: string = "",
colorId: string = "", colorId: string = "",
walletType: string = "", walletType: string = "",
@ -73,6 +76,7 @@ QtObject:
new(result, delete) new(result, delete)
result.setup(name, result.setup(name,
address, address,
mixedcaseAddress,
path, path,
colorId, colorId,
walletType, walletType,

View File

@ -7,6 +7,7 @@ type
ModelRole {.pure.} = enum ModelRole {.pure.} = enum
Name = UserRole + 1, Name = UserRole + 1,
Address, Address,
MixedcaseAddress,
Path, Path,
ColorId, ColorId,
WalletType, WalletType,
@ -58,6 +59,7 @@ QtObject:
{ {
ModelRole.Name.int:"name", ModelRole.Name.int:"name",
ModelRole.Address.int:"address", ModelRole.Address.int:"address",
ModelRole.MixedcaseAddress.int:"mixedcaseAddress",
ModelRole.Path.int:"path", ModelRole.Path.int:"path",
ModelRole.ColorId.int:"colorId", ModelRole.ColorId.int:"colorId",
ModelRole.WalletType.int:"walletType", ModelRole.WalletType.int:"walletType",
@ -160,6 +162,8 @@ QtObject:
result = newQVariant(item.name()) result = newQVariant(item.name())
of ModelRole.Address: of ModelRole.Address:
result = newQVariant(item.address()) result = newQVariant(item.address())
of ModelRole.MixedcaseAddress:
result = newQVariant(item.mixedcaseAddress())
of ModelRole.Path: of ModelRole.Path:
result = newQVariant(item.path()) result = newQVariant(item.path())
of ModelRole.ColorId: of ModelRole.ColorId:

View File

@ -19,6 +19,7 @@ proc walletAccountToWalletAccountItem*(w: WalletAccountDto, keycardAccount: bool
return newWalletAccountItem( return newWalletAccountItem(
w.name, w.name,
w.address, w.address,
w.mixedcaseAddress,
w.colorId, w.colorId,
w.emoji, w.emoji,
w.walletType, w.walletType,
@ -37,6 +38,7 @@ proc walletAccountToWalletAccountsItem*(w: WalletAccountDto, isKeycardAccount: b
return wallet_accounts_item.newItem( return wallet_accounts_item.newItem(
w.name, w.name,
w.address, w.address,
w.mixedcaseAddress,
w.path, w.path,
w.colorId, w.colorId,
w.walletType, w.walletType,

View File

@ -7,6 +7,7 @@ QtObject:
type WalletAccountItem* = ref object of QObject type WalletAccountItem* = ref object of QObject
name: string name: string
address: string address: string
mixedcaseAddress: string
colorId: string colorId: string
emoji: string emoji: string
walletType: string walletType: string
@ -21,6 +22,7 @@ QtObject:
proc setup*(self: WalletAccountItem, proc setup*(self: WalletAccountItem,
name: string = "", name: string = "",
address: string = "", address: string = "",
mixedcaseAddress: string = "",
colorId: string = "", colorId: string = "",
emoji: string = "", emoji: string = "",
walletType: string = "", walletType: string = "",
@ -35,6 +37,7 @@ QtObject:
self.QObject.setup self.QObject.setup
self.name = name self.name = name
self.address = address self.address = address
self.mixedcaseAddress = mixedcaseAddress
self.colorId = colorId self.colorId = colorId
self.emoji = emoji self.emoji = emoji
self.walletType = walletType self.walletType = walletType
@ -52,6 +55,7 @@ QtObject:
proc newWalletAccountItem*( proc newWalletAccountItem*(
name: string = "", name: string = "",
address: string = "", address: string = "",
mixedcaseAddress: string = "",
colorId: string = "", colorId: string = "",
emoji: string = "", emoji: string = "",
walletType: string = "", walletType: string = "",
@ -81,6 +85,7 @@ QtObject:
result = fmt"""WalletAccountItem( result = fmt"""WalletAccountItem(
name: {self.name}, name: {self.name},
address: {self.address}, address: {self.address},
mixedcaseAddress: {self.mixedcaseAddress},
colorId: {self.colorId}, colorId: {self.colorId},
emoji: {self.emoji}, emoji: {self.emoji},
walletType: {self.walletType}, walletType: {self.walletType},
@ -113,6 +118,14 @@ QtObject:
read = address read = address
notify = addressChanged notify = addressChanged
proc mixedcaseAddressChanged*(self: WalletAccountItem) {.signal.}
proc mixedcaseAddress*(self: WalletAccountItem): string {.slot.} =
return self.mixedcaseAddress
QtProperty[string] mixedcaseAddress:
read = mixedcaseAddress
notify = mixedcaseAddressChanged
proc colorIdChanged*(self: WalletAccountItem) {.signal.} proc colorIdChanged*(self: WalletAccountItem) {.signal.}
proc colorId*(self: WalletAccountItem): string {.slot.} = proc colorId*(self: WalletAccountItem): string {.slot.} =
return self.colorId return self.colorId

View File

@ -33,7 +33,7 @@ StatusModal {
property bool switchingAccounsEnabled: true property bool switchingAccounsEnabled: true
property string qrImageSource: root.store.getQrCode(root.selectedAccount.address) property string qrImageSource: root.store.getQrCode(root.selectedAccount.mixedcaseAddress)
property WalletStores.RootStore store: WalletStores.RootStore property WalletStores.RootStore store: WalletStores.RootStore
@ -108,7 +108,7 @@ StatusModal {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
textFormat: TextEdit.RichText textFormat: TextEdit.RichText
wrapMode: Text.WrapAnywhere wrapMode: Text.WrapAnywhere
text: root.selectedAccount.address text: root.selectedAccount.mixedcaseAddress
font.pixelSize: 15 font.pixelSize: 15
color: Theme.palette.directColor1 color: Theme.palette.directColor1
} }
@ -120,7 +120,7 @@ StatusModal {
Layout.preferredWidth: 32 Layout.preferredWidth: 32
Layout.preferredHeight: 32 Layout.preferredHeight: 32
Layout.fillWidth: true Layout.fillWidth: true
textToCopy: root.selectedAccount.address textToCopy: root.selectedAccount.mixedcaseAddress
successCircleVisible: true successCircleVisible: true
} }
} }

View File

@ -69,7 +69,7 @@ Rectangle {
address: { address: {
if (!account) if (!account)
return "" return ""
return account.address return account.mixedcaseAddress
} }
name: account ? account.name : "" name: account ? account.name : ""
walletType: account ? account.walletType : "" walletType: account ? account.walletType : ""