| 118 | } |
| 119 | |
| 120 | void NotificationItemWidgetPrivate::updateContent() |
| 121 | { |
| 122 | msgLabel->setText(entity->message()); |
| 123 | |
| 124 | QIcon icon; |
| 125 | switch (entity->type()) { |
| 126 | case NotificationEntity::Information: |
| 127 | icon = QIcon::fromTheme("notification_info"); |
| 128 | break; |
| 129 | case NotificationEntity::Warning: |
| 130 | icon = QIcon::fromTheme("notification_warning"); |
| 131 | break; |
| 132 | case NotificationEntity::Error: |
| 133 | icon = QIcon::fromTheme("notification_error"); |
| 134 | break; |
| 135 | } |
| 136 | iconBtn->setIcon(icon); |
| 137 | |
| 138 | if (entity->actions().isEmpty()) |
| 139 | actButton->setVisible(false); |
| 140 | else |
| 141 | actButton->addButtons(entity->actions()); |
| 142 | |
| 143 | if (entity->name().isEmpty()) { |
| 144 | fromLabel->setVisible(false); |
| 145 | } else { |
| 146 | QString format(NotificationItemWidget::tr("Source: %1")); |
| 147 | fromLabel->setText(format.arg(entity->name())); |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | NotificationItemWidget::NotificationItemWidget(QWidget *parent, EntityPtr entity) |
| 152 | : QWidget(parent), |
no test coverage detected