mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-04-18 04:38:29 +00:00
wait for main window to be created to display fetch config error #LINQT-2413
This commit is contained in:
parent
8a8f095d68
commit
22ca1cec23
3 changed files with 48 additions and 28 deletions
|
|
@ -444,6 +444,16 @@ void App::setSelf(QSharedPointer<App>(me)) {
|
|||
});
|
||||
}
|
||||
});
|
||||
mCoreModelConnection->makeConnectToModel(&CoreModel::fetchConfigFailed, [this](const QString &message) {
|
||||
if (mMainWindow) {
|
||||
Utils::showInformationPopup(tr("info_popup_error_title"), message, false);
|
||||
} else {
|
||||
connect(
|
||||
this, &App::mainWindowChanged, this,
|
||||
[this, message] { Utils::showInformationPopup(tr("info_popup_error_title"), message, false); },
|
||||
Qt::SingleShotConnection);
|
||||
}
|
||||
});
|
||||
mCoreModelConnection->makeConnectToModel(
|
||||
&CoreModel::accountAdded,
|
||||
[this](const std::shared_ptr<linphone::Core> &core, const std::shared_ptr<linphone::Account> &account) {
|
||||
|
|
@ -821,31 +831,39 @@ void App::initCore() {
|
|||
firstOpen = false;
|
||||
lInfo() << log().arg("Checking remote provisioning");
|
||||
if (mIsRestarting) {
|
||||
if (CoreModel::getInstance()->mConfigStatus == linphone::ConfiguringState::Failed) {
|
||||
QMetaObject::invokeMethod(thread(), [this]() {
|
||||
mustBeInMainThread(log().arg(Q_FUNC_INFO));
|
||||
auto message = CoreModel::getInstance()->mConfigMessage;
|
||||
//: not reachable
|
||||
if (message.isEmpty()) message = tr("configuration_error_detail");
|
||||
lWarning() << log().arg("Configuration failed (reason: %1)").arg(message);
|
||||
//: Error
|
||||
Utils::showInformationPopup(
|
||||
tr("info_popup_error_title"),
|
||||
//: Remote provisioning failed : %1
|
||||
tr("info_popup_configuration_failed_message").arg(message), false);
|
||||
});
|
||||
} else if (CoreModel::getInstance()->mConfigStatus ==
|
||||
linphone::ConfiguringState::Successful) {
|
||||
lInfo() << log().arg("Configuration succeed");
|
||||
mPossiblyLookForAddedAccount = true;
|
||||
if (mAccountList && mAccountList->getCount() > 0) {
|
||||
auto defaultConnected =
|
||||
mAccountList->getDefaultAccountCore() &&
|
||||
mAccountList->getDefaultAccountCore()->getRegistrationState() ==
|
||||
LinphoneEnums::RegistrationState::Ok;
|
||||
QMetaObject::invokeMethod(mMainWindow, "openMainPage", Qt::DirectConnection,
|
||||
Q_ARG(QVariant, defaultConnected));
|
||||
auto handleConfigStatus = [this] {
|
||||
if (CoreModel::getInstance()->mConfigStatus == linphone::ConfiguringState::Failed) {
|
||||
QMetaObject::invokeMethod(thread(), [this]() {
|
||||
mustBeInMainThread(log().arg(Q_FUNC_INFO));
|
||||
auto message = CoreModel::getInstance()->mConfigMessage;
|
||||
//: not reachable
|
||||
if (message.isEmpty()) message = tr("configuration_error_detail");
|
||||
lWarning() << log().arg("Configuration failed (reason: %1)").arg(message);
|
||||
//: Error
|
||||
Utils::showInformationPopup(
|
||||
tr("info_popup_error_title"),
|
||||
//: Remote provisioning failed : %1
|
||||
tr("info_popup_configuration_failed_message").arg(message), false);
|
||||
});
|
||||
} else if (CoreModel::getInstance()->mConfigStatus ==
|
||||
linphone::ConfiguringState::Successful) {
|
||||
lInfo() << log().arg("Configuration succeed");
|
||||
mPossiblyLookForAddedAccount = true;
|
||||
if (mAccountList && mAccountList->getCount() > 0) {
|
||||
auto defaultConnected =
|
||||
mAccountList->getDefaultAccountCore() &&
|
||||
mAccountList->getDefaultAccountCore()->getRegistrationState() ==
|
||||
LinphoneEnums::RegistrationState::Ok;
|
||||
QMetaObject::invokeMethod(mMainWindow, "openMainPage", Qt::DirectConnection,
|
||||
Q_ARG(QVariant, defaultConnected));
|
||||
}
|
||||
}
|
||||
};
|
||||
if (mMainWindow) {
|
||||
handleConfigStatus();
|
||||
} else {
|
||||
connect(this, &App::mainWindowChanged, this, handleConfigStatus,
|
||||
Qt::SingleShotConnection);
|
||||
}
|
||||
}
|
||||
checkForUpdate();
|
||||
|
|
|
|||
|
|
@ -223,10 +223,7 @@ QString CoreModel::getFetchConfig(QString filePath, bool *error) {
|
|||
if (!filePath.isEmpty()) filePath = "file://" + filePath;
|
||||
}
|
||||
if (filePath.isEmpty()) {
|
||||
qWarning() << "Remote provisioning cannot be retrieved. Command have been cleaned";
|
||||
Utils::showInformationPopup(tr("info_popup_error_title"),
|
||||
//: "Remote provisioning cannot be retrieved"
|
||||
tr("fetching_config_failed_error_message"), false);
|
||||
lWarning() << "Remote provisioning path cannot be retrieved. Command have been cleaned";
|
||||
*error = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -247,6 +244,10 @@ void CoreModel::useFetchConfig(QString filePath, bool askForConfirmation) {
|
|||
this, &CoreModel::globalStateChanged, this, [filePath, this]() { useFetchConfig(filePath); },
|
||||
Qt::SingleShotConnection);
|
||||
}
|
||||
} else {
|
||||
lWarning() << log().arg("Could not get file path for fetching config");
|
||||
//: "Could not get file path for fetching config, return"
|
||||
emit fetchConfigFailed(tr("fetching_config_empty_path_failure_error_message"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ signals:
|
|||
void bearerAccountAdded();
|
||||
void unreadNotificationsChanged();
|
||||
void requestFetchConfig(QString path, bool askForConfirmation);
|
||||
void fetchConfigFailed(const QString &message);
|
||||
void requestRestart();
|
||||
void enabledLdapAddressBookSaved();
|
||||
void magicSearchResultReceived(QString filter);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue