- Add an option to enable standard and secure chats feature ('app' section)

- Fix history buttons that should not appear if chat room mode is not activated
- Allow to use a secure chat room to be used when calling (set by context : encrypted call/secure chat enabled)
- Replace a warning log by info while creating a chat room.
- Fix missing qml variables.
- Change Contact Edit and SIP Addresses selections to start a standard chat or a secure one.
- Simplify encryption activation on call parameters with enableEncryption()
This commit is contained in:
Julien Wadel 2021-10-20 19:22:52 +02:00
parent aa745fa44c
commit 3a560324f8
35 changed files with 247 additions and 62 deletions

View file

@ -753,6 +753,11 @@ Server url ikke konfigureret.</translation>
<source>tooltipShowConversation</source>
<translation>Vis samtale</translation>
</message>
<message>
<source>missingConferenceURI</source>
<extracomment>&apos;You need to set the conference URI in your account settings to create a conference based chat room.&apos; : Tooltip to warn the user that a setting is missing in its configuration.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Contacts</name>

View file

@ -753,6 +753,11 @@ Server URL ist nicht konfiguriert.</translation>
<source>tooltipShowConversation</source>
<translation>Konversation anzeigen</translation>
</message>
<message>
<source>missingConferenceURI</source>
<extracomment>&apos;You need to set the conference URI in your account settings to create a conference based chat room.&apos; : Tooltip to warn the user that a setting is missing in its configuration.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Contacts</name>

View file

@ -753,6 +753,11 @@ Server URL not configured.</translation>
<source>tooltipShowConversation</source>
<translation>Show conversation</translation>
</message>
<message>
<source>missingConferenceURI</source>
<extracomment>&apos;You need to set the conference URI in your account settings to create a conference based chat room.&apos; : Tooltip to warn the user that a setting is missing in its configuration.</extracomment>
<translation type="unfinished">You need to set the conference URI in your account settings to create a conference based chat room.</translation>
</message>
</context>
<context>
<name>Contacts</name>

View file

@ -753,6 +753,11 @@ URL del servidor no configurada.</translation>
<source>tooltipShowConversation</source>
<translation>Mostrar conversación</translation>
</message>
<message>
<source>missingConferenceURI</source>
<extracomment>&apos;You need to set the conference URI in your account settings to create a conference based chat room.&apos; : Tooltip to warn the user that a setting is missing in its configuration.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Contacts</name>

View file

@ -753,6 +753,11 @@ URL du serveur non configurée.</translation>
<source>tooltipShowConversation</source>
<translation>Aller à la conversation</translation>
</message>
<message>
<source>missingConferenceURI</source>
<extracomment>&apos;You need to set the conference URI in your account settings to create a conference based chat room.&apos; : Tooltip to warn the user that a setting is missing in its configuration.</extracomment>
<translation type="unfinished">Vous devez définir l&apos;URI de la conférence dans les paramètres de votre compte pour créer une conférence.</translation>
</message>
</context>
<context>
<name>Contacts</name>

View file

@ -748,6 +748,11 @@ A kiszolgáló URL-je nincs konfigurálva.</translation>
<source>tooltipShowConversation</source>
<translation>Beszélgetés megjelenítése</translation>
</message>
<message>
<source>missingConferenceURI</source>
<extracomment>&apos;You need to set the conference URI in your account settings to create a conference based chat room.&apos; : Tooltip to warn the user that a setting is missing in its configuration.</extracomment>
<translation type="unfinished">Konferenciaalapú csevegőszoba létrehozásához be kell állítania a konferencia URI-címét a fiókbeállításokban.</translation>
</message>
</context>
<context>
<name>Contacts</name>

View file

@ -753,6 +753,11 @@ URL del server non configurato.</translation>
<source>tooltipShowConversation</source>
<translation>Mostra conversazione</translation>
</message>
<message>
<source>missingConferenceURI</source>
<extracomment>&apos;You need to set the conference URI in your account settings to create a conference based chat room.&apos; : Tooltip to warn the user that a setting is missing in its configuration.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Contacts</name>

View file

@ -748,6 +748,11 @@
<source>tooltipShowConversation</source>
<translation></translation>
</message>
<message>
<source>missingConferenceURI</source>
<extracomment>&apos;You need to set the conference URI in your account settings to create a conference based chat room.&apos; : Tooltip to warn the user that a setting is missing in its configuration.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Contacts</name>

View file

@ -758,6 +758,11 @@ Nesukonfigūruotas serverio url.</translation>
<source>tooltipShowConversation</source>
<translation>Rodyti pokalbį</translation>
</message>
<message>
<source>missingConferenceURI</source>
<extracomment>&apos;You need to set the conference URI in your account settings to create a conference based chat room.&apos; : Tooltip to warn the user that a setting is missing in its configuration.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Contacts</name>

View file

@ -753,6 +753,11 @@ URL do servidor não configurado.</translation>
<source>tooltipShowConversation</source>
<translation>Mostrar conversa</translation>
</message>
<message>
<source>missingConferenceURI</source>
<extracomment>&apos;You need to set the conference URI in your account settings to create a conference based chat room.&apos; : Tooltip to warn the user that a setting is missing in its configuration.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Contacts</name>

View file

@ -758,6 +758,11 @@
<source>tooltipShowConversation</source>
<translation>Показать разговор</translation>
</message>
<message>
<source>missingConferenceURI</source>
<extracomment>&apos;You need to set the conference URI in your account settings to create a conference based chat room.&apos; : Tooltip to warn the user that a setting is missing in its configuration.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Contacts</name>

View file

@ -753,6 +753,11 @@ Serverwebbadressen är inte konfigurerad.</translation>
<source>tooltipShowConversation</source>
<translation>Visa konversation</translation>
</message>
<message>
<source>missingConferenceURI</source>
<extracomment>&apos;You need to set the conference URI in your account settings to create a conference based chat room.&apos; : Tooltip to warn the user that a setting is missing in its configuration.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Contacts</name>

View file

@ -748,6 +748,11 @@ Sunucu url&apos;si yapılandırılmadı.</translation>
<source>tooltipShowConversation</source>
<translation>Sohbeti göster</translation>
</message>
<message>
<source>missingConferenceURI</source>
<extracomment>&apos;You need to set the conference URI in your account settings to create a conference based chat room.&apos; : Tooltip to warn the user that a setting is missing in its configuration.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Contacts</name>

View file

@ -758,6 +758,11 @@
<source>tooltipShowConversation</source>
<translation>Показати розмову</translation>
</message>
<message>
<source>missingConferenceURI</source>
<extracomment>&apos;You need to set the conference URI in your account settings to create a conference based chat room.&apos; : Tooltip to warn the user that a setting is missing in its configuration.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Contacts</name>

View file

@ -748,6 +748,11 @@
<source>tooltipShowConversation</source>
<translation></translation>
</message>
<message>
<source>missingConferenceURI</source>
<extracomment>&apos;You need to set the conference URI in your account settings to create a conference based chat room.&apos; : Tooltip to warn the user that a setting is missing in its configuration.</extracomment>
<translation type="unfinished"> URI </translation>
</message>
</context>
<context>
<name>Contacts</name>

View file

@ -116,9 +116,41 @@ ContactModel *CallModel::getContactModel() const{
}
ChatRoomModel * CallModel::getChatRoomModel() const{
if(mCall->getCallLog()->getCallId() != "")
if(mCall->getCallLog()->getCallId() != "") {
auto currentParams = mCall->getCurrentParams();
bool isEncrypted = currentParams->getMediaEncryption() != linphone::MediaEncryption::None;
SettingsModel * settingsModel = CoreManager::getInstance()->getSettingsModel();
if( mCall->getChatRoom() && (settingsModel->getSecureChatEnabled() &&
(!settingsModel->getChatEnabled() || (settingsModel->getChatEnabled() && isEncrypted))
)){
std::shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
std::shared_ptr<const linphone::ChatRoomParams> dbParams = mCall->getChatRoom()->getCurrentParams();
std::shared_ptr<linphone::ChatRoomParams> params = core->createDefaultChatRoomParams();
auto callLog = mCall->getCallLog();
auto callLocalAddress = callLog->getLocalAddress();
std::list<std::shared_ptr<linphone::Address>> participants;
std::shared_ptr<linphone::ChatRoom> chatRoom;
// Copy parameters
params->setBackend(dbParams->getBackend());
params->setEncryptionBackend(dbParams->getEncryptionBackend());
params->enableEncryption(dbParams->encryptionEnabled());
params->enableGroup(dbParams->groupEnabled());
params->enableRtt(dbParams->rttEnabled());
params->setSubject(dbParams->getSubject());
params->enableEncryption(true);
std::list<std::shared_ptr<linphone::Participant>> chatRoomParticipants = mCall->getChatRoom()->getParticipants();
for(auto p : chatRoomParticipants){
participants.push_back(p->getAddress()->clone());
}
chatRoom = core->searchChatRoom(params, callLocalAddress
, nullptr
, participants);
if(chatRoom)
return CoreManager::getInstance()->getTimelineListModel()->getChatRoomModel(chatRoom, true).get();
}
return CoreManager::getInstance()->getTimelineListModel()->getChatRoomModel(mCall->getChatRoom(), true).get();
else
}else
return nullptr;
}

View file

@ -223,8 +223,7 @@ ChatRoomModel* CallsListModel::launchSecureChat (const QString &sipAddress) cons
params->enableEncryption(true);
params->setSubject("Dummy Subject");
params->setBackend(linphone::ChatRoomBackend::FlexisipChat);
params->setEncryptionBackend(linphone::ChatRoomEncryptionBackend::Lime);
params->enableEncryption(true);
std::shared_ptr<linphone::ChatRoom> chatRoom = core->createChatRoom(params, localAddress, participants);
if( chatRoom != nullptr){
@ -293,8 +292,7 @@ bool CallsListModel::createSecureChat (const QString& subject, const QString &pa
params->enableEncryption(true);
params->setSubject(Utils::appStringToCoreString(subject));
params->setBackend(linphone::ChatRoomBackend::FlexisipChat);
params->setEncryptionBackend(linphone::ChatRoomEncryptionBackend::Lime);
params->enableEncryption(true);
params->enableGroup(true);
std::shared_ptr<linphone::ChatRoom> chatRoom = core->createChatRoom(params, localAddress, participants);
@ -309,7 +307,7 @@ QVariantMap CallsListModel::createChatRoom(const QString& subject, const int& se
QList< std::shared_ptr<linphone::Address>> admins;
std::shared_ptr<TimelineModel> timeline;
auto timelineList = CoreManager::getInstance()->getTimelineListModel();
qWarning() << "ChatRoom creation of " << subject << " at " << securityLevel << " security and with " << participants;
qInfo() << "ChatRoom creation of " << subject << " at " << securityLevel << " security and with " << participants;
std::shared_ptr<linphone::ChatRoomParams> params = core->createDefaultChatRoomParams();
std::list <shared_ptr<linphone::Address> > chatRoomParticipants;
@ -333,8 +331,7 @@ QVariantMap CallsListModel::createChatRoom(const QString& subject, const int& se
params->enableEncryption(securityLevel>0);
if( securityLevel>0){
params->setBackend(linphone::ChatRoomBackend::FlexisipChat);
params->setEncryptionBackend(linphone::ChatRoomEncryptionBackend::Lime);
params->enableEncryption(true);
}else
params->setBackend(linphone::ChatRoomBackend::Basic);
params->enableGroup( subject!="" );

View file

@ -197,7 +197,8 @@ void CoreHandlers::onMessageReceived (
// 1. Do not notify if chat is not activated.
CoreManager *coreManager = CoreManager::getInstance();
SettingsModel *settingsModel = coreManager->getSettingsModel();
if (!settingsModel->getChatEnabled())
if (chatRoom->getCurrentParams()->getEncryptionBackend() == linphone::ChatRoomEncryptionBackend::None && !settingsModel->getChatEnabled()
|| chatRoom->getCurrentParams()->getEncryptionBackend() != linphone::ChatRoomEncryptionBackend::None && !settingsModel->getSecureChatEnabled())
return;
// 2. Notify with Notification popup.

View file

@ -53,6 +53,10 @@ AbstractEventCountNotifier::AbstractEventCountNotifier (QObject *parent) : QObje
coreManager->getSettingsModel(), &SettingsModel::chatEnabledChanged,
this, &AbstractEventCountNotifier::internalnotifyEventCount
);
QObject::connect(
coreManager->getSettingsModel(), &SettingsModel::secureChatEnabledChanged,
this, &AbstractEventCountNotifier::internalnotifyEventCount
);
/*
QObject::connect(
coreManager->getCallsListModel(), &CallsListModel::callMissed,
@ -72,7 +76,7 @@ void AbstractEventCountNotifier::internalnotifyEventCount () {
qInfo() << QStringLiteral("Notify event count: %1.").arg(n);
n = n > 99 ? 99 : n;
notifyEventCount(CoreManager::getInstance()->getSettingsModel()->getChatEnabled() ? n : 0);
notifyEventCount(CoreManager::getInstance()->getSettingsModel()->getChatEnabled() || CoreManager::getInstance()->getSettingsModel()->getSecureChatEnabled()? n : 0);
emit eventCountChanged();
}

View file

@ -41,6 +41,7 @@
using namespace std;
const string SettingsModel::UiSection("ui");
const string SettingsModel::AppSection("app");
const string SettingsModel::ContactsSection("contacts_import");
SettingsModel::SettingsModel (QObject *parent) : QObject(parent) {
@ -601,14 +602,23 @@ void SettingsModel::setMuteMicrophoneEnabled (bool status) {
// -----------------------------------------------------------------------------
bool SettingsModel::getChatEnabled () const {
return !!mConfig->getInt(UiSection, "chat_enabled", 1);
return !!mConfig->getInt(AppSection, "chat_enabled", 1);
}
void SettingsModel::setChatEnabled (bool status) {
mConfig->setInt(UiSection, "chat_enabled", status);
mConfig->setInt(AppSection, "chat_enabled", status);
emit chatEnabledChanged(status);
}
bool SettingsModel::getSecureChatEnabled () const {
return !!mConfig->getInt(AppSection, "secure_chat_enabled", 1);
}
void SettingsModel::setSecureChatEnabled (bool status) {
mConfig->setInt(AppSection, "secure_chat_enabled", status);
emit secureChatEnabledChanged(status);
}
// -----------------------------------------------------------------------------
bool SettingsModel::getHideEmptyChatRooms() const{

View file

@ -104,6 +104,7 @@ class SettingsModel : public QObject {
Q_PROPERTY(bool muteMicrophoneEnabled READ getMuteMicrophoneEnabled WRITE setMuteMicrophoneEnabled NOTIFY muteMicrophoneEnabledChanged)
Q_PROPERTY(bool chatEnabled READ getChatEnabled WRITE setChatEnabled NOTIFY chatEnabledChanged)
Q_PROPERTY(bool secureChatEnabled READ getSecureChatEnabled WRITE setSecureChatEnabled NOTIFY secureChatEnabledChanged)
Q_PROPERTY(bool hideEmptyChatRooms READ getHideEmptyChatRooms WRITE setHideEmptyChatRooms NOTIFY hideEmptyChatRoomsChanged)
Q_PROPERTY(bool waitRegistrationForCall READ getWaitRegistrationForCall WRITE setWaitRegistrationForCall NOTIFY waitRegistrationForCallChanged)// Allow call only if the current proxy has been registered
@ -328,6 +329,9 @@ public:
bool getChatEnabled () const;
void setChatEnabled (bool status);
bool getSecureChatEnabled () const;
void setSecureChatEnabled (bool status);
bool getHideEmptyChatRooms() const;
void setHideEmptyChatRooms(const bool& data);
@ -487,6 +491,7 @@ public:
bool getIsInCall() const;
static const std::string UiSection;
static const std::string AppSection;
static const std::string ContactsSection;
// ===========================================================================
@ -555,6 +560,7 @@ signals:
void muteMicrophoneEnabledChanged (bool status);
void chatEnabledChanged (bool status);
void secureChatEnabledChanged (bool status);
void hideEmptyChatRoomsChanged (bool status);
void waitRegistrationForCallChanged (bool status);

View file

@ -352,8 +352,22 @@ void TimelineListModel::onCallCreated(const std::shared_ptr<linphone::Call> &cal
bool found = false;
auto callLog = call->getCallLog();
auto callLocalAddress = callLog->getLocalAddress();
auto currentParams = call->getCurrentParams();
bool isEncrypted = currentParams->getMediaEncryption() != linphone::MediaEncryption::None;
bool createSecureChatRoom = false;
SettingsModel * settingsModel = CoreManager::getInstance()->getSettingsModel();
if( settingsModel->getSecureChatEnabled() &&
(!settingsModel->getChatEnabled() || (settingsModel->getChatEnabled() && isEncrypted))
){
params->enableEncryption(true);
createSecureChatRoom = true;
}
participants.push_back(callLog->getRemoteAddress()->clone());
auto chatRoom = core->searchChatRoom(params, callLocalAddress
, callLog->getRemoteAddress()
, nullptr//callLog->getRemoteAddress()
, participants);
if(chatRoom){
for(auto timeline : mTimelines){
@ -370,7 +384,7 @@ void TimelineListModel::onCallCreated(const std::shared_ptr<linphone::Call> &cal
auto remoteAddress = callLog->getRemoteAddress()->clone();
remoteAddress->clean();
participants << Utils::coreStringToAppString(remoteAddress->asStringUriOnly());
CoreManager::getInstance()->getCallsListModel()->createChatRoom("", 0, participants, isOutgoing);
CoreManager::getInstance()->getCallsListModel()->createChatRoom("", (createSecureChatRoom?1:0), participants, isOutgoing);
}
}

View file

@ -270,7 +270,6 @@ Rectangle {
}
}
}
footer: Item{
Text {
property var composers : container.proxyModel.composers
@ -278,7 +277,7 @@ Rectangle {
font.pointSize: ChatStyle.composingText.pointSize
height: visible ? undefined : 0
leftPadding: ChatStyle.composingText.leftPadding
visible: composers.length > 0 && SettingsModel.chatEnabled
visible: composers.length > 0 && (!proxyModel.chatRoomModel.haveEncryption && SettingsModel.chatEnabled || proxyModel.chatRoomModel.haveEncryption && SettingsModel.secureChatEnabled)
wrapMode: Text.Wrap
//: '%1 is typing...' indicate that someone is composing in chat
text:(composers.length==0?'': qsTr('chatTyping','',composers.length).arg(container.proxyModel.getDisplayNameComposers()))
@ -359,7 +358,8 @@ Rectangle {
borderColor: ChatStyle.sendArea.border.color
topWidth: ChatStyle.sendArea.border.width
visible: SettingsModel.chatEnabled && proxyModel.chatRoomModel && !proxyModel.chatRoomModel.hasBeenLeft
visible: proxyModel.chatRoomModel && !proxyModel.chatRoomModel.hasBeenLeft && (!proxyModel.chatRoomModel.haveEncryption && SettingsModel.chatEnabled || proxyModel.chatRoomModel.haveEncryption && SettingsModel.secureChatEnabled)
DroppableTextArea {
id: textArea

View file

@ -18,16 +18,16 @@ Item {
// ---------------------------------------------------------------------------
function open () {
function open (isSecure) {
var length = sipAddresses.length
if (!length) {
return
}
if (length === 1) {
return sipAddressesMenu.sipAddressClicked(sipAddresses[0])
return sipAddressesMenu.sipAddressClicked(sipAddresses[0], isSecure)
}
menu.isSecure = isSecure
menu.open()
}
@ -41,7 +41,7 @@ Item {
// ---------------------------------------------------------------------------
signal sipAddressClicked (string sipAddress)
signal sipAddressClicked (string sipAddress, bool isSecure)
// ---------------------------------------------------------------------------
@ -51,6 +51,7 @@ Item {
DropDownDynamicMenu {
id: menu
property bool isSecure : false
parent: sipAddressesMenu.parent
@ -104,7 +105,7 @@ Item {
onClicked: {
menu.close()
sipAddressesMenu.sipAddressClicked($sipAddress)
sipAddressesMenu.sipAddressClicked($sipAddress, menu.isSecure)
}
}
}

View file

@ -60,8 +60,8 @@ SearchBox {
actions: [{
icon: 'video_call',
secure:0,
visible:true,
secure: 0,
visible: true,
handler: function (entry) {
searchBox.closeMenu()
searchBox.launchVideoCall(entry.sipAddress)
@ -69,27 +69,30 @@ SearchBox {
visible: SettingsModel.videoSupported && SettingsModel.outgoingCallsEnabled && SettingsModel.showStartVideoCallButton
}, {
icon: 'call',
secure:0,
visible:true,
secure: 0,
visible: true,
handler: function (entry) {
searchBox.closeMenu()
searchBox.launchCall(entry.sipAddress)
},
visible: SettingsModel.outgoingCallsEnabled
}, {
icon: SettingsModel.chatEnabled && SettingsModel.getShowStartChatButton() ? 'chat' : 'history',
secure:0,
visible:true,
icon: SettingsModel.getShowStartChatButton() ? 'chat' : 'history',
secure: 0,
visible: SettingsModel.chatEnabled ,
handler: function (entry) {
searchBox.closeMenu()
searchBox.launchChat(entry.sipAddress)
}
}, {
icon: SettingsModel.chatEnabled && SettingsModel.getShowStartChatButton() ? 'chat' : 'history',
secure:1,
visible:SettingsModel.chatEnabled && SettingsModel.getShowStartChatButton() && AccountSettingsModel.conferenceURI != '',
icon: SettingsModel.getShowStartChatButton() ? 'chat' : 'history',
secure: 1,
visible: SettingsModel.secureChatEnabled && AccountSettingsModel.conferenceURI != '',
visibleHandler : function(entry) {
return UtilsCpp.hasCapability(entry.sipAddress, LinphoneEnums.FriendCapabilityLimeX3Dh);
if(entry)
return UtilsCpp.hasCapability(entry.sipAddress ? entry.sipAddress : entry, LinphoneEnums.FriendCapabilityLimeX3Dh);
else
return false;
},
handler: function (entry) {
searchBox.closeMenu()

View file

@ -243,7 +243,7 @@ Rectangle {
? TimelineStyle.contact.backgroundColor.a
: TimelineStyle.contact.backgroundColor.b
)
displayUnreadMessageCount: SettingsModel.chatEnabled
displayUnreadMessageCount: SettingsModel.chatEnabled || SettingsModel.secureChatEnabled
entry: modelData.chatRoomModel
sipAddressColor: isSelected
? TimelineStyle.contact.sipAddress.color.selected

View file

@ -202,7 +202,8 @@ Window {
Chat {
proxyModel: ChatRoomProxyModel {
Component.onCompleted: {
if (!SettingsModel.chatEnabled) {
if (chatRoomModel
&& (!chatRoomModel.haveEncryption && !SettingsModel.chatEnabled || chatRoomModel.haveEncryption && !SettingsModel.secureChatEnabled)) {
setEntryTypeFilter(ChatRoomModel.CallEntry | ChatRoomModel.NoticeEntry)
}
}
@ -217,7 +218,8 @@ Window {
Connections {
target: SettingsModel
onChatEnabledChanged: proxyModel.setEntryTypeFilter(status ? ChatRoomModel.GenericEntry : ChatRoomModel.CallEntry | ChatRoomModel.NoticeEntry)
onChatEnabledChanged: if(!chatRoomModel.haveEncryption) proxyModel.setEntryTypeFilter(status ? ChatRoomModel.GenericEntry : ChatRoomModel.CallEntry | ChatRoomModel.NoticeEntry)
onSecureChatEnabledChanged: if(chatRoomModel.haveEncryption) proxyModel.setEntryTypeFilter(status ? ChatRoomModel.GenericEntry : ChatRoomModel.CallEntry | ChatRoomModel.NoticeEntry)
}
}
}

View file

@ -421,7 +421,7 @@ Rectangle {
}
ActionButton {
icon: SettingsModel.chatEnabled && SettingsModel.showStartChatButton ? 'chat' : 'history'
icon: (SettingsModel.chatEnabled || SettingsModel.secureChatEnabled) && SettingsModel.showStartChatButton ? 'chat' : 'history'
onClicked: {
if (window.chatIsOpened) {

View file

@ -8,6 +8,7 @@ import Linphone 1.0
import Linphone.Styles 1.0
import UtilsCpp 1.0
import LinphoneEnums 1.0
import App.Styles 1.0
@ -147,17 +148,38 @@ ColumnLayout {
visible: _contact != null
ActionBar {
id: actionBar
anchors.verticalCenter: parent.verticalCenter
iconSize: ContactEditStyle.bar.actions.history.iconSize
ActionButton {
icon: 'history'
onClicked: sipAddressesMenu.open()
TooltipArea {
isClickable: false
text: qsTr('tooltipShowConversation')
icon: SettingsModel.getShowStartChatButton() ? 'chat' : 'history'
visible: SettingsModel.chatEnabled
onClicked: sipAddressesMenu.open(false)
TooltipArea {
isClickable: false
text: qsTr('tooltipShowConversation')
}
}
ActionButton {
icon: SettingsModel.getShowStartChatButton() ? 'chat' : 'history'
visible: SettingsModel.secureChatEnabled && _contact && _contact.hasCapability(LinphoneEnums.FriendCapabilityLimeX3Dh)
enabled: AccountSettingsModel.conferenceURI != ''
Icon{
icon:'secure_level_1'
iconSize:15
anchors.right:parent.right
anchors.top:parent.top
anchors.topMargin: -3
}
onClicked: {sipAddressesMenu.open(true)}
TooltipArea{
maxWidth: actionBar.width
visible: AccountSettingsModel.conferenceURI == ''
//: 'You need to set the conference URI in your account settings to create a conference based chat room.' : Tooltip to warn the user that a setting is missing in its configuration.
text: '- ' + qsTr('missingConferenceURI') + '\n'
}
}
}
@ -196,7 +218,7 @@ ColumnLayout {
sipAddresses: _contact ? _contact.vcard.sipAddresses : [ contactEdit.sipAddress ]
onSipAddressClicked: {
var entry = CallsListModel.createChatRoom( "", false, [sipAddress], false )
var entry = CallsListModel.createChatRoom( "", isSecure, [sipAddress], false )
if(entry){
window.setView('Conversation', {
chatRoomModel:entry.chatRoomModel

View file

@ -148,13 +148,14 @@ ColumnLayout {
}
ActionButton {
icon: SettingsModel.chatEnabled && SettingsModel.getShowStartChatButton() ? 'chat' : 'history'
icon: SettingsModel.getShowStartChatButton() ? 'chat' : 'history'
visible: SettingsModel.chatEnabled
onClicked: actions.itemAt(2).open()
}
ActionButton {
icon: 'chat'
visible: SettingsModel.chatEnabled && SettingsModel.getShowStartChatButton() && $contact.hasCapability(LinphoneEnums.FriendCapabilityLimeX3Dh)
icon: SettingsModel.getShowStartChatButton() ? 'chat' : 'history'
visible: SettingsModel.secureChatEnabled && $contact.hasCapability(LinphoneEnums.FriendCapabilityLimeX3Dh)
enabled: AccountSettingsModel.conferenceURI != ''
Icon{
icon:'secure_level_1'

View file

@ -264,7 +264,7 @@ ColumnLayout {
}
ActionButton {
icon: 'chat'
visible: SettingsModel.chatEnabled && SettingsModel.getShowStartChatButton() && !conversation.haveMoreThanOneParticipants && conversation.securityLevel == 1 && UtilsCpp.hasCapability(conversation.peerAddress, LinphoneEnums.FriendCapabilityLimeX3Dh)
visible: SettingsModel.secureChatEnabled && SettingsModel.getShowStartChatButton() && !conversation.haveMoreThanOneParticipants && conversation.securityLevel == 1 && UtilsCpp.hasCapability(conversation.peerAddress, LinphoneEnums.FriendCapabilityLimeX3Dh)
onClicked: CallsListModel.launchChat(chatRoomModel.participants.addressesToString, 1)
Icon{
@ -415,7 +415,7 @@ ColumnLayout {
bottomWidth: ConversationStyle.filters.border.bottomWidth
color: ConversationStyle.filters.backgroundColor
topWidth: ConversationStyle.filters.border.topWidth
visible: SettingsModel.chatEnabled
visible: !chatRoomModel.haveEncryption && SettingsModel.chatEnabled || chatRoomModel.haveEncryption && SettingsModel.secureChatEnabled
ExclusiveButtons {
id: filterButtons
@ -515,7 +515,8 @@ ColumnLayout {
id: chatRoomProxyModel
Component.onCompleted: {
if (!SettingsModel.chatEnabled) {
if ( (!chatRoomModel.haveEncryption && !SettingsModel.chatEnabled)
|| (chatRoomModel.haveEncryption && !SettingsModel.secureChatEnabled) ) {
setEntryTypeFilter(ChatRoomModel.CallEntry)
}
}

View file

@ -119,15 +119,20 @@ DialogPlus {
anchors.verticalCenter: parent.verticalCenter
width:50
enabled:true
checked: !SettingsModel.chatEnabled && SettingsModel.secureChatEnabled
onClicked: {
if(!checked){ // Remove all participants that have not the capabilities
var participants = selectedParticipants.getParticipants()
for(var index in participants){
if(!smartSearchBar.isUsable(participants[index].sipAddress))
participantView.removeParticipant(participants[index])
var newCheck = checked
if(! ( SettingsModel.chatEnabled && !checked || SettingsModel.secureChatEnabled && checked))
newCheck = !checked;
if(newCheck){ // Remove all participants that have not the capabilities
var participants = selectedParticipants.getParticipants()
for(var index in participants){
if(!smartSearchBar.isUsable(participants[index].sipAddress))
participantView.removeParticipant(participants[index])
}
}
}
checked = !checked
checked = newCheck;
}
indicatorStyle: SwitchStyle.aux
}

View file

@ -201,6 +201,7 @@ ApplicationWindow {
//: 'Open Conference' : Tooltip to illustrate a button
tooltipText : qsTr('newChatRoom')
iconSize: MainWindowStyle.newConferenceSize
visible: SettingsModel.chatEnabled || SettingsModel.secureChatEnabled
//autoIcon: true
onClicked: {
window.detachVirtualWindow()

View file

@ -216,7 +216,7 @@ TabContainer {
Form {
title: qsTr('chatTitle')
visible: SettingsModel.chatEnabled || SettingsModel.developerSettingsEnabled
visible: SettingsModel.chatEnabled || SettingsModel.secureChatEnabled || SettingsModel.developerSettingsEnabled
width: parent.width
FormLine {
@ -231,7 +231,16 @@ TabContainer {
onClicked: SettingsModel.chatEnabled = !checked
}
}
FormGroup {
label: 'Activate secure chats'
Switch {
checked: SettingsModel.secureChatEnabled
onClicked: SettingsModel.secureChatEnabled = !checked
}
}
FormGroup {
label: qsTr('conferenceEnabledLabel')

View file

@ -107,6 +107,7 @@ TabContainer {
visible: SettingsModel.videoSupported ||
SettingsModel.callRecorderEnabled ||
SettingsModel.chatEnabled ||
SettingsModel.secureChatEnabled ||
SettingsModel.developerSettingsEnabled
width: parent.width
@ -141,7 +142,7 @@ TabContainer {
}
FormLine {
visible: SettingsModel.chatEnabled || SettingsModel.developerSettingsEnabled
visible: SettingsModel.chatEnabled || SettingsModel.secureChatEnabled || SettingsModel.developerSettingsEnabled
FormGroup {
label: qsTr('downloadLabel')