Reformat arts files

This commit does not change compiled functionality
pull/16/head
Timothy Pearson 12 years ago
parent c5463fddb1
commit c6e643528e

@ -72,7 +72,7 @@
class KNotifyPrivate class KNotifyPrivate
{ {
public: public:
TDEConfig* globalEvents; TDEConfig* globalEvents;
TDEConfig* globalConfig; TDEConfig* globalConfig;
TQMap<TQString, TDEConfig*> events; TQMap<TQString, TDEConfig*> events;
@ -98,13 +98,11 @@ public:
// Yes, it's ugly to put this here, but this facilitates the cautious startup // Yes, it's ugly to put this here, but this facilitates the cautious startup
// procedure. // procedure.
#ifndef WITHOUT_ARTS #ifndef WITHOUT_ARTS
KArtsServer *soundServer = 0; KArtsServer *soundServer = 0;
#endif #endif
extern "C"{ extern "C"{
KDE_EXPORT int kdemain(int argc, char **argv) {
KDE_EXPORT int kdemain(int argc, char **argv)
{
TDEAboutData aboutdata("knotify", I18N_NOOP("KNotify"), TDEAboutData aboutdata("knotify", I18N_NOOP("KNotify"),
"3.0", I18N_NOOP("TDE Notification Server"), "3.0", I18N_NOOP("TDE Notification Server"),
TDEAboutData::License_GPL, "(C) 1997-2003, KDE Developers"); TDEAboutData::License_GPL, "(C) 1997-2003, KDE Developers");
@ -116,7 +114,6 @@ KDE_EXPORT int kdemain(int argc, char **argv)
TDECmdLineArgs::init( argc, argv, &aboutdata ); TDECmdLineArgs::init( argc, argv, &aboutdata );
KUniqueApplication::addCmdLineOptions(); KUniqueApplication::addCmdLineOptions();
// initialize application // initialize application
if ( !KUniqueApplication::start() ) { if ( !KUniqueApplication::start() ) {
kdDebug() << "Running knotify found" << endl; kdDebug() << "Running knotify found" << endl;
@ -140,12 +137,12 @@ KDE_EXPORT int kdemain(int argc, char **argv)
TDEConfig artsKCMConfig( "kcmartsrc" ); TDEConfig artsKCMConfig( "kcmartsrc" );
artsKCMConfig.setGroup( "Arts" ); artsKCMConfig.setGroup( "Arts" );
bool useArts = artsKCMConfig.readBoolEntry( "StartServer", true ); bool useArts = artsKCMConfig.readBoolEntry( "StartServer", true );
if (useArts) if (useArts) {
useArts = config.readBoolEntry( "Use Arts", useArts ); useArts = config.readBoolEntry( "Use Arts", useArts );
}
bool ok = config.readBoolEntry( "Arts Init", true ); bool ok = config.readBoolEntry( "Arts Init", true );
if ( useArts && !ok ) if ( useArts && !ok ) {
{
if ( KMessageBox::questionYesNo( if ( KMessageBox::questionYesNo(
0L, 0L,
i18n("During the previous startup, KNotify crashed while creating " i18n("During the previous startup, KNotify crashed while creating "
@ -160,8 +157,7 @@ KDE_EXPORT int kdemain(int argc, char **argv)
"KNotifyStartProgress", "KNotifyStartProgress",
0 /* don't call KNotify :) */ 0 /* don't call KNotify :) */
) )
== KMessageBox::No ) == KMessageBox::No ) {
{
useArts = false; useArts = false;
} }
} }
@ -172,8 +168,7 @@ KDE_EXPORT int kdemain(int argc, char **argv)
config.sync(); config.sync();
KArtsDispatcher *dispatcher = 0; KArtsDispatcher *dispatcher = 0;
if ( useArts ) if ( useArts ) {
{
dispatcher = new KArtsDispatcher; dispatcher = new KArtsDispatcher;
soundServer = new KArtsServer; soundServer = new KArtsServer;
} }
@ -183,8 +178,7 @@ KDE_EXPORT int kdemain(int argc, char **argv)
config.sync(); config.sync();
ok = config.readBoolEntry( "KNotify Init", true ); ok = config.readBoolEntry( "KNotify Init", true );
if ( useArts && !ok ) if ( useArts && !ok ) {
{
if ( KMessageBox::questionYesNo( if ( KMessageBox::questionYesNo(
0L, 0L,
i18n("During the previous startup, KNotify crashed while instantiating " i18n("During the previous startup, KNotify crashed while instantiating "
@ -199,8 +193,7 @@ KDE_EXPORT int kdemain(int argc, char **argv)
"KNotifyStartProgress", "KNotifyStartProgress",
0 /* don't call KNotify :) */ 0 /* don't call KNotify :) */
) )
== KMessageBox::No ) == KMessageBox::No ) {
{
useArts = false; useArts = false;
delete soundServer; delete soundServer;
soundServer = 0L; soundServer = 0L;
@ -238,8 +231,8 @@ KDE_EXPORT int kdemain(int argc, char **argv)
delete dispatcher; delete dispatcher;
#endif #endif
return ret; return ret;
} }
}// end extern "C" } // end extern "C"
KNotify::KNotify( bool useArts ) KNotify::KNotify( bool useArts )
: TQObject(), DCOPObject("Notify") : TQObject(), DCOPObject("Notify")
@ -253,15 +246,12 @@ KNotify::KNotify( bool useArts )
#ifndef WITHOUT_ARTS #ifndef WITHOUT_ARTS
d->playObjects.setAutoDelete(true); d->playObjects.setAutoDelete(true);
d->audioManager = 0; d->audioManager = 0;
if( useArts ) if( useArts ) {
{
connect( soundServer, TQT_SIGNAL( restartedServer() ), this, TQT_SLOT( restartedArtsd() ) ); connect( soundServer, TQT_SIGNAL( restartedServer() ), this, TQT_SLOT( restartedArtsd() ) );
restartedArtsd(); //started allready need to initialize d->audioManager restartedArtsd(); //started allready need to initialize d->audioManager
} }
#endif #endif
d->volume = 100; d->volume = 100;
d->playTimer = 0; d->playTimer = 0;
loadConfig(); loadConfig();
@ -313,8 +303,9 @@ void KNotify::reconfigure()
// clear loaded config files // clear loaded config files
d->globalConfig->reparseConfiguration(); d->globalConfig->reparseConfiguration();
for ( TQMapIterator<TQString,TDEConfig*> it = d->configs.begin(); it != d->configs.end(); ++it ) for ( TQMapIterator<TQString,TDEConfig*> it = d->configs.begin(); it != d->configs.end(); ++it ) {
delete it.data(); delete it.data();
}
d->configs.clear(); d->configs.clear();
} }
@ -353,19 +344,20 @@ void KNotify::notify(const TQString &event, const TQString &fromApp,
// get config file // get config file
if ( d->events.contains( fromApp ) ) { if ( d->events.contains( fromApp ) ) {
eventsFile = d->events[fromApp]; eventsFile = d->events[fromApp];
} else { }
else {
eventsFile=new TDEConfig(locate("data", fromApp+"/eventsrc"),true,false); eventsFile=new TDEConfig(locate("data", fromApp+"/eventsrc"),true,false);
d->events.insert( fromApp, eventsFile ); d->events.insert( fromApp, eventsFile );
} }
if ( d->configs.contains( fromApp) ) { if ( d->configs.contains( fromApp) ) {
configFile = d->configs[fromApp]; configFile = d->configs[fromApp];
} else { }
else {
configFile=new TDEConfig(fromApp+".eventsrc",true,false); configFile=new TDEConfig(fromApp+".eventsrc",true,false);
d->configs.insert( fromApp, configFile ); d->configs.insert( fromApp, configFile );
} }
if ( !eventsFile->hasGroup( event ) && isGlobal(event) ) if ( !eventsFile->hasGroup( event ) && isGlobal(event) ) {
{
eventsFile = d->globalEvents; eventsFile = d->globalEvents;
configFile = d->globalConfig; configFile = d->globalConfig;
} }
@ -374,68 +366,81 @@ void KNotify::notify(const TQString &event, const TQString &fromApp,
configFile->setGroup( event ); configFile->setGroup( event );
// get event presentation // get event presentation
if ( present==-1 ) if ( present==-1 ) {
present = configFile->readNumEntry( "presentation", -1 ); present = configFile->readNumEntry( "presentation", -1 );
if ( present==-1 ) }
if ( present==-1 ) {
present = eventsFile->readNumEntry( "default_presentation", 0 ); present = eventsFile->readNumEntry( "default_presentation", 0 );
}
// get sound file name // get sound file name
if( present & KNotifyClient::Sound ) { if( present & KNotifyClient::Sound ) {
TQString theSound = configFile->readPathEntry( "soundfile" ); TQString theSound = configFile->readPathEntry( "soundfile" );
if ( theSound.isEmpty() ) if ( theSound.isEmpty() ) {
theSound = eventsFile->readPathEntry( "default_sound" ); theSound = eventsFile->readPathEntry( "default_sound" );
if ( !theSound.isEmpty() ) }
if ( !theSound.isEmpty() ) {
sound = theSound; sound = theSound;
} }
}
// get log file name // get log file name
if( present & KNotifyClient::Logfile ) { if( present & KNotifyClient::Logfile ) {
TQString theFile = configFile->readPathEntry( "logfile" ); TQString theFile = configFile->readPathEntry( "logfile" );
if ( theFile.isEmpty() ) if ( theFile.isEmpty() ) {
theFile = eventsFile->readPathEntry( "default_logfile" ); theFile = eventsFile->readPathEntry( "default_logfile" );
if ( !theFile.isEmpty() ) }
if ( !theFile.isEmpty() ) {
file = theFile; file = theFile;
} }
}
// get default event level // get default event level
if( present & KNotifyClient::Messagebox ) if( present & KNotifyClient::Messagebox ) {
level = eventsFile->readNumEntry( "level", 0 ); level = eventsFile->readNumEntry( "level", 0 );
}
// get command line // get command line
if (present & KNotifyClient::Execute ) { if (present & KNotifyClient::Execute ) {
commandline = configFile->readPathEntry( "commandline" ); commandline = configFile->readPathEntry( "commandline" );
if ( commandline.isEmpty() ) if ( commandline.isEmpty() ) {
commandline = eventsFile->readPathEntry( "default_commandline" ); commandline = eventsFile->readPathEntry( "default_commandline" );
} }
} }
}
// emit event // emit event
if ( present & KNotifyClient::Sound ) // && TQFile(sound).isReadable() if ( present & KNotifyClient::Sound ) { // && TQFile(sound).isReadable()
notifyBySound( sound, fromApp, eventId ); notifyBySound( sound, fromApp, eventId );
}
if ( present & KNotifyClient::Execute ) if ( present & KNotifyClient::Execute ) {
notifyByExecute( commandline, event, fromApp, text, winId, eventId ); notifyByExecute( commandline, event, fromApp, text, winId, eventId );
}
if ( present & KNotifyClient::Logfile ) // && TQFile(file).isWritable() if ( present & KNotifyClient::Logfile ) { // && TQFile(file).isWritable()
notifyByLogfile( text, file ); notifyByLogfile( text, file );
}
if ( present & KNotifyClient::Stderr ) if ( present & KNotifyClient::Stderr ) {
notifyByStderr( text ); notifyByStderr( text );
}
if ( present & KNotifyClient::Taskbar ) if ( present & KNotifyClient::Taskbar ) {
notifyByTaskbar( checkWinId( fromApp, winId )); notifyByTaskbar( checkWinId( fromApp, winId ));
}
if ( present & KNotifyClient::PassivePopup ) if ( present & KNotifyClient::PassivePopup ) {
notifyByPassivePopup( text, fromApp, eventsFile, checkWinId( fromApp, winId )); notifyByPassivePopup( text, fromApp, eventsFile, checkWinId( fromApp, winId ));
else if ( present & KNotifyClient::Messagebox ) }
else if ( present & KNotifyClient::Messagebox ) {
notifyByMessagebox( text, level, checkWinId( fromApp, winId )); notifyByMessagebox( text, level, checkWinId( fromApp, winId ));
}
TQByteArray qbd; TQByteArray qbd;
TQDataStream ds(qbd, IO_WriteOnly); TQDataStream ds(qbd, IO_WriteOnly);
ds << event << fromApp << text << sound << file << present << level ds << event << fromApp << text << sound << file << present << level << winId << eventId;
<< winId << eventId;
emitDCOPSignal("notifySignal(TQString,TQString,TQString,TQString,TQString,int,int,int,int)", qbd); emitDCOPSignal("notifySignal(TQString,TQString,TQString,TQString,TQString,int,int,int,int)", qbd);
} }
@ -449,15 +454,14 @@ bool KNotify::notifyBySound( const TQString &sound, const TQString &appname, int
bool external = d->useExternal && !d->externalPlayer.isEmpty(); bool external = d->useExternal && !d->externalPlayer.isEmpty();
// get file name // get file name
TQString soundFile(sound); TQString soundFile(sound);
if ( TQFileInfo(sound).isRelative() ) if ( TQFileInfo(sound).isRelative() ) {
{
TQString search = TQString("%1/sounds/%2").arg(appname).arg(sound); TQString search = TQString("%1/sounds/%2").arg(appname).arg(sound);
soundFile = TDEGlobal::instance()->dirs()->findResource("data", search); soundFile = TDEGlobal::instance()->dirs()->findResource("data", search);
if ( soundFile.isEmpty() ) if ( soundFile.isEmpty() ) {
soundFile = locate( "sound", sound ); soundFile = locate( "sound", sound );
} }
if ( soundFile.isEmpty() || isPlaying( soundFile ) ) }
{ if ( soundFile.isEmpty() || isPlaying( soundFile ) ) {
soundFinished( eventId, soundFile.isEmpty() ? NoSoundFile : FileAlreadyPlaying ); soundFinished( eventId, soundFile.isEmpty() ? NoSoundFile : FileAlreadyPlaying );
return false; return false;
} }
@ -476,32 +480,31 @@ bool KNotify::notifyBySound( const TQString &sound, const TQString &appname, int
#ifndef WITHOUT_ARTS #ifndef WITHOUT_ARTS
// play sound finally // play sound finally
while( d->playObjects.count()>5 ) while( d->playObjects.count()>5 ) {
abortFirstPlayObject(); abortFirstPlayObject();
}
KDE::PlayObjectFactory factory(soundServer->server()); KDE::PlayObjectFactory factory(soundServer->server());
if( d->audioManager ) if( d->audioManager ) {
factory.setAudioManagerPlay( d->audioManager ); factory.setAudioManagerPlay( d->audioManager );
}
KURL soundURL; KURL soundURL;
soundURL.setPath(soundFile); soundURL.setPath(soundFile);
KDE::PlayObject *playObject = factory.createPlayObject(soundURL, false); KDE::PlayObject *playObject = factory.createPlayObject(soundURL, false);
if (playObject->isNull()) if (playObject->isNull()) {
{
soundFinished( eventId, NoSoundSupport ); soundFinished( eventId, NoSoundSupport );
delete playObject; delete playObject;
return false; return false;
} }
if ( d->volume != 100 ) if ( d->volume != 100 ) {
{
// It works to access the playObject immediately because we don't allow // It works to access the playObject immediately because we don't allow
// non-file URLs for sounds. // non-file URLs for sounds.
Arts::StereoVolumeControl volumeControl = Arts::DynamicCast(soundServer->server().createObject("Arts::StereoVolumeControl")); Arts::StereoVolumeControl volumeControl = Arts::DynamicCast(soundServer->server().createObject("Arts::StereoVolumeControl"));
Arts::PlayObject player = playObject->object(); Arts::PlayObject player = playObject->object();
Arts::Synth_AMAN_PLAY ap = d->audioManager->amanPlay(); Arts::Synth_AMAN_PLAY ap = d->audioManager->amanPlay();
if( ! volumeControl.isNull() && ! player.isNull() && ! ap.isNull() ) if( ! volumeControl.isNull() && ! player.isNull() && ! ap.isNull() ) {
{
volumeControl.scaleFactor( d->volume/100.0 ); volumeControl.scaleFactor( d->volume/100.0 );
ap.stop(); ap.stop();
@ -525,27 +528,24 @@ bool KNotify::notifyBySound( const TQString &sound, const TQString &appname, int
d->playObjects.append( playObject ); d->playObjects.append( playObject );
d->playObjectEventMap.insert( playObject, eventId ); d->playObjectEventMap.insert( playObject, eventId );
if ( !d->playTimer ) if ( !d->playTimer ) {
{
d->playTimer = new TQTimer( this ); d->playTimer = new TQTimer( this );
connect( d->playTimer, TQT_SIGNAL( timeout() ), TQT_SLOT( playTimeout() ) ); connect( d->playTimer, TQT_SIGNAL( timeout() ), TQT_SLOT( playTimeout() ) );
} }
if ( !d->playTimer->isActive() ) if ( !d->playTimer->isActive() ) {
d->playTimer->start( 1000 ); d->playTimer->start( 1000 );
}
#endif #endif
return true; return true;
}
} else if(!d->externalPlayer.isEmpty()) { else if(!d->externalPlayer.isEmpty()) {
// use an external player to play the sound // use an external player to play the sound
TDEProcess *proc = d->externalPlayerProc; TDEProcess *proc = d->externalPlayerProc;
if (!proc) if (!proc) {
{
proc = d->externalPlayerProc = new TDEProcess; proc = d->externalPlayerProc = new TDEProcess;
connect( proc, TQT_SIGNAL( processExited( TDEProcess * )), connect( proc, TQT_SIGNAL( processExited( TDEProcess * )), TQT_SLOT( slotPlayerProcessExited( TDEProcess * )));
TQT_SLOT( slotPlayerProcessExited( TDEProcess * )));
} }
if (proc->isRunning()) if (proc->isRunning()) {
{
soundFinished( eventId, PlayerBusy ); soundFinished( eventId, PlayerBusy );
return false; // Skip return false; // Skip
} }
@ -563,8 +563,9 @@ bool KNotify::notifyBySound( const TQString &sound, const TQString &appname, int
bool KNotify::notifyByMessagebox(const TQString &text, int level, WId winId) bool KNotify::notifyByMessagebox(const TQString &text, int level, WId winId)
{ {
// ignore empty messages // ignore empty messages
if ( text.isEmpty() ) if ( text.isEmpty() ) {
return false; return false;
}
// display message box for specified event level // display message box for specified event level
switch( level ) { switch( level ) {
@ -598,8 +599,10 @@ bool KNotify::notifyByPassivePopup( const TQString &text,
TQPixmap icon = iconLoader.loadIcon( iconName, TDEIcon::Small ); TQPixmap icon = iconLoader.loadIcon( iconName, TDEIcon::Small );
TQString title = config.readEntry( "Comment", appName ); TQString title = config.readEntry( "Comment", appName );
KPassivePopup::message(title, text, icon, senderWinId); KPassivePopup::message(title, text, icon, senderWinId);
} else }
else {
kdError() << "No events for app " << appName << "defined!" <<endl; kdError() << "No events for app " << appName << "defined!" <<endl;
}
return true; return true;
} }
@ -616,8 +619,9 @@ bool KNotify::notifyByExecute(const TQString &command, const TQString& event,
subst.insert( 'w', TQString::number( winId )); subst.insert( 'w', TQString::number( winId ));
subst.insert( 'i', TQString::number( eventId )); subst.insert( 'i', TQString::number( eventId ));
TQString execLine = KMacroExpander::expandMacrosShellQuote( command, subst ); TQString execLine = KMacroExpander::expandMacrosShellQuote( command, subst );
if ( execLine.isEmpty() ) if ( execLine.isEmpty() ) {
execLine = command; // fallback execLine = command; // fallback
}
TDEProcess p; TDEProcess p;
p.setUseShell(true); p.setUseShell(true);
@ -632,13 +636,15 @@ bool KNotify::notifyByExecute(const TQString &command, const TQString& event,
bool KNotify::notifyByLogfile(const TQString &text, const TQString &file) bool KNotify::notifyByLogfile(const TQString &text, const TQString &file)
{ {
// ignore empty messages // ignore empty messages
if ( text.isEmpty() ) if ( text.isEmpty() ) {
return true; return true;
}
// open file in append mode // open file in append mode
TQFile logFile(file); TQFile logFile(file);
if ( !logFile.open(IO_WriteOnly | IO_Append) ) if ( !logFile.open(IO_WriteOnly | IO_Append) ) {
return false; return false;
}
// append msg // append msg
TQTextStream strm( &logFile ); TQTextStream strm( &logFile );
@ -653,8 +659,9 @@ bool KNotify::notifyByLogfile(const TQString &text, const TQString &file)
bool KNotify::notifyByStderr(const TQString &text) bool KNotify::notifyByStderr(const TQString &text)
{ {
// ignore empty messages // ignore empty messages
if ( text.isEmpty() ) if ( text.isEmpty() ) {
return true; return true;
}
// open stderr for output // open stderr for output
TQTextStream strm( stderr, IO_WriteOnly ); TQTextStream strm( stderr, IO_WriteOnly );
@ -668,8 +675,9 @@ bool KNotify::notifyByStderr(const TQString &text)
bool KNotify::notifyByTaskbar( WId win ) bool KNotify::notifyByTaskbar( WId win )
{ {
if( win == 0 ) if( win == 0 ) {
return false; return false;
}
KWin::demandAttention( win ); KWin::demandAttention( win );
return true; return true;
} }
@ -689,50 +697,46 @@ void KNotify::setVolume( int volume )
void KNotify::playTimeout() void KNotify::playTimeout()
{ {
#ifndef WITHOUT_ARTS #ifndef WITHOUT_ARTS
for ( TQPtrListIterator< KDE::PlayObject > it(d->playObjects); *it;) for ( TQPtrListIterator< KDE::PlayObject > it(d->playObjects); *it;) {
{
TQPtrListIterator< KDE::PlayObject > current = it; TQPtrListIterator< KDE::PlayObject > current = it;
++it; ++it;
if ( (*current)->state() != Arts::posPlaying ) if ( (*current)->state() != Arts::posPlaying ) {
{
TQMap<KDE::PlayObject*,int>::Iterator eit = d->playObjectEventMap.find( *current ); TQMap<KDE::PlayObject*,int>::Iterator eit = d->playObjectEventMap.find( *current );
if ( eit != d->playObjectEventMap.end() ) if ( eit != d->playObjectEventMap.end() ) {
{
soundFinished( *eit, PlayedOK ); soundFinished( *eit, PlayedOK );
d->playObjectEventMap.remove( eit ); d->playObjectEventMap.remove( eit );
} }
d->playObjects.remove( current ); d->playObjects.remove( current );
} }
} }
if ( !d->playObjects.count() ) if ( !d->playObjects.count() ) {
d->playTimer->stop(); d->playTimer->stop();
}
#endif #endif
} }
bool KNotify::isPlaying( const TQString& soundFile ) const bool KNotify::isPlaying( const TQString& soundFile ) const
{ {
#ifndef WITHOUT_ARTS #ifndef WITHOUT_ARTS
for ( TQPtrListIterator< KDE::PlayObject > it(d->playObjects); *it; ++it) for ( TQPtrListIterator< KDE::PlayObject > it(d->playObjects); *it; ++it) {
{ if ( (*it)->mediaName() == soundFile ) {
if ( (*it)->mediaName() == soundFile )
return true; return true;
} }
}
#endif #endif
return false; return false;
} }
void KNotify::slotPlayerProcessExited( TDEProcess *proc ) void KNotify::slotPlayerProcessExited( TDEProcess *proc )
{ {
soundFinished( d->externalPlayerEventId, soundFinished( d->externalPlayerEventId, (proc->normalExit() && proc->exitStatus() == 0) ? PlayedOK : Unknown );
(proc->normalExit() && proc->exitStatus() == 0) ? PlayedOK : Unknown );
} }
void KNotify::abortFirstPlayObject() void KNotify::abortFirstPlayObject()
{ {
#ifndef WITHOUT_ARTS #ifndef WITHOUT_ARTS
TQMap<KDE::PlayObject*,int>::Iterator it = d->playObjectEventMap.find( d->playObjects.getFirst() ); TQMap<KDE::PlayObject*,int>::Iterator it = d->playObjectEventMap.find( d->playObjects.getFirst() );
if ( it != d->playObjectEventMap.end() ) if ( it != d->playObjectEventMap.end() ) {
{
soundFinished( it.data(), Aborted ); soundFinished( it.data(), Aborted );
d->playObjectEventMap.remove( it ); d->playObjectEventMap.remove( it );
} }
@ -751,8 +755,7 @@ void KNotify::soundFinished( int eventId, PlayingFinishedStatus reason )
WId KNotify::checkWinId( const TQString &appName, WId senderWinId ) WId KNotify::checkWinId( const TQString &appName, WId senderWinId )
{ {
if ( senderWinId == 0 ) if ( senderWinId == 0 ) {
{
TQCString senderId = kapp->dcopClient()->senderId(); TQCString senderId = kapp->dcopClient()->senderId();
TQCString compare = (appName + "-mainwindow").latin1(); TQCString compare = (appName + "-mainwindow").latin1();
int len = compare.length(); int len = compare.length();
@ -792,8 +795,9 @@ void KNotify::restartedArtsd()
void KNotify::sessionReady() void KNotify::sessionReady()
{ {
if( d->inStartup && !d->startupEvents.isEmpty()) if( d->inStartup && !d->startupEvents.isEmpty()) {
kdDebug() << "There were knotify events while startup:" << d->startupEvents << endl; kdDebug() << "There were knotify events while startup:" << d->startupEvents << endl;
}
d->inStartup = false; d->inStartup = false;
} }

@ -30,15 +30,14 @@ class TDEConfig;
class KNotify : public TQObject, public DCOPObject class KNotify : public TQObject, public DCOPObject
{ {
Q_OBJECT Q_OBJECT
K_DCOP K_DCOP
public: public:
KNotify( bool useArts ); KNotify( bool useArts );
~KNotify(); ~KNotify();
enum PlayingFinishedStatus enum PlayingFinishedStatus {
{
PlayedOK = 0, // success, all following mean failure PlayedOK = 0, // success, all following mean failure
NoSoundFile, NoSoundFile,
FileAlreadyPlaying, FileAlreadyPlaying,
@ -48,40 +47,28 @@ public:
Unknown = 5000 Unknown = 5000
}; };
protected: protected:
k_dcop: k_dcop:
// deprecated // deprecated
void notify(const TQString &event, const TQString &fromApp, void notify(const TQString &event, const TQString &fromApp, const TQString &text, TQString sound, TQString file, int present, int level);
const TQString &text, TQString sound, TQString file,
int present, int level);
// deprecated // deprecated
void notify(const TQString &event, const TQString &fromApp, void notify(const TQString &event, const TQString &fromApp, const TQString &text, TQString sound, TQString file, int present, int level, int winId);
const TQString &text, TQString sound, TQString file,
int present, int level, int winId);
void notify(const TQString &event, const TQString &fromApp, void notify(const TQString &event, const TQString &fromApp, const TQString &text, TQString sound, TQString file, int present, int level, int winId, int eventId);
const TQString &text, TQString sound, TQString file,
int present, int level, int winId, int eventId);
void reconfigure(); void reconfigure();
void setVolume( int volume ); void setVolume( int volume );
void sessionReady(); // from ksmserver void sessionReady(); // from ksmserver
private: private:
bool notifyBySound(const TQString &sound, const TQString &appname, int eventId); bool notifyBySound(const TQString &sound, const TQString &appname, int eventId);
bool notifyByMessagebox(const TQString &text, int level, WId winId); bool notifyByMessagebox(const TQString &text, int level, WId winId);
bool notifyByLogfile(const TQString &text, const TQString &file); bool notifyByLogfile(const TQString &text, const TQString &file);
bool notifyByStderr(const TQString &text); bool notifyByStderr(const TQString &text);
bool notifyByPassivePopup(const TQString &text, const TQString &appName, bool notifyByPassivePopup(const TQString &text, const TQString &appName, TDEConfig* eventsFile, WId winId );
TDEConfig* eventsFile, WId winId ); bool notifyByExecute(const TQString &command, const TQString& event, const TQString& fromApp, const TQString& text, int winId, int eventId );
bool notifyByExecute(const TQString &command,
const TQString& event,
const TQString& fromApp,
const TQString& text,
int winId,
int eventId );
bool notifyByTaskbar( WId winId ); bool notifyByTaskbar( WId winId );
bool isPlaying( const TQString& soundFile ) const; bool isPlaying( const TQString& soundFile ) const;
@ -96,12 +83,12 @@ private:
**/ **/
bool isGlobal(const TQString &eventname); bool isGlobal(const TQString &eventname);
private slots: private slots:
void playTimeout(); void playTimeout();
void slotPlayerProcessExited( TDEProcess *proc ); void slotPlayerProcessExited( TDEProcess *proc );
void restartedArtsd(); void restartedArtsd();
private: private:
KNotifyPrivate* d; KNotifyPrivate* d;
void loadConfig(); void loadConfig();
}; };

Loading…
Cancel
Save