From f5ad63632e3a1887d8328844c0bb0626e7580a4c Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Thu, 28 Apr 2011 17:23:17 +0200 Subject: [PATCH] use the new and improve retrieval --- datacontainer.cpp | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/datacontainer.cpp b/datacontainer.cpp index b60ee90c0..62c70a310 100644 --- a/datacontainer.cpp +++ b/datacontainer.cpp @@ -244,38 +244,25 @@ void DataContainerPrivate::populateFromStoredData(KJob *job) return; } - DataEngine::Data dataToInsert; - ServiceJob* ret = dynamic_cast(job); - const QHash h = ret->result().toHash(); - QHash::const_iterator it = h.begin(); - QHash::const_iterator itEnd = h.end(); - for ( ; it != itEnd; ++it) { - QString key = it.key(); - if (key.startsWith("base64-")) { - QByteArray b = QByteArray::fromBase64(it.value().toString().toAscii()); - QDataStream ds(&b, QIODevice::ReadOnly); - QVariant v(ds); - key.remove(0, 7); - dataToInsert.insert(key, v); - } else { - dataToInsert.insert(key, it.value()); - } + StorageJob *ret = dynamic_cast(job); + if (!ret) { + return; } + DataEngine::Data dataToInsert = ret->data(); + KConfigGroup expireGroup = storage->operationDescription("expire"); //expire things older than 4 days expireGroup.writeEntry("age", 345600); storage->startOperationCall(expireGroup); - if (!(data.isEmpty())) { - //Do not fill the source with old stored - //data if it is already populated with new data. - return; + // Only fill the source with old stored + // data if it is already populated with new data. + if (data.isEmpty()) { + data = dataToInsert; + dirty = true; + q->checkForUpdate(); } - - data = dataToInsert; - dirty = true; - q->checkForUpdate(); } void DataContainer::disconnectVisualization(QObject *visualization)