From e8eefd8f87069ff266591dab13fc42c432073a5f Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Thu, 11 Nov 2021 11:11:40 -0500 Subject: [PATCH] refactor: move all old usages of contacts to the new code --- .../contacts/models/contact_list.nim | 2 +- ui/app/AppLayouts/Chat/ChatLayout.qml | 16 +++++++++++----- .../AppLayouts/Chat/panels/BadgeContentPanel.qml | 1 - .../popups/community/CommunityProfilePopup.qml | 1 - .../Profile/Sections/Contacts/ContactList.qml | 2 -- .../Profile/panels/ContactsListPanel.qml | 1 + 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/app/modules/main/profile_section/contacts/models/contact_list.nim b/src/app/modules/main/profile_section/contacts/models/contact_list.nim index bdc1f7730a..8519dc6250 100644 --- a/src/app/modules/main/profile_section/contacts/models/contact_list.nim +++ b/src/app/modules/main/profile_section/contacts/models/contact_list.nim @@ -132,7 +132,7 @@ QtObject: self.endRemoveRows() self.countChanged() - proc hasAddedContacts(self: ContactList): bool {.slot.} = + proc hasAddedContacts(self: ContactList): bool {.slot.} = for c in self.contacts: if(c.isContact()): return true return false diff --git a/ui/app/AppLayouts/Chat/ChatLayout.qml b/ui/app/AppLayouts/Chat/ChatLayout.qml index 4d943162ef..3ef590696d 100644 --- a/ui/app/AppLayouts/Chat/ChatLayout.qml +++ b/ui/app/AppLayouts/Chat/ChatLayout.qml @@ -27,7 +27,13 @@ StatusAppThreePanelLayout { property var store - property var messageStore + // Not Refactored +// property var messageStore + + // Not Refactored + property RootStore rootStore: RootStore { + messageStore: root.messageStore + } property alias chatColumn: chatColumn property bool stickersLoaded: false @@ -58,7 +64,7 @@ StatusAppThreePanelLayout { centerPanel: ChatColumnView { id: chatColumn - //rootStore: root.rootStore + rootStore: root.rootStore chatGroupsListViewCount: contactColumnLoader.item.chatGroupsListViewCount onOpenAppSearch: { @@ -100,7 +106,7 @@ StatusAppThreePanelLayout { id: contactsColumnComponent ContactsColumnView { // Not Refactored - //store: root.rootStore + store: root.rootStore onOpenProfileClicked: { root.profileButtonClicked(); } @@ -123,7 +129,7 @@ StatusAppThreePanelLayout { id: groupInfoPopupComponent GroupInfoPopup { // Not Refactored - //store: root.rootStore + store: root.rootStore pinnedMessagesPopupComponent: chatColumn.pinnedMessagesPopupComponent } } @@ -155,7 +161,7 @@ StatusAppThreePanelLayout { MessageContextMenuView { id: quickActionMessageOptionsMenu // Not Refactored -// store: root.rootStore + store: root.rootStore // reactionModel: root.rootStore.emojiReactionsModel } } diff --git a/ui/app/AppLayouts/Chat/panels/BadgeContentPanel.qml b/ui/app/AppLayouts/Chat/panels/BadgeContentPanel.qml index 047f5b4c0c..04f060490f 100644 --- a/ui/app/AppLayouts/Chat/panels/BadgeContentPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/BadgeContentPanel.qml @@ -162,7 +162,6 @@ Item { Connections { enabled: realChatType === Constants.chatTypeOneToOne - // TODO use a store once it is available target: contactsModule.model.list onContactChanged: { if (pubkey === wrapper.chatId) { diff --git a/ui/app/AppLayouts/Chat/popups/community/CommunityProfilePopup.qml b/ui/app/AppLayouts/Chat/popups/community/CommunityProfilePopup.qml index 4916560aae..eed2985157 100644 --- a/ui/app/AppLayouts/Chat/popups/community/CommunityProfilePopup.qml +++ b/ui/app/AppLayouts/Chat/popups/community/CommunityProfilePopup.qml @@ -107,7 +107,6 @@ StatusModal { Component { id: membersList CommunityProfilePopupMembersListPanel { - // TODO assign the store on open store: root.store width: stack.width //% "Members" diff --git a/ui/app/AppLayouts/Profile/Sections/Contacts/ContactList.qml b/ui/app/AppLayouts/Profile/Sections/Contacts/ContactList.qml index 62a0f8ac58..099ad14998 100644 --- a/ui/app/AppLayouts/Profile/Sections/Contacts/ContactList.qml +++ b/ui/app/AppLayouts/Profile/Sections/Contacts/ContactList.qml @@ -61,7 +61,6 @@ ListView { BlockContactConfirmationDialog { id: blockContactConfirmationDialog onBlockButtonClicked: { - // TODO use a store once it is available contactsModule.blockContact(blockContactConfirmationDialog.contactAddress) blockContactConfirmationDialog.close() } @@ -75,7 +74,6 @@ ListView { //% "Are you sure you want to remove this contact?" confirmationText: qsTrId("are-you-sure-you-want-to-remove-this-contact-") onConfirmButtonClicked: { - // TODO use a store once it is available if (contactsModule.model.isAdded(removeContactConfirmationDialog.value)) { contactsModule.removeContact(removeContactConfirmationDialog.value); } diff --git a/ui/app/AppLayouts/Profile/panels/ContactsListPanel.qml b/ui/app/AppLayouts/Profile/panels/ContactsListPanel.qml index e565d7f5c9..1aca7908fb 100644 --- a/ui/app/AppLayouts/Profile/panels/ContactsListPanel.qml +++ b/ui/app/AppLayouts/Profile/panels/ContactsListPanel.qml @@ -20,6 +20,7 @@ ListView { property Component profilePopupComponent: ProfilePopup { id: profilePopup + store: contactList.store onClosed: destroy() }