Branch: master

1574938e 2014-07-13 11:42:33 Slávek Banko
Fix invisible Klipper tray icon
M klipper/toplevel.cpp
diff --git a/klipper/toplevel.cpp b/klipper/toplevel.cpp
index d46d867..7ebcd14 100644
--- a/klipper/toplevel.cpp
+++ b/klipper/toplevel.cpp
@@ -196,23 +196,14 @@
     connect( poll, TQT_SIGNAL( clipboardChanged( bool ) ),
              this, TQT_SLOT( newClipData( bool ) ) );
 
-    if ( isApplet() ) {
+    if ( isApplet() || !isShown() ) {
         m_pixmap = KSystemTray::loadIcon( "klipper" );
-        m_iconOrigWidth = width();
-        m_iconOrigHeight = height();
     }
     else {
-        if (isShown()) {
-            m_pixmap = KSystemTray::loadSizedIcon( "klipper", width() );
-            m_iconOrigWidth = width();
-            m_iconOrigHeight = height();
-        }
-        else {
-            m_pixmap = KSystemTray::loadIcon( "klipper" );
-            m_iconOrigWidth = m_pixmap.width();
-            m_iconOrigHeight = m_pixmap.height();
-        }
+        m_pixmap = KSystemTray::loadSizedIcon( "klipper", width() );
     }
+    m_iconOrigWidth = m_pixmap.width();
+    m_iconOrigHeight = m_pixmap.height();
     adjustSize();
 
     globalKeys = new TDEGlobalAccel(TQT_TQOBJECT(this));
@@ -307,8 +298,11 @@
 {
     TQPainter p(this);
     // Honor Free Desktop specifications that allow for arbitrary system tray icon sizes
-    if ((m_iconOrigWidth != width()) || (m_iconOrigHeight != height())) {
+    if (m_scaledpixmap.isNull() ||
+        (m_iconOrigWidth != width()) || (m_iconOrigHeight != height())) {
         TQImage newIcon;
+        m_iconOrigWidth = width();
+        m_iconOrigHeight = height();
         m_pixmap = KSystemTray::loadSizedIcon( "klipper", width() );
         newIcon = m_pixmap;
         newIcon = newIcon.smoothScale(width(), height());