| Home · All Classes · Main Classes · Deprecated |
00001 /*************************************************************************** 00002 ** 00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 00004 ** All rights reserved. 00005 ** Contact: Nokia Corporation (directui@nokia.com) 00006 ** 00007 ** This file is part of libmeegotouch. 00008 ** 00009 ** If you have questions regarding the use of this file, please contact 00010 ** Nokia at directui@nokia.com. 00011 ** 00012 ** This library is free software; you can redistribute it and/or 00013 ** modify it under the terms of the GNU Lesser General Public 00014 ** License version 2.1 as published by the Free Software Foundation 00015 ** and appearing in the file LICENSE.LGPL included in the packaging 00016 ** of this file. 00017 ** 00018 ****************************************************************************/ 00019 00020 #include "mnotificationgroup.h" 00021 #include "mnotificationgroup_p.h" 00022 #include "mnotificationmanager.h" 00023 00024 MNotificationGroupPrivate::MNotificationGroupPrivate() : MNotificationPrivate() 00025 { 00026 } 00027 00028 MNotificationGroupPrivate::~MNotificationGroupPrivate() 00029 { 00030 } 00031 00032 MNotificationGroup::MNotificationGroup() : 00033 MNotification(*new MNotificationGroupPrivate) 00034 { 00035 } 00036 00037 MNotificationGroup::MNotificationGroup(const QString &eventType, const QString &summary, const QString &body) : 00038 MNotification(*new MNotificationGroupPrivate) 00039 { 00040 Q_D(MNotificationGroup); 00041 d->eventType = eventType; 00042 d->summary = summary; 00043 d->body = body; 00044 } 00045 00046 MNotificationGroup::MNotificationGroup(const MNotificationGroup &group) : 00047 MNotification(*new MNotificationGroupPrivate) 00048 { 00049 *this = group; 00050 } 00051 00052 MNotificationGroup::~MNotificationGroup() 00053 { 00054 } 00055 00056 MNotificationGroup::MNotificationGroup(uint id) : MNotification(id) 00057 { 00058 } 00059 00060 bool MNotificationGroup::publish() 00061 { 00062 Q_D(MNotificationGroup); 00063 00064 bool success = false; 00065 00066 if (d->id == 0) { 00067 if (!d->summary.isNull() || !d->body.isNull() || !d->image.isNull() || !d->action.isNull()) { 00068 d->id = MNotificationManager::instance()->addGroup(d->eventType, d->summary, d->body, d->action, d->image, d->count); 00069 } else { 00070 d->id = MNotificationManager::instance()->addGroup(d->eventType); 00071 } 00072 00073 success = d->id != 0; 00074 } else { 00075 if (!d->summary.isNull() || !d->body.isNull() || !d->image.isNull() || !d->action.isNull()) { 00076 success = MNotificationManager::instance()->updateGroup(d->id, d->eventType, d->summary, d->body, d->action, d->image, d->count); 00077 } else { 00078 success = MNotificationManager::instance()->updateGroup(d->id, d->eventType); 00079 } 00080 } 00081 00082 return success; 00083 } 00084 00085 bool MNotificationGroup::remove() 00086 { 00087 if (!isPublished()) { 00088 return false; 00089 } else { 00090 Q_D(MNotificationGroup); 00091 uint id = d->id; 00092 d->id = 0; 00093 return MNotificationManager::instance()->removeGroup(id); 00094 } 00095 } 00096 00097 QList<MNotificationGroup *> MNotificationGroup::notificationGroups() 00098 { 00099 QList<MNotificationGroup> list = MNotificationManager::instance()->notificationGroupList(); 00100 QList<MNotificationGroup *> notificationGroups; 00101 foreach(const MNotificationGroup &group, list) { 00102 notificationGroups.append(new MNotificationGroup(group)); 00103 } 00104 return notificationGroups; 00105 } 00106 00107 QDBusArgument &operator<<(QDBusArgument &argument, const MNotificationGroup &group) 00108 { 00109 const MNotificationGroupPrivate *d = group.d_func(); 00110 argument.beginStructure(); 00111 argument << d->id; 00112 argument << d->eventType; 00113 argument << d->summary; 00114 argument << d->body; 00115 argument << d->image; 00116 argument << d->action; 00117 argument << d->count; 00118 argument.endStructure(); 00119 return argument; 00120 } 00121 00122 const QDBusArgument &operator>>(const QDBusArgument &argument, MNotificationGroup &group) 00123 { 00124 MNotificationGroupPrivate *d = group.d_func(); 00125 argument.beginStructure(); 00126 argument >> d->id; 00127 argument >> d->eventType; 00128 argument >> d->summary; 00129 argument >> d->body; 00130 argument >> d->image; 00131 argument >> d->action; 00132 argument >> d->count; 00133 argument.endStructure(); 00134 return argument; 00135 }
| Copyright © 2010 Nokia Corporation | Generated on Thu Nov 4 2010 18:14:21 (PDT) Doxygen 1.7.1 |
MeeGo Touch |