diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-05-10 03:04:21 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-05-10 03:04:21 +0000 |
commit | 5ccb957341daaf5c223a49391f3076e95832ac1f (patch) | |
tree | 0e23ba8717f429560881bedc107e1f6de2c78075 /klipper/toplevel.cpp | |
parent | 4d3847fc45c6700ec1667d9616c8f91b734cb75d (diff) | |
download | tdebase-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/toplevel.cpp')
-rw-r--r-- | klipper/toplevel.cpp | 18 |
1 files changed, 14 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(); } |