Commit ceb8cf62 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

poppler: Convert Stamp annotations via C++

Instead of via the magic XML cycle of Poppler::AnnotationUtils::storeAnnotation + Okular::AnnotationUtils::createAnnotation
parent d13b18af
Pipeline #35441 passed with stage
in 23 minutes and 17 seconds
......@@ -563,6 +563,15 @@ static Okular::Annotation *createAnnotationFromPopplerAnnotation(const Poppler::
return oCaretAnn;
}
static Okular::Annotation *createAnnotationFromPopplerAnnotation(const Poppler::StampAnnotation *popplerAnnotation)
{
Okular::StampAnnotation *oStampAnn = new Okular::StampAnnotation();
oStampAnn->setStampIconName(popplerAnnotation->stampIconName());
return oStampAnn;
}
Okular::Annotation *createAnnotationFromPopplerAnnotation(Poppler::Annotation *popplerAnnotation, const Poppler::Page &popplerPage, bool *doDelete)
{
Okular::Annotation *okularAnnotation = nullptr;
......@@ -675,14 +684,9 @@ Okular::Annotation *createAnnotationFromPopplerAnnotation(Poppler::Annotation *p
case Poppler::Annotation::AStamp:
tieToOkularAnn = true;
*doDelete = false;
/* fallthrough */
okularAnnotation = createAnnotationFromPopplerAnnotation(static_cast<Poppler::StampAnnotation *>(popplerAnnotation));
break;
default: {
// this is uber ugly but i don't know a better way to do it without introducing a poppler::annotation dependency on core
QDomDocument doc;
QDomElement root = doc.createElement(QStringLiteral("root"));
doc.appendChild(root);
Poppler::AnnotationUtils::storeAnnotation(popplerAnnotation, root, doc);
okularAnnotation = Okular::AnnotationUtils::createAnnotation(root);
break;
}
}
......
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