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

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/7359

Thank You,
vesuri

[This message was auto-generated]

---

Request # 7359:

Messages from BOSS:

State: review at 2012-11-09T16:28:51 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 / libmeegotouch -> CE:MW:Shared / 
libmeegotouch
  
changes files:
--------------
--- libmeegotouch.changes
+++ libmeegotouch.changes
@@ -0,0 +1,3 @@
+* Fri Nov 09 2012 Vesa Halttunen <[email protected]> - 0.30.4
+- MNotification/MNotificationGroup backwards compatibility improvements
+

old:
----
  libmeegotouch-0.30.3.tar.bz2

new:
----
  libmeegotouch-0.30.4.tar.bz2

spec files:
-----------
--- libmeegotouch.spec
+++ libmeegotouch.spec
@@ -9,7 +9,7 @@
 # << macros
 
 Summary:    MeeGo Touch Framework
-Version:    0.30.3
+Version:    0.30.4
 Release:    1
 Group:      System/Libraries
 License:    LGPLv2.1

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

++++++ libmeegotouch-0.30.3.tar.bz2 -> libmeegotouch-0.30.4.tar.bz2
--- mkspecs/features/meegotouch_defines.prf.in
+++ mkspecs/features/meegotouch_defines.prf.in
@@ -6,7 +6,7 @@
 
 M_MAJOR_VERSION = 0
 M_MINOR_VERSION = 30
-M_PATCH_VERSION = 3
+M_PATCH_VERSION = 4
 M_VERSION=$${M_MAJOR_VERSION}.$${M_MINOR_VERSION}.$${M_PATCH_VERSION}
 
 # first set default value for meegotouch prefix
--- src/corelib/notification/mnotification.cpp
+++ src/corelib/notification/mnotification.cpp
@@ -93,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)
 {
@@ -262,6 +277,8 @@
 
     d->userSetTimestamp = QDateTime();
 
+    d->publishGroup();
+
     return d->id != 0;
 }
 
@@ -272,6 +289,7 @@
     if (isPublished()) {
         Q_D(MNotification);
         notificationManager()->CloseNotification(d->id);
+        d->publishGroup();
         d->id = 0;
         success = true;
     }
@@ -339,6 +357,12 @@
     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();
--- src/corelib/notification/mnotification.cpp.orig
+++ src/corelib/notification/mnotification.cpp.orig
@@ -0,0 +1,370 @@
+/***************************************************************************
+**
+** Copyright (C) 2010, 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation ([email protected])
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at [email protected].
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#include <QDBusConnection>
+#include <QCoreApplication>
+#include <QFileInfo>
+#include <QScopedPointer>
+#include "mnotification.h"
+#include "mnotification_p.h"
+#include "mnotificationgroup.h"
+#include "mnotificationmanagerproxy.h"
+#include "mremoteaction.h"
+
+const QString MNotification::DeviceEvent = "device";
+const QString MNotification::DeviceAddedEvent = "device.added";
+const QString MNotification::DeviceErrorEvent = "device.error";
+const QString MNotification::DeviceRemovedEvent = "device.removed";
+const QString MNotification::EmailEvent = "email";
+const QString MNotification::EmailArrivedEvent = "email.arrived";
+const QString MNotification::EmailBouncedEvent = "email.bounced";
+const QString MNotification::ImEvent = "im";
+const QString MNotification::ImErrorEvent = "im.error";
+const QString MNotification::ImReceivedEvent = "im.received";
+const QString MNotification::NetworkEvent = "network";
+const QString MNotification::NetworkConnectedEvent = "network.connected";
+const QString MNotification::NetworkDisconnectedEvent = "network.disconnected";
+const QString MNotification::NetworkErrorEvent = "network.error";
+const QString MNotification::PresenceEvent = "presence";
+const QString MNotification::PresenceOfflineEvent = "presence.offline";
+const QString MNotification::PresenceOnlineEvent = "presence.online";
+const QString MNotification::TransferEvent = "transfer";
+const QString MNotification::TransferCompleteEvent = "transfer.complete";
+const QString MNotification::TransferErrorEvent = "transfer.error";
+
+//! A proxy for accessing the notification manager
+static QScopedPointer<MNotificationManagerProxy> notificationManagerProxy;
+
+MNotificationManagerProxy *notificationManager()
+{
+    if (notificationManagerProxy.isNull()) {
+        qDBusRegisterMetaType<MNotification>();
+        qDBusRegisterMetaType<QList<MNotification> >();
+        notificationManagerProxy.reset(new 
MNotificationManagerProxy("org.freedesktop.Notifications", 
"/org/freedesktop/Notifications", QDBusConnection::sessionBus()));
+    }
+    return notificationManagerProxy.data();
+}
+
+MNotificationPrivate::MNotificationPrivate() :
+    id(0),
+    groupId(0),
+    count(0)
+{
+}
+
+MNotificationPrivate::~MNotificationPrivate()
+{
+}
+
+QVariantHash MNotificationPrivate::hints() const
+{
+    QVariantHash hints;
+    hints.insert("category", eventType);
+    hints.insert("x-nemo-item-count", count);
+    hints.insert("x-nemo-timestamp", userSetTimestamp);
+    hints.insert("x-nemo-preview-summary", summary);
+    hints.insert("x-nemo-preview-body", body);
+    hints.insert("x-nemo-legacy-type", "MNotification");
+    if (groupId > 0) {
+        hints.insert("x-nemo-legacy-group-id", groupId);
+    }
+    if (!identifier.isEmpty()) {
+        hints.insert("x-nemo-legacy-identifier", identifier);
+    }
+    if (!action.isEmpty()) {
+        hints.insert("x-nemo-remote-action-default", action);
+    }
+    return hints;
+}
+
+MNotification::MNotification(MNotificationPrivate &dd) :
+    d_ptr(&dd)
+{
+}
+
+MNotification::MNotification() :
+    d_ptr(new MNotificationPrivate)
+{
+}
+
+MNotification::MNotification(const QString &eventType, const QString &summary, 
const QString &body) :
+    d_ptr(new MNotificationPrivate)
+{
+    Q_D(MNotification);
+    d->eventType = eventType;
+    d->summary = summary;
+    d->body = body;
+}
+
+MNotification::MNotification(const MNotification &notification) :
+    QObject(), d_ptr(new MNotificationPrivate)
+{
+    *this = notification;
+}
+
+MNotification::MNotification(uint id) :
+    d_ptr(new MNotificationPrivate)
+{
+    Q_D(MNotification);
+    d->id = id;
+}
+
+MNotification::~MNotification()
+{
+    delete d_ptr;
+}
+
+uint MNotification::id() const
+{
+    Q_D(const MNotification);
+    return d->id;
+}
+
+void MNotification::setGroup(const MNotificationGroup &group)
+{
+    Q_D(MNotification);
+    d->groupId = group.id();
+}
+
+uint MNotification::groupId() const
+{
+    Q_D(const MNotification);
+    return d->groupId;
+}
+
+void MNotification::setEventType(const QString &eventType)
+{
+    Q_D(MNotification);
+    d->eventType = eventType;
+}
+
+QString MNotification::eventType() const
+{
+    Q_D(const MNotification);
+    return d->eventType;
+}
+
+void MNotification::setSummary(const QString &summary)
+{
+    Q_D(MNotification);
+    d->summary = summary;
+}
+
+QString MNotification::summary() const
+{
+    Q_D(const MNotification);
+    return d->summary;
+}
+
+void MNotification::setBody(const QString &body)
+{
+    Q_D(MNotification);
+    d->body = body;
+}
+
+QString MNotification::body() const
+{
+    Q_D(const MNotification);
+    return d->body;
+}
+
+void MNotification::setImage(const QString &image)
+{
+    Q_D(MNotification);
+    d->image = image;
+}
+
+QString MNotification::image() const
+{
+    Q_D(const MNotification);
+    return d->image;
+}
+
+void MNotification::setAction(const MRemoteAction &action)
+{
+    Q_D(MNotification);
+    d->action = action.toString();
+}
+
+void MNotification::setCount(uint count)
+{
+    Q_D(MNotification);
+    d->count = count;
+}
+
+uint MNotification::count() const
+{
+    Q_D(const MNotification);
+    return d->count;
+}
+
+void MNotification::setIdentifier(const QString &identifier)
+{
+    Q_D(MNotification);
+    d->identifier = identifier;
+}
+
+QString MNotification::identifier() const
+{
+    Q_D(const MNotification);
+    return d->identifier;
+}
+
+void MNotification::setTimestamp(const QDateTime &timestamp)
+{
+    Q_D(MNotification);
+    d->userSetTimestamp = timestamp;
+}
+
+const QDateTime MNotification::timestamp() const
+{
+    Q_D(const MNotification);
+    return d->publishedTimestamp;
+}
+
+bool MNotification::publish()
+{
+    Q_D(MNotification);
+
+    if (d->userSetTimestamp.isNull()) {
+        d->userSetTimestamp = QDateTime::currentDateTimeUtc();
+    }
+
+    QString summary;
+    QString body;
+    if (d->groupId == 0) {
+        // Standalone notifications use the same summary and body for the 
preview banner and the lock screen; for grouped notifications only the preview 
banner has them
+        summary = d->summary;
+        body = d->body;
+    }
+
+    d->id = 
notificationManager()->Notify(QFileInfo(QCoreApplication::arguments()[0]).fileName(),
 d->id, d->image, summary, body, QStringList(), d->hints(), -1);
+
+    if (d->id != 0) {
+        d->publishedTimestamp = d->userSetTimestamp;
+    }
+
+    d->userSetTimestamp = QDateTime();
+
+    return d->id != 0;
+}
+
+bool MNotification::remove()
+{
+    bool success = false;
+
+    if (isPublished()) {
+        Q_D(MNotification);
+        notificationManager()->CloseNotification(d->id);
+        d->id = 0;
+        success = true;
+    }
+
+    return success;
+}
+
+bool MNotification::isPublished() const
+{
+    Q_D(const MNotification);
+    return d->id != 0;
+}
+
+QList<MNotification *> MNotification::notifications()
+{
+    QList<MNotification *> notificationList;
+    if 
(notificationManager()->GetCapabilities().value().contains("x-nemo-get-notifications"))
 {
+        QList<MNotification> list = 
notificationManager()->GetNotifications(QFileInfo(QCoreApplication::arguments()[0]).fileName());
+        foreach(const MNotification &notification, list) {
+            if (notification.property("legacyType").toString() == 
"MNotification") {
+                notificationList.append(new MNotification(notification));
+            }
+        }
+    } else {
+        qWarning("Notification manager does not support GetNotifications(). 
The application may misbehave.");
+    }
+    return notificationList;
+}
+
+QDBusArgument &operator<<(QDBusArgument &argument, const MNotification &)
+{
+    argument.beginStructure();
+    argument << QString();
+    argument << (uint)0;
+    argument << QString();
+    argument << QString();
+    argument << QString();
+    argument << QStringList();
+    argument << QVariantHash();
+    argument << -1;
+    argument.endStructure();
+    return argument;
+}
+
+const QDBusArgument &operator>>(const QDBusArgument &argument, MNotification 
&notification)
+{
+    QString appName;
+    QStringList actions;
+    QVariantHash hints;
+    int expireTimeout;
+    argument.beginStructure();
+    argument >> appName;
+    argument >> notification.d_ptr->id;
+    argument >> notification.d_ptr->image;
+    argument >> notification.d_ptr->summary;
+    argument >> notification.d_ptr->body;
+    argument >> actions;
+    argument >> hints;
+    argument >> expireTimeout;
+    argument.endStructure();
+
+    if (hints.contains("x-nemo-preview-summary")) {
+        notification.d_ptr->summary = 
hints.value("x-nemo-preview-summary").toString();
+    }
+    if (hints.contains("x-nemo-preview-body")) {
+        notification.d_ptr->body = 
hints.value("x-nemo-preview-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();
+    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();
+    notification.setProperty("legacyType", hints.value("x-nemo-legacy-type"));
+
+    return argument;
+}
+
+MNotification &MNotification::operator=(const MNotification &notification)
+{
+    Q_D(MNotification);
+    const MNotificationPrivate *dn = notification.d_func();
+    d->id = dn->id;
+    d->groupId = dn->groupId;
+    d->eventType = dn->eventType;
+    d->summary = dn->summary;
+    d->body = dn->body;
+    d->image = dn->image;
+    d->action = dn->action;
+    d->count = dn->count;
+    d->identifier = dn->identifier;
+    d->userSetTimestamp = dn->userSetTimestamp;
+    d->publishedTimestamp = dn->publishedTimestamp;
+    setProperty("legacyType", notification.property("legacyType"));
+    return *this;
+}
--- src/corelib/notification/mnotification_p.h
+++ src/corelib/notification/mnotification_p.h
@@ -47,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;
 
--- src/corelib/notification/mnotification_p.h.orig
+++ src/corelib/notification/mnotification_p.h.orig
@@ -0,0 +1,84 @@
+/***************************************************************************
+**
+** Copyright (C) 2010, 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation ([email protected])
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at [email protected].
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#ifndef MNOTIFICATION_P_H
+#define MNOTIFICATION_P_H
+
+#include <QPointer>
+#include <QDateTime>
+#include <QVariantHash>
+
+class MNotificationManagerProxy;
+
+/*!
+ * A private class for MNotification
+ */
+class MNotificationPrivate : public QObject
+{
+    Q_OBJECT
+
+public:
+    /*!
+     * Constructor
+     */
+    MNotificationPrivate();
+
+    /*!
+     * Destructor
+     */
+    virtual ~MNotificationPrivate();
+
+    //! Returns hints for the notification
+    virtual QVariantHash hints() const;
+
+    //! The ID of the notification
+    uint id;
+
+    //! Notification group of the notification.
+    uint groupId;
+
+    //! The event type of the notification.
+    QString eventType;
+
+    //! The summary text to be used in the notification. Defaults to no 
summary text.
+    QString summary;
+
+    //! The body text to be used in the notification. Defaults to no body text.
+    QString body;
+
+    //! The name of the image to be used in the notification. Defaults to no 
image.
+    QString image;
+
+    //! The action to be executed when the notification is activated. Defaults 
to no action.
+    QString action;
+
+    //! The number of items inside this notification
+    uint count;
+
+    //! The identifier of the notification set by the application
+    QString identifier;
+
+    //! User set timestamp of notification
+    QDateTime userSetTimestamp;
+
+    //!  Timestamp that has been previously published
+    QDateTime publishedTimestamp;
+};
+
+#endif // MNOTIFICATION_P_H
--- src/corelib/notification/mnotificationgroup.cpp
+++ src/corelib/notification/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;
+}
--- src/corelib/notification/mnotificationgroup.h
+++ src/corelib/notification/mnotificationgroup.h
@@ -106,6 +106,10 @@
      */
     uint notificationCount();
 
+    //! \reimp
+    virtual bool publish();
+    //! \reimp_end
+
     //! \internal
     /*!
      * Timestamp cannot be set for MotificationGroup.

++++++ libmeegotouch.yaml
--- libmeegotouch.yaml
+++ libmeegotouch.yaml
@@ -1,6 +1,6 @@
 Name: libmeegotouch
 Summary: MeeGo Touch Framework
-Version: 0.30.3
+Version: 0.30.4
 Release: 1
 Group: System/Libraries
 License: LGPLv2.1



Reply via email to