PDA

View Full Version : QSystemTrayIcon: Overridden balloon msg



further
17th April 2008, 02:59
Hi All,

My application is a mailbox monitor (Java/QtJambi), polling email accounts to look for new messages. Tray ballons are used to display information (new message available...) or/and errors (server not responding...).

I use a FIFO mecanism to push notifications into a queue. I'd like to pop notifications and display them using showMessage() (http://doc.trolltech.com/latest/showmessage().html) with some mecanism allowing the user to confirm the previous balloon has been read before displaying the next one, to avoid unnoticed "critical" notifications being overridden before they have been read.

I'm aware of the messageClicked() (http://doc.trolltech.com/latest/messageclicked().html) signal that may inform of the closure of the balloon. However I'm looking for a way to known whether a balloon is currently displayed, rather than using a flag mecanism fueled by showMessage() (http://doc.trolltech.com/latest/showmessage().html) and messageClicked() (http://doc.trolltech.com/latest/messageclicked().html) that may desynchronize easily.

Any help will be appreciated (C++ or Java ok)
Thanks.
Robert.

spud
17th April 2008, 08:33
Actually I don't see your concern. What's wrong with flagging messages as "acknowledged" or "dismissed" upon QSystemTrayIcon::messageClicked(). Seeing that QSystemTrayIcons API is pretty minimal, any other solution will surely be highly platform dependent and likely much more complicated.

further
17th April 2008, 11:58
Spud, thanks for the feedback which could confirm there is no simple way to do that.

A balloon may be closed by the system itself without user action, leaving the application in a state like "maybe the balloon has been closed before the user saw it, maybe it is still visible".

With Windows XP, when the user doesn't interact, balloons remain visible as long as the application keeps the focus (beyond the timeout hint provided in QSystemTrayIcon::showMessage() (http://doc.trolltech.com/latest/qsystemtrayicon.html#showMessage)), when the application losts the focus, the balloon disappears. It seems no event/signal is triggered in this case (as well as when the timeout hint has expired).

This will make it difficult to have a reliable semaphore system. I know when to raise the "notificationIsVisible flag", but clearing it upon QSystemTrayIcon::messageClicked () (http://doc.trolltech.com/latest/qsystemtrayicon.html#messageClicked) is not sufficient (at least a timer needs to be used, but as explained above, still not reliable). I'm considering using alternatives.

Robert.