summaryrefslogtreecommitdiffabout
path: root/microkde/kresources/resource.h
Unidiff
Diffstat (limited to 'microkde/kresources/resource.h') (more/less context) (show whitespace changes)
-rw-r--r--microkde/kresources/resource.h24
1 files changed, 5 insertions, 19 deletions
diff --git a/microkde/kresources/resource.h b/microkde/kresources/resource.h
index 70b5613..ed5af96 100644
--- a/microkde/kresources/resource.h
+++ b/microkde/kresources/resource.h
@@ -31,25 +31,24 @@
31#include <qvaluelist.h> 31#include <qvaluelist.h>
32#include <qwidget.h> 32#include <qwidget.h>
33 33
34#include <qobject.h> 34#include <qobject.h>
35 35
36#include <klibloader.h> 36#include <klibloader.h>
37 37
38class KConfig; 38class KConfig;
39 39
40namespace KRES { 40namespace KRES {
41 41
42class ConfigWidget; 42class ConfigWidget;
43class SyncWidgetContainer;
44 43
45/** 44/**
46 * @internal 45 * @internal
47 * @libdoc The KDE Resource library 46 * @libdoc The KDE Resource library
48 * 47 *
49 * NOTE: this library is NOT (YET?) PUBLIC. Do not publish this 48 * NOTE: this library is NOT (YET?) PUBLIC. Do not publish this
50 * interface, it is in constant flux. 49 * interface, it is in constant flux.
51 * 50 *
52 * The KDE Resource framework can be used to manage resources of 51 * The KDE Resource framework can be used to manage resources of
53 * different types, organized in families. The Resource framework 52 * different types, organized in families. The Resource framework
54 * is currently used for addressbook resources in libkabc and for 53 * is currently used for addressbook resources in libkabc and for
55 * calendar resources in libkcal. 54 * calendar resources in libkcal.
@@ -223,25 +222,25 @@ resourceexample_la_LIBADD= -lkderesources
223 222
224linkdir= $(kde_datadir)/resources/family 223linkdir= $(kde_datadir)/resources/family
225link_DATA= resourceexample.desktop 224link_DATA= resourceexample.desktop
226</pre> 225</pre>
227 * 226 *
228 * 227 *
229 */ 228 */
230 229
231/** 230/**
232 * A @ref Resource is a ... 231 * A @ref Resource is a ...
233 * 232 *
234 * A subclass should reimplement at least the constructor and the 233 * A subclass should reimplement at least the constructor and the
235 * @ref writeConfig method. 234k * @ref writeConfig method.
236 * 235 *
237 */ 236 */
238class Resource : public QObject 237class Resource : public QObject
239{ 238{
240 Q_OBJECT 239 Q_OBJECT
241 240
242 public: 241 public:
243 typedef QValueList<Resource *> List; 242 typedef QValueList<Resource *> List;
244 243
245 /** 244 /**
246 * Constructor. Construct resource from config. 245 * Constructor. Construct resource from config.
247 * @param config Configuration to read persistence information from. 246 * @param config Configuration to read persistence information from.
@@ -314,29 +313,24 @@ class Resource : public QObject
314 bool includeInSync() const; 313 bool includeInSync() const;
315 /** 314 /**
316 * Set the name of resource.You can override this method, 315 * Set the name of resource.You can override this method,
317 * but also remember to call Resource::setResourceName(). 316 * but also remember to call Resource::setResourceName().
318 */ 317 */
319 virtual void setResourceName( const QString &name ); 318 virtual void setResourceName( const QString &name );
320 319
321 /** 320 /**
322 * Returns the name of resource. 321 * Returns the name of resource.
323 */ 322 */
324 virtual QString resourceName() const; 323 virtual QString resourceName() const;
325 324
326
327
328 virtual bool isSyncable() const = 0;
329
330
331 /** 325 /**
332 Sets, if the resource is active. 326 Sets, if the resource is active.
333 */ 327 */
334 void setActive( bool active ); 328 void setActive( bool active );
335 329
336 /** 330 /**
337 Return true, if the resource is active. 331 Return true, if the resource is active.
338 */ 332 */
339 bool isActive() const; 333 bool isActive() const;
340 334
341 friend class Factory; 335 friend class Factory;
342 friend class ManagerImpl; 336 friend class ManagerImpl;
@@ -367,52 +361,44 @@ class Resource : public QObject
367 361
368 void setIdentifier( const QString& identifier ); 362 void setIdentifier( const QString& identifier );
369 void setType( const QString& type ); 363 void setType( const QString& type );
370 364
371 private: 365 private:
372 class ResourcePrivate; 366 class ResourcePrivate;
373 ResourcePrivate *d; 367 ResourcePrivate *d;
374}; 368};
375 369
376class PluginFactoryBase : public KLibFactory 370class PluginFactoryBase : public KLibFactory
377{ 371{
378 public: 372 public:
379 virtual Resource *resource( const KConfig *config, bool syncable ) = 0; 373 virtual Resource *resource( const KConfig *config) = 0;
380 374
381 virtual ConfigWidget *configWidget( QWidget *parent ) = 0; 375 virtual ConfigWidget *configWidget( QWidget *parent ) = 0;
382 376
383 virtual SyncWidgetContainer *syncWidgetContainer() = 0;
384
385 protected: 377 protected:
386 virtual QObject* createObject( QObject*, const char*, const char*, 378 virtual QObject* createObject( QObject*, const char*, const char*,
387 const QStringList & ) 379 const QStringList & )
388 { 380 {
389 return 0; 381 return 0;
390 } 382 }
391}; 383};
392 384
393template<class TR,class TC, class TS> 385template<class TR,class TC>
394class PluginFactory : public PluginFactoryBase 386class PluginFactory : public PluginFactoryBase
395{ 387{
396 public: 388 public:
397 Resource *resource( const KConfig *config, bool syncable ) 389 Resource *resource( const KConfig *config)
398 { 390 {
399 return new TR( config, syncable ); 391 return new TR( config );
400 } 392 }
401 393
402 ConfigWidget *configWidget( QWidget *parent ) 394 ConfigWidget *configWidget( QWidget *parent )
403 { 395 {
404 return new TC( parent ); 396 return new TC( parent );
405 } 397 }
406
407 SyncWidgetContainer *syncWidgetContainer()
408 {
409 return new TS();
410 }
411
412}; 398};
413 399
414 400
415 401
416} 402}
417 403
418#endif 404#endif