Commit 91133a5a authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix remove identity which was created

parent df5608c3
......@@ -42,12 +42,13 @@ void Identity::create()
Q_EMIT info(i18n("Setting up identity..."));
// store identity information
m_identity->setIdentityName(identityName());
m_identityName = identityName();
m_identity->setIdentityName(m_identityName);
auto manager = KIdentityManagement::IdentityManager::self();
manager->commit();
if (!manager->setAsDefault(m_identity->uoid())) {
qCWarning(ACCOUNTWIZARD_LOG) << "Impossible to find identity";
}
manager->commit();
Q_EMIT finished(i18n("Identity set up."));
}
......@@ -84,8 +85,8 @@ QString Identity::identityName() const
void Identity::destroy()
{
auto manager = KIdentityManagement::IdentityManager::self();
if (!manager->removeIdentityForced(m_identity->identityName())) {
qCWarning(ACCOUNTWIZARD_LOG) << " impossible to remove identity " << m_identity->identityName();
if (!manager->removeIdentityForced(m_identityName)) {
qCWarning(ACCOUNTWIZARD_LOG) << " impossible to remove identity " << m_identityName;
}
manager->commit();
m_identity = nullptr;
......
......@@ -53,10 +53,8 @@ public Q_SLOTS:
Q_SCRIPTABLE void setPgpAutoEncrypt(bool autoencrypt);
Q_SCRIPTABLE void setKey(GpgME::Protocol protocol, const QByteArray &fingerprint);
protected:
QString identityName() const;
private:
QString identityName() const;
QString m_identityName;
KIdentityManagement::Identity *m_identity = nullptr;
};
......
Supports Markdown
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