KNotifyClient Namespace Reference
This namespace provides a method for issuing events to a KNotifyServer call KNotifyClient::event("eventname"); to issue it. More...
Classes | |
class | Instance |
Makes it possible to use KNotifyClient with a KInstance that is not the application. Enables KNotifyClient to use a different KInstance. More... | |
Enumerations | |
enum | { Default = -1, None = 0, Sound = 1, Messagebox = 2, Logfile = 4, Stderr = 8, PassivePopup = 16, Execute = 32 } |
Describes the notification method. More... | |
enum | { Notification = 1, Warning = 2, Error = 4, Catastrophe = 8 } |
Describes the level of the error. More... | |
enum | StandardEvent { cannotOpenFile, notification, warning, fatalError, catastrophe } |
default events you can use More... | |
Functions | |
bool | startDaemon () |
This starts the KNotify Daemon, if it's not already started. | |
bool | event (const QString &message, const QString &text=QString::null) |
This class or method is obsolete, it is provided for compatibility only. | |
bool | event (StandardEvent event, const QString &text=QString::null) |
This class or method is obsolete, it is provided for compatibility only. Allows to easily emit standard events. | |
bool | userEvent (const QString &text=QString::null, int present=Default, int level=Default, const QString &sound=QString::null, const QString &file=QString::null) |
This class or method is obsolete, it is provided for compatibility only. Will fire an event that's not registered. | |
bool | event (int winId, const QString &message, const QString &text=QString::null) |
This should be the most used method in here. | |
bool | event (int winId, StandardEvent event, const QString &text=QString::null) |
You should pass the origin-widget's winId() here so that a PassivePopup can be placed appropriately. | |
bool | userEvent (int winId, const QString &text=QString::null, int present=Default, int level=Default, const QString &sound=QString::null, const QString &file=QString::null) |
Will fire an event that's not registered. | |
void | beep (const QString &reason=QString::null) |
This is a simple substitution for QApplication::beep(). | |
int | getPresentation (const QString &eventname) |
Gets the presentation associated with a certain event name Remeber that they may be ORed:. | |
QString | getFile (const QString &eventname, int present) |
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. | |
int | getDefaultPresentation (const QString &eventname) |
Gets the default presentation for the event of this program. | |
QString | getDefaultFile (const QString &eventname, int present) |
Gets the default File for the event of this program. | |
KInstance * | instance () |
Shortcut to KNotifyClient::Instance::current() :). |
Detailed Description
This namespace 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!] IconName=Filename (e.g. kdesktop, without any extension) Comment=FriendlyNameOfApp
[eventname] Name=FriendlyNameOfEvent Comment=Description Of Event default_sound=filetoplay.wav default_presentation=1 ...default_presentation contains these ORed events: None=0, Sound=1, Messagebox=2, Logfile=4, Stderr=8KNotify will search for sound files given with a relative path first in the application's sound directory ( share/apps/Application Name/sounds ), then in the KDE global sound directory ( share/sounds ).
You can also use the "nopresentation" key, with any the presentations ORed. Those that are in that field will not appear in the kcontrol module. This was intended for software like KWin to not allow a window-opening that opens a window (e.g., allowing to disable KMessageBoxes from appearing) If the user edits the eventsrc file manually, it will appear. This only affects the KcmNotify.
You can also use the following events, which are system controlled and do not need to be placed in your eventsrc:
- cannotopenfile
- notification
- warning
- fatalerror
- catastrophe
- Author:
- Charles Samuels <charles@kde.org>
Enumeration Type Documentation
|
Describes the notification method.
Definition at line 132 of file knotifyclient.h. |
|
Describes the level of the error.
Definition at line 146 of file knotifyclient.h. |
|
default events you can use
Definition at line 156 of file knotifyclient.h. |
Function Documentation
|
This starts the KNotify Daemon, if it's not already started. This will be useful for games that use sound effects. Run this at the start of the program, and there won't be a pause when it is first triggered.
Definition at line 180 of file knotifyclient.cpp. References KApplication::startServiceByDesktopName(). |
|
This class or method is obsolete, it is provided for compatibility only.
Definition at line 66 of file knotifyclient.cpp. |
|
This class or method is obsolete, it is provided for compatibility only. Allows to easily emit standard events.
Definition at line 61 of file knotifyclient.cpp. References event(). |
|
This class or method is obsolete, it is provided for compatibility only. Will fire an event that's not registered.
Definition at line 71 of file knotifyclient.cpp. Referenced by KAudioPlayer::play(). |
|
This should be the most used method in here. Pass the origin-widget's winId() here so that a PassivePopup can be placed appropriately. Call it by KNotifyClient::event(widget->winId(), "EventName"); It will use KApplication::kApplication->dcopClient() to communicate to the server
Definition at line 105 of file knotifyclient.cpp. |
|
You should pass the origin-widget's winId() here so that a PassivePopup can be placed appropriately.
Definition at line 79 of file knotifyclient.cpp. References QString::fromLatin1(). |
|
Will fire an event that's not registered. You should pass the origin-widget's winId() here so that a PassivePopup can be placed appropriately.
Definition at line 111 of file knotifyclient.cpp. |
|
This is a simple substitution for QApplication::beep(). It simply calls
Definition at line 191 of file knotifyclient.cpp. References DCOPClient::attach(), QApplication::beep(), KNotifyClient::Instance::currentInstance(), event(), DCOPClient::isApplicationRegistered(), DCOPClient::isAttached(), and KNotifyClient::Instance::useSystemBell(). |
|
Gets the presentation associated with a certain event name Remeber that they may be ORed:.
Definition at line 118 of file knotifyclient.cpp. References QString::isEmpty(), KConfigBase::readNumEntry(), and KConfigBase::setGroup(). |
|
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.
Definition at line 131 of file knotifyclient.cpp. References QString::isEmpty(), KConfigBase::readPathEntry(), and KConfigBase::setGroup(). |
|
Gets the default presentation for the event of this program. Remember that the Presentation may be ORed. Try this:
Definition at line 149 of file knotifyclient.cpp. References QString::isEmpty(), KConfigBase::readNumEntry(), and KConfigBase::setGroup(). |
|
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)
Definition at line 162 of file knotifyclient.cpp. References QString::isEmpty(), KConfigBase::readPathEntry(), and KConfigBase::setGroup(). |
|
Shortcut to KNotifyClient::Instance::current() :).
Definition at line 219 of file knotifyclient.cpp. References KNotifyClient::Instance::current(). Referenced by KCrash::defaultCrashHandler(), KCmdLineArgs::enable_i18n(), KLibLoader::findLibrary(), and KNotifyClient::Instance::Instance(). |