Refactor: Moved openPopup function to Global

The openPopup function was declared in AppMain
and used via dynamic scoping in many places in the
application. Moved function to Global component
and updated all places to call it via Global instead.

Closes #4267
This commit is contained in:
Alexandra Betouni 2021-12-07 22:33:12 +02:00 committed by Sale Djenic
parent 336f90a60f
commit f0b39ce4f6
39 changed files with 107 additions and 161 deletions

View File

@ -66,7 +66,7 @@ Item {
//% "Membership requests"
title: qsTrId("membership-requests")
requestsCount: nbRequests
sensor.onClicked: openPopup(membershipRequestPopup)
sensor.onClicked: Global.openPopup(membershipRequestPopup)
}
StatusModalDivider {
@ -171,7 +171,7 @@ Item {
//% "View Profile"
text: qsTrId("view-profile")
icon.name: "channel"
onTriggered: openPopup(profilePopup, {
onTriggered: Global.openPopup(profilePopup, {
noFooter: userProfile.pubKey !== model.pubKey,
userName: model.userName,
fromAuthor: model.pubKey,

View File

@ -88,7 +88,7 @@ Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: manageBtn.top
anchors.bottomMargin: Style.current.halfPadding
onClicked: openPopup(inviteFriendsToCommunityPopup, {
onClicked: Global.openPopup(inviteFriendsToCommunityPopup, {
community: root.activeCommunity
})
}
@ -100,7 +100,7 @@ Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: Style.current.padding
onClicked: openPopup(communityProfilePopup, {
onClicked: Global.openPopup(communityProfilePopup, {
store: rootStore,
community: root.activeCommunity
})

View File

@ -178,7 +178,7 @@ StatusModal {
//% "Pinned messages"
text: qsTrId("pinned-messages")
currentValue: pinnedCount
onClicked: openPopup(pinnedMessagesPopupComponent)
onClicked: Global.openPopup(pinnedMessagesPopupComponent)
iconSource: Style.svg("pin")
}

View File

@ -299,7 +299,7 @@ StatusModal {
if(gasSelector.eip1599Enabled && stack.currentGroup === groupSelectGas && gasSelector.advancedMode){
if(gasSelector.showPriceLimitWarning || gasSelector.showTipLimitWarning){
openPopup(transactionSettingsConfirmationPopupComponent, {
Global.openPopup(transactionSettingsConfirmationPopupComponent, {
currentBaseFee: gasSelector.latestBaseFeeGwei,
currentMinimumTip: gasSelector.perGasTipLimitFloor,
currentAverageTip: gasSelector.perGasTipLimitAverage,

View File

@ -40,7 +40,7 @@ StatusModal {
icon.name: "download"
//% "Access existing community"
text: qsTrId("access-existing-community")
onTriggered: openPopup(importCommunitiesPopupComponent)
onTriggered: Global.openPopup(importCommunitiesPopupComponent)
}
}
}
@ -132,7 +132,7 @@ StatusModal {
popup.setActiveCommunity(id);
} else {
popup.setObservedCommunity(id);
openPopup(communityDetailPopup)
Global.openPopup(communityDetailPopup)
}
popup.close()
}
@ -146,7 +146,7 @@ StatusModal {
//% "Create a community"
text: qsTrId("create-community")
onClicked: {
openPopup(createCommunitiesPopupComponent)
Global.openPopup(createCommunitiesPopupComponent)
popup.close()
}
}

View File

@ -146,7 +146,7 @@ StatusModal {
icon.width: 20
rotation: 180
onClicked: {
openPopup(communitiesPopupComponent)
Global.openPopup(communitiesPopupComponent)
root.close()
}
}

View File

@ -63,12 +63,12 @@ StatusModal {
onNotificationsButtonClicked: {
root.store.setCommunityMuted(root.community.id, checked);
}
onEditButtonClicked: openPopup(editCommunityPopup, {
onEditButtonClicked: Global.openPopup(editCommunityPopup, {
store: root.store,
community: root.community,
onSave: root.close
})
onTransferOwnershipButtonClicked: openPopup(transferOwnershiproot, {
onTransferOwnershipButtonClicked: Global.openPopup(transferOwnershiproot, {
privateKey: root.store.exportCommunity(),
store: root.store
})

View File

@ -163,7 +163,7 @@ StatusModal {
icon.name: "delete"
type: StatusListItem.Type.Danger
sensor.onClicked: {
openPopup(deleteCategoryConfirmationDialogComponent, {
Global.openPopup(deleteCategoryConfirmationDialogComponent, {
//% "Delete %1 category"
title: qsTrId("delete--1-category").arg(root.contentItem.categoryName.input.text),
//% "Are you sure you want to delete %1 category? Channels inside the category wont be deleted."

View File

@ -180,7 +180,7 @@ StatusModal {
}
]
sensor.onClicked: openPopup(pinnedMessagesPopupComponent)
sensor.onClicked: Global.openPopup(pinnedMessagesPopupComponent)
}
Item {

View File

@ -200,7 +200,7 @@ Item {
chatInfoButton.pinnedMessagesCount: root.rootStore.chatsModelInst.messageView.pinnedMessagesList.count
chatInfoButton.muted: root.rootStore.chatsModelInst.channelView.activeChannel.muted
chatInfoButton.onPinnedMessagesCountClicked: openPopup(pinnedMessagesPopupComponent)
chatInfoButton.onPinnedMessagesCountClicked: Global.openPopup(pinnedMessagesPopupComponent)
chatInfoButton.onUnmute: root.rootStore.chatsModelInst.channelView.unmuteChatItem(chatsModel.channelView.activeChannel.id)
chatInfoButton.sensor.enabled: root.rootStore.chatsModelInst.channelView.activeChannel.chatType !== Constants.chatTypePublic &&
@ -208,7 +208,7 @@ Item {
chatInfoButton.onClicked: {
switch (root.rootStore.chatsModelInst.channelView.activeChannel.chatType) {
case Constants.chatTypePrivateGroupChat:
openPopup(groupInfoPopupComponent, {
Global.openPopup(groupInfoPopupComponent, {
channelType: GroupInfoPopup.ChannelType.ActiveChannel,
channel: root.rootStore.chatsModelInst.channelView.activeChannel
})

View File

@ -47,7 +47,7 @@ StatusPopupMenu {
)
}
if (chatItem.chatType === Constants.chatTypePrivateGroupChat) {
return openPopup(groupInfoPopupComponent, {
return Global.openPopup(groupInfoPopupComponent, {
channel: chatItem,
channelType: GroupInfoPopup.ChannelType.ContextChannel
})
@ -104,7 +104,7 @@ StatusPopupMenu {
icon.name: "edit"
enabled: communityActive &&
root.store.chatsModelInst.communities.activeCommunity.admin
onTriggered: openPopup(editChannelPopup, {
onTriggered: Global.openPopup(editChannelPopup, {
store: root.store,
communityId: root.store.chatsModelInst.communities.activeCommunity.id,
channel: chatItem
@ -140,7 +140,7 @@ StatusPopupMenu {
type: StatusMenuItem.Type.Danger
onTriggered: {
openPopup(deleteChatConfirmationDialogComponent)
Global.openPopup(deleteChatConfirmationDialogComponent)
}
enabled: !communityActive || root.store.chatsModelInst.communities.activeCommunity.admin

View File

@ -46,7 +46,7 @@ Item {
// chatInfoButton.image.source: root.store.chatsModelInst.communities.activeCommunity.thumbnailImage
// chatInfoButton.icon.color: root.store.chatsModelInst.communities.activeCommunity.communityColor
// menuButton.visible: root.store.chatsModelInst.communities.activeCommunity.admin && root.store.chatsModelInst.communities.activeCommunity.canManageUsers
// chatInfoButton.onClicked: openPopup(communityProfilePopup, {
// chatInfoButton.onClicked: Global.openPopup(communityProfilePopup, {
// store: root.store,
// community: root.store.chatsModelInst.communities.activeCommunity
// })
@ -57,7 +57,7 @@ Item {
text: qsTrId("create-channel")
icon.name: "channel"
//enabled: root.store.chatsModelInst.communities.activeCommunity.admin
onTriggered: openPopup(createChannelPopup, {communityId: chatsModel.communities.activeCommunity.id})
onTriggered: Global.openPopup(createChannelPopup, {communityId: chatsModel.communities.activeCommunity.id})
}
StatusMenuItem {
@ -65,7 +65,7 @@ Item {
text: qsTrId("create-category")
icon.name: "channel-category"
//enabled: root.store.chatsModelInst.communities.activeCommunity.admin
onTriggered: openPopup(createCategoryPopup, {communityId: chatsModel.communities.activeCommunity.id})
onTriggered: Global.openPopup(createCategoryPopup, {communityId: chatsModel.communities.activeCommunity.id})
}
StatusMenuSeparator {}
@ -75,7 +75,7 @@ Item {
text: qsTrId("invite-people")
icon.name: "share-ios"
//enabled: root.store.chatsModelInst.communities.activeCommunity.canManageUsers
onTriggered: openPopup(inviteFriendsToCommunityPopup, {
onTriggered: Global.openPopup(inviteFriendsToCommunityPopup, {
community: root.store.chatsModelInst.communities.activeCommunity
})
}
@ -101,7 +101,7 @@ Item {
//% "Membership requests"
title: qsTrId("membership-requests")
requestsCount: membershipRequests.nbRequests
sensor.onClicked: openPopup(membershipRequestPopup)
sensor.onClicked: Global.openPopup(membershipRequestPopup)
}
}
}
@ -164,7 +164,7 @@ Item {
// root.store.chatsModelInst.communities.reorderCommunityCategories(chatsModel.communities.activeCommunity.id, categoryId, to);
// }
// onCategoryAddButtonClicked: openPopup(createChannelPopup, {
// onCategoryAddButtonClicked: Global.openPopup(createChannelPopup, {
// communityId: root.store.chatsModelInst.communities.activeCommunity.id,
// categoryId: id
// })
@ -175,7 +175,7 @@ Item {
text: qsTrId("create-channel")
icon.name: "channel"
enabled: chatsModel.communities.activeCommunity.admin
onTriggered: openPopup(createChannelPopup, {communityId: root.store.chatsModelInst.communities.activeCommunity.id})
onTriggered: Global.openPopup(createChannelPopup, {communityId: root.store.chatsModelInst.communities.activeCommunity.id})
}
StatusMenuItem {
@ -185,7 +185,7 @@ Item {
// Not Refactored Yet
enabled: false
//enabled: root.store.chatsModelInst.communities.activeCommunity.admin
onTriggered: openPopup(createCategoryPopup, {communityId: root.store.chatsModelInst.communities.activeCommunity.id})
onTriggered: Global.openPopup(createCategoryPopup, {communityId: root.store.chatsModelInst.communities.activeCommunity.id})
}
StatusMenuSeparator {}
@ -197,7 +197,7 @@ Item {
// Not Refactored Yet
enabled: false
//enabled: root.store.chatsModelInst.communities.activeCommunity.canManageUsers
onTriggered: openPopup(inviteFriendsToCommunityPopup, {
onTriggered: Global.openPopup(inviteFriendsToCommunityPopup, {
community: root.store.chatsModelInst.communities.activeCommunity
})
}
@ -219,7 +219,7 @@ Item {
text: qsTrId("edit-category")
icon.name: "edit"
onTriggered: {
openPopup(createCategoryPopup, {
Global.openPopup(createCategoryPopup, {
communityId: root.store.chatsModelInst.communities.activeCommunity.id,
isEdit: true,
categoryId: categoryItem.id,
@ -243,7 +243,7 @@ Item {
icon.name: "delete"
type: StatusMenuItem.Type.Danger
onTriggered: {
openPopup(deleteCategoryConfirmationDialogComponent, {
Global.openPopup(deleteCategoryConfirmationDialogComponent, {
//% "Delete %1 category"
title: qsTrId("delete--1-category").arg(categoryItem.name),
//% "Are you sure you want to delete %1 category? Channels inside the category wont be deleted."
@ -301,7 +301,7 @@ Item {
id: backupBanner
activeCommunity: store.activeCommunity
onBackupButtonClicked: {
openPopup(transferOwnershipPopup, {
Global.openPopup(transferOwnershipPopup, {
privateKey: root.store.exportCommunity(),
store: root.store
})

View File

@ -34,7 +34,7 @@ Item {
Component.onCompleted: {
appMain.openContactsPopup.connect(function(){
openPopup(contactRequestsPopup)
Global.openPopup(contactRequestsPopup)
})
}
@ -161,28 +161,28 @@ Item {
//% "Start new chat"
text: qsTrId("start-new-chat")
icon.name: "private-chat"
onTriggered: openPopup(privateChatPopupComponent)
onTriggered: Global.openPopup(privateChatPopupComponent)
}
StatusMenuItem {
//% "Start group chat"
text: qsTrId("start-group-chat")
icon.name: "group-chat"
onTriggered: openPopup(groupChatPopupComponent)
onTriggered: Global.openPopup(groupChatPopupComponent)
}
StatusMenuItem {
//% "Join public chat"
text: qsTrId("new-public-group-chat")
icon.name: "public-chat"
onTriggered: openPopup(publicChatPopupComponent)
onTriggered: Global.openPopup(publicChatPopupComponent)
}
StatusMenuItem {
//% "Communities"
text: qsTrId("communities")
icon.name: "communities"
onTriggered: openPopup(communitiesPopupComponent)
onTriggered: Global.openPopup(communitiesPopupComponent)
enabled: localAccountSensitiveSettings.communitiesEnabled
}
}
@ -205,7 +205,7 @@ Item {
title: qsTrId("contact-requests")
requestsCount: nbRequests
sensor.onClicked: openPopup(contactRequestsPopup)
sensor.onClicked: Global.openPopup(contactRequestsPopup)
}
ScrollView {

View File

@ -19,7 +19,7 @@ RadioButtonSelector {
if (checked) {
if (profileModel.fleets.fleet === root.fleetName) return;
root.newFleet = root.fleetName;
openPopup(confirmDialogComponent)
Global.openPopup(confirmDialogComponent)
}
}

View File

@ -20,7 +20,7 @@ RadioButtonSelector {
if (checked) {
if (profileModel.network.current === root.network) return;
root.newNetwork = root.network;
openPopup(confirmDialogComponent)
Global.openPopup(confirmDialogComponent)
}
}

View File

@ -282,7 +282,7 @@ ModalPopup {
validationError = "";
txtFieldWord.text = "";
openPopup(removeSeedPhraseConfirmDialogComponent);
Global.openPopup(removeSeedPhraseConfirmDialogComponent);
}
}
}

View File

@ -65,7 +65,7 @@ ModalPopup {
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: openPopup(addNetworkPopupComponent)
onClicked: Global.openPopup(addNetworkPopupComponent)
}
}

View File

@ -54,7 +54,7 @@ ModalPopup {
checked: localAccountSettings.storeToKeychainValue === Constants.storeToKeychainValueStore
onCheckedChanged: {
if (checked && localAccountSettings.storeToKeychainValue !== Constants.storeToKeychainValueStore) {
var storePassPopup = openPopup(storePasswordModal)
var storePassPopup = Global.openPopup(storePasswordModal)
if(storePassPopup)
{
storePassPopup.closed.connect(function(){

View File

@ -59,7 +59,7 @@ Item {
}
onClicked: {
root.store.checkForUpdates();
openPopup(downloadModalComponent, {newVersionAvailable: newVersionJSON.available, downloadURL: newVersionJSON.url})
Global.openPopup(downloadModalComponent, {newVersionAvailable: newVersionJSON.available, downloadURL: newVersionJSON.url})
}
}
}

View File

@ -281,7 +281,7 @@ ScrollView {
btnText: qsTrId("light-node")
onToggled: {
if (root.store.bloomLevel != "light") {
openPopup(bloomConfirmationDialogComponent, {mode: "light"})
Global.openPopup(bloomConfirmationDialogComponent, {mode: "light"})
} else {
btnBloomLight.click()
}
@ -296,7 +296,7 @@ ScrollView {
btnText: qsTrId("normal")
onToggled: {
if (root.store.bloomLevel != "normal") {
openPopup(bloomConfirmationDialogComponent, {mode: "normal"})
Global.openPopup(bloomConfirmationDialogComponent, {mode: "normal"})
} else {
btnBloomNormal.click()
}
@ -311,7 +311,7 @@ ScrollView {
btnText: qsTrId("full-node")
onToggled: {
if (root.store.bloomLevel != "full") {
openPopup(bloomConfirmationDialogComponent, {mode: "full"})
Global.openPopup(bloomConfirmationDialogComponent, {mode: "full"})
} else {
btnBloomFull.click()
}
@ -363,7 +363,7 @@ ScrollView {
btnText: qsTrId("light-node")
onToggled: {
if (!root.store.isWakuV2LightClient) {
openPopup(wakuV2ModeConfirmationDialogComponent, {mode: true})
Global.openPopup(wakuV2ModeConfirmationDialogComponent, {mode: true})
} else {
btnWakuV2Light.click()
}
@ -378,7 +378,7 @@ ScrollView {
btnText: qsTrId("full-node")
onToggled: {
if (root.store.isWakuV2LightClient) {
openPopup(wakuV2ModeConfirmationDialogComponent, {mode: false})
Global.openPopup(wakuV2ModeConfirmationDialogComponent, {mode: false})
} else {
btnWakuV2Full.click()
}
@ -386,41 +386,6 @@ ScrollView {
}
}
StatusSectionHeadline {
text: qsTr("Developer features")
topPadding: Style.current.bigPadding
bottomPadding: Style.current.padding
}
Separator {
anchors.topMargin: Style.current.bigPadding
anchors.left: parent.left
anchors.leftMargin: -Style.current.padding
anchors.right: parent.right
anchors.rightMargin: -Style.current.padding
}
StatusSettingsLineButton {
text: qsTr("Full developer mode")
isEnabled: {
return !localAccountSensitiveSettings.downloadChannelMessagesEnabled ||
!root.store.profileModuleInst.isTelemetryEnabled ||
!root.store.profileModuleInst.isDebugEnabled ||
!root.store.profileModuleInst.isAutoMessageEnabled
}
onClicked: {
openPopup(enableDeveloperFeaturesConfirmationDialogComponent)
}
}
Separator {
anchors.topMargin: Style.current.bigPadding
anchors.left: parent.left
anchors.leftMargin: -Style.current.padding
anchors.right: parent.right
anchors.rightMargin: -Style.current.padding
}
// TODO: replace with StatusQ component
StatusSettingsLineButton {
text: qsTr("Download messages")
@ -433,11 +398,22 @@ ScrollView {
// TODO: replace with StatusQ component
StatusSettingsLineButton {
text: qsTr("Telemetry")
text: qsTr("Stickers/ENS on ropsten")
visible: root.store.currentNetwork === Constants.networkRopsten
isSwitch: true
switchChecked: localAccountSensitiveSettings.stickersEnsRopsten
onClicked: {
localAccountSensitiveSettings.stickersEnsRopsten = !localAccountSensitiveSettings.stickersEnsRopsten
}
}
// TODO: replace with StatusQ component
StatusSettingsLineButton {
text: qsTr("Enable Telemetry")
isSwitch: true
switchChecked: root.store.profileModuleInst.isTelemetryEnabled
onClicked: {
openPopup(enableTelemetryConfirmationDialogComponent)
Global.openPopup(enableTelemetryConfirmationDialogComponent, {light: false})
}
}
@ -447,28 +423,17 @@ ScrollView {
isSwitch: true
switchChecked: root.store.profileModuleInst.isDebugEnabled
onClicked: {
openPopup(enableDebugComponent)
Global.openPopup(enableDebugComponent)
}
}
// TODO: replace with StatusQ component
StatusSettingsLineButton {
text: qsTr("Auto message")
text: qsTr("Enable Auto message")
isSwitch: true
switchChecked: root.store.profileModuleInst.isAutoMessageEnabled
onClicked: {
openPopup(enableAutoMessageConfirmationDialogComponent)
}
}
// TODO: replace with StatusQ component
StatusSettingsLineButton {
text: qsTr("Stickers/ENS on ropsten")
visible: root.store.currentNetwork === Constants.networkRopsten
isSwitch: true
switchChecked: localAccountSensitiveSettings.stickersEnsRopsten
onClicked: {
localAccountSensitiveSettings.stickersEnsRopsten = !localAccountSensitiveSettings.stickersEnsRopsten
Global.openPopup(enableAutoMessageConfirmationDialogComponent, {light: false})
}
}
}
@ -481,26 +446,6 @@ ScrollView {
id: fleetModal
}
Component {
id: enableDeveloperFeaturesConfirmationDialogComponent
ConfirmationDialog {
property bool mode: false
id: confirmDialog
showCancelButton: true
confirmationText: qsTr("Are you sure you want to enable all the develoer features? The app will be restarted.")
onConfirmButtonClicked: {
localAccountSensitiveSettings.downloadChannelMessagesEnabled = true
Qt.callLater(root.store.profileModuleInst.enableDeveloperFeatures)
close()
}
onCancelButtonClicked: {
close()
}
}
}
Component {
id: enableTelemetryConfirmationDialogComponent
ConfirmationDialog {
@ -544,7 +489,7 @@ ScrollView {
id: confirmDialog
showCancelButton: true
confirmationText: qsTr("Are you sure you want to %1 debug mode? You need to restart the app for this change to take effect.").arg(root.store.profileModuleInst.isDebugEnabled ?
confirmationText: qsTr("Are you sure you want to %1 debug mode? The app will be restarted for this change to take effect.").arg(root.store.profileModuleInst.isDebugEnabled ?
qsTr("disable") :
qsTr("enable"))
onConfirmButtonClicked: {

View File

@ -137,7 +137,7 @@ Item {
anchors.leftMargin: 24
text: qsTrId("Release username")
onClicked: {
openPopup(transactionDialogComponent)
Global.openPopup(transactionDialogComponent)
}
}

View File

@ -197,7 +197,7 @@ Item {
}
if(ensStatus === Constants.ens_connected_dkey || ensStatus === Constants.ens_owned){
openPopup(transactionDialogComponent)
Global.openPopup(transactionDialogComponent)
return;
}
}

View File

@ -105,7 +105,7 @@ Item {
color: Theme.palette.baseColor1
}
]
sensor.onClicked: openPopup(storeToKeychainSelectionModal)
sensor.onClicked: Global.openPopup(storeToKeychainSelectionModal)
Component {
id: storePasswordModal
@ -229,7 +229,7 @@ Item {
color: Theme.palette.baseColor1
}
]
sensor.onClicked: openPopup(chatLinksPreviewModal)
sensor.onClicked: Global.openPopup(chatLinksPreviewModal)
}
Component {
@ -259,7 +259,7 @@ Item {
color: Theme.palette.baseColor1
}
]
sensor.onClicked: openPopup(openLinksWithModal)
sensor.onClicked: Global.openPopup(openLinksWithModal)
}
StatusListItem {

View File

@ -147,7 +147,7 @@ Item {
//% "Receive"
text: qsTrId("receive")
onClicked: function () {
openPopup(receiveModalComponent);
Global.openPopup(receiveModalComponent);
}
anchors.left: sendBtn.right
anchors.leftMargin: walletMenu.btnOuterMargin
@ -180,7 +180,7 @@ Item {
icon.source: Style.svg("manage-wallet")
icon.width: 16
icon.height: 16
onTriggered: openPopup(accountSettingsModalComponent)
onTriggered: Global.openPopup(accountSettingsModalComponent)
}
Action {
//% "Manage Assets"
@ -189,7 +189,7 @@ Item {
icon.width: 16
icon.height: 16
onTriggered: {
openPopup(tokenSettingsModalComponent)
Global.openPopup(tokenSettingsModalComponent)
}
}
Action {
@ -199,7 +199,7 @@ Item {
icon.width: 16
icon.height: 16
onTriggered: {
openPopup(setCurrencyModalComponent)
Global.openPopup(setCurrencyModalComponent)
}
}
}

View File

@ -63,8 +63,7 @@ Item {
anchors.fill: accountRow
cursorShape: Qt.PointingHandCursor
onClicked: {
//TOOD improve this to not use dynamic scoping
openPopup(shareModalComponent);
Global.openPopup(shareModalComponent);
}
}

View File

@ -84,8 +84,7 @@ Item {
rightPadding: 11
visible: !root.loading
onClicked: {
//TODO improve this to not use dynamic scoping
appMain.openPopup(addEditSavedAddress)
Global.openPopup(addEditSavedAddress)
}
}
StatusLoadingIndicator {
@ -119,8 +118,7 @@ Item {
StatusRoundButton {
icon.name: "pencil"
visible: showButtons
//TODO improve this to not use dynamic scoping
onClicked: appMain.openPopup(addEditSavedAddress,
onClicked: Global.openPopup(addEditSavedAddress,
{
edit: true,
address: address,

View File

@ -47,7 +47,12 @@ Item {
browserLayoutContainer.item.openUrlInNewTab(link);
}
onOpenChooseBrowserPopup: {
appMain.openPopup(chooseBrowserPopupComponent, {link: link})
Global.openPopup(chooseBrowserPopupComponent, {link: link});
}
onOpenPopupRequested: {
const popup = popupComponent.createObject(appMain, params);
popup.open();
return popup;
}
}
@ -75,12 +80,6 @@ Item {
return appMain.rootStore.contactsModuleInst.model.list.rowData(index, useLargeImage ? "largeImage" : "thumbnailImage")
}
function openPopup(popupComponent, params = {}) {
const popup = popupComponent.createObject(appMain, params);
popup.open()
return popup
}
function getContactListObject(dataModel) {
const nbContacts = appMain.rootStore.contactsModuleInst.model.list.rowCount()
const contacts = []
@ -170,7 +169,7 @@ Item {
text: qsTr("A new version of Status (%1) is available").arg(newVersionJSON.version)
btnText: qsTr("Download")
onClick: function(){
openPopup(downloadModalComponent, {newVersionAvailable: newVersionJSON.available, downloadURL: newVersionJSON.url})
Global.openPopup(downloadModalComponent, {newVersionAvailable: newVersionJSON.available, downloadURL: newVersionJSON.url})
}
}
@ -260,7 +259,7 @@ Item {
text: qsTrId("invite-people")
icon.name: "share-ios"
enabled: chatsModel.communities.observedCommunity.canManageUsers
onTriggered: openPopup(inviteFriendsToCommunityPopup, {
onTriggered: Global.openPopup(inviteFriendsToCommunityPopup, {
community: chatsModel.communities.observedCommunity
})
}
@ -269,7 +268,7 @@ Item {
//% "View Community"
text: qsTrId("view-community")
icon.name: "group-chat"
onTriggered: openPopup(communityProfilePopup, {
onTriggered: Global.openPopup(communityProfilePopup, {
store: appMain.rootStore,
community: chatsModel.communities.observedCommunity
})
@ -280,7 +279,7 @@ Item {
//% "Edit Community"
text: qsTrId("edit-community")
icon.name: "edit"
onTriggered: openPopup(editCommunityPopup, {store: appMain.rootStore, community: chatsModel.communities.observedCommunity})
onTriggered: Global.openPopup(editCommunityPopup, {store: appMain.rootStore, community: chatsModel.communities.observedCommunity})
}
StatusMenuSeparator {}

View File

@ -43,7 +43,7 @@ MouseArea {
isHovered = false;
}
//TODO remove dynamic scoping
openPopup(statusStickerPackClickPopup, {packId: stickerPackId} )
Global.openPopup(statusStickerPackClickPopup, {packId: stickerPackId} )
return;
}
}

View File

@ -258,7 +258,7 @@ ModalPopup {
if(gasSelector.eip1599Enabled && stack.currentGroup === group2 && gasSelector.advancedMode){
if(gasSelector.showPriceLimitWarning || gasSelector.showTipLimitWarning){
openPopup(transactionSettingsConfirmationPopupComponent, {
Global.openPopup(transactionSettingsConfirmationPopupComponent, {
currentBaseFee: gasSelector.latestBaseFeeGwei,
currentMinimumTip: gasSelector.perGasTipLimitFloor,
currentAverageTip: gasSelector.perGasTipLimitAverage,

View File

@ -299,7 +299,7 @@ StatusModal {
if(gasSelector.eip1599Enabled && stack.currentGroup === groupSelectGas && gasSelector.advancedMode){
if(gasSelector.showPriceLimitWarning || gasSelector.showTipLimitWarning){
openPopup(transactionSettingsConfirmationPopupComponent, {
Global.openPopup(transactionSettingsConfirmationPopupComponent, {
currentBaseFee: gasSelector.latestBaseFeeGwei,
currentMinimumTip: gasSelector.perGasTipLimitFloor,
currentAverageTip: gasSelector.perGasTipLimitAverage,

View File

@ -215,7 +215,7 @@ ModalPopup {
if(gasSelector.eip1599Enabled && stack.currentGroup === group2 && gasSelector.advancedMode){
if(gasSelector.showPriceLimitWarning || gasSelector.showTipLimitWarning){
openPopup(transactionSettingsConfirmationPopupComponent, {
Global.openPopup(transactionSettingsConfirmationPopupComponent, {
currentBaseFee: gasSelector.latestBaseFeeGwei,
currentMinimumTip: gasSelector.perGasTipLimitFloor,
currentAverageTip: gasSelector.perGasTipLimitAverage,

View File

@ -225,7 +225,7 @@ ModalPopup {
if(gasSelector.eip1599Enabled && stack.currentGroup === group2 && gasSelector.advancedMode){
if(gasSelector.showPriceLimitWarning || gasSelector.showTipLimitWarning){
openPopup(transactionSettingsConfirmationPopupComponent, {
Global.openPopup(transactionSettingsConfirmationPopupComponent, {
currentBaseFee: gasSelector.latestBaseFeeGwei,
currentMinimumTip: gasSelector.perGasTipLimitFloor,
currentAverageTip: gasSelector.perGasTipLimitAverage,

View File

@ -89,7 +89,7 @@ Item {
onCancelClicked: root.cancelClicked(packId)
onUpdateClicked: root.updateClicked(packId)
onBuyClicked: {
root.stickerPurchasePopup = openPopup(stickerPackPurchaseModal)
root.stickerPurchasePopup = Global.openPopup(stickerPackPurchaseModal)
root.buyClicked(packId)
}
}
@ -157,7 +157,7 @@ Item {
confirmationPopup.open()
return
}
root.stickerPurchasePopup = openPopup(stickerPackPurchaseModal)
root.stickerPurchasePopup = Global.openPopup(stickerPackPurchaseModal)
root.buyClicked(packId)
}
}
@ -171,7 +171,7 @@ Item {
onConfirmButtonClicked: {
localAccountSensitiveSettings.isWalletEnabled = true
close()
root.stickerPurchasePopup = openPopup(stickerPackPurchaseModal)
root.stickerPurchasePopup = Global.openPopup(stickerPackPurchaseModal)
root.buyClicked(packId)
}

View File

@ -102,7 +102,7 @@ ModalPopup {
onCancelClicked: function(){}
onUpdateClicked: function(){}
onBuyClicked: {
openPopup(stickerPackPurchaseModal)
Global.openPopup(stickerPackPurchaseModal)
root.buyClicked(packId)
}
}

View File

@ -44,7 +44,7 @@ Item {
if (root.state === Constants.addressRequested) {
selectAccountModal.open()
} else if (root.state === Constants.transactionRequested) {
openPopup(signTxComponent)
Global.openPopup(signTxComponent)
}
}
}

View File

@ -323,7 +323,7 @@ Item {
if (localAccountSensitiveSettings.communitiesEnabled) {
onBtnClick();
} else {
openPopup(confirmationPopupComponent, { onConfirmed: onBtnClick });
Global.openPopup(confirmationPopupComponent, { onConfirmed: onBtnClick });
}
}

View File

@ -307,7 +307,7 @@ StatusPopupMenu {
if (!canPin) {
// Open pin modal so that the user can unpin one
openPopup(pinnedMessagesPopupComponent, {messageToPin: messageId})
Global.openPopup(pinnedMessagesPopupComponent, {messageToPin: messageId})
return
}

View File

@ -205,8 +205,7 @@ Item {
}
onSendTransaction: {
root.store.walletModelInst.accountsView.setFocusedAccountByAddress(fromAddress);
//TODO remove dynamic scoping
openPopup(signTxComponent, {selectedAccount: {
Global.openPopup(signTxComponent, {selectedAccount: {
name: acc.name,
address: fromAddress,
iconColor: acc.iconColor,

View File

@ -3,15 +3,21 @@ pragma Singleton
import QtQuick 2.13
QtObject {
id: root
property int currentMenuTab: 0
property var errorSound: Audio {
id: errorSound
track: Qt.resolvedUrl("../assets/audio/error.mp3")
}
property var mainModuleInst: mainModule
signal openLinkInBrowser(string link)
signal openChooseBrowserPopup(string link)
signal openPopupRequested(var popupComponent, var params)
function openPopup(popupComponent, params = {}) {
root.openPopupRequested(popupComponent, params);
}
function changeAppSectionBySectionType(sectionType) {
mainModuleInst.setActiveSectionBySectionType(sectionType)