00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef KNOTIFY_H
00021 #define KNOTIFY_H
00022
00023 #include <tqobject.h>
00024 #include <knotifyclient.h>
00025 #include <dcopobject.h>
00026
00027 class KNotifyPrivate;
00028 class TDEProcess;
00029 class TDEConfig;
00030
00031 class KNotify : public TQObject, public DCOPObject
00032 {
00033 Q_OBJECT
00034 K_DCOP
00035
00036 public:
00037 KNotify( bool useArts );
00038 ~KNotify();
00039
00040 enum PlayingFinishedStatus {
00041 PlayedOK = 0,
00042 NoSoundFile,
00043 FileAlreadyPlaying,
00044 NoSoundSupport,
00045 PlayerBusy,
00046 Aborted,
00047 Unknown = 5000
00048 };
00049
00050 protected:
00051 k_dcop:
00052
00053 void notify(const TQString &event, const TQString &fromApp, const TQString &text, TQString sound, TQString file, int present, int level);
00054
00055
00056 void notify(const TQString &event, const TQString &fromApp, const TQString &text, TQString sound, TQString file, int present, int level, int winId);
00057
00058 void notify(const TQString &event, const TQString &fromApp, const TQString &text, TQString sound, TQString file, int present, int level, int winId, int eventId);
00059
00060
00061 void reconfigure();
00062 void setVolume( int volume );
00063 void sessionReady();
00064
00065 private:
00066 bool notifyBySound(const TQString &sound, const TQString &appname, int eventId);
00067 bool notifyByMessagebox(const TQString &text, int level, WId winId);
00068 bool notifyByLogfile(const TQString &text, const TQString &file);
00069 bool notifyByStderr(const TQString &text);
00070 bool notifyByPassivePopup(const TQString &text, const TQString &appName, TDEConfig* eventsFile, WId winId );
00071 bool notifyByExecute(const TQString &command, const TQString& event, const TQString& fromApp, const TQString& text, int winId, int eventId );
00072 bool notifyByTaskbar( WId winId );
00073
00074 bool isPlaying( const TQString& soundFile ) const;
00075
00076 void soundFinished( int eventId, PlayingFinishedStatus reason );
00077 void abortFirstPlayObject();
00078
00079 WId checkWinId( const TQString& appName, WId senderWinId );
00080
00084 bool isGlobal(const TQString &eventname);
00085
00086 private slots:
00087 void playTimeout();
00088 void slotPlayerProcessExited( TDEProcess *proc );
00089 void restartedArtsd();
00090
00091 private:
00092 KNotifyPrivate* d;
00093 void loadConfig();
00094 };
00095
00096
00097 #endif
00098