Commit 89e7438b authored by Ming Rui Zhang's avatar Ming Rui Zhang
Browse files

newwizardwidget: add ringtone path directly when creating accounts

Change-Id: Ic5dabc2cc1a401834ee2da69e497f3598c7d0687
parent 2504f3a1
...@@ -34,6 +34,9 @@ ...@@ -34,6 +34,9 @@
#include "utils.h" #include "utils.h"
#include "ringthemeutils.h" #include "ringthemeutils.h"
#undef REGISTERED
#include "../daemon/src/dring/account_const.h"
NewWizardWidget::NewWizardWidget(QWidget* parent) : NewWizardWidget::NewWizardWidget(QWidget* parent) :
NavWidget(parent), NavWidget(parent),
ui(new Ui::NewWizardWidget), ui(new Ui::NewWizardWidget),
...@@ -548,21 +551,16 @@ NewWizardWidget::createAccount() ...@@ -548,21 +551,16 @@ NewWizardWidget::createAccount()
if (isConnectingToManager) { if (isConnectingToManager) {
Utils::oneShotConnect(&LRCInstance::accountModel(), &lrc::api::NewAccountModel::accountAdded, Utils::oneShotConnect(&LRCInstance::accountModel(), &lrc::api::NewAccountModel::accountAdded,
[this](const QString& accountId) { [this](const QString& accountId) {
Q_UNUSED(accountId)
if (!LRCInstance::accountModel().getAccountList().size()) if (!LRCInstance::accountModel().getAccountList().size())
return; return;
//set default ringtone
auto confProps = LRCInstance::accountModel().getAccountConfig(accountId);
confProps.Ringtone.ringtonePath = Utils::GetRingtonePath();
LRCInstance::accountModel().setAccountConfig(accountId, confProps);
emit NavigationRequested(ScreenEnum::CallScreen); emit NavigationRequested(ScreenEnum::CallScreen);
emit LRCInstance::instance().accountListChanged(); emit LRCInstance::instance().accountListChanged();
}); });
} else { } else {
Utils::oneShotConnect(&LRCInstance::accountModel(), &lrc::api::NewAccountModel::accountAdded, Utils::oneShotConnect(&LRCInstance::accountModel(), &lrc::api::NewAccountModel::accountAdded,
[this, isRing, isCreating](const QString& accountId) { [this, isRing, isCreating](const QString& accountId) {
//set default ringtone
auto confProps = LRCInstance::accountModel().getAccountConfig(accountId); auto confProps = LRCInstance::accountModel().getAccountConfig(accountId);
confProps.Ringtone.ringtonePath = Utils::GetRingtonePath();
if (!isRing) { if (!isRing) {
// set SIP details // set SIP details
confProps.hostname = inputPara_["hostname"]; confProps.hostname = inputPara_["hostname"];
...@@ -626,11 +624,15 @@ NewWizardWidget::createAccount() ...@@ -626,11 +624,15 @@ NewWizardWidget::createAccount()
}); });
QtConcurrent::run( QtConcurrent::run(
[this, isRing, isConnectingToManager] { [this, isRing, isConnectingToManager] {
QMap<QString, QString> additionalAccountConfig;
additionalAccountConfig.insert(DRing::Account::ConfProperties::Ringtone::PATH, Utils::GetRingtonePath());
if (isConnectingToManager) { if (isConnectingToManager) {
LRCInstance::accountModel().connectToAccountManager( LRCInstance::accountModel().connectToAccountManager(
inputPara_["username"], inputPara_["username"],
inputPara_["password"], inputPara_["password"],
inputPara_["manager"] inputPara_["manager"],
additionalAccountConfig
); );
} else if (isRing) { } else if (isRing) {
LRCInstance::accountModel().createNewAccount( LRCInstance::accountModel().createNewAccount(
...@@ -638,7 +640,9 @@ NewWizardWidget::createAccount() ...@@ -638,7 +640,9 @@ NewWizardWidget::createAccount()
inputPara_["alias"], inputPara_["alias"],
inputPara_["archivePath"], inputPara_["archivePath"],
inputPara_["password"], inputPara_["password"],
inputPara_["archivePin"] inputPara_["archivePin"],
"",
additionalAccountConfig
); );
} else { } else {
LRCInstance::accountModel().createNewAccount( LRCInstance::accountModel().createNewAccount(
...@@ -647,7 +651,8 @@ NewWizardWidget::createAccount() ...@@ -647,7 +651,8 @@ NewWizardWidget::createAccount()
inputPara_["archivePath"], inputPara_["archivePath"],
"", "",
"", "",
inputPara_["username"] inputPara_["username"],
additionalAccountConfig
); );
QThread::sleep(2); QThread::sleep(2);
emit NavigationRequested(ScreenEnum::CallScreen); emit NavigationRequested(ScreenEnum::CallScreen);
......
Supports Markdown
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