SANKORE-429

Document explorer(navigator): Imported ubz files are always imported into "Untitled Documents" folder
preferencesAboutTextFull
Anatoly Mihalchenko 13 years ago
parent 921953e069
commit 71e8585b74
  1. 2
      src/adaptors/UBImportDocument.cpp
  2. 14
      src/core/UBPersistenceManager.cpp
  3. 2
      src/core/UBPersistenceManager.h

@ -191,7 +191,7 @@ 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;
} }

@ -254,13 +254,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())

@ -46,7 +46,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