fixed import issue related to documents, without title page, imported at application start up

preferencesAboutTextFull
Claudio Valerio 12 years ago
parent 807c68ea9f
commit f49e2fa75e
  1. 7
      src/adaptors/UBImportDocument.cpp
  2. 5
      src/core/UBPersistenceManager.cpp
  3. 2
      src/core/UBPersistenceManager.h
  4. 2
      src/core/main.cpp

@ -171,8 +171,11 @@ UBDocumentProxy* UBImportDocument::importFile(const QFile& pFile, const QString&
return NULL;
}
UBDocumentProxy* newDocument = UBPersistenceManager::persistenceManager()->createDocumentFromDir(documentRootFolder, pGroup);
bool addTitlePage = false;
if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool() && !QFile(documentRootFolder+"/page000.svg").exists())
addTitlePage=true;
UBDocumentProxy* newDocument = UBPersistenceManager::persistenceManager()->createDocumentFromDir(documentRootFolder, pGroup, "", false, addTitlePage);
UBApplication::showMessage(tr("Import successful."));
return newDocument;
}

@ -265,7 +265,7 @@ UBDocumentProxy* UBPersistenceManager::createDocument(const QString& pGroupName,
return doc;
}
UBDocumentProxy* UBPersistenceManager::createDocumentFromDir(const QString& pDocumentDirectory, const QString& pGroupName, const QString& pName, bool withEmptyPage)
UBDocumentProxy* UBPersistenceManager::createDocumentFromDir(const QString& pDocumentDirectory, const QString& pGroupName, const QString& pName, bool withEmptyPage, bool addTitlePage)
{
checkIfDocumentRepositoryExists();
@ -280,7 +280,8 @@ UBDocumentProxy* UBPersistenceManager::createDocumentFromDir(const QString& pDoc
{
doc->setMetaData(UBSettings::documentName, pName);
}
if (withEmptyPage) createDocumentSceneAt(doc, 0);
if(withEmptyPage) createDocumentSceneAt(doc, 0);
if(addTitlePage) persistDocumentScene(doc, mSceneCache.createScene(doc, 0, false), 0);
QMap<QString, QVariant> metadatas = UBMetadataDcSubsetAdaptor::load(pDocumentDirectory);

@ -47,7 +47,7 @@ class UBPersistenceManager : public QObject
static void destroy();
virtual UBDocumentProxy* createDocument(const QString& pGroupName = "", const QString& pName = "", bool withEmptyPage = true);
virtual UBDocumentProxy* createDocumentFromDir(const QString& pDocumentDirectory, const QString& pGroupName = "", const QString& pName = "", bool withEmptyPage = false);
virtual UBDocumentProxy* createDocumentFromDir(const QString& pDocumentDirectory, const QString& pGroupName = "", const QString& pName = "", bool withEmptyPage = false, bool addTitlePage = false);
virtual UBDocumentProxy* persistDocumentMetadata(UBDocumentProxy* pDocumentProxy);

@ -129,7 +129,7 @@ int main(int argc, char *argv[])
QObject::connect(&app, SIGNAL(messageReceived(const QString&)), &app, SLOT(handleOpenMessage(const QString&)));
qDebug() << fileToOpen;
qDebug() << "file name argument" << fileToOpen;
int result = app.exec(fileToOpen);
app.cleanup();

Loading…
Cancel
Save