SANKORE-429

preferencesAboutTextFull
Anatoly Mihalchenko 13 years ago
parent b6604dce59
commit c4e771c8ad
  1. 6
      src/adaptors/UBImportDocument.cpp
  2. 14
      src/core/UBPersistenceManager.cpp
  3. 2
      src/core/UBPersistenceManager.h

@ -191,8 +191,10 @@ UBDocumentProxy* UBImportDocument::importFile(const QFile& pFile, const QString&
return 0; return 0;
} }
else{ else{
UBDocumentProxy* newDocument = UBPersistenceManager::persistenceManager()->createDocumentFromDir(documentRootFolder); UBDocumentProxy* newDocument = UBPersistenceManager::persistenceManager()->createDocumentFromDir(documentRootFolder, pGroup);
UBApplication::showMessage(tr("Import successful."));
UBApplication::showMessage(tr("Import successful."));
return newDocument; return newDocument;
} }
} }

@ -272,13 +272,23 @@ UBDocumentProxy* UBPersistenceManager::createDocument(const QString& pGroupName,
return doc; return doc;
} }
UBDocumentProxy* UBPersistenceManager::createDocumentFromDir(const QString& pDocumentDirectory, const QString& pGroupName, const QString& pName, bool withEmptyPage)
UBDocumentProxy* UBPersistenceManager::createDocumentFromDir(const QString& pDocumentDirectory)
{ {
checkIfDocumentRepositoryExists(); checkIfDocumentRepositoryExists();
UBDocumentProxy* doc = new UBDocumentProxy(pDocumentDirectory); // deleted in UBPersistenceManager::destructor UBDocumentProxy* doc = new UBDocumentProxy(pDocumentDirectory); // deleted in UBPersistenceManager::destructor
if (pGroupName.length() > 0)
{
doc->setMetaData(UBSettings::documentGroupName, pGroupName);
}
if (pName.length() > 0)
{
doc->setMetaData(UBSettings::documentName, pName);
}
if (withEmptyPage) createDocumentSceneAt(doc, 0);
QMap<QString, QVariant> metadatas = UBMetadataDcSubsetAdaptor::load(pDocumentDirectory); QMap<QString, QVariant> metadatas = UBMetadataDcSubsetAdaptor::load(pDocumentDirectory);
foreach(QString key, metadatas.keys()) foreach(QString key, metadatas.keys())

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

Loading…
Cancel
Save