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 @@
#define PATH_CALL_HISTORY_LIST "/call-history.db"
#define PATH_CONFIG "/linphonerc"
#define PATH_FACTORY_CONFIG "/linphonerc-factory"
#define PATH_ROOT_CA "/rootca.pem"
#define PATH_FRIENDS_LIST "/friends.db"
#define PATH_MESSAGE_HISTORY_LIST "/message-history.db"
#define PATH_ZRTP_DATA "/zrtp-lime.db"
......@@ -100,50 +101,56 @@ inline string getWritableFilePath (const QString &filename) {
return getReadableFilePath(filename);
}
static QString getAppPackageDataDirpath () {
// -----------------------------------------------------------------------------
inline QString getAppPackageDataDirpath () {
QDir dir(QCoreApplication::applicationDirPath());
if (dir.dirName() == "MacOS") {
dir.cdUp();
dir.cd("Resources");
} else {
} else
dir.cdUp();
}
dir.cd("share/linphone");
return dir.absolutePath();
}
static QString getAppPackageMsPluginsDirpath () {
inline QString getAppPackageMsPluginsDirpath () {
QDir dir(QCoreApplication::applicationDirPath());
if (dir.dirName() == "MacOS") {
dir.cdUp();
dir.cd("Resources");
} else {
} else
dir.cdUp();
}
dir.cd(MSPLUGINS_DIR);
return dir.absolutePath();
}
static QString getAppConfigFilepath () {
inline QString getAppConfigFilepath () {
if (QSysInfo::productType() == "macos")
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_CONFIG;
return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + PATH_CONFIG;
}
static QString getAppCallHistoryFilepath () {
inline QString getAppCallHistoryFilepath () {
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_CALL_HISTORY_LIST;
}
static QString getAppFactoryConfigFilepath () {
inline QString getAppFactoryConfigFilepath () {
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;
}
static QString getAppMessageHistoryFilepath () {
inline QString getAppMessageHistoryFilepath () {
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_MESSAGE_HISTORY_LIST;
}
......@@ -157,6 +164,10 @@ string Paths::getCallHistoryFilepath () {
return getWritableFilePath(getAppCallHistoryFilepath());
}
string Paths::getCapturesDirpath () {
return getWritableDirectoryPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_CAPTURES);
}
string Paths::getConfigFilepath (const QString &config_path) {
if (!config_path.isEmpty())
return getWritableFilePath(QFileInfo(config_path).absoluteFilePath());
......@@ -188,12 +199,16 @@ string Paths::getPackageMsPluginsDirpath () {
return getReadableDirectoryPath(getAppPackageMsPluginsDirpath());
}
string Paths::getRootCaFilepath () {
return getReadableFilePath(getAppRootCaFilepath());
}
string Paths::getThumbnailsDirpath () {
return getWritableDirectoryPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_THUMBNAILS);
}
string Paths::getCapturesDirpath () {
return getWritableDirectoryPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_CAPTURES);
string Paths::getUserCertificatesDirpath () {
return getWritableDirectoryPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + PATH_USER_CERTIFICATES);
}
string Paths::getZrtpDataFilepath () {
......@@ -204,10 +219,6 @@ string Paths::getZrtpSecretsFilepath () {
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) {
......
......@@ -31,19 +31,18 @@
namespace Paths {
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 getCapturesDirpath ();
std::string getConfigFilepath (const QString &config_path = QString());
std::string getFactoryConfigFilepath ();
std::string getFriendsListFilepath ();
std::string getLogsDirpath ();
std::string getMessageHistoryFilepath ();
std::string getPackageDataDirpath ();
std::string getPackageMsPluginsDirpath ();
std::string getRootCaFilepath ();
std::string getThumbnailsDirpath ();
std::string getUserCertificatesDirpath ();
std::string getZrtpDataFilepath ();
std::string getZrtpSecretsFilepath ();
......
......@@ -146,6 +146,6 @@ float ContactsListProxyModel::computeContactWeight (const ContactModel *contact)
void ContactsListProxyModel::setConnectedFilter (bool use_connected_filter) {
if (use_connected_filter != m_use_connected_filter) {
m_use_connected_filter = use_connected_filter;
invalidateFilter();
invalidate();
}
}
......@@ -99,6 +99,8 @@ void CoreManager::setOtherPaths () {
m_core->setZrtpCacheDatabasePath(Paths::getZrtpDataFilepath());
m_core->setUserCertificatesPath(Paths::getUserCertificatesDirpath());
m_core->setRootCa(Paths::getRootCaFilepath());
}
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