diff --git a/linphone-app/src/components/chat-room/ChatRoomModel.cpp b/linphone-app/src/components/chat-room/ChatRoomModel.cpp index 966b5d53c..8483baf50 100644 --- a/linphone-app/src/components/chat-room/ChatRoomModel.cpp +++ b/linphone-app/src/components/chat-room/ChatRoomModel.cpp @@ -388,7 +388,7 @@ QString ChatRoomModel::getUsername () const { QString username; if( !mChatRoom) return ""; - if( isGroupEnabled()) + if( !isOneToOne()) username = Utils::coreStringToAppString(mChatRoom->getSubject()); if(username != "") @@ -449,7 +449,7 @@ long ChatRoomModel::getEphemeralLifetime() const{ } bool ChatRoomModel::canBeEphemeral(){ - return mChatRoom && mChatRoom->hasCapability((int)linphone::ChatRoomCapabilities::Conference); + return isConference(); } bool ChatRoomModel::haveEncryption() const{ @@ -468,6 +468,15 @@ int ChatRoomModel::getSecurityLevel() const{ bool ChatRoomModel::isGroupEnabled() const{ return mChatRoom && mChatRoom->getCurrentParams()->groupEnabled(); } + +bool ChatRoomModel::isConference() const{ + return mChatRoom && mChatRoom->hasCapability((int)linphone::ChatRoomCapabilities::Conference); +} + +bool ChatRoomModel::isOneToOne() const{ + return mChatRoom && mChatRoom->hasCapability((int)linphone::ChatRoomCapabilities::OneToOne); +} + bool ChatRoomModel::isMeAdmin() const{ return mChatRoom->getMe()->isAdmin(); } diff --git a/linphone-app/src/components/chat-room/ChatRoomModel.hpp b/linphone-app/src/components/chat-room/ChatRoomModel.hpp index e6e3d823a..f8ae44a40 100644 --- a/linphone-app/src/components/chat-room/ChatRoomModel.hpp +++ b/linphone-app/src/components/chat-room/ChatRoomModel.hpp @@ -127,6 +127,8 @@ public: Q_PROPERTY(int securityLevel READ getSecurityLevel NOTIFY securityLevelChanged) Q_PROPERTY(bool groupEnabled READ isGroupEnabled NOTIFY groupEnabledChanged) + Q_PROPERTY(bool isConference READ isConference CONSTANT) + Q_PROPERTY(bool isOneToOne READ isOneToOne CONSTANT) Q_PROPERTY(bool haveEncryption READ haveEncryption CONSTANT) Q_PROPERTY(bool isMeAdmin READ isMeAdmin NOTIFY isMeAdminChanged) Q_PROPERTY(bool canHandleParticipants READ canHandleParticipants CONSTANT) @@ -185,6 +187,8 @@ public: Q_INVOKABLE bool isSecure() const; int getSecurityLevel() const; bool isGroupEnabled() const; + bool isConference() const; + bool isOneToOne() const; bool isMeAdmin() const; bool isCurrentProxy() const; // Return true if this chat room is Me() is the current proxy bool canHandleParticipants() const; diff --git a/linphone-app/src/components/timeline/TimelineModel.cpp b/linphone-app/src/components/timeline/TimelineModel.cpp index 113f337ec..b3b339900 100644 --- a/linphone-app/src/components/timeline/TimelineModel.cpp +++ b/linphone-app/src/components/timeline/TimelineModel.cpp @@ -98,6 +98,8 @@ void TimelineModel::setSelected(const bool& selected){ qInfo() << "Chat room selected : Subject :" << mChatRoomModel->getSubject() << ", Username:" << mChatRoomModel->getUsername() << ", GroupEnabled:"<< mChatRoomModel->isGroupEnabled() + << ", isConference:"<< mChatRoomModel->isConference() + << ", isOneToOne:"<< mChatRoomModel->isOneToOne() << ", Encrypted:"<< mChatRoomModel->haveEncryption() << ", ephemeralEnabled:" << mChatRoomModel->haveEncryption() << ", isAdmin:"<< mChatRoomModel->isMeAdmin() diff --git a/linphone-app/ui/modules/Linphone/Contact/Contact.qml b/linphone-app/ui/modules/Linphone/Contact/Contact.qml index acd818be2..874c08bae 100644 --- a/linphone-app/ui/modules/Linphone/Contact/Contact.qml +++ b/linphone-app/ui/modules/Linphone/Contact/Contact.qml @@ -83,7 +83,7 @@ Rectangle { icon:'chat_room' iconSize: ContactStyle.contentHeight - visible: entry!=undefined && entry.groupEnabled != undefined && entry.groupEnabled && entry.participants.count > 2 + visible: entry!=undefined && !entry.isOneToOne && entry.participants.count > 2 Icon{ anchors.right: parent.right @@ -102,29 +102,11 @@ Rectangle { Layout.fillWidth: true Layout.leftMargin: ContactStyle.spacing - //sipAddress: entry.sipAddress || entry.fullPeerAddress || entry.peerAddress || '' - //sipAddress: (entry && showContactAddress? entry.sipAddress : '') - - sipAddress: (entry && showContactAddress - ? (entry.groupEnabled != undefined && entry.groupEnabled - ? '' - : (entry.haveEncryption != undefined && entry.haveEncryption - ? '' - : entry.sipAddress || entry.fullPeerAddress || entry.peerAddress || '')) - : '') - participants: entry && showContactAddress && entry.groupEnabled != undefined && !entry.groupEnabled && entry.haveEncryption != undefined && entry.haveEncryption ? entry.participants.addressesToString : '' - /* - - sipAddress: (entry && showContactAddress? - (entry.contactModel != undefined ? - entry.contactModel.vcard.address - : (entry.groupEnabled != undefined && entry.groupEnabled ? 'no group': - (entry.haveEncryption != undefined && entry.haveEncryption? - entry.participants.addressesToString() - : entry.sipAddress || entry.fullPeerAddress || entry.peerAddress || '') - ) - ):'No show') - */ + sipAddress: (entry && item.showContactAddress + && entry.isOneToOne && (entry.haveEncryption == undefined || !entry.haveEncryption) + ? entry.sipAddress || entry.fullPeerAddress || entry.peerAddress || '' + : '') + participants: entry && item.showContactAddress && sipAddress == '' && entry.isOneToOne ? entry.participants.addressesToString : '' username: avatar.username } diff --git a/linphone-app/ui/views/App/Main/Conversation.qml b/linphone-app/ui/views/App/Main/Conversation.qml index 35d760c58..92bc00eb4 100644 --- a/linphone-app/ui/views/App/Main/Conversation.qml +++ b/linphone-app/ui/views/App/Main/Conversation.qml @@ -151,7 +151,7 @@ ColumnLayout { return chatRoomModel.sipAddress; } }else { - return conversation.sipAddress || conversation.fullPeerAddress || conversation.peerAddress || ''; + return conversation.fullPeerAddress || conversation.peerAddress || ''; } } @@ -236,13 +236,13 @@ ColumnLayout { icon: 'chat' visible: SettingsModel.chatEnabled && SettingsModel.getShowStartChatButton() && !conversation.haveMoreThanOneParticipants && conversation.securityLevel != 1 - onClicked: CallsListModel.launchChat(conversation.peerAddress, 0) + onClicked: CallsListModel.launchChat(chatRoomModel.participants.addressesToString, 0) } ActionButton { icon: 'chat' visible: SettingsModel.chatEnabled && SettingsModel.getShowStartChatButton() && !conversation.haveMoreThanOneParticipants && conversation.securityLevel == 1 && UtilsCpp.hasCapability(conversation.peerAddress, LinphoneEnums.FriendCapabilityLimeX3Dh) - onClicked: CallsListModel.launchChat(conversation.peerAddress, 1) + onClicked: CallsListModel.launchChat(chatRoomModel.participants.addressesToString, 1) Icon{ icon:'secure_level_1' iconSize:15