25#include <tdeapplication.h>
32class Resource::ResourcePrivate
35#ifdef TQT_THREAD_SUPPORT
48 : TQObject( 0,
"" ), d(
new ResourcePrivate )
54 d->mType =
config->readEntry(
"ResourceType" );
55 d->mName =
config->readEntry(
"ResourceName" );
56 d->mReadOnly =
config->readBoolEntry(
"ResourceIsReadOnly",
false );
57 d->mActive =
config->readBoolEntry(
"ResourceIsActive",
true );
58 d->mIdentifier =
config->readEntry(
"ResourceIdentifier" );
61 d->mName =
i18n(
"resource");
64 d->mIdentifier = TDEApplication::randomString( 10 );
78 config->writeEntry(
"ResourceType", d->mType );
79 config->writeEntry(
"ResourceName", d->mName );
80 config->writeEntry(
"ResourceIsReadOnly", d->mReadOnly );
81 config->writeEntry(
"ResourceIsActive", d->mActive );
82 config->writeEntry(
"ResourceIdentifier", d->mIdentifier );
88#ifdef TQT_THREAD_SUPPORT
91 if ( !d->mOpenCount ) {
101#ifdef TQT_THREAD_SUPPORT
104 if ( !d->mOpenCount ) {
109 if ( !d->mOpenCount ) {
123void Resource::setIdentifier(
const TQString& identifier )
130 return d->mIdentifier;
133void Resource::setType(
const TQString& type )
145 d->mReadOnly =
value;
177 kdDebug(5650) <<
" Identifier: " << d->mIdentifier <<
endl;
179 kdDebug(5650) <<
" OpenCount: " << d->mOpenCount <<
endl;
180 kdDebug(5650) <<
" ReadOnly: " << ( d->mReadOnly ?
"yes" :
"no" ) <<
endl;
181 kdDebug(5650) <<
" Active: " << ( d->mActive ?
"yes" :
"no" ) <<
endl;
182 kdDebug(5650) <<
" IsOpen: " << ( d->mIsOpen ?
"yes" :
"no" ) <<
endl;
185#include "resource.moc"
This class provides a manager for resources of a specified family.
virtual void setReadOnly(bool value)
Mark the resource as read-only.
bool open()
Open this resource, if it not already open.
virtual ~Resource()
Destructor.
bool isOpen() const
Returns whether the resource is open or not.
virtual void doClose()
Close this resource.
virtual void dump() const
Print resource information as debug output.
virtual void setResourceName(const TQString &name)
Set the name of resource.
bool isActive() const
Return true, if the resource is active.
virtual void writeConfig(TDEConfig *config)
Write configuration information for this resource to a configuration file.
TQString type() const
Returns the type of this resource.
virtual bool readOnly() const
Returns, if the resource is read-only.
void close()
Decrease the open count of this object, and if the count reaches zero, close this resource by calling...
virtual bool doOpen()
Open this resource.
Resource(const TDEConfig *config)
Constructor.
void setActive(bool active)
Sets, if the resource is active.
TQString identifier() const
Returns a unique identifier.
virtual TQString resourceName() const
Returns the name of resource.