class KNotifyClient

This class provides a method for issuing events to a KNotifyServer call KNotifyClient::event("eventname"); to issue it. More...

Definition#include <knotifyclient.h>
InheritsQObject (qt)
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Public Slots

Public Static Methods


Detailed Description

This class provides a method for issuing events to a KNotifyServer call KNotifyClient::event("eventname"); to issue it. On installation, there should be a file called $KDEDIR/share/apps/appname/eventsrc which contains the events.

The file looks like this:


 [!Global!]
 appname=executable
 friendly=FriendlyNameOfApp

 [eventname]
 friendly=FriendlyNameOfEvent
 description=DescriptionOfEvent
 default_sound=/path/to/sound/file
 default_presentation=1
  ...

This class works, but is still in testing.

 KNotifyClient (const QString &message, const QString &text=0, Presentation present=Default, const QString &file=0, DCOPClient* client=0)

The Default constructor. You should have little use for this thanks to the event method.

Parameters:
messageThe event type to send, such as "Desktop1" for a virtual desktop change
textIf you need to send off a message with your alert. This will happen for an error level of 2 or more.
presentHow to present it. If "Default" is chosen, the server will decide according to the config
clientThe DCOPClient to use. Usually it pulls the one from your KApplication.

bool  send ()

[slot]

If you need to send a message a whole lot sequentially, for reasons I don't want to know, you might instanciate a KNotifyClient, and call this function when needed.

bool  event (const QString &message, const QString &text=0)

[static]

This should be the most used method in here. Call it by KNotifyClient::event("EventName"); It will use KApplication::kApplication->dcopClient() to communicate to the server

Parameters:
messageThe name of the event
textThe text to put in a dialog box. This won't be shown if the user connected the event to sound, only.

Reimplemented from QObject

bool  userEvent (const QString &text=0, Presentation present=Default, const QString &file=0)

[static]

Will fire an event that's not registered.

Parameters:
textThe error message text, if applicable
presentThe error message level, one again, defaulting to "Default"
fileThe sound file to play if selected with present

Presentation  getPresentation (const QString &eventname)

[static]

Gets the presentation associated with a certain event name Remeber that they may be ORed: if (present & KNotifyClient::Sound) { [Yes, sound is a default] }

QString  getFile (const QString &eventname, Presentation present)

[static]

Gets the default file associated with a certain event name The control panel module will list all the event names This has the potential for being slow. [Not Yet Implemented!]

This gets it for this app only!

Presentation  getDefaultPresentation (const QString &eventname)

[static]

Gets the default presentation for the event of this program. Remember that the Presentation may be ORed. Try this: if (present & KNotifyClient::Sound) { [Yes, sound is a default] }

QString  getDefaultFile (const QString &eventname, Presentation present)

[static]

Gets the default File for the event of this program. It gets it in relation to present. Some events don't apply to this function ("Message Box") Some do (Sound)