From: Dirk H Bartley Date: Sat, 14 Mar 2009 01:41:41 +0000 (+0000) Subject: Temporary fix to ease the ".messages" issues. Set the messages button bar X-Git-Tag: Release-3.0.0~166 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6b0b580e1516597505bee10339e97a48f95aa587;p=bacula%2Fbacula 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 --- 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 0000000000..5b1680c816 Binary files /dev/null and b/bacula/src/qt-console/images/mail-message-pending.png differ diff --git a/bacula/src/qt-console/images/mail-message-pending.svg b/bacula/src/qt-console/images/mail-message-pending.svg new file mode 100644 index 0000000000..59df1b591f --- /dev/null +++ b/bacula/src/qt-console/images/mail-message-pending.svg @@ -0,0 +1,467 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 *);