From 217274bf216f62b08c699e3f50d0272a22259b57 Mon Sep 17 00:00:00 2001 From: Dirk H Bartley Date: Fri, 13 Mar 2009 01:33:32 +0000 Subject: [PATCH] Implement a suppression of .messages if the console does not have the focus. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8524 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/console/console.cpp | 14 ++++++++++++-- bacula/src/qt-console/console/console.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/bacula/src/qt-console/console/console.cpp b/bacula/src/qt-console/console/console.cpp index 97d4adf118..9fb2a0dc11 100644 --- a/bacula/src/qt-console/console/console.cpp +++ b/bacula/src/qt-console/console/console.cpp @@ -647,7 +647,7 @@ int Console::read() break; } app->processEvents(); - if (m_api_set && m_messages_pending && is_notify_enabled()) { + if (m_api_set && m_messages_pending && is_notify_enabled() && hasFocus()) { write_dir(".messages"); m_messages_pending = false; } @@ -664,7 +664,7 @@ int Console::read() } switch (m_sock->msglen) { case BNET_MSGS_PENDING : - if (is_notify_enabled()) { + if (is_notify_enabled() && hasFocus()) { if (mainWin->m_commDebug) Pmsg0(000, "MSGS PENDING\n"); write_dir(".messages"); displayToPrompt(); @@ -950,3 +950,13 @@ void Console::getStatusList(QStringList &statusLongList) } /* foreach resultline */ } /* if results from statusquery */ } + +/* For suppressing .messages + * This may be rendered not needed if the multiple connections feature gets working */ +bool Console::hasFocus() +{ + if (mainWin->stackedWidget->currentIndex() == mainWin->stackedWidget->indexOf(this)) + return true; + else + return false; +} diff --git a/bacula/src/qt-console/console/console.h b/bacula/src/qt-console/console/console.h index 44e577c927..439003b0f6 100644 --- a/bacula/src/qt-console/console/console.h +++ b/bacula/src/qt-console/console/console.h @@ -145,6 +145,7 @@ private: bool m_api_set; bool m_messages_pending; QTimer *m_timer; + bool hasFocus(); }; #endif /* _CONSOLE_H_ */ -- 2.39.5