kresources
#include <resource.h>
Public Types | |
typedef QList< Resource * > | List |
Public Member Functions | |
Resource () | |
Resource (const KConfigGroup &group) | |
virtual | ~Resource () |
void | close () |
virtual void | dump () const |
QString | identifier () const |
bool | isActive () const |
bool | isOpen () const |
bool | open () |
virtual bool | readOnly () const |
virtual QString | resourceName () const |
void | setActive (bool active) |
void | setIdentifier (const QString &identifier) |
virtual void | setReadOnly (bool value) |
virtual void | setResourceName (const QString &name) |
void | setType (const QString &type) |
QString | type () const |
virtual void | writeConfig (KConfigGroup &group) |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
QObject (QObject *parent, const char *name) | |
bool | blockSignals (bool block) |
QObject * | child (const char *objName, const char *inheritsClass, bool recursiveSearch) const |
const QObjectList & | children () const |
const char * | className () const |
bool | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const QObject *receiver, const char *method) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QByteArray > | dynamicPropertyNames () const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name) const |
QList< T > | findChildren (const QRegExp ®Exp) const |
QList< T > | findChildren (const QString &name) const |
bool | inherits (const char *className) const |
void | insertChild (QObject *object) |
void | installEventFilter (QObject *filterObj) |
bool | isA (const char *className) const |
bool | isWidgetType () const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
const char * | name () const |
const char * | name (const char *defaultName) const |
QString | objectName () const |
QObject * | parent () const |
QVariant | property (const char *name) const |
void | removeChild (QObject *object) |
void | removeEventFilter (QObject *obj) |
void | setName (const char *name) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval) |
QThread * | thread () const |
Protected Member Functions | |
virtual void | doClose () |
virtual bool | doOpen () |
Protected Member Functions inherited from QObject | |
bool | checkConnectArgs (const char *signal, const QObject *object, const char *method) |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const char *signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const char *signal) |
int | receivers (const char *signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
Additional Inherited Members | |
Static Public Member Functions inherited from QObject | |
bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
Static Protected Member Functions inherited from QObject | |
QByteArray | normalizeSignalSlot (const char *signalSlot) |
Properties inherited from QObject | |
objectName | |
Detailed Description
This class provides a resource which is managed in a general way.
A Resource represents the concept of an object with the following attributes:
- Applications operate on sets of one or more Resource objects.
- Creation and deletetion of Resource objects is done in a general way, independent of concrete functionality of the Resource.
- The end user has control over creation, deletion and configuration of Resource object.
- Properties, behaviour and configuration of different Resource objects can widely differ.
- Resources can be active or inactive.
- There is one special Resource which is the standard Resource. This can for example be used as default destination for newly created object managed by a certain Resource family.
- Activation of Resources can be covered by a two step process of being opened and then loaded. Deactivation corresponds to saving and closing.
- Different application ususally share the same set of Resources.
The Resource base class provides the management functionality. Classes inheriting from Resource automatically appear in the general kresources kcontrol module.
Concrete functionality of Resources is specified per family by a subclass of Resource. This classes in turn have subclasses which implement the different flavors of the functionality represented by the family.
A subclass should reimplement at least the constructor and the writeConfig method.
An example for a Resource subclass hierarchy would be the "calendar" family. The ResourceCalendar subclass would specify an API for accessing calendar data. Subclasses of ResourceCalendar would implement this API for local files, remote files, specific calendar servers etc.
Definition at line 75 of file resource.h.
Constructor & Destructor Documentation
Resource::Resource | ( | ) |
|
explicit |
Constructor.
Construct resource from configuration group.
- Parameters
-
group Configuration group to read persistence information from
Definition at line 85 of file resource.cpp.
|
virtual |
Destructor.
Definition at line 98 of file resource.cpp.
Member Function Documentation
void Resource::close | ( | ) |
Decrease the open count of this object, and if the count reaches zero, close this resource by calling doClose().
This method may block while another thread is concurrently closing or opening the resource.
Definition at line 128 of file resource.cpp.
|
protectedvirtual |
Close this resource.
Pre-condition: resource is open. Post-condition: resource is closed.
Definition at line 221 of file resource.cpp.
|
protectedvirtual |
Open this resource.
When called, the resource must be in a closed state.
Returns true if the resource was opened successfully; returns false if the resource was not opened successfully.
The result of this call can be accessed later by isOpen()
Definition at line 216 of file resource.cpp.
|
virtual |
Print resource information as debug output.
Definition at line 204 of file resource.cpp.
QString Resource::identifier | ( | ) | const |
Returns a unique identifier.
The identifier is unique for this resource. It is created when the resource is first created, and it is retained in the resource family configuration file for this resource.
- Returns
- This resource's identifier
Definition at line 159 of file resource.cpp.
bool Resource::isActive | ( | ) | const |
Return true, if the resource is active.
Definition at line 199 of file resource.cpp.
bool Resource::isOpen | ( | ) | const |
Returns whether the resource is open or not.
Definition at line 149 of file resource.cpp.
bool Resource::open | ( | ) |
Open this resource, if it not already open.
Increase the open count of this object, and open the resource by calling doOpen(). This method may block while another thread is concurrently opening or closing the resource.
Returns true if the resource was already opened or if it was opened successfully; returns false if the resource was not opened successfully.
Definition at line 114 of file resource.cpp.
|
virtual |
Returns, if the resource is read-only.
Definition at line 179 of file resource.cpp.
|
virtual |
Returns the name of resource.
Definition at line 189 of file resource.cpp.
void Resource::setActive | ( | bool | active | ) |
Sets, if the resource is active.
Definition at line 194 of file resource.cpp.
void Resource::setIdentifier | ( | const QString & | identifier | ) |
Sets the resource unique identifier.
Definition at line 154 of file resource.cpp.
|
virtual |
Mark the resource as read-only.
You can override this method, but also remember to call Resource::setReadOnly().
Definition at line 174 of file resource.cpp.
|
virtual |
Set the name of resource.
You can override this method, but also remember to call Resource::setResourceName().
Definition at line 184 of file resource.cpp.
void Resource::setType | ( | const QString & | type | ) |
Sets the resource type.
Definition at line 164 of file resource.cpp.
QString Resource::type | ( | ) | const |
Returns the type of this resource.
Definition at line 169 of file resource.cpp.
|
virtual |
Write configuration information for this resource to a configuration file.
If you override this method, remember to call Resource::writeConfig or Terrible Things(TM) will happen.
- Parameters
-
group Configuration group to write persistence information to.
Definition at line 103 of file resource.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:37:52 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.