mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-30 17:56:29 -05:00
add tray icon to MacOS X
This commit is contained in:
parent
b3160a17ea
commit
8d6db27b34
@ -660,13 +660,7 @@ void MainWindow::databaseTabChanged(int tabIndex)
|
|||||||
|
|
||||||
void MainWindow::closeEvent(QCloseEvent* event)
|
void MainWindow::closeEvent(QCloseEvent* event)
|
||||||
{
|
{
|
||||||
bool minimizeOnClose = config()->get("GUI/MinimizeOnClose").toBool();
|
if (isTrayIconEnabled() && config()->get("GUI/MinimizeOnClose").toBool() && !appExitCalled)
|
||||||
#ifndef Q_OS_MAC
|
|
||||||
// if we aren't on OS X, check if the tray is enabled.
|
|
||||||
// on OS X we are using the dock for the minimize action
|
|
||||||
minimizeOnClose = isTrayIconEnabled() && minimizeOnClose;
|
|
||||||
#endif
|
|
||||||
if (minimizeOnClose && !appExitCalled)
|
|
||||||
{
|
{
|
||||||
event->ignore();
|
event->ignore();
|
||||||
hideWindow();
|
hideWindow();
|
||||||
@ -836,7 +830,9 @@ void MainWindow::trayIconTriggered(QSystemTrayIcon::ActivationReason reason)
|
|||||||
|
|
||||||
void MainWindow::hideWindow()
|
void MainWindow::hideWindow()
|
||||||
{
|
{
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
setWindowState(windowState() | Qt::WindowMinimized);
|
setWindowState(windowState() | Qt::WindowMinimized);
|
||||||
|
#endif
|
||||||
QTimer::singleShot(0, this, SLOT(hide()));
|
QTimer::singleShot(0, this, SLOT(hide()));
|
||||||
|
|
||||||
if (config()->get("security/lockdatabaseminimize").toBool()) {
|
if (config()->get("security/lockdatabaseminimize").toBool()) {
|
||||||
@ -919,13 +915,8 @@ void MainWindow::repairDatabase()
|
|||||||
|
|
||||||
bool MainWindow::isTrayIconEnabled() const
|
bool MainWindow::isTrayIconEnabled() const
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
// systray not useful on OS X
|
|
||||||
return false;
|
|
||||||
#else
|
|
||||||
return config()->get("GUI/ShowTrayIcon").toBool()
|
return config()->get("GUI/ShowTrayIcon").toBool()
|
||||||
&& QSystemTrayIcon::isSystemTrayAvailable();
|
&& QSystemTrayIcon::isSystemTrayAvailable();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::displayGlobalMessage(const QString& text, MessageWidget::MessageType type, bool showClosebutton)
|
void MainWindow::displayGlobalMessage(const QString& text, MessageWidget::MessageType type, bool showClosebutton)
|
||||||
|
@ -66,11 +66,6 @@ SettingsWidget::SettingsWidget(QWidget* parent)
|
|||||||
m_generalUi->generalSettingsTabWidget->removeTab(1);
|
m_generalUi->generalSettingsTabWidget->removeTab(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
// systray not useful on OS X
|
|
||||||
m_generalUi->systraySettings->setVisible(false);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
connect(this, SIGNAL(accepted()), SLOT(saveSettings()));
|
connect(this, SIGNAL(accepted()), SLOT(saveSettings()));
|
||||||
connect(this, SIGNAL(rejected()), SLOT(reject()));
|
connect(this, SIGNAL(rejected()), SLOT(reject()));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user