- 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
This commit is contained in:
Julien Wadel 2021-11-08 20:18:58 +01:00
parent 30bcee8ddb
commit 379bcedad4
16 changed files with 75 additions and 36 deletions

View file

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

View file

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

View file

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

View file

@ -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<linphone::Factory> 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<linphone::Config> config = mCore->getConfig();
if (mCore->videoSupported()) {
shared_ptr<linphone::Config> 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();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

@ -1 +1 @@
Subproject commit 6f1485a2de0507a51087c81d6f457df8e6a496cd
Subproject commit 3ea9277c8035deb632e47519971122550ca8f64d