Commit 7cb9c9d3 authored by jan.koester's avatar jan.koester
Browse files

test

parent 1a666de3
Loading
Loading
Loading
Loading
+8 −8
Changes for client/documentmanager.cpp: 8 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -33,8 +33,6 @@
#include <htmlpp/html.h>
#include <htmlpp/exception.h>

#include "plugin.h"

using blogi::webedit::EditPlugin;
using blogi::webedit::EditPluginLoad;
using blogi::webedit::EditPluginDeleter;
@@ -54,6 +52,8 @@ DocumentManager::~DocumentManager() {

void DocumentManager::clearDocument() {
    _docRoot = nullptr;
    for (auto *el : _ownedElements)
        delete el;
    _ownedElements.clear();
    _doc.Clear();
    _rootEl = nullptr;
@@ -98,11 +98,11 @@ bool DocumentManager::saveToFile(const QString &path) {
    _rootEl->SetAttribute("editor", "blogi");
    _doc.InsertFirstChild(_rootEl);

    const EditPlugin *el = _docRoot;
    EditPlugin *el = _docRoot;
    while (el) {
        tinyxml2::XMLElement *xmlEl = el->toXmlObject(&_doc);
        if (xmlEl) _rootEl->InsertEndChild(xmlEl);
        el = el->nextElement();
        el = const_cast<EditPlugin*>(el->nextElement());
    }

    return _doc.SaveFile(path.toUtf8().constData()) == tinyxml2::XML_SUCCESS;
@@ -115,11 +115,11 @@ QString DocumentManager::exportXml() const {
    root->SetAttribute("editor", "blogi");
    expDoc.InsertFirstChild(root);

    const EditPlugin *el = _docRoot;
    EditPlugin *el = _docRoot;
    while (el) {
        tinyxml2::XMLElement *xmlEl = el->toXmlObject(&expDoc);
        if (xmlEl) root->InsertEndChild(xmlEl);
        el = el->nextElement();
        el = const_cast<EditPlugin*>(el->nextElement());
    }

    tinyxml2::XMLPrinter printer;
@@ -255,7 +255,7 @@ EditPlugin *DocumentManager::createPluginByName(const std::string &name) {
        if (plgName == lowerName) {
            EditPlugin *inst = p->createNewInstance();
            if (inst) {
                _ownedElements.emplace_back(inst);
                _ownedElements.push_back(inst);
                return inst;
            }
        }
@@ -685,7 +685,7 @@ QString DocumentManager::setElementProperties(const QString &uuid, const QString
        return r;
    }

    json_object *req = json_object_parse(propsJson.toUtf8().constData());
    json_object *req = json_tokener_parse(propsJson.toUtf8().constData());
    if (!req) {
        json_object_object_add(resp, "status", json_object_new_string("error"));
        json_object_object_add(resp, "message", json_object_new_string("Invalid JSON"));