[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:       2007-10-02 15:46:53
Message-ID: 1191340013.680467.22346.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 720162 by aseigo:

use constraintsUpdated rather than trying to override the non-virtual setLocation.


 M  +27 -24    panel.cpp  
 M  +5 -16     panel.h  


--- trunk/KDE/kdebase/workspace/plasma/containments/panel/panel.cpp #720161:720162
@@ -48,35 +48,38 @@
     delete m_background;
 }
 
-void Panel::setLocation(Plasma::Location location)
+void Panel::constraintsUpdated(Plasma::Constraints constraints)
 {
-    Containment::setLocation(location);
-    kDebug() << "Setting location to" << location;
-    QDesktopWidget desktop;
-    int x = 0;
-    int y = 0;
-    int width = 0;
-    int height = 0;
-    if (location == BottomEdge || location == TopEdge) {
-        setFormFactor(Plasma::Horizontal);
+    if (constraints & Plasma::LocationConstraint) {
+        Plasma::Location loc = location();
+        kDebug() << "Setting location to" << loc;
 
-        width = desktop.screenGeometry().width();
-        height = 48;
-        kDebug() << "Width:" << width << ", height:" << height;
-        if (location == BottomEdge) {
-            y = desktop.screenGeometry().height() - height;
-        }
-    } else if (location == LeftEdge || location == RightEdge) {
-        setFormFactor(Plasma::Vertical);
+        QDesktopWidget desktop;
+        int x = 0;
+        int y = 0;
+        int width = 0;
+        int height = 0;
+        if (loc == BottomEdge || loc == TopEdge) {
+            setFormFactor(Plasma::Horizontal);
 
-        width = 48;
-        height = desktop.screenGeometry().height();
-        if (location == RightEdge) {
-            x = desktop.screenGeometry().width() - width;
+            width = desktop.screenGeometry().width();
+            height = 48;
+            kDebug() << "Width:" << width << ", height:" << height;
+            if (loc == BottomEdge) {
+                y = desktop.screenGeometry().height() - height;
+            }
+        } else if (loc == LeftEdge || loc == RightEdge) {
+            setFormFactor(Plasma::Vertical);
+
+            width = 48;
+            height = desktop.screenGeometry().height();
+            if (loc == RightEdge) {
+                x = desktop.screenGeometry().width() - width;
+            }
         }
+        kDebug() << "Setting geometry to" << QRectF(x, y, width, height);
+        setGeometry(QRectF(x, y, width, height));
     }
-    kDebug() << "Setting geometry to" << QRectF(x, y, width, height);
-    setGeometry(QRectF(x, y, width, height));
 }
 
 Qt::Orientations Panel::expandingDirections() const
--- trunk/KDE/kdebase/workspace/plasma/containments/panel/panel.h #720161:720162
@@ -33,24 +33,13 @@
     Panel(QObject *parent, const QVariantList &args);
     ~Panel();
 
-    /**
-     * Sets the location (screen edge) where this panel is positioned.
-     *
-     * Valid values are TopEdge, RightEdge, BottomEdge and LeftEdge.
-     * This will set the correct FormFactor.
-     *
-     * @param location the location to place the panel at
-     */
-    //FIXME: I don't this works, as setLocation isn't virtual
-    //       but for now it's useful from the constructor
-    void setLocation(Plasma::Location location);
+    void constraintsUpdated(Plasma::Constraints constraints);
+    Qt::Orientations expandingDirections() const;
 
-    virtual Qt::Orientations expandingDirections() const;
+    void paintInterface(QPainter *painter,
+                        const QStyleOptionGraphicsItem *option,
+                        const QRect& contentsRect);
 
-    virtual void paintInterface(QPainter *painter,
-                                const QStyleOptionGraphicsItem *option,
-                                const QRect& contentsRect);
-
 private:
     Plasma::Svg *m_background;
 };
[prev in list] [next in list] [prev in thread] [next in thread] 

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