mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-29 07:43:36 -05:00
Fix password generator close button for good
* Avoids using QDialog which breaks the standalone password generator Revert "Fix password dialog close button" This reverts commit 5b47190fcc4b2f51fb11849cef7f53346e8fe439.
This commit is contained in:
parent
9dd90c95a7
commit
485c446013
@ -278,6 +278,8 @@ QJsonObject BrowserAction::handleGeneratePassword(QLocalSocket* socket, const QJ
|
|||||||
errorReply["requestID"] = requestId;
|
errorReply["requestID"] = requestId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show the existing password generator
|
||||||
|
browserService()->showPasswordGenerator({});
|
||||||
return errorReply;
|
return errorReply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,6 @@ BrowserService::BrowserService()
|
|||||||
, m_browserHost(new BrowserHost)
|
, m_browserHost(new BrowserHost)
|
||||||
, m_dialogActive(false)
|
, m_dialogActive(false)
|
||||||
, m_bringToFrontRequested(false)
|
, m_bringToFrontRequested(false)
|
||||||
, m_passwordGeneratorRequested(false)
|
|
||||||
, m_prevWindowState(WindowState::Normal)
|
, m_prevWindowState(WindowState::Normal)
|
||||||
, m_keepassBrowserUUID(Tools::hexToUuid("de887cc3036343b8974b5911b8816224"))
|
, m_keepassBrowserUUID(Tools::hexToUuid("de887cc3036343b8974b5911b8816224"))
|
||||||
{
|
{
|
||||||
@ -460,7 +459,7 @@ QList<Entry*> BrowserService::confirmEntries(QList<Entry*>& entriesToConfirm,
|
|||||||
void BrowserService::showPasswordGenerator(const KeyPairMessage& keyPairMessage)
|
void BrowserService::showPasswordGenerator(const KeyPairMessage& keyPairMessage)
|
||||||
{
|
{
|
||||||
if (!m_passwordGenerator) {
|
if (!m_passwordGenerator) {
|
||||||
m_passwordGenerator.reset(PasswordGeneratorWidget::popupGenerator(m_currentDatabaseWidget));
|
m_passwordGenerator = PasswordGeneratorWidget::popupGenerator();
|
||||||
|
|
||||||
connect(m_passwordGenerator.data(), &PasswordGeneratorWidget::closed, m_passwordGenerator.data(), [=] {
|
connect(m_passwordGenerator.data(), &PasswordGeneratorWidget::closed, m_passwordGenerator.data(), [=] {
|
||||||
if (!m_passwordGenerator->isPasswordGenerated()) {
|
if (!m_passwordGenerator->isPasswordGenerated()) {
|
||||||
@ -469,9 +468,7 @@ void BrowserService::showPasswordGenerator(const KeyPairMessage& keyPairMessage)
|
|||||||
m_browserHost->sendClientMessage(keyPairMessage.socket, errorMessage);
|
m_browserHost->sendClientMessage(keyPairMessage.socket, errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_passwordGenerator.reset();
|
QTimer::singleShot(50, this, [&] { hideWindow(); });
|
||||||
hideWindow();
|
|
||||||
m_passwordGeneratorRequested = false;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(m_passwordGenerator.data(),
|
connect(m_passwordGenerator.data(),
|
||||||
@ -485,19 +482,18 @@ void BrowserService::showPasswordGenerator(const KeyPairMessage& keyPairMessage)
|
|||||||
params,
|
params,
|
||||||
keyPairMessage.publicKey,
|
keyPairMessage.publicKey,
|
||||||
keyPairMessage.secretKey));
|
keyPairMessage.secretKey));
|
||||||
hideWindow();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
m_passwordGeneratorRequested = true;
|
|
||||||
raiseWindow();
|
raiseWindow();
|
||||||
|
m_passwordGenerator->show();
|
||||||
m_passwordGenerator->raise();
|
m_passwordGenerator->raise();
|
||||||
m_passwordGenerator->activateWindow();
|
m_passwordGenerator->activateWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BrowserService::isPasswordGeneratorRequested() const
|
bool BrowserService::isPasswordGeneratorRequested() const
|
||||||
{
|
{
|
||||||
return m_passwordGeneratorRequested;
|
return m_passwordGenerator && m_passwordGenerator->isVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BrowserService::storeKey(const QString& key)
|
QString BrowserService::storeKey(const QString& key)
|
||||||
|
@ -209,12 +209,11 @@ private:
|
|||||||
|
|
||||||
bool m_dialogActive;
|
bool m_dialogActive;
|
||||||
bool m_bringToFrontRequested;
|
bool m_bringToFrontRequested;
|
||||||
bool m_passwordGeneratorRequested;
|
|
||||||
WindowState m_prevWindowState;
|
WindowState m_prevWindowState;
|
||||||
QUuid m_keepassBrowserUUID;
|
QUuid m_keepassBrowserUUID;
|
||||||
|
|
||||||
QPointer<DatabaseWidget> m_currentDatabaseWidget;
|
QPointer<DatabaseWidget> m_currentDatabaseWidget;
|
||||||
QScopedPointer<PasswordGeneratorWidget> m_passwordGenerator;
|
QPointer<PasswordGeneratorWidget> m_passwordGenerator;
|
||||||
|
|
||||||
Q_DISABLE_COPY(BrowserService);
|
Q_DISABLE_COPY(BrowserService);
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ void PasswordGeneratorWidget::closeEvent(QCloseEvent* event)
|
|||||||
{
|
{
|
||||||
// Emits closed signal when clicking X from title bar
|
// Emits closed signal when clicking X from title bar
|
||||||
emit closed();
|
emit closed();
|
||||||
event->accept();
|
QWidget::closeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
PasswordGeneratorWidget* PasswordGeneratorWidget::popupGenerator(QWidget* parent)
|
PasswordGeneratorWidget* PasswordGeneratorWidget::popupGenerator(QWidget* parent)
|
||||||
|
@ -70,6 +70,9 @@ public slots:
|
|||||||
void deleteWordList();
|
void deleteWordList();
|
||||||
void addWordList();
|
void addWordList();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void closeEvent(QCloseEvent* event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateButtonsEnabled(const QString& password);
|
void updateButtonsEnabled(const QString& password);
|
||||||
void updatePasswordStrength();
|
void updatePasswordStrength();
|
||||||
@ -86,7 +89,6 @@ private:
|
|||||||
bool m_passwordGenerated = false;
|
bool m_passwordGenerated = false;
|
||||||
int m_firstCustomWordlistIndex;
|
int m_firstCustomWordlistIndex;
|
||||||
|
|
||||||
void closeEvent(QCloseEvent* event);
|
|
||||||
PasswordGenerator::CharClasses charClasses();
|
PasswordGenerator::CharClasses charClasses();
|
||||||
PasswordGenerator::GeneratorFlags generatorFlags();
|
PasswordGenerator::GeneratorFlags generatorFlags();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user