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

List:       kde-commits
Subject:    playground/base/plasma/shells/mobile
From:       Marco Martin <notmart () gmail ! com>
Date:       2010-08-31 19:42:23
Message-ID: 20100831194223.A19B6AC857 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1170413 by mart:

the mobiledesktop creates by hand the mobile toolbox, still hacky but way less than \
before


 M  +12 -12    containments/mobiledesktop/appletscontainer.cpp  
 M  +2 -3      containments/mobiledesktop/appletscontainer.h  
 M  +0 -12     containments/mobiledesktop/mobiledesktop.cpp  
 M  +0 -3      containments/mobiledesktop/mobiledesktop.h  
 M  +0 -3      shell/mobcorona.cpp  
 M  +0 -8      shell/mobiletoolbox/mobiletoolbox.cpp  


--- trunk/playground/base/plasma/shells/mobile/containments/mobiledesktop/appletscontainer.cpp \
#1170412:1170413 @@ -32,6 +32,7 @@
 #include <KGlobalSettings>
 #include <KIconLoader>
 
+#include <Plasma/AbstractToolBox>
 #include <Plasma/Animation>
 #include <Plasma/Applet>
 #include <Plasma/Containment>
@@ -77,17 +78,21 @@
 AppletsContainer::AppletsContainer(QGraphicsItem *parent, Plasma::Containment \
*containment)  : QGraphicsWidget(parent),
    m_containment(containment),
-   m_toolBoxContainer(0),
+   m_toolBox(0),
    m_appletsOverlay(0),
    m_startupCompleted(false)
 {
     setFlag(QGraphicsItem::ItemHasNoContents);
 
-    m_toolBoxContainer = new QGraphicsWidget(this);
+    m_toolBox = Plasma::AbstractToolBox::load("org.kde.mobiletoolbox", \
QVariantList(), containment); +    QAction *a = containment->action("add widgets");
+    if (a) {
+        m_toolBox->addTool(a);
+    }
 
     m_inputBlocker = new InputBlocker(this);
     m_inputBlocker->setZValue(2000);
-    m_toolBoxContainer->setZValue(2001);
+    m_toolBox->setZValue(2001);
     m_inputBlocker->show();
 
     m_relayoutTimer = new QTimer(this);
@@ -99,11 +104,6 @@
 {
 }
 
-QGraphicsWidget *AppletsContainer::toolBoxContainer() const
-{
-    return m_toolBoxContainer;
-}
-
 Plasma::Containment *AppletsContainer::containment() const
 {
     return m_containment;
@@ -166,7 +166,7 @@
 void AppletsContainer::relayout()
 {
     if (m_applets.isEmpty()) {
-        m_toolBoxContainer->setPos(0,0);
+        m_toolBox->setPos(0,0);
         return;
     }
 
@@ -219,8 +219,8 @@
 
     int extraHeight = 0;
 
-    if (m_toolBoxContainer) {
-        QRectF buttonGeom = m_toolBoxContainer->geometry();
+    if (m_toolBox) {
+        QRectF buttonGeom = m_toolBox->geometry();
 
         if (m_applets.count() % columns != 0) {
             QRectF geom = m_applets.last()->geometry();
@@ -236,7 +236,7 @@
            extraHeight = maximumAppletSize.height();
         }
 
-        m_toolBoxContainer->setPos(buttonGeom.topLeft());
+        m_toolBox->setPos(buttonGeom.topLeft());
     }
 
     resize(size().width(), \
(ceil((qreal)m_containment->applets().count()/columns))*maximumAppletSize.height() + \
                extraHeight);
--- trunk/playground/base/plasma/shells/mobile/containments/mobiledesktop/appletscontainer.h \
#1170412:1170413 @@ -26,6 +26,7 @@
 
 namespace Plasma
 {
+    class AbstractToolBox;
     class Applet;
     class Containment;
     class IconWidget;
@@ -58,8 +59,6 @@
 
     void completeStartup();
 
-    QGraphicsWidget *toolBoxContainer() const;
-
 public Q_SLOTS:
     void layoutApplet(Plasma::Applet *applet, const QPointF &post);
     void appletRemoved(Plasma::Applet*);
@@ -78,7 +77,7 @@
 private:
     QGraphicsLinearLayout *m_layout;
     Plasma::Containment *m_containment;
-    QGraphicsWidget *m_toolBoxContainer;
+    Plasma::AbstractToolBox *m_toolBox;
     QTimer *m_relayoutTimer;
     QWeakPointer<Plasma::Applet> m_currentApplet;
     AppletsOverlay *m_appletsOverlay;
--- trunk/playground/base/plasma/shells/mobile/containments/mobiledesktop/mobiledesktop.cpp \
#1170412:1170413 @@ -70,20 +70,8 @@
     setAcceptsHoverEvents(false);
     setFlag(QGraphicsItem::ItemSendsGeometryChanges, false);
     setFlag(QGraphicsItem::ItemUsesExtendedStyleOption, false);
-
-    setToolBox(Plasma::AbstractToolBox::load(corona()->preferredToolBoxPlugin(Plasma::Containment::DesktopContainment), \
                QVariantList(), this));
-
-    QAction *a = action("add widgets");
-    if (a) {
-        addToolBoxAction(a);
     }
-}
 
-QGraphicsItem *MobileDesktop::toolBoxContainer() const
-{
-    return m_container->toolBoxContainer();
-}
-
 void MobileDesktop::constraintsEvent(Plasma::Constraints constraints)
 {
     if (constraints & Plasma::SizeConstraint) {
--- trunk/playground/base/plasma/shells/mobile/containments/mobiledesktop/mobiledesktop.h \
#1170412:1170413 @@ -35,7 +35,6 @@
 class MobileDesktop : public Plasma::Containment
 {
     Q_OBJECT
-    Q_PROPERTY(QGraphicsItem *toolBoxContainer READ toolBoxContainer)
 
 public:
     MobileDesktop(QObject *parent, const QVariantList &args);
@@ -44,8 +43,6 @@
 
     void constraintsEvent(Plasma::Constraints constraints);
 
-    QGraphicsItem *toolBoxContainer() const;
-
 protected:
     void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
     void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
--- trunk/playground/base/plasma/shells/mobile/shell/mobcorona.cpp #1170412:1170413
@@ -51,9 +51,6 @@
 
 void MobCorona::init()
 {
-    setPreferredToolBoxPlugin(Plasma::Containment::DesktopContainment, \
                "org.kde.mobiletoolbox");
-    setPreferredToolBoxPlugin(Plasma::Containment::CustomContainment, \
                "org.kde.mobiletoolbox");
-
     Plasma::ContainmentActionsPluginsConfig desktopPlugins;
     desktopPlugins.addPlugin(Qt::NoModifier, Qt::Vertical, "switchdesktop");
     desktopPlugins.addPlugin(Qt::NoModifier, Qt::RightButton, "contextmenu");
--- trunk/playground/base/plasma/shells/mobile/shell/mobiletoolbox/mobiletoolbox.cpp \
#1170412:1170413 @@ -46,14 +46,6 @@
 
 void MobileToolBox::init()
 {
-   QGraphicsItem *item = \
                m_containment->property("toolBoxContainer").value<QGraphicsItem *>();
-
-    if (item) {
-        setParentItem(item);
-    } else {
-        deleteLater();
-    }
-
     m_showing = false;
     m_containment = containment();
     Q_ASSERT(m_containment);


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

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