From 06cacc13d1ddcc4fb7f9dcd21debe826107fac5a Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Sat, 1 Jul 2017 16:34:36 +0300 Subject: Show unread count on MacOs toolbar --- src/TrayIcon.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') diff --git a/src/TrayIcon.cc b/src/TrayIcon.cc index beaf00df..7e649077 100644 --- a/src/TrayIcon.cc +++ b/src/TrayIcon.cc @@ -20,6 +20,10 @@ #include "TrayIcon.h" +#if defined(Q_OS_MAC) +#include +#endif + MsgCountComposedIcon::MsgCountComposedIcon(const QString &filename) : QIconEngine() { @@ -91,10 +95,17 @@ TrayIcon::TrayIcon(const QString &filename, QWidget *parent) void TrayIcon::setUnreadCount(int count) { +#if defined(Q_OS_MAC) + if (count == 0) + QtMac::setBadgeLabelText(""); + else + QtMac::setBadgeLabelText(QString::number(count)); +#else MsgCountComposedIcon *tmp = static_cast(icon_->clone()); tmp->msgCount = count; setIcon(QIcon(tmp)); icon_ = tmp; +#endif } -- cgit 1.5.1