From a2eb4c06c01389896a21bb98fa4cf865ad28c73b Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Tue, 7 Oct 2014 12:40:31 +0200 Subject: [PATCH] Fixed bug. On import action the image is immediately stored into the document folder --- src/adaptors/UBImportImage.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/adaptors/UBImportImage.cpp b/src/adaptors/UBImportImage.cpp index b27d433d..a579ad77 100644 --- a/src/adaptors/UBImportImage.cpp +++ b/src/adaptors/UBImportImage.cpp @@ -29,6 +29,8 @@ #include "document/UBDocumentProxy.h" +#include "board/UBBoardController.h" + #include "core/UBApplication.h" #include "core/UBPersistenceManager.h" #include "core/UBDocumentManager.h" @@ -98,6 +100,18 @@ QList UBImportImage::import(const QUuid& uuid, const QString& f UBGraphicsPixmapItem* pixmapItem = new UBGraphicsPixmapItem(); pixmapItem->setPixmap(pix); result << pixmapItem; + + QString documentPath = UBApplication::boardController->selectedDocument()->persistencePath(); + QString fileName = UBPersistenceManager::imageDirectory + "/" + pixmapItem->uuid().toString() + ".png"; + QString path = documentPath + "/" + fileName; + if (!QFile::exists(path)) + { + QDir dir; + dir.mkdir(documentPath + "/" + UBPersistenceManager::imageDirectory); + + pixmapItem->pixmap().toImage().save(path, "PNG"); + } + return result; }