mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-01 17:27:53 +00:00
feat: edit group name
This commit is contained in:
parent
de5d542b8e
commit
b842925ba4
@ -129,5 +129,8 @@ QtObject:
|
||||
self.activeChannel.setChatItem(chat)
|
||||
self.activeChannelChanged()
|
||||
|
||||
proc renameGroup*(self: ChatsView, newName: string) {.slot.} =
|
||||
self.status.chat.renameGroup(self.activeChannel.id, newName)
|
||||
|
||||
proc blockContact*(self: ChatsView, id: string): string {.slot.} =
|
||||
return self.status.chat.blockContact(id)
|
||||
|
@ -168,3 +168,7 @@ proc blockContact*(self: ChatModel, id: string): string =
|
||||
contact.systemTags.add(":contact/blocked")
|
||||
result = status_chat.blockContact(contact)
|
||||
|
||||
proc renameGroup*(self: ChatModel, chatId: string, newName: string) =
|
||||
var response = parseJson(status_chat.renameGroup(chatId, newName))
|
||||
var (chats, messages) = formatChatUpdate(response)
|
||||
self.events.emit("chatUpdate", ChatUpdateArgs(messages: messages, chats: chats))
|
||||
|
@ -124,3 +124,6 @@ proc confirmJoiningGroup*(chatId: string): string =
|
||||
|
||||
proc leaveGroupChat*(chatId: string): string =
|
||||
callPrivateRPC("leaveGroupChat".prefix, %* [nil, chatId, true])
|
||||
|
||||
proc renameGroup*(chatId: string, newName: string): string =
|
||||
callPrivateRPC("changeGroupChatName".prefix, %* [nil, chatId, newName])
|
||||
|
@ -14,6 +14,7 @@ ScrollView {
|
||||
|
||||
property var messageList: MessagesData {}
|
||||
property bool loadingMessages: false
|
||||
property real scrollY: chatLogView.visibleArea.yPosition * chatLogView.contentHeight
|
||||
|
||||
contentItem: chatLogView
|
||||
anchors.fill: parent
|
||||
@ -26,6 +27,7 @@ ScrollView {
|
||||
ListView {
|
||||
anchors.fill: parent
|
||||
spacing: 4
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
id: chatLogView
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
@ -61,6 +61,43 @@ ModalPopup {
|
||||
color: Theme.darkGrey
|
||||
font.family: "Inter"
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: editGroupNameBtn
|
||||
visible: true // TODO: only show this if the current user is admin
|
||||
height: 24
|
||||
width: 24
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: Theme.padding
|
||||
anchors.leftMargin: 4
|
||||
anchors.left: groupName.right
|
||||
radius: 8
|
||||
|
||||
Image {
|
||||
id: editGroupImg
|
||||
source: "../../../img/edit-group.svg"
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: closeModalMouseArea
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onExited: {
|
||||
editGroupNameBtn.color = Theme.white
|
||||
}
|
||||
onEntered: {
|
||||
editGroupNameBtn.color = Theme.grey
|
||||
}
|
||||
onClicked: renameGroupPopup.open()
|
||||
}
|
||||
}
|
||||
|
||||
RenameGroupPopup {
|
||||
id: renameGroupPopup
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
85
ui/app/AppLayouts/Chat/components/RenameGroupPopup.qml
Normal file
85
ui/app/AppLayouts/Chat/components/RenameGroupPopup.qml
Normal file
@ -0,0 +1,85 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.3
|
||||
import QtQuick.Layouts 1.3
|
||||
import "../../../../imports"
|
||||
import "../../../../shared"
|
||||
import "./"
|
||||
|
||||
Popup {
|
||||
id: popup
|
||||
modal: true
|
||||
|
||||
Overlay.modal: Rectangle {
|
||||
color: "#60000000"
|
||||
}
|
||||
|
||||
onOpened: {
|
||||
groupName.forceActiveFocus(Qt.MouseFocusReason)
|
||||
groupName.text = chatsModel.activeChannel.name
|
||||
}
|
||||
|
||||
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
|
||||
parent: Overlay.overlay
|
||||
x: Math.round((parent.width - width) / 2)
|
||||
y: Math.round((parent.height - height) / 2)
|
||||
width: 480
|
||||
height: 159
|
||||
background: Rectangle {
|
||||
color: Theme.white
|
||||
radius: 8
|
||||
}
|
||||
padding: 0
|
||||
|
||||
contentItem: Item {
|
||||
Text {
|
||||
id: groupTitleLabel
|
||||
text: qsTr("Group name")
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
font.pixelSize: 13
|
||||
anchors.leftMargin: 16
|
||||
anchors.topMargin: Theme.padding
|
||||
anchors.bottomMargin: Theme.padding
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: groupNameBox
|
||||
height: 44
|
||||
color: Theme.grey
|
||||
anchors.top: groupTitleLabel.bottom
|
||||
radius: 8
|
||||
anchors.right: parent.right
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Theme.padding
|
||||
anchors.rightMargin: Theme.padding
|
||||
anchors.topMargin: 7
|
||||
|
||||
TextField {
|
||||
id: groupName
|
||||
placeholderText: qsTr("Group Name")
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
font.pixelSize: 15
|
||||
background: Rectangle {
|
||||
color: "#00000000"
|
||||
}
|
||||
width: groupNameBox.width - 32
|
||||
selectByMouse: true
|
||||
}
|
||||
}
|
||||
|
||||
StyledButton {
|
||||
id: saveBtn
|
||||
anchors.top: groupNameBox.bottom
|
||||
anchors.topMargin: 22
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Theme.padding
|
||||
label: qsTr("Save")
|
||||
onClicked : {
|
||||
chatsModel.renameGroup(groupName.text)
|
||||
popup.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -4,3 +4,4 @@ PrivateChatPopup 1.0 PrivateChatPopup.qml
|
||||
GroupInfoPopup 1.0 GroupInfoPopup.qml
|
||||
ProfilePropup 1.0 ProfilePopup.qml
|
||||
ChannelIcon 1.0 ChannelIcon.qml
|
||||
RenameGroupPopup 1.0 RenameGroupPopup.qml
|
4
ui/app/img/edit-group.svg
Normal file
4
ui/app/img/edit-group.svg
Normal file
@ -0,0 +1,4 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M2.10095 13.5959L2.79836 10.8062C2.83059 10.6773 2.87123 10.5512 2.91985 10.4285C2.98171 10.2724 3.18145 10.2423 3.30017 10.361L5.63897 12.6998C5.75769 12.8185 5.7276 13.0183 5.57152 13.0801C5.44883 13.1288 5.32266 13.1694 5.19376 13.2016L2.40412 13.899C2.22103 13.9448 2.05518 13.779 2.10095 13.5959Z" fill="black"/>
|
||||
<path d="M6.32312 11.2627C6.71364 11.6532 7.34681 11.6532 7.73733 11.2627L14.2928 4.7072C14.6833 4.31668 14.6833 3.68351 14.2928 3.29299L12.707 1.7072C12.3165 1.31668 11.6833 1.31668 11.2928 1.7072L4.73733 8.26266C4.34681 8.65318 4.34681 9.28635 4.73733 9.67687L6.32312 11.2627Z" fill="black"/>
|
||||
</svg>
|
After Width: | Height: | Size: 725 B |
@ -68,6 +68,7 @@ DISTFILES += \
|
||||
app/AppLayouts/Chat/ContactsColumn/qmldir \
|
||||
app/AppLayouts/Chat/components/PublicChatPopup.qml \
|
||||
app/AppLayouts/Chat/components/PrivateChatPopup.qml \
|
||||
app/AppLayouts/Chat/components/RenameGroupPopup.qml \
|
||||
app/AppLayouts/Chat/components/SuggestedChannel.qml \
|
||||
app/AppLayouts/Chat/components/qmldir \
|
||||
app/AppLayouts/Chat/qmldir \
|
||||
|
Loading…
x
Reference in New Issue
Block a user