duplicated images on page duplication

preferencesAboutTextFull
Claudio Valerio 11 years ago
parent ee66b24988
commit 998e074ea7
  1. 16
      src/core/UBPersistenceManager.cpp

@ -596,13 +596,25 @@ void UBPersistenceManager::duplicateDocumentScene(UBDocumentProxy* proxy, int in
UBGraphicsPixmapItem* pixmapItem = qgraphicsitem_cast<UBGraphicsPixmapItem*>(item);
if(pixmapItem){
pixmapItem->setUuid(QUuid::createUuid());
QString source = proxy->persistencePath() + "/" + UBPersistenceManager::imageDirectory + "/" + pixmapItem->uuid() + ".png";
QString destination = source;
QUuid newUuid = QUuid::createUuid();
QString fileName = QFileInfo(source).completeBaseName();
destination = destination.replace(fileName,newUuid.toString());
Q_ASSERT(QFile::copy(source,destination));
pixmapItem->setUuid(newUuid);
continue;
}
UBGraphicsSvgItem* svgItem = qgraphicsitem_cast<UBGraphicsSvgItem*>(item);
if(svgItem){
svgItem->setUuid(QUuid::createUuid());
QString source = proxy->persistencePath() + "/" + UBPersistenceManager::imageDirectory + "/" + svgItem->uuid() + ".svg";
QString destination = source;
QUuid newUuid = QUuid::createUuid();
QString fileName = QFileInfo(source).completeBaseName();
destination = destination.replace(fileName,newUuid.toString());
Q_ASSERT(QFile::copy(source,destination));
svgItem->setUuid(newUuid);
continue;
}

Loading…
Cancel
Save