1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-03 14:25:38 +02:00

accountwizard: remove some useless parameters

Change-Id: I19a26ef9ea3d58565ca2e62f1b75ff8c119abdee
GitLab: #847
This commit is contained in:
Andreas Traczyk 2022-10-05 15:58:05 -04:00 committed by Sébastien Blin
parent f377f25793
commit c99d4967c6
3 changed files with 40 additions and 46 deletions

View file

@ -97,16 +97,14 @@ AccountAdapter::connectFailure()
}
void
AccountAdapter::createJamiAccount(QString registeredName,
const QVariantMap& settings,
bool isCreating)
AccountAdapter::createJamiAccount(const QVariantMap& settings)
{
auto registeredName = settings["registeredName"].toString();
Utils::oneShotConnect(
&lrcInstance_->accountModel(),
&lrc::api::AccountModel::accountAdded,
[this, registeredName, settings, isCreating](const QString& accountId) {
[this, registeredName, settings](const QString& accountId) {
lrcInstance_->accountModel().setAvatar(accountId, settings["avatar"].toString());
Utils::oneShotConnect(&lrcInstance_->accountModel(),
&lrc::api::AccountModel::accountDetailsChanged,
[this](const QString& accountId) {
@ -127,6 +125,7 @@ AccountAdapter::createJamiAccount(QString registeredName,
registeredNameSavedConnection_
= connect(&lrcInstance_->accountModel(),
&lrc::api::AccountModel::profileUpdated,
this,
[this, addedAccountId = accountId](const QString& accountId) {
if (addedAccountId == accountId) {
Q_EMIT lrcInstance_->accountListChanged();
@ -361,4 +360,4 @@ AccountAdapter::setArchivePasswordAsync(const QString& accountID, const QString&
config.archivePassword = password;
lrcInstance_->accountModel().setAccountConfig(accountID, config);
});
}
}

View file

@ -56,9 +56,7 @@ public:
Q_INVOKABLE void changeAccount(int row);
// Create normal Jami account, SIP account and JAMS accounts.
Q_INVOKABLE void createJamiAccount(QString registeredName,
const QVariantMap& settings,
bool isCreating);
Q_INVOKABLE void createJamiAccount(const QVariantMap& settings);
Q_INVOKABLE void createSIPAccount(const QVariantMap& settings);
Q_INVOKABLE void createJAMSAccount(const QVariantMap& settings);

View file

@ -32,21 +32,24 @@ WizardViewStepModel::WizardViewStepModel(LRCInstance* lrcInstance,
{
reset();
connect(accountAdapter_, &AccountAdapter::accountAdded, [this](QString accountId, int index) {
accountAdapter_->changeAccount(index);
connect(accountAdapter_,
&AccountAdapter::accountAdded,
this,
[this](QString accountId, int index) {
accountAdapter_->changeAccount(index);
auto accountCreationOption = get_accountCreationOption();
if (accountCreationOption == AccountCreationOption::ConnectToAccountManager
|| accountCreationOption == AccountCreationOption::CreateSipAccount) {
Q_EMIT closeWizardView();
reset();
} else if (accountCreationOption != AccountCreationOption::None) {
Q_EMIT closeWizardView();
reset();
}
auto accountCreationOption = get_accountCreationOption();
if (accountCreationOption == AccountCreationOption::ConnectToAccountManager
|| accountCreationOption == AccountCreationOption::CreateSipAccount) {
Q_EMIT closeWizardView();
reset();
} else if (accountCreationOption != AccountCreationOption::None) {
Q_EMIT closeWizardView();
reset();
}
Q_EMIT accountIsReady(accountId);
});
Q_EMIT accountIsReady(accountId);
});
}
void
@ -64,35 +67,29 @@ void
WizardViewStepModel::nextStep()
{
auto accountCreationOption = get_accountCreationOption();
if (accountCreationOption == AccountCreationOption::None)
if (get_mainStep() == MainSteps::Initial
|| accountCreationOption == AccountCreationOption::None) {
return;
}
switch (get_mainStep()) {
case MainSteps::NameRegistration:
case MainSteps::AccountCreation: {
switch (get_accountCreationOption()) {
case AccountCreationOption::CreateJamiAccount:
case AccountCreationOption::CreateRendezVous:
case AccountCreationOption::ImportFromBackup:
case AccountCreationOption::ImportFromDevice: {
accountAdapter_->createJamiAccount(get_accountCreationInfo()["registeredName"].toString(),
get_accountCreationInfo(),
false);
break;
}
case AccountCreationOption::ConnectToAccountManager: {
accountAdapter_->createJAMSAccount(get_accountCreationInfo());
break;
}
case AccountCreationOption::CreateSipAccount: {
accountAdapter_->createSIPAccount(get_accountCreationInfo());
break;
}
}
switch (accountCreationOption) {
case AccountCreationOption::CreateJamiAccount:
case AccountCreationOption::CreateRendezVous:
case AccountCreationOption::ImportFromBackup:
case AccountCreationOption::ImportFromDevice: {
accountAdapter_->createJamiAccount(get_accountCreationInfo());
break;
}
case AccountCreationOption::ConnectToAccountManager: {
accountAdapter_->createJAMSAccount(get_accountCreationInfo());
break;
}
case AccountCreationOption::CreateSipAccount: {
accountAdapter_->createSIPAccount(get_accountCreationInfo());
break;
}
default:
break;
return;
}
}