|
|
@ -123,22 +123,34 @@ TQPixmap TrayIcon::takeScreenshot() const
|
|
|
|
return shot; // not finalShot?? -fo
|
|
|
|
return shot; // not finalShot?? -fo
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TrayIcon::resizeEvent(TQResizeEvent *)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
setUnread(m_unread, true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void TrayIcon::slotSetUnread(int unread)
|
|
|
|
void TrayIcon::slotSetUnread(int unread)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (unread==m_unread)
|
|
|
|
setUnread(unread, false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TrayIcon::setUnread(int unread, bool force)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if ((unread==m_unread) && (!force))
|
|
|
|
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
m_unread=unread;
|
|
|
|
m_unread=unread;
|
|
|
|
|
|
|
|
|
|
|
|
TQToolTip::remove(this);
|
|
|
|
TQToolTip::remove(this);
|
|
|
|
TQToolTip::add(this, i18n("Akregator - 1 unread article", "Akregator - %n unread articles", unread > 0 ? unread : 0));
|
|
|
|
TQToolTip::add(this, i18n("Akregator - 1 unread article", "Akregator - %n unread articles", unread > 0 ? unread : 0));
|
|
|
|
|
|
|
|
|
|
|
|
if (unread <= 0)
|
|
|
|
if (unread <= 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
setPixmap(m_defaultIcon);
|
|
|
|
setPixmap(m_defaultIcon);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// from KMSystemTray
|
|
|
|
// from KMSystemTray
|
|
|
|
int oldW = pixmap()->size().width();
|
|
|
|
int oldW = pixmap()->size().width();
|
|
|
|
int oldH = pixmap()->size().height();
|
|
|
|
int oldH = pixmap()->size().height();
|
|
|
@ -146,6 +158,17 @@ void TrayIcon::slotSetUnread(int unread)
|
|
|
|
TQString uStr=TQString::number( unread );
|
|
|
|
TQString uStr=TQString::number( unread );
|
|
|
|
TQFont f=TDEGlobalSettings::generalFont();
|
|
|
|
TQFont f=TDEGlobalSettings::generalFont();
|
|
|
|
f.setBold(true);
|
|
|
|
f.setBold(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// increase the size of the font for the number of unread messages if the
|
|
|
|
|
|
|
|
// icon size is less than 22 pixels
|
|
|
|
|
|
|
|
// see bug 1251
|
|
|
|
|
|
|
|
int realIconHeight = height();
|
|
|
|
|
|
|
|
if (realIconHeight < 22) {
|
|
|
|
|
|
|
|
f.setPointSizeFloat( f.pointSizeFloat() * 2.0 );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// decrease the size of the font for the number of unread articles if the
|
|
|
|
|
|
|
|
// number doesn't fit into the available space
|
|
|
|
float pointSize=f.pointSizeFloat();
|
|
|
|
float pointSize=f.pointSizeFloat();
|
|
|
|
TQFontMetrics fm(f);
|
|
|
|
TQFontMetrics fm(f);
|
|
|
|
int w=fm.width(uStr);
|
|
|
|
int w=fm.width(uStr);
|
|
|
|