| 67 | } |
| 68 | |
| 69 | bool TrayIconController::handleCloseToTrayIcon(QCloseEvent *event) |
| 70 | { |
| 71 | #ifdef Q_OS_MACOS |
| 72 | if (!event->spontaneous() || !window->isVisible()) { |
| 73 | return false; |
| 74 | } |
| 75 | #endif |
| 76 | if (trayIcon.isVisible()) { |
| 77 | if (!settings->value(CLOSE_TO_TRAY_NOTIFIED, false).toBool()) { |
| 78 | QMessageBox::information(window, tr("Systray"), |
| 79 | tr("YACReaderLibrary will keep running in the " |
| 80 | "system tray. To terminate the program, " |
| 81 | "choose <b>Quit</b> in the context menu " |
| 82 | "of the system tray icon.")); |
| 83 | settings->setValue(CLOSE_TO_TRAY_NOTIFIED, true); |
| 84 | } |
| 85 | #ifdef Q_OS_MACOS |
| 86 | OSXHideDockIcon(); |
| 87 | #endif |
| 88 | window->hide(); |
| 89 | event->ignore(); |
| 90 | return true; |
| 91 | } else { |
| 92 | return false; |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | void TrayIconController::showWindow() |
| 97 | { |
no test coverage detected