Lukáš Tinkl f5d6c538c2 chore: consolidate & refactor popup handling
- all remaining global popup components moved into a separate Popups
entity
- removed some static objects from the Global singleton (appMain,
pinnedMessagesPopup, communityProfilePopup, sounds); rationale:
singletons should not contain any state
- fixed support for popups in storybook
- fixed some warnings (most of them broke the popups in one way or the other)
2023-02-09 15:01:57 +01:00

73 lines
2.1 KiB
QML

import QtQuick 2.14
import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14
import utils 1.0
import "views"
import "stores"
import "popups/community"
StackLayout {
id: root
property var contactsStore
property RootStore rootStore: RootStore {
contactsStore: root.contactsStore
}
property alias chatView: chatView
signal importCommunityClicked()
signal createCommunityClicked()
onCurrentIndexChanged: {
Global.closeCreateChatView()
}
Component {
id: membershipRequestPopupComponent
MembershipRequestsPopup {
anchors.centerIn: parent
store: root.rootStore
communityData: store.mainModuleInst ? store.mainModuleInst.activeSection || {} : {}
onClosed: {
destroy()
}
}
}
ChatView {
id: chatView
contactsStore: root.contactsStore
rootStore: root.rootStore
membershipRequestPopup: membershipRequestPopupComponent
onCommunityInfoButtonClicked: root.currentIndex = 1
onCommunityManageButtonClicked: root.currentIndex = 1
onImportCommunityClicked: {
root.importCommunityClicked();
}
onCreateCommunityClicked: {
root.createCommunityClicked();
}
}
Loader {
active: root.rootStore.chatCommunitySectionModule.isCommunity()
sourceComponent: CommunitySettingsView {
rootStore: root.rootStore
hasAddedContacts: root.contactsStore.myContactsModel.count > 0
chatCommunitySectionModule: root.rootStore.chatCommunitySectionModule
community: root.rootStore.mainModuleInst ? root.rootStore.mainModuleInst.activeSection
|| ({}) : ({})
onBackToCommunityClicked: root.currentIndex = 0
// TODO: remove me when migration to new settings is done
onOpenLegacyPopupClicked: Global.openCommunityProfilePopupRequested(root.rootStore, community, chatCommunitySectionModule)
}
}
}