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

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/plasma
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2008-04-07 9:18:03
Message-ID: 1207559883.010892.6809.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 794395 by aseigo:

adapt to the new id/config system:
* take an id in the view ctors
* restore the view/id mapping on restart
* save the view/id mappings on app shutdown


 M  +2 -2      desktopview.cpp  
 M  +1 -1      desktopview.h  
 M  +2 -2      panelview.cpp  
 M  +1 -1      panelview.h  
 M  +26 -2     plasmaapp.cpp  
 M  +2 -2      rootwidget.cpp  
 M  +1 -1      rootwidget.h  


--- trunk/KDE/kdebase/workspace/plasma/plasma/desktopview.cpp #794394:794395
@@ -39,8 +39,8 @@
 #include "dashboardview.h"
 #include "plasmaapp.h"
 
-DesktopView::DesktopView(Plasma::Containment *containment, QWidget *parent)
-    : Plasma::View(containment, parent),
+DesktopView::DesktopView(Plasma::Containment *containment, int id, QWidget *parent)
+    : Plasma::View(containment, id, parent),
       m_zoomLevel(Plasma::DesktopZoom),
       m_dashboard(0)
 {
--- trunk/KDE/kdebase/workspace/plasma/plasma/desktopview.h #794394:794395
@@ -35,7 +35,7 @@
     Q_OBJECT
 
 public:
-    DesktopView(Plasma::Containment *containment, QWidget *parent);
+    DesktopView(Plasma::Containment *containment, int id, QWidget *parent);
     ~DesktopView();
 
 public slots:
--- trunk/KDE/kdebase/workspace/plasma/plasma/panelview.cpp #794394:794395
@@ -33,8 +33,8 @@
 
 #include "plasmaapp.h"
 
-PanelView::PanelView(Plasma::Containment *panel, QWidget *parent)
-    : Plasma::View(panel, parent)
+PanelView::PanelView(Plasma::Containment *panel, int id, QWidget *parent)
+    : Plasma::View(panel, id, parent)
 {
     Q_ASSERT(qobject_cast<Plasma::Corona*>(panel->scene()));
     updatePanelGeometry();
--- trunk/KDE/kdebase/workspace/plasma/plasma/panelview.h #794394:794395
@@ -41,7 +41,7 @@
     * Constructs a new panelview.
     * @arg parent the QWidget this panel is parented to
     */
-    explicit PanelView(Plasma::Containment *panel, QWidget *parent = 0);
+    explicit PanelView(Plasma::Containment *panel, int id = 0, QWidget *parent = 0);
 
     /**
      * Sets the location (screen edge) where this panel is positioned.
--- trunk/KDE/kdebase/workspace/plasma/plasma/plasmaapp.cpp #794394:794395
@@ -224,6 +224,25 @@
         m_corona->saveApplets();
     }
 
+    // save the mapping of Views to Containments at the moment
+    // of application exit so we can restore that when we start again.
+    KConfigGroup viewIds(KGlobal::config(), "ViewIds");
+    viewIds.deleteGroup();
+
+    foreach (PanelView *v, m_panels) {
+        if (v->containment()) {
+            viewIds.writeEntry(QString::number(v->containment()->id()), v->id());
+        }
+    }
+
+    int numScreens = QApplication::desktop()->numScreens();
+    for (int i = 0; i < numScreens; ++i) {
+        DesktopView *v = m_root->viewForScreen(i);
+        if (v && v->containment()) {
+            viewIds.writeEntry(QString::number(v->containment()->id()), v->id());
+        }
+    }
+
     delete m_root;
     m_root = 0;
     QList<PanelView*> panels = m_panels;
@@ -336,9 +355,14 @@
              << "| geometry:" << containment->geometry()
              << "| zValue:" << containment->zValue();
 
+    // find the mapping of View to Containment, if any,
+    // so we can restore things on start.
+    KConfigGroup viewIds(KGlobal::config(), "ViewIds");
+    int id = viewIds.readEntry(QString::number(containment->id()), 0);
+
     switch (containment->containmentType()) {
         case Plasma::Containment::PanelContainment: {
-            PanelView *panelView = new PanelView(containment);
+            PanelView *panelView = new PanelView(containment, id);
             connect(panelView, SIGNAL(destroyed(QObject*)), this, SLOT(panelRemoved(QObject*)));
             m_panels << panelView;
             panelView->show();
@@ -347,7 +371,7 @@
         default:
             if (containment->screen() > -1 &&
                 containment->screen() < QApplication::desktop()->numScreens()) {
-                m_root->createDesktopView(containment);
+                m_root->createDesktopView(containment, id);
             }
             break;
     }
--- trunk/KDE/kdebase/workspace/plasma/plasma/rootwidget.cpp #794394:794395
@@ -133,7 +133,7 @@
     return 0;
 }
 
-void RootWidget::createDesktopView(Plasma::Containment *containment)
+void RootWidget::createDesktopView(Plasma::Containment *containment, int id)
 {
     if (viewForScreen(containment->screen())) {
         // we already have a view for this screen
@@ -144,7 +144,7 @@
         << QApplication::desktop()->numScreens() << "screens";
 
     // we have a new screen. neat.
-    DesktopView *view = new DesktopView(containment, this);
+    DesktopView *view = new DesktopView(containment, id, this);
     view->setGeometry(QApplication::desktop()->screenGeometry(containment->screen()));
     m_desktops.append(view);
     view->show();
--- trunk/KDE/kdebase/workspace/plasma/plasma/rootwidget.h #794394:794395
@@ -62,7 +62,7 @@
         /**
          * Creates a view for the given containment
          */
-        void createDesktopView(Plasma::Containment *containment);
+        void createDesktopView(Plasma::Containment *containment, int id = 0);
 
         /**
          * Returns the view, if any, for the given screen
[prev in list] [next in list] [prev in thread] [next in thread] 

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