Skip to content
Snippets Groups Projects
Unverified Commit 12daccb5 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

accountadapter: do not set incorrect ringtone on creation

On GNU/Linux, the ringtone is managed by the deamon. No need to
manage it (incorrectly) in the client

Change-Id: I38fe783d6bd0778f702ee6da333468c54d59d678
GitLab: #351
parent 2eac155b
No related branches found
Tags nightly/20230527.0
No related merge requests found
......@@ -99,7 +99,9 @@ AccountAdapter::createJamiAccount(QString registeredName,
&lrc::api::NewAccountModel::accountAdded,
[this, registeredName, settings, isCreating](const QString& accountId) {
auto confProps = lrcInstance_->accountModel().getAccountConfig(accountId);
#ifdef Q_OS_WIN
confProps.Ringtone.ringtonePath = Utils::GetRingtonePath();
#endif
confProps.isRendezVous = settings["isRendezVous"].toBool();
lrcInstance_->accountModel().setAccountConfig(accountId, confProps);
......@@ -108,19 +110,21 @@ AccountAdapter::createJamiAccount(QString registeredName,
.toBool();
if (!registeredName.isEmpty()) {
QObject::disconnect(registeredNameSavedConnection_);
registeredNameSavedConnection_ = connect(
&lrcInstance_->accountModel(),
&lrc::api::NewAccountModel::profileUpdated,
[this, showBackup, addedAccountId = accountId](const QString& accountId) {
if (addedAccountId == accountId) {
Q_EMIT lrcInstance_->accountListChanged();
Q_EMIT accountAdded(accountId,
showBackup,
lrcInstance_->accountModel().getAccountList().indexOf(
accountId));
QObject::disconnect(registeredNameSavedConnection_);
}
});
registeredNameSavedConnection_
= connect(&lrcInstance_->accountModel(),
&lrc::api::NewAccountModel::profileUpdated,
[this, showBackup, addedAccountId = accountId](
const QString& accountId) {
if (addedAccountId == accountId) {
Q_EMIT lrcInstance_->accountListChanged();
Q_EMIT accountAdded(accountId,
showBackup,
lrcInstance_->accountModel()
.getAccountList()
.indexOf(accountId));
QObject::disconnect(registeredNameSavedConnection_);
}
});
lrcInstance_->accountModel().registerName(accountId,
settings["password"].toString(),
......@@ -128,8 +132,9 @@ AccountAdapter::createJamiAccount(QString registeredName,
} else {
Q_EMIT lrcInstance_->accountListChanged();
Q_EMIT accountAdded(accountId,
showBackup,
lrcInstance_->accountModel().getAccountList().indexOf(accountId));
showBackup,
lrcInstance_->accountModel().getAccountList().indexOf(
accountId));
}
});
......@@ -158,14 +163,17 @@ AccountAdapter::createSIPAccount(const QVariantMap& settings)
confProps.username = settings["username"].toString();
confProps.password = settings["password"].toString();
confProps.routeset = settings["proxy"].toString();
#ifdef Q_OS_WIN
confProps.Ringtone.ringtonePath = Utils::GetRingtonePath();
#endif
lrcInstance_->accountModel().setAccountConfig(accountId, confProps);
Q_EMIT lrcInstance_->accountListChanged();
Q_EMIT accountAdded(accountId,
false,
lrcInstance_->accountModel().getAccountList().indexOf(
accountId));
false,
lrcInstance_->accountModel()
.getAccountList()
.indexOf(accountId));
});
connectFailure();
......@@ -192,13 +200,16 @@ AccountAdapter::createJAMSAccount(const QVariantMap& settings)
auto confProps = lrcInstance_->accountModel().getAccountConfig(
accountId);
#ifdef Q_OS_WIN
confProps.Ringtone.ringtonePath = Utils::GetRingtonePath();
#endif
lrcInstance_->accountModel().setAccountConfig(accountId, confProps);
Q_EMIT accountAdded(accountId,
false,
lrcInstance_->accountModel().getAccountList().indexOf(
accountId));
false,
lrcInstance_->accountModel()
.getAccountList()
.indexOf(accountId));
Q_EMIT lrcInstance_->accountListChanged();
});
......
......@@ -280,7 +280,7 @@ Utils::GetRingtonePath()
#ifdef Q_OS_WIN
return QCoreApplication::applicationDirPath() + "\\ringtones\\default.opus";
#else
return QString("/usr/local");
return QString("/usr/share/ring/ringtones/default.opus");
#endif
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment