summaryrefslogtreecommitdiffstats
path: root/akregator/src
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-06-23 02:17:48 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-06-23 02:18:48 -0500
commit5f8b00b9567d41d1f4681e2240528b9fce2d7b3b (patch)
tree507cae4a17c331c56aeaf5e9ef2978c13064af9b /akregator/src
parentc830701a444a8f4f1ce8ce55fa7c1aff083ee5cc (diff)
downloadtdepim-5f8b00b9567d41d1f4681e2240528b9fce2d7b3b.tar.gz
tdepim-5f8b00b9567d41d1f4681e2240528b9fce2d7b3b.zip
Use the largest possible font for the unread display in kmail and akregator if the tray icon size is less than 22 pixels
This resolves Bug 1251
Diffstat (limited to 'akregator/src')
-rw-r--r--akregator/src/trayicon.cpp35
-rw-r--r--akregator/src/trayicon.h16
2 files changed, 40 insertions, 11 deletions
diff --git a/akregator/src/trayicon.cpp b/akregator/src/trayicon.cpp
index fc26cadeb..240e2d5b5 100644
--- a/akregator/src/trayicon.cpp
+++ b/akregator/src/trayicon.cpp
@@ -123,22 +123,34 @@ TQPixmap TrayIcon::takeScreenshot() const
return shot; // not finalShot?? -fo
}
+void TrayIcon::resizeEvent(TQResizeEvent *)
+{
+ setUnread(m_unread, true);
+}
+
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;
-
+ }
+
m_unread=unread;
-
+
TQToolTip::remove(this);
TQToolTip::add(this, i18n("Akregator - 1 unread article", "Akregator - %n unread articles", unread > 0 ? unread : 0));
-
+
if (unread <= 0)
- {
+ {
setPixmap(m_defaultIcon);
}
else
- {
+ {
// from KMSystemTray
int oldW = pixmap()->size().width();
int oldH = pixmap()->size().height();
@@ -146,6 +158,17 @@ void TrayIcon::slotSetUnread(int unread)
TQString uStr=TQString::number( unread );
TQFont f=TDEGlobalSettings::generalFont();
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();
TQFontMetrics fm(f);
int w=fm.width(uStr);
diff --git a/akregator/src/trayicon.h b/akregator/src/trayicon.h
index e491fdaca..7c854666e 100644
--- a/akregator/src/trayicon.h
+++ b/akregator/src/trayicon.h
@@ -35,27 +35,33 @@ namespace Akregator
class TrayIcon : public KSystemTray
{
Q_OBJECT
-
+
public:
static TrayIcon* getInstance();
static void setInstance(TrayIcon* trayIcon);
-
+
TrayIcon(TQWidget *parent = 0, const char *name = 0);
~TrayIcon();
-
+
TQPixmap takeScreenshot() const;
virtual void mousePressEvent(TQMouseEvent *);
+
public slots:
void settingsChanged();
void slotSetUnread(int unread);
void viewButtonClicked();
-
+
+ protected:
+ void resizeEvent(TQResizeEvent *);
+
signals:
void showPart();
private:
+ void setUnread(int unread, bool force);
+
static TrayIcon* m_instance;
-
+
TQPixmap m_defaultIcon;
TQImage m_lightIconImage;
int m_unread;