1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

feat(systemtray): add "Show" action to context menu

Makes it possible for all users to get qTox back from the tray.
This commit is contained in:
sudden6 2016-06-05 15:57:45 +02:00
parent f74ba9131c
commit a851a5b18d
No known key found for this signature in database
GPG Key ID: 279509B499E032B9
2 changed files with 10 additions and 0 deletions

View File

@ -124,6 +124,10 @@ void Widget::init()
offlineMsgTimer->start(2*60*1000); offlineMsgTimer->start(2*60*1000);
icon_size = 15; icon_size = 15;
actionActivate = new QAction(this);
connect(actionActivate, &QAction::triggered, this, &Widget::forceShow);
statusOnline = new QAction(this); statusOnline = new QAction(this);
statusOnline->setIcon(prepareIcon(getStatusIconPath(Status::Online), icon_size, icon_size)); statusOnline->setIcon(prepareIcon(getStatusIconPath(Status::Online), icon_size, icon_size));
connect(statusOnline, &QAction::triggered, this, &Widget::setStatusOnline); connect(statusOnline, &QAction::triggered, this, &Widget::setStatusOnline);
@ -143,6 +147,7 @@ void Widget::init()
#ifndef Q_OS_OSX #ifndef Q_OS_OSX
actionQuit->setMenuRole(QAction::QuitRole); actionQuit->setMenuRole(QAction::QuitRole);
#endif #endif
actionQuit->setIcon(prepareIcon(":/ui/rejectCall/rejectCall.svg", icon_size, icon_size)); actionQuit->setIcon(prepareIcon(":/ui/rejectCall/rejectCall.svg", icon_size, icon_size));
connect(actionQuit, &QAction::triggered, qApp, &QApplication::quit); connect(actionQuit, &QAction::triggered, qApp, &QApplication::quit);
@ -1785,6 +1790,9 @@ void Widget::onTryCreateTrayIcon()
updateIcons(); updateIcons();
trayMenu = new QMenu(this); trayMenu = new QMenu(this);
// adding activate to the top, avoids accidentally clicking quit
trayMenu->addAction(actionActivate);
trayMenu->addSeparator();
trayMenu->addAction(statusOnline); trayMenu->addAction(statusOnline);
trayMenu->addAction(statusAway); trayMenu->addAction(statusAway);
trayMenu->addAction(statusBusy); trayMenu->addAction(statusBusy);
@ -2245,6 +2253,7 @@ void Widget::retranslateUi()
statusBusy->setText(tr("Busy", "Button to set your status to 'Busy'")); statusBusy->setText(tr("Busy", "Button to set your status to 'Busy'"));
actionLogout->setText(tr("Logout", "Tray action menu to logout user")); actionLogout->setText(tr("Logout", "Tray action menu to logout user"));
actionQuit->setText(tr("Exit", "Tray action menu to exit tox")); actionQuit->setText(tr("Exit", "Tray action menu to exit tox"));
actionActivate->setText(tr("Activate", "Tray action menu to reactivate qTox window"));
if (!Settings::getInstance().getSeparateWindow()) if (!Settings::getInstance().getSeparateWindow())
setWindowTitle(fromDialogType(AddDialog)); setWindowTitle(fromDialogType(AddDialog));

View File

@ -241,6 +241,7 @@ private:
QAction *statusBusy; QAction *statusBusy;
QAction *actionLogout; QAction *actionLogout;
QAction *actionQuit; QAction *actionQuit;
QAction *actionActivate;
QMenu* filterMenu; QMenu* filterMenu;