chore(Qt5.15): Fix qml warnings after qt 5.15 migration

Fixing QML Connections warnings due to deprecated onFoo handlers. Now we're using function onFoo(params).
Fixing QML compilation error due to js filename format.
Fixing cyclic dependencies between qml components.
This commit is contained in:
Alex Jbanca 2023-01-18 11:25:36 +02:00 committed by Alexandra Betouni
parent db3b63e29d
commit 81a4d70932
43 changed files with 125 additions and 119 deletions

View File

@ -176,7 +176,7 @@ Item {
// Consider word inserted if input looses focus while a valid word is present ("user" clicks outside) // Consider word inserted if input looses focus while a valid word is present ("user" clicks outside)
Connections { Connections {
target: seedWordInput.input.edit target: seedWordInput.input.edit
onActiveFocusChanged: { function onActiveFocusChanged() {
if (!seedWordInput.input.edit.activeFocus && d.isInputValidWord) { if (!seedWordInput.input.edit.activeFocus && d.isInputValidWord) {
// There are so many side effects regarding focus and doneInsertingWord that we need to reset this flag not to be processed again. // There are so many side effects regarding focus and doneInsertingWord that we need to reset this flag not to be processed again.
d.isInputValidWord = false d.isInputValidWord = false

View File

@ -596,7 +596,7 @@ StatusSectionLayout {
Connections { Connections {
target: _internal.currentWebView target: _internal.currentWebView
onUrlChanged: { function onUrlChanged() {
browserHeader.addressBar.text = Web3ProviderStore.obtainAddress(_internal.currentWebView.url) browserHeader.addressBar.text = Web3ProviderStore.obtainAddress(_internal.currentWebView.url)
RootStore.currentTabConnected = Web3ProviderStore.hasWalletConnected(Utils.getHostname(_internal.currentWebView.url)) RootStore.currentTabConnected = Web3ProviderStore.hasWalletConnected(Utils.getHostname(_internal.currentWebView.url))
} }
@ -604,14 +604,14 @@ StatusSectionLayout {
Connections { Connections {
target: BookmarksStore.bookmarksModel target: BookmarksStore.bookmarksModel
onModelChanged: { function onModelChanged() {
browserHeader.currentFavorite = Qt.binding(function () {return BookmarksStore.getCurrentFavorite(_internal.currentWebView.url)}) browserHeader.currentFavorite = Qt.binding(function () {return BookmarksStore.getCurrentFavorite(_internal.currentWebView.url)})
} }
} }
Connections { Connections {
target: browserSection target: browserSection
onOpenUrl: { function onOpenUrl(url: string) {
root.openUrlInNewTab(url); root.openUrlInNewTab(url);
} }
} }

View File

@ -85,7 +85,7 @@ Rectangle {
} }
Connections { Connections {
target: downloadsMenu target: downloadsMenu
onCancelClicked: { function onCancelClicked() {
isCanceled = true isCanceled = true
} }
} }

View File

@ -61,7 +61,7 @@ import "../controls"
} }
Connections { Connections {
target: downloadsMenu target: downloadsMenu
onCancelClicked: { function onCancelClicked() {
isCanceled = true isCanceled = true
} }
} }

View File

@ -102,7 +102,7 @@ Popup {
Connections { Connections {
target: WalletStore.dappBrowserAccount target: WalletStore.dappBrowserAccount
onConnectedAccountDeleted: { function onConnectedAccountDeleted() {
popup.reload() popup.reload()
// This is done because when an account is deleted and the account is updated to default one, // This is done because when an account is deleted and the account is updated to default one,
// only the properties are updated and we need to listen to those events and update the selected account // only the properties are updated and we need to listen to those events and update the selected account

View File

@ -30,7 +30,7 @@ QtObject {
property Connections conn: Connections { property Connections conn: Connections {
target: Web3ProviderStore.web3ProviderInst target: Web3ProviderStore.web3ProviderInst
onPostMessageResult: { function onPostMessageResult(payloadMethod: string, result: string, chainId: string) {
web3Response(result) web3Response(result)
const isSign = ["eth_sign", "personal_sign", "eth_signTypedData", "eth_signTypedData_v3"].indexOf(payloadMethod) > -1 const isSign = ["eth_sign", "personal_sign", "eth_signTypedData", "eth_signTypedData_v3"].indexOf(payloadMethod) > -1
const isTx = payloadMethod === "eth_sendTransaction" const isTx = payloadMethod === "eth_sendTransaction"

View File

@ -65,11 +65,11 @@ StatusDialog {
enabled: root.opened && root.emojiPopupOpened enabled: root.opened && root.emojiPopupOpened
target: emojiPopup target: emojiPopup
onEmojiSelected: function (emojiText, atCursor) { function onEmojiSelected(emojiText: string, atCursor: bool) {
nameInput.input.asset.isLetterIdenticon = false; nameInput.input.asset.isLetterIdenticon = false;
nameInput.input.asset.emoji = emojiText nameInput.input.asset.emoji = emojiText
} }
onClosed: { function onClosed() {
root.emojiPopupOpened = false root.emojiPopupOpened = false
} }
} }

View File

@ -124,7 +124,7 @@ Item {
Connections { Connections {
target: root.store.communitiesModuleInst target: root.store.communitiesModuleInst
onCommunityAccessRequested: function (communityId) { function onCommunityAccessRequested(communityId: string) {
if (communityId === communityData.id) { if (communityId === communityData.id) {
joinCommunityButton.invitationPending = root.store.isCommunityRequestPending(communityData.id) joinCommunityButton.invitationPending = root.store.isCommunityRequestPending(communityData.id)
} }
@ -608,7 +608,7 @@ Item {
Connections { Connections {
target: root.store.mainModuleInst target: root.store.mainModuleInst
onOpenCommunityMembershipRequestsPopup:{ function onOpenCommunityMembershipRequestsPopup(sectionId: string) {
if(root.store.getMySectionId() != sectionId) if(root.store.getMySectionId() != sectionId)
return return

View File

@ -88,7 +88,7 @@ MembersSelectorBase {
Connections { Connections {
enabled: root.visible enabled: root.visible
target: root.rootStore.contactsStore.mainModuleInst target: root.rootStore.contactsStore.mainModuleInst
onResolvedENS: { function onResolvedENS(resolvedPubKey: string, resolvedAddress: string, uuid: string) {
if (resolvedPubKey === "") { if (resolvedPubKey === "") {
root.suggestionsDialog.forceHide = false root.suggestionsDialog.forceHide = false
return return

View File

@ -138,7 +138,7 @@ OnboardingBasePage {
Connections { Connections {
target: root.startupStore.startupModuleInst target: root.startupStore.startupModuleInst
onStartupError: { function onStartupError(error: string, errType: int) {
msgDialog.errType = errType msgDialog.errType = errType
if (errType === Constants.startupErrorType.setupAccError) { if (errType === Constants.startupErrorType.setupAccError) {
if (error === Constants.existingAccountError) { if (error === Constants.existingAccountError) {
@ -172,10 +172,10 @@ following the \"Add existing Status user\" flow, using your seed phrase.")
msgDialog.open() msgDialog.open()
} }
onDisplayKeycardSharedModuleFlow: { function onDisplayKeycardSharedModuleFlow() {
keycardPopup.active = true keycardPopup.active = true
} }
onDestroyKeycardSharedModuleFlow: { function onDestroyKeycardSharedModuleFlow() {
keycardPopup.active = false keycardPopup.active = false
} }
} }

View File

@ -142,7 +142,7 @@ Item {
Connections { Connections {
target: RootStore.privacyModule target: RootStore.privacyModule
onPasswordChanged: { function onPasswordChanged(success: bool, errorMsg: string) {
if (success) { if (success) {
submitBtn.loading = false submitBtn.loading = false
root.exit(); root.exit();

View File

@ -105,7 +105,7 @@ Item {
Connections{ Connections{
target: root.startupStore.startupModuleInst target: root.startupStore.startupModuleInst
onObtainingPasswordError: { function onObtainingPasswordError(errorDescription: string, errorType: string) {
if (errorType === Constants.keychain.errorType.authentication) { if (errorType === Constants.keychain.errorType.authentication) {
// We are notifying user only about keychain errors. // We are notifying user only about keychain errors.
return return
@ -120,7 +120,7 @@ Item {
obtainingPasswordErrorNotification.open() obtainingPasswordErrorNotification.open()
} }
onObtainingPasswordSuccess: { function onObtainingPasswordSuccess(password: string) {
if(localAccountSettings.storeToKeychainValue !== Constants.keychain.storedValue.store) if(localAccountSettings.storeToKeychainValue !== Constants.keychain.storedValue.store)
return return
@ -132,7 +132,7 @@ Item {
} }
} }
onAccountLoginError: { function onAccountLoginError(error: string) {
if (error) { if (error) {
if (!root.startupStore.selectedLoginAccount.keycardCreatedAccount) { if (!root.startupStore.selectedLoginAccount.keycardCreatedAccount) {
// SQLITE_NOTADB: "file is not a database" // SQLITE_NOTADB: "file is not a database"

View File

@ -5,6 +5,7 @@ import QtQuick.Layouts 1.13
import utils 1.0 import utils 1.0
import shared 1.0 import shared 1.0
import shared.panels 1.0 import shared.panels 1.0
import shared.stores 1.0 as SharedStores
import "stores" import "stores"
import "popups" import "popups"
@ -193,7 +194,7 @@ StatusSectionLayout {
implicitHeight: parent.height implicitHeight: parent.height
languageStore: root.store.languageStore languageStore: root.store.languageStore
currencyStore: root.store.walletStore.currencyStore currencyStore: SharedStores.RootStore.currencyStore
sectionTitle: root.store.getNameForSubsection(Constants.settingsSubsection.language) sectionTitle: root.store.getNameForSubsection(Constants.settingsSubsection.language)
contentWidth: d.contentWidth contentWidth: d.contentWidth
} }

View File

@ -55,7 +55,9 @@ StatusModal {
Connections { Connections {
target: root.privacyStore.privacyModule target: root.privacyStore.privacyModule
onPasswordChanged: onChangePasswordResponse(success, errorMsg) function onPasswordChanged(success: bool, errorMsg: string) {
onChangePasswordResponse(success, errorMsg)
}
} }
width: 480 width: 480

View File

@ -34,7 +34,7 @@ StatusModal {
Connections { Connections {
enabled: popup.opened enabled: popup.opened
target: emojiPopup target: emojiPopup
onEmojiSelected: function (emojiText, atCursor) { function onEmojiSelected(emojiText: string, atCursor: bool) {
popup.contentItem.accountNameInput.input.asset.emoji = emojiText popup.contentItem.accountNameInput.input.asset.emoji = emojiText
} }
} }

View File

@ -65,7 +65,7 @@ StatusModal {
Connections { Connections {
target: contactsStore.mainModuleInst target: contactsStore.mainModuleInst
onResolvedENS: { function onResolvedENS(resolvedPubKey: string, resolvedAddress: string, uuid: string) {
if(!d.showChatKeyValidationIndicator){ if(!d.showChatKeyValidationIndicator){
d.showPasteButton = false d.showPasteButton = false
d.showChatKeyValidationIndicator = true d.showChatKeyValidationIndicator = true

View File

@ -1,6 +1,5 @@
import QtQuick 2.13 import QtQuick 2.13
import shared.stores 1.0 as SharedStore
import "../../Wallet/stores" import "../../Wallet/stores"
QtObject { QtObject {
@ -22,8 +21,6 @@ QtObject {
property var generatedAccounts: walletSectionAccounts.generated property var generatedAccounts: walletSectionAccounts.generated
property var watchOnlyAccounts: walletSectionAccounts.watchOnly property var watchOnlyAccounts: walletSectionAccounts.watchOnly
property var currencyStore: SharedStore.RootStore.currencyStore
property var currentAccount: walletSectionCurrent property var currentAccount: walletSectionCurrent
function switchAccountByAddress(address) { function switchAccountByAddress(address) {

View File

@ -57,7 +57,7 @@ Item {
Connections { Connections {
target: root.ensUsernamesStore.ensUsernamesModule target: root.ensUsernamesStore.ensUsernamesModule
onDetailsObtained: { function onDetailsObtained(ensName: string, address: string, pubkey: string, isStatus: bool, expirationTime: int) {
if(username != (isStatus ? ensName + ".stateofus.eth" : ensName)) if(username != (isStatus ? ensName + ".stateofus.eth" : ensName))
return; return;
walletAddressLbl.subTitle = address; walletAddressLbl.subTitle = address;
@ -71,7 +71,7 @@ Item {
&& root.ensUsernamesStore.preferredUsername !== username && root.ensUsernamesStore.preferredUsername !== username
d.expirationTimestamp = expirationTime * 1000 d.expirationTimestamp = expirationTime * 1000
} }
onLoading: { function onLoading(isLoading: bool) {
loadingImg.active = isLoading loadingImg.active = isLoading
if (!isLoading) if (!isLoading)
return; return;
@ -152,7 +152,7 @@ Item {
} }
Connections { Connections {
target: root.ensUsernamesStore.ensUsernamesModule target: root.ensUsernamesStore.ensUsernamesModule
onTransactionWasSent: { function onTransactionWasSent(txResult: string) {
try { try {
let response = JSON.parse(txResult) let response = JSON.parse(txResult)
if (!response.success) { if (!response.success) {

View File

@ -43,7 +43,7 @@ Item {
Connections { Connections {
target: root.ensUsernamesStore.ensUsernamesModule target: root.ensUsernamesStore.ensUsernamesModule
onUsernameConfirmed: { function onUsernameConfirmed(username: string) {
d.updateNumberOfPendingEnsUsernames() d.updateNumberOfPendingEnsUsernames()
chatSettingsLabel.visible = true chatSettingsLabel.visible = true
} }

View File

@ -98,7 +98,7 @@ Item {
} }
Connections { Connections {
target: root.ensUsernamesStore.ensUsernamesModule target: root.ensUsernamesStore.ensUsernamesModule
onTransactionWasSent: { function onTransactionWasSent(txResult: string) {
try { try {
let response = JSON.parse(txResult) let response = JSON.parse(txResult)
if (!response.success) { if (!response.success) {
@ -189,7 +189,7 @@ Item {
Connections { Connections {
target: root.ensUsernamesStore.ensUsernamesModule target: root.ensUsernamesStore.ensUsernamesModule
onUsernameAvailabilityChecked: { function onUsernameAvailabilityChecked(availabilityStatus: string) {
if(!validate(ensUsername.text)) return; if(!validate(ensUsername.text)) return;
valid = false; valid = false;
loading = false; loading = false;

View File

@ -85,7 +85,7 @@ Item {
} }
Connections { Connections {
target: root.ensUsernamesStore.ensUsernamesModule target: root.ensUsernamesStore.ensUsernamesModule
onTransactionWasSent: { function onTransactionWasSent(txResult: string) {
try { try {
let response = JSON.parse(txResult) let response = JSON.parse(txResult)
if (!response.success) { if (!response.success) {

View File

@ -315,14 +315,14 @@ Item {
Connections { Connections {
target: ensView target: ensView
onConnect: { function onConnect(ensUsername: string) {
addedUsername = ensUsername; addedUsername = ensUsername;
} }
} }
Connections { Connections {
target: ensView.ensUsernamesStore.ensUsernamesModule target: ensView.ensUsernamesStore.ensUsernamesModule
onTransactionCompleted: { function onTransactionCompleted(success: bool, txHash: string, username: string, trxType: string, revertReason: string) {
let title = "" let title = ""
switch(trxType){ switch(trxType){
case "RegisterENS": case "RegisterENS":

View File

@ -89,10 +89,10 @@ SettingsContentBase {
Connections { Connections {
target: root.keycardStore.keycardModule target: root.keycardStore.keycardModule
onDisplayKeycardSharedModuleFlow: { function onDisplayKeycardSharedModuleFlow() {
keycardPopup.active = true keycardPopup.active = true
} }
onDestroyKeycardSharedModuleFlow: { function onDestroyKeycardSharedModuleFlow() {
keycardPopup.active = false keycardPopup.active = false
} }
onSharedModuleBusy: { onSharedModuleBusy: {

View File

@ -238,7 +238,9 @@ SettingsContentBase {
Connections { Connections {
target: localAccountSensitiveSettings target: localAccountSensitiveSettings
onWhitelistedUnfurlingSitesChanged: generalColumn.populatePreviewableSites() function onWhitelistedUnfurlingSitesChanged() {
generalColumn.populatePreviewableSites()
}
} }
// Manually add switch for the image unfurling // Manually add switch for the image unfurling

View File

@ -15,7 +15,7 @@ import "../stores"
Item { Item {
id: derivedAddresses id: derivedAddresses
property int selectedAccountType: RootStore.defaultSelectedType property int selectedAccountType: Constants.AddAccountType.GenerateNew
property string selectedKeyUid: RootStore.defaultSelectedKeyUid property string selectedKeyUid: RootStore.defaultSelectedKeyUid
property bool selectedKeyUidMigratedToKeycard: RootStore.defaultSelectedKeyUidMigratedToKeycard property bool selectedKeyUidMigratedToKeycard: RootStore.defaultSelectedKeyUidMigratedToKeycard
property string selectedPath: "" property string selectedPath: ""
@ -52,8 +52,8 @@ Item {
id: _internal id: _internal
readonly property bool showEnterPinPassButton: !RootStore.loggedInUserAuthenticated && readonly property bool showEnterPinPassButton: !RootStore.loggedInUserAuthenticated &&
derivedAddresses.selectedAccountType !== SelectGeneratedAccount.AddAccountType.ImportSeedPhrase && derivedAddresses.selectedAccountType !== Constants.AddAccountType.ImportSeedPhrase &&
derivedAddresses.selectedAccountType !== SelectGeneratedAccount.AddAccountType.ImportPrivateKey derivedAddresses.selectedAccountType !== Constants.AddAccountType.ImportPrivateKey
property int pageSize: 6 property int pageSize: 6
property int noOfPages: Math.ceil(RootStore.derivedAddressesList.count/pageSize) property int noOfPages: Math.ceil(RootStore.derivedAddressesList.count/pageSize)
property int lastPageSize: RootStore.derivedAddressesList.count - ((noOfPages -1) * pageSize) property int lastPageSize: RootStore.derivedAddressesList.count - ((noOfPages -1) * pageSize)
@ -85,7 +85,7 @@ Item {
Connections { Connections {
target: RootStore.derivedAddressesList target: RootStore.derivedAddressesList
onModelReset: { function onModelReset() {
_internal.pageSize = 0 _internal.pageSize = 0
_internal.pageSize = 6 _internal.pageSize = 6
_internal.nextSelectableAddressIndex = -1 _internal.nextSelectableAddressIndex = -1

View File

@ -17,24 +17,16 @@ StatusSelect {
property string selectedKeyUid: userProfile.keyUid property string selectedKeyUid: userProfile.keyUid
property bool selectedKeyUidMigratedToKeycard: userProfile.isKeycardUser property bool selectedKeyUidMigratedToKeycard: userProfile.isKeycardUser
enum AddAccountType {
GenerateNew,
ImportSeedPhrase,
ImportPrivateKey,
WatchOnly
}
function resetMe() { function resetMe() {
_internal.getGeneratedAccountsModel() _internal.getGeneratedAccountsModel()
selectAccountType.addAccountType = SelectGeneratedAccount.AddAccountType.GenerateNew selectAccountType.addAccountType = Constants.AddAccountType.GenerateNew
selectAccountType.selectedKeyUid = userProfile.keyUid selectAccountType.selectedKeyUid = userProfile.keyUid
selectAccountType.selectedKeyUidMigratedToKeycard = userProfile.isKeycardUser selectAccountType.selectedKeyUidMigratedToKeycard = userProfile.isKeycardUser
} }
Connections { Connections {
target: RootStore.generatedAccountsViewModel target: RootStore.generatedAccountsViewModel
onModelReset: { function onModelReset() {
_internal.delegateModel.model = RootStore.generatedAccountsViewModel _internal.delegateModel.model = RootStore.generatedAccountsViewModel
_internal.getGeneratedAccountsModel() _internal.getGeneratedAccountsModel()
} }
@ -116,10 +108,10 @@ StatusSelect {
titleText.color: Theme.palette.indirectColor1 titleText.color: Theme.palette.indirectColor1
} }
onClicked: { onClicked: {
selectAccountType.addAccountType = (model.name === _internal.importSeedPhraseString) ? SelectGeneratedAccount.AddAccountType.ImportSeedPhrase : selectAccountType.addAccountType = (model.name === _internal.importSeedPhraseString) ? Constants.AddAccountType.ImportSeedPhrase :
(model.name === _internal.importPrivateKeyString) ? SelectGeneratedAccount.AddAccountType.ImportPrivateKey : (model.name === _internal.importPrivateKeyString) ? Constants.AddAccountType.ImportPrivateKey :
(model.name === _internal.addWatchOnlyAccountString) ? SelectGeneratedAccount.AddAccountType.WatchOnly : (model.name === _internal.addWatchOnlyAccountString) ? Constants.AddAccountType.WatchOnly :
SelectGeneratedAccount.AddAccountType.GenerateNew Constants.AddAccountType.GenerateNew
selectedItem.title = model.name selectedItem.title = model.name
selectedItem.asset.name = model.iconName selectedItem.asset.name = model.iconName
selectedItem.tagsModel = model.generatedModel selectedItem.tagsModel = model.generatedModel

View File

@ -42,11 +42,11 @@ StatusModal {
Connections { Connections {
target: walletSectionAccounts target: walletSectionAccounts
onUserAuthenticationSuccess: { function onUserAuthenticationSuccess(password: string) {
validationError.text = "" validationError.text = ""
d.password = password d.password = password
RootStore.loggedInUserAuthenticated = true RootStore.loggedInUserAuthenticated = true
if (d.selectedAccountType === SelectGeneratedAccount.AddAccountType.ImportPrivateKey) { if (d.selectedAccountType === Constants.AddAccountType.ImportPrivateKey) {
d.generateNewAccount() d.generateNewAccount()
} }
else { else {
@ -55,7 +55,7 @@ StatusModal {
} }
} }
} }
onUserAuthentiactionFail: { function onUserAuthentiactionFail() {
d.password = "" d.password = ""
RootStore.loggedInUserAuthenticated = false RootStore.loggedInUserAuthenticated = false
validationError.text = qsTr("An authentication failed") validationError.text = qsTr("An authentication failed")
@ -70,7 +70,7 @@ StatusModal {
readonly property int pageNumber: 1 readonly property int pageNumber: 1
property string password: "" property string password: ""
property int selectedAccountType: RootStore.defaultSelectedType property int selectedAccountType: Constants.AddAccountType.GenerateNew
property string selectedAccountDerivedFromAddress: "" property string selectedAccountDerivedFromAddress: ""
property string selectedKeyUid: RootStore.defaultSelectedKeyUid property string selectedKeyUid: RootStore.defaultSelectedKeyUid
property bool selectedKeyUidMigratedToKeycard: RootStore.defaultSelectedKeyUidMigratedToKeycard property bool selectedKeyUidMigratedToKeycard: RootStore.defaultSelectedKeyUidMigratedToKeycard
@ -78,7 +78,7 @@ StatusModal {
property string selectedAddress: "" property string selectedAddress: ""
property bool selectedAddressAvailable: true property bool selectedAddressAvailable: true
readonly property bool authenticationNeeded: d.selectedAccountType !== SelectGeneratedAccount.AddAccountType.WatchOnly && readonly property bool authenticationNeeded: d.selectedAccountType !== Constants.AddAccountType.WatchOnly &&
d.password === "" d.password === ""
property string addAccountIcon: "" property string addAccountIcon: ""
@ -90,7 +90,7 @@ StatusModal {
} }
function getDerivedAddressList() { function getDerivedAddressList() {
if(d.selectedAccountType === SelectGeneratedAccount.AddAccountType.ImportSeedPhrase if(d.selectedAccountType === Constants.AddAccountType.ImportSeedPhrase
&& !!advancedSelection.expandableItem.path && !!advancedSelection.expandableItem.path
&& !!advancedSelection.expandableItem.mnemonicText) { && !!advancedSelection.expandableItem.mnemonicText) {
RootStore.getDerivedAddressListForMnemonic(advancedSelection.expandableItem.mnemonicText, RootStore.getDerivedAddressListForMnemonic(advancedSelection.expandableItem.mnemonicText,
@ -113,7 +113,7 @@ StatusModal {
let errMessage = "" let errMessage = ""
switch(d.selectedAccountType) { switch(d.selectedAccountType) {
case SelectGeneratedAccount.AddAccountType.GenerateNew: case Constants.AddAccountType.GenerateNew:
if (d.selectedKeyUidMigratedToKeycard) { if (d.selectedKeyUidMigratedToKeycard) {
errMessage = RootStore.addNewWalletAccountGeneratedFromKeycard(Constants.generatedWalletType, errMessage = RootStore.addNewWalletAccountGeneratedFromKeycard(Constants.generatedWalletType,
accountNameInput.text, accountNameInput.text,
@ -126,16 +126,16 @@ StatusModal {
advancedSelection.expandableItem.derivedFromAddress) advancedSelection.expandableItem.derivedFromAddress)
} }
break break
case SelectGeneratedAccount.AddAccountType.ImportSeedPhrase: case Constants.AddAccountType.ImportSeedPhrase:
errMessage = RootStore.addAccountsFromSeed(advancedSelection.expandableItem.mnemonicText, d.password, errMessage = RootStore.addAccountsFromSeed(advancedSelection.expandableItem.mnemonicText, d.password,
accountNameInput.text, colorSelectionGrid.selectedColor, accountNameInput.input.asset.emoji, accountNameInput.text, colorSelectionGrid.selectedColor, accountNameInput.input.asset.emoji,
advancedSelection.expandableItem.completePath) advancedSelection.expandableItem.completePath)
break break
case SelectGeneratedAccount.AddAccountType.ImportPrivateKey: case Constants.AddAccountType.ImportPrivateKey:
errMessage = RootStore.addAccountsFromPrivateKey(advancedSelection.expandableItem.privateKey, d.password, errMessage = RootStore.addAccountsFromPrivateKey(advancedSelection.expandableItem.privateKey, d.password,
accountNameInput.text, colorSelectionGrid.selectedColor, accountNameInput.input.asset.emoji) accountNameInput.text, colorSelectionGrid.selectedColor, accountNameInput.input.asset.emoji)
break break
case SelectGeneratedAccount.AddAccountType.WatchOnly: case Constants.AddAccountType.WatchOnly:
errMessage = RootStore.addWatchOnlyAccount(advancedSelection.expandableItem.watchAddress, accountNameInput.text, errMessage = RootStore.addWatchOnlyAccount(advancedSelection.expandableItem.watchAddress, accountNameInput.text,
colorSelectionGrid.selectedColor, accountNameInput.input.asset.emoji) colorSelectionGrid.selectedColor, accountNameInput.input.asset.emoji)
break break
@ -156,7 +156,7 @@ StatusModal {
if (d.authenticationNeeded) { if (d.authenticationNeeded) {
d.password = "" d.password = ""
if (d.selectedKeyUidMigratedToKeycard && if (d.selectedKeyUidMigratedToKeycard &&
d.selectedAccountType === SelectGeneratedAccount.AddAccountType.GenerateNew) { d.selectedAccountType === Constants.AddAccountType.GenerateNew) {
RootStore.authenticateUserAndDeriveAddressOnKeycardForPath(d.selectedKeyUid, d.selectedPath) RootStore.authenticateUserAndDeriveAddressOnKeycardForPath(d.selectedKeyUid, d.selectedPath)
} }
else { else {

View File

@ -3,14 +3,11 @@ pragma Singleton
import QtQuick 2.13 import QtQuick 2.13
import utils 1.0 import utils 1.0
import shared.stores 1.0 as SharedStore
import "../panels" import "../panels"
QtObject { QtObject {
id: root id: root
readonly property int defaultSelectedType: SelectGeneratedAccount.AddAccountType.GenerateNew
readonly property string defaultSelectedKeyUid: userProfile.keyUid readonly property string defaultSelectedKeyUid: userProfile.keyUid
readonly property bool defaultSelectedKeyUidMigratedToKeycard: userProfile.isKeycardUser readonly property bool defaultSelectedKeyUidMigratedToKeycard: userProfile.isKeycardUser
@ -24,8 +21,6 @@ QtObject {
property var accountSensitiveSettings: localAccountSensitiveSettings property var accountSensitiveSettings: localAccountSensitiveSettings
property bool hideSignPhraseModal: accountSensitiveSettings.hideSignPhraseModal property bool hideSignPhraseModal: accountSensitiveSettings.hideSignPhraseModal
property var currencyStore: SharedStore.RootStore.currencyStore
property string currentCurrency: currencyStore.currentCurrency
property var totalCurrencyBalance: walletSection.totalCurrencyBalance property var totalCurrencyBalance: walletSection.totalCurrencyBalance
property bool tokensLoading: walletSection.tokensLoading property bool tokensLoading: walletSection.tokensLoading
property string signingPhrase: walletSection.signingPhrase property string signingPhrase: walletSection.signingPhrase

View File

@ -36,7 +36,7 @@ Item {
Connections { Connections {
target: walletSectionAllTokens target: walletSectionAllTokens
onTokenHistoricalDataReady: { function onTokenHistoricalDataReady(tokenDetails: string) {
let response = JSON.parse(tokenDetails) let response = JSON.parse(tokenDetails)
if (response === null) { if (response === null) {
console.debug("error parsing json message for tokenHistoricalDataReady") console.debug("error parsing json message for tokenHistoricalDataReady")

View File

@ -58,29 +58,31 @@ Item {
Connections { Connections {
target: rootStore.mainModuleInst target: rootStore.mainModuleInst
onDisplayUserProfile: Global.openProfilePopup(publicKey) function onDisplayUserProfile(publicKey: string) {
Global.openProfilePopup(publicKey)
}
onDisplayKeycardSharedModuleFlow: { function onDisplayKeycardSharedModuleFlow() {
keycardPopup.active = true keycardPopup.active = true
} }
onDestroyKeycardSharedModuleFlow: { function onDestroyKeycardSharedModuleFlow() {
keycardPopup.active = false keycardPopup.active = false
} }
onMailserverWorking: { function onMailserverWorking() {
mailserverConnectionBanner.hide() mailserverConnectionBanner.hide()
} }
onMailserverNotWorking: { function onMailserverNotWorking() {
mailserverConnectionBanner.show() mailserverConnectionBanner.show()
} }
onActiveSectionChanged: { function onActiveSectionChanged() {
createChatView.opened = false createChatView.opened = false
} }
onOpenActivityCenter: { function onOpenActivityCenter() {
Global.openPopup(activityCenterPopupComponent) Global.openPopup(activityCenterPopupComponent)
} }
} }
@ -99,14 +101,14 @@ Item {
Connections { Connections {
target: Global target: Global
onOpenLinkInBrowser: { function onOpenLinkInBrowser(link: string) {
changeAppSectionBySectionId(Constants.appSection.browser) changeAppSectionBySectionId(Constants.appSection.browser)
Qt.callLater(() => browserLayoutContainer.item.openUrlInNewTab(link)); Qt.callLater(() => browserLayoutContainer.item.openUrlInNewTab(link));
} }
onOpenChooseBrowserPopup: { function onOpenChooseBrowserPopup(link: string) {
Global.openPopup(chooseBrowserPopupComponent, {link: link}); Global.openPopup(chooseBrowserPopupComponent, {link: link});
} }
onOpenDownloadModalRequested: { function onOpenDownloadModalRequested(available: bool, version: string, url: string) {
const downloadPage = downloadPageComponent.createObject(appMain, const downloadPage = downloadPageComponent.createObject(appMain,
{ {
newVersionAvailable: available, newVersionAvailable: available,
@ -117,52 +119,57 @@ Item {
return downloadPage return downloadPage
} }
onOpenImagePopup: { function onOpenImagePopup(image, contextMenu) {
var popup = imagePopupComponent.createObject(appMain) var popup = imagePopupComponent.createObject(appMain)
popup.contextMenu = contextMenu popup.contextMenu = contextMenu
popup.openPopup(image) popup.openPopup(image)
} }
onOpenCreateChatView: { function onOpenCreateChatView() {
createChatView.opened = true createChatView.opened = true
} }
onCloseCreateChatView: { function onCloseCreateChatView() {
createChatView.opened = false createChatView.opened = false
} }
onOpenProfilePopupRequested: { function onOpenProfilePopupRequested(publicKey: string, parentPopup) {
if (Global.profilePopupOpened) { if (Global.profilePopupOpened) {
appMain.closeProfilePopup() appMain.closeProfilePopup()
} }
Global.openPopup(profilePopupComponent, {publicKey: publicKey, parentPopup: parentPopup}) Global.openPopup(profilePopupComponent, {publicKey: publicKey, parentPopup: parentPopup})
Global.profilePopupOpened = true Global.profilePopupOpened = true
} }
onOpenNicknamePopupRequested: { function onOpenNicknamePopupRequested(publicKey: string,nickname: string, subtitle: string) {
Global.openPopup(nicknamePopupComponent, {publicKey: publicKey, nickname: nickname, "header.subTitle": subtitle}) Global.openPopup(nicknamePopupComponent, {publicKey: publicKey, nickname: nickname, "header.subTitle": subtitle})
} }
onBlockContactRequested: { function onBlockContactRequested(publicKey: string, contactName: string) {
Global.openPopup(blockContactConfirmationComponent, {contactName: contactName, contactAddress: publicKey}) Global.openPopup(blockContactConfirmationComponent, {contactName: contactName, contactAddress: publicKey})
} }
onUnblockContactRequested: { function onUnblockContactRequested(publicKey: string, contactName: string) {
Global.openPopup(unblockContactConfirmationComponent, {contactName: contactName, contactAddress: publicKey}) Global.openPopup(unblockContactConfirmationComponent, {contactName: contactName, contactAddress: publicKey})
} }
onOpenActivityCenterPopupRequested: { function onOpenActivityCenterPopupRequested(publicKey: string, contactName: string) {
Global.openPopup(activityCenterPopupComponent) Global.openPopup(activityCenterPopupComponent)
} }
onOpenChangeProfilePicPopup: { function onOpenChangeProfilePicPopup(cb) {
var popup = changeProfilePicComponent.createObject(appMain, {callback: cb}); var popup = changeProfilePicComponent.createObject(appMain, {callback: cb});
popup.chooseImageToCrop(); popup.chooseImageToCrop();
} }
onOpenBackUpSeedPopup: Global.openPopup(backupSeedModalComponent) function onOpenBackUpSeedPopup() {
onDisplayToastMessage: { Global.openPopup(backupSeedModalComponent)
}
function onDisplayToastMessage(title: string, subTitle: string, icon: string, loading: bool, ephNotifType: int, url: string) {
appMain.rootStore.mainModuleInst.displayEphemeralNotification(title, subTitle, icon, loading, ephNotifType, url); appMain.rootStore.mainModuleInst.displayEphemeralNotification(title, subTitle, icon, loading, ephNotifType, url);
} }
onOpenEditDisplayNamePopup: Global.openPopup(displayNamePopupComponent) function onOpenEditDisplayNamePopup() {
Global.openPopup(displayNamePopupComponent)
}
function onOpenPopupRequested(popupComponent, params) {
onOpenPopupRequested: {
if (activePopupComponents.includes(popupComponent)) { if (activePopupComponents.includes(popupComponent)) {
return; return;
} }
@ -181,7 +188,7 @@ Item {
return popup; return popup;
} }
onOpenLink: { function onOpenLink(link: string) {
// Qt sometimes inserts random HTML tags; and this will break on invalid URL inside QDesktopServices::openUrl(link) // Qt sometimes inserts random HTML tags; and this will break on invalid URL inside QDesktopServices::openUrl(link)
link = appMain.rootStore.plainText(link); link = appMain.rootStore.plainText(link);
if (appMain.rootStore.showBrowserSelector) { if (appMain.rootStore.showBrowserSelector) {
@ -196,13 +203,13 @@ Item {
} }
} }
onSetNthEnabledSectionActive: { function onSetNthEnabledSectionActive(nthSection: int) {
if(!appMain.rootStore.mainModuleInst) if(!appMain.rootStore.mainModuleInst)
return return
appMain.rootStore.mainModuleInst.setNthEnabledSectionActive(nthSection) appMain.rootStore.mainModuleInst.setNthEnabledSectionActive(nthSection)
} }
onAppSectionBySectionTypeChanged: { function onAppSectionBySectionTypeChanged(sectionType: int, subsection: int) {
if(!appMain.rootStore.mainModuleInst) if(!appMain.rootStore.mainModuleInst)
return return
@ -598,7 +605,7 @@ Item {
Connections { Connections {
target: rootStore.aboutModuleInst target: rootStore.aboutModuleInst
onAppVersionFetched: { function onAppVersionFetched(available: bool, version: string, url: string) {
rootStore.setLatestVersionInfo(available, version, url); rootStore.setLatestVersionInfo(available, version, url);
bannersLayout.processUpdateAvailable() bannersLayout.processUpdateAvailable()
} }

View File

@ -28,7 +28,7 @@ Item {
Connections { Connections {
target: appSearch.store.locationMenuModel target: appSearch.store.locationMenuModel
onModelAboutToBeReset: { function onModelAboutToBeReset() {
while (searchPopupMenu.takeItem(searchPopupMenu.numDefaultItems)) { while (searchPopupMenu.takeItem(searchPopupMenu.numDefaultItems)) {
// Delete the item right after the default items // Delete the item right after the default items
// If takeItem returns null, it means there was nothing to remove // If takeItem returns null, it means there was nothing to remove
@ -38,7 +38,9 @@ Item {
Connections { Connections {
target: appSearch.store.appSearchModule target: appSearch.store.appSearchModule
onAppSearchCompleted: searchPopup.loading = false function onAppSearchCompleted() {
searchPopup.loading = false
}
} }
StatusSearchLocationMenu { StatusSearchLocationMenu {

View File

@ -1,3 +1,4 @@
.pragma library
// polyfill.number.toLocaleDateString // polyfill.number.toLocaleDateString
// Copied from: https://github.com/willsp/polyfill-Number.toLocaleString-with-Locales // Copied from: https://github.com/willsp/polyfill-Number.toLocaleString-with-Locales
// Got this from MDN: // Got this from MDN:

View File

@ -115,7 +115,7 @@ Item {
Connections { Connections {
target: mainModule target: mainModule
onResolvedENS: { function onResolvedENS(resolvedPubKey: string, resolvedAddress: string, uuid: string) {
chatKey.hasValidSearchResult = false chatKey.hasValidSearchResult = false
if (chatKey.text == "") { if (chatKey.text == "") {
ensUsername.text = ""; ensUsername.text = "";

View File

@ -48,7 +48,7 @@ StatusDialog {
Connections { Connections {
target: store.currentAccount.assets target: store.currentAccount.assets
onModelReset: { function onModelReset() {
popup.selectedAccount = null popup.selectedAccount = null
popup.selectedAccount = store.currentAccount popup.selectedAccount = store.currentAccount
} }
@ -393,7 +393,7 @@ StatusDialog {
Connections { Connections {
target: store.mainModuleInst target: store.mainModuleInst
onResolvedENS: { function onResolvedENS(resolvedPubKey: string, resolvedAddress: string, uuid: string) {
recipientSelector.isPending = false recipientSelector.isPending = false
if(Utils.isValidAddress(resolvedAddress)) { if(Utils.isValidAddress(resolvedAddress)) {
d.resolvedENSAddress = resolvedAddress d.resolvedENSAddress = resolvedAddress
@ -474,7 +474,7 @@ StatusDialog {
Connections { Connections {
target: popup.store.walletSectionTransactionsInst target: popup.store.walletSectionTransactionsInst
onSuggestedRoutesReady: { function onSuggestedRoutesReady(suggestedRoutes: string) {
let response = JSON.parse(suggestedRoutes) let response = JSON.parse(suggestedRoutes)
if(!!response.error) { if(!!response.error) {
popup.isLoading = false popup.isLoading = false
@ -495,7 +495,7 @@ StatusDialog {
Connections { Connections {
target: popup.store.walletSectionTransactionsInst target: popup.store.walletSectionTransactionsInst
onTransactionSent: { function onTransactionSent(txResult: string) {
d.isPendingTx = false d.isPendingTx = false
try { try {
let response = JSON.parse(txResult) let response = JSON.parse(txResult)

View File

@ -3,4 +3,4 @@ module shared
DelegateModelGeneralized 1.0 DelegateModelGeneralized.qml DelegateModelGeneralized 1.0 DelegateModelGeneralized.qml
LoadingAnimation 1.0 LoadingAnimation.qml LoadingAnimation 1.0 LoadingAnimation.qml
MacTrafficLights 1.0 MacTrafficLights.qml MacTrafficLights 1.0 MacTrafficLights.qml
NumberPolyFill 1.0 polyfill.number.toLocaleString.js NumberPolyFill 1.0 PolyfillNumberToLocaleString.js

View File

@ -293,7 +293,7 @@ Rectangle {
enabled: control.emojiPopupOpened enabled: control.emojiPopupOpened
target: emojiPopup target: emojiPopup
function onEmojiSelected(text, atCursor) { function onEmojiSelected(text: string, atCursor: bool) {
insertInTextInput(atCursor ? messageInputField.cursorPosition : messageInputField.length, text) insertInTextInput(atCursor ? messageInputField.cursorPosition : messageInputField.length, text)
emojiBtn.highlighted = false emojiBtn.highlighted = false
messageInputField.forceActiveFocus(); messageInputField.forceActiveFocus();
@ -308,7 +308,7 @@ Rectangle {
enabled: control.stickersPopupOpened enabled: control.stickersPopupOpened
target: control.stickersPopup target: control.stickersPopup
function onStickerSelected(hashId, packId, url) { function onStickerSelected(hashId: string, packId: string, url: string ) {
control.stickerSelected(hashId, packId, url) control.stickerSelected(hashId, packId, url)
control.hideExtendedArea(); control.hideExtendedArea();
messageInputField.forceActiveFocus(); messageInputField.forceActiveFocus();

View File

@ -187,7 +187,7 @@ Item {
} }
Connections { Connections {
target: root.store.stickersStore.stickersModule target: root.store.stickersStore.stickersModule
onTransactionWasSent: { function onTransactionWasSent(txResult: string) {
try { try {
let response = JSON.parse(txResult) let response = JSON.parse(txResult)
if (!response.success) { if (!response.success) {

View File

@ -102,7 +102,7 @@ ModalPopup {
} }
Connections { Connections {
target: stickerPackDetailsPopup.store.stickersStore.stickersModule target: stickerPackDetailsPopup.store.stickersStore.stickersModule
onTransactionWasSent: { function onTransactionWasSent(txResult: string) {
try { try {
let response = JSON.parse(txResult) let response = JSON.parse(txResult)
if (!response.success) { if (!response.success) {

View File

@ -51,7 +51,7 @@ ChartStoreBase {
Connections { Connections {
target: walletSectionAllTokens target: walletSectionAllTokens
onTokenBalanceHistoryDataReady: (balanceHistory) => { function onTokenBalanceHistoryDataReady(balanceHistory: string) {
// chainId, address, symbol, timeInterval // chainId, address, symbol, timeInterval
let response = JSON.parse(balanceHistory) let response = JSON.parse(balanceHistory)
if (response === null) { if (response === null) {

View File

@ -44,7 +44,7 @@ Item {
Connections { Connections {
target: mainModule target: mainModule
onResolvedENS: { function onResolvedENS(resolvedPubKey: string, resolvedAddress: string, uuid: string) {
if (uuid !== root.uuid) { if (uuid !== root.uuid) {
return return
} }

View File

@ -33,7 +33,7 @@ ColumnLayout {
Connections { Connections {
target: RootStore.history target: RootStore.history
onLoadingTrxHistoryChanged: function(isLoading, address) { function onLoadingTrxHistoryChanged(isLoading: bool, address: string) {
if (historyView.account.address.toLowerCase() === address.toLowerCase()) { if (historyView.account.address.toLowerCase() === address.toLowerCase()) {
historyView.isLoading = isLoading historyView.isLoading = isLoading
} }

View File

@ -70,7 +70,7 @@ Column {
id: linkFetchConnections id: linkFetchConnections
enabled: false enabled: false
target: root.messageStore.messageModule target: root.messageStore.messageModule
onLinkPreviewDataWasReceived: { function onLinkPreviewDataWasReceived(previewData: string) {
let response = {} let response = {}
try { try {
response = JSON.parse(previewData) response = JSON.parse(previewData)
@ -106,7 +106,7 @@ Column {
id: linkCommunityFetchConnections id: linkCommunityFetchConnections
enabled: false enabled: false
target: root.store.communitiesModuleInst target: root.store.communitiesModuleInst
function onCommunityAdded(communityId) { function onCommunityAdded(communityId: string) {
if (communityId !== linkData.communityId) { if (communityId !== linkData.communityId) {
return return
} }

View File

@ -779,6 +779,13 @@ QtObject {
NoError NoError
} }
enum AddAccountType {
GenerateNew,
ImportSeedPhrase,
ImportPrivateKey,
WatchOnly
}
readonly property QtObject walletSection: QtObject { readonly property QtObject walletSection: QtObject {
readonly property string cancelledMessage: "cancelled" readonly property string cancelledMessage: "cancelled"
} }