Commit 558dbba9 authored by Ming Rui Zhang's avatar Ming Rui Zhang

accountmodel: add supplemental account config option when creating new accounts

Change-Id: Ibb100a51f86b0004533b8352520c3aafb085ea4b
parent e8f48e4b
......@@ -153,11 +153,13 @@ public:
* @param username
* @param password
* @param serverUri
* @param config
* @return the account id
*/
static QString connectToAccountManager(const QString& username,
const QString& password,
const QString& serverUri);
const QString& password,
const QString& serverUri,
const MapStringString& config = MapStringString());
/**
* Create a new Ring or SIP account
......@@ -168,6 +170,7 @@ public:
* @param password of the archive (unused for SIP)
* @param pin of the archive (unused for SIP)
* @param uri of the account (for SIP)
* @param config
* @return the created account
*/
static QString createNewAccount(profile::Type type,
......@@ -175,7 +178,8 @@ public:
const QString& archivePath = "",
const QString& password = "",
const QString& pin = "",
const QString& uri = "");
const QString& uri = "",
const MapStringString& config = MapStringString());
/**
* Set an account to the first position
......
......@@ -942,7 +942,8 @@ NewAccountModel::createNewAccount(profile::Type type,
const QString& archivePath,
const QString& password,
const QString& pin,
const QString& uri)
const QString& uri,
const MapStringString& config)
{
MapStringString details = type == profile::Type::SIP?
......@@ -956,8 +957,12 @@ NewAccountModel::createNewAccount(profile::Type type,
details[ConfProperties::ARCHIVE_PASSWORD] = password;
details[ConfProperties::ARCHIVE_PIN] = pin;
details[ConfProperties::ARCHIVE_PATH] = archivePath;
if (type == profile::Type::SIP) {
if (type == profile::Type::SIP)
details[ConfProperties::USERNAME] = uri;
if (!config.isEmpty()) {
for (MapStringString::const_iterator it = config.begin(); it != config.end(); it++) {
details[it.key()] = it.value();
}
}
QString accountId = ConfigurationManager::instance().addAccount(details);
......@@ -967,7 +972,8 @@ NewAccountModel::createNewAccount(profile::Type type,
QString
NewAccountModel::connectToAccountManager(const QString& username,
const QString& password,
const QString& serverUri)
const QString& serverUri,
const MapStringString& config)
{
MapStringString details = ConfigurationManager::instance().getAccountTemplate("RING");
using namespace DRing::Account;
......@@ -975,6 +981,11 @@ NewAccountModel::connectToAccountManager(const QString& username,
details[ConfProperties::MANAGER_URI] = serverUri;
details[ConfProperties::MANAGER_USERNAME] = username;
details[ConfProperties::ARCHIVE_PASSWORD] = password;
if (!config.isEmpty()) {
for (MapStringString::const_iterator it = config.begin(); it != config.end(); it++) {
details[it.key()] = it.value();
}
}
QString accountId = ConfigurationManager::instance().addAccount(details);
return accountId;
......
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