* @brief Drops all events and resets unread count. */
| 276 | * @brief Drops all events and resets unread count. |
| 277 | */ |
| 278 | void DataModel::NotificationCenter::clearAll() |
| 279 | { |
| 280 | if (m_history.empty() && m_unreadCount == 0) |
| 281 | return; |
| 282 | |
| 283 | m_history.clear(); |
| 284 | m_lastSeen.clear(); |
| 285 | m_channelCounts.clear(); |
| 286 | |
| 287 | const bool hadUnread = m_unreadCount > 0; |
| 288 | m_unreadCount = 0; |
| 289 | |
| 290 | Q_EMIT historyCleared(); |
| 291 | Q_EMIT channelsChanged(); |
| 292 | if (hadUnread) |
| 293 | Q_EMIT unreadCountChanged(); |
| 294 | } |
| 295 | |
| 296 | /** |
| 297 | * @brief Clears the unread badge counter without touching history. |