summaryrefslogtreecommitdiffabout
path: root/microkde/kresources
Side-by-side diff
Diffstat (limited to 'microkde/kresources') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kresources/managerimpl.h19
-rw-r--r--microkde/kresources/resource.cpp5
-rw-r--r--microkde/kresources/resource.h25
3 files changed, 39 insertions, 10 deletions
diff --git a/microkde/kresources/managerimpl.h b/microkde/kresources/managerimpl.h
index a049bcc..0425279 100644
--- a/microkde/kresources/managerimpl.h
+++ b/microkde/kresources/managerimpl.h
@@ -18,12 +18,19 @@
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
+/*
+Enhanced Version of the file for platform independent KDE tools.
+Copyright (c) 2004 Ulf Schenk
+
+$Id$
+*/
+
#ifndef KRESOURCES_MANAGERIMPL_H
#define KRESOURCES_MANAGERIMPL_H
#include <qstring.h>
#include <qptrlist.h>
#include <qdict.h>
@@ -55,13 +62,13 @@ class ManagerImplListener
Do not use this class directly. Use ResourceManager instead
*/
class ManagerImpl : public QObject
{
Q_OBJECT
public:
- ManagerImpl( const QString &family );
+ ManagerImpl( const QString &family, bool syncable);
~ManagerImpl();
void readConfig( KConfig * );
void writeConfig( KConfig * );
void add( Resource *resource, bool useDCOP = true );
@@ -80,29 +87,35 @@ class ManagerImpl : public QObject
QPtrList<Resource> resources( bool active );
QStringList resourceNames();
void setListener( ManagerImplListener *listener );
+ /**
+ Return true, if the manager manages syncable resources.
+ */
+ bool manageSyncable() const;
+
public slots:
void resourceChanged( Resource *resource );
private:
// dcop calls
private:
void createStandardConfig();
-
+
Resource *readResourceConfig( const QString& identifier, bool checkActive );
void writeResourceConfig( Resource *resource, bool checkActive );
-
+
void removeResource( Resource *resource );
Resource *getResource( Resource *resource );
Resource *getResource( const QString& identifier );
QString mFamily;
+ bool mSyncable;
KConfig *mConfig;
KConfig *mStdConfig;
Resource *mStandard;
Factory *mFactory;
Resource::List mResources;
ManagerImplListener *mListener;
diff --git a/microkde/kresources/resource.cpp b/microkde/kresources/resource.cpp
index 991d53d..4f69540 100644
--- a/microkde/kresources/resource.cpp
+++ b/microkde/kresources/resource.cpp
@@ -48,13 +48,13 @@ Resource::Resource( const KConfig* config )
: QObject( 0, "" ), d( new ResourcePrivate )
{
d->mOpenCount = 0;
d->mIsOpen = false;
//US compiler claimed that const discards qualifier
- KConfig* cfg = (KConfig*)config;
+ KConfig* cfg = (KConfig*)config;
if ( cfg ) {
#ifdef _WIN32_
// we use plugins on win32. the group is stored in a static variable
// such that group info not available on win32 plugins
// to fix that, it would be a looooot of work
if ( !cfg->tempGroup().isEmpty() )
@@ -79,13 +79,13 @@ Resource::~Resource()
delete d;
d = 0;
}
void Resource::writeConfig( KConfig* config )
{
-
+
config->writeEntry( "ResourceType", d->mType );
config->writeEntry( "ResourceName", d->mName );
config->writeEntry( "ResourceIsReadOnly", d->mReadOnly );
config->writeEntry( "ResourceIsActive", d->mActive );
config->writeEntry( "ResourceIdentifier", d->mIdentifier );
@@ -188,6 +188,7 @@ void Resource::dump() const
kdDebug(5650) << " Type: " << d->mType << endl;
kdDebug(5650) << " OpenCount: " << d->mOpenCount << endl;
kdDebug(5650) << " ReadOnly: " << ( d->mReadOnly ? "yes" : "no" ) << endl;
kdDebug(5650) << " Active: " << ( d->mActive ? "yes" : "no" ) << endl;
kdDebug(5650) << " IsOpen: " << ( d->mIsOpen ? "yes" : "no" ) << endl;
}
+
diff --git a/microkde/kresources/resource.h b/microkde/kresources/resource.h
index 64e7424..c9202c9 100644
--- a/microkde/kresources/resource.h
+++ b/microkde/kresources/resource.h
@@ -37,12 +37,13 @@
class KConfig;
namespace KRES {
class ConfigWidget;
+class SyncWidget;
/**
* @internal
* @libdoc The KDE Resource library
*
* NOTE: this library is NOT (YET?) PUBLIC. Do not publish this
@@ -317,12 +318,17 @@ class Resource : public QObject
/**
* Returns the name of resource.
*/
virtual QString resourceName() const;
+
+
+ virtual bool isSyncable() const = 0;
+
+
/**
Sets, if the resource is active.
*/
void setActive( bool active );
/**
@@ -335,12 +341,13 @@ class Resource : public QObject
/**
Print resource information as debug output.
*/
virtual void dump() const;
+
protected:
/**
* Open this resource. When called, the resource must be in
* a closed state.
*
* Returns true if the resource was opened successfully;
@@ -364,37 +371,45 @@ class Resource : public QObject
ResourcePrivate *d;
};
class PluginFactoryBase : public KLibFactory
{
public:
- virtual Resource *resource( const KConfig *config ) = 0;
+ virtual Resource *resource( const KConfig *config, bool syncable ) = 0;
virtual ConfigWidget *configWidget( QWidget *parent ) = 0;
+ virtual SyncWidget *syncWidget( QWidget *parent ) = 0;
+
protected:
virtual QObject* createObject( QObject*, const char*, const char*,
const QStringList & )
{
return 0;
}
};
-template<class TR,class TC>
+template<class TR,class TC, class TS>
class PluginFactory : public PluginFactoryBase
{
public:
- Resource *resource( const KConfig *config )
+ Resource *resource( const KConfig *config, bool syncable )
{
- return new TR( config );
+ return new TR( config, syncable );
}
-
+
ConfigWidget *configWidget( QWidget *parent )
{
return new TC( parent );
}
+
+ virtual SyncWidget *syncWidget( QWidget *parent )
+ {
+ return new TS( parent );
+ }
+
};
}