[calligra] libs: Remember the lock state of the dockers

Boudewijn Rempt boud at valdyas.org
Wed May 21 10:22:01 UTC 2014


Git commit 15e381914d7b328207d367cc03789e85d785a1cc by Boudewijn Rempt.
Committed on 21/05/2014 at 10:21.
Pushed by rempt into branch 'master'.

Remember the lock state of the dockers

BUG:325928

Now we just need some pretty lock/unlock icons of the right size!
CCMAIL:kimageshop at kde.org

M  +6    -0    libs/main/KoMainWindow.cpp
M  +10   -0    libs/widgets/KoDockWidgetTitleBar.cpp
M  +1    -1    libs/widgets/KoDockWidgetTitleBar.h

http://commits.kde.org/calligra/15e381914d7b328207d367cc03789e85d785a1cc

diff --git a/libs/main/KoMainWindow.cpp b/libs/main/KoMainWindow.cpp
index 95972ed..56d043a 100644
--- a/libs/main/KoMainWindow.cpp
+++ b/libs/main/KoMainWindow.cpp
@@ -1200,6 +1200,7 @@ void KoMainWindow::saveWindowSettings()
             if (i.value()->widget()) {
                 KConfigGroup dockGroup = group.group(QString("DockWidget ") + i.key());
                 dockGroup.writeEntry("Collapsed", i.value()->widget()->isHidden());
+                dockGroup.writeEntry("Locked", i.value()->property("Locked").toBool());
                 dockGroup.writeEntry("DockArea", (int) dockWidgetArea(i.value()));
             }
         }
@@ -1857,12 +1858,17 @@ QDockWidget* KoMainWindow::createDockWidget(KoDockFactoryBase* factory)
         }
 
         bool collapsed = factory->defaultCollapsed();
+        bool locked = false;
         if (rootDocument()) {
             KConfigGroup group = KGlobal::config()->group(d->rootPart->componentData().componentName()).group("DockWidget " + factory->id());
             collapsed = group.readEntry("Collapsed", collapsed);
+            locked = group.readEntry("Locked", locked);
         }
         if (titleBar && collapsed)
             titleBar->setCollapsed(true);
+        if (titleBar && locked)
+            titleBar->setLocked(true);
+
         d->dockWidgetsMap.insert(factory->id(), dockWidget);
     } else {
         dockWidget = d->dockWidgetsMap[ factory->id()];
diff --git a/libs/widgets/KoDockWidgetTitleBar.cpp b/libs/widgets/KoDockWidgetTitleBar.cpp
index 89f5dae..e7813c4 100644
--- a/libs/widgets/KoDockWidgetTitleBar.cpp
+++ b/libs/widgets/KoDockWidgetTitleBar.cpp
@@ -234,6 +234,15 @@ void KoDockWidgetTitleBar::setCollapsed(bool collapsed)
         d->toggleCollapsed();
 }
 
+void KoDockWidgetTitleBar::setLocked(bool locked)
+{
+    QDockWidget *q = qobject_cast<QDockWidget*>(parentWidget());
+
+    if (q && q->widget() && d->locked != locked)
+        d->toggleLocked();
+}
+
+
 void KoDockWidgetTitleBar::setCollapsable(bool collapsable)
 {
     d->collapseButton->setVisible(collapsable);
@@ -288,6 +297,7 @@ void KoDockWidgetTitleBar::Private::toggleLocked()
         floatButton->setEnabled(true);
         collapseButton->setEnabled(true);
     }
+    q->setProperty("Locked", locked);
 
 }
 
diff --git a/libs/widgets/KoDockWidgetTitleBar.h b/libs/widgets/KoDockWidgetTitleBar.h
index f55592a..4f2f08b 100644
--- a/libs/widgets/KoDockWidgetTitleBar.h
+++ b/libs/widgets/KoDockWidgetTitleBar.h
@@ -40,7 +40,7 @@ public:
     virtual QSize sizeHint() const;  ///< reimplemented from QWidget
 
     void setCollapsed(bool collapsed);
-
+    void setLocked(bool locked);
     void setCollapsable(bool collapsable);
 
     enum TextVisibilityMode {TextCanBeInvisible, FullTextAlwaysVisible};


More information about the kimageshop mailing list