mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-11-22 07:51:37 -05:00
Merge branch 'release/2.1.2' into develop
This commit is contained in:
commit
e0e6f2b8e9
70 changed files with 7701 additions and 723 deletions
|
|
@ -22,6 +22,11 @@
|
|||
#include <QShortcut>
|
||||
#include <QTimer>
|
||||
|
||||
#if defined(Q_OS_LINUX) && ! defined(QT_NO_DBUS)
|
||||
#include <QList>
|
||||
#include <QtDBus/QtDBus>
|
||||
#endif
|
||||
|
||||
#include "config-keepassx.h"
|
||||
|
||||
#include "autotype/AutoType.h"
|
||||
|
|
@ -590,7 +595,7 @@ void MainWindow::closeEvent(QCloseEvent* event)
|
|||
if (minimizeOnClose && !appExitCalled)
|
||||
{
|
||||
event->ignore();
|
||||
hide();
|
||||
toggleWindow();
|
||||
|
||||
if (config()->get("security/lockdatabaseminimize").toBool()) {
|
||||
m_ui->tabWidget->lockDatabases();
|
||||
|
|
@ -758,18 +763,37 @@ void MainWindow::trayIconTriggered(QSystemTrayIcon::ActivationReason reason)
|
|||
void MainWindow::toggleWindow()
|
||||
{
|
||||
if ((QApplication::activeWindow() == this) && isVisible() && !isMinimized()) {
|
||||
hide();
|
||||
|
||||
setWindowState(windowState() | Qt::WindowMinimized);
|
||||
QTimer::singleShot(0, this, SLOT(hide()));
|
||||
|
||||
if (config()->get("security/lockdatabaseminimize").toBool()) {
|
||||
m_ui->tabWidget->lockDatabases();
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ensurePolished();
|
||||
setWindowState(windowState() & ~Qt::WindowMinimized);
|
||||
show();
|
||||
raise();
|
||||
activateWindow();
|
||||
|
||||
#if defined(Q_OS_LINUX) && ! defined(QT_NO_DBUS)
|
||||
// re-register global D-Bus menu (needed on Ubuntu with Unity)
|
||||
// see https://github.com/keepassxreboot/keepassxc/issues/271
|
||||
// and https://bugreports.qt.io/browse/QTBUG-58723
|
||||
// check for !isVisible(), because isNativeMenuBar() does not work with appmenu-qt5
|
||||
if (!m_ui->menubar->isVisible()) {
|
||||
QDBusMessage msg = QDBusMessage::createMethodCall(
|
||||
"com.canonical.AppMenu.Registrar",
|
||||
"/com/canonical/AppMenu/Registrar",
|
||||
"com.canonical.AppMenu.Registrar",
|
||||
"RegisterWindow");
|
||||
QList<QVariant> args;
|
||||
args << QVariant::fromValue(static_cast<uint32_t>(winId()))
|
||||
<< QVariant::fromValue(QDBusObjectPath("/MenuBar/1"));
|
||||
msg.setArguments(args);
|
||||
QDBusConnection::sessionBus().send(msg);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue