void Window::toggleTray(QSystemTrayIcon::ActivationReason reason) { if (cPlatform() == dbipMac && psIsActive()) return; if (reason == QSystemTrayIcon::Context) { updateTrayMenu(true); QTimer::singleShot(1, this, SLOT(psShowTrayMenu())); } else { if (psIsActive()) { minimizeToTray(); } else { showFromTray(reason); } } }
void Window::toggleTray(QSystemTrayIcon::ActivationReason reason) { if (reason != QSystemTrayIcon::Context) { if (psIsActive()) { minimizeToTray(); } else { showFromTray(reason); } } }
void Window::updateTrayMenu(bool force) { if (!trayIconMenu || (cPlatform() == dbipWindows && !force) || cPlatform() == dbipLinux32 || cPlatform() == dbipLinux64) return; bool active = psIsActive(); QAction *first = trayIconMenu->actions().at(0); first->setText(lang(active ? lng_minimize_to_tray : lng_open_from_tray)); disconnect(first, SIGNAL(triggered(bool)), 0, 0); connect(first, SIGNAL(triggered(bool)), this, active ? SLOT(minimizeToTray()) : SLOT(showFromTray())); #ifndef Q_OS_WIN if (trayIcon) { trayIcon->setContextMenu((active || cPlatform() != dbipMac) ? trayIconMenu : 0); } #endif }
bool Window::historyIsActive(int state) const { return psIsActive(state) && main && main->historyIsActive() && (!settings || !settings->isVisible()); }