OpenSavedMSAEditorTask::OpenSavedMSAEditorTask(const QString& viewName, const QVariantMap& stateData) : ObjectViewTask(MSAEditorFactory::ID, viewName, stateData) { MSAEditorState state(stateData); GObjectReference ref = state.getMSAObjectRef(); Document* doc = AppContext::getProject()->findDocumentByURL(ref.docUrl); if (doc == NULL) { doc = createDocumentAndAddToProject(ref.docUrl, AppContext::getProject(), stateInfo); CHECK_OP_EXT(stateInfo, stateIsIllegal = true ,); }
OpenSavedMaEditorTask::OpenSavedMaEditorTask(GObjectType type, MaEditorFactory* factory, const QString& viewName, const QVariantMap& stateData) : ObjectViewTask(factory->getId(), viewName, stateData), type(type), factory(factory) { MaEditorState state(stateData); GObjectReference ref = state.getMaObjectRef(); Document* doc = AppContext::getProject()->findDocumentByURL(ref.docUrl); if (doc == NULL) { doc = createDocumentAndAddToProject(ref.docUrl, AppContext::getProject(), stateInfo); CHECK_OP_EXT(stateInfo, stateIsIllegal = true ,); }
OpenSavedTextObjectViewTask::OpenSavedTextObjectViewTask(const QString& vname, const QVariantMap& stateData) : ObjectViewTask(SimpleTextObjectViewFactory::ID, vname, stateData), doc(NULL) { QString documentUrl = SimpleTextObjectView::getDocumentUrl(stateData); doc = AppContext::getProject()->findDocumentByURL(documentUrl); if (doc.isNull()) { doc = createDocumentAndAddToProject(documentUrl, AppContext::getProject(), stateInfo); if (!doc) { stateIsIllegal = true; stateInfo.setError(L10N::errorDocumentNotFound(documentUrl)); return; } } if (!doc->isLoaded()) { documentsToLoad.append(doc); } }