mirror of
https://github.com/savoirfairelinux/jami-client-qt.git
synced 2025-12-19 10:20:17 +08:00
conversation: add ended banner
Change-Id: I4e58f8da33a2776b6f2cdc15b4f8f11ad8f88482
This commit is contained in:
committed by
Adrien Béraud
parent
d8f548261d
commit
faba758254
@@ -45,6 +45,7 @@ Rectangle {
|
|||||||
color: JamiTheme.chatviewBgColor
|
color: JamiTheme.chatviewBgColor
|
||||||
|
|
||||||
property var mapPositions: PositionManager.mapStatus
|
property var mapPositions: PositionManager.mapStatus
|
||||||
|
property bool isConversationEndedFlag: false
|
||||||
|
|
||||||
// The purpose of this alias is to make the message bar
|
// The purpose of this alias is to make the message bar
|
||||||
// accessible to the EmojiPicker
|
// accessible to the EmojiPicker
|
||||||
@@ -85,6 +86,32 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isConversationEnded() {
|
||||||
|
if (!CurrentConversation.isSwarm)
|
||||||
|
return false;
|
||||||
|
var myRole = UtilsAdapter.getParticipantRole(CurrentAccount.id, CurrentConversation.id, CurrentAccount.uri);
|
||||||
|
var info = ConversationsAdapter.getConvInfoMap(CurrentConversation.id);
|
||||||
|
var peers = info && info.uris ? info.uris : [];
|
||||||
|
peers = peers.filter(function(u) { return u !== CurrentAccount.uri; });
|
||||||
|
for (var i = 0; i < peers.length; i++) {
|
||||||
|
var role = UtilsAdapter.getParticipantRole(CurrentAccount.id, CurrentConversation.id, peers[i]);
|
||||||
|
if (!(role === Member.Role.LEFT || role === Member.Role.BANNED)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CurrentConversation.isCoreDialog) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return myRole !== Member.Role.ADMIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateConversationEndedFlag() {
|
||||||
|
var newVal = isConversationEnded();
|
||||||
|
if (isConversationEndedFlag !== newVal) {
|
||||||
|
isConversationEndedFlag = newVal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Used externally to switch to a extras panel.
|
// Used externally to switch to a extras panel.
|
||||||
function switchToPanel(panel, toggle = true) {
|
function switchToPanel(panel, toggle = true) {
|
||||||
extrasPanel.switchToPanel(panel, toggle);
|
extrasPanel.switchToPanel(panel, toggle);
|
||||||
@@ -102,16 +129,33 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: LRCInstance
|
||||||
|
function onConversationUpdated(convId, accountId) {
|
||||||
|
if (convId === CurrentConversation.id) {
|
||||||
|
updateConversationEndedFlag();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Connections {
|
||||||
|
target: CurrentConversation.members
|
||||||
|
function onCountChanged() {
|
||||||
|
updateConversationEndedFlag();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: CurrentConversation
|
target: CurrentConversation
|
||||||
function onIdChanged() {
|
function onIdChanged() {
|
||||||
MessagesAdapter.loadMoreMessages();
|
MessagesAdapter.loadMoreMessages();
|
||||||
|
updateConversationEndedFlag();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
chatViewSplitView.resolvePanes(true);
|
chatViewSplitView.resolvePanes(true);
|
||||||
|
Qt.callLater(updateConversationEndedFlag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,6 +240,29 @@ Rectangle {
|
|||||||
visible: false
|
visible: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Control {
|
||||||
|
id: conversationEndedBanner
|
||||||
|
Layout.fillWidth: true
|
||||||
|
visible: isConversationEndedFlag
|
||||||
|
|
||||||
|
padding: 10
|
||||||
|
background: Rectangle {
|
||||||
|
color: JamiTheme.infoRectangleColor
|
||||||
|
radius: 5
|
||||||
|
}
|
||||||
|
contentItem: RowLayout {
|
||||||
|
spacing: 8
|
||||||
|
Label {
|
||||||
|
text: JamiStrings.conversationEnded
|
||||||
|
color: JamiTheme.textColor
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NotificationArea {
|
NotificationArea {
|
||||||
id: notificationArea
|
id: notificationArea
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@@ -333,6 +400,8 @@ Rectangle {
|
|||||||
return false;
|
return false;
|
||||||
else if (CurrentConversation.isRequest)
|
else if (CurrentConversation.isRequest)
|
||||||
return false;
|
return false;
|
||||||
|
else if (isConversationEndedFlag)
|
||||||
|
return false;
|
||||||
return CurrentConversation.isSwarm || CurrentConversation.isTemporary;
|
return CurrentConversation.isSwarm || CurrentConversation.isTemporary;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -368,6 +368,9 @@ Item {
|
|||||||
property string deletedMedia: qsTr("%1 deleted a media")
|
property string deletedMedia: qsTr("%1 deleted a media")
|
||||||
property string returnToCall: qsTr("Return to call")
|
property string returnToCall: qsTr("Return to call")
|
||||||
|
|
||||||
|
// Conversation ended banner
|
||||||
|
property string conversationEnded: qsTr("This conversation has ended.")
|
||||||
|
|
||||||
// MessagesResearch
|
// MessagesResearch
|
||||||
property string jumpTo: qsTr("Jump to")
|
property string jumpTo: qsTr("Jump to")
|
||||||
property string messages: qsTr("Messages")
|
property string messages: qsTr("Messages")
|
||||||
|
|||||||
Reference in New Issue
Block a user