small tray fixes

This commit is contained in:
arcan1s 2014-08-24 13:00:50 +04:00
parent d65ded6072
commit e21b2201ab
2 changed files with 6 additions and 3 deletions

View File

@ -165,6 +165,8 @@ void TrayIcon::updateMenu()
contextMenu[QString("gui")]->setText(QApplication::translate("TrayIcon", "Show")); contextMenu[QString("gui")]->setText(QApplication::translate("TrayIcon", "Show"));
else else
contextMenu[QString("gui")]->setText(QApplication::translate("TrayIcon", "Hide")); contextMenu[QString("gui")]->setText(QApplication::translate("TrayIcon", "Hide"));
setContextMenu(menuActions);
} }
@ -176,6 +178,7 @@ void TrayIcon::createActions()
contextMenu[QString("title")] = new QAction(QIcon(":icon"), QApplication::translate("TrayIcon", "Status"), this); contextMenu[QString("title")] = new QAction(QIcon(":icon"), QApplication::translate("TrayIcon", "Status"), this);
menuActions->addAction(contextMenu[QString("title")]); menuActions->addAction(contextMenu[QString("title")]);
connect(contextMenu[QString("title")], SIGNAL(triggered(bool)), this, SLOT(showInformationInWindow()));
menuActions->addSeparator(); menuActions->addSeparator();
@ -233,9 +236,7 @@ void TrayIcon::init()
setToolTip(QString("netctl-gui")); setToolTip(QString("netctl-gui"));
createActions(); createActions();
setContextMenu(menuActions);
connect(this, SIGNAL(messageClicked()), this, SLOT(showInformationInWindow()));
connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
this, SLOT(itemActivated(QSystemTrayIcon::ActivationReason))); this, SLOT(itemActivated(QSystemTrayIcon::ActivationReason)));
} }
@ -254,6 +255,8 @@ void TrayIcon::itemActivated(const QSystemTrayIcon::ActivationReason reason)
mainWindow->showMainWindow(); mainWindow->showMainWindow();
break; break;
case QSystemTrayIcon::Context: case QSystemTrayIcon::Context:
// clear menu before update
setContextMenu(0);
updateMenu(); updateMenu();
break; break;
default: default:

View File

@ -1935,7 +1935,7 @@
</message> </message>
<message> <message>
<source>Restart %1</source> <source>Restart %1</source>
<translation>Перезапустит %1</translation> <translation>Перезапустить %1</translation>
</message> </message>
<message> <message>
<source>Disable %1</source> <source>Disable %1</source>