1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-09-10 03:53:23 +02:00

accountadapter: move current account id and type properties to lrcinstance

Change-Id: I609452e83edd55a909d0f30aa6cb0daa3687ff3c
This commit is contained in:
Ming Rui Zhang 2021-05-13 17:47:23 -04:00
parent 76eb198b9c
commit 9d0f84d8be
32 changed files with 289 additions and 223 deletions

View file

@ -45,13 +45,11 @@ void
AccountAdapter::safeInit() AccountAdapter::safeInit()
{ {
connect(lrcInstance_, connect(lrcInstance_,
&LRCInstance::currentAccountChanged, &LRCInstance::currentAccountIdChanged,
this, this,
&AccountAdapter::onCurrentAccountChanged); &AccountAdapter::onCurrentAccountChanged);
auto accountId = lrcInstance_->getCurrAccId(); connectAccount(lrcInstance_->getCurrentAccountId());
setProperties(accountId);
connectAccount(accountId);
} }
lrc::api::NewAccountModel* lrc::api::NewAccountModel*
@ -71,7 +69,7 @@ AccountAdapter::changeAccount(int row)
{ {
auto accountList = lrcInstance_->accountModel().getAccountList(); auto accountList = lrcInstance_->accountModel().getAccountList();
if (accountList.size() > row) { if (accountList.size() > row) {
lrcInstance_->setSelectedAccountId(accountList.at(row)); lrcInstance_->setCurrentAccountId(accountList.at(row));
} }
} }
@ -228,7 +226,7 @@ AccountAdapter::createJAMSAccount(const QVariantMap& settings)
void void
AccountAdapter::deleteCurrentAccount() AccountAdapter::deleteCurrentAccount()
{ {
lrcInstance_->accountModel().removeAccount(lrcInstance_->getCurrAccId()); lrcInstance_->accountModel().removeAccount(lrcInstance_->getCurrentAccountId());
Q_EMIT lrcInstance_->accountListChanged(); Q_EMIT lrcInstance_->accountListChanged();
} }
@ -297,24 +295,24 @@ AccountAdapter::setCurrAccAvatar(bool fromFile, const QString& source)
void void
AccountAdapter::onCurrentAccountChanged() AccountAdapter::onCurrentAccountChanged()
{ {
auto accountId = lrcInstance_->getCurrAccId(); connectAccount(lrcInstance_->getCurrentAccountId());
setProperties(accountId);
connectAccount(accountId);
} }
bool bool
AccountAdapter::hasPassword() AccountAdapter::hasPassword()
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
return confProps.archiveHasPassword; return confProps.archiveHasPassword;
} }
void void
AccountAdapter::setArchiveHasPassword(bool isHavePassword) AccountAdapter::setArchiveHasPassword(bool isHavePassword)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.archiveHasPassword = isHavePassword; confProps.archiveHasPassword = isHavePassword;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
bool bool
AccountAdapter::exportToFile(const QString& accountId, AccountAdapter::exportToFile(const QString& accountId,
@ -408,12 +406,3 @@ AccountAdapter::connectAccount(const QString& accountId)
qWarning() << "Couldn't get account: " << accountId; qWarning() << "Couldn't get account: " << accountId;
} }
} }
void
AccountAdapter::setProperties(const QString& accountId)
{
setProperty("currentAccountId", accountId);
auto accountType = lrcInstance_->getAccountInfo(accountId).profileInfo.type;
setProperty("currentAccountType", lrc::api::profile::to_string(accountType));
Q_EMIT deviceModelChanged();
}

View file

@ -36,10 +36,6 @@ class AccountAdapter final : public QmlAdapterBase
Q_PROPERTY(lrc::api::NewAccountModel* model READ getModel NOTIFY modelChanged) Q_PROPERTY(lrc::api::NewAccountModel* model READ getModel NOTIFY modelChanged)
Q_PROPERTY(lrc::api::NewDeviceModel* deviceModel READ getDeviceModel NOTIFY deviceModelChanged) Q_PROPERTY(lrc::api::NewDeviceModel* deviceModel READ getDeviceModel NOTIFY deviceModelChanged)
Q_PROPERTY(QString currentAccountId MEMBER currentAccountId_ NOTIFY currentAccountIdChanged)
Q_PROPERTY(lrc::api::profile::Type currentAccountType MEMBER currentAccountType_ NOTIFY
currentAccountTypeChanged)
Q_PROPERTY(int accountListSize MEMBER accountListSize_ NOTIFY accountListSizeChanged)
public: public:
lrc::api::NewAccountModel* getModel(); lrc::api::NewAccountModel* getModel();
@ -48,9 +44,6 @@ public:
Q_SIGNALS: Q_SIGNALS:
void modelChanged(); void modelChanged();
void deviceModelChanged(); void deviceModelChanged();
void currentAccountIdChanged();
void currentAccountTypeChanged();
void accountListSizeChanged();
public: public:
explicit AccountAdapter(AppSettingsManager* settingsManager, explicit AccountAdapter(AppSettingsManager* settingsManager,
@ -114,16 +107,9 @@ private Q_SLOTS:
void onCurrentAccountChanged(); void onCurrentAccountChanged();
private: private:
QString currentAccountId_ {};
lrc::api::profile::Type currentAccountType_ {};
int accountListSize_ {};
// Make account signal connections. // Make account signal connections.
void connectAccount(const QString& accountId); void connectAccount(const QString& accountId);
// Make account signal connections.
void setProperties(const QString& accountId);
// Implement what to do when account creation fails. // Implement what to do when account creation fails.
void connectFailure(); void connectFailure();

View file

@ -64,7 +64,7 @@ public:
// Accept all contacts in conversation list filtered with account type, except those in a call. // Accept all contacts in conversation list filtered with account type, except those in a call.
auto index = sourceModel()->index(sourceRow, 0, sourceParent); auto index = sourceModel()->index(sourceRow, 0, sourceParent);
auto accountID = sourceModel()->data(index, AccountList::ID); auto accountID = sourceModel()->data(index, AccountList::ID);
return accountID != lrcInstance_->getCurrAccId(); return accountID != lrcInstance_->getCurrentAccountId();
} }
protected: protected:

View file

@ -36,7 +36,7 @@ CallAdapter::CallAdapter(SystemTray* systemTray, LRCInstance* instance, QObject*
, oneSecondTimer_(new QTimer(this)) , oneSecondTimer_(new QTimer(this))
, systemTray_(systemTray) , systemTray_(systemTray)
{ {
accountId_ = lrcInstance_->getCurrAccId(); accountId_ = lrcInstance_->getCurrentAccountId();
if (!accountId_.isEmpty()) if (!accountId_.isEmpty())
connectCallModel(accountId_); connectCallModel(accountId_);
@ -50,7 +50,10 @@ CallAdapter::CallAdapter(SystemTray* systemTray, LRCInstance* instance, QObject*
this, this,
&CallAdapter::onShowCallView); &CallAdapter::onShowCallView);
connect(lrcInstance_, &LRCInstance::currentAccountChanged, this, &CallAdapter::onAccountChanged); connect(lrcInstance_,
&LRCInstance::currentAccountIdChanged,
this,
&CallAdapter::onAccountChanged);
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
// notification responses (gnu/linux currently) // notification responses (gnu/linux currently)
@ -79,7 +82,7 @@ CallAdapter::CallAdapter(SystemTray* systemTray, LRCInstance* instance, QObject*
void void
CallAdapter::onAccountChanged() CallAdapter::onAccountChanged()
{ {
accountId_ = lrcInstance_->getCurrAccId(); accountId_ = lrcInstance_->getCurrentAccountId();
connectCallModel(accountId_); connectCallModel(accountId_);
} }
@ -197,7 +200,7 @@ CallAdapter::onShowIncomingCallView(const QString& accountId, const QString& con
if (convInfo.uid.isEmpty()) { if (convInfo.uid.isEmpty()) {
return; return;
} }
auto selectedAccountId = lrcInstance_->getCurrAccId(); auto selectedAccountId = lrcInstance_->getCurrentAccountId();
auto* callModel = lrcInstance_->getCurrentCallModel(); auto* callModel = lrcInstance_->getCurrentCallModel();
// new call // new call

View file

@ -69,7 +69,7 @@ BaseDialog {
var success = false var success = false
if (path.length > 0) { if (path.length > 0) {
success = AccountAdapter.exportToFile( success = AccountAdapter.exportToFile(
AccountAdapter.currentAccountId, LRCInstance.currentAccountId,
path, path,
currentPasswordEdit.text) currentPasswordEdit.text)
} }
@ -80,7 +80,7 @@ BaseDialog {
function savePasswordQML() { function savePasswordQML() {
var success = false var success = false
success = AccountAdapter.savePassword( success = AccountAdapter.savePassword(
AccountAdapter.currentAccountId, LRCInstance.currentAccountId,
currentPasswordEdit.text, currentPasswordEdit.text,
passwordEdit.text) passwordEdit.text)
if (success) { if (success) {

View file

@ -66,7 +66,7 @@ ColumnLayout {
} }
function setAvatarImage(mode = AvatarImage.Mode.FromAccount, function setAvatarImage(mode = AvatarImage.Mode.FromAccount,
imageId = AccountAdapter.currentAccountId){ imageId = LRCInstance.currentAccountId){
if (mode !== AvatarImage.Mode.FromBase64) if (mode !== AvatarImage.Mode.FromBase64)
avatarImg.enableAnimation = true avatarImg.enableAnimation = true
else else

View file

@ -36,7 +36,7 @@ ContactAdapter::getContactSelectableModel(int type)
if (listModeltype_ == SmartListModel::Type::CONVERSATION) { if (listModeltype_ == SmartListModel::Type::CONVERSATION) {
defaultModerators_ = lrcInstance_->accountModel().getDefaultModerators( defaultModerators_ = lrcInstance_->accountModel().getDefaultModerators(
lrcInstance_->getCurrAccId()); lrcInstance_->getCurrentAccountId());
smartListModel_.reset(new SmartListModel(this, listModeltype_, lrcInstance_)); smartListModel_.reset(new SmartListModel(this, listModeltype_, lrcInstance_));
smartListModel_->fillConversationsList(); smartListModel_->fillConversationsList();
} else { } else {
@ -64,7 +64,8 @@ ContactAdapter::getContactSelectableModel(int type)
const auto& conv = lrcInstance_->getConversationFromConvUid( const auto& conv = lrcInstance_->getConversationFromConvUid(
lrcInstance_->get_selectedConvUid()); lrcInstance_->get_selectedConvUid());
if (!conv.participants.isEmpty()) { if (!conv.participants.isEmpty()) {
QString calleeDisplayId = lrcInstance_->getAccountInfo(lrcInstance_->getCurrAccId()) QString calleeDisplayId = lrcInstance_
->getAccountInfo(lrcInstance_->getCurrentAccountId())
.contactModel->bestIdForContact(conv.participants[0]); .contactModel->bestIdForContact(conv.participants[0]);
QRegExp matchExcept = QRegExp(QString("\\b(?!" + calleeDisplayId + "\\b)\\w+")); QRegExp matchExcept = QRegExp(QString("\\b(?!" + calleeDisplayId + "\\b)\\w+"));
@ -172,7 +173,7 @@ ContactAdapter::contactSelected(int index)
return; return;
} }
lrcInstance_->accountModel().setDefaultModerator(lrcInstance_->getCurrAccId(), lrcInstance_->accountModel().setDefaultModerator(lrcInstance_->getCurrentAccountId(),
contactUri, contactUri,
true); true);
Q_EMIT defaultModeratorsUpdated(); Q_EMIT defaultModeratorsUpdated();

View file

@ -164,7 +164,7 @@ ConversationsAdapter::safeInit()
Qt::UniqueConnection); Qt::UniqueConnection);
connect(lrcInstance_, connect(lrcInstance_,
&LRCInstance::currentAccountChanged, &LRCInstance::currentAccountIdChanged,
this, this,
&ConversationsAdapter::onCurrentAccountIdChanged, &ConversationsAdapter::onCurrentAccountIdChanged,
Qt::UniqueConnection); Qt::UniqueConnection);
@ -198,7 +198,7 @@ ConversationsAdapter::onNewUnreadInteraction(const QString& accountId,
const interaction::Info& interaction) const interaction::Info& interaction)
{ {
if (!interaction.authorUri.isEmpty() if (!interaction.authorUri.isEmpty()
&& (!QApplication::focusWindow() || accountId != lrcInstance_->getCurrAccId() && (!QApplication::focusWindow() || accountId != lrcInstance_->getCurrentAccountId()
|| convUid != lrcInstance_->get_selectedConvUid())) { || convUid != lrcInstance_->get_selectedConvUid())) {
auto& accountInfo = lrcInstance_->getAccountInfo(accountId); auto& accountInfo = lrcInstance_->getAccountInfo(accountId);
auto from = accountInfo.contactModel->bestNameForContact(interaction.authorUri); auto from = accountInfo.contactModel->bestNameForContact(interaction.authorUri);
@ -248,7 +248,7 @@ void
ConversationsAdapter::onNewTrustRequest(const QString& accountId, const QString& peerUri) ConversationsAdapter::onNewTrustRequest(const QString& accountId, const QString& peerUri)
{ {
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
if (!QApplication::focusWindow() || accountId != lrcInstance_->getCurrAccId()) { if (!QApplication::focusWindow() || accountId != lrcInstance_->getCurrentAccountId()) {
auto& accInfo = lrcInstance_->getAccountInfo(accountId); auto& accInfo = lrcInstance_->getAccountInfo(accountId);
auto from = accInfo.contactModel->bestNameForContact(peerUri); auto from = accInfo.contactModel->bestNameForContact(peerUri);
auto contactPhoto = Utils::contactPhoto(lrcInstance_, peerUri, QSize(50, 50), accountId); auto contactPhoto = Utils::contactPhoto(lrcInstance_, peerUri, QSize(50, 50), accountId);

View file

@ -115,7 +115,20 @@ LRCInstance::getAccountInfo(const QString& accountId)
const account::Info& const account::Info&
LRCInstance::getCurrentAccountInfo() LRCInstance::getCurrentAccountInfo()
{ {
return getAccountInfo(getCurrAccId()); return getAccountInfo(getCurrentAccountId());
}
profile::Type
LRCInstance::getCurrentAccountType()
{
if (currentAccountType_ == profile::Type::INVALID) {
try {
currentAccountType_ = getCurrentAccountInfo().profileInfo.type;
} catch (...) {
qDebug() << "Cannot find current account info";
}
}
return currentAccountType_;
} }
bool bool
@ -186,7 +199,8 @@ LRCInstance::getCallInfoForConversation(const conversation::Info& convInfo, bool
const conversation::Info& const conversation::Info&
LRCInstance::getConversationFromConvUid(const QString& convUid, const QString& accountId) LRCInstance::getConversationFromConvUid(const QString& convUid, const QString& accountId)
{ {
auto& accInfo = accountModel().getAccountInfo(!accountId.isEmpty() ? accountId : getCurrAccId()); auto& accInfo = accountModel().getAccountInfo(!accountId.isEmpty() ? accountId
: getCurrentAccountId());
auto& convModel = accInfo.conversationModel; auto& convModel = accInfo.conversationModel;
return convModel->getConversationForUid(convUid).value_or(invalid); return convModel->getConversationForUid(convUid).value_or(invalid);
} }
@ -194,7 +208,8 @@ LRCInstance::getConversationFromConvUid(const QString& convUid, const QString& a
const conversation::Info& const conversation::Info&
LRCInstance::getConversationFromPeerUri(const QString& peerUri, const QString& accountId) LRCInstance::getConversationFromPeerUri(const QString& peerUri, const QString& accountId)
{ {
auto& accInfo = accountModel().getAccountInfo(!accountId.isEmpty() ? accountId : getCurrAccId()); auto& accInfo = accountModel().getAccountInfo(!accountId.isEmpty() ? accountId
: getCurrentAccountId());
auto& convModel = accInfo.conversationModel; auto& convModel = accInfo.conversationModel;
return convModel->getConversationForPeerUri(peerUri).value_or(invalid); return convModel->getConversationForPeerUri(peerUri).value_or(invalid);
} }
@ -202,7 +217,8 @@ LRCInstance::getConversationFromPeerUri(const QString& peerUri, const QString& a
const conversation::Info& const conversation::Info&
LRCInstance::getConversationFromCallId(const QString& callId, const QString& accountId) LRCInstance::getConversationFromCallId(const QString& callId, const QString& accountId)
{ {
auto& accInfo = accountModel().getAccountInfo(!accountId.isEmpty() ? accountId : getCurrAccId()); auto& accInfo = accountModel().getAccountInfo(!accountId.isEmpty() ? accountId
: getCurrentAccountId());
auto& convModel = accInfo.conversationModel; auto& convModel = accInfo.conversationModel;
return convModel->getConversationForCallId(callId).value_or(invalid); return convModel->getConversationForCallId(callId).value_or(invalid);
} }
@ -241,35 +257,42 @@ LRCInstance::getCurrentContactModel()
} }
const QString& const QString&
LRCInstance::getCurrAccId() LRCInstance::getCurrentAccountId()
{ {
if (selectedAccountId_.isEmpty()) { if (currentAccountId_.isEmpty()) {
auto accountList = accountModel().getAccountList(); auto accountList = accountModel().getAccountList();
if (accountList.size()) if (accountList.size())
selectedAccountId_ = accountList.at(0); currentAccountId_ = accountList.at(0);
} }
return selectedAccountId_; return currentAccountId_;
} }
void void
LRCInstance::setSelectedAccountId(const QString& accountId) LRCInstance::setCurrentAccountId(const QString& accountId)
{ {
if (accountId == selectedAccountId_) if (accountId == currentAccountId_)
return; // No need to select current selected account return; // No need to select current selected account
selectedAccountId_ = accountId; auto newAccountType = getAccountInfo(accountId).profileInfo.type;
bool accountTypeChanged = getCurrentAccountType() != newAccountType;
currentAccountId_ = accountId;
// Last selected account should be set as preferred. // Last selected account should be set as preferred.
accountModel().setTopAccount(accountId); accountModel().setTopAccount(accountId);
Q_EMIT currentAccountChanged(); if (accountTypeChanged) {
currentAccountType_ = newAccountType;
Q_EMIT currentAccountTypeChanged(newAccountType);
}
Q_EMIT currentAccountIdChanged(accountId);
} }
int int
LRCInstance::getCurrentAccountIndex() LRCInstance::getCurrentAccountIndex()
{ {
for (int i = 0; i < accountModel().getAccountList().size(); i++) { for (int i = 0; i < accountModel().getAccountList().size(); i++) {
if (accountModel().getAccountList()[i] == getCurrAccId()) { if (accountModel().getAccountList()[i] == getCurrentAccountId()) {
return i; return i;
} }
} }
@ -295,19 +318,19 @@ LRCInstance::setCurrAccAvatar(const QPixmap& avatarPixmap)
bu.open(QIODevice::WriteOnly); bu.open(QIODevice::WriteOnly);
avatarPixmap.save(&bu, "PNG"); avatarPixmap.save(&bu, "PNG");
auto str = QString::fromLocal8Bit(ba.toBase64()); auto str = QString::fromLocal8Bit(ba.toBase64());
accountModel().setAvatar(getCurrAccId(), str); accountModel().setAvatar(getCurrentAccountId(), str);
} }
void void
LRCInstance::setCurrAccAvatar(const QString& avatar) LRCInstance::setCurrAccAvatar(const QString& avatar)
{ {
accountModel().setAvatar(getCurrAccId(), avatar); accountModel().setAvatar(getCurrentAccountId(), avatar);
} }
void void
LRCInstance::setCurrAccDisplayName(const QString& displayName) LRCInstance::setCurrAccDisplayName(const QString& displayName)
{ {
auto accountId = getCurrAccId(); auto accountId = getCurrentAccountId();
accountModel().setAlias(accountId, displayName); accountModel().setAlias(accountId, displayName);
/* /*
* Force save to .yml. * Force save to .yml.
@ -413,11 +436,11 @@ LRCInstance::selectConversation(const QString& convId, const QString& accountId)
{ {
// if the account is not currently selected, do that first, then // if the account is not currently selected, do that first, then
// proceed to select the conversation // proceed to select the conversation
if (!accountId.isEmpty() && accountId != getCurrAccId()) { if (!accountId.isEmpty() && accountId != getCurrentAccountId()) {
Utils::oneShotConnect(this, &LRCInstance::currentAccountChanged, [this, convId] { Utils::oneShotConnect(this, &LRCInstance::currentAccountIdChanged, [this, convId] {
set_selectedConvUid(convId); set_selectedConvUid(convId);
}); });
setSelectedAccountId(accountId); setCurrentAccountId(accountId);
return; return;
} }
set_selectedConvUid(convId); set_selectedConvUid(convId);

View file

@ -55,6 +55,10 @@ class LRCInstance : public QObject
{ {
Q_OBJECT Q_OBJECT
QML_PROPERTY(QString, selectedConvUid) QML_PROPERTY(QString, selectedConvUid)
Q_PROPERTY(lrc::api::profile::Type currentAccountType READ getCurrentAccountType NOTIFY
currentAccountTypeChanged)
Q_PROPERTY(QString currentAccountId READ getCurrentAccountId WRITE setCurrentAccountId NOTIFY
currentAccountIdChanged)
public: public:
explicit LRCInstance(migrateCallback willMigrateCb = {}, explicit LRCInstance(migrateCallback willMigrateCb = {},
@ -85,6 +89,7 @@ public:
const account::Info& getAccountInfo(const QString& accountId); const account::Info& getAccountInfo(const QString& accountId);
const account::Info& getCurrentAccountInfo(); const account::Info& getCurrentAccountInfo();
profile::Type getCurrentAccountType();
QString getCallIdForConversationUid(const QString& convUid, const QString& accountId); QString getCallIdForConversationUid(const QString& convUid, const QString& accountId);
const call::Info* getCallInfo(const QString& callId, const QString& accountId); const call::Info* getCallInfo(const QString& callId, const QString& accountId);
const call::Info* getCallInfoForConversation(const conversation::Info& convInfo, const call::Info* getCallInfoForConversation(const conversation::Info& convInfo,
@ -99,8 +104,8 @@ public:
Q_INVOKABLE void selectConversation(const QString& convId, const QString& accountId = {}); Q_INVOKABLE void selectConversation(const QString& convId, const QString& accountId = {});
Q_INVOKABLE void deselectConversation(); Q_INVOKABLE void deselectConversation();
const QString& getCurrAccId(); const QString& getCurrentAccountId();
void setSelectedAccountId(const QString& accountId = {}); void setCurrentAccountId(const QString& accountId = {});
int getCurrentAccountIndex(); int getCurrentAccountIndex();
void setAvatarForAccount(const QPixmap& avatarPixmap, const QString& accountID); void setAvatarForAccount(const QPixmap& avatarPixmap, const QString& accountID);
void setCurrAccAvatar(const QPixmap& avatarPixmap); void setCurrAccAvatar(const QPixmap& avatarPixmap);
@ -122,19 +127,22 @@ public:
Q_SIGNALS: Q_SIGNALS:
void accountListChanged(); void accountListChanged();
void currentAccountChanged();
void restoreAppRequested(); void restoreAppRequested();
void notificationClicked(); void notificationClicked();
void quitEngineRequested(); void quitEngineRequested();
void conversationUpdated(const QString& convId, const QString& accountId); void conversationUpdated(const QString& convId, const QString& accountId);
void draftSaved(const QString& convId); void draftSaved(const QString& convId);
void contactBanned(const QString& uri); void contactBanned(const QString& uri);
void currentAccountIdChanged(const QString& accountId);
void currentAccountTypeChanged(profile::Type type);
private: private:
std::unique_ptr<Lrc> lrc_; std::unique_ptr<Lrc> lrc_;
std::unique_ptr<RenderManager> renderer_; std::unique_ptr<RenderManager> renderer_;
std::unique_ptr<UpdateManager> updateManager_; std::unique_ptr<UpdateManager> updateManager_;
QString selectedAccountId_ {};
QString currentAccountId_ {};
profile::Type currentAccountType_ = profile::Type::INVALID;
MapStringString contentDrafts_; MapStringString contentDrafts_;
MapStringString lastConferences_; MapStringString lastConferences_;

View file

@ -57,7 +57,7 @@ Rectangle {
signal loaderSourceChangeRequested(int sourceToLoad) signal loaderSourceChangeRequested(int sourceToLoad)
property string currentAccountId: AccountAdapter.currentAccountId property string currentAccountId: LRCInstance.currentAccountId
onCurrentAccountIdChanged: { onCurrentAccountIdChanged: {
if (inSettingsView) { if (inSettingsView) {
settingsView.accountListChanged() settingsView.accountListChanged()
@ -115,7 +115,7 @@ Rectangle {
} }
function currentAccountIsCalling() { function currentAccountIsCalling() {
return UtilsAdapter.hasCall(AccountAdapter.currentAccountId) return UtilsAdapter.hasCall(LRCInstance.currentAccountId)
} }
// Only called onWidthChanged // Only called onWidthChanged
@ -137,7 +137,7 @@ Rectangle {
return return
if (checkCurrentCall && currentAccountIsCalling()) { if (checkCurrentCall && currentAccountIsCalling()) {
var callConv = UtilsAdapter.getCallConvForAccount( var callConv = UtilsAdapter.getCallConvForAccount(
AccountAdapter.currentAccountId) LRCInstance.currentAccountId)
LRCInstance.selectConversation(callConv) LRCInstance.selectConversation(callConv)
CallAdapter.updateCall(callConv, currentAccountId) CallAdapter.updateCall(callConv, currentAccountId)
} else { } else {
@ -187,13 +187,13 @@ Rectangle {
} }
MessagesAdapter.setupChatView(convId) MessagesAdapter.setupChatView(convId)
callStackView.setLinkedWebview(communicationPageMessageWebView) callStackView.setLinkedWebview(communicationPageMessageWebView)
callStackView.responsibleAccountId = AccountAdapter.currentAccountId callStackView.responsibleAccountId = LRCInstance.currentAccountId
callStackView.responsibleConvUid = convId callStackView.responsibleConvUid = convId
currentConvUID = convId currentConvUID = convId
if (item.callState === Call.Status.IN_PROGRESS || if (item.callState === Call.Status.IN_PROGRESS ||
item.callState === Call.Status.PAUSED) { item.callState === Call.Status.PAUSED) {
CallAdapter.updateCall(convId, AccountAdapter.currentAccountId) CallAdapter.updateCall(convId, LRCInstance.currentAccountId)
if (item.isAudioOnly) if (item.isAudioOnly)
callStackView.showAudioCallPage() callStackView.showAudioCallPage()
else else

View file

@ -38,16 +38,20 @@ Label {
Connections { Connections {
target: AccountAdapter target: AccountAdapter
function onCurrentAccountIdChanged() {
root.update()
resetAccountListModel(AccountAdapter.currentAccountId)
}
function onAccountStatusChanged(accountId) { function onAccountStatusChanged(accountId) {
resetAccountListModel(accountId) resetAccountListModel(accountId)
} }
} }
Connections {
target: LRCInstance
function onCurrentAccountIdChanged() {
root.update()
resetAccountListModel(LRCInstance.currentAccountId)
}
}
function resetAccountListModel(accountId) { function resetAccountListModel(accountId) {
AccountListModel.updateAvatarUid(accountId) AccountListModel.updateAvatarUid(accountId)
AccountListModel.reset() AccountListModel.reset()
@ -108,7 +112,7 @@ Label {
target: AccountListModel target: AccountListModel
function onModelReset() { function onModelReset() {
avatar.updateImage(AccountAdapter.currentAccountId, avatar.updateImage(LRCInstance.currentAccountId,
AccountListModel.data(AccountListModel.index(0, 0), AccountListModel.data(AccountListModel.index(0, 0),
AccountList.PictureUid)) AccountList.PictureUid))
avatar.presenceStatus = AccountListModel.data(AccountListModel.index(0, 0), avatar.presenceStatus = AccountListModel.data(AccountListModel.index(0, 0),
@ -133,7 +137,7 @@ Label {
Layout.preferredHeight: JamiTheme.accountListAvatarSize Layout.preferredHeight: JamiTheme.accountListAvatarSize
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
imageId: AccountAdapter.currentAccountId imageId: LRCInstance.currentAccountId
presenceStatus: AccountListModel.data(AccountListModel.index(0, 0), presenceStatus: AccountListModel.data(AccountListModel.index(0, 0),
AccountList.Status) AccountList.Status)
@ -208,7 +212,7 @@ Label {
height: visible ? preferredSize : 0 height: visible ? preferredSize : 0
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
visible: AccountAdapter.currentAccountType === Profile.Type.RING visible: LRCInstance.currentAccountType === Profile.Type.RING
toolTipText: JamiStrings.displayQRCode toolTipText: JamiStrings.displayQRCode
source: "qrc:/images/icons/share-24px.svg" source: "qrc:/images/icons/share-24px.svg"

View file

@ -136,7 +136,7 @@ ListView {
"contactType": model.dataForRow(row, ConversationList.ContactType), "contactType": model.dataForRow(row, ConversationList.ContactType),
} }
responsibleAccountId = AccountAdapter.currentAccountId responsibleAccountId = LRCInstance.currentAccountId
responsibleConvUid = item.convId responsibleConvUid = item.convId
contactType = item.contactType contactType = item.contactType
@ -175,7 +175,7 @@ ListView {
context: Qt.ApplicationShortcut context: Qt.ApplicationShortcut
enabled: root.visible enabled: root.visible
onActivated: MessagesAdapter.clearConversationHistory( onActivated: MessagesAdapter.clearConversationHistory(
AccountAdapter.currentAccountId, LRCInstance.currentAccountId,
UtilsAdapter.getCurrConvId()) UtilsAdapter.getCurrConvId())
} }
@ -193,7 +193,7 @@ ListView {
context: Qt.ApplicationShortcut context: Qt.ApplicationShortcut
enabled: root.visible enabled: root.visible
onActivated: MessagesAdapter.removeConversation( onActivated: MessagesAdapter.removeConversation(
AccountAdapter.currentAccountId, LRCInstance.currentAccountId,
UtilsAdapter.getCurrConvId(), UtilsAdapter.getCurrConvId(),
false) false)
} }

View file

@ -58,7 +58,7 @@ Rectangle {
contactImage.updateImage(avatar) contactImage.updateImage(avatar)
} else if (local) { } else if (local) {
contactImage.mode = AvatarImage.Mode.FromAccount contactImage.mode = AvatarImage.Mode.FromAccount
contactImage.updateImage(AccountAdapter.currentAccountId) contactImage.updateImage(LRCInstance.currentAccountId)
} else if (isContact) { } else if (isContact) {
contactImage.mode = AvatarImage.Mode.FromContactUri contactImage.mode = AvatarImage.Mode.FromContactUri
contactImage.updateImage(uri) contactImage.updateImage(uri)

View file

@ -65,7 +65,7 @@ Popup {
pluginhandlerPickerListView.model = PluginAdapter.getMediaHandlerSelectableModel(callId) pluginhandlerPickerListView.model = PluginAdapter.getMediaHandlerSelectableModel(callId)
} else { } else {
// Reset the model on each show. // Reset the model on each show.
var accountId = AccountAdapter.currentAccountId var accountId = LRCInstance.currentAccountId
var peerId = UtilsAdapter.getPeerUri(accountId, UtilsAdapter.getCurrConvId()) var peerId = UtilsAdapter.getPeerUri(accountId, UtilsAdapter.getCurrConvId())
pluginhandlerPickerListView.model = PluginAdapter.getChatHandlerSelectableModel(accountId, peerId) pluginhandlerPickerListView.model = PluginAdapter.getChatHandlerSelectableModel(accountId, peerId)
} }
@ -79,7 +79,7 @@ Popup {
PluginModel.toggleCallMediaHandler(handlerId, callId, !isLoaded) PluginModel.toggleCallMediaHandler(handlerId, callId, !isLoaded)
pluginhandlerPickerListView.model = PluginAdapter.getMediaHandlerSelectableModel(callId) pluginhandlerPickerListView.model = PluginAdapter.getMediaHandlerSelectableModel(callId)
} else { } else {
var accountId = AccountAdapter.currentAccountId var accountId = LRCInstance.currentAccountId
var peerId = UtilsAdapter.getPeerUri(accountId, UtilsAdapter.getCurrConvId()) var peerId = UtilsAdapter.getPeerUri(accountId, UtilsAdapter.getCurrConvId())
PluginModel.toggleChatHandler(handlerId, accountId, peerId, !isLoaded) PluginModel.toggleChatHandler(handlerId, accountId, peerId, !isLoaded)
pluginhandlerPickerListView.model = PluginAdapter.getChatHandlerSelectableModel(accountId, peerId) pluginhandlerPickerListView.model = PluginAdapter.getChatHandlerSelectableModel(accountId, peerId)
@ -138,7 +138,7 @@ Popup {
callStackViewWindow.responsibleConvUid) callStackViewWindow.responsibleConvUid)
return PluginAdapter.getMediaHandlerSelectableModel(callId) return PluginAdapter.getMediaHandlerSelectableModel(callId)
} else { } else {
var accountId = AccountAdapter.currentAccountId var accountId = LRCInstance.currentAccountId
var peerId = UtilsAdapter.getPeerUri(accountId, UtilsAdapter.getCurrConvId()) var peerId = UtilsAdapter.getPeerUri(accountId, UtilsAdapter.getCurrConvId())
return PluginAdapter.getChatHandlerSelectableModel(accountId, peerId) return PluginAdapter.getChatHandlerSelectableModel(accountId, peerId)
} }

View file

@ -38,16 +38,20 @@ Rectangle {
Connections { Connections {
target: AccountAdapter target: AccountAdapter
function onCurrentAccountIdChanged() {
clearContactSearchBar()
}
function onSelectedContactAdded(convId) { function onSelectedContactAdded(convId) {
clearContactSearchBar() clearContactSearchBar()
LRCInstance.selectConversation(convId) LRCInstance.selectConversation(convId)
} }
} }
Connections {
target: LRCInstance
function onCurrentAccountIdChanged() {
clearContactSearchBar()
}
}
function clearContactSearchBar() { function clearContactSearchBar() {
contactSearchBar.clearText() contactSearchBar.clearText()
} }

View file

@ -43,7 +43,7 @@ TabBar {
function selectTab(tabIndex) { function selectTab(tabIndex) {
ConversationsAdapter.currentTypeFilter = ConversationsAdapter.currentTypeFilter =
(tabIndex === SidePanelTabBar.Conversations) ? (tabIndex === SidePanelTabBar.Conversations) ?
AccountAdapter.currentAccountType : LRCInstance.currentAccountType :
Profile.Type.PENDING Profile.Type.PENDING
} }

View file

@ -166,7 +166,7 @@ ItemDelegate {
onClicked: ListView.view.model.select(index) onClicked: ListView.view.model.select(index)
onDoubleClicked: { onDoubleClicked: {
ListView.view.model.select(index) ListView.view.model.select(index)
if (AccountAdapter.currentAccountType === Profile.Type.SIP) if (LRCInstance.currentAccountType === Profile.Type.SIP)
CallAdapter.placeAudioOnlyCall() CallAdapter.placeAudioOnlyCall()
else else
CallAdapter.placeCall() CallAdapter.placeCall()

View file

@ -79,7 +79,7 @@ Rectangle {
function handleParticipantsInfo(infos) { function handleParticipantsInfo(infos) {
if (infos.length === 0) { if (infos.length === 0) {
bestName = UtilsAdapter.getBestName(AccountAdapter.currentAccountId, bestName = UtilsAdapter.getBestName(LRCInstance.currentAccountId,
UtilsAdapter.getCurrConvId()) UtilsAdapter.getCurrConvId())
} else { } else {
bestName = "" bestName = ""

View file

@ -91,7 +91,7 @@ Rectangle {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
visible: AccountAdapter.currentAccountType === Profile.Type.RING visible: LRCInstance.currentAccountType === Profile.Type.RING
text: JamiStrings.shareInvite text: JamiStrings.shareInvite
color: JamiTheme.faddedFontColor color: JamiTheme.faddedFontColor
@ -106,7 +106,7 @@ Rectangle {
color: JamiTheme.secondaryBackgroundColor color: JamiTheme.secondaryBackgroundColor
visible: AccountAdapter.currentAccountType === Profile.Type.RING visible: LRCInstance.currentAccountType === Profile.Type.RING
ColumnLayout { ColumnLayout {
id: jamiRegisteredNameRectColumnLayout id: jamiRegisteredNameRectColumnLayout
@ -128,7 +128,7 @@ Rectangle {
TextMetrics { TextMetrics {
id: textMetricsjamiRegisteredNameText id: textMetricsjamiRegisteredNameText
font: jamiRegisteredNameText.font font: jamiRegisteredNameText.font
text: UtilsAdapter.getBestId(AccountAdapter.currentAccountId) text: UtilsAdapter.getBestId(LRCInstance.currentAccountId)
elideWidth: welcomePageColumnLayout.width elideWidth: welcomePageColumnLayout.width
elide: Qt.ElideMiddle elide: Qt.ElideMiddle
} }

View file

@ -49,9 +49,9 @@ ModalPopup {
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
source: { source: {
if (AccountAdapter.currentAccountId && if (LRCInstance.currentAccountId &&
AccountAdapter.currentAccountType === Profile.Type.RING) LRCInstance.currentAccountType === Profile.Type.RING)
return "image://qrImage/account_" + AccountAdapter.currentAccountId return "image://qrImage/account_" + LRCInstance.currentAccountId
return "" return ""
} }
} }

View file

@ -48,7 +48,7 @@ MessagesAdapter::MessagesAdapter(AppSettingsManager* settingsManager,
void void
MessagesAdapter::safeInit() MessagesAdapter::safeInit()
{ {
connect(lrcInstance_, &LRCInstance::currentAccountChanged, [this]() { connect(lrcInstance_, &LRCInstance::currentAccountIdChanged, [this]() {
currentConvUid_.clear(); currentConvUid_.clear();
connectConversationModel(); connectConversationModel();
}); });
@ -73,7 +73,7 @@ MessagesAdapter::setupChatView(const QString& convUid)
QString contactURI = convInfo.participants.at(0); QString contactURI = convInfo.participants.at(0);
auto selectedAccountId = lrcInstance_->getCurrAccId(); auto selectedAccountId = lrcInstance_->getCurrentAccountId();
auto& accountInfo = lrcInstance_->accountModel().getAccountInfo(selectedAccountId); auto& accountInfo = lrcInstance_->accountModel().getAccountInfo(selectedAccountId);
lrc::api::contact::Info contactInfo; lrc::api::contact::Info contactInfo;
@ -131,7 +131,7 @@ MessagesAdapter::connectConversationModel()
[this](const QString& convUid, [this](const QString& convUid,
uint64_t interactionId, uint64_t interactionId,
const lrc::api::interaction::Info& interaction) { const lrc::api::interaction::Info& interaction) {
auto accountId = lrcInstance_->getCurrAccId(); auto accountId = lrcInstance_->getCurrentAccountId();
newInteraction(accountId, convUid, interactionId, interaction); newInteraction(accountId, convUid, interactionId, interaction);
}); });
@ -180,7 +180,7 @@ void
MessagesAdapter::slotSendMessageContentSaved(const QString& content) MessagesAdapter::slotSendMessageContentSaved(const QString& content)
{ {
if (!LastConvUid_.isEmpty()) { if (!LastConvUid_.isEmpty()) {
lrcInstance_->setContentDraft(LastConvUid_, lrcInstance_->getCurrAccId(), content); lrcInstance_->setContentDraft(LastConvUid_, lrcInstance_->getCurrentAccountId(), content);
} }
LastConvUid_ = lrcInstance_->get_selectedConvUid(); LastConvUid_ = lrcInstance_->get_selectedConvUid();
@ -189,7 +189,7 @@ MessagesAdapter::slotSendMessageContentSaved(const QString& content)
setInvitation(false); setInvitation(false);
clear(); clear();
auto restoredContent = lrcInstance_->getContentDraft(lrcInstance_->get_selectedConvUid(), auto restoredContent = lrcInstance_->getContentDraft(lrcInstance_->get_selectedConvUid(),
lrcInstance_->getCurrAccId()); lrcInstance_->getCurrentAccountId());
setSendMessageContent(restoredContent); setSendMessageContent(restoredContent);
} }
@ -197,7 +197,7 @@ void
MessagesAdapter::slotUpdateDraft(const QString& content) MessagesAdapter::slotUpdateDraft(const QString& content)
{ {
if (!LastConvUid_.isEmpty()) { if (!LastConvUid_.isEmpty()) {
lrcInstance_->setContentDraft(LastConvUid_, lrcInstance_->getCurrAccId(), content); lrcInstance_->setContentDraft(LastConvUid_, lrcInstance_->getCurrentAccountId(), content);
} }
} }

View file

@ -52,7 +52,7 @@ ModeratorListModel::data(const QModelIndex& index, int role) const
{ {
try { try {
QStringList list = lrcInstance_->accountModel().getDefaultModerators( QStringList list = lrcInstance_->accountModel().getDefaultModerators(
lrcInstance_->getCurrAccId()); lrcInstance_->getCurrentAccountId());
if (!index.isValid() || list.size() <= index.row()) { if (!index.isValid() || list.size() <= index.row()) {
return QVariant(); return QVariant();
} }

View file

@ -257,7 +257,7 @@ SettingsAdapter::getCurrentAccount_Profile_Info_Type()
QString QString
SettingsAdapter::getAccountBestName() SettingsAdapter::getAccountBestName()
{ {
return lrcInstance_->accountModel().bestNameForAccount(lrcInstance_->getCurrAccId()); return lrcInstance_->accountModel().bestNameForAccount(lrcInstance_->getCurrentAccountId());
} }
lrc::api::account::ConfProperties_t lrc::api::account::ConfProperties_t
@ -265,7 +265,7 @@ SettingsAdapter::getAccountConfig()
{ {
lrc::api::account::ConfProperties_t res; lrc::api::account::ConfProperties_t res;
try { try {
res = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); res = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrentAccountId());
} catch (...) { } catch (...) {
} }
return res; return res;
@ -564,7 +564,7 @@ SettingsAdapter::setAccountConfig_Username(QString input)
{ {
auto confProps = getAccountConfig(); auto confProps = getAccountConfig();
confProps.username = input; confProps.username = input;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
@ -572,7 +572,7 @@ SettingsAdapter::setAccountConfig_Hostname(QString input)
{ {
auto confProps = getAccountConfig(); auto confProps = getAccountConfig();
confProps.hostname = input; confProps.hostname = input;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
@ -580,7 +580,7 @@ SettingsAdapter::setAccountConfig_Password(QString input)
{ {
auto confProps = getAccountConfig(); auto confProps = getAccountConfig();
confProps.password = input; confProps.password = input;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
@ -588,326 +588,366 @@ SettingsAdapter::setAccountConfig_RouteSet(QString input)
{ {
auto confProps = getAccountConfig(); auto confProps = getAccountConfig();
confProps.routeset = input; confProps.routeset = input;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::setAutoConnectOnLocalNetwork(bool state) SettingsAdapter::setAutoConnectOnLocalNetwork(bool state)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.peerDiscovery = state; confProps.peerDiscovery = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::setCallsUntrusted(bool state) SettingsAdapter::setCallsUntrusted(bool state)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.DHT.PublicInCalls = state; confProps.DHT.PublicInCalls = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::setIsRendezVous(bool state) SettingsAdapter::setIsRendezVous(bool state)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.isRendezVous = state; confProps.isRendezVous = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::setAutoAnswerCalls(bool state) SettingsAdapter::setAutoAnswerCalls(bool state)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.autoAnswer = state; confProps.autoAnswer = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::setEnableRingtone(bool state) SettingsAdapter::setEnableRingtone(bool state)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.Ringtone.ringtoneEnabled = state; confProps.Ringtone.ringtoneEnabled = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::setEnableProxy(bool state) SettingsAdapter::setEnableProxy(bool state)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.proxyEnabled = state; confProps.proxyEnabled = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::setKeepAliveEnabled(bool state) SettingsAdapter::setKeepAliveEnabled(bool state)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.keepAliveEnabled = state; confProps.keepAliveEnabled = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::setUseUPnP(bool state) SettingsAdapter::setUseUPnP(bool state)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.upnpEnabled = state; confProps.upnpEnabled = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::setUseTURN(bool state) SettingsAdapter::setUseTURN(bool state)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TURN.enable = state; confProps.TURN.enable = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::setUseSTUN(bool state) SettingsAdapter::setUseSTUN(bool state)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.STUN.enable = state; confProps.STUN.enable = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::setVideoState(bool state) SettingsAdapter::setVideoState(bool state)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.Video.videoEnabled = state; confProps.Video.videoEnabled = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::setUseSRTP(bool state) SettingsAdapter::setUseSRTP(bool state)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.SRTP.enable = state; confProps.SRTP.enable = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::setUseSDES(bool state) SettingsAdapter::setUseSDES(bool state)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.SRTP.keyExchange = state ? lrc::api::account::KeyExchangeProtocol::SDES confProps.SRTP.keyExchange = state ? lrc::api::account::KeyExchangeProtocol::SDES
: lrc::api::account::KeyExchangeProtocol::NONE; : lrc::api::account::KeyExchangeProtocol::NONE;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::setUseRTPFallback(bool state) SettingsAdapter::setUseRTPFallback(bool state)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.SRTP.rtpFallback = state; confProps.SRTP.rtpFallback = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::setUseTLS(bool state) SettingsAdapter::setUseTLS(bool state)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TLS.enable = state; confProps.TLS.enable = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::setVerifyCertificatesServer(bool state) SettingsAdapter::setVerifyCertificatesServer(bool state)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TLS.verifyServer = state; confProps.TLS.verifyServer = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::setVerifyCertificatesClient(bool state) SettingsAdapter::setVerifyCertificatesClient(bool state)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TLS.verifyClient = state; confProps.TLS.verifyClient = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::setRequireCertificatesIncomingTLS(bool state) SettingsAdapter::setRequireCertificatesIncomingTLS(bool state)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TLS.requireClientCertificate = state; confProps.TLS.requireClientCertificate = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::setUseCustomAddressAndPort(bool state) SettingsAdapter::setUseCustomAddressAndPort(bool state)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.publishedSameAsLocal = state; confProps.publishedSameAsLocal = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::setNameServer(QString text) SettingsAdapter::setNameServer(QString text)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.RingNS.uri = text; confProps.RingNS.uri = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::setProxyAddress(QString text) SettingsAdapter::setProxyAddress(QString text)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.proxyServer = text; confProps.proxyServer = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::setBootstrapAddress(QString text) SettingsAdapter::setBootstrapAddress(QString text)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.hostname = text; confProps.hostname = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::setTURNAddress(QString text) SettingsAdapter::setTURNAddress(QString text)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TURN.server = text; confProps.TURN.server = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::setTURNUsername(QString text) SettingsAdapter::setTURNUsername(QString text)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TURN.username = text; confProps.TURN.username = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::setTURNPassword(QString text) SettingsAdapter::setTURNPassword(QString text)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TURN.password = text; confProps.TURN.password = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::setTURNRealm(QString text) SettingsAdapter::setTURNRealm(QString text)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TURN.realm = text; confProps.TURN.realm = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::setSTUNAddress(QString text) SettingsAdapter::setSTUNAddress(QString text)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.STUN.server = text; confProps.STUN.server = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::lineEditVoiceMailDialCodeEditFinished(QString text) SettingsAdapter::lineEditVoiceMailDialCodeEditFinished(QString text)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.mailbox = text; confProps.mailbox = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::outgoingTLSServerNameLineEditTextChanged(QString text) SettingsAdapter::outgoingTLSServerNameLineEditTextChanged(QString text)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TLS.serverName = text; confProps.TLS.serverName = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::lineEditSIPCertPasswordLineEditTextChanged(QString text) SettingsAdapter::lineEditSIPCertPasswordLineEditTextChanged(QString text)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TLS.password = text; confProps.TLS.password = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::lineEditSIPCustomAddressLineEditTextChanged(QString text) SettingsAdapter::lineEditSIPCustomAddressLineEditTextChanged(QString text)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.publishedAddress = text; confProps.publishedAddress = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::customPortSIPSpinBoxValueChanged(int value) SettingsAdapter::customPortSIPSpinBoxValueChanged(int value)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.publishedPort = value; confProps.publishedPort = value;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::negotiationTimeoutSpinBoxValueChanged(int value) SettingsAdapter::negotiationTimeoutSpinBoxValueChanged(int value)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TLS.negotiationTimeoutSec = value; confProps.TLS.negotiationTimeoutSec = value;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::registrationTimeoutSpinBoxValueChanged(int value) SettingsAdapter::registrationTimeoutSpinBoxValueChanged(int value)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.Registration.expire = value; confProps.Registration.expire = value;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::networkInterfaceSpinBoxValueChanged(int value) SettingsAdapter::networkInterfaceSpinBoxValueChanged(int value)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.localPort = value; confProps.localPort = value;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::audioRTPMinPortSpinBoxEditFinished(int value) SettingsAdapter::audioRTPMinPortSpinBoxEditFinished(int value)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.Audio.audioPortMin = value; confProps.Audio.audioPortMin = value;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::audioRTPMaxPortSpinBoxEditFinished(int value) SettingsAdapter::audioRTPMaxPortSpinBoxEditFinished(int value)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.Audio.audioPortMax = value; confProps.Audio.audioPortMax = value;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::videoRTPMinPortSpinBoxEditFinished(int value) SettingsAdapter::videoRTPMinPortSpinBoxEditFinished(int value)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.Video.videoPortMin = value; confProps.Video.videoPortMin = value;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::videoRTPMaxPortSpinBoxEditFinished(int value) SettingsAdapter::videoRTPMaxPortSpinBoxEditFinished(int value)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.Video.videoPortMax = value; confProps.Video.videoPortMax = value;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::tlsProtocolComboBoxIndexChanged(const int& index) SettingsAdapter::tlsProtocolComboBoxIndexChanged(const int& index)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
if (static_cast<int>(confProps.TLS.method) != index) { if (static_cast<int>(confProps.TLS.method) != index) {
if (index == 0) { if (index == 0) {
@ -919,16 +959,18 @@ SettingsAdapter::tlsProtocolComboBoxIndexChanged(const int& index)
} else { } else {
confProps.TLS.method = lrc::api::account::TlsMethod::TLSv1_2; confProps.TLS.method = lrc::api::account::TlsMethod::TLSv1_2;
} }
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(),
confProps);
} }
} }
void void
SettingsAdapter::setDeviceName(QString text) SettingsAdapter::setDeviceName(QString text)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.deviceName = text; confProps.deviceName = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
@ -988,33 +1030,37 @@ SettingsAdapter::increaseVideoCodecPriority(unsigned int id)
void void
SettingsAdapter::set_RingtonePath(QString text) SettingsAdapter::set_RingtonePath(QString text)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.Ringtone.ringtonePath = text; confProps.Ringtone.ringtonePath = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::set_FileCACert(QString text) SettingsAdapter::set_FileCACert(QString text)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TLS.certificateListFile = text; confProps.TLS.certificateListFile = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::set_FileUserCert(QString text) SettingsAdapter::set_FileUserCert(QString text)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TLS.certificateFile = text; confProps.TLS.certificateFile = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void
SettingsAdapter::set_FilePrivateKey(QString text) SettingsAdapter::set_FilePrivateKey(QString text)
{ {
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId()); auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TLS.privateKeyFile = text; confProps.TLS.privateKeyFile = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps); lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
} }
void void

View file

@ -43,7 +43,7 @@ ColumnLayout {
checkBoxRdv.checked = SettingsAdapter.getAccountConfig_RendezVous() checkBoxRdv.checked = SettingsAdapter.getAccountConfig_RendezVous()
checkBoxAutoAnswer.checked = SettingsAdapter.getAccountConfig_AutoAnswer() checkBoxAutoAnswer.checked = SettingsAdapter.getAccountConfig_AutoAnswer()
checkBoxCustomRingtone.checked = SettingsAdapter.getAccountConfig_Ringtone_RingtoneEnabled() checkBoxCustomRingtone.checked = SettingsAdapter.getAccountConfig_Ringtone_RingtoneEnabled()
checkboxAllModerators.checked = SettingsAdapter.isAllModeratorsEnabled(AccountAdapter.currentAccountId) checkboxAllModerators.checked = SettingsAdapter.isAllModeratorsEnabled(LRCInstance.currentAccountId)
btnRingtone.setEnabled(SettingsAdapter.getAccountConfig_Ringtone_RingtoneEnabled()) btnRingtone.setEnabled(SettingsAdapter.getAccountConfig_Ringtone_RingtoneEnabled())
btnRingtone.setText(UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_Ringtone_RingtonePath())) btnRingtone.setText(UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_Ringtone_RingtonePath()))
@ -61,7 +61,7 @@ ColumnLayout {
function updateAndShowModeratorsSlot() { function updateAndShowModeratorsSlot() {
toggleLocalModerators.checked = SettingsAdapter.isLocalModeratorsEnabled( toggleLocalModerators.checked = SettingsAdapter.isLocalModeratorsEnabled(
AccountAdapter.currentAccountId) LRCInstance.currentAccountId)
moderatorListWidget.model.reset() moderatorListWidget.model.reset()
moderatorListWidget.visible = (moderatorListWidget.model.rowCount() > 0) moderatorListWidget.visible = (moderatorListWidget.model.rowCount() > 0)
} }
@ -170,7 +170,7 @@ ColumnLayout {
fontPointSize: JamiTheme.settingsFontSize fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: SettingsAdapter.enableLocalModerators( onSwitchToggled: SettingsAdapter.enableLocalModerators(
AccountAdapter.currentAccountId, checked) LRCInstance.currentAccountId, checked)
} }
ElidedTextLabel { ElidedTextLabel {
@ -207,7 +207,7 @@ ColumnLayout {
onClicked: moderatorListWidget.currentIndex = index onClicked: moderatorListWidget.currentIndex = index
onBtnContactClicked: { onBtnContactClicked: {
SettingsAdapter.setDefaultModerator( SettingsAdapter.setDefaultModerator(
AccountAdapter.currentAccountId, contactID, false) LRCInstance.currentAccountId, contactID, false)
updateAndShowModeratorsSlot() updateAndShowModeratorsSlot()
} }
} }
@ -245,7 +245,7 @@ ColumnLayout {
fontPointSize: JamiTheme.settingsFontSize fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: SettingsAdapter.setAllModeratorsEnabled( onSwitchToggled: SettingsAdapter.setAllModeratorsEnabled(
AccountAdapter.currentAccountId, checked) LRCInstance.currentAccountId, checked)
} }
} }
} }

View file

@ -166,7 +166,7 @@ Rectangle {
return return
} else { } else {
if (exportPath.length > 0) { if (exportPath.length > 0) {
var isSuccessful = AccountAdapter.model.exportToFile(AccountAdapter.currentAccountId, var isSuccessful = AccountAdapter.model.exportToFile(LRCInstance.currentAccountId,
exportPath, "") exportPath, "")
var title = isSuccessful ? qsTr("Success") : qsTr("Error") var title = isSuccessful ? qsTr("Success") : qsTr("Error")
var info = isSuccessful ? JamiStrings.backupSuccessful : JamiStrings.backupFailed var info = isSuccessful ? JamiStrings.backupSuccessful : JamiStrings.backupFailed
@ -195,7 +195,7 @@ Rectangle {
fontPointSize: JamiTheme.headerFontSize fontPointSize: JamiTheme.headerFontSize
onSwitchToggled: AccountAdapter.model.setAccountEnabled( onSwitchToggled: AccountAdapter.model.setAccountEnabled(
AccountAdapter.currentAccountId, checked) LRCInstance.currentAccountId, checked)
} }
AccountProfile { AccountProfile {

View file

@ -60,7 +60,7 @@ BaseDialog {
interval: 200 interval: 200
onTriggered: { onTriggered: {
AccountAdapter.model.exportOnRing(AccountAdapter.currentAccountId, AccountAdapter.model.exportOnRing(LRCInstance.currentAccountId,
passwordEdit.text) passwordEdit.text)
} }
} }

View file

@ -53,7 +53,7 @@ BaseDialog {
function slotStartNameRegistration() { function slotStartNameRegistration() {
var password = passwordEdit.text var password = passwordEdit.text
AccountAdapter.model.registerName(AccountAdapter.currentAccountId, AccountAdapter.model.registerName(LRCInstance.currentAccountId,
password, registerdName) password, registerdName)
} }

View file

@ -46,7 +46,8 @@ int
SmartListModel::rowCount(const QModelIndex& parent) const SmartListModel::rowCount(const QModelIndex& parent) const
{ {
if (!parent.isValid() && lrcInstance_) { if (!parent.isValid() && lrcInstance_) {
auto& accInfo = lrcInstance_->accountModel().getAccountInfo(lrcInstance_->getCurrAccId()); auto& accInfo = lrcInstance_->accountModel().getAccountInfo(
lrcInstance_->getCurrentAccountId());
auto& convModel = accInfo.conversationModel; auto& convModel = accInfo.conversationModel;
if (listModelType_ == Type::TRANSFER) { if (listModelType_ == Type::TRANSFER) {
auto filterType = accInfo.profileInfo.type; auto filterType = accInfo.profileInfo.type;
@ -77,7 +78,7 @@ SmartListModel::data(const QModelIndex& index, int role) const
case Type::TRANSFER: { case Type::TRANSFER: {
try { try {
auto& currentAccountInfo = lrcInstance_->accountModel().getAccountInfo( auto& currentAccountInfo = lrcInstance_->accountModel().getAccountInfo(
lrcInstance_->getCurrAccId()); lrcInstance_->getCurrentAccountId());
auto& convModel = currentAccountInfo.conversationModel; auto& convModel = currentAccountInfo.conversationModel;
auto filterType = currentAccountInfo.profileInfo.type; auto filterType = currentAccountInfo.profileInfo.type;
auto& item = convModel->getFilteredConversations(filterType).at(index.row()); auto& item = convModel->getFilteredConversations(filterType).at(index.row());
@ -142,7 +143,8 @@ void
SmartListModel::setConferenceableFilter(const QString& filter) SmartListModel::setConferenceableFilter(const QString& filter)
{ {
beginResetModel(); beginResetModel();
auto& accountInfo = lrcInstance_->accountModel().getAccountInfo(lrcInstance_->getCurrAccId()); auto& accountInfo = lrcInstance_->accountModel().getAccountInfo(
lrcInstance_->getCurrentAccountId());
auto& convModel = accountInfo.conversationModel; auto& convModel = accountInfo.conversationModel;
conferenceables_ = convModel->getConferenceableConversations(lrcInstance_->get_selectedConvUid(), conferenceables_ = convModel->getConferenceableConversations(lrcInstance_->get_selectedConvUid(),
filter); filter);

View file

@ -337,7 +337,7 @@ Utils::contactPhoto(LRCInstance* instance,
* Get first contact photo. * Get first contact photo.
*/ */
auto& accountInfo = instance->accountModel().getAccountInfo( auto& accountInfo = instance->accountModel().getAccountInfo(
accountId.isEmpty() ? instance->getCurrAccId() : accountId); accountId.isEmpty() ? instance->getCurrentAccountId() : accountId);
auto contactInfo = accountInfo.contactModel->getContact(contactUri); auto contactInfo = accountInfo.contactModel->getContact(contactUri);
auto contactPhoto = contactInfo.profileInfo.avatar; auto contactPhoto = contactInfo.profileInfo.avatar;
auto bestName = accountInfo.contactModel->bestNameForContact(contactUri); auto bestName = accountInfo.contactModel->bestNameForContact(contactUri);

View file

@ -218,7 +218,7 @@ UtilsAdapter::getCallId(const QString& accountId, const QString& convUid)
int int
UtilsAdapter::getCallStatus(const QString& callId) UtilsAdapter::getCallStatus(const QString& callId)
{ {
const auto callStatus = lrcInstance_->getCallInfo(callId, lrcInstance_->getCurrAccId()); const auto callStatus = lrcInstance_->getCallInfo(callId, lrcInstance_->getCurrentAccountId());
return static_cast<int>(callStatus->status); return static_cast<int>(callStatus->status);
} }

View file

@ -316,7 +316,7 @@ Rectangle {
} else { } else {
if (folderDir.length > 0) { if (folderDir.length > 0) {
AccountAdapter.exportToFile( AccountAdapter.exportToFile(
AccountAdapter.currentAccountId, LRCInstance.currentAccountId,
UtilsAdapter.getAbsPath(folderDir)) UtilsAdapter.getAbsPath(folderDir))
} }
} }