• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

Classes | Enumerations | Functions
KNotifyClient Namespace Reference

Classes

class  Instance
 

Enumerations

enum  {
  Default = -1 , None = 0 , Sound = 1 , Messagebox = 2 ,
  Logfile = 4 , Stderr = 8 , PassivePopup = 16 , Execute = 32 ,
  Taskbar = 64
}
 
enum  { Notification =1 , Warning =2 , Error =4 , Catastrophe =8 }
 
enum  StandardEvent {
  cannotOpenFile , notification , warning , fatalError ,
  catastrophe
}
 

Functions

bool startDaemon ()
 
int event (const TQString &message, const TQString &text=TQString::null) TDE_DEPRECATED
 
int event (StandardEvent event, const TQString &text=TQString::null) TDE_DEPRECATED
 
int userEvent (const TQString &text=TQString::null, int present=Default, int level=Default, const TQString &sound=TQString::null, const TQString &file=TQString::null) TDE_DEPRECATED
 
int event (int winId, const TQString &message, const TQString &text=TQString::null)
 
int event (int winId, StandardEvent event, const TQString &text=TQString::null)
 
int userEvent (int winId, const TQString &text=TQString::null, int present=Default, int level=Default, const TQString &sound=TQString::null, const TQString &file=TQString::null)
 
void beep (const TQString &reason=TQString::null)
 
int getPresentation (const TQString &eventname)
 
TQString getFile (const TQString &eventname, int present)
 
int getDefaultPresentation (const TQString &eventname)
 
TQString getDefaultFile (const TQString &eventname, int present)
 
TDEInstance * instance ()
 

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 $TDEDIR/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:

  • cannotopenfile
  • notification
  • warning
  • fatalerror
  • catastrophe

The events can be configured in an application using KNotifyDialog, which is part of TDEIO.

Author
Charles Samuels charl.nosp@m.es@k.nosp@m.de.or.nosp@m.g

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Describes the notification method.

Enumerator
PassivePopup 
Since
3.1
Execute 
Since
3.1
Taskbar 
Since
3.2

Definition at line 138 of file knotifyclient.h.

◆ anonymous enum

anonymous enum

Describes the level of the error.

Definition at line 153 of file knotifyclient.h.

◆ StandardEvent

enum KNotifyClient::StandardEvent

default events you can use

Definition at line 163 of file knotifyclient.h.

Function Documentation

◆ beep()

void KNotifyClient::beep ( const TQString &  reason = TQString::null)

This is a simple substitution for TQApplication::beep().

It simply calls

KNotifyClient::event( KNotifyClient::notification, reason );
KNotifyClient::event
int event(const TQString &message, const TQString &text=TQString::null) TDE_DEPRECATED
Definition: knotifyclient.cpp:125
Parameters
reasonthe reason, can be TQString::null.

Definition at line 252 of file knotifyclient.cpp.

◆ event() [1/4]

int KNotifyClient::event ( const TQString &  message,
const TQString &  text = TQString::null 
)
Deprecated:
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. Can be TQString::null.
Returns
a value > 0, unique for this event if successful, 0 otherwise

Definition at line 125 of file knotifyclient.cpp.

◆ event() [2/4]

int KNotifyClient::event ( int  winId,
const TQString &  message,
const TQString &  text = TQString::null 
)

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 TDEApplication::tdeApplication->dcopClient() to communicate to the server

Parameters
winIdThe winId() of the widget where the event originates
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. Can be TQString::null.
Returns
a value > 0, unique for this event if successful, 0 otherwise
Since
3.1.1

Definition at line 163 of file knotifyclient.cpp.

◆ event() [3/4]

int KNotifyClient::event ( int  winId,
StandardEvent  event,
const TQString &  text = TQString::null 
)

You should pass the origin-widget's winId() here so that a PassivePopup can be placed appropriately.

Parameters
winIdThe winId() of the widget where the event originates
eventThe event you want to raise
textThe text to put in a dialog box. This won't be shown if the user connected the event to sound, only. Can be TQString::null.
Returns
a value > 0, unique for this event if successful, 0 otherwise
Since
3.1.1

Definition at line 137 of file knotifyclient.cpp.

◆ event() [4/4]

int KNotifyClient::event ( StandardEvent  event,
const TQString &  text = TQString::null 
)
Deprecated:
Allows to easily emit standard events.
Parameters
eventThe event you want to raise.
textThe text explaining the event you raise. Can be TQString::null.
Returns
a value > 0, unique for this event if successful, 0 otherwise

Definition at line 120 of file knotifyclient.cpp.

◆ getDefaultFile()

TQString KNotifyClient::getDefaultFile ( const TQString &  eventname,
int  present 
)

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)

Parameters
eventnamethe name of the event
presentthe presentation method
Returns
the default file. Can be TQString::null if not found.

Definition at line 220 of file knotifyclient.cpp.

◆ getDefaultPresentation()

int KNotifyClient::getDefaultPresentation ( const TQString &  eventname)

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] }
Returns
the presentation methods

Definition at line 207 of file knotifyclient.cpp.

◆ getFile()

TQString KNotifyClient::getFile ( const TQString &  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.

Parameters
eventnamethe name of the event
presentthe presentation method
Returns
the associated file. Can be TQString::null if not found.

Definition at line 189 of file knotifyclient.cpp.

◆ getPresentation()

int KNotifyClient::getPresentation ( const TQString &  eventname)

Gets the presentation associated with a certain event name Remeber that they may be ORed:

if (present & KNotifyClient::Sound) { [Yes, sound is a default] }
Parameters
eventnamethe event name to check
Returns
the presentation methods

Definition at line 176 of file knotifyclient.cpp.

◆ instance()

TDEInstance * KNotifyClient::instance ( )

Shortcut to KNotifyClient::Instance::current() :)

Returns
the current TDEInstance.

Definition at line 280 of file knotifyclient.cpp.

◆ startDaemon()

bool KNotifyClient::startDaemon ( )

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.

Returns
true if daemon is running (always true at the moment)

Definition at line 238 of file knotifyclient.cpp.

◆ userEvent() [1/2]

int KNotifyClient::userEvent ( const TQString &  text = TQString::null,
int  present = Default,
int  level = Default,
const TQString &  sound = TQString::null,
const TQString &  file = TQString::null 
)
Deprecated:
Will fire an event that's not registered.
Parameters
textThe error message text, if applicable
presentThe presentation method(s) of the event
levelThe error message level, defaulting to "Default"
soundThe sound file to play if selected with present
fileThe log file to append the message to if selected with present
Returns
a value > 0, unique for this event if successful, 0 otherwise

Definition at line 130 of file knotifyclient.cpp.

◆ userEvent() [2/2]

int KNotifyClient::userEvent ( int  winId,
const TQString &  text = TQString::null,
int  present = Default,
int  level = Default,
const TQString &  sound = TQString::null,
const TQString &  file = TQString::null 
)

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.

Parameters
winIdThe winId() of the originating widget
textThe error message text, if applicable
presentThe presentation method(s) of the event
levelThe error message level, defaulting to "Default"
soundThe sound file to play if selected with present
fileThe log file to append the message to if selected with present
Returns
a value > 0, unique for this event if successful, 0 otherwise
Since
3.1.1

Definition at line 169 of file knotifyclient.cpp.

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.9.4
This website is maintained by Timothy Pearson.