really don't store things that shouldn't be stored.

svn path=/trunk/KDE/kdelibs/; revision=1168012
This commit is contained in:
Aaron J. Seigo 2010-08-25 21:17:54 +00:00
parent d071b6e301
commit 3af1f71492
2 changed files with 8 additions and 7 deletions

View File

@ -58,11 +58,12 @@ void DataContainer::setData(const QString &key, const QVariant &value)
//If it is not set to be stored,then this is the first
//setData() since the last time it was stored. This
//gives us only one singleShot timer.
if (isStorageEnabled() && !needsToBeStored()) {
QTimer::singleShot(180000, this, SLOT(store()));
if (isStorageEnabled()) {
if (!needsToBeStored()) {
QTimer::singleShot(180000, this, SLOT(store()));
}
setNeedsToBeStored(true);
}
setNeedsToBeStored(true);
}
void DataContainer::removeAllData()
@ -187,7 +188,7 @@ DataEngine* DataContainer::getDataEngine()
void DataContainer::store()
{
if (!needsToBeStored()){
if (!needsToBeStored() || !isStorageEnabled()){
return;
}
@ -353,6 +354,7 @@ void DataContainer::checkUsage()
if (d->relays.count() < 1 &&
receivers(SIGNAL(dataUpdated(QString, Plasma::DataEngine::Data))) < 1) {
// DO NOT CALL ANYTHING AFTER THIS LINE AS IT MAY GET DELETED!
kDebug() << objectName() << "is unused";
emit becameUnused(objectName());
}
}

View File

@ -304,7 +304,6 @@ void DataEngine::setPollingInterval(uint frequency)
void DataEngine::removeSource(const QString &source)
{
//kDebug() << "removing source " << source;
SourceDict::iterator it = d->sources.find(source);
if (it != d->sources.end()) {
DataContainer *s = it.value();
@ -617,7 +616,7 @@ DataContainer *DataEnginePrivate::source(const QString &sourceName, bool createW
}
sourceQueue.enqueue(s);
}
return it.value();
return s;
}
if (!createWhenMissing) {