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 <qobject.h>
00024 #include <knotifyclient.h>
00025 #include <dcopobject.h>
00026 #include <soundserver.h>
00027
00028 class KNotifyPrivate;
00029 class KProcess;
00030
00031 class KNotify : public QObject, public DCOPObject
00032 {
00033 Q_OBJECT
00034 K_DCOP
00035
00036 public:
00037 KNotify( bool useArts );
00038 ~KNotify();
00039
00040 enum PlayingFinishedStatus
00041 {
00042 PlayedOK = 0,
00043 NoSoundFile,
00044 FileAlreadyPlaying,
00045 NoSoundSupport,
00046 PlayerBusy,
00047 Aborted,
00048 Unknown = 5000
00049 };
00050
00051 protected:
00052 k_dcop:
00053
00054 void notify(const QString &event, const QString &fromApp,
00055 const QString &text, QString sound, QString file,
00056 int present, int level);
00057
00058
00059 void notify(const QString &event, const QString &fromApp,
00060 const QString &text, QString sound, QString file,
00061 int present, int level, int winId);
00062
00063 void notify(const QString &event, const QString &fromApp,
00064 const QString &text, QString sound, QString file,
00065 int present, int level, int winId, int eventId);
00066
00067
00068 void reconfigure();
00069 void setVolume( int volume );
00070 void sessionReady();
00071
00072 private:
00073 bool notifyBySound(const QString &sound, const QString &appname, int eventId);
00074 bool notifyByMessagebox(const QString &text, int level, WId winId);
00075 bool notifyByLogfile(const QString &text, const QString &file);
00076 bool notifyByStderr(const QString &text);
00077 bool notifyByPassivePopup(const QString &text, const QString &appName,
00078 WId winId );
00079 bool notifyByExecute(const QString &command,
00080 const QString& event,
00081 const QString& fromApp,
00082 const QString& text,
00083 int winId,
00084 int eventId );
00085 bool notifyByTaskbar( WId winId );
00086
00087 bool isPlaying( const QString& soundFile ) const;
00088
00089 void soundFinished( int eventId, PlayingFinishedStatus reason );
00090 void abortFirstPlayObject();
00091
00092 WId checkWinId( const QString& appName, WId senderWinId );
00093
00097 bool isGlobal(const QString &eventname);
00098
00099 private slots:
00100 void playTimeout();
00101 void slotPlayerProcessExited( KProcess *proc );
00102 void restartedArtsd();
00103
00104 private:
00105 KNotifyPrivate* d;
00106 void loadConfig();
00107 };
00108
00109
00110 #endif
00111