mirror of
https://github.com/zealdocs/zeal.git
synced 2024-12-02 09:44:14 +03:00
ui: Display show/hide in the systray menu on all platforms
This commit is contained in:
parent
d0b2d4c2dd
commit
4769b7a228
@ -718,19 +718,14 @@ void MainWindow::createTrayIcon()
|
||||
|
||||
QMenu *trayIconMenu = new QMenu(this);
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
if (QString::fromLocal8Bit(qgetenv("XDG_CURRENT_DESKTOP")) == QLatin1String("Unity")) {
|
||||
QAction *showAction = trayIconMenu->addAction(tr("Show"));
|
||||
connect(showAction, &QAction::triggered, this, &MainWindow::toggleWindow);
|
||||
|
||||
connect(trayIconMenu, &QMenu::aboutToShow, this, [this, showAction]() {
|
||||
showAction->setText(isVisible() ? tr("Hide") : tr("Show"));
|
||||
});
|
||||
|
||||
trayIconMenu->addSeparator();
|
||||
}
|
||||
#endif
|
||||
// TODO: [Qt 5.6] Use addAction(text, receiver, method...).
|
||||
QAction *toggleAction = trayIconMenu->addAction(tr("Show Zeal"));
|
||||
connect(toggleAction, &QAction::triggered, this, &MainWindow::toggleWindow);
|
||||
connect(trayIconMenu, &QMenu::aboutToShow, this, [this, toggleAction]() {
|
||||
toggleAction->setText(isVisible() ? tr("Minimize to Tray") : tr("Show Zeal"));
|
||||
});
|
||||
|
||||
trayIconMenu->addSeparator();
|
||||
trayIconMenu->addAction(ui->actionQuit);
|
||||
m_trayIcon->setContextMenu(trayIconMenu);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user