[CREATE] [calligra] krita/ui/openrastertk: Implement support for loading/saving layer locks in ora

Boudewijn Rempt boud at valdyas.org
Sun Mar 25 03:41:20 PDT 2012


Git commit eb246b9c51e222410475af97139335431feec7dd by Boudewijn Rempt.
Committed on 25/03/2012 at 12:39.
Pushed by rempt into branch 'master'.

Implement support for loading/saving layer locks in ora

Following spec proposed by Adrew Chadwick, see

http://www.freedesktop.org/wiki/Specifications/OpenRaster/Draft/LayerEditLockingStatus

CCMAIL:a.t.chadwick at gmail.com
CCMAIL:create at lists.freedesktop.org

M  +4    -1    krita/ui/openrastertk/kis_open_raster_stack_load_visitor.cpp
M  +3    -1    krita/ui/openrastertk/kis_open_raster_stack_save_visitor.cpp

http://commits.kde.org/calligra/eb246b9c51e222410475af97139335431feec7dd

diff --git a/krita/ui/openrastertk/kis_open_raster_stack_load_visitor.cpp b/krita/ui/openrastertk/kis_open_raster_stack_load_visitor.cpp
index fecb3e1..7acb3f6 100644
--- a/krita/ui/openrastertk/kis_open_raster_stack_load_visitor.cpp
+++ b/krita/ui/openrastertk/kis_open_raster_stack_load_visitor.cpp
@@ -104,11 +104,14 @@ void KisOpenRasterStackLoadVisitor::loadLayerInfo(const QDomElement& elem, KisLa
     layer->setName(elem.attribute("name"));
     layer->setX(elem.attribute("x").toInt());
     layer->setY(elem.attribute("y").toInt());
-    if(elem.attribute("visibility") == "hidden") {
+    if (elem.attribute("visibility") == "hidden") {
         layer->setVisible(false);
     } else {
         layer->setVisible(true);
     }
+    if (elem.hasAttribute("edit-locked")) {
+        layer->setUserLocked(true);
+    }
 
     QString compop = elem.attribute("composite-op");
     if (compop.startsWith("svg:")) {
diff --git a/krita/ui/openrastertk/kis_open_raster_stack_save_visitor.cpp b/krita/ui/openrastertk/kis_open_raster_stack_save_visitor.cpp
index d67ad8c..acd33ed 100644
--- a/krita/ui/openrastertk/kis_open_raster_stack_save_visitor.cpp
+++ b/krita/ui/openrastertk/kis_open_raster_stack_save_visitor.cpp
@@ -55,7 +55,9 @@ void KisOpenRasterStackSaveVisitor::saveLayerInfo(QDomElement& elt, KisLayer* la
     elt.setAttribute("name", layer->name());
     elt.setAttribute("opacity", QString().setNum(layer->opacity() / 255.0));
     elt.setAttribute("visibility", layer->visible() ? "visible" : "hidden");
-
+    if (layer->userLocked()) {
+        elt.setAttribute("edit-locked", "edit-locked");
+    }
     QString compop = layer->compositeOpId();
     if (layer->compositeOpId() == COMPOSITE_CLEAR) compop = "svg:clear";
     else if (layer->compositeOpId() == COMPOSITE_OVER) compop = "svg:src-over";


More information about the CREATE mailing list