Launch KeePassXC password generator popup from the extension

* Closes #6473
This commit is contained in:
varjolintu 2021-10-17 09:53:25 +03:00 committed by Jonathan White
parent 2a9d92faeb
commit dd41f093e6
8 changed files with 66 additions and 341 deletions

View file

@ -311,6 +311,34 @@ QString BrowserService::getCurrentTotp(const QString& uuid)
return {};
}
void BrowserService::showPasswordGenerator(const QJsonObject& errorMessage, const QString& nonce)
{
if (!m_passwordGenerator) {
m_passwordGenerator.reset(PasswordGeneratorWidget::popupGenerator());
connect(m_passwordGenerator.data(), &PasswordGeneratorWidget::closed, m_passwordGenerator.data(), [=] {
m_passwordGenerator.reset();
m_browserHost->sendClientMessage(errorMessage);
hideWindow();
});
connect(m_passwordGenerator.data(),
&PasswordGeneratorWidget::appliedPassword,
m_passwordGenerator.data(),
[=](const QString& password) { emit passwordGenerated(password, nonce); });
}
raiseWindow();
m_passwordGenerator->raise();
m_passwordGenerator->activateWindow();
}
void BrowserService::sendPassword(const QJsonObject& message)
{
m_browserHost->sendClientMessage(message);
hideWindow();
}
QString BrowserService::storeKey(const QString& key)
{
auto db = getDatabase();