fixed an issue where pages with a pdf object would not copy the pdf file on the new document

preferencesAboutTextFull
Clément Fauconnier 6 years ago
parent 1441c1f50d
commit f319d60867
  1. 15
      src/core/UBForeignObjectsHandler.cpp

@ -526,6 +526,10 @@ private:
QString reqExt = element.attribute(aReqExt); QString reqExt = element.attribute(aReqExt);
if (reqExt == vReqExt) { //pdf reference if (reqExt == vReqExt) { //pdf reference
QString ref = element.attribute(aHref); QString ref = element.attribute(aHref);
int i = ref.indexOf("#page");
QString dest = ref.replace(i, ref.length()-i, "");
if (!QFileInfo::exists(dest))
cureNCopy(dest, false);
if (ref.isEmpty()) { if (ref.isEmpty()) {
return; return;
} }
@ -553,15 +557,24 @@ private:
} }
} }
QString cureNCopy(const QString &relativePath) QString cureNCopy(const QString &relativePath, bool createNewUuid=true)
{ {
QString relative = relativePath; QString relative = relativePath;
if (createNewUuid)
{
QUuid newUuid = QUuid::createUuid(); QUuid newUuid = QUuid::createUuid();
QString newPath = relative.replace(QRegExp("\\{.*\\}"), newUuid.toString()); QString newPath = relative.replace(QRegExp("\\{.*\\}"), newUuid.toString());
cp_rf(mFromDir + "/" + relativePath, mToDir + "/" + newPath); cp_rf(mFromDir + "/" + relativePath, mToDir + "/" + newPath);
return newPath; return newPath;
} }
else
{
cp_rf(mFromDir + "/" + relativePath, mToDir + "/" + relativePath);
return relativePath;
}
}
private: private:
QString mFromDir; QString mFromDir;

Loading…
Cancel
Save