@@ -47,6 +47,7 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent),
4747 actOptions = new QAction (QIcon::fromTheme (QStringLiteral (" configure" )), tr (" Options" ), this );
4848 actAbout = new QAction (QIcon::fromTheme (QStringLiteral (" help-about" )), tr (" About" ), this );
4949 actQuit = new QAction (QIcon::fromTheme (QStringLiteral (" application-exit" )), tr (" Quit" ), this );
50+ actHideQuit = new QAction (QIcon::fromTheme (QStringLiteral (" application-exit" )), tr (" QuitHide" ), this );
5051
5152 // connect actions to slots
5253 Core *c = Core::instance ();
@@ -67,9 +68,9 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent),
6768
6869 QWidget* spacer = new QWidget ();
6970 spacer->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding);
70- _ui->toolBar ->addWidget (spacer);
71+ _ui->toolBar ->addWidget (spacer);
7172
72- _ui->toolBar ->addAction (actQuit );
73+ _ui->toolBar ->addAction (actHideQuit );
7374
7475 connect (_ui->delayBox , &QSpinBox::valueChanged, this , &MainWindow::delayBoxChange);
7576 connect (_ui->checkIncludeCursor , &QCheckBox::toggled, this , &MainWindow::checkIncludeCursor);
@@ -285,14 +286,14 @@ void MainWindow::show()
285286{
286287 if (!isVisible () && !_trayed)
287288 showNormal ();
288- if (_trayIcon){
289+ if (_trayIcon) {
289290 if (_conf->getShowTrayIcon ())
290291 {
291292 _trayIcon->blockSignals (false );
292293 _trayIcon->setContextMenu (_trayMenu);
293294 }
294295
295- _trayIcon->setVisible (true );
296+ _trayIcon->setVisible (true );
296297 }
297298 QMainWindow::show ();
298299}
@@ -511,6 +512,17 @@ void MainWindow::updateUI()
511512 _ui->checkIncludeCursor ->setChecked (_conf->getIncludeCursor ());
512513
513514 updateShortcuts ();
515+ Core* c = Core::instance ();
516+
517+ if (_conf->getShowTrayIcon ()) {
518+ disconnect (actHideQuit, &QAction::triggered, c, &Core::coreQuit);
519+ connect (actHideQuit, &QAction::triggered, this , &MainWindow::windowHideShow);
520+ actHideQuit->setText (tr (" Hide" ));
521+ } else {
522+ disconnect (actHideQuit, &QAction::triggered, this , &MainWindow::windowHideShow);
523+ connect (actHideQuit, &QAction::triggered, c, &Core::coreQuit);
524+ actHideQuit->setText (tr (" Quit" ));
525+ }
514526
515527 // create tray object, but not with the "-n" option
516528 if (!Core::instance ()->noWin () && _conf->getShowTrayIcon () && !_trayIcon)
0 commit comments