Commit fa2aa888 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Add API for cancelling account configuration

Needed for correctly cancelling the AccountCreationJob
parent c333f3d4
......@@ -94,6 +94,7 @@ void CreateAccountJob::loadPluginAndShowDialog(const QString &pluginName)
connect(ui, &KAccountsUiPlugin::success, this, &CreateAccountJob::pluginFinished, Qt::UniqueConnection);
connect(ui, &KAccountsUiPlugin::error, this, &CreateAccountJob::pluginError, Qt::UniqueConnection);
connect(ui, &KAccountsUiPlugin::cancelled, this, &CreateAccountJob::pluginCancelled, Qt::UniqueConnection);
ui->setProviderName(m_providerName);
ui->init(KAccountsUiPlugin::NewAccountDialog);
......@@ -142,6 +143,14 @@ void CreateAccountJob::pluginError(const QString &error)
emitResult();
}
void CreateAccountJob::pluginCancelled()
{
setError(KJob::KilledJobError);
setErrorText(i18n("Cancelled by user"));
emitResult();
}
void CreateAccountJob::sessionResponse(const SignOn::SessionData &/*data*/)
{
qDebug() << "Received session response";
......
......@@ -49,6 +49,7 @@ private Q_SLOTS:
void info(const SignOn::IdentityInfo &info);
void pluginFinished(const QString &screenName, const QString &secret, const QVariantMap &map);
void pluginError(const QString &error);
void pluginCancelled();
Q_SIGNALS:
void providerNameChanged();
......
......@@ -83,6 +83,11 @@ Q_SIGNALS:
* @param errorString The error that has occurred
*/
void error(const QString &errorString);
/**
* Emitted when the user cancels the account creation
*/
void cancelled();
};
Q_DECLARE_INTERFACE(KAccountsUiPlugin, "org.kde.kaccounts.UiPlugin")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment