[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/containments/panel
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2009-07-03 3:15:47
Message-ID: 1246590947.840250.20090.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 990708 by aseigo:

we only care about adjusting to the old margin when the theme changes; in all other \
cases we should simple care about what the borders are now. BUG:198712


 M  +17 -8     panel.cpp  
 M  +1 -1      panel.h  


--- trunk/KDE/kdebase/workspace/plasma/containments/panel/panel.cpp #990707:990708
@@ -462,7 +462,7 @@
     }
 }
 
-void Panel::updateBorders(const QRect &geom)
+void Panel::updateBorders(const QRect &geom, bool themeChange)
 {
     Plasma::Location loc = location();
     FrameSvg::EnabledBorders enabledBorders = FrameSvg::AllBorders;
@@ -509,10 +509,12 @@
             enabledBorders ^= FrameSvg::LeftBorder;
             leftWidth = 0;
         }
+
         if (geom.y() <= r.y()) {
             enabledBorders ^= FrameSvg::TopBorder;
             topHeight = 0;
         }
+
         if (geom.bottom() >= r.bottom()) {
             enabledBorders ^= FrameSvg::BottomBorder;
             bottomHeight = 0;
@@ -558,18 +560,25 @@
         default:
             break;
         }
-        qreal oldLeft, oldTop, oldRight, oldBottom;
-        layout()->getContentsMargins(&oldLeft, &oldTop, &oldRight, &oldBottom);
 
+        qreal oldLeft = leftWidth;
+        qreal oldTop = topHeight;
+        qreal oldRight = rightWidth;
+        qreal oldBottom = bottomHeight;
+
+        if (themeChange) {
+            layout()->getContentsMargins(&oldLeft, &oldTop, &oldRight, &oldBottom);
+        }
+
         layout()->setContentsMargins(leftWidth, topHeight, rightWidth, \
                bottomHeight);
-
         if (formFactor() == Plasma::Vertical) {
-            setPreferredHeight(preferredHeight() - (oldBottom-bottomHeight));
+            setPreferredHeight(preferredHeight() - (oldBottom - bottomHeight));
         } else if (QApplication::layoutDirection() == Qt::LeftToRight) {
-            setPreferredWidth(preferredWidth() - (oldRight-rightWidth));
+            setPreferredWidth(preferredWidth() - (oldRight - rightWidth));
         } else {
-            setPreferredWidth(preferredWidth() - (oldLeft-leftWidth));
+            setPreferredWidth(preferredWidth() - (oldLeft - leftWidth));
         }
+
         layout()->invalidate();
         resize(preferredSize());
     }
@@ -693,7 +702,7 @@
         setMinimumHeight(newSize.height());
     }
 
-    updateBorders(geometry().toRect());
+    updateBorders(geometry().toRect(), true);
 }
 
 void Panel::paintInterface(QPainter *painter,
--- trunk/KDE/kdebase/workspace/plasma/containments/panel/panel.h #990707:990708
@@ -75,7 +75,7 @@
     /**
      * recalculate which borders to show
      */
-    void updateBorders(const QRect &geom);
+    void updateBorders(const QRect &geom, bool themeChange = false);
 
     Plasma::FrameSvg *m_background;
     QMenu *m_addPanelsMenu;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic