I have made the following changes intended for :
  CE:MW:Shared / mlite

Please review and accept or decline.
BOSS has already run some checks on this request.
See the "Messages from BOSS" section below.

https://build.pub.meego.com//request/show/7358

Thank You,
vesuri

[This message was auto-generated]

---

Request # 7358:

Messages from BOSS:

State: review at 2012-11-09T16:28:41 by bossbot

Reviews:
       accepted by bossbot : Prechecks succeeded.
       new for CE-maintainers : Please replace this text with a review and 
approve/reject the review (not the SR). BOSS will take care of the rest

Changes:
  submit: home:vesuri:branches:CE:MW:Shared / mlite -> CE:MW:Shared / mlite
  
changes files:
--------------
--- mlite.changes
+++ mlite.changes
@@ -0,0 +1,3 @@
+* Fri Nov 09 2012 Vesa Halttunen <[email protected]> - 0.0.9
+- MNotification/MNotificationGroup backwards compatibility improvements
+

old:
----
  mlite-0.0.8.tar.bz2

new:
----
  mlite-0.0.9.tar.bz2

spec files:
-----------
--- mlite.spec
+++ mlite.spec
@@ -9,7 +9,7 @@
 # << macros
 
 Summary:    Useful classes originating from MeeGo Touch
-Version:    0.0.8
+Version:    0.0.9
 Release:    1
 Group:      System/Libraries
 License:    LGPL v2.1
@@ -40,7 +40,7 @@
 
 
 %prep
-%setup -q -n %{name}-%{version}
+%setup -q -n %{name}
 
 # 0001-remove-API-which-will-block-use-of-dconf.patch
 %patch0 -p1

other changes:
--------------

++++++ mlite-0.0.8.tar.bz2 -> mlite-0.0.9.tar.bz2
--- .gitignore
+++ .gitignore
@@ -1,8 +0,0 @@
-*~
-*.o
-*.so*
-Makefile
-*.pro.user
-.moc
-.obj
-mnotificationmanagerproxy.*
--- mlite.pro
+++ mlite.pro
@@ -81,7 +81,7 @@
 INSTALLS += target headers pcfiles
 
 TRANSLATIONS += $${SOURCES} $${HEADERS} $${OTHER_FILES}
-VERSION = 0.0.7
+VERSION = 0.0.9
 PROJECT_NAME = mlite
 
 dist.commands += rm -fR $${PROJECT_NAME}-$${VERSION} &&
--- mnotification.cpp
+++ mnotification.cpp
@@ -64,9 +64,7 @@
 MNotificationPrivate::MNotificationPrivate() :
     id(0),
     groupId(0),
-    count(0),
-    userSetTimestamp(0),
-    publishedTimestamp(0)
+    count(0)
 {
 }
 
@@ -95,6 +93,21 @@
     return hints;
 }
 
+void MNotificationPrivate::publishGroup()
+{
+    if (groupId != 0) {
+        // Publish the notification group this notification is in
+        QList<MNotificationGroup *> groups = 
MNotificationGroup::notificationGroups();
+        foreach (MNotificationGroup *group, groups) {
+            if (group->id() == groupId) {
+                group->publish();
+                break;
+            }
+        }
+        qDeleteAll(groups);
+    }
+}
+
 MNotification::MNotification(MNotificationPrivate &dd) :
     d_ptr(&dd)
 {
@@ -231,21 +244,21 @@
 void MNotification::setTimestamp(const QDateTime &timestamp)
 {
     Q_D(MNotification);
-    d->userSetTimestamp = timestamp.isValid() ? timestamp.toTime_t() : 0;
+    d->userSetTimestamp = timestamp;
 }
 
 const QDateTime MNotification::timestamp() const
 {
     Q_D(const MNotification);
-    return d->publishedTimestamp != 0 ? 
QDateTime::fromTime_t(d->publishedTimestamp) : QDateTime();
+    return d->publishedTimestamp;
 }
 
 bool MNotification::publish()
 {
     Q_D(MNotification);
 
-    if (d->userSetTimestamp == 0) {
-        d->userSetTimestamp = QDateTime::currentDateTimeUtc().toTime_t();
+    if (d->userSetTimestamp.isNull()) {
+        d->userSetTimestamp = QDateTime::currentDateTimeUtc();
     }
 
     QString summary;
@@ -262,7 +275,9 @@
         d->publishedTimestamp = d->userSetTimestamp;
     }
 
-    d->userSetTimestamp = 0;
+    d->userSetTimestamp = QDateTime();
+
+    d->publishGroup();
 
     return d->id != 0;
 }
@@ -274,6 +289,7 @@
     if (isPublished()) {
         Q_D(MNotification);
         notificationManager()->CloseNotification(d->id);
+        d->publishGroup();
         d->id = 0;
         success = true;
     }
@@ -341,9 +357,15 @@
     if (hints.contains("x-nemo-preview-body")) {
         notification.d_ptr->body = 
hints.value("x-nemo-preview-body").toString();
     }
+    if (hints.contains("x-nemo-legacy-group-summary")) {
+        notification.d_ptr->summary = 
hints.value("x-nemo-legacy-group-summary").toString();
+    }
+    if (hints.contains("x-nemo-legacy-group-body")) {
+        notification.d_ptr->body = 
hints.value("x-nemo-legacy-group-body").toString();
+    }
     notification.d_ptr->eventType = hints.value("category").toString();
     notification.d_ptr->count = hints.value("x-nemo-item-count").toUInt();
-    notification.d_ptr->userSetTimestamp = 
hints.value("x-nemo-timestamp").toDateTime().toTime_t();
+    notification.d_ptr->userSetTimestamp = 
hints.value("x-nemo-timestamp").toDateTime();
     notification.d_ptr->action = 
hints.value("x-nemo-remote-action-default").toString();
     notification.d_ptr->identifier = 
hints.value("x-nemo-legacy-identifier").toString();
     notification.d_ptr->groupId = 
hints.value("x-nemo-legacy-group-id").toUInt();
--- mnotification_p.h
+++ mnotification_p.h
@@ -21,6 +21,7 @@
 #define MNOTIFICATION_P_H
 
 #include <QPointer>
+#include <QDateTime>
 #include <QVariantHash>
 
 class MNotificationManagerProxy;
@@ -46,6 +47,9 @@
     //! Returns hints for the notification
     virtual QVariantHash hints() const;
 
+    //! Publishes the group of the notification (if any)
+    void publishGroup();
+
     //! The ID of the notification
     uint id;
 
@@ -74,10 +78,10 @@
     QString identifier;
 
     //! User set timestamp of notification
-    uint userSetTimestamp;
+    QDateTime userSetTimestamp;
 
     //!  Timestamp that has been previously published
-    uint publishedTimestamp;
+    QDateTime publishedTimestamp;
 };
 
 #endif // MNOTIFICATION_P_H
--- mnotificationgroup.cpp
+++ mnotificationgroup.cpp
@@ -60,6 +60,8 @@
     hints.insert("x-nemo-item-count", count);
     hints.insert("x-nemo-timestamp", userSetTimestamp);
     hints.insert("x-nemo-legacy-type", "MNotificationGroup");
+    hints.insert("x-nemo-legacy-group-summary", summary);
+    hints.insert("x-nemo-legacy-group-body", body);
     if (!identifier.isEmpty()) {
         hints.insert("x-nemo-legacy-identifier", identifier);
     }
@@ -104,3 +106,20 @@
 void MNotificationGroup::setTimestamp(const QDateTime &)
 {
 }
+
+bool MNotificationGroup::publish()
+{
+    Q_D(MNotificationGroup);
+
+    QString summary;
+    QString body;
+    if (d->id != 0 && notificationCount() > 0) {
+        // Only already published groups may have notifications in them and 
thus should have a visual representation
+        summary = d->summary.isEmpty() ? 
d->hints().value("x-nemo-legacy-group-summary").toString() : d->summary;
+        body = d->body.isEmpty() ? 
d->hints().value("x-nemo-legacy-group-body").toString() : d->body;
+    }
+
+    d->id = 
notificationManager()->Notify(QFileInfo(QCoreApplication::arguments()[0]).fileName(),
 d->id, d->image, summary, body, QStringList(), d->hints(), -1);
+
+    return d->id != 0;
+}
--- mnotificationgroup.h
+++ mnotificationgroup.h
@@ -106,6 +106,10 @@
      */
     uint notificationCount();
 
+    //! \reimp
+    virtual bool publish();
+    //! \reimp_end
+
     //! \internal
     /*!
      * Timestamp cannot be set for MotificationGroup.
--- tools/mlitenotificationtool/.gitignore
+++ tools/mlitenotificationtool/.gitignore
@@ -1 +0,0 @@
-mlitenotificationtool

++++++ mlite.yaml
--- mlite.yaml
+++ mlite.yaml
@@ -1,6 +1,6 @@
 Name: mlite
 Summary: Useful classes originating from MeeGo Touch
-Version: 0.0.8
+Version: 0.0.9
 Release: 1
 Group: System/Libraries
 License: LGPL v2.1



Reply via email to