diff --git a/app/SysTray-X/SysTray-X-app/systrayxicon.cpp b/app/SysTray-X/SysTray-X-app/systrayxicon.cpp index 25e21fe..22b0a8b 100644 --- a/app/SysTray-X/SysTray-X-app/systrayxicon.cpp +++ b/app/SysTray-X/SysTray-X-app/systrayxicon.cpp @@ -303,8 +303,18 @@ void SysTrayXIcon::setMailCount( int unread_mail, int new_mail ) void SysTrayXIcon::renderIcon() { QPixmap pixmap; + int count; - if( m_unread_mail > 0 || m_new_mail > 0 ) + if( m_pref->getCountType() == Preferences::PREF_COUNT_UNREAD ) + { + count = m_unread_mail; + } + else + { + count = m_new_mail; + } + + if( count > 0 ) { switch( m_icon_type ) { @@ -394,7 +404,7 @@ void SysTrayXIcon::renderIcon() } } - if( m_show_number && ( m_unread_mail > 0 || m_new_mail > 0 ) ) + if( m_show_number && count > 0 ) { /* * Paint the number @@ -417,9 +427,7 @@ void SysTrayXIcon::renderIcon() QRect bounding = pixmap.rect().adjusted( m_number_margins.left(), m_number_margins.top(), -m_number_margins.right(), -m_number_margins.bottom()); - -// TODO: check pref for type - painter.drawText( bounding, m_number_alignment, QString::number( m_unread_mail ) ); + painter.drawText( bounding, m_number_alignment, QString::number( count ) ); } /* diff --git a/app/SysTray-X/SysTray-X-app/systrayxstatusnotifier.cpp b/app/SysTray-X/SysTray-X-app/systrayxstatusnotifier.cpp index 859baa4..10f67eb 100644 --- a/app/SysTray-X/SysTray-X-app/systrayxstatusnotifier.cpp +++ b/app/SysTray-X/SysTray-X-app/systrayxstatusnotifier.cpp @@ -349,8 +349,18 @@ void SysTrayXStatusNotifier::setMailCount( int unread_mail, int new_mail ) void SysTrayXStatusNotifier::renderIcon() { QPixmap pixmap; + int count; - if( m_unread_mail > 0 || m_new_mail > 0 ) + if( m_pref->getCountType() == Preferences::PREF_COUNT_UNREAD ) + { + count = m_unread_mail; + } + else + { + count = m_new_mail; + } + + if( count > 0 ) { switch( m_icon_type ) { @@ -439,7 +449,7 @@ void SysTrayXStatusNotifier::renderIcon() } } - if( m_show_number && ( m_unread_mail > 0 || m_new_mail > 0 ) ) + if( m_show_number && count > 0 ) { /* * Paint the number @@ -462,8 +472,7 @@ void SysTrayXStatusNotifier::renderIcon() QRect bounding = pixmap.rect().adjusted( m_number_margins.left(), m_number_margins.top(), -m_number_margins.right(), -m_number_margins.bottom()); -// TODO pref to get the type - painter.drawText( bounding, m_number_alignment, QString::number( m_unread_mail ) ); + painter.drawText( bounding, m_number_alignment, QString::number( count ) ); } /* @@ -474,7 +483,7 @@ void SysTrayXStatusNotifier::renderIcon() /* * Hide the icon? */ - if( m_hide_default_icon && m_unread_mail == 0 && m_new_mail == 0 ) + if( m_hide_default_icon && count == 0 ) { setStatus( KStatusNotifierItem::ItemStatus::Passive ); }