}
#endif
- connect(QtUi::instance(), SIGNAL(iconThemeRefreshed()), this, SLOT(refreshIcons()));
+ connect(this, SIGNAL(iconsChanged()), this, SLOT(refreshIcons()));
refreshIcons();
// Our own SNI service
_statusNotifierItemDBus = new StatusNotifierItemDBus(this);
+ connect(this, SIGNAL(currentIconNameChanged()), _statusNotifierItemDBus, SIGNAL(NewIcon()));
+ connect(this, SIGNAL(currentIconNameChanged()), _statusNotifierItemDBus, SIGNAL(NewAttentionIcon()));
connect(this, SIGNAL(toolTipChanged(QString, QString)), _statusNotifierItemDBus, SIGNAL(NewToolTip()));
- connect(this, SIGNAL(animationEnabledChanged(bool)), _statusNotifierItemDBus, SIGNAL(NewAttentionIcon()));
// Service watcher to keep track of the StatusNotifierWatcher service
QDBusServiceWatcher *watcher = new QDBusServiceWatcher(kSniWatcherService,
setMode(Mode::Legacy);
}
+
void StatusNotifierItem::refreshIcons()
{
#if QT_VERSION >= 0x050000
void StatusNotifierItem::onModeChanged(Mode mode)
{
if (mode == Mode::StatusNotifier) {
- _statusNotifierItemDBus->registerService();
+ _statusNotifierItemDBus->registerTrayIcon();
registerToWatcher();
}
else {
- _statusNotifierItemDBus->unregisterService();
+ _statusNotifierItemDBus->unregisterTrayIcon();
}
}
void StatusNotifierItem::onStateChanged(State state)
{
if (mode() == Mode::StatusNotifier) {
- emit _statusNotifierItemDBus->NewIcon();
emit _statusNotifierItemDBus->NewStatus(metaObject()->enumerator(metaObject()->indexOfEnumerator("State")).valueToKey(state));
}
}
{
if (mode() == Mode::StatusNotifier) {
if (isVisible) {
- _statusNotifierItemDBus->registerService();
+ _statusNotifierItemDBus->registerTrayIcon();
registerToWatcher();
}
else {
- _statusNotifierItemDBus->unregisterService();
+ _statusNotifierItemDBus->unregisterTrayIcon();
}
}
}
QString StatusNotifierItem::iconName() const
{
- if (state() == Passive) {
- return SystemTray::iconName(State::Passive);
- }
- else {
- return SystemTray::iconName(State::Active);
- }
+ return currentIconName();
}
QString StatusNotifierItem::attentionIconName() const
{
- if (animationEnabled()) {
- return SystemTray::iconName(State::NeedsAttention);
- }
- else {
- return SystemTray::iconName(State::NeedsAttention);
- }
+ return currentAttentionIconName();
}