File dont-cut-login-sound.diff of Package kdebase4-runtime

Subject: Hotplug support for KDE3 applications
From: upstream
Signed-Off-By: Lubos Lunak
Feature: bnc#458963
Patch-upstream: r887719

------------------------------------------------------------------------
r887719 | mkretz | 2008-11-22 16:48:29 +0000 (Sat, 22 Nov 2008) | 2 lines
Changed paths:
   M /trunk/KDE/kdebase/runtime/knotify/notifybysound.cpp
   M /trunk/KDE/kdebase/runtime/knotify/notifybysound.h

hack sound notifications to delay calls to close by 1 minute. This "fixes" the startup sound which got cut off by the hardcoded timeout of 6 seconds - now it's hardcoded to 1:06.
BUG: 157810
------------------------------------------------------------------------
Index: notifybysound.cpp
===================================================================
--- knotify/notifybysound.cpp	(revision 887718)
+++ knotify/notifybysound.cpp	(revision 887719)
@@ -31,6 +31,8 @@
 // QT headers
 #include <QHash>
 #include <QtCore/QBasicTimer>
+#include <QtCore/QQueue>
+#include <QtCore/QTimer>
 #include <QtCore/QTimerEvent>
 #include <QtCore/QStack>
 #include <QSignalMapper>
@@ -138,6 +140,7 @@
 		QSignalMapper *signalmapper;
 		PlayerPool playerPool;
 		QBasicTimer poolTimer;
+		QQueue<int> closeQueue;
 
 		int volume;
 
@@ -287,9 +290,17 @@
 	finish(id);
 }
 
-
 void NotifyBySound::close(int id)
 {
+	// close in 1 min - ugly workaround for sounds getting cut off because the close call in kdelibs
+	// is hardcoded to 6 seconds
+	d->closeQueue.enqueue(id);
+	QTimer::singleShot(60000, this, SLOT(closeNow()));
+}
+
+void NotifyBySound::closeNow()
+{
+	const int id = d->closeQueue.dequeue();
 	if(d->playerObjects.contains(id))
 	{
 		Player *p = d->playerObjects.take(id);
Index: notifybysound.h
===================================================================
--- knotify/notifybysound.h	(revision 887718)
+++ knotify/notifybysound.h	(revision 887719)
@@ -49,6 +49,7 @@
 
 	private Q_SLOTS:
 		void slotSoundFinished(int id);
+		void closeNow();
 };
 
 #endif