Commit 7afa3950 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(src/components/core/CoreManager): set root ca file path

parent 8fedfb58
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#define PATH_CALL_HISTORY_LIST "/call-history.db" #define PATH_CALL_HISTORY_LIST "/call-history.db"
#define PATH_CONFIG "/linphonerc" #define PATH_CONFIG "/linphonerc"
#define PATH_FACTORY_CONFIG "/linphonerc-factory" #define PATH_FACTORY_CONFIG "/linphonerc-factory"
#define PATH_ROOT_CA "/rootca.pem"
#define PATH_FRIENDS_LIST "/friends.db" #define PATH_FRIENDS_LIST "/friends.db"
#define PATH_MESSAGE_HISTORY_LIST "/message-history.db" #define PATH_MESSAGE_HISTORY_LIST "/message-history.db"
#define PATH_ZRTP_DATA "/zrtp-lime.db" #define PATH_ZRTP_DATA "/zrtp-lime.db"
...@@ -100,50 +101,56 @@ inline string getWritableFilePath (const QString &filename) { ...@@ -100,50 +101,56 @@ inline string getWritableFilePath (const QString &filename) {
return getReadableFilePath(filename); return getReadableFilePath(filename);
} }
static QString getAppPackageDataDirpath () { // -----------------------------------------------------------------------------
inline QString getAppPackageDataDirpath () {
QDir dir(QCoreApplication::applicationDirPath()); QDir dir(QCoreApplication::applicationDirPath());
if (dir.dirName() == "MacOS") { if (dir.dirName() == "MacOS") {
dir.cdUp(); dir.cdUp();
dir.cd("Resources"); dir.cd("Resources");
} else { } else
dir.cdUp(); dir.cdUp();
}
dir.cd("share/linphone"); dir.cd("share/linphone");
return dir.absolutePath(); return dir.absolutePath();
} }
static QString getAppPackageMsPluginsDirpath () { inline QString getAppPackageMsPluginsDirpath () {
QDir dir(QCoreApplication::applicationDirPath()); QDir dir(QCoreApplication::applicationDirPath());
if (dir.dirName() == "MacOS") { if (dir.dirName() == "MacOS") {
dir.cdUp(); dir.cdUp();
dir.cd("Resources"); dir.cd("Resources");
} else { } else
dir.cdUp(); dir.cdUp();
}
dir.cd(MSPLUGINS_DIR); dir.cd(MSPLUGINS_DIR);
return dir.absolutePath(); return dir.absolutePath();
} }
static QString getAppConfigFilepath () { inline QString getAppConfigFilepath () {
if (QSysInfo::productType() == "macos") if (QSysInfo::productType() == "macos")
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_CONFIG; return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_CONFIG;
return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + PATH_CONFIG; return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + PATH_CONFIG;
} }
static QString getAppCallHistoryFilepath () { inline QString getAppCallHistoryFilepath () {
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_CALL_HISTORY_LIST; return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_CALL_HISTORY_LIST;
} }
static QString getAppFactoryConfigFilepath () { inline QString getAppFactoryConfigFilepath () {
return getAppPackageDataDirpath() + PATH_FACTORY_CONFIG; return getAppPackageDataDirpath() + PATH_FACTORY_CONFIG;
} }
static QString getAppFriendsFilepath () { inline QString getAppRootCaFilepath () {
return getAppPackageDataDirpath() + PATH_ROOT_CA;
}
inline QString getAppFriendsFilepath () {
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_FRIENDS_LIST; return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_FRIENDS_LIST;
} }
static QString getAppMessageHistoryFilepath () { inline QString getAppMessageHistoryFilepath () {
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_MESSAGE_HISTORY_LIST; return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_MESSAGE_HISTORY_LIST;
} }
...@@ -157,6 +164,10 @@ string Paths::getCallHistoryFilepath () { ...@@ -157,6 +164,10 @@ string Paths::getCallHistoryFilepath () {
return getWritableFilePath(getAppCallHistoryFilepath()); return getWritableFilePath(getAppCallHistoryFilepath());
} }
string Paths::getCapturesDirpath () {
return getWritableDirectoryPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_CAPTURES);
}
string Paths::getConfigFilepath (const QString &config_path) { string Paths::getConfigFilepath (const QString &config_path) {
if (!config_path.isEmpty()) if (!config_path.isEmpty())
return getWritableFilePath(QFileInfo(config_path).absoluteFilePath()); return getWritableFilePath(QFileInfo(config_path).absoluteFilePath());
...@@ -188,12 +199,16 @@ string Paths::getPackageMsPluginsDirpath () { ...@@ -188,12 +199,16 @@ string Paths::getPackageMsPluginsDirpath () {
return getReadableDirectoryPath(getAppPackageMsPluginsDirpath()); return getReadableDirectoryPath(getAppPackageMsPluginsDirpath());
} }
string Paths::getRootCaFilepath () {
return getReadableFilePath(getAppRootCaFilepath());
}
string Paths::getThumbnailsDirpath () { string Paths::getThumbnailsDirpath () {
return getWritableDirectoryPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_THUMBNAILS); return getWritableDirectoryPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_THUMBNAILS);
} }
string Paths::getCapturesDirpath () { string Paths::getUserCertificatesDirpath () {
return getWritableDirectoryPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_CAPTURES); return getWritableDirectoryPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_USER_CERTIFICATES);
} }
string Paths::getZrtpDataFilepath () { string Paths::getZrtpDataFilepath () {
...@@ -204,10 +219,6 @@ string Paths::getZrtpSecretsFilepath () { ...@@ -204,10 +219,6 @@ string Paths::getZrtpSecretsFilepath () {
return getWritableFilePath(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + PATH_ZRTP_SECRETS); return getWritableFilePath(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + PATH_ZRTP_SECRETS);
} }
string Paths::getUserCertificatesDirpath () {
return getWritableDirectoryPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_USER_CERTIFICATES);
}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
static void migrateFile (const QString &old_path, const QString &new_path) { static void migrateFile (const QString &old_path, const QString &new_path) {
......
...@@ -31,19 +31,18 @@ ...@@ -31,19 +31,18 @@
namespace Paths { namespace Paths {
std::string getAvatarsDirpath (); std::string getAvatarsDirpath ();
std::string getCapturesDirpath ();
std::string getLogsDirpath ();
std::string getThumbnailsDirpath ();
std::string getUserCertificatesDirpath ();
std::string getPackageDataDirpath ();
std::string getPackageMsPluginsDirpath ();
std::string getCallHistoryFilepath (); std::string getCallHistoryFilepath ();
std::string getCapturesDirpath ();
std::string getConfigFilepath (const QString &config_path = QString()); std::string getConfigFilepath (const QString &config_path = QString());
std::string getFactoryConfigFilepath (); std::string getFactoryConfigFilepath ();
std::string getFriendsListFilepath (); std::string getFriendsListFilepath ();
std::string getLogsDirpath ();
std::string getMessageHistoryFilepath (); std::string getMessageHistoryFilepath ();
std::string getPackageDataDirpath ();
std::string getPackageMsPluginsDirpath ();
std::string getRootCaFilepath ();
std::string getThumbnailsDirpath ();
std::string getUserCertificatesDirpath ();
std::string getZrtpDataFilepath (); std::string getZrtpDataFilepath ();
std::string getZrtpSecretsFilepath (); std::string getZrtpSecretsFilepath ();
......
...@@ -146,6 +146,6 @@ float ContactsListProxyModel::computeContactWeight (const ContactModel *contact) ...@@ -146,6 +146,6 @@ float ContactsListProxyModel::computeContactWeight (const ContactModel *contact)
void ContactsListProxyModel::setConnectedFilter (bool use_connected_filter) { void ContactsListProxyModel::setConnectedFilter (bool use_connected_filter) {
if (use_connected_filter != m_use_connected_filter) { if (use_connected_filter != m_use_connected_filter) {
m_use_connected_filter = use_connected_filter; m_use_connected_filter = use_connected_filter;
invalidateFilter(); invalidate();
} }
} }
...@@ -99,6 +99,8 @@ void CoreManager::setOtherPaths () { ...@@ -99,6 +99,8 @@ void CoreManager::setOtherPaths () {
m_core->setZrtpCacheDatabasePath(Paths::getZrtpDataFilepath()); m_core->setZrtpCacheDatabasePath(Paths::getZrtpDataFilepath());
m_core->setUserCertificatesPath(Paths::getUserCertificatesDirpath()); m_core->setUserCertificatesPath(Paths::getUserCertificatesDirpath());
m_core->setRootCa(Paths::getRootCaFilepath());
} }
void CoreManager::setResourcesPaths () { void CoreManager::setResourcesPaths () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment