Skip to content

Commit

Permalink
chore(Qt5.15): Fix qml warnings after qt 5.15 migration
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alexjba authored and alexandraB99 committed Jan 31, 2023
1 parent db3b63e commit 81a4d70
Show file tree
Hide file tree
Showing 43 changed files with 125 additions and 119 deletions.
2 changes: 1 addition & 1 deletion ui/StatusQ/src/StatusQ/Controls/StatusSeedPhraseInput.qml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ Item {
// Consider word inserted if input looses focus while a valid word is present ("user" clicks outside)
Connections {
target: seedWordInput.input.edit
onActiveFocusChanged: {
function onActiveFocusChanged() {
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.
d.isInputValidWord = false
Expand Down
6 changes: 3 additions & 3 deletions ui/app/AppLayouts/Browser/BrowserLayout.qml
Original file line number Diff line number Diff line change
Expand Up @@ -596,22 +596,22 @@ StatusSectionLayout {

Connections {
target: _internal.currentWebView
onUrlChanged: {
function onUrlChanged() {
browserHeader.addressBar.text = Web3ProviderStore.obtainAddress(_internal.currentWebView.url)
RootStore.currentTabConnected = Web3ProviderStore.hasWalletConnected(Utils.getHostname(_internal.currentWebView.url))
}
}

Connections {
target: BookmarksStore.bookmarksModel
onModelChanged: {
function onModelChanged() {
browserHeader.currentFavorite = Qt.binding(function () {return BookmarksStore.getCurrentFavorite(_internal.currentWebView.url)})
}
}

Connections {
target: browserSection
onOpenUrl: {
function onOpenUrl(url: string) {
root.openUrlInNewTab(url);
}
}
Expand Down
2 changes: 1 addition & 1 deletion ui/app/AppLayouts/Browser/panels/DownloadBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Rectangle {
}
Connections {
target: downloadsMenu
onCancelClicked: {
function onCancelClicked() {
isCanceled = true
}
}
Expand Down
2 changes: 1 addition & 1 deletion ui/app/AppLayouts/Browser/panels/DownloadView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ import "../controls"
}
Connections {
target: downloadsMenu
onCancelClicked: {
function onCancelClicked() {
isCanceled = true
}
}
Expand Down
2 changes: 1 addition & 1 deletion ui/app/AppLayouts/Browser/popups/BrowserWalletMenu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Popup {

Connections {
target: WalletStore.dappBrowserAccount
onConnectedAccountDeleted: {
function onConnectedAccountDeleted() {
popup.reload()
// 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
Expand Down
2 changes: 1 addition & 1 deletion ui/app/AppLayouts/Browser/views/WebProviderObj.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ QtObject {
property Connections conn: Connections {
target: Web3ProviderStore.web3ProviderInst

onPostMessageResult: {
function onPostMessageResult(payloadMethod: string, result: string, chainId: string) {
web3Response(result)
const isSign = ["eth_sign", "personal_sign", "eth_signTypedData", "eth_signTypedData_v3"].indexOf(payloadMethod) > -1
const isTx = payloadMethod === "eth_sendTransaction"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ StatusDialog {
enabled: root.opened && root.emojiPopupOpened
target: emojiPopup

onEmojiSelected: function (emojiText, atCursor) {
function onEmojiSelected(emojiText: string, atCursor: bool) {
nameInput.input.asset.isLetterIdenticon = false;
nameInput.input.asset.emoji = emojiText
}
onClosed: {
function onClosed() {
root.emojiPopupOpened = false
}
}
Expand Down
4 changes: 2 additions & 2 deletions ui/app/AppLayouts/Chat/views/CommunityColumnView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Item {

Connections {
target: root.store.communitiesModuleInst
onCommunityAccessRequested: function (communityId) {
function onCommunityAccessRequested(communityId: string) {
if (communityId === communityData.id) {
joinCommunityButton.invitationPending = root.store.isCommunityRequestPending(communityData.id)
}
Expand Down Expand Up @@ -608,7 +608,7 @@ Item {
Connections {
target: root.store.mainModuleInst

onOpenCommunityMembershipRequestsPopup:{
function onOpenCommunityMembershipRequestsPopup(sectionId: string) {
if(root.store.getMySectionId() != sectionId)
return

Expand Down
2 changes: 1 addition & 1 deletion ui/app/AppLayouts/Chat/views/MembersSelectorView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ MembersSelectorBase {
Connections {
enabled: root.visible
target: root.rootStore.contactsStore.mainModuleInst
onResolvedENS: {
function onResolvedENS(resolvedPubKey: string, resolvedAddress: string, uuid: string) {
if (resolvedPubKey === "") {
root.suggestionsDialog.forceHide = false
return
Expand Down
6 changes: 3 additions & 3 deletions ui/app/AppLayouts/Onboarding/OnboardingLayout.qml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ OnboardingBasePage {

Connections {
target: root.startupStore.startupModuleInst
onStartupError: {
function onStartupError(error: string, errType: int) {
msgDialog.errType = errType
if (errType === Constants.startupErrorType.setupAccError) {
if (error === Constants.existingAccountError) {
Expand Down Expand Up @@ -172,10 +172,10 @@ following the \"Add existing Status user\" flow, using your seed phrase.")
msgDialog.open()
}

onDisplayKeycardSharedModuleFlow: {
function onDisplayKeycardSharedModuleFlow() {
keycardPopup.active = true
}
onDestroyKeycardSharedModuleFlow: {
function onDestroyKeycardSharedModuleFlow() {
keycardPopup.active = false
}
}
Expand Down
2 changes: 1 addition & 1 deletion ui/app/AppLayouts/Onboarding/views/ConfirmPasswordView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ Item {

Connections {
target: RootStore.privacyModule
onPasswordChanged: {
function onPasswordChanged(success: bool, errorMsg: string) {
if (success) {
submitBtn.loading = false
root.exit();
Expand Down
6 changes: 3 additions & 3 deletions ui/app/AppLayouts/Onboarding/views/LoginView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Item {
Connections{
target: root.startupStore.startupModuleInst

onObtainingPasswordError: {
function onObtainingPasswordError(errorDescription: string, errorType: string) {
if (errorType === Constants.keychain.errorType.authentication) {
// We are notifying user only about keychain errors.
return
Expand All @@ -120,7 +120,7 @@ Item {
obtainingPasswordErrorNotification.open()
}

onObtainingPasswordSuccess: {
function onObtainingPasswordSuccess(password: string) {
if(localAccountSettings.storeToKeychainValue !== Constants.keychain.storedValue.store)
return

Expand All @@ -132,7 +132,7 @@ Item {
}
}

onAccountLoginError: {
function onAccountLoginError(error: string) {
if (error) {
if (!root.startupStore.selectedLoginAccount.keycardCreatedAccount) {
// SQLITE_NOTADB: "file is not a database"
Expand Down
3 changes: 2 additions & 1 deletion ui/app/AppLayouts/Profile/ProfileLayout.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import QtQuick.Layouts 1.13
import utils 1.0
import shared 1.0
import shared.panels 1.0
import shared.stores 1.0 as SharedStores

import "stores"
import "popups"
Expand Down Expand Up @@ -193,7 +194,7 @@ StatusSectionLayout {
implicitHeight: parent.height

languageStore: root.store.languageStore
currencyStore: root.store.walletStore.currencyStore
currencyStore: SharedStores.RootStore.currencyStore
sectionTitle: root.store.getNameForSubsection(Constants.settingsSubsection.language)
contentWidth: d.contentWidth
}
Expand Down
4 changes: 3 additions & 1 deletion ui/app/AppLayouts/Profile/popups/ChangePasswordModal.qml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ StatusModal {

Connections {
target: root.privacyStore.privacyModule
onPasswordChanged: onChangePasswordResponse(success, errorMsg)
function onPasswordChanged(success: bool, errorMsg: string) {
onChangePasswordResponse(success, errorMsg)
}
}

width: 480
Expand Down
2 changes: 1 addition & 1 deletion ui/app/AppLayouts/Profile/popups/RenameAccontModal.qml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ StatusModal {
Connections {
enabled: popup.opened
target: emojiPopup
onEmojiSelected: function (emojiText, atCursor) {
function onEmojiSelected(emojiText: string, atCursor: bool) {
popup.contentItem.accountNameInput.input.asset.emoji = emojiText
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ StatusModal {

Connections {
target: contactsStore.mainModuleInst
onResolvedENS: {
function onResolvedENS(resolvedPubKey: string, resolvedAddress: string, uuid: string) {
if(!d.showChatKeyValidationIndicator){
d.showPasteButton = false
d.showChatKeyValidationIndicator = true
Expand Down
5 changes: 1 addition & 4 deletions ui/app/AppLayouts/Profile/stores/WalletStore.qml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import QtQuick 2.13

import shared.stores 1.0 as SharedStore
import "../../Wallet/stores"

QtObject {
Expand All @@ -21,9 +20,7 @@ QtObject {
property var importedAccounts: walletSectionAccounts.imported
property var generatedAccounts: walletSectionAccounts.generated
property var watchOnlyAccounts: walletSectionAccounts.watchOnly

property var currencyStore: SharedStore.RootStore.currencyStore


property var currentAccount: walletSectionCurrent

function switchAccountByAddress(address) {
Expand Down
6 changes: 3 additions & 3 deletions ui/app/AppLayouts/Profile/views/EnsDetailsView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Item {

Connections {
target: root.ensUsernamesStore.ensUsernamesModule
onDetailsObtained: {
function onDetailsObtained(ensName: string, address: string, pubkey: string, isStatus: bool, expirationTime: int) {
if(username != (isStatus ? ensName + ".stateofus.eth" : ensName))
return;
walletAddressLbl.subTitle = address;
Expand All @@ -71,7 +71,7 @@ Item {
&& root.ensUsernamesStore.preferredUsername !== username
d.expirationTimestamp = expirationTime * 1000
}
onLoading: {
function onLoading(isLoading: bool) {
loadingImg.active = isLoading
if (!isLoading)
return;
Expand Down Expand Up @@ -152,7 +152,7 @@ Item {
}
Connections {
target: root.ensUsernamesStore.ensUsernamesModule
onTransactionWasSent: {
function onTransactionWasSent(txResult: string) {
try {
let response = JSON.parse(txResult)
if (!response.success) {
Expand Down
2 changes: 1 addition & 1 deletion ui/app/AppLayouts/Profile/views/EnsListView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Item {

Connections {
target: root.ensUsernamesStore.ensUsernamesModule
onUsernameConfirmed: {
function onUsernameConfirmed(username: string) {
d.updateNumberOfPendingEnsUsernames()
chatSettingsLabel.visible = true
}
Expand Down
4 changes: 2 additions & 2 deletions ui/app/AppLayouts/Profile/views/EnsSearchView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Item {
}
Connections {
target: root.ensUsernamesStore.ensUsernamesModule
onTransactionWasSent: {
function onTransactionWasSent(txResult: string) {
try {
let response = JSON.parse(txResult)
if (!response.success) {
Expand Down Expand Up @@ -189,7 +189,7 @@ Item {

Connections {
target: root.ensUsernamesStore.ensUsernamesModule
onUsernameAvailabilityChecked: {
function onUsernameAvailabilityChecked(availabilityStatus: string) {
if(!validate(ensUsername.text)) return;
valid = false;
loading = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Item {
}
Connections {
target: root.ensUsernamesStore.ensUsernamesModule
onTransactionWasSent: {
function onTransactionWasSent(txResult: string) {
try {
let response = JSON.parse(txResult)
if (!response.success) {
Expand Down
4 changes: 2 additions & 2 deletions ui/app/AppLayouts/Profile/views/EnsView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -315,14 +315,14 @@ Item {

Connections {
target: ensView
onConnect: {
function onConnect(ensUsername: string) {
addedUsername = ensUsername;
}
}

Connections {
target: ensView.ensUsernamesStore.ensUsernamesModule
onTransactionCompleted: {
function onTransactionCompleted(success: bool, txHash: string, username: string, trxType: string, revertReason: string) {
let title = ""
switch(trxType){
case "RegisterENS":
Expand Down
4 changes: 2 additions & 2 deletions ui/app/AppLayouts/Profile/views/KeycardView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ SettingsContentBase {
Connections {
target: root.keycardStore.keycardModule

onDisplayKeycardSharedModuleFlow: {
function onDisplayKeycardSharedModuleFlow() {
keycardPopup.active = true
}
onDestroyKeycardSharedModuleFlow: {
function onDestroyKeycardSharedModuleFlow() {
keycardPopup.active = false
}
onSharedModuleBusy: {
Expand Down
4 changes: 3 additions & 1 deletion ui/app/AppLayouts/Profile/views/MessagingView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,9 @@ SettingsContentBase {

Connections {
target: localAccountSensitiveSettings
onWhitelistedUnfurlingSitesChanged: generalColumn.populatePreviewableSites()
function onWhitelistedUnfurlingSitesChanged() {
generalColumn.populatePreviewableSites()
}
}

// Manually add switch for the image unfurling
Expand Down
8 changes: 4 additions & 4 deletions ui/app/AppLayouts/Wallet/panels/DerivedAddressesPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import "../stores"
Item {
id: derivedAddresses

property int selectedAccountType: RootStore.defaultSelectedType
property int selectedAccountType: Constants.AddAccountType.GenerateNew
property string selectedKeyUid: RootStore.defaultSelectedKeyUid
property bool selectedKeyUidMigratedToKeycard: RootStore.defaultSelectedKeyUidMigratedToKeycard
property string selectedPath: ""
Expand Down Expand Up @@ -52,8 +52,8 @@ Item {
id: _internal

readonly property bool showEnterPinPassButton: !RootStore.loggedInUserAuthenticated &&
derivedAddresses.selectedAccountType !== SelectGeneratedAccount.AddAccountType.ImportSeedPhrase &&
derivedAddresses.selectedAccountType !== SelectGeneratedAccount.AddAccountType.ImportPrivateKey
derivedAddresses.selectedAccountType !== Constants.AddAccountType.ImportSeedPhrase &&
derivedAddresses.selectedAccountType !== Constants.AddAccountType.ImportPrivateKey
property int pageSize: 6
property int noOfPages: Math.ceil(RootStore.derivedAddressesList.count/pageSize)
property int lastPageSize: RootStore.derivedAddressesList.count - ((noOfPages -1) * pageSize)
Expand Down Expand Up @@ -85,7 +85,7 @@ Item {

Connections {
target: RootStore.derivedAddressesList
onModelReset: {
function onModelReset() {
_internal.pageSize = 0
_internal.pageSize = 6
_internal.nextSelectableAddressIndex = -1
Expand Down
Loading

0 comments on commit 81a4d70

Please sign in to comment.