List Info

Thread: Singleton for multiple sessions




Singleton for multiple sessions
user name
2007-07-18 13:21:06
Is there a way to create some sort of singleton class in
such a way
that when a user has two or more sessions, only one instance
of that
singleton is created?

Here's the background:
For my personal entertainment I want to create a plasma
applet that
displays kdebug messages. In my opinion the easiest way to
intercept
kdebug messages is to create a kdebug message handler (a
singleton).
And that's what I did and it works perfectly, except when I
open a
second session in konsole. The debug messages for the second
session
are not being redirected to my plasma applet because a new
default
message handler is used.

Thus I have the following:
Session 1
     Default message handler is created
     Overload the default message handler with my own new
handler
     Debug messages show in the applet
Create a new session
     A new default message handler is created
     My applet is still running
     Messages show in konsole (as that's the default
behaviour on my pc)

What I want to create is a message handler that is only
instanciated
once and whenever and whichever session gets added or
removed, that
one and only message handler is kept until all sessions are
closed.

Does anyone know if and how that can be done?
 
>> Visit 
http://mail.kde.org/mailman/listinfo/kde-devel#unsub to
unsubscribe <<

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )