From 6b0b580e1516597505bee10339e97a48f95aa587 Mon Sep 17 00:00:00 2001 From: Dirk H Bartley Date: Sat, 14 Mar 2009 01:41:41 +0000 Subject: [PATCH] Temporary fix to ease the ".messages" issues. Set the messages button bar to a different icon to signal that messages are pending. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8526 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/console/console.cpp | 44 +- bacula/src/qt-console/console/console.h | 2 + .../images/mail-message-pending.png | Bin 0 -> 1772 bytes .../images/mail-message-pending.svg | 467 ++++++++++++++++++ bacula/src/qt-console/main.qrc | 1 + bacula/src/qt-console/mainwin.cpp | 9 + bacula/src/qt-console/mainwin.h | 1 + 7 files changed, 510 insertions(+), 14 deletions(-) create mode 100644 bacula/src/qt-console/images/mail-message-pending.png create mode 100644 bacula/src/qt-console/images/mail-message-pending.svg diff --git a/bacula/src/qt-console/console/console.cpp b/bacula/src/qt-console/console/console.cpp index 9fb2a0dc11..ae9da662de 100644 --- a/bacula/src/qt-console/console/console.cpp +++ b/bacula/src/qt-console/console/console.cpp @@ -45,10 +45,11 @@ static int tls_pem_callback(char *buf, int size, const void *userdata); Console::Console(QStackedWidget *parent): m_notifier(NULL), -m_api_set(false), -m_messages_pending(false) +m_api_set(false) { QFont font; + Pmsg0(000, "initializing m_messages_pending to false\n"); + m_messages_pending = false; m_parent = parent; m_closeable = false; m_console = this; @@ -92,13 +93,16 @@ void Console::stopTimer() m_timer = NULL; } } - + +/* slot connected to the timer + * requires preferences of check messages and operates at interval */ void Console::poll_messages() { - m_messages_pending = true; - if ((m_at_main_prompt) && (mainWin->m_checkMessages)){ + if ( mainWin->m_checkMessages && m_at_main_prompt && hasFocus()){ + messagesPending(true); write(".messages"); displayToPrompt(); + messagesPending(false); } } @@ -476,11 +480,13 @@ void Console::status_dir() /* * Slot for responding to messages button on button bar + * Here we want to bring the console to the front so use pages' consoleCommand */ void Console::messages() { QString cmd(".messages"); consoleCommand(cmd); + messagesPending(false); } /* @@ -595,12 +601,12 @@ void Console::displayToPrompt() if (mainWin->m_commDebug) Pmsg0(000, "DisplaytoPrompt\n"); while (!m_at_prompt) { if ((stat=read()) > 0) { - buf += msg(); - if (buf.size() >= 8196 || m_messages_pending) { - display_text(buf); - buf.clear(); - m_messages_pending = false; - } + buf += msg(); + if (buf.size() >= 8196 || m_messages_pending) { + display_text(buf); + buf.clear(); + messagesPending(false); + } } } display_text(buf); @@ -649,7 +655,7 @@ int Console::read() app->processEvents(); if (m_api_set && m_messages_pending && is_notify_enabled() && hasFocus()) { write_dir(".messages"); - m_messages_pending = false; + messagesPending(false); } } m_sock->msg[0] = 0; @@ -668,9 +674,9 @@ int Console::read() if (mainWin->m_commDebug) Pmsg0(000, "MSGS PENDING\n"); write_dir(".messages"); displayToPrompt(); - m_messages_pending = false; + messagesPending(false); } - m_messages_pending = true; + messagesPending(true); continue; case BNET_CMD_OK: if (mainWin->m_commDebug) Pmsg0(000, "CMD OK\n"); @@ -960,3 +966,13 @@ bool Console::hasFocus() else return false; } + +/* For adding feature to have the gui's messages button change when + * messages are pending */ +bool Console::messagesPending(bool pend) +{ + bool prev = m_messages_pending; + m_messages_pending = pend; + mainWin->setMessageIcon(); + return prev; +} diff --git a/bacula/src/qt-console/console/console.h b/bacula/src/qt-console/console/console.h index 439003b0f6..65ab2d8c9c 100644 --- a/bacula/src/qt-console/console/console.h +++ b/bacula/src/qt-console/console/console.h @@ -107,6 +107,7 @@ public: void stopTimer(); void getVolumeList(QStringList &); void getStatusList(QStringList &); + bool is_messagesPending() { return m_messages_pending; }; QStringList job_list; QStringList client_list; @@ -146,6 +147,7 @@ private: bool m_messages_pending; QTimer *m_timer; bool hasFocus(); + bool messagesPending(bool pend); }; #endif /* _CONSOLE_H_ */ diff --git a/bacula/src/qt-console/images/mail-message-pending.png b/bacula/src/qt-console/images/mail-message-pending.png new file mode 100644 index 0000000000000000000000000000000000000000..5b1680c816dad95642e771dd04aff259db4a283b GIT binary patch literal 1772 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(?R}R$ zt-oR2cONGd4r8sw_kGgoG`8^g#HM@2(?bxviIZAJVd=M{Ycl9!V`?LHy z6lUGh&y4F@w0|t(?d_!Z?`Qc7FI?Wa5EJwg!IWOZWd~01@7=HR$6%D3<}WE|lnKdu zdwMv3{5W5D^wIH+V}?xXKoPg^-p3DS)Zw}Tvc5;}a4#aou&YQR%GQNqxcweqdidcI zFy((NR(b1V2nHQ z7N}}T2L@`Z*z?s*Z29!(sZM)v*FA9J1fACbsl*n;h1!BYLJC^WuwWTN|{sjXD<-m9K;_U}|Hi zB8Lw3&lo2Fh@E`@{pus + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Mail New + + + Jakub Steiner + + + + + Andreas Nilsson, Steven Garrity + + + + + + mail + e-mail + MUA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/qt-console/main.qrc b/bacula/src/qt-console/main.qrc index f521152c8e..16266bb271 100644 --- a/bacula/src/qt-console/main.qrc +++ b/bacula/src/qt-console/main.qrc @@ -26,6 +26,7 @@ images/joblog.png images/label.png images/mail-message-new.png + images/mail-message-pending.png images/mark.png images/network-server.png images/new.png diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index a03e221025..3e3567bd3d 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -397,6 +397,7 @@ void MainWin::treeItemChanged(QTreeWidgetItem *currentitem, QTreeWidgetItem *pre connect(actionSelectFont, SIGNAL(triggered()), m_currentConsole, SLOT(set_font())); connect(actionStatusDir, SIGNAL(triggered()), m_currentConsole, SLOT(status_dir())); connect(actionMessages, SIGNAL(triggered()), m_currentConsole, SLOT(messages())); + setMessageIcon(); /* Set director's tree widget background to magenta for ease of identification */ QTreeWidgetItem *dirItem = m_currentConsole->directorTreeItem(); QBrush magentaBrush(Qt::magenta); @@ -841,3 +842,11 @@ void MainWin::readPreferences() m_rtRestore3Debug = settings.value("rtRestore3Debug", false).toBool(); settings.endGroup(); } + +void MainWin::setMessageIcon() +{ + if (m_currentConsole->is_messagesPending()) + actionMessages->setIcon(QIcon(QString::fromUtf8(":/images/mail-message-pending.png"))); + else + actionMessages->setIcon(QIcon(QString::fromUtf8(":/images/mail-message-new.png"))); +} diff --git a/bacula/src/qt-console/mainwin.h b/bacula/src/qt-console/mainwin.h index 64df8f51da..09c10591d4 100644 --- a/bacula/src/qt-console/mainwin.h +++ b/bacula/src/qt-console/mainwin.h @@ -59,6 +59,7 @@ public: void hashInsert(QTreeWidgetItem *, Pages *); void hashRemove(Pages *); void hashRemove(QTreeWidgetItem *, Pages *); + void setMessageIcon(); Console *currentConsole(); QTreeWidgetItem *currentTopItem(); Pages* getFromHash(QTreeWidgetItem *); -- 2.39.5