summaryrefslogtreecommitdiffstats
path: root/klipper
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-05-10 03:04:21 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-05-10 03:04:21 +0000
commit5ccb957341daaf5c223a49391f3076e95832ac1f (patch)
tree0e23ba8717f429560881bedc107e1f6de2c78075 /klipper
parent4d3847fc45c6700ec1667d9616c8f91b734cb75d (diff)
downloadtdebase-5ccb957341daaf5c223a49391f3076e95832ac1f.tar.gz
tdebase-5ccb957341daaf5c223a49391f3076e95832ac1f.zip
Part of batch commit to enable true tasktray resize support for Trinity applications
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1124757 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'klipper')
-rw-r--r--klipper/toplevel.cpp18
-rw-r--r--klipper/toplevel.h3
2 files changed, 17 insertions, 4 deletions
diff --git a/klipper/toplevel.cpp b/klipper/toplevel.cpp
index cc5de3f63..748d4a78f 100644
--- a/klipper/toplevel.cpp
+++ b/klipper/toplevel.cpp
@@ -196,7 +196,9 @@ KlipperWidget::KlipperWidget( QWidget *parent, KConfig* config )
connect( poll, SIGNAL( clipboardChanged( bool ) ),
this, SLOT( newClipData( bool ) ) );
- m_pixmap = KSystemTray::loadIcon( "klipper" );
+ m_pixmap = KSystemTray::loadSizedIcon( "klipper", width() );
+ m_iconOrigWidth = width();
+ m_iconOrigHeight = height();
adjustSize();
globalKeys = new KGlobalAccel(this);
@@ -290,11 +292,19 @@ void KlipperWidget::mousePressEvent(QMouseEvent *e)
void KlipperWidget::paintEvent(QPaintEvent *)
{
QPainter p(this);
- int x = (width() - m_pixmap.width()) / 2;
- int y = (height() - m_pixmap.height()) / 2;
+ // Honor Free Desktop specifications that allow for arbitrary system tray icon sizes
+ if ((m_iconOrigWidth != width()) || (m_iconOrigHeight != height())) {
+ QImage newIcon;
+ m_pixmap = KSystemTray::loadSizedIcon( "klipper", width() );
+ newIcon = m_pixmap;
+ newIcon = newIcon.smoothScale(width(), height());
+ m_scaledpixmap = newIcon;
+ }
+ int x = (width() - m_scaledpixmap.width()) / 2;
+ int y = (height() - m_scaledpixmap.height()) / 2;
if ( x < 0 ) x = 0;
if ( y < 0 ) y = 0;
- p.drawPixmap(x , y, m_pixmap);
+ p.drawPixmap(x, y, m_scaledpixmap);
p.end();
}
diff --git a/klipper/toplevel.h b/klipper/toplevel.h
index 735698487..20a6a3027 100644
--- a/klipper/toplevel.h
+++ b/klipper/toplevel.h
@@ -173,6 +173,9 @@ private:
KAction* configureAction;
KAction* quitAction;
QPixmap m_pixmap;
+ QPixmap m_scaledpixmap;
+ int m_iconOrigWidth;
+ int m_iconOrigHeight;
bool bPopupAtMouse :1;
bool bKeepContents :1;
bool bURLGrabber :1;