From 512662dbdb0a7cf40d31ef4f0fde6f96165f8489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Fri, 4 Jan 2019 09:49:38 -0500 Subject: [PATCH] configurationmanager: update exportToFile API Change-Id: I6c07f8712da5b0ddc87256bfb3a19d751be42e3f Reviewed-by: Kateryna Kostiuk<kateryna.kostiuk@savoirfairelinux.com> --- src/account.cpp | 4 ++-- src/account.h | 2 +- src/api/newaccountmodel.h | 3 ++- src/newaccountmodel.cpp | 4 ++-- src/qtwrapper/configurationmanager_wrap.h | 4 ++-- test/mocks/configurationmanager_mock.h | 3 ++- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/account.cpp b/src/account.cpp index 1d3621df..c5307798 100644 --- a/src/account.cpp +++ b/src/account.cpp @@ -1041,9 +1041,9 @@ bool Account::exportOnRing(const QString& password) const return ConfigurationManager::instance().exportOnRing(id(), password); } -bool Account::exportToFile(const QString& destinationPath) const +bool Account::exportToFile(const QString& destinationPath, const QString& password) const { - return ConfigurationManager::instance().exportToFile(id(), destinationPath); + return ConfigurationManager::instance().exportToFile(id(), destinationPath, password); } #define CAST(item) static_cast<int>(item) diff --git a/src/account.h b/src/account.h index 5e9fb540..a5f0812a 100644 --- a/src/account.h +++ b/src/account.h @@ -446,7 +446,7 @@ class LIB_EXPORT Account : public ItemBase { QString lastSipRegistrationStatus () const; Q_INVOKABLE bool exportOnRing (const QString& password) const; - Q_INVOKABLE bool exportToFile (const QString& destinationPath) const; + Q_INVOKABLE bool exportToFile (const QString& destinationPath, const QString& password = {}) const; Q_INVOKABLE bool registerName (const QString& password, const QString& name) const; Q_INVOKABLE bool lookupName (const QString& name ) const; Q_INVOKABLE bool lookupAddress(const QString& address ) const; diff --git a/src/api/newaccountmodel.h b/src/api/newaccountmodel.h index 9cba75a2..65347d50 100644 --- a/src/api/newaccountmodel.h +++ b/src/api/newaccountmodel.h @@ -93,9 +93,10 @@ public: * Call exportToFile from the daemon * @param accountId * @param path destination + * @param password * @return if the file is exported with success */ - bool exportToFile(const std::string& accountId, const std::string& path) const; + bool exportToFile(const std::string& accountId, const std::string& path, const std::string& password = {}) const; /** * Call exportOnRing from the daemon * @param accountId diff --git a/src/newaccountmodel.cpp b/src/newaccountmodel.cpp index 4f420dc8..9173cae6 100644 --- a/src/newaccountmodel.cpp +++ b/src/newaccountmodel.cpp @@ -278,9 +278,9 @@ NewAccountModel::registerName(const std::string& accountId, const std::string& p } bool -NewAccountModel::exportToFile(const std::string& accountId, const std::string& path) const +NewAccountModel::exportToFile(const std::string& accountId, const std::string& path, const std::string& password) const { - return ConfigurationManager::instance().exportToFile(accountId.c_str(), path.c_str()); + return ConfigurationManager::instance().exportToFile(accountId.c_str(), path.c_str(), password.c_str()); } bool diff --git a/src/qtwrapper/configurationmanager_wrap.h b/src/qtwrapper/configurationmanager_wrap.h index 2df61484..5223bc71 100644 --- a/src/qtwrapper/configurationmanager_wrap.h +++ b/src/qtwrapper/configurationmanager_wrap.h @@ -190,8 +190,8 @@ public Q_SLOTS: // METHODS return DRing::exportOnRing(accountID.toStdString(), password.toStdString()); } - bool exportToFile(const QString& accountID, const QString& destinationPath) { - return DRing::exportToFile(accountID.toStdString(), destinationPath.toStdString()); + bool exportToFile(const QString& accountID, const QString& destinationPath, const QString& password = {}) { + return DRing::exportToFile(accountID.toStdString(), destinationPath.toStdString(), password.toStdString()); } MapStringString getKnownRingDevices(const QString& accountID) { diff --git a/test/mocks/configurationmanager_mock.h b/test/mocks/configurationmanager_mock.h index 392d8d6b..6373b971 100644 --- a/test/mocks/configurationmanager_mock.h +++ b/test/mocks/configurationmanager_mock.h @@ -144,10 +144,11 @@ public Q_SLOTS: // METHODS return false; } - bool exportToFile(const QString& accountId, const QString& destinationPath) + bool exportToFile(const QString& accountId, const QString& destinationPath, const QString& password = {}) { Q_UNUSED(accountId) Q_UNUSED(destinationPath) + Q_UNUSED(password) return false; } -- GitLab