All pastes #1488103 Raw Edit

Something

public text v1 · immutable
#1488103 ·published 2009-07-08 12:16 UTC
rendered paste body
From bf4906a632f272e0ef64c530fedbed89e780f814 Mon Sep 17 00:00:00 2001
From: Michael Jansen <kde@michael-jansen.biz>
Date: Wed, 8 Jul 2009 14:15:30 +0200
Subject: [PATCH] Implement an constructor for KNotification that takes an QObject.

---
 kdeui/util/knotification.cpp |   15 +++++++++++++++
 kdeui/util/knotification.h   |   18 ++++++++++++++++++
 2 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/kdeui/util/knotification.cpp b/kdeui/util/knotification.cpp
index ae06437..fbb6e1c 100644
--- a/kdeui/util/knotification.cpp
+++ b/kdeui/util/knotification.cpp
@@ -89,6 +89,21 @@ KNotification::KNotification(const QString& eventId, QWidget *parent, const Noti
 	d->updateTimer.setInterval(100);
 }
 
+KNotification::KNotification(
+		const QString& eventId,
+		const NotificationFlags& flags,
+		QObject *parent)
+	:	QObject(parent),
+		d(new Private)
+{
+	d->eventId=eventId;
+	d->flags=flags;
+	connect(&d->updateTimer,SIGNAL(timeout()), this, SLOT(update()));
+	d->updateTimer.setSingleShot(true);
+	d->updateTimer.setInterval(100);
+}
+
+
 KNotification::~KNotification()
 {
 	kDebug( 299 ) << d->id;
diff --git a/kdeui/util/knotification.h b/kdeui/util/knotification.h
index 4a21153..534e7c6 100644
--- a/kdeui/util/knotification.h
+++ b/kdeui/util/knotification.h
@@ -250,6 +250,7 @@ public:
 	 * default events you can use in the event function
 	 */
 	enum StandardEvent { Notification , Warning , Error , Catastrophe };
+
 	/**
 	 * Create a new notification.
 	 * 
@@ -267,6 +268,23 @@ public:
 	 */
 	explicit KNotification(const QString & eventId , QWidget *widget=0L, const NotificationFlags &flags=CloseOnTimeout);
 
+	/**
+	 * Create a new notification.
+	 *
+	 * You have to use sendEvent to show the notification.
+	 *
+	 * The pointer is automatically deleted when the event is closed.
+	 *
+	 * Make sure you use one of the NotificationFlags CloseOnTimeOut or
+	 * CloseWhenWidgetActivated, if not,
+	 * you have to close the notification yourself.
+	 *
+	 * @param eventId is the name of the event
+	 * @param widget is a widget where the notification reports to
+	 * @param flags is a bitmask of NotificationFlag
+	 */
+	explicit KNotification(const QString & eventId , const NotificationFlags &flags=CloseOnTimeout, QObject *parent = NULL );
+
 	~KNotification();
 
 	/**
-- 
1.6.0.2