Commit f319d608 authored by Clément Fauconnier's avatar Clément Fauconnier

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

parent 1441c1f5
......@@ -526,6 +526,10 @@ private:
QString reqExt = element.attribute(aReqExt);
if (reqExt == vReqExt) { //pdf reference
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()) {
return;
}
......@@ -553,14 +557,23 @@ private:
}
}
QString cureNCopy(const QString &relativePath)
QString cureNCopy(const QString &relativePath, bool createNewUuid=true)
{
QString relative = relativePath;
QUuid newUuid = QUuid::createUuid();
QString newPath = relative.replace(QRegExp("\\{.*\\}"), newUuid.toString());
cp_rf(mFromDir + "/" + relativePath, mToDir + "/" + newPath);
if (createNewUuid)
{
QUuid newUuid = QUuid::createUuid();
QString newPath = relative.replace(QRegExp("\\{.*\\}"), newUuid.toString());
return newPath;
cp_rf(mFromDir + "/" + relativePath, mToDir + "/" + newPath);
return newPath;
}
else
{
cp_rf(mFromDir + "/" + relativePath, mToDir + "/" + relativePath);
return relativePath;
}
}
private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment