mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-27 00:09:53 -05:00
Correct window transitions from browser plugin
* Eliminated multiple state variables * Fix #1643, window is brought to front
This commit is contained in:
parent
ca39f6e159
commit
d3a424cc74
@ -54,8 +54,7 @@ BrowserService::BrowserService(DatabaseTabWidget* parent)
|
|||||||
: m_dbTabWidget(parent)
|
: m_dbTabWidget(parent)
|
||||||
, m_dialogActive(false)
|
, m_dialogActive(false)
|
||||||
, m_bringToFrontRequested(false)
|
, m_bringToFrontRequested(false)
|
||||||
, m_wasMinimized(false)
|
, m_prevWindowState(WindowState::Normal)
|
||||||
, m_wasHidden(false)
|
|
||||||
, m_keepassBrowserUUID(Tools::hexToUuid("de887cc3036343b8974b5911b8816224"))
|
, m_keepassBrowserUUID(Tools::hexToUuid("de887cc3036343b8974b5911b8816224"))
|
||||||
{
|
{
|
||||||
// Don't connect the signals when used from DatabaseSettingsWidgetBrowser (parent is nullptr)
|
// Don't connect the signals when used from DatabaseSettingsWidgetBrowser (parent is nullptr)
|
||||||
@ -1009,29 +1008,42 @@ bool BrowserService::checkLegacySettings()
|
|||||||
|
|
||||||
void BrowserService::hideWindow() const
|
void BrowserService::hideWindow() const
|
||||||
{
|
{
|
||||||
if (m_wasMinimized) {
|
if (m_prevWindowState == WindowState::Minimized) {
|
||||||
getMainWindow()->showMinimized();
|
getMainWindow()->showMinimized();
|
||||||
} else {
|
} else {
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
if (m_wasHidden) {
|
if (m_prevWindowState == WindowState::Hidden) {
|
||||||
macUtils()->hideOwnWindow();
|
macUtils()->hideOwnWindow();
|
||||||
} else {
|
} else {
|
||||||
macUtils()->raiseLastActiveWindow();
|
macUtils()->raiseLastActiveWindow();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
if (m_prevWindowState == WindowState::Hidden) {
|
||||||
|
getMainWindow()->hideWindow();
|
||||||
|
} else {
|
||||||
getMainWindow()->lower();
|
getMainWindow()->lower();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserService::raiseWindow(const bool force)
|
void BrowserService::raiseWindow(const bool force)
|
||||||
{
|
{
|
||||||
m_wasMinimized = getMainWindow()->isMinimized();
|
m_prevWindowState = WindowState::Normal;
|
||||||
|
if (getMainWindow()->isMinimized()) {
|
||||||
|
m_prevWindowState = WindowState::Minimized;
|
||||||
|
}
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
m_wasHidden = macUtils()->isHidden();
|
if (macUtils()->isHidden()) {
|
||||||
|
m_prevWindowState = WindowState::Hidden;
|
||||||
|
}
|
||||||
macUtils()->raiseOwnWindow();
|
macUtils()->raiseOwnWindow();
|
||||||
Tools::wait(500);
|
Tools::wait(500);
|
||||||
#else
|
#else
|
||||||
|
if (getMainWindow()->isHidden()) {
|
||||||
|
m_prevWindowState = WindowState::Hidden;
|
||||||
|
}
|
||||||
|
|
||||||
if (force) {
|
if (force) {
|
||||||
getMainWindow()->bringToFront();
|
getMainWindow()->bringToFront();
|
||||||
}
|
}
|
||||||
|
@ -97,6 +97,13 @@ private:
|
|||||||
Allowed
|
Allowed
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum WindowState
|
||||||
|
{
|
||||||
|
Normal,
|
||||||
|
Minimized,
|
||||||
|
Hidden
|
||||||
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<Entry*> sortEntries(QList<Entry*>& pwEntries, const QString& host, const QString& submitUrl);
|
QList<Entry*> sortEntries(QList<Entry*>& pwEntries, const QString& host, const QString& submitUrl);
|
||||||
bool confirmEntries(QList<Entry*>& pwEntriesToConfirm,
|
bool confirmEntries(QList<Entry*>& pwEntriesToConfirm,
|
||||||
@ -125,8 +132,7 @@ private:
|
|||||||
DatabaseTabWidget* const m_dbTabWidget;
|
DatabaseTabWidget* const m_dbTabWidget;
|
||||||
bool m_dialogActive;
|
bool m_dialogActive;
|
||||||
bool m_bringToFrontRequested;
|
bool m_bringToFrontRequested;
|
||||||
bool m_wasMinimized;
|
WindowState m_prevWindowState;
|
||||||
bool m_wasHidden;
|
|
||||||
QUuid m_keepassBrowserUUID;
|
QUuid m_keepassBrowserUUID;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1162,7 +1162,7 @@ void MainWindow::hideYubiKeyPopup()
|
|||||||
void MainWindow::bringToFront()
|
void MainWindow::bringToFront()
|
||||||
{
|
{
|
||||||
ensurePolished();
|
ensurePolished();
|
||||||
setWindowState(windowState() & ~Qt::WindowMinimized);
|
setWindowState((windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
|
||||||
show();
|
show();
|
||||||
raise();
|
raise();
|
||||||
activateWindow();
|
activateWindow();
|
||||||
|
Loading…
Reference in New Issue
Block a user