summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2023-06-04 03:51:58 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2023-06-08 22:32:13 +0200
commit838b091acd07b681fc52f6f705b2bee8ce8519d5 (patch)
tree79457c544d8bd78a5badfefbf1ac88d2a3006104 /src
parentUse Badge function on non-dbus systems (diff)
downloadnheko-838b091acd07b681fc52f6f705b2bee8ce8519d5.tar.xz
Remove MacExtras include
Diffstat (limited to 'src')
-rw-r--r--src/TrayIcon.cpp31
1 files changed, 1 insertions, 30 deletions
diff --git a/src/TrayIcon.cpp b/src/TrayIcon.cpp
index 5d500553..8eaf522e 100644
--- a/src/TrayIcon.cpp
+++ b/src/TrayIcon.cpp
@@ -12,10 +12,6 @@
 
 #include "TrayIcon.h"
 
-#if defined(Q_OS_MAC)
-#include <QtMacExtras>
-#endif
-
 MsgCountComposedIcon::MsgCountComposedIcon(const QString &filename)
   : QIconEngine()
   , icon_{QIcon{filename}}
@@ -125,30 +121,5 @@ TrayIcon::TrayIcon(const QString &filename, QWindow *parent)
 void
 TrayIcon::setUnreadCount(int count)
 {
-// Use the native badge counter in MacOS.
-#if defined(Q_OS_MAC)
-// currently, to avoid writing obj-c code, ignore deprecated warnings on the badge functions
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
-    auto labelText = count == 0 ? "" : QString::number(count);
-
-    if (labelText == QtMac::badgeLabelText())
-        return;
-
-    QtMac::setBadgeLabelText(labelText);
-#pragma clang diagnostic pop
-#elif defined(Q_OS_WIN)
-// FIXME: Find a way to use Windows apis for the badge counter (if any).
-#else
-    if (count == icon_->msgCount)
-        return;
-
-    // Custom drawing on Linux.
-    MsgCountComposedIcon *tmp = static_cast<MsgCountComposedIcon *>(icon_->clone());
-    tmp->msgCount             = count;
-
-    setIcon(QIcon(tmp));
-
-    icon_ = tmp;
-#endif
+    qGuiApp->setBadgeNumber(count);
 }