@@ -49,6 +49,7 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent),
4949 actHelp = new QAction (QIcon::fromTheme (QStringLiteral (" system-help" )), tr (" Help" ), this );
5050 actAbout = new QAction (QIcon::fromTheme (QStringLiteral (" system-about" )), tr (" About" ), this );
5151 actQuit = new QAction (QIcon::fromTheme (QStringLiteral (" application-exit" )), tr (" Quit" ), this );
52+ actHideQuit = new QAction (QIcon::fromTheme (QStringLiteral (" application-exit" )), tr (" QuitHide" ), this );
5253
5354 // connect actions to slots
5455 Core *c = Core::instance ();
@@ -79,9 +80,9 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent),
7980
8081 QWidget* spacer = new QWidget ();
8182 spacer->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding);
82- _ui->toolBar ->addWidget (spacer);
83+ _ui->toolBar ->addWidget (spacer);
8384
84- _ui->toolBar ->addAction (actQuit );
85+ _ui->toolBar ->addAction (actHideQuit );
8586
8687 void (QSpinBox::*delayChange)(int ) = &QSpinBox::valueChanged;
8788 connect (_ui->delayBox , delayChange, this , &MainWindow::delayBoxChange);
@@ -217,14 +218,14 @@ void MainWindow::show()
217218{
218219 if (!isVisible () && !_trayed)
219220 showNormal ();
220- if (_trayIcon){
221+ if (_trayIcon) {
221222 if (_conf->getShowTrayIcon ())
222223 {
223224 _trayIcon->blockSignals (false );
224225 _trayIcon->setContextMenu (_trayMenu);
225226 }
226227
227- _trayIcon->setVisible (true );
228+ _trayIcon->setVisible (true );
228229 }
229230 QMainWindow::show ();
230231}
@@ -451,6 +452,17 @@ void MainWindow::updateUI()
451452 _ui->checkIncludeCursor ->setChecked (_conf->getIncludeCursor ());
452453
453454 updateShortcuts ();
455+ Core* c = Core::instance ();
456+
457+ if (_conf->getShowTrayIcon ()) {
458+ disconnect (actHideQuit, &QAction::triggered, c, &Core::coreQuit);
459+ connect (actHideQuit, &QAction::triggered, this , &MainWindow::windowHideShow);
460+ actHideQuit->setText (tr (" Hide" ));
461+ } else {
462+ disconnect (actHideQuit, &QAction::triggered, this , &MainWindow::windowHideShow);
463+ connect (actHideQuit, &QAction::triggered, c, &Core::coreQuit);
464+ actHideQuit->setText (tr (" Quit" ));
465+ }
454466
455467 // create tray object
456468 if (_conf->getShowTrayIcon () && !_trayIcon)
0 commit comments