[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/dataengines/notifications
From:       Aurélien Gâteau <agateau () kde ! org>
Date:       2009-07-16 12:55:08
Message-ID: 1247748908.855945.8029.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 997749 by gateau:

Handle case where timeout is -1

 M  +12 -0     notificationsengine.cpp  


--- trunk/KDE/kdebase/workspace/plasma/dataengines/notifications/notificationsengine.cpp #997748:997749
@@ -62,6 +62,18 @@
         appname_str = i18n("Unknown Application");
     }
 
+    if (timeout == -1) {
+        const int AVERAGE_WORD_LENGTH = 6;
+        const int WORD_PER_MINUTE = 250;
+        int count = summary.length() + body.length();
+        timeout = 60000 * count / AVERAGE_WORD_LENGTH / WORD_PER_MINUTE;
+
+        // Add two seconds for the user to notice the notification, and ensure
+        // it last at least five seconds, otherwise all the user see is a
+        // flash
+        timeout = 2000 + qMin(timeout, 3000);
+    }
+
     const QString source = QString("notification %1").arg(id);
     if (replaces_id) {
         Plasma::DataContainer *container = containerForSource(source);
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic