add automatic op reloading when opening tray menu
parent
e07cff2521
commit
2d1c1ae273
|
@ -90,7 +90,6 @@ TrayManager::~TrayManager() {
|
|||
cleanChooseOpSubmenu(); // must be done before deleting chooseOpSubmenu/action
|
||||
|
||||
delete chooseOpStatusAction;
|
||||
delete refreshOperationListAction;
|
||||
delete chooseOpSubmenu;
|
||||
|
||||
delete trayIconMenu;
|
||||
|
@ -171,14 +170,7 @@ void TrayManager::createActions() {
|
|||
chooseOpStatusAction = new QAction("Loading operations...", chooseOpSubmenu);
|
||||
chooseOpStatusAction->setEnabled(false);
|
||||
|
||||
refreshOperationListAction = new QAction(tr("Refresh Operations"), chooseOpSubmenu);
|
||||
connect(refreshOperationListAction, &QAction::triggered, [this] {
|
||||
chooseOpStatusAction->setText("Loading operations...");
|
||||
NetMan::getInstance().refreshOperationsList();
|
||||
});
|
||||
|
||||
chooseOpSubmenu->addAction(chooseOpStatusAction);
|
||||
chooseOpSubmenu->addAction(refreshOperationListAction);
|
||||
chooseOpSubmenu->addSeparator();
|
||||
}
|
||||
|
||||
|
@ -256,6 +248,10 @@ void TrayManager::createTrayMenu() {
|
|||
|
||||
trayIcon = new QSystemTrayIcon(this);
|
||||
trayIcon->setContextMenu(trayIconMenu);
|
||||
connect(trayIcon, &QSystemTrayIcon::activated, [this]{
|
||||
chooseOpStatusAction->setText("Loading operations...");
|
||||
NetMan::getInstance().refreshOperationsList();
|
||||
});
|
||||
}
|
||||
|
||||
void TrayManager::onScreenshotCaptured(const QString& path) {
|
||||
|
|
|
@ -74,7 +74,6 @@ class TrayManager : public QDialog {
|
|||
void cleanChooseOpSubmenu();
|
||||
QMenu *chooseOpSubmenu;
|
||||
QAction *chooseOpStatusAction;
|
||||
QAction *refreshOperationListAction;
|
||||
QAction *selectedAction = nullptr; // note: do not delete; for reference only
|
||||
std::vector<QAction *> allOperationActions;
|
||||
|
||||
|
|
Loading…
Reference in New Issue