Merge pull request #582 from weslly/feature/macos-minimize-onclose

Fix quit submenu on macOS tray icon
This commit is contained in:
TheZ3ro 2017-05-19 14:19:11 +02:00 committed by GitHub
commit 07d4668670

View File

@ -747,10 +747,17 @@ void MainWindow::updateTrayIcon()
QAction* actionToggle = new QAction(tr("Toggle window"), menu); QAction* actionToggle = new QAction(tr("Toggle window"), menu);
menu->addAction(actionToggle); menu->addAction(actionToggle);
#ifdef Q_OS_MAC
QAction* actionQuit = new QAction(tr("Quit KeePassXC"), menu);
menu->addAction(actionQuit);
connect(actionQuit, SIGNAL(triggered()), SLOT(appExit()));
#else
menu->addAction(m_ui->actionQuit); menu->addAction(m_ui->actionQuit);
connect(m_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), connect(m_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
SLOT(trayIconTriggered(QSystemTrayIcon::ActivationReason))); SLOT(trayIconTriggered(QSystemTrayIcon::ActivationReason)));
#endif
connect(actionToggle, SIGNAL(triggered()), SLOT(toggleWindow())); connect(actionToggle, SIGNAL(triggered()), SLOT(toggleWindow()));
m_trayIcon->setContextMenu(menu); m_trayIcon->setContextMenu(menu);