diff --git a/datacontainer.cpp b/datacontainer.cpp index 5b944cd81..225f06023 100644 --- a/datacontainer.cpp +++ b/datacontainer.cpp @@ -29,7 +29,7 @@ namespace Plasma DataContainer::DataContainer(QObject *parent) : QObject(parent), - d(new DataContainerPrivate) + d(new DataContainerPrivate(this)) { } @@ -251,11 +251,12 @@ void DataContainer::retrieve() SLOT(populateFromStoredData(KJob*))); } -void DataContainer::populateFromStoredData(KJob *job) +void DataContainerPrivate::populateFromStoredData(KJob *job) { if (job->error()) { return; } + DataEngine::Data dataToInsert; ServiceJob* ret = dynamic_cast(job); QHash h = ret->result().toHash(); @@ -270,15 +271,17 @@ void DataContainer::populateFromStoredData(KJob *job) dataToInsert.insert(key, h[key]); } } - if (!(d->data.isEmpty())) + + if (!(data.isEmpty())) { //Do not fill the source with old stored //data if it is already populated with new data. return; } - d->data = dataToInsert; - d->dirty = true; - checkForUpdate(); + + data = dataToInsert; + dirty = true; + q->checkForUpdate(); } void DataContainer::disconnectVisualization(QObject *visualization) diff --git a/datacontainer.h b/datacontainer.h index 14bd9f855..73ff1c98e 100644 --- a/datacontainer.h +++ b/datacontainer.h @@ -253,17 +253,13 @@ class PLASMA_EXPORT DataContainer : public QObject **/ void checkUsage(); - /** - * Does the work of putting the data from disk into the DataContainer - * after retrieve() sets it up. - */ - void populateFromStoredData(KJob *job); - private: friend class SignalRelay; + friend class DataContainerPrivate; DataContainerPrivate *const d; Q_PRIVATE_SLOT(d, void storeJobFinished(KJob *job)) + Q_PRIVATE_SLOT(d, void populateFromStoredData(KJob *job)) }; } // Plasma namespace diff --git a/private/datacontainer_p.h b/private/datacontainer_p.h index b47951b89..7ab62b837 100644 --- a/private/datacontainer_p.h +++ b/private/datacontainer_p.h @@ -33,8 +33,9 @@ class SignalRelay; class DataContainerPrivate { public: - DataContainerPrivate() - : store(NULL), + DataContainerPrivate(DataContainer *container) + : q(container), + store(NULL), dirty(false), cached(false), enableStorage(false), @@ -47,7 +48,6 @@ public: bool immediateUpdate); bool hasUpdates(); - void populateFromStoredData(KJob *job); /** * Deletes the store member of DataContainerPrivate if @@ -55,7 +55,13 @@ public: */ void storeJobFinished(KJob *job); + /** + * Does the work of putting the data from disk into the DataContainer + * after retrieve() sets it up. + */ + void populateFromStoredData(KJob *job); + DataContainer *q; DataEngine::Data data; QMap relayObjects; QMap relays;