mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-12 15:59:58 -05:00
Use unlock dialog when unlocking a database from browser extension
This commit is contained in:
parent
09f5a74a15
commit
92a7fe33bd
@ -64,7 +64,6 @@ BrowserService::BrowserService()
|
|||||||
: QObject()
|
: QObject()
|
||||||
, m_browserHost(new BrowserHost)
|
, m_browserHost(new BrowserHost)
|
||||||
, m_dialogActive(false)
|
, m_dialogActive(false)
|
||||||
, m_bringToFrontRequested(false)
|
|
||||||
, m_prevWindowState(WindowState::Normal)
|
, m_prevWindowState(WindowState::Normal)
|
||||||
, m_keepassBrowserUUID(Tools::hexToUuid("de887cc3036343b8974b5911b8816224"))
|
, m_keepassBrowserUUID(Tools::hexToUuid("de887cc3036343b8974b5911b8816224"))
|
||||||
{
|
{
|
||||||
@ -110,8 +109,7 @@ bool BrowserService::openDatabase(bool triggerUnlock)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (triggerUnlock) {
|
if (triggerUnlock) {
|
||||||
m_bringToFrontRequested = true;
|
emit requestUnlock();
|
||||||
raiseWindow(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -1220,6 +1218,23 @@ void BrowserService::raiseWindow(const bool force)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BrowserService::updateWindowState()
|
||||||
|
{
|
||||||
|
m_prevWindowState = WindowState::Normal;
|
||||||
|
if (getMainWindow()->isMinimized()) {
|
||||||
|
m_prevWindowState = WindowState::Minimized;
|
||||||
|
}
|
||||||
|
#ifdef Q_OS_MACOS
|
||||||
|
if (macUtils()->isHidden()) {
|
||||||
|
m_prevWindowState = WindowState::Hidden;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (getMainWindow()->isHidden()) {
|
||||||
|
m_prevWindowState = WindowState::Hidden;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void BrowserService::databaseLocked(DatabaseWidget* dbWidget)
|
void BrowserService::databaseLocked(DatabaseWidget* dbWidget)
|
||||||
{
|
{
|
||||||
if (dbWidget) {
|
if (dbWidget) {
|
||||||
@ -1232,11 +1247,6 @@ void BrowserService::databaseLocked(DatabaseWidget* dbWidget)
|
|||||||
void BrowserService::databaseUnlocked(DatabaseWidget* dbWidget)
|
void BrowserService::databaseUnlocked(DatabaseWidget* dbWidget)
|
||||||
{
|
{
|
||||||
if (dbWidget) {
|
if (dbWidget) {
|
||||||
if (m_bringToFrontRequested) {
|
|
||||||
hideWindow();
|
|
||||||
m_bringToFrontRequested = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QJsonObject msg;
|
QJsonObject msg;
|
||||||
msg["action"] = QString("database-unlocked");
|
msg["action"] = QString("database-unlocked");
|
||||||
m_browserHost->sendClientMessage(msg);
|
m_browserHost->sendClientMessage(msg);
|
||||||
|
@ -91,6 +91,9 @@ public:
|
|||||||
static const QString OPTION_ONLY_HTTP_AUTH;
|
static const QString OPTION_ONLY_HTTP_AUTH;
|
||||||
static const QString ADDITIONAL_URL;
|
static const QString ADDITIONAL_URL;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void requestUnlock();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void databaseLocked(DatabaseWidget* dbWidget);
|
void databaseLocked(DatabaseWidget* dbWidget);
|
||||||
void databaseUnlocked(DatabaseWidget* dbWidget);
|
void databaseUnlocked(DatabaseWidget* dbWidget);
|
||||||
@ -142,6 +145,7 @@ private:
|
|||||||
|
|
||||||
void hideWindow() const;
|
void hideWindow() const;
|
||||||
void raiseWindow(const bool force = false);
|
void raiseWindow(const bool force = false);
|
||||||
|
void updateWindowState();
|
||||||
|
|
||||||
static bool moveSettingsToCustomData(Entry* entry, const QString& name);
|
static bool moveSettingsToCustomData(Entry* entry, const QString& name);
|
||||||
static int moveKeysToCustomData(Entry* entry, QSharedPointer<Database> db);
|
static int moveKeysToCustomData(Entry* entry, QSharedPointer<Database> db);
|
||||||
@ -150,7 +154,6 @@ private:
|
|||||||
QHash<QString, QSharedPointer<BrowserAction>> m_browserClients;
|
QHash<QString, QSharedPointer<BrowserAction>> m_browserClients;
|
||||||
|
|
||||||
bool m_dialogActive;
|
bool m_dialogActive;
|
||||||
bool m_bringToFrontRequested;
|
|
||||||
WindowState m_prevWindowState;
|
WindowState m_prevWindowState;
|
||||||
QUuid m_keepassBrowserUUID;
|
QUuid m_keepassBrowserUUID;
|
||||||
|
|
||||||
|
@ -755,3 +755,11 @@ void DatabaseTabWidget::performGlobalAutoType()
|
|||||||
unlockDatabaseInDialog(currentDatabaseWidget(), DatabaseOpenDialog::Intent::AutoType);
|
unlockDatabaseInDialog(currentDatabaseWidget(), DatabaseOpenDialog::Intent::AutoType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DatabaseTabWidget::performBrowserUnlock()
|
||||||
|
{
|
||||||
|
auto dbWidget = currentDatabaseWidget();
|
||||||
|
if (dbWidget && dbWidget->isLocked()) {
|
||||||
|
unlockDatabaseInDialog(dbWidget, DatabaseOpenDialog::Intent::Browser);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -82,6 +82,7 @@ public slots:
|
|||||||
void changeReports();
|
void changeReports();
|
||||||
void changeDatabaseSettings();
|
void changeDatabaseSettings();
|
||||||
void performGlobalAutoType();
|
void performGlobalAutoType();
|
||||||
|
void performBrowserUnlock();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void databaseOpened(DatabaseWidget* dbWidget);
|
void databaseOpened(DatabaseWidget* dbWidget);
|
||||||
|
@ -144,6 +144,8 @@ MainWindow::MainWindow()
|
|||||||
&DatabaseTabWidget::activateDatabaseChanged,
|
&DatabaseTabWidget::activateDatabaseChanged,
|
||||||
browserService(),
|
browserService(),
|
||||||
&BrowserService::activeDatabaseChanged);
|
&BrowserService::activeDatabaseChanged);
|
||||||
|
connect(
|
||||||
|
browserService(), &BrowserService::requestUnlock, m_ui->tabWidget, &DatabaseTabWidget::performBrowserUnlock);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WITH_XC_SSHAGENT
|
#ifdef WITH_XC_SSHAGENT
|
||||||
|
Loading…
Reference in New Issue
Block a user