leave conversation

This commit is contained in:
Gaelle Braud 2025-07-28 16:52:53 +02:00
parent 3546287649
commit 2e0d963bd2
6 changed files with 921 additions and 832 deletions

View file

@ -166,7 +166,7 @@ void LimitProxy::displayMore() {
auto model = sourceModel(); auto model = sourceModel();
int newCount = getDisplayCount(model ? model->rowCount() : 0, mMaxDisplayItems + mDisplayItemsStep); int newCount = getDisplayCount(model ? model->rowCount() : 0, mMaxDisplayItems + mDisplayItemsStep);
if (newCount != oldCount) { if (newCount != oldCount) {
setMaxDisplayItems(mMaxDisplayItems + mDisplayItemsStep); setMaxDisplayItems(newCount);
} }
} }

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -364,6 +364,39 @@ ListView {
chatroomPopup.close() chatroomPopup.close()
} }
} }
Rectangle {
Layout.fillWidth: true
visible: mainItem.currentChatGui && !mainItem.currentChatGui.core.isReadOnly
Layout.preferredHeight: Math.min(1, Math.round(1 * DefaultStyle.dp))
color: DefaultStyle.main2_400
}
IconLabelButton {
//: "leave"
text: qsTr("chat_room_leave")
visible: mainItem.currentChatGui && !mainItem.currentChatGui.core.isReadOnly
icon.source: AppIcons.trashCan
spacing: Math.round(10 * DefaultStyle.dp)
Layout.fillWidth: true
onClicked: {
//: leave the conversation ?
mainWindow.showConfirmationLambdaPopup(qsTr("chat_list_leave_chat_popup_title"),
//: You will not be able to send or receive messages in this conversation anymore. Do You want to continue ?
qsTr("chat_list_leave_chat_popup_message"),
"",
function(confirmed) {
if (confirmed) {
modelData.core.lLeave()
chatroomPopup.close()
}
})
}
style: ButtonStyle.hoveredBackground
}
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: Math.min(1, Math.round(1 * DefaultStyle.dp))
color: DefaultStyle.main2_400
}
IconLabelButton { IconLabelButton {
//: "Delete" //: "Delete"
text: qsTr("chat_room_delete") text: qsTr("chat_room_delete")

View file

@ -97,6 +97,8 @@ ListView {
chatGui: mainItem.chat chatGui: mainItem.chat
// scroll when in view and message inserted // scroll when in view and message inserted
filterText: mainItem.filterText filterText: mainItem.filterText
initialDisplayItems: 10
displayItemsStep: 3 * initialDisplayItems / 2
onEventInserted: (index, gui) => { onEventInserted: (index, gui) => {
if (!mainItem.visible) return if (!mainItem.visible) return
if(mainItem.lastItemVisible) mainItem.positionViewAtIndex(index, ListView.End) if(mainItem.lastItemVisible) mainItem.positionViewAtIndex(index, ListView.End)