diff options
| -rw-r--r-- | src/daemon/NotificationsService.cpp | 79 | ||||
| -rw-r--r-- | src/daemon/NotificationsService.h | 2 |
2 files changed, 41 insertions, 40 deletions
diff --git a/src/daemon/NotificationsService.cpp b/src/daemon/NotificationsService.cpp index 4201643..3cb9cbd 100644 --- a/src/daemon/NotificationsService.cpp +++ b/src/daemon/NotificationsService.cpp @@ -42,14 +42,14 @@ NotificationsService::NotificationsService(TQT_DBusConnection &conn) NotificationsService::~NotificationsService() { - notificationMap.clear(); + mNotificationMap.clear(); } void NotificationsService::closeNotifyWidget(TQ_UINT32 id, TQ_UINT32 reason) { - if (notificationMap[id]) { - notificationMap[id]->close(); - notificationMap.remove(id); + if (mNotificationMap[id]) { + mNotificationMap[id]->close(); + mNotificationMap.remove(id); } if ( !emitNotificationClosed(id, reason) ) { @@ -110,16 +110,17 @@ void NotificationsService::NotifyAsync( TQ_INT32 timeout) { TQ_UINT32 nId=id; -// if (nId != 0 && !notificationMap.contains(nId)) +// if (nId != 0 && !mNotificationMap.contains(nId)) // tqDebug("Requested id %i is not valid", nId); - bool found = notificationMap.contains(nId); - if (nId == 0 || !notificationMap.contains(nId)) // new notification + bool found = mNotificationMap.contains(nId); + if (nId == 0 || !mNotificationMap.contains(nId)) // new notification { nId = ++mNotificationId; - notificationMap[nId] = new NotifyWidget(0, app_name.ascii(), nId); - notificationMap[nId]->setMinimumSize(200, 40); - connect(notificationMap[nId], TQ_SIGNAL(notificationClosed(TQ_UINT32, TQ_UINT32)), + mNotificationMap[nId] = new NotifyWidget(0, app_name.ascii(), nId); + mNotificationMap[nId]->setMinimumSize(200, 40); + + connect(mNotificationMap[nId], TQ_SIGNAL(notificationClosed(TQ_UINT32, TQ_UINT32)), this, TQ_SLOT(closeNotifyWidget(TQ_UINT32, TQ_UINT32))); } @@ -131,47 +132,47 @@ void NotificationsService::NotifyAsync( bool ok = true; if(it.key().latin1()=="category") { - notificationMap[nId]->setCategory(it.data().value.toString(&ok)); + mNotificationMap[nId]->setCategory(it.data().value.toString(&ok)); if(!ok) errStr += " category"; } else if (it.key().latin1()=="image-path") { - notificationMap[nId]->setImage(it.data().value.toString(&ok)); + mNotificationMap[nId]->setImage(it.data().value.toString(&ok)); if(!ok) errStr += " image-path"; } else if (it.key().latin1()=="image-data" || it.key().latin1()=="image_data" || it.key().latin1()=="icon_data") { - notificationMap[nId]->setImageData(it.data().value.toTQValueList(&ok)); + mNotificationMap[nId]->setImageData(it.data().value.toTQValueList(&ok)); if(!ok) errStr += " image-data"; } else if (it.key().latin1()=="sound-file") { - notificationMap[nId]->setSoundFile(it.data().value.toString(&ok)); + mNotificationMap[nId]->setSoundFile(it.data().value.toString(&ok)); if(!ok) errStr += " sound-file"; } else if (it.key().latin1()=="sound-name") { - notificationMap[nId]->setSoundName(it.data().value.toString(&ok)); + mNotificationMap[nId]->setSoundName(it.data().value.toString(&ok)); if(!ok) errStr += " sound-name"; } else if (it.key().latin1()=="suppress-sound") { - notificationMap[nId]->setSuppressSound(it.data().value.toBool(&ok)); + mNotificationMap[nId]->setSuppressSound(it.data().value.toBool(&ok)); if(!ok) errStr += " suppress-sound"; } else if (it.key().latin1()=="transient") { - notificationMap[nId]->setTransient(it.data().value.toBool(&ok)); + mNotificationMap[nId]->setTransient(it.data().value.toBool(&ok)); if(!ok) errStr += " transient"; } else if (it.key().latin1()=="urgency") { - notificationMap[nId]->setUrgency(it.data().value.toUInt16(&ok)); + mNotificationMap[nId]->setUrgency(it.data().value.toUInt16(&ok)); if(!ok) errStr += " urgency"; } else if (it.key().latin1()=="sender-pid") { - notificationMap[nId]->setSenderPid(it.data().value.toUInt64(&ok)); + mNotificationMap[nId]->setSenderPid(it.data().value.toUInt64(&ok)); if(!ok) errStr += " sender-pid"; } } @@ -179,33 +180,33 @@ void NotificationsService::NotifyAsync( tqDebug("There was an error converting some of the hint values:" + errStr); } - notificationMap[nId]->setFrameStyle( TQFrame::NoFrame ); -// notificationMap[nId]->setPaletteBackgroundColor(TQt::black); -// notificationMap[nId]->setPaletteForegroundColor(TQt::white); + mNotificationMap[nId]->setFrameStyle( TQFrame::NoFrame ); +// mNotificationMap[nId]->setPaletteBackgroundColor(TQt::black); +// mNotificationMap[nId]->setPaletteForegroundColor(TQt::white); - if (icon.isEmpty() || ! notificationMap[nId]->setIcon(icon)) { - notificationMap[nId]->setTextFormat(TQt::RichText); - notificationMap[nId]->setText("<b>" + app_name + ": " + summary + "</b><p>" + body + "</p>"); + if (icon.isEmpty() || ! mNotificationMap[nId]->setIcon(icon)) { + mNotificationMap[nId]->setTextFormat(TQt::RichText); + mNotificationMap[nId]->setText("<b>" + app_name + ": " + summary + "</b><p>" + body + "</p>"); } - notificationMap[nId]->setActions(actions); - notificationMap[nId]->setTimeout(timeout); - notificationMap[nId]->adjustSize(); - notificationMap[nId]->raise(); - notificationMap[nId]->show(); - notificationMap[nId]->setActiveWindow(); + mNotificationMap[nId]->setActions(actions); + mNotificationMap[nId]->setTimeout(timeout); + mNotificationMap[nId]->adjustSize(); + mNotificationMap[nId]->raise(); + mNotificationMap[nId]->show(); + mNotificationMap[nId]->setActiveWindow(); // make sure we display the new notification above the older one // and if we reach the top of the screen we start at the bottom TQDesktopWidget *d = TQApplication::desktop(); - if (notificationMap.contains(nId-1) && notificationMap[nId-1] != 0) { - TQPoint pos = notificationMap[nId-1]->pos(); - if(pos.y()-notificationMap[nId-1]->height() < 0) - pos.setY(d->height()-notificationMap[nId]->height()); - pos.setX(d->width()-notificationMap[nId]->width()); - notificationMap[nId]->move(pos.x(),pos.y()-notificationMap[nId-1]->height()); + if (mNotificationMap.contains(nId-1) && mNotificationMap[nId-1] != 0) { + TQPoint pos = mNotificationMap[nId-1]->pos(); + if(pos.y()-mNotificationMap[nId-1]->height() < 0) + pos.setY(d->height()-mNotificationMap[nId]->height()); + pos.setX(d->width()-mNotificationMap[nId]->width()); + mNotificationMap[nId]->move(pos.x(),pos.y()-mNotificationMap[nId-1]->height()); } else { - notificationMap[nId]->move( d->width()-notificationMap[nId]->width(), - d->height()-notificationMap[nId]->height()); + mNotificationMap[nId]->move( d->width()-mNotificationMap[nId]->width(), + d->height()-mNotificationMap[nId]->height()); } NotifyAsyncReply(asyncCallId, nId); diff --git a/src/daemon/NotificationsService.h b/src/daemon/NotificationsService.h index ff44691..5c439a7 100644 --- a/src/daemon/NotificationsService.h +++ b/src/daemon/NotificationsService.h @@ -78,7 +78,7 @@ protected: private: TQT_DBusConnection *mConnection; TQ_UINT32 mNotificationId; - TQMap<TQ_UINT32, NotifyWidget*> notificationMap; + TQMap<TQ_UINT32, NotifyWidget*> mNotificationMap; }; #endif /* NOTIFICATIONSSERVICE_H_ */ |
