diff --git a/ui/app/AppLayouts/Chat/panels/communities/CommunityProfilePopupMembersListPanel.qml b/ui/app/AppLayouts/Chat/panels/communities/CommunityProfilePopupMembersListPanel.qml index d379c1a2ee..2f82f76880 100644 --- a/ui/app/AppLayouts/Chat/panels/communities/CommunityProfilePopupMembersListPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/communities/CommunityProfilePopupMembersListPanel.qml @@ -10,6 +10,7 @@ import StatusQ.Popups 0.1 import utils 1.0 import shared 1.0 +import shared.popups 1.0 import "../../popups" import "../../popups/community" diff --git a/ui/app/AppLayouts/Chat/popups/ActivityCenterPopup.qml b/ui/app/AppLayouts/Chat/popups/ActivityCenterPopup.qml index 78fe281358..520648e112 100644 --- a/ui/app/AppLayouts/Chat/popups/ActivityCenterPopup.qml +++ b/ui/app/AppLayouts/Chat/popups/ActivityCenterPopup.qml @@ -3,6 +3,7 @@ import QtQuick.Controls 2.13 import QtQml.Models 2.13 import QtGraphicalEffects 1.13 import shared 1.0 +import shared.popups 1.0 import StatusQ.Controls 0.1 import "../views" diff --git a/ui/app/AppLayouts/Chat/stores/RootStore.qml b/ui/app/AppLayouts/Chat/stores/RootStore.qml index 0cc4a6a65e..62c708413a 100644 --- a/ui/app/AppLayouts/Chat/stores/RootStore.qml +++ b/ui/app/AppLayouts/Chat/stores/RootStore.qml @@ -186,10 +186,6 @@ QtObject { return contactsModuleModel.isContactBlocked(pubkey) } - function isEnsVerified(pubkey) { - return contactsModuleModel.isEnsVerified(pubkey) - } - function alias(pubkey) { return contactsModuleModel.alias(pubkey) } diff --git a/ui/app/AppLayouts/Profile/Sections/Contacts/ContactList.qml b/ui/app/AppLayouts/Profile/Sections/Contacts/ContactList.qml index 62a0f8ac58..9953b8ff81 100644 --- a/ui/app/AppLayouts/Profile/Sections/Contacts/ContactList.qml +++ b/ui/app/AppLayouts/Profile/Sections/Contacts/ContactList.qml @@ -5,6 +5,7 @@ import "./samples/" import utils 1.0 import shared 1.0 +import shared.popups 1.0 import "../../../Chat/popups" import "." diff --git a/ui/app/AppLayouts/Profile/panels/ContactsListPanel.qml b/ui/app/AppLayouts/Profile/panels/ContactsListPanel.qml index e565d7f5c9..30a5473ec4 100644 --- a/ui/app/AppLayouts/Profile/panels/ContactsListPanel.qml +++ b/ui/app/AppLayouts/Profile/panels/ContactsListPanel.qml @@ -4,6 +4,7 @@ import QtQuick.Layouts 1.13 import utils 1.0 import shared 1.0 +import shared.popups 1.0 import "../../Chat/popups" import "." diff --git a/ui/app/AppLayouts/Chat/popups/NicknamePopup.qml b/ui/imports/shared/popups/NicknamePopup.qml similarity index 100% rename from ui/app/AppLayouts/Chat/popups/NicknamePopup.qml rename to ui/imports/shared/popups/NicknamePopup.qml diff --git a/ui/app/AppLayouts/Chat/popups/ProfilePopup.qml b/ui/imports/shared/popups/ProfilePopup.qml similarity index 90% rename from ui/app/AppLayouts/Chat/popups/ProfilePopup.qml rename to ui/imports/shared/popups/ProfilePopup.qml index c78b0baa53..3988192a22 100644 --- a/ui/app/AppLayouts/Chat/popups/ProfilePopup.qml +++ b/ui/imports/shared/popups/ProfilePopup.qml @@ -7,6 +7,7 @@ import QtGraphicalEffects 1.13 import utils 1.0 import shared 1.0 import shared.popups 1.0 +import shared.stores 1.0 import StatusQ.Core.Theme 0.1 import StatusQ.Components 0.1 @@ -19,10 +20,6 @@ StatusModal { property Popup parentPopup -//ProfilePopup is either instantiated in some files -//and called to open via the openProfilePopup in others -//TODO --------------------------------------- -//use one PofilePopup instance and pass the store there property var store property var identicon: "" property var userName: "" @@ -51,9 +48,9 @@ StatusModal { fromAuthor = fromAuthorParam || "" identicon = identiconParam || "" text = textParam || "" - isEnsVerified = popup.store.isEnsVerified(this.fromAuthor) - isBlocked = popup.store.isContactBlocked(this.fromAuthor); - alias = popup.store.alias(this.fromAuthor) || "" + isEnsVerified = RootStore.isEnsVerified(this.fromAuthor) + isBlocked = RootStore.isContactBlocked(this.fromAuthor); + alias = RootStore.alias(this.fromAuthor) || "" isCurrentUser = userProfile.pubKey === this.fromAuthor showFooter = _showFooter; popup.open() @@ -211,7 +208,7 @@ StatusModal { UnblockContactConfirmationDialog { id: unblockContactConfirmationDialog onUnblockButtonClicked: { - popup.store.contactsModuleInst.unblockContact(fromAuthor) + RootStore.contactsModuleInst.unblockContact(fromAuthor) unblockContactConfirmationDialog.close(); popup.close() popup.contactUnblocked(fromAuthor) @@ -221,7 +218,7 @@ StatusModal { BlockContactConfirmationDialog { id: blockContactConfirmationDialog onBlockButtonClicked: { - popup.store.contactsModuleInst.blockContact(fromAuthor) + RootStore.contactsModuleInst.blockContact(fromAuthor) blockContactConfirmationDialog.close(); popup.close() @@ -234,8 +231,8 @@ StatusModal { header.title: qsTr("Remove contact") confirmationText: qsTr("Are you sure you want to remove this contact?") onConfirmButtonClicked: { - if (popup.store.contactsModuleInst.model.isAdded(fromAuthor)) { - popup.store.contactsModuleInst.removeContact(fromAuthor); + if (RootStore.contactsModuleModel.isAdded(fromAuthor)) { + RootStore.contactsModuleInst.removeContact(fromAuthor); } removeContactConfirmationDialog.close(); popup.close(); @@ -250,7 +247,7 @@ StatusModal { popup.userName = newUsername; } popup.nickname = newNickname; - popup.store.contactsModuleInst.changeContactNickname(fromAuthor, newNickname); + RootStore.contactsModuleInst.changeContactNickname(fromAuthor, newNickname); popup.close() // Not Refactored Yet // if (!!chatsModel.communities.activeCommunity) { @@ -280,7 +277,7 @@ StatusModal { }, StatusFlatButton { - property bool isAdded: popup.store.contactsModuleInst.model.isAdded(fromAuthor) + property bool isAdded: RootStore.contactsModuleModel.isAdded(fromAuthor) visible: !isBlocked && isAdded type: StatusBaseButton.Type.Danger text: qsTr('Remove Contact') @@ -291,7 +288,7 @@ StatusModal { }, StatusButton { - property bool isAdded: popup.store.contactsModuleInst.model.isAdded(fromAuthor) + property bool isAdded: RootStore.contactsModuleModel.isAdded(fromAuthor) text: qsTr("Add to contacts") visible: !isBlocked && !isAdded onClicked: { diff --git a/ui/imports/shared/popups/qmldir b/ui/imports/shared/popups/qmldir index 57a6715770..ee449f7705 100644 --- a/ui/imports/shared/popups/qmldir +++ b/ui/imports/shared/popups/qmldir @@ -13,3 +13,4 @@ UnblockContactConfirmationDialog 1.0 UnblockContactConfirmationDialog.qml UserStatusContextMenu 1.0 UserStatusContextMenu.qml SignTransactionModal 1.0 SignTransactionModal.qml SelectAccountModal 1.0 SelectAccountModal.qml +ProfilePopup 1.0 ProfilePopup.qml diff --git a/ui/imports/shared/stores/RootStore.qml b/ui/imports/shared/stores/RootStore.qml index bf6d21a4ad..11d1b39845 100644 --- a/ui/imports/shared/stores/RootStore.qml +++ b/ui/imports/shared/stores/RootStore.qml @@ -12,6 +12,7 @@ QtObject { property var profileModelInst: !!profileModel ? profileModel : null property var walletSectionInst: !!walletSection ? walletSection : null property var contactsModuleInst: !!contactsModule ? contactsModule : null + property var contactsModuleModel: contactsModuleInst.model || {} property var appSettings: !!localAppSettings ? localAppSettings : null property var accountSensitiveSettings: !!localAccountSensitiveSettings ? localAccountSensitiveSettings : null property real volume: !!accountSensitiveSettings ? accountSensitiveSettings.volume : 0.0 @@ -71,6 +72,18 @@ QtObject { } function copyToClipboard(textToCopy) { - chatsModelInst.copyToClipboard(textToCopy); + chatsModelInst.copyToClipboard(textToCopy) + } + + function isEnsVerified(pubkey) { + return contactsModuleInst.isEnsVerified(pubkey); + } + + function isContactBlocked(pubkey) { + return contactsModuleModel.isContactBlocked(pubkey); + } + + function alias(pubkey) { + return contactsModuleInst.alias(pubkey); } }