• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

Plasma

  • plasma
datacontainer.h
Go to the documentation of this file.
1/*
2 * Copyright 2006-2007 Aaron Seigo <aseigo@kde.org>
3 *
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 as
6 * published by the Free Software Foundation; either version 2, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20#ifndef PLASMA_DATACONTAINER_H
21#define PLASMA_DATACONTAINER_H
22
23#include <QtCore/QHash>
24#include <QtCore/QObject>
25#include <QtCore/QTimer>
26
27#include <kjob.h>
28#include <plasma/plasma_export.h>
29#include <plasma/dataengine.h>
30
31namespace Plasma
32{
33
34class DataContainerPrivate;
35
63class PLASMA_EXPORT DataContainer : public QObject
64{
65 friend class DataEngine;
66 friend class DataEnginePrivate;
67 Q_OBJECT
68
69 public:
74 explicit DataContainer(QObject *parent = 0);
75 virtual ~DataContainer();
76
80 const DataEngine::Data data() const;
81
97 void setData(const QString &key, const QVariant &value);
98
107 void removeAllData();
108
112 bool visualizationIsConnected(QObject *visualization) const;
113
124 void connectVisualization(QObject *visualization, uint pollingInterval,
125 Plasma::IntervalAlignment alignment);
126
132 void setStorageEnabled(bool store);
133
138 bool isStorageEnabled() const;
139
143 bool needsToBeStored() const;
144
149 void setNeedsToBeStored(bool store);
150
155 DataEngine* getDataEngine();
156
157 public Q_SLOTS:
164 void disconnectVisualization(QObject *visualization);
165
170 void forceImmediateUpdate();
171
172 Q_SIGNALS:
184 void dataUpdated(const QString &source, const Plasma::DataEngine::Data &data);
185
195 void becameUnused(const QString &source);
196
210 void updateRequested(DataContainer *source);
211
212 protected:
216 void checkForUpdate();
217
225 uint timeSinceLastUpdate() const;
226
235 void setNeedsUpdate(bool update = true);
236
237 protected Q_SLOTS:
246 void checkUsage();
247
251 void timerEvent(QTimerEvent * event);
252
253 private:
254 friend class SignalRelay;
255 friend class DataContainerPrivate;
256 friend class DataEngineManager;
257 DataContainerPrivate *const d;
258
259 Q_PRIVATE_SLOT(d, void storeJobFinished(KJob *job))
260 Q_PRIVATE_SLOT(d, void populateFromStoredData(KJob *job))
261 Q_PRIVATE_SLOT(d, void retrieve())
262};
263
264} // Plasma namespace
265
266#endif // multiple inclusion guard
KJob
Plasma::DataContainer::SignalRelay
friend class SignalRelay
Definition datacontainer.h:254
Plasma::DataContainer::setNeedsToBeStored
void setNeedsToBeStored(bool store)
sets that the data container needs to be stored or not.
Definition datacontainer.cpp:167
Plasma::DataContainer::DataContainerPrivate
friend class DataContainerPrivate
Definition datacontainer.h:255
Plasma::DataContainer::timerEvent
void timerEvent(QTimerEvent *event)
Definition datacontainer.cpp:333
Plasma::DataContainer::updateRequested
void updateRequested(DataContainer *source)
Emitted when an update is requested.
Plasma::DataContainer::visualizationIsConnected
bool visualizationIsConnected(QObject *visualization) const
Definition datacontainer.cpp:80
Plasma::DataContainer::data
const DataEngine::Data data() const
Returns the data for this DataContainer.
Definition datacontainer.cpp:41
Plasma::DataContainer::DataEngineManager
friend class DataEngineManager
Definition datacontainer.h:256
Plasma::DataContainer::becameUnused
void becameUnused(const QString &source)
Emitted when the last visualization is disconnected.
Plasma::DataContainer::DataEnginePrivate
friend class DataEnginePrivate
Definition datacontainer.h:66
Plasma::DataContainer::checkUsage
void checkUsage()
Check if the DataContainer is still in use.
Definition datacontainer.cpp:326
Plasma::DataContainer::setNeedsUpdate
void setNeedsUpdate(bool update=true)
Indicates that the data should be treated as dirty the next time hasUpdates() is called.
Definition datacontainer.cpp:321
Plasma::DataContainer::isStorageEnabled
bool isStorageEnabled() const
Definition datacontainer.cpp:157
Plasma::DataContainer::dataUpdated
void dataUpdated(const QString &source, const Plasma::DataEngine::Data &data)
Emitted when the data has been updated, allowing visualizations to reflect the new data.
Plasma::DataContainer::checkForUpdate
void checkForUpdate()
Checks whether any data has changed and, if so, emits dataUpdated().
Definition datacontainer.cpp:290
Plasma::DataContainer::needsToBeStored
bool needsToBeStored() const
Definition datacontainer.cpp:162
Plasma::DataContainer::DataContainer
DataContainer(QObject *parent=0)
Constructs a default DataContainer that has no name or data associated with it.
Definition datacontainer.cpp:30
Plasma::DataContainer::timeSinceLastUpdate
uint timeSinceLastUpdate() const
Returns how long ago, in msecs, that the data in this container was last updated.
Definition datacontainer.cpp:316
Plasma::DataContainer::getDataEngine
DataEngine * getDataEngine()
Definition datacontainer.cpp:172
Plasma::DataContainer::disconnectVisualization
void disconnectVisualization(QObject *visualization)
Disconnects an object from this DataContainer.
Definition datacontainer.cpp:264
Plasma::DataContainer::DataEngine
friend class DataEngine
Definition datacontainer.h:65
Plasma::DataContainer::removeAllData
void removeAllData()
Removes all data currently associated with this source.
Definition datacontainer.cpp:68
Plasma::DataContainer::setData
void setData(const QString &key, const QVariant &value)
Set a value for a key.
Definition datacontainer.cpp:46
Plasma::DataContainer::connectVisualization
void connectVisualization(QObject *visualization, uint pollingInterval, Plasma::IntervalAlignment alignment)
Connects an object to this DataContainer.
Definition datacontainer.cpp:85
Plasma::DataContainer::setStorageEnabled
void setStorageEnabled(bool store)
sets this data container to be automatically stored.
Definition datacontainer.cpp:147
Plasma::DataContainer::forceImmediateUpdate
void forceImmediateUpdate()
Forces immediate update signals to all visualizations.
Definition datacontainer.cpp:304
Plasma::DataEngine::Data
QHash< QString, QVariant > Data
Definition dataengine.h:68
QObject
dataengine.h
Plasma
Namespace for everything in libplasma.
Definition abstractdialogmanager.cpp:25
Plasma::IntervalAlignment
IntervalAlignment
Possible timing alignments.
Definition plasma.h:181
plasma_export.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 17 2025 00:00:00 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Plasma

Skip menu "Plasma"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal