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