use the new setData method

This commit is contained in:
Aaron Seigo 2011-04-28 14:14:37 +02:00 committed by Marco Martin
parent 549f988fee
commit 54a832c270

View File

@ -194,41 +194,23 @@ void DataContainerPrivate::store()
}
DataEngine* de = q->getDataEngine();
if (de == NULL) {
if (!de) {
return;
}
q->setNeedsToBeStored(false);
if (storage == NULL) {
if (!storage) {
storage = new Storage(q);
}
KConfigGroup op = storage->operationDescription("save");
op.writeEntry("group", q->objectName());
DataEngine::Data dataToStore = q->data();
DataEngine::Data::const_iterator it = dataToStore.constBegin();
while (it != dataToStore.constEnd() && dataToStore.constEnd() == q->data().constEnd()) {
QVariant v = it.value();
if ((it.value().type() == QVariant::String) || (it.value().type() == QVariant::Int)) {
op.writeEntry("key", it.key());
op.writeEntry("data", it.value());
} else {
QByteArray b;
QDataStream ds(&b, QIODevice::WriteOnly);
ds << it.value();
op.writeEntry("key", QString(QLatin1String("base64-") + it.key()));
op.writeEntry("data", b.toBase64());
}
++it;
if (storage == NULL) {
storage = new Storage(q);
}
ServiceJob* job = storage->startOperationCall(op);
StorageJob *job = static_cast<StorageJob *>(storage->startOperationCall(op));
job->setData(data);
storageCount++;
QObject::connect(job, SIGNAL(finished(KJob*)), q, SLOT(storeJobFinished(KJob*)));
}
}
void DataContainerPrivate::storeJobFinished(KJob* )
{