Fix dummy subject on external one-to-one creation

This commit is contained in:
Julien Wadel 2021-08-17 18:10:10 +02:00
parent 13e677b4b2
commit d2f4a43d92
5 changed files with 26 additions and 29 deletions

View file

@ -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();
}

View file

@ -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;

View file

@ -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()

View file

@ -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
}

View file

@ -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