Diffstat (limited to 'microkde/kresources/resource.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | microkde/kresources/resource.h | 25 |
1 files changed, 20 insertions, 5 deletions
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 @@ -19,48 +19,49 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef KRESOURCES_RESOURCE_H #define KRESOURCES_RESOURCE_H //US #ifdef QT_THREAD_SUPPORT #include <qmutex.h> #endif //QT_THREAD_SUPPORT #include <qvaluelist.h> #include <qwidget.h> #include <qobject.h> #include <klibloader.h> 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 * interface, it is in constant flux. * * The KDE Resource framework can be used to manage resources of * different types, organized in families. The Resource framework * is currently used for addressbook resources in libkabc and for * calendar resources in libkcal. * * When you want to use the framework for a new family, you need to * <ul><li>Define a name for your resource family</li> * <li>subclass Resource and add the fields and method that are needed * in your application</li> * <li>If needed, override the doOpen() and doClose() methods. * <li> Provide a configuration possibility for resources in your * new family. You can use @ref ResourcesConfigPage to easily create a * KControl applet</li> * <li>In your application, you can use @ref ResourceManager to keep track * of the resources in your family, and you can use @ref ResourceSelectDialog * to let the user select a single resource.</li> @@ -299,103 +300,117 @@ class Resource : public QObject QString type() const; /** * Mark the resource as read-only. You can override this method, * but also remember to call Resource::setReadOnly(). */ virtual void setReadOnly( bool value ); /** * Returns, if the resource is read-only. */ virtual bool readOnly() const; /** * Set the name of resource.You can override this method, * but also remember to call Resource::setResourceName(). */ virtual void setResourceName( const QString &name ); /** * Returns the name of resource. */ virtual QString resourceName() const; + + + virtual bool isSyncable() const = 0; + + /** Sets, if the resource is active. */ void setActive( bool active ); /** Return true, if the resource is active. */ bool isActive() const; friend class Factory; friend class ManagerImpl; /** 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; * returns false if the resource was not opened successfully. * * The result of this call can be accessed later by @ref isOpen() */ virtual bool doOpen() { return true; } /** * Close this resource. Pre-condition: resource is open. * Post-condition: resource is closed. */ virtual void doClose() {} void setIdentifier( const QString& identifier ); void setType( const QString& type ); private: class ResourcePrivate; 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 ); + } + }; } #endif |