chore(@desktop/chat): remove legacy GroupInfoPopup
This commit is contained in:
parent
740c5c3874
commit
655af35958
|
@ -1,286 +0,0 @@
|
|||
import QtQuick 2.13
|
||||
import QtQuick.Controls 2.13
|
||||
import QtQuick.Layouts 1.13
|
||||
|
||||
import StatusQ.Controls 0.1
|
||||
import StatusQ.Components 0.1
|
||||
import StatusQ.Popups 0.1
|
||||
import StatusQ.Core 0.1
|
||||
import StatusQ.Core.Theme 0.1
|
||||
|
||||
import utils 1.0
|
||||
|
||||
import shared.views 1.0
|
||||
import shared.panels 1.0
|
||||
import shared.status 1.0
|
||||
|
||||
import "../panels"
|
||||
|
||||
StatusModal {
|
||||
id: popup
|
||||
|
||||
enum ChannelType {
|
||||
ActiveChannel,
|
||||
ContextChannel
|
||||
}
|
||||
property var chatSectionModule
|
||||
property var store
|
||||
property var messageStore
|
||||
property bool addMembers: false
|
||||
property int currMemberCount: chatContentModule.usersModule.model.count
|
||||
property int memberCount: 1
|
||||
|
||||
property int channelType: GroupInfoPopup.ChannelType.ActiveChannel
|
||||
property var chatDetails
|
||||
property bool isAdmin: popup.chatSectionModule.activeItem.amIChatAdmin
|
||||
|
||||
property var chatContentModule
|
||||
|
||||
readonly property int maxMembers: 20
|
||||
|
||||
function resetSelectedMembers() {
|
||||
contactList.selectedPubKeys = []
|
||||
|
||||
memberCount = popup.chatContentModule.usersModule.model.count
|
||||
}
|
||||
|
||||
function doAddMembers() {
|
||||
if (popup.chatDetails.id && contactList.selectedPubKeys.length > 0) {
|
||||
popup.chatSectionModule.addGroupMembers(popup.chatDetails.id, JSON.stringify(contactList.selectedPubKeys));
|
||||
}
|
||||
popup.close();
|
||||
}
|
||||
|
||||
height: 504
|
||||
anchors.centerIn: parent
|
||||
|
||||
header.title: addMembers ? qsTr("Add members") : (popup.chatDetails ? popup.chatDetails.name : "")
|
||||
header.subTitle: {
|
||||
if (addMembers) {
|
||||
return qsTr("%1/%2 members").arg(memberCount).arg(maxMembers)
|
||||
} else {
|
||||
if (currMemberCount > 1) {
|
||||
return qsTr("%1 members").arg(currMemberCount);
|
||||
}
|
||||
return qsTr("1 member");
|
||||
}
|
||||
}
|
||||
header.editable: !addMembers
|
||||
header.asset.isLetterIdenticon: (popup.chatDetails.icon === "")
|
||||
header.asset.name: (popup.chatDetails.icon !== "") ? popup.chatDetails.icon : popup.chatDetails.name
|
||||
header.asset.isImage: (popup.chatDetails.icon !== "")
|
||||
header.asset.bgColor: popup.chatDetails ? popup.chatDetails.color : "transparent"
|
||||
|
||||
onEditButtonClicked: renameGroupPopup.open()
|
||||
|
||||
onClosed: {
|
||||
chatSectionModule.clearMyContacts()
|
||||
popup.destroy();
|
||||
}
|
||||
|
||||
onOpened: {
|
||||
chatSectionModule.populateMyContacts(popup.chatContentModule.usersModule.getMembersPublicKeys())
|
||||
|
||||
addMembers = false;
|
||||
|
||||
btnSelectMembers.enabled = false;
|
||||
resetSelectedMembers();
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: addMembersItem
|
||||
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: Style.current.halfPadding
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
width: parent.width - 2 * Style.current.padding
|
||||
height: parent.height
|
||||
|
||||
visible: addMembers
|
||||
|
||||
spacing: Style.current.padding
|
||||
|
||||
StatusInput {
|
||||
id: searchBox
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignTop
|
||||
maximumHeight: 36
|
||||
placeholderText: qsTr("Search")
|
||||
input.placeholderFont.pixelSize: 15
|
||||
input.asset.name: "search"
|
||||
input.asset.width: 17
|
||||
input.asset.height: 17
|
||||
topPadding: 0
|
||||
bottomPadding: 0
|
||||
}
|
||||
|
||||
NoFriendsRectangle {
|
||||
Layout.preferredHeight: childrenRect.height
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.bottomMargin: childrenRect.height
|
||||
|
||||
visible: popup.store.contactsStore.myContactsModel.count === 0
|
||||
}
|
||||
|
||||
NoFriendsRectangle {
|
||||
Layout.preferredHeight: childrenRect.height
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.bottomMargin: childrenRect.height
|
||||
|
||||
visible: chatSectionModule.listOfMyContacts.count === 0
|
||||
text: qsTr("All your contacts are already in the group")
|
||||
textColor: Style.current.textColor
|
||||
}
|
||||
|
||||
ContactListPanel {
|
||||
id: contactList
|
||||
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
|
||||
visible: popup.addMembers && chatSectionModule.listOfMyContacts.count > 0
|
||||
model: chatSectionModule.listOfMyContacts
|
||||
selectMode: memberCount < maxMembers
|
||||
searchString: searchBox.text.toLowerCase()
|
||||
onSelectedPubKeysChanged: {
|
||||
memberCount = popup.chatContentModule.usersModule.model.count + selectedPubKeys.length;
|
||||
btnSelectMembers.enabled = selectedPubKeys.length > 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: groupInfoItem
|
||||
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: Style.current.padding
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
width: parent.width - 2*Style.current.padding
|
||||
height: parent.height - 2*Style.current.padding
|
||||
|
||||
visible: !addMembers
|
||||
spacing: Style.current.padding
|
||||
|
||||
StatusSettingsLineButton {
|
||||
property int pinnedCount: popup.chatContentModule.pinnedMessagesModel.count
|
||||
|
||||
id: pinnedMessagesBtn
|
||||
visible: pinnedCount > 0
|
||||
text: qsTr("Pinned messages")
|
||||
currentValue: pinnedCount
|
||||
onClicked: {
|
||||
popup.store.messageStore.messageModule = popup.chatContentModule.messagesModule
|
||||
popup.store.messageStore.chatSectionModule = popup.chatSectionModule
|
||||
|
||||
Global.openPopup(Global.pinnedMessagesPopup, {
|
||||
store: popup.store,
|
||||
messageStore: popup.store.messageStore,
|
||||
pinnedMessagesModel: popup.chatContentModule.pinnedMessagesModel,
|
||||
messageToPin: ""
|
||||
})
|
||||
}
|
||||
iconSource: Style.svg("pin")
|
||||
anchors.left: undefined
|
||||
anchors.right: undefined
|
||||
width: parent.width
|
||||
}
|
||||
|
||||
Separator {
|
||||
id: separator2
|
||||
visible: pinnedMessagesBtn.visible
|
||||
}
|
||||
|
||||
StatusListView {
|
||||
id: memberList
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
model: popup.chatContentModule.usersModule.model
|
||||
delegate: StatusListItem {
|
||||
id: contactRow
|
||||
|
||||
title: model.displayName
|
||||
statusListItemTitle.font.pixelSize: 17
|
||||
statusListItemTitleAside.font.pixelSize: 17
|
||||
label: model.isAdmin ? qsTr("Admin"): ""
|
||||
asset.name: model.icon
|
||||
asset.isImage: !!model.icon
|
||||
ringSettings.ringSpecModel: Utils.getColorHashAsJson(model.pubKey)
|
||||
asset.color: Utils.colorForColorId(model.colorId)
|
||||
asset.charactersLen: 2
|
||||
asset.isLetterIdenticon: model.icon === ""
|
||||
asset.height: asset.isLetterIdenticon ? 40 : 20
|
||||
asset.width: asset.isLetterIdenticon ? 40 : 20
|
||||
components: [
|
||||
StatusFlatRoundButton {
|
||||
id: moreActionsBtn
|
||||
type: StatusFlatRoundButton.Type.Tertiary
|
||||
color: "transparent"
|
||||
icon.name: "more"
|
||||
icon.color: Theme.palette.baseColor1
|
||||
visible: !model.isAdmin && popup.isAdmin
|
||||
onClicked: {
|
||||
contextMenu.popup(-contextMenu.width / 2 + moreActionsBtn.width / 2, moreActionsBtn.height + 10)
|
||||
}
|
||||
StatusPopupMenu {
|
||||
id: contextMenu
|
||||
StatusMenuItem {
|
||||
icon.name: "remove-contact"
|
||||
icon.width: 16
|
||||
icon.height: 16
|
||||
type: StatusMenuItem.Type.Danger
|
||||
text: qsTr("Remove From Group")
|
||||
onTriggered: popup.chatSectionModule.removeMemberFromGroupChat("", popup.chatDetails.id, model.pubKey)
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
onTitleClicked: {
|
||||
Global.openProfilePopup(model.pubKey, popup)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
leftButtons: [
|
||||
StatusBackButton {
|
||||
visible: popup.addMembers
|
||||
onClicked: {
|
||||
popup.addMembers = false;
|
||||
popup.resetSelectedMembers();
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
rightButtons: [
|
||||
StatusButton {
|
||||
visible: !popup.addMembers
|
||||
text: qsTr("Add members")
|
||||
onClicked: {
|
||||
popup.addMembers = true;
|
||||
}
|
||||
},
|
||||
StatusButton {
|
||||
id: btnSelectMembers
|
||||
visible: popup.addMembers
|
||||
enabled: popup.memberCount >= popup.currMemberCount
|
||||
text: qsTr("Add selected")
|
||||
onClicked: popup.doAddMembers()
|
||||
}
|
||||
]
|
||||
|
||||
RenameGroupPopup {
|
||||
id: renameGroupPopup
|
||||
activeGroupName: popup.chatDetails ? popup.chatDetails.name : ""
|
||||
activeGroupColor: popup.chatDetails ? popup.chatDetails.color: ""
|
||||
activeGroupImageData: popup.chatDetails ? popup.chatDetails.icon: ""
|
||||
onUpdateGroupChatDetails: {
|
||||
popup.chatSectionModule.updateGroupChatDetails(popup.chatSectionModule.activeItem.id, groupName, groupColor, groupImage)
|
||||
popup.header.title = groupName
|
||||
close()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,7 +19,6 @@ QtObject {
|
|||
property string createChatStickerPackId: ""
|
||||
property string createChatStickerUrl: ""
|
||||
|
||||
property var groupInfoPopupComponent
|
||||
property var membershipRequestPopup
|
||||
property var contactsModel: root.contactsStore.myContactsModel
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ StatusPopupMenu {
|
|||
property var emojiPopup
|
||||
|
||||
signal displayProfilePopup(string publicKey)
|
||||
signal displayGroupInfoPopup(string chatId)
|
||||
signal requestAllHistoricMessages(string chatId)
|
||||
signal unmuteChat(string chatId)
|
||||
signal muteChat(string chatId)
|
||||
|
@ -54,13 +53,6 @@ StatusPopupMenu {
|
|||
onTriggered: root.displayProfilePopup(root.chatId)
|
||||
}
|
||||
|
||||
StatusMenuItem {
|
||||
text: qsTr("View Members")
|
||||
icon.name: "group-chat"
|
||||
enabled: root.chatType === Constants.chatType.privateGroupChat
|
||||
onTriggered: root.displayGroupInfoPopup(root.chatId)
|
||||
}
|
||||
|
||||
StatusMenuItem {
|
||||
text: root.amIChatAdmin ? qsTr("Add / remove from group") : qsTr("Add to group")
|
||||
icon.name: "add-to-dm"
|
||||
|
|
|
@ -204,13 +204,6 @@ RowLayout {
|
|||
Global.openProfilePopup(publicKey)
|
||||
}
|
||||
|
||||
onDisplayGroupInfoPopup: {
|
||||
Global.openPopup(root.rootStore.groupInfoPopupComponent, {
|
||||
chatContentModule: chatContentModule,
|
||||
chatDetails: chatContentModule.chatDetails
|
||||
})
|
||||
}
|
||||
|
||||
onEditCommunityChannel: {
|
||||
root.rootStore.editCommunityChannel(
|
||||
chatId,
|
||||
|
@ -321,16 +314,11 @@ RowLayout {
|
|||
return false
|
||||
|
||||
return chatContentModule.chatDetails.type !== Constants.chatType.publicChat &&
|
||||
chatContentModule.chatDetails.type !== Constants.chatType.communityChat
|
||||
chatContentModule.chatDetails.type !== Constants.chatType.communityChat &&
|
||||
chatContentModule.chatDetails.type !== Constants.chatType.privateGroupChat
|
||||
}
|
||||
onClicked: {
|
||||
switch (chatContentModule.chatDetails.type) {
|
||||
case Constants.chatType.privateGroupChat:
|
||||
Global.openPopup(root.rootStore.groupInfoPopupComponent, {
|
||||
chatContentModule: chatContentModule,
|
||||
chatDetails: chatContentModule.chatDetails
|
||||
})
|
||||
break;
|
||||
case Constants.chatType.oneToOne:
|
||||
Global.openProfilePopup(chatContentModule.chatDetails.id)
|
||||
break;
|
||||
|
|
|
@ -166,14 +166,6 @@ StatusSectionLayout {
|
|||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: groupInfoPopupComponent
|
||||
GroupInfoPopup {
|
||||
chatSectionModule: root.rootStore.chatCommunitySectionModule
|
||||
store: root.rootStore
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: statusStickerPackClickPopup
|
||||
StatusStickerPackClickPopup{
|
||||
|
@ -212,10 +204,6 @@ StatusSectionLayout {
|
|||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
rootStore.groupInfoPopupComponent = groupInfoPopupComponent;
|
||||
}
|
||||
|
||||
ActivityCenterPopup {
|
||||
id: activityCenter
|
||||
y: 56
|
||||
|
|
|
@ -357,15 +357,6 @@ Item {
|
|||
Global.openProfilePopup(publicKey)
|
||||
}
|
||||
|
||||
onDisplayGroupInfoPopup: {
|
||||
communitySectionModule.prepareChatContentModuleForChatId(chatId)
|
||||
let chatContentModule = communitySectionModule.getChatContentModule()
|
||||
Global.openPopup(root.store.groupInfoPopupComponent, {
|
||||
chatContentModule: chatContentModule,
|
||||
chatDetails: chatContentModule.chatDetails
|
||||
})
|
||||
}
|
||||
|
||||
onEditCommunityChannel: {
|
||||
communitySectionModule.editCommunityChannel(
|
||||
chatId,
|
||||
|
|
|
@ -226,14 +226,6 @@ Item {
|
|||
onLeaveGroup: {
|
||||
chatSectionModule.leaveChat("", chatId, true);
|
||||
}
|
||||
onDisplayGroupInfoPopup: {
|
||||
chatSectionModule.prepareChatContentModuleForChatId(chatId)
|
||||
let chatContentModule = chatSectionModule.getChatContentModule()
|
||||
Global.openPopup(root.store.groupInfoPopupComponent, {
|
||||
chatContentModule: chatContentModule,
|
||||
chatDetails: chatContentModule.chatDetails
|
||||
})
|
||||
}
|
||||
onUpdateGroupChatDetails: {
|
||||
chatSectionModule.updateGroupChatDetails(
|
||||
chatId,
|
||||
|
|
Loading…
Reference in New Issue