revert fix config login page (accounts registration states are not enough specific to use them as indicator of existing accounts)
This commit is contained in:
parent
c1013baac5
commit
5d77bd257d
4 changed files with 14 additions and 34 deletions
|
|
@ -486,7 +486,10 @@ void App::initCore() {
|
||||||
mEngine->setObjectOwnership(settings.get(), QQmlEngine::CppOwnership);
|
mEngine->setObjectOwnership(settings.get(), QQmlEngine::CppOwnership);
|
||||||
mEngine->setObjectOwnership(this, QQmlEngine::CppOwnership);
|
mEngine->setObjectOwnership(this, QQmlEngine::CppOwnership);
|
||||||
if (!mAccountList) setAccountList(AccountList::create());
|
if (!mAccountList) setAccountList(AccountList::create());
|
||||||
else mAccountList->lUpdate();
|
else {
|
||||||
|
mAccountList->setInitialized(false);
|
||||||
|
mAccountList->lUpdate(true);
|
||||||
|
}
|
||||||
if (!mCallList) setCallList(CallList::create());
|
if (!mCallList) setCallList(CallList::create());
|
||||||
else mCallList->lUpdate();
|
else mCallList->lUpdate();
|
||||||
if (!mSettings) {
|
if (!mSettings) {
|
||||||
|
|
|
||||||
|
|
@ -64,27 +64,8 @@ void AccountList::setSelf(QSharedPointer<AccountList> me) {
|
||||||
}
|
}
|
||||||
mModelConnection->invokeToCore([this, accounts, defaultAccountCore, isInitialization]() {
|
mModelConnection->invokeToCore([this, accounts, defaultAccountCore, isInitialization]() {
|
||||||
mustBeInMainThread(getClassName());
|
mustBeInMainThread(getClassName());
|
||||||
auto reallyHaveAccount = [this]() -> bool {
|
|
||||||
// When an account is trying to connect, we don't want to display the features
|
|
||||||
// provided for the accounts that really stays in the account list
|
|
||||||
// (for example the back button to return on the main page in the login page)
|
|
||||||
for (auto &account : getSharedList<AccountCore>()) {
|
|
||||||
if (account->getRegistrationState() != LinphoneEnums::RegistrationState::Progress &&
|
|
||||||
account->getRegistrationState() != LinphoneEnums::RegistrationState::None) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
for (auto &account : getSharedList<AccountCore>()) {
|
|
||||||
disconnect(account.get(), &AccountCore::registrationStateChanged, this, nullptr);
|
|
||||||
}
|
|
||||||
resetData<AccountCore>(*accounts);
|
resetData<AccountCore>(*accounts);
|
||||||
for (auto &account : getSharedList<AccountCore>()) {
|
setHaveAccount(accounts->size() > 0);
|
||||||
connect(account.get(), &AccountCore::registrationStateChanged, this,
|
|
||||||
[this, reallyHaveAccount] { setHaveAccount(reallyHaveAccount()); });
|
|
||||||
}
|
|
||||||
setHaveAccount(reallyHaveAccount());
|
|
||||||
setDefaultAccount(defaultAccountCore);
|
setDefaultAccount(defaultAccountCore);
|
||||||
if (isInitialization) setInitialized(true);
|
if (isInitialization) setInitialized(true);
|
||||||
delete accounts;
|
delete accounts;
|
||||||
|
|
@ -102,7 +83,7 @@ void AccountList::setSelf(QSharedPointer<AccountList> me) {
|
||||||
} else mModelConnection->invokeToCore([this]() { setDefaultAccount(nullptr); });
|
} else mModelConnection->invokeToCore([this]() { setDefaultAccount(nullptr); });
|
||||||
});
|
});
|
||||||
mModelConnection->makeConnectToModel(&CoreModel::accountRemoved, [this] { emit lUpdate(); });
|
mModelConnection->makeConnectToModel(&CoreModel::accountRemoved, [this] { emit lUpdate(); });
|
||||||
mModelConnection->makeConnectToModel(&CoreModel::accountAdded, [this] { emit lUpdate(); });
|
mModelConnection->makeConnectToModel(&CoreModel::accountAdded, [this] { emit lUpdate(true); });
|
||||||
|
|
||||||
mModelConnection->makeConnectToModel(
|
mModelConnection->makeConnectToModel(
|
||||||
&CoreModel::globalStateChanged,
|
&CoreModel::globalStateChanged,
|
||||||
|
|
|
||||||
|
|
@ -143,6 +143,7 @@ bool AccountManager::login(QString username,
|
||||||
auto status = core->addAccount(account);
|
auto status = core->addAccount(account);
|
||||||
if (status == -1) {
|
if (status == -1) {
|
||||||
*errorMessage = tr("Impossible d'ajouter le compte.");
|
*errorMessage = tr("Impossible d'ajouter le compte.");
|
||||||
|
core->removeAuthInfo(authInfo);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ AbstractWindow {
|
||||||
Connections {
|
Connections {
|
||||||
target: SettingsCpp
|
target: SettingsCpp
|
||||||
function onAssistantGoDirectlyToThirdPartySipAccountLoginChanged() {
|
function onAssistantGoDirectlyToThirdPartySipAccountLoginChanged() {
|
||||||
initStackViewItem()
|
initStackViewItem()
|
||||||
}
|
}
|
||||||
function onIsSavedChanged() {
|
function onIsSavedChanged() {
|
||||||
if (SettingsCpp.isSaved) UtilsCpp.showInformationPopup(qsTr("Succès"), qsTr("Les changements ont été sauvegardés"), true, mainWindow)
|
if (SettingsCpp.isSaved) UtilsCpp.showInformationPopup(qsTr("Succès"), qsTr("Les changements ont été sauvegardés"), true, mainWindow)
|
||||||
|
|
@ -112,13 +112,10 @@ AbstractWindow {
|
||||||
active: AppCpp.coreStarted
|
active: AppCpp.coreStarted
|
||||||
sourceComponent: AccountProxy {
|
sourceComponent: AccountProxy {
|
||||||
sourceModel: AppCpp.accounts
|
sourceModel: AppCpp.accounts
|
||||||
onInitializedChanged: if (isInitialized) {
|
onInitializedChanged: if (isInitialized) {
|
||||||
mainWindow.accountProxy = this
|
mainWindow.accountProxy = this
|
||||||
mainWindow.initStackViewItem()
|
mainWindow.initStackViewItem()
|
||||||
}
|
}
|
||||||
onHaveAccountChanged: {
|
|
||||||
if (isInitialized) mainWindow.initStackViewItem()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -126,10 +123,6 @@ AbstractWindow {
|
||||||
id: mainWindowStackView
|
id: mainWindowStackView
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
initialItem: splashScreen
|
initialItem: splashScreen
|
||||||
Component.onCompleted: {
|
|
||||||
clear()
|
|
||||||
push(splashScreen)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Component {
|
Component {
|
||||||
id: splashScreen
|
id: splashScreen
|
||||||
|
|
@ -161,7 +154,8 @@ AbstractWindow {
|
||||||
onGoBack: openMainPage()
|
onGoBack: openMainPage()
|
||||||
onUseSIPButtonClicked: mainWindowStackView.push(sipLoginPage)
|
onUseSIPButtonClicked: mainWindowStackView.push(sipLoginPage)
|
||||||
onGoToRegister: mainWindowStackView.replace(registerPage)
|
onGoToRegister: mainWindowStackView.replace(registerPage)
|
||||||
showBackButton: accountProxy?.haveAccount
|
showBackButton: false
|
||||||
|
StackView.onActivated: if (mainWindow.accountProxy?.haveAccount) showBackButton = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Component {
|
Component {
|
||||||
|
|
@ -175,7 +169,8 @@ AbstractWindow {
|
||||||
mainWindowStackView.pop()
|
mainWindowStackView.pop()
|
||||||
}
|
}
|
||||||
onGoToRegister: mainWindowStackView.replace(registerPage)
|
onGoToRegister: mainWindowStackView.replace(registerPage)
|
||||||
showBackButton: !SettingsCpp.assistantGoDirectlyToThirdPartySipAccountLogin || accountProxy?.haveAccount
|
showBackButton: false
|
||||||
|
StackView.onActivated: if (!SettingsCpp.assistantGoDirectlyToThirdPartySipAccountLogin || mainWindow.accountProxy?.haveAccount) showBackButton = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Component {
|
Component {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue