mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-28 08:49:42 -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)
|
||||
{
|
||||
bool minimizeOnClose = config()->get("GUI/MinimizeOnClose").toBool();
|
||||
#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)
|
||||
if (isTrayIconEnabled() && config()->get("GUI/MinimizeOnClose").toBool() && !appExitCalled)
|
||||
{
|
||||
event->ignore();
|
||||
hideWindow();
|
||||
@ -836,7 +830,9 @@ void MainWindow::trayIconTriggered(QSystemTrayIcon::ActivationReason reason)
|
||||
|
||||
void MainWindow::hideWindow()
|
||||
{
|
||||
#ifndef Q_OS_MAC
|
||||
setWindowState(windowState() | Qt::WindowMinimized);
|
||||
#endif
|
||||
QTimer::singleShot(0, this, SLOT(hide()));
|
||||
|
||||
if (config()->get("security/lockdatabaseminimize").toBool()) {
|
||||
@ -919,13 +915,8 @@ void MainWindow::repairDatabase()
|
||||
|
||||
bool MainWindow::isTrayIconEnabled() const
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
// systray not useful on OS X
|
||||
return false;
|
||||
#else
|
||||
return config()->get("GUI/ShowTrayIcon").toBool()
|
||||
&& QSystemTrayIcon::isSystemTrayAvailable();
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainWindow::displayGlobalMessage(const QString& text, MessageWidget::MessageType type, bool showClosebutton)
|
||||
|
@ -66,11 +66,6 @@ SettingsWidget::SettingsWidget(QWidget* parent)
|
||||
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(rejected()), SLOT(reject()));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user