summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vrátil <dvratil@kde.org>2016-09-07 12:48:14 (GMT)
committerDaniel Vrátil <dvratil@kde.org>2016-09-07 12:48:14 (GMT)
commit38216a7638281545b34892e8dca7d28764842fec (patch)
treeaa6d9b895ef19b7365797df17fa9a05a645c7c1d
parent00b20af8afa1d67a4ef37e64e999cacde328ce7a (diff)
Knut: re-enable disabled code
Should fix some unit-tests and Knut getting stuck on unprocessed tasks.
-rw-r--r--autotests/libs/testresource/knutresource.cpp24
-rw-r--r--src/xml/xmldocument.cpp5
-rw-r--r--src/xml/xmldocument.h5
3 files changed, 11 insertions, 23 deletions
diff --git a/autotests/libs/testresource/knutresource.cpp b/autotests/libs/testresource/knutresource.cpp
index 2542096..00dd95f 100644
--- a/autotests/libs/testresource/knutresource.cpp
+++ b/autotests/libs/testresource/knutresource.cpp
@@ -199,7 +199,6 @@ bool KnutResource::retrieveItems(const Item::List &items, const QSet<QByteArray>
void KnutResource::collectionAdded(const Akonadi::Collection &collection, const Akonadi::Collection &parent)
{
-#if 0 //PORT QT5
QDomElement parentElem = mDocument.collectionElementByRemoteId(parent.remoteId());
if (parentElem.isNull()) {
emit error(i18n("Parent collection not found in DOM tree."));
@@ -216,15 +215,10 @@ void KnutResource::collectionAdded(const Akonadi::Collection &collection, const
save();
changeCommitted(c);
}
-#else
- Q_UNUSED(collection);
- Q_UNUSED(parent);
-#endif
}
void KnutResource::collectionChanged(const Akonadi::Collection &collection)
{
-#if 0 //PORT QT5
QDomElement oldElem = mDocument.collectionElementByRemoteId(collection.remoteId());
if (oldElem.isNull()) {
emit error(i18n("Modified collection not found in DOM tree."));
@@ -252,14 +246,10 @@ void KnutResource::collectionChanged(const Akonadi::Collection &collection)
oldElem.parentNode().replaceChild(newElem, oldElem);
save();
changeCommitted(c);
-#else
- Q_UNUSED(collection);
-#endif
}
void KnutResource::collectionRemoved(const Akonadi::Collection &collection)
{
-#if 0 //PORT QT5
const QDomElement colElem = mDocument.collectionElementByRemoteId(collection.remoteId());
if (colElem.isNull()) {
emit error(i18n("Deleted collection not found in DOM tree."));
@@ -270,14 +260,10 @@ void KnutResource::collectionRemoved(const Akonadi::Collection &collection)
colElem.parentNode().removeChild(colElem);
save();
changeProcessed();
-#else
- Q_UNUSED(collection);
-#endif
}
void KnutResource::itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
-#if 0 //PORT QT5
QDomElement parentElem = mDocument.collectionElementByRemoteId(collection.remoteId());
if (parentElem.isNull()) {
emit error(i18n("Parent collection '%1' not found in DOM tree." , collection.remoteId()));
@@ -294,10 +280,6 @@ void KnutResource::itemAdded(const Akonadi::Item &item, const Akonadi::Collectio
save();
changeCommitted(i);
}
-#else
- Q_UNUSED(item);
- Q_UNUSED(collection);
-#endif
}
void KnutResource::itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &parts)
@@ -340,7 +322,7 @@ void KnutResource::itemMoved(const Item &item, const Collection &collectionSourc
changeProcessed();
return;
}
-#if 0 //PORT QT5
+
QDomElement sourceParentElem = mDocument.collectionElementByRemoteId(collectionSource.remoteId());
if (sourceParentElem.isNull()) {
emit error(i18n("Parent collection '%1' not found in DOM tree.", collectionSource.remoteId()));
@@ -368,10 +350,6 @@ void KnutResource::itemMoved(const Item &item, const Collection &collectionSourc
save();
}
changeProcessed();
-#else
- Q_UNUSED(collectionSource);
- Q_UNUSED(collectionDestination);
-#endif
}
QSet<qint64> KnutResource::parseQuery(const QString &queryString)
diff --git a/src/xml/xmldocument.cpp b/src/xml/xmldocument.cpp
index bea3db1..1092bf0 100644
--- a/src/xml/xmldocument.cpp
+++ b/src/xml/xmldocument.cpp
@@ -258,6 +258,11 @@ QDomElement XmlDocument::itemElementByRemoteId(const QString &rid) const
return d->findElementByRid(rid, Format::Tag::item());
}
+QDomElement XmlDocument::collectionElementByRemoteId(const QString &rid) const
+{
+ return d->findElementByRid(rid, Format::Tag::collection());
+}
+
Collection XmlDocument::collectionByRemoteId(const QString &rid) const
{
const QDomElement elem = d->findElementByRid(rid, Format::Tag::collection());
diff --git a/src/xml/xmldocument.h b/src/xml/xmldocument.h
index d36b2ca..d867613 100644
--- a/src/xml/xmldocument.h
+++ b/src/xml/xmldocument.h
@@ -94,6 +94,11 @@ public:
QDomElement itemElementByRemoteId(const QString &rid) const;
/**
+ * Returns the DOM element representing the collection with the given remote id
+ */
+ QDomElement collectionElementByRemoteId(const QString &rid) const;
+
+ /**
Returns the collection with the given remote id.
*/
Collection collectionByRemoteId(const QString &rid) const;