-void IndicatorNotificationBackend::notify(const Notification ¬ification) {
- if(!_enabled) {
- return;
- }
- if (notification.type != Highlight && notification.type != PrivMsg) {
- return;
- }
- BufferId bufferId = notification.bufferId;
- Indicator *indicator = _indicatorHash.value(bufferId);
- if(!indicator) {
- indicator = new Indicator;
- _indicatorHash.insert(bufferId, indicator);
- connect(indicator, SIGNAL(display(QIndicate::Indicator*)),
- SLOT(indicatorDisplayed(QIndicate::Indicator*)));
- }
- indicator->lastNotificationId = notification.notificationId;
-
- BufferInfo::Type type = Client::networkModel()->bufferType(bufferId);
- QString name;
- if (type == BufferInfo::QueryBuffer) {
- name = notification.sender;
- } else {
- name = QString("%1 (%2)")
- .arg(Client::networkModel()->bufferName(bufferId))
- .arg(notification.sender);
- }
- indicator->setNameProperty(name);
-
- indicator->setTimeProperty(QDateTime::currentDateTime());
-
- QModelIndex index = Client::networkModel()->bufferIndex(bufferId);
- QVariant icon = QtUi::style()->bufferViewItemData(index, Qt::DecorationRole);
- if (icon.canConvert<QPixmap>()) {
- QImage image = icon.value<QPixmap>().toImage();
- indicator->setIconProperty(image);
- }
-
- indicator->setDrawAttentionProperty(true);
- indicator->show();