|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.kde.koala.KNotifyClient
public class KNotifyClient
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_logfile=logfile.txt default_commandline=command default_presentation=1 ...default_presentation contains these ORed events: None=0, Sound=1, Messagebox=2, Logfile=4, Stderr=8, PassivePopup=16, Execute=32, Taskbar=64 KNotify 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:
Field Summary | |
---|---|
static int |
cannotOpenFile
default events you can use |
static int |
catastrophe
|
static int |
Catastrophe
|
static int |
Default
Describes the notification method. |
static int |
Error
|
static int |
Execute
|
static int |
fatalError
|
static int |
Logfile
|
static int |
Messagebox
|
static int |
None
|
static int |
notification
|
static int |
Notification
Describes the level of the error. |
static int |
PassivePopup
|
static int |
Sound
|
static int |
Stderr
|
static int |
Taskbar
|
static int |
warning
|
static int |
Warning
|
Constructor Summary | |
---|---|
KNotifyClient()
|
Method Summary | |
---|---|
static void |
beep()
|
static void |
beep(java.lang.String reason)
This is a simple substitution for QApplication.beep(). |
static int |
event(int winId,
int event)
|
static int |
event(int winId,
int event,
java.lang.String text)
You should pass the origin-widget's winId() here so that a PassivePopup can be placed appropriately. |
static int |
event(int winId,
java.lang.String message)
|
static int |
event(int winId,
java.lang.String message,
java.lang.String text)
This should be the most used method in here. |
static java.lang.String |
getDefaultFile(java.lang.String eventname,
int present)
Gets the default File for the event of this program. |
static int |
getDefaultPresentation(java.lang.String eventname)
Gets the default presentation for the event of this program. |
static java.lang.String |
getFile(java.lang.String 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. |
static int |
getPresentation(java.lang.String eventname)
Gets the presentation associated with a certain event name Remeber that they may be ORed: |
static KInstanceInterface |
instance()
Shortcut to KNotifyClient.Instance.current() :) |
static boolean |
startDaemon()
This starts the KNotify Daemon, if it's not already started. |
static int |
userEvent(int winId)
|
static int |
userEvent(int winId,
java.lang.String text)
|
static int |
userEvent(int winId,
java.lang.String text,
int present)
|
static int |
userEvent(int winId,
java.lang.String text,
int present,
int level)
|
static int |
userEvent(int winId,
java.lang.String text,
int present,
int level,
java.lang.String sound)
|
static int |
userEvent(int winId,
java.lang.String text,
int present,
int level,
java.lang.String sound,
java.lang.String file)
Will fire an event that's not registered. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int Default
public static final int None
public static final int Sound
public static final int Messagebox
public static final int Logfile
public static final int Stderr
public static final int PassivePopup
public static final int Execute
public static final int Taskbar
public static final int Notification
public static final int Warning
public static final int Error
public static final int Catastrophe
public static final int cannotOpenFile
public static final int notification
public static final int warning
public static final int fatalError
public static final int catastrophe
Constructor Detail |
---|
public KNotifyClient()
Method Detail |
---|
public static boolean startDaemon()
public static int event(int winId, java.lang.String message, java.lang.String text)
winId
- The winId() of the widget where the event originatesmessage
- The name of the eventtext
- The text to put in a dialog box. This won't be shown if
the user connected the event to sound, only. Can be null.
public static int event(int winId, java.lang.String message)
public static int event(int winId, int event, java.lang.String text)
winId
- The winId() of the widget where the event originatesevent
- The event you want to raisetext
- The text to put in a dialog box. This won't be shown if
the user connected the event to sound, only. Can be null.
public static int event(int winId, int event)
public static int userEvent(int winId, java.lang.String text, int present, int level, java.lang.String sound, java.lang.String file)
winId
- The winId() of the originating widgettext
- The error message text, if applicablepresent
- The presentation method(s) of the eventlevel
- The error message level, defaulting to "Default"sound
- The sound file to play if selected with present
file
- The log file to append the message to if selected with present
public static int userEvent(int winId, java.lang.String text, int present, int level, java.lang.String sound)
public static int userEvent(int winId, java.lang.String text, int present, int level)
public static int userEvent(int winId, java.lang.String text, int present)
public static int userEvent(int winId, java.lang.String text)
public static int userEvent(int winId)
public static void beep(java.lang.String reason)
KNotifyClient.event( KNotifyClient.notification, reason );
reason
- the reason, can be null.public static void beep()
public static int getPresentation(java.lang.String eventname)
if (present & KNotifyClient.Sound) { [Yes, sound is a default] }
eventname
- the event name to check
public static java.lang.String getFile(java.lang.String eventname, int present)
eventname
- the name of the eventpresent
- the presentation method
public static int getDefaultPresentation(java.lang.String eventname)
if (present & KNotifyClient.Sound) { [Yes, sound is a default] }
public static java.lang.String getDefaultFile(java.lang.String eventname, int present)
eventname
- the name of the eventpresent
- the presentation method
public static KInstanceInterface instance()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |