From cab036fe9eff3c8bfb919c193a984e053d57cc3f Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Tue, 30 Jul 2013 18:27:47 +0200 Subject: [PATCH] on scene move fixed copying issues --- src/board/UBBoardController.cpp | 13 ++++++++----- src/gui/UBDocumentNavigator.cpp | 1 - src/gui/UBDocumentTreeWidget.cpp | 13 ++++++++----- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index cf84fdd1..b889c96b 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -485,11 +485,14 @@ void UBBoardController::addScene(UBGraphicsScene* scene, bool replaceActiveIfEmp QString source = scene->document()->persistencePath() + "/" + relativeFile.toString(); QString target = selectedDocument()->persistencePath() + "/" + relativeFile.toString(); - QFileInfo fi(target); - QDir d = fi.dir(); - - d.mkpath(d.absolutePath()); - QFile::copy(source, target); + if(QFileInfo(source).isDir()) + Q_ASSERT(UBFileSystemUtils::copyDir(source,target)); + else{ + QFileInfo fi(target); + QDir d = fi.dir(); + d.mkpath(d.absolutePath()); + Q_ASSERT(QFile::copy(source, target)); + } } } diff --git a/src/gui/UBDocumentNavigator.cpp b/src/gui/UBDocumentNavigator.cpp index 1756b2b5..c8d75a5b 100644 --- a/src/gui/UBDocumentNavigator.cpp +++ b/src/gui/UBDocumentNavigator.cpp @@ -85,7 +85,6 @@ UBDocumentNavigator::~UBDocumentNavigator() void UBDocumentNavigator::generateThumbnails(UBDocumentContainer* source) { mThumbsWithLabels.clear(); -// foreach(QGraphicsItem* it, mScene->items()) int selectedIndex = -1; QList graphicsItemList = mScene->items(); for(int i = 0; i < graphicsItemList.size(); i+=1) diff --git a/src/gui/UBDocumentTreeWidget.cpp b/src/gui/UBDocumentTreeWidget.cpp index 6c1409f6..dc5a7a0d 100644 --- a/src/gui/UBDocumentTreeWidget.cpp +++ b/src/gui/UBDocumentTreeWidget.cpp @@ -326,11 +326,14 @@ void UBDocumentTreeWidget::dropEvent(QDropEvent *event) QString source = scene->document()->persistencePath() + "/" + relativeFile.toString(); QString target = targetDocProxy->persistencePath() + "/" + relativeFile.toString(); - QFileInfo fi(target); - QDir d = fi.dir(); - - d.mkpath(d.absolutePath()); - QFile::copy(source, target); + if(QFileInfo(source).isDir()) + Q_ASSERT(UBFileSystemUtils::copyDir(source,target)); + else{ + QFileInfo fi(target); + QDir d = fi.dir(); + d.mkpath(d.absolutePath()); + Q_ASSERT(QFile::copy(source, target)); + } } UBPersistenceManager::persistenceManager()->insertDocumentSceneAt(targetDocProxy, sceneClone, targetDocProxy->pageCount());