mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-04-17 20:08:28 +00:00
fix fetch config with url and do not display confirmation popup if fetching from url or cli
This commit is contained in:
parent
da15f94443
commit
bbb60d884a
4 changed files with 28 additions and 13 deletions
|
|
@ -363,9 +363,13 @@ void App::setSelf(QSharedPointer<App>(me)) {
|
||||||
restart();
|
restart();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
mCoreModelConnection->makeConnectToModel(&CoreModel::requestFetchConfig, [this](QString path) {
|
mCoreModelConnection->makeConnectToModel(&CoreModel::requestFetchConfig, [this](QString path,
|
||||||
mCoreModelConnection->invokeToCore([this, path]() {
|
bool askForConfirmation) {
|
||||||
auto callback = [this, path]() {
|
mCoreModelConnection->invokeToCore([this, path, askForConfirmation]() {
|
||||||
|
auto apply = [this, path] {
|
||||||
|
mCoreModelConnection->invokeToModel([this, path]() { CoreModel::getInstance()->setFetchConfig(path); });
|
||||||
|
};
|
||||||
|
auto callback = [this, path, askForConfirmation]() {
|
||||||
//: Voulez-vous télécharger et appliquer la configuration depuis cette adresse ?
|
//: Voulez-vous télécharger et appliquer la configuration depuis cette adresse ?
|
||||||
RequestDialog *obj = new RequestDialog(tr("remote_provisioning_dialog"), path);
|
RequestDialog *obj = new RequestDialog(tr("remote_provisioning_dialog"), path);
|
||||||
connect(obj, &RequestDialog::result, this, [this, obj, path](int result) {
|
connect(obj, &RequestDialog::result, this, [this, obj, path](int result) {
|
||||||
|
|
@ -380,9 +384,12 @@ void App::setSelf(QSharedPointer<App>(me)) {
|
||||||
QMetaObject::invokeMethod(getMainWindow(), "showConfirmationPopup", QVariant::fromValue(obj));
|
QMetaObject::invokeMethod(getMainWindow(), "showConfirmationPopup", QVariant::fromValue(obj));
|
||||||
};
|
};
|
||||||
if (!getMainWindow()) { // Delay
|
if (!getMainWindow()) { // Delay
|
||||||
|
if (askForConfirmation)
|
||||||
connect(this, &App::mainWindowChanged, this, callback, Qt::SingleShotConnection);
|
connect(this, &App::mainWindowChanged, this, callback, Qt::SingleShotConnection);
|
||||||
|
else connect(this, &App::mainWindowChanged, this, apply, Qt::SingleShotConnection);
|
||||||
} else {
|
} else {
|
||||||
callback();
|
if (askForConfirmation) callback();
|
||||||
|
else apply();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ void CliModel::cliFetchConfig(QHash<QString, QString> args) {
|
||||||
connect(
|
connect(
|
||||||
CoreModel::getInstance().get(), &CoreModel::globalStateChanged, this,
|
CoreModel::getInstance().get(), &CoreModel::globalStateChanged, this,
|
||||||
[this, args]() { cliFetchConfig(args); }, Qt::SingleShotConnection);
|
[this, args]() { cliFetchConfig(args); }, Qt::SingleShotConnection);
|
||||||
else CoreModel::getInstance()->useFetchConfig(args["fetch-config"]);
|
else CoreModel::getInstance()->useFetchConfig(args["fetch-config"], false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -310,13 +310,21 @@ void CliModel::Command::executeUrl(const QString &pUrl, CliModel *parent) {
|
||||||
QStringList urlParts = pUrl.split('?');
|
QStringList urlParts = pUrl.split('?');
|
||||||
QString query = (urlParts.size() > 1 ? urlParts[1] : urlParts[0]);
|
QString query = (urlParts.size() > 1 ? urlParts[1] : urlParts[0]);
|
||||||
QString authority = (urlParts.size() > 1 && urlParts[0].contains(':') ? urlParts[0].split(':')[1] : "");
|
QString authority = (urlParts.size() > 1 && urlParts[0].contains(':') ? urlParts[0].split(':')[1] : "");
|
||||||
|
lDebug() << QStringLiteral("CliModel : execute url : %1").arg(query);
|
||||||
|
|
||||||
QStringList parameters = query.split('&');
|
QStringList parameters = query.split('&');
|
||||||
for (int i = 0; i < parameters.size(); ++i) {
|
for (int i = 0; i < parameters.size(); ++i) {
|
||||||
QStringList parameter = parameters[i].split('=');
|
QStringList parameter = parameters[i].split('=');
|
||||||
if (parameter[0] != "method") {
|
lDebug() << QStringLiteral("CliModel : Detecting parameter : %1").arg(parameter[0]);
|
||||||
if (parameter.size() > 1) args[parameter[0]] = QByteArray::fromBase64(parameter[1].toUtf8());
|
QHash<QString, QString> args = parent->parseArgs(parameters[i]);
|
||||||
else args[parameter[0]] = "";
|
for (auto it = args.begin(); it != args.end(); ++it) {
|
||||||
|
auto subfonction = parent->parseFunctionName(it.key(), true);
|
||||||
|
if (!subfonction.isEmpty()) {
|
||||||
|
QHash<QString, QString> arg;
|
||||||
|
arg[it.key()] = QByteArray::fromBase64(it.value().toUtf8());
|
||||||
|
lDebug() << "parsing parameters" << it.key() << it.value();
|
||||||
|
parent->addProcess(ProcessCommand(mCommands[it.key()], arg, 1, parent));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!authority.isEmpty()) args["sip-address"] = authority;
|
if (!authority.isEmpty()) args["sip-address"] = authority;
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,7 @@ QString CoreModel::getFetchConfig(QString filePath, bool *error) {
|
||||||
return filePath;
|
return filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreModel::useFetchConfig(QString filePath) {
|
void CoreModel::useFetchConfig(QString filePath, bool askForConfirmation) {
|
||||||
bool error = false;
|
bool error = false;
|
||||||
filePath = getFetchConfig(filePath, &error);
|
filePath = getFetchConfig(filePath, &error);
|
||||||
if (!error && !filePath.isEmpty()) {
|
if (!error && !filePath.isEmpty()) {
|
||||||
|
|
@ -237,7 +237,7 @@ void CoreModel::useFetchConfig(QString filePath) {
|
||||||
if (mCore && mCore->getGlobalState() == linphone::GlobalState::On) {
|
if (mCore && mCore->getGlobalState() == linphone::GlobalState::On) {
|
||||||
// TODO
|
// TODO
|
||||||
// if (mSettings->getAutoApplyProvisioningConfigUriHandlerEnabled()) setFetchConfig(filePath); else
|
// if (mSettings->getAutoApplyProvisioningConfigUriHandlerEnabled()) setFetchConfig(filePath); else
|
||||||
emit requestFetchConfig(filePath);
|
emit requestFetchConfig(filePath, askForConfirmation);
|
||||||
} else {
|
} else {
|
||||||
connect(
|
connect(
|
||||||
this, &CoreModel::globalStateChanged, this, [filePath, this]() { useFetchConfig(filePath); },
|
this, &CoreModel::globalStateChanged, this, [filePath, this]() { useFetchConfig(filePath); },
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ public:
|
||||||
void refreshOidcRemainingTime();
|
void refreshOidcRemainingTime();
|
||||||
|
|
||||||
QString getFetchConfig(QString filePath, bool *error);
|
QString getFetchConfig(QString filePath, bool *error);
|
||||||
void useFetchConfig(QString filePath);
|
void useFetchConfig(QString filePath, bool askForConfirmation = true);
|
||||||
bool setFetchConfig(QString filePath);
|
bool setFetchConfig(QString filePath);
|
||||||
void migrate();
|
void migrate();
|
||||||
|
|
||||||
|
|
@ -94,7 +94,7 @@ signals:
|
||||||
void friendUpdated(const std::shared_ptr<linphone::Friend> &f);
|
void friendUpdated(const std::shared_ptr<linphone::Friend> &f);
|
||||||
void bearerAccountAdded();
|
void bearerAccountAdded();
|
||||||
void unreadNotificationsChanged();
|
void unreadNotificationsChanged();
|
||||||
void requestFetchConfig(QString path);
|
void requestFetchConfig(QString path, bool askForConfirmation);
|
||||||
void requestRestart();
|
void requestRestart();
|
||||||
void enabledLdapAddressBookSaved();
|
void enabledLdapAddressBookSaved();
|
||||||
void magicSearchResultReceived(QString filter);
|
void magicSearchResultReceived(QString filter);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue