knotify.h
00001 /* 00002 Copyright (c) 1997 Christian Esken (esken@kde.org) 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2, or (at your option) 00007 any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 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, // success, all following mean failure 00042 NoSoundFile, 00043 FileAlreadyPlaying, 00044 NoSoundSupport, 00045 PlayerBusy, 00046 Aborted, 00047 Unknown = 5000 00048 }; 00049 00050 protected: 00051 k_dcop: 00052 // deprecated 00053 void notify(const TQString &event, const TQString &fromApp, const TQString &text, TQString sound, TQString file, int present, int level); 00054 00055 // deprecated 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(); // from ksmserver 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