From f973c8b2d2511294318a4eeb7594ede4ff0d0684 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Mon, 5 Aug 2013 13:08:51 +0200 Subject: [PATCH] importing pdf doesn't add a blanc page anymore. Issue 81 --- src/core/UBDocumentManager.cpp | 2 +- src/core/UBPersistenceManager.cpp | 10 +++++----- src/document/UBDocumentController.cpp | 1 - 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/core/UBDocumentManager.cpp b/src/core/UBDocumentManager.cpp index 17c2c9f5..cedc1bef 100644 --- a/src/core/UBDocumentManager.cpp +++ b/src/core/UBDocumentManager.cpp @@ -150,7 +150,7 @@ UBDocumentProxy* UBDocumentManager::importFile(const QFile& pFile, const QString // Document import procedure..... QString documentName = QFileInfo(pFile.fileName()).completeBaseName(); - document = UBPersistenceManager::persistenceManager()->createDocument(pGroup, documentName); + document = UBPersistenceManager::persistenceManager()->createDocument(pGroup, documentName,false); QUuid uuid = QUuid::createUuid(); QString filepath = pFile.fileName(); diff --git a/src/core/UBPersistenceManager.cpp b/src/core/UBPersistenceManager.cpp index ab267208..a97cc87e 100644 --- a/src/core/UBPersistenceManager.cpp +++ b/src/core/UBPersistenceManager.cpp @@ -264,7 +264,10 @@ UBDocumentProxy* UBPersistenceManager::createDocument(const QString& pGroupName, doc->setMetaData(UBSettings::documentUpdatedAt,currentDate); doc->setMetaData(UBSettings::documentDate,currentDate); - if (withEmptyPage) createDocumentSceneAt(doc, 0); + if (withEmptyPage) + createDocumentSceneAt(doc, 0); + else + generatePathIfNeeded(doc); documentProxies.insert(0, QPointer(doc)); @@ -887,16 +890,13 @@ bool UBPersistenceManager::addFileToDocument(UBDocumentProxy* pDocumentProxy, if (data == NULL && !fi.exists()) return false; - qDebug() << fi.suffix(); - QString fileName = subdir + "/" + objectUuid.toString() + "." + fi.suffix(); - destinationPath = pDocumentProxy->persistencePath() + "/" + fileName; if (!QFile::exists(destinationPath)) { QDir dir; - dir.mkdir(pDocumentProxy->persistencePath() + "/" + subdir); + dir.mkpath(pDocumentProxy->persistencePath() + "/" + subdir); if (!QFile::exists(pDocumentProxy->persistencePath() + "/" + subdir)) return false; diff --git a/src/document/UBDocumentController.cpp b/src/document/UBDocumentController.cpp index a0fe8304..01b8d8ab 100644 --- a/src/document/UBDocumentController.cpp +++ b/src/document/UBDocumentController.cpp @@ -1052,7 +1052,6 @@ bool UBDocumentController::addFileToDocument(UBDocumentProxy* document) if (filePath.length() > 0) { QApplication::processEvents(); // NOTE: We performed this just a few lines before. Is it really necessary to do it again here?? - QFile selectedFile(filePath); showMessage(tr("Importing file %1...").arg(fileInfo.baseName()), true);