Commit c0775ffa authored by Halla Rempt's avatar Halla Rempt
Browse files

Fix loading annotations and load them in the right order

BUG:434244
parent 912d6595
......@@ -1026,10 +1026,14 @@ void Document::setCurrentTime(int time)
QStringList Document::annotationTypes() const
{
if (!d->document) return QStringList();
QStringList types;
KisImageSP image = d->document->image().toStrongRef();
if (!image) return QStringList();
vKisAnnotationSP_it beginIt = image->beginAnnotations();
vKisAnnotationSP_it endIt = image->endAnnotations();
......
......@@ -378,9 +378,9 @@ KisImageSP KisKraLoader::loadXML(const KoXmlElement& element)
for (child = element.lastChild(); !child.isNull(); child = child.previousSibling()) {
QDomElement e = child.toElement();
if (e.tagName() == ANNOTATIONS) {
for (QDomElement annotationElement = e.lastChildElement();
for (QDomElement annotationElement = e.firstChildElement();
!annotationElement.isNull();
annotationElement = annotationElement.previousSiblingElement())
annotationElement = annotationElement.nextSiblingElement())
{
QString type = annotationElement.attribute("type");
QString description = annotationElement.attribute("description");
......@@ -518,7 +518,6 @@ void KisKraLoader::loadBinaryData(KoStore * store, KisImageSP image, const QStri
// Annotations
Q_FOREACH(KisAnnotationSP annotation, m_d->annotations) {
QByteArray ba;
location = external ? QString() : uri;
location += m_d->imageName + ANNOTATIONS_PATH + annotation->type();
......@@ -528,6 +527,7 @@ void KisKraLoader::loadBinaryData(KoStore * store, KisImageSP image, const QStri
device.open(QIODevice::ReadOnly);
ba = device.readAll();
device.close();
store->close();
annotation->setAnnotation(ba);
m_d->document->image()->addAnnotation(annotation);
}
......
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