From 379bcedad4120127d84a2da2cc08a9e199dd110f Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Mon, 8 Nov 2021 20:18:58 +0100 Subject: [PATCH] - Fix Installation folders to executable name - Force application paths to Database, Lime DB and sounds - Remove constraints on actions that were based on friends capabilities - Fix secure group chat activation --- .../linphone_package/CMakeLists.txt | 11 +++++++++-- linphone-app/src/app/paths/Paths.cpp | 12 ++++++++++++ linphone-app/src/app/paths/Paths.hpp | 3 +++ .../src/components/core/CoreManager.cpp | 16 +++++++++------- linphone-app/src/utils/Constants.cpp | 3 +++ linphone-app/src/utils/Constants.hpp | 5 ++++- linphone-app/src/utils/Utils.cpp | 2 +- .../Linphone/SmartSearchBar/SmartSearchBar.qml | 2 +- .../modules/Linphone/View/ParticipantsView.qml | 16 +++++++++++++--- .../modules/Linphone/View/SipAddressesView.qml | 10 ++++++---- linphone-app/ui/views/App/Main/ContactEdit.qml | 2 +- linphone-app/ui/views/App/Main/Contacts.qml | 2 +- linphone-app/ui/views/App/Main/Conversation.qml | 2 +- .../ui/views/App/Main/Dialogs/InfoChatRoom.qml | 6 +++--- .../ui/views/App/Main/Dialogs/NewChatRoom.qml | 17 +++++++---------- linphone-sdk | 2 +- 16 files changed, 75 insertions(+), 36 deletions(-) diff --git a/linphone-app/cmake_builder/linphone_package/CMakeLists.txt b/linphone-app/cmake_builder/linphone_package/CMakeLists.txt index bebe29752..aecb394ab 100644 --- a/linphone-app/cmake_builder/linphone_package/CMakeLists.txt +++ b/linphone-app/cmake_builder/linphone_package/CMakeLists.txt @@ -133,7 +133,7 @@ if (WIN32) file(GLOB GRAMMAR_FILES "${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/Belr/grammars/*") install(FILES ${GRAMMAR_FILES} DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/belr/grammars/" ) install(DIRECTORY "${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/images" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}" USE_SOURCE_PERMISSIONS OPTIONAL) - install(DIRECTORY "${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/sounds" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}" USE_SOURCE_PERMISSIONS) + install(DIRECTORY "${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/sounds/linphone/" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${EXECUTABLE_NAME}" USE_SOURCE_PERMISSIONS) install(FILES "${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/Linphone/rootca.pem" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${EXECUTABLE_NAME}/") install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../../assets/linphonerc-factory" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${EXECUTABLE_NAME}") @@ -194,7 +194,7 @@ elseif (APPLE) file(GLOB GRAMMAR_FILES "${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/Belr/grammars/*") install(FILES ${GRAMMAR_FILES} DESTINATION "${APPLICATION_NAME}.app/Contents/Resources/${CMAKE_INSTALL_DATAROOTDIR}/belr/grammars/") install(DIRECTORY "${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/images" DESTINATION "${APPLICATION_NAME}.app/Contents/Resources/${CMAKE_INSTALL_DATAROOTDIR}" USE_SOURCE_PERMISSIONS OPTIONAL) - install(DIRECTORY "${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/sounds" DESTINATION "${APPLICATION_NAME}.app/Contents/Resources/${CMAKE_INSTALL_DATAROOTDIR}" USE_SOURCE_PERMISSIONS) + install(DIRECTORY "${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/sounds/linphone/" DESTINATION "${APPLICATION_NAME}.app/Contents/Resources/${CMAKE_INSTALL_DATAROOTDIR}/${EXECUTABLE_NAME}" USE_SOURCE_PERMISSIONS) install(FILES "${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/Linphone/rootca.pem" DESTINATION "${APPLICATION_NAME}.app/Contents/Resources/${CMAKE_INSTALL_DATAROOTDIR}/${EXECUTABLE_NAME}") install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../../assets/linphonerc-factory" DESTINATION "${APPLICATION_NAME}.app/Contents/Resources/${CMAKE_INSTALL_DATAROOTDIR}/${EXECUTABLE_NAME}") @@ -266,6 +266,13 @@ else()# Not Windows and Apple install(FILES ${SHARED_LIBRARIES} DESTINATION "lib64") endif() install(DIRECTORY "${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}" USE_SOURCE_PERMISSIONS) + install(DIRECTORY "${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}" USE_SOURCE_PERMISSIONS + PATTERN "linphone" EXCLUDE + PATTERN "sounds" EXCLUDE + ) + install(DIRECTORY "${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/linphone/" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${EXECUTABLE_NAME}" USE_SOURCE_PERMISSIONS) + install(DIRECTORY "${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/sounds/linphone/" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/sounds/${EXECUTABLE_NAME}" USE_SOURCE_PERMISSIONS) + if(ENABLE_BUILD_VERBOSE) message("INSTALLATION : ${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/" ) endif() diff --git a/linphone-app/src/app/paths/Paths.cpp b/linphone-app/src/app/paths/Paths.cpp index d60f4fb5d..2b06931fe 100644 --- a/linphone-app/src/app/paths/Paths.cpp +++ b/linphone-app/src/app/paths/Paths.cpp @@ -227,6 +227,10 @@ string Paths::getConfigFilePath (const QString &configPath, bool writable) { return writable ? getWritableFilePath(path) : getReadableFilePath(path); } +std::string Paths::getDatabaseFilePath (){ + return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)) + Constants::PathDatabase; +} + string Paths::getFactoryConfigFilePath () { return getReadableFilePath(getAppFactoryConfigFilePath()); } @@ -239,6 +243,10 @@ string Paths::getDownloadDirPath () { return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::DownloadLocation)); } +std::string Paths::getLimeDatabasePath (){ + return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)) + Constants::PathLimeDatabase; +} + string Paths::getLogsDirPath () { return getWritableDirPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + Constants::PathLogs); } @@ -259,6 +267,10 @@ string Paths::getPackagePluginsAppDirPath () { return getReadableDirPath(getAppPackagePluginsDirPath() + Constants::PathPluginsApp); } +std::string Paths::getPackageSoundsResourcesDirPath (){ + return getReadableDirPath(getAppPackageDataDirPath() + Constants::PathSounds); +} + string Paths::getPluginsAppDirPath () { return getWritableDirPath(getAppPluginsDirPath() + Constants::PathPluginsApp); } diff --git a/linphone-app/src/app/paths/Paths.hpp b/linphone-app/src/app/paths/Paths.hpp index 6cb62a752..bb61db2f4 100644 --- a/linphone-app/src/app/paths/Paths.hpp +++ b/linphone-app/src/app/paths/Paths.hpp @@ -36,14 +36,17 @@ namespace Paths { std::string getCodecsDirPath (); std::string getConfigDirPath (bool writable = true); std::string getConfigFilePath (const QString &configPath = QString(), bool writable = true); + std::string getDatabaseFilePath (); std::string getDownloadDirPath (); std::string getFactoryConfigFilePath (); std::string getFriendsListFilePath (); + std::string getLimeDatabasePath (); std::string getLogsDirPath (); std::string getMessageHistoryFilePath (); std::string getPackageDataDirPath (); std::string getPackageMsPluginsDirPath (); std::string getPackagePluginsAppDirPath (); + std::string getPackageSoundsResourcesDirPath (); std::string getPluginsAppDirPath (); QStringList getPluginsAppFolders(); std::string getRootCaFilePath (); diff --git a/linphone-app/src/components/core/CoreManager.cpp b/linphone-app/src/components/core/CoreManager.cpp index 76a741402..84219f480 100644 --- a/linphone-app/src/components/core/CoreManager.cpp +++ b/linphone-app/src/components/core/CoreManager.cpp @@ -208,14 +208,11 @@ void CoreManager::setDatabasesPaths () { // ----------------------------------------------------------------------------- void CoreManager::setOtherPaths () { - if (mCore->getZrtpSecretsFile().empty() || !Paths::filePathExists(mCore->getZrtpSecretsFile(), true)) - mCore->setZrtpSecretsFile(Paths::getZrtpSecretsFilePath()); + mCore->setZrtpSecretsFile(Paths::getZrtpSecretsFilePath()); qInfo() << "Using ZrtpSecrets path : " << QString::fromStdString(mCore->getZrtpSecretsFile()); - if (mCore->getUserCertificatesPath().empty() || !Paths::filePathExists(mCore->getUserCertificatesPath(), true)) - mCore->setUserCertificatesPath(Paths::getUserCertificatesDirPath()); + mCore->setUserCertificatesPath(Paths::getUserCertificatesDirPath()); qInfo() << "Using UserCertificate path : " << QString::fromStdString(mCore->getUserCertificatesPath()); - if (mCore->getRootCa().empty() || !Paths::filePathExists(mCore->getRootCa())) - mCore->setRootCa(Paths::getRootCaFilePath()); + mCore->setRootCa(Paths::getRootCaFilePath()); qInfo() << "Using RootCa path : " << QString::fromStdString(mCore->getRootCa()); } @@ -223,6 +220,7 @@ void CoreManager::setResourcesPaths () { shared_ptr factory = linphone::Factory::get(); factory->setMspluginsDir(Paths::getPackageMsPluginsDirPath()); factory->setTopResourcesDir(Paths::getPackageDataDirPath()); + factory->setSoundResourcesDir(Paths::getPackageSoundsResourcesDirPath()); } // ----------------------------------------------------------------------------- @@ -258,11 +256,15 @@ void CoreManager::createLinphoneCore (const QString &configPath) { // Force capture/display. // Useful if the app was built without video support. // (The capture/display attributes are reset by the core in this case.) + shared_ptr config = mCore->getConfig(); if (mCore->videoSupported()) { - shared_ptr config = mCore->getConfig(); config->setInt("video", "capture", 1); config->setInt("video", "display", 1); } + if(!config->hasEntry("storage", "uri")) + config->setString("storage", "uri", Paths::getDatabaseFilePath()); + if(!config->hasEntry("lime", "x3dh_db_path")) + config->setString("lime", "x3dh_db_path", Paths::getLimeDatabasePath()); mCore->start(); setDatabasesPaths(); setOtherPaths(); diff --git a/linphone-app/src/utils/Constants.cpp b/linphone-app/src/utils/Constants.cpp index 9c166fd63..8b9363a78 100644 --- a/linphone-app/src/utils/Constants.cpp +++ b/linphone-app/src/utils/Constants.cpp @@ -40,14 +40,17 @@ constexpr char Constants::PathPlugins[]; constexpr char Constants::PathPlugins[]; #endif constexpr char Constants::PathPluginsApp[]; +constexpr char Constants::PathSounds[]; constexpr char Constants::PathThumbnails[]; constexpr char Constants::PathUserCertificates[]; constexpr char Constants::PathCallHistoryList[]; constexpr char Constants::PathConfig[]; +constexpr char Constants::PathDatabase[]; constexpr char Constants::PathFactoryConfig[]; constexpr char Constants::PathRootCa[]; constexpr char Constants::PathFriendsList[]; +constexpr char Constants::PathLimeDatabase[]; constexpr char Constants::PathMessageHistoryList[]; constexpr char Constants::PathZrtpSecrets[]; diff --git a/linphone-app/src/utils/Constants.hpp b/linphone-app/src/utils/Constants.hpp index 939f5c5f4..ef3163185 100644 --- a/linphone-app/src/utils/Constants.hpp +++ b/linphone-app/src/utils/Constants.hpp @@ -86,14 +86,17 @@ public: static constexpr char PathPlugins[] = "/plugins/"; #endif static constexpr char PathPluginsApp[] = "app/"; + static constexpr char PathSounds[] = "/sounds/" EXECUTABLE_NAME; static constexpr char PathThumbnails[] = "/thumbnails/"; static constexpr char PathUserCertificates[] = "/usr-crt/"; static constexpr char PathCallHistoryList[] = "/call-history.db"; static constexpr char PathConfig[] = "/linphonerc"; + static constexpr char PathDatabase[] = "/" EXECUTABLE_NAME ".db"; static constexpr char PathFactoryConfig[] = "/" EXECUTABLE_NAME "/linphonerc-factory"; static constexpr char PathRootCa[] = "/" EXECUTABLE_NAME "/rootca.pem"; static constexpr char PathFriendsList[] = "/friends.db"; + static constexpr char PathLimeDatabase[] = "/x3dh.c25519.sqlite3"; static constexpr char PathMessageHistoryList[] = "/message-history.db"; static constexpr char PathZrtpSecrets[] = "/zidcache"; @@ -114,7 +117,7 @@ public: static constexpr char QtDomain[] = "qt"; static constexpr char SrcPattern[] = "/src/"; - static constexpr char VcardScheme[] = "linphone-desktop:/"; + static constexpr char VcardScheme[] = EXECUTABLE_NAME "-desktop:/"; static constexpr int CbsCallInterval = 20; static constexpr char RcVersionName[] = "rc_version"; static constexpr int RcVersionCurrent = 2;// 2 = Conference URI diff --git a/linphone-app/src/utils/Utils.cpp b/linphone-app/src/utils/Utils.cpp index b21c1e397..0e00de26c 100644 --- a/linphone-app/src/utils/Utils.cpp +++ b/linphone-app/src/utils/Utils.cpp @@ -76,7 +76,7 @@ bool Utils::hasCapability(const QString& address, const LinphoneEnums::FriendCap if(contact) return contact->hasCapability(capability); else - return true; + return false; } QString Utils::toDateTimeString(QDateTime date){ diff --git a/linphone-app/ui/modules/Linphone/SmartSearchBar/SmartSearchBar.qml b/linphone-app/ui/modules/Linphone/SmartSearchBar/SmartSearchBar.qml index d36f47063..37c60222c 100644 --- a/linphone-app/ui/modules/Linphone/SmartSearchBar/SmartSearchBar.qml +++ b/linphone-app/ui/modules/Linphone/SmartSearchBar/SmartSearchBar.qml @@ -88,7 +88,7 @@ SearchBox { colorSet: SettingsModel.getShowStartChatButton() ? SipAddressesViewStyle.chat : SipAddressesViewStyle.history, secure: 1, visible: SettingsModel.secureChatEnabled && AccountSettingsModel.conferenceURI != '', - visibleHandler : function(entry) { + secureIconVisibleHandler : function(entry) { if(entry) return UtilsCpp.hasCapability(entry.sipAddress ? entry.sipAddress : entry, LinphoneEnums.FriendCapabilityLimeX3Dh); else diff --git a/linphone-app/ui/modules/Linphone/View/ParticipantsView.qml b/linphone-app/ui/modules/Linphone/View/ParticipantsView.qml index 1e35c1140..cb05ba475 100644 --- a/linphone-app/ui/modules/Linphone/View/ParticipantsView.qml +++ b/linphone-app/ui/modules/Linphone/View/ParticipantsView.qml @@ -120,11 +120,20 @@ ScrollableListView { isCustom: true backgroundRadius: 90 colorSet: modelData.colorSet - visible: (sipAddressesView.actions[index].visibleHandler ? sipAddressesView.actions[index].visibleHandler($sipAddress) : sipAddressesView.actions[index].visible) + visible: sipAddressesView.actions[index].visible onClicked: sipAddressesView.actions[index].handler({ sipAddress: sipAddressesView.interpretableSipAddress }) + Icon{ + visible: modelData.secure>0 && + (sipAddressesView.actions[index].secureIconVisibleHandler ? sipAddressesView.actions[index].secureIconVisibleHandler($sipAddress) : true) + icon:modelData.secure === 2?'secure_level_2':'secure_level_1' + iconSize:15 + anchors.right:parent.right + anchors.top:parent.top + anchors.topMargin: -3 + } } } } @@ -282,12 +291,13 @@ ScrollableListView { colorSet: modelData.colorSet anchors.verticalCenter: parent.verticalCenter tooltipText:modelData.tooltipText?modelData.tooltipText:'' - visible: (sipAddressesView.actions[index].visibleHandler ? sipAddressesView.actions[index].visibleHandler($sipAddress) : sipAddressesView.actions[index].visible) + visible: sipAddressesView.actions[index].visible onClicked: { sipAddressesView.actions[index].handler(contactView.entry) } Icon{ - visible: modelData.secure>0 + visible: modelData.secure>0 && + (sipAddressesView.actions[index].secureIconVisibleHandler ? sipAddressesView.actions[index].secureIconVisibleHandler($sipAddress) : true) icon:modelData.secure === 2?'secure_level_2':'secure_level_1' iconSize:15 anchors.right:parent.right diff --git a/linphone-app/ui/modules/Linphone/View/SipAddressesView.qml b/linphone-app/ui/modules/Linphone/View/SipAddressesView.qml index 963778913..4c663feec 100644 --- a/linphone-app/ui/modules/Linphone/View/SipAddressesView.qml +++ b/linphone-app/ui/modules/Linphone/View/SipAddressesView.qml @@ -122,13 +122,14 @@ ScrollableListView { backgroundRadius: 90 colorSet: modelData.colorSet - visible: (sipAddressesView.actions[index].visibleHandler ? sipAddressesView.actions[index].visibleHandler({ sipAddress : sipAddressesView.interpretableSipAddress}) : sipAddressesView.actions[index].visible) + visible: sipAddressesView.actions[index].visible onClicked: sipAddressesView.actions[index].handler({ sipAddress: sipAddressesView.interpretableSipAddress }) Icon{ - visible: modelData.secure>0 + visible: modelData.secure>0 && + (sipAddressesView.actions[index].secureIconVisibleHandler ? sipAddressesView.actions[index].secureIconVisibleHandler({ sipAddress : sipAddressesView.interpretableSipAddress}) : true) icon: 'secure_on' iconSize:15 anchors.right:parent.right @@ -281,12 +282,13 @@ ScrollableListView { backgroundRadius: 90 colorSet: modelData.colorSet tooltipText:modelData.tooltipText?modelData.tooltipText:'' - visible: (sipAddressesView.actions[index].visibleHandler ? sipAddressesView.actions[index].visibleHandler($sipAddress) : sipAddressesView.actions[index].visible) + visible: sipAddressesView.actions[index].visible onClicked: { sipAddressesView.actions[index].handler($sipAddress) } Icon{ - visible: modelData.secure>0 + visible: modelData.secure>0 && + (sipAddressesView.actions[index].secureIconVisibleHandler ? sipAddressesView.actions[index].secureIconVisibleHandler($sipAddress) : true) icon: 'secure_on' iconSize:15 anchors.right:parent.right diff --git a/linphone-app/ui/views/App/Main/ContactEdit.qml b/linphone-app/ui/views/App/Main/ContactEdit.qml index b0dcc8e98..a4640194f 100644 --- a/linphone-app/ui/views/App/Main/ContactEdit.qml +++ b/linphone-app/ui/views/App/Main/ContactEdit.qml @@ -186,7 +186,7 @@ ColumnLayout { isCustom: true backgroundRadius: 90 colorSet: SettingsModel.getShowStartChatButton() ? ContactEditStyle.chat : ContactEditStyle.history - visible: SettingsModel.secureChatEnabled && _contact && _contact.hasCapability(LinphoneEnums.FriendCapabilityLimeX3Dh) + visible: SettingsModel.secureChatEnabled enabled: AccountSettingsModel.conferenceURI != '' Icon{ icon:'secure_level_1' diff --git a/linphone-app/ui/views/App/Main/Contacts.qml b/linphone-app/ui/views/App/Main/Contacts.qml index 1774cf68f..f60a15072 100644 --- a/linphone-app/ui/views/App/Main/Contacts.qml +++ b/linphone-app/ui/views/App/Main/Contacts.qml @@ -164,7 +164,7 @@ ColumnLayout { isCustom: true backgroundRadius: 90 colorSet: SettingsModel.getShowStartChatButton() ? ContactsStyle.chat : ContactsStyle.history - visible: SettingsModel.secureChatEnabled && $contact.hasCapability(LinphoneEnums.FriendCapabilityLimeX3Dh) + visible: SettingsModel.secureChatEnabled enabled: AccountSettingsModel.conferenceURI != '' Icon{ icon:'secure_level_1' diff --git a/linphone-app/ui/views/App/Main/Conversation.qml b/linphone-app/ui/views/App/Main/Conversation.qml index b733dc5f0..5086b3075 100644 --- a/linphone-app/ui/views/App/Main/Conversation.qml +++ b/linphone-app/ui/views/App/Main/Conversation.qml @@ -277,7 +277,7 @@ ColumnLayout { isCustom: true backgroundRadius: 1000 colorSet: ConversationStyle.bar.actions.chat - visible: SettingsModel.secureChatEnabled && SettingsModel.getShowStartChatButton() && !conversation.haveMoreThanOneParticipants && conversation.securityLevel == 1 && UtilsCpp.hasCapability(conversation.peerAddress, LinphoneEnums.FriendCapabilityLimeX3Dh) + visible: SettingsModel.secureChatEnabled && SettingsModel.getShowStartChatButton() && !conversation.haveMoreThanOneParticipants && conversation.securityLevel == 1 onClicked: CallsListModel.launchChat(chatRoomModel.participants.addressesToString, 1) Icon{ diff --git a/linphone-app/ui/views/App/Main/Dialogs/InfoChatRoom.qml b/linphone-app/ui/views/App/Main/Dialogs/InfoChatRoom.qml index 7bd8f5c72..ba2f81ad6 100644 --- a/linphone-app/ui/views/App/Main/Dialogs/InfoChatRoom.qml +++ b/linphone-app/ui/views/App/Main/Dialogs/InfoChatRoom.qml @@ -89,9 +89,9 @@ DialogPlus { colorSet: InfoChatRoomStyle.addParticipant, secure: chatRoomModel.haveEncryption, visible: true, - visibleHandler : function(entry) { - return !chatRoomModel.haveEncryption || UtilsCpp.hasCapability(entry.sipAddress, LinphoneEnums.FriendCapabilityLimeX3Dh); - }, + secureIconVisibleHandler : function(entry) { + return chatRoomModel.haveEncryption && UtilsCpp.hasCapability(entry.sipAddress, LinphoneEnums.FriendCapabilityLimeX3Dh); + }, handler: function (entry) { selectedParticipants.addAddress(entry.sipAddress) }, diff --git a/linphone-app/ui/views/App/Main/Dialogs/NewChatRoom.qml b/linphone-app/ui/views/App/Main/Dialogs/NewChatRoom.qml index 3f994f89e..a202038b7 100644 --- a/linphone-app/ui/views/App/Main/Dialogs/NewChatRoom.qml +++ b/linphone-app/ui/views/App/Main/Dialogs/NewChatRoom.qml @@ -123,8 +123,9 @@ DialogPlus { onClicked: { var newCheck = checked - if(! ( SettingsModel.standardChatEnabled && !checked || SettingsModel.secureChatEnabled && checked)) + if(SettingsModel.standardChatEnabled && checked || SettingsModel.secureChatEnabled && !checked) newCheck = !checked; +/* Uncomment if we need to remove participants that doesn't have the capability (was commented because we cannot get capabilities in all cases) if(newCheck){ // Remove all participants that have not the capabilities var participants = selectedParticipants.getParticipants() for(var index in participants){ @@ -132,6 +133,7 @@ DialogPlus { participantView.removeParticipant(participants[index]) } } +*/ checked = newCheck; } indicatorStyle: SwitchStyle.aux @@ -310,17 +312,14 @@ DialogPlus { placeholderText: qsTr('participantSelectionPlaceholder') //: 'Search in your contacts or add a custom one to the chat room.' tooltipText: qsTr('participantSelectionTooltip') - function isUsable(sipAddress){ - return UtilsCpp.hasCapability(sipAddress, LinphoneEnums.FriendCapabilityGroupChat) && - (secureSwitch.checked ? UtilsCpp.hasCapability(sipAddress, LinphoneEnums.FriendCapabilityLimeX3Dh) : true); - } + actions:[{ colorSet: NewChatRoomStyle.addParticipant, secure: secureSwitch.checked, visible: true, - visibleHandler : function(entry) { - return isUsable(entry.sipAddress) - }, + secureIconVisibleHandler : function(entry) { + return UtilsCpp.hasCapability(entry.sipAddress, LinphoneEnums.FriendCapabilityLimeX3Dh) + }, handler: function (entry) { selectedParticipants.addAddress(entry.sipAddress) smartSearchBar.addAddressToIgnore(entry.sipAddress); @@ -329,11 +328,9 @@ DialogPlus { }] onEntryClicked: { - if( isUsable(entry)){ selectedParticipants.addAddress(entry) smartSearchBar.addAddressToIgnore(entry); ++lastContacts.reloadCount - } } } Text{ diff --git a/linphone-sdk b/linphone-sdk index 6f1485a2d..3ea9277c8 160000 --- a/linphone-sdk +++ b/linphone-sdk @@ -1 +1 @@ -Subproject commit 6f1485a2de0507a51087c81d6f457df8e6a496cd +Subproject commit 3ea9277c8035deb632e47519971122550ca8f64d