Permalink
Browse files

Add the tray option to manually refresh the messages - now we are not…

… forced to wait five minutes when doing testing on zpool status changes
  • Loading branch information...
1 parent 3da8c20 commit 2c4335ebbc945cd0c018654afb28c1f2572cdcd0 Ken Moore committed Oct 17, 2013
Showing with 15 additions and 1 deletion.
  1. +8 −1 lp-tray/LPTray.cpp
  2. +1 −0 lp-tray/LPTray.h
  3. +4 −0 lp-tray/LPWatcher.cpp
  4. +1 −0 lp-tray/LPWatcher.h
  5. +1 −0 lp-tray/lPreserve.qrc
View
9 lp-tray/LPTray.cpp
@@ -8,9 +8,11 @@ LPTray::LPTray() : QSystemTrayIcon(){
connect(watcher,SIGNAL(StatusUpdated()),this,SLOT(watcherMessage()) );
//Setup the context menu
menu = new QMenu;
- menu->addAction(QIcon(":/images/backup-failed.png"),tr("View Messages"),this,SLOT(startMessageDialog()) );
menu->addAction(QIcon(":/images/tray-icon-idle.png"),tr("Start Application UI"),this,SLOT(startGUI()) );
menu->addSeparator();
+ menu->addAction(QIcon(":/images/backup-failed.png"),tr("View Messages"),this,SLOT(startMessageDialog()) );
+ menu->addAction(QIcon(":/images/refresh.png"),tr("Refresh Tray"),this,SLOT(refreshStatus()) );
+ menu->addSeparator();
menu->addAction(QIcon(":/images/application-exit.png"),tr("Close Life Preserver Tray"),this,SLOT(slotClose()) );
this->setContextMenu(menu);
//Setup initial icon for the tray
@@ -163,3 +165,8 @@ void LPTray::startMessageDialog(){
msgdlg->raise();
msgdlg->show();
}
+
+void LPTray::refreshStatus(){
+ //Manually trigger the watcher to update status notifications
+ watcher->refresh();
+}
View
1 lp-tray/LPTray.h
@@ -31,6 +31,7 @@ private slots:
void slotSingleInstance();
void startGUI();
void startMessageDialog();
+ void refreshStatus();
};
View
4 lp-tray/LPWatcher.cpp
@@ -79,6 +79,10 @@ void LPWatcher::stop(){
timer->stop();
}
+void LPWatcher::refresh(){
+ QTimer::singleShot(1, this, SLOT(checkPoolStatus()) );
+}
+
QStringList LPWatcher::getMessages(QString type, QStringList msgList){
QStringList output;
type = type.toLower();
View
1 lp-tray/LPWatcher.h
@@ -28,6 +28,7 @@ class LPWatcher : public QObject{
public slots:
void start();
void stop();
+ void refresh();
private:
//Internal paths for the lpreserver output files
View
1 lp-tray/lPreserve.qrc
@@ -11,5 +11,6 @@
<file>images/list-remove.png</file>
<file>images/tray-icon-idle.png</file>
<file>images/tray-icon-failed.png</file>
+ <file>images/refresh.png</file>
</qresource>
</RCC>

0 comments on commit 2c4335e

Please sign in to comment.