2
* Copyright 2006-2007 Aaron Seigo <aseigo@kde.org>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Library General Public License version 2 as
6
* published by the Free Software Foundation
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details
13
* You should have received a copy of the GNU Library General Public
14
* License along with this program; if not, write to the
15
* Free Software Foundation, Inc.,
16
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
#include "datacontainer.h"
28
class DataContainer::Private
35
DataEngine::Data data;
40
DataContainer::DataContainer(QObject* parent)
46
DataContainer::~DataContainer()
51
const DataEngine::Data DataContainer::data() const
56
void DataContainer::setData(const QString& key, const QVariant& value)
58
if (value.isNull() || !value.isValid()) {
59
if (!d->data.contains(key)) {
71
void DataContainer::clearData()
73
if (d->data.count() < 1) {
74
// avoid an update if we don't have any data anyways
82
void DataContainer::checkForUpdate()
85
emit updated(objectName(), d->data);
90
void DataContainer::connectNotify(const char *signal)
92
if (QLatin1String(signal) == QMetaObject::normalizedSignature(SIGNAL(updated(QString, Plasma::DataEngine::Data))).constData()) {
97
void DataContainer::disconnectNotify(const char *signal)
99
if (QLatin1String(signal) == QMetaObject::normalizedSignature(SIGNAL(updated(QString, Plasma::DataEngine::Data))).constData()) {
100
if (d->connectCount > 0) {
104
if (d->connectCount < 1) {
105
// DO NOT CALL ANYTHING AFTER THIS LINE AS IT MAY GET DELETED!
106
emit unused(objectName());
111
} // Plasma namespace
113
#include "datacontainer.moc"