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/7426 Thank You, vesuri [This message was auto-generated] --- Request # 7426: Messages from BOSS: State: review at 2012-11-20T15:32:34 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 @@ +* Tue Nov 20 2012 Vesa Halttunen <[email protected]> - 0.0.10 +- MNotification/MNotificationGroup backwards compatibility improvements + old: ---- mlite-0.0.9.tar.bz2 new: ---- mlite-0.0.10.tar.bz2 spec files: ----------- --- mlite.spec +++ mlite.spec @@ -9,7 +9,7 @@ # << macros Summary: Useful classes originating from MeeGo Touch -Version: 0.0.9 +Version: 0.0.10 Release: 1 Group: System/Libraries License: LGPL v2.1 other changes: -------------- ++++++ mlite-0.0.9.tar.bz2 -> mlite-0.0.10.tar.bz2 --- mlite.pro +++ mlite.pro @@ -81,7 +81,7 @@ INSTALLS += target headers pcfiles TRANSLATIONS += $${SOURCES} $${HEADERS} $${OTHER_FILES} -VERSION = 0.0.9 +VERSION = 0.0.10 PROJECT_NAME = mlite dist.commands += rm -fR $${PROJECT_NAME}-$${VERSION} && --- mnotification.cpp +++ mnotification.cpp @@ -78,9 +78,10 @@ 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-summary", summary); + hints.insert("x-nemo-legacy-body", body); hints.insert("x-nemo-legacy-type", "MNotification"); + hints.insert("x-nemo-user-closeable", true); if (groupId > 0) { hints.insert("x-nemo-legacy-group-id", groupId); } @@ -100,7 +101,7 @@ QList<MNotificationGroup *> groups = MNotificationGroup::notificationGroups(); foreach (MNotificationGroup *group, groups) { if (group->id() == groupId) { - group->publish(); + group->publish(summary, body); break; } } @@ -261,15 +262,22 @@ d->userSetTimestamp = QDateTime::currentDateTimeUtc(); } + QVariantHash hints = d->hints(); 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; + // Standalone notifications use the same summary and body for the lock screen - show nothing for grouped notifications + summary = hints.value("x-nemo-legacy-summary").toString(); + body = hints.value("x-nemo-legacy-body").toString(); + + if (d->id == 0) { + // Only show the preview banner for new notifications + hints.insert("x-nemo-preview-summary", hints.value("x-nemo-legacy-summary")); + hints.insert("x-nemo-preview-body", hints.value("x-nemo-legacy-body")); + } } - d->id = notificationManager()->Notify(QFileInfo(QCoreApplication::arguments()[0]).fileName(), d->id, d->image, summary, body, QStringList(), d->hints(), -1); + d->id = notificationManager()->Notify(QFileInfo(QCoreApplication::arguments()[0]).fileName(), d->id, d->image, summary, body, QStringList(), hints, -1); if (d->id != 0) { d->publishedTimestamp = d->userSetTimestamp; @@ -351,17 +359,11 @@ 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(); - } - 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-summary")) { + notification.d_ptr->summary = hints.value("x-nemo-legacy-summary").toString(); } - if (hints.contains("x-nemo-legacy-group-body")) { - notification.d_ptr->body = hints.value("x-nemo-legacy-group-body").toString(); + if (hints.contains("x-nemo-legacy-body")) { + notification.d_ptr->body = hints.value("x-nemo-legacy-body").toString(); } notification.d_ptr->eventType = hints.value("category").toString(); notification.d_ptr->count = hints.value("x-nemo-item-count").toUInt(); --- mnotificationgroup.cpp +++ mnotificationgroup.cpp @@ -49,8 +49,11 @@ { } -MNotificationGroup::MNotificationGroup(uint id) : MNotification(id) +MNotificationGroup::MNotificationGroup(uint id) : + MNotification(*new MNotificationGroupPrivate) { + Q_D(MNotificationGroup); + d->id = id; } QVariantHash MNotificationGroupPrivate::hints() const @@ -60,8 +63,9 @@ 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); + hints.insert("x-nemo-legacy-summary", summary); + hints.insert("x-nemo-legacy-body", body); + hints.insert("x-nemo-user-closeable", false); if (!identifier.isEmpty()) { hints.insert("x-nemo-legacy-identifier", identifier); } @@ -109,17 +113,31 @@ bool MNotificationGroup::publish() { + return publish(QString(), QString()); +} + +bool MNotificationGroup::publish(const QString &previewSummary, const QString &previewBody) +{ Q_D(MNotificationGroup); + QVariantHash hints = d->hints(); 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; + summary = hints.value("x-nemo-legacy-summary").toString(); + body = hints.value("x-nemo-legacy-body").toString(); + + // Allow a notification belonging to this group to show a preview banner + if (!previewSummary.isEmpty()) { + hints.insert("x-nemo-preview-summary", previewSummary); + } + if (!previewBody.isEmpty()) { + hints.insert("x-nemo-preview-body", previewBody); + } } - d->id = notificationManager()->Notify(QFileInfo(QCoreApplication::arguments()[0]).fileName(), d->id, d->image, summary, body, QStringList(), d->hints(), -1); + d->id = notificationManager()->Notify(QFileInfo(QCoreApplication::arguments()[0]).fileName(), d->id, d->image, summary, body, QStringList(), hints, -1); return d->id != 0; } --- mnotificationgroup.h +++ mnotificationgroup.h @@ -117,6 +117,12 @@ * MNotification. */ void setTimestamp(const QDateTime ×tamp); + + /*! + * Publishes the group using a preview banner. Should only be used + * by MNotification. + */ + bool publish(const QString &previewSummary, const QString &previewBody); //! \internal_end protected: --- tools/mlitenotificationtool/mlitenotificationtool.cpp +++ tools/mlitenotificationtool/mlitenotificationtool.cpp @@ -303,9 +303,6 @@ group.setAction(*remoteAction); group.setCount(count); group.setIdentifier(identifier); - if (timestamp != 0) { - group.setTimestamp(QDateTime::fromTime_t(timestamp)); - } group.publish(); result = group.id(); } else { @@ -345,9 +342,6 @@ group.setAction(*remoteAction); group.setCount(count); group.setIdentifier(identifier); - if (timestamp != 0) { - group.setTimestamp(QDateTime::fromTime_t(timestamp)); - } group.publish(); } else { MNotificationToolNotification notification(id); ++++++ mlite.yaml --- mlite.yaml +++ mlite.yaml @@ -1,6 +1,6 @@ Name: mlite Summary: Useful classes originating from MeeGo Touch -Version: 0.0.9 +Version: 0.0.10 Release: 1 Group: System/Libraries License: LGPL v2.1
