on scene move fixed copying issues

preferencesAboutTextFull
Claudio Valerio 11 years ago
parent 0e22a1d523
commit cab036fe9e
  1. 13
      src/board/UBBoardController.cpp
  2. 1
      src/gui/UBDocumentNavigator.cpp
  3. 13
      src/gui/UBDocumentTreeWidget.cpp

@ -485,11 +485,14 @@ void UBBoardController::addScene(UBGraphicsScene* scene, bool replaceActiveIfEmp
QString source = scene->document()->persistencePath() + "/" + relativeFile.toString(); QString source = scene->document()->persistencePath() + "/" + relativeFile.toString();
QString target = selectedDocument()->persistencePath() + "/" + relativeFile.toString(); QString target = selectedDocument()->persistencePath() + "/" + relativeFile.toString();
QFileInfo fi(target); if(QFileInfo(source).isDir())
QDir d = fi.dir(); Q_ASSERT(UBFileSystemUtils::copyDir(source,target));
else{
d.mkpath(d.absolutePath()); QFileInfo fi(target);
QFile::copy(source, target); QDir d = fi.dir();
d.mkpath(d.absolutePath());
Q_ASSERT(QFile::copy(source, target));
}
} }
} }

@ -85,7 +85,6 @@ UBDocumentNavigator::~UBDocumentNavigator()
void UBDocumentNavigator::generateThumbnails(UBDocumentContainer* source) void UBDocumentNavigator::generateThumbnails(UBDocumentContainer* source)
{ {
mThumbsWithLabels.clear(); mThumbsWithLabels.clear();
// foreach(QGraphicsItem* it, mScene->items())
int selectedIndex = -1; int selectedIndex = -1;
QList<QGraphicsItem*> graphicsItemList = mScene->items(); QList<QGraphicsItem*> graphicsItemList = mScene->items();
for(int i = 0; i < graphicsItemList.size(); i+=1) for(int i = 0; i < graphicsItemList.size(); i+=1)

@ -326,11 +326,14 @@ void UBDocumentTreeWidget::dropEvent(QDropEvent *event)
QString source = scene->document()->persistencePath() + "/" + relativeFile.toString(); QString source = scene->document()->persistencePath() + "/" + relativeFile.toString();
QString target = targetDocProxy->persistencePath() + "/" + relativeFile.toString(); QString target = targetDocProxy->persistencePath() + "/" + relativeFile.toString();
QFileInfo fi(target); if(QFileInfo(source).isDir())
QDir d = fi.dir(); Q_ASSERT(UBFileSystemUtils::copyDir(source,target));
else{
d.mkpath(d.absolutePath()); QFileInfo fi(target);
QFile::copy(source, target); QDir d = fi.dir();
d.mkpath(d.absolutePath());
Q_ASSERT(QFile::copy(source, target));
}
} }
UBPersistenceManager::persistenceManager()->insertDocumentSceneAt(targetDocProxy, sceneClone, targetDocProxy->pageCount()); UBPersistenceManager::persistenceManager()->insertDocumentSceneAt(targetDocProxy, sceneClone, targetDocProxy->pageCount());

Loading…
Cancel
Save