summaryrefslogtreecommitdiffabout
path: root/microkde/kresources/resource.h
Unidiff
Diffstat (limited to 'microkde/kresources/resource.h') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kresources/resource.h25
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
@@ -31,24 +31,25 @@
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 SyncWidget;
43 44
44/** 45/**
45 * @internal 46 * @internal
46 * @libdoc The KDE Resource library 47 * @libdoc The KDE Resource library
47 * 48 *
48 * NOTE: this library is NOT (YET?) PUBLIC. Do not publish this 49 * NOTE: this library is NOT (YET?) PUBLIC. Do not publish this
49 * interface, it is in constant flux. 50 * interface, it is in constant flux.
50 * 51 *
51 * The KDE Resource framework can be used to manage resources of 52 * The KDE Resource framework can be used to manage resources of
52 * different types, organized in families. The Resource framework 53 * different types, organized in families. The Resource framework
53 * is currently used for addressbook resources in libkabc and for 54 * is currently used for addressbook resources in libkabc and for
54 * calendar resources in libkcal. 55 * calendar resources in libkcal.
@@ -311,42 +312,48 @@ class Resource : public QObject
311 312
312 /** 313 /**
313 * Set the name of resource.You can override this method, 314 * Set the name of resource.You can override this method,
314 * but also remember to call Resource::setResourceName(). 315 * but also remember to call Resource::setResourceName().
315 */ 316 */
316 virtual void setResourceName( const QString &name ); 317 virtual void setResourceName( const QString &name );
317 318
318 /** 319 /**
319 * Returns the name of resource. 320 * Returns the name of resource.
320 */ 321 */
321 virtual QString resourceName() const; 322 virtual QString resourceName() const;
322 323
324
325
326 virtual bool isSyncable() const = 0;
327
328
323 /** 329 /**
324 Sets, if the resource is active. 330 Sets, if the resource is active.
325 */ 331 */
326 void setActive( bool active ); 332 void setActive( bool active );
327 333
328 /** 334 /**
329 Return true, if the resource is active. 335 Return true, if the resource is active.
330 */ 336 */
331 bool isActive() const; 337 bool isActive() const;
332 338
333 friend class Factory; 339 friend class Factory;
334 friend class ManagerImpl; 340 friend class ManagerImpl;
335 341
336 /** 342 /**
337 Print resource information as debug output. 343 Print resource information as debug output.
338 */ 344 */
339 virtual void dump() const; 345 virtual void dump() const;
340 346
347
341 protected: 348 protected:
342 /** 349 /**
343 * Open this resource. When called, the resource must be in 350 * Open this resource. When called, the resource must be in
344 * a closed state. 351 * a closed state.
345 * 352 *
346 * Returns true if the resource was opened successfully; 353 * Returns true if the resource was opened successfully;
347 * returns false if the resource was not opened successfully. 354 * returns false if the resource was not opened successfully.
348 * 355 *
349 * The result of this call can be accessed later by @ref isOpen() 356 * The result of this call can be accessed later by @ref isOpen()
350 */ 357 */
351 virtual bool doOpen() { return true; } 358 virtual bool doOpen() { return true; }
352 359
@@ -358,44 +365,52 @@ class Resource : public QObject
358 365
359 void setIdentifier( const QString& identifier ); 366 void setIdentifier( const QString& identifier );
360 void setType( const QString& type ); 367 void setType( const QString& type );
361 368
362 private: 369 private:
363 class ResourcePrivate; 370 class ResourcePrivate;
364 ResourcePrivate *d; 371 ResourcePrivate *d;
365}; 372};
366 373
367class PluginFactoryBase : public KLibFactory 374class PluginFactoryBase : public KLibFactory
368{ 375{
369 public: 376 public:
370 virtual Resource *resource( const KConfig *config ) = 0; 377 virtual Resource *resource( const KConfig *config, bool syncable ) = 0;
371 378
372 virtual ConfigWidget *configWidget( QWidget *parent ) = 0; 379 virtual ConfigWidget *configWidget( QWidget *parent ) = 0;
373 380
381 virtual SyncWidget *syncWidget( QWidget *parent ) = 0;
382
374 protected: 383 protected:
375 virtual QObject* createObject( QObject*, const char*, const char*, 384 virtual QObject* createObject( QObject*, const char*, const char*,
376 const QStringList & ) 385 const QStringList & )
377 { 386 {
378 return 0; 387 return 0;
379 } 388 }
380}; 389};
381 390
382template<class TR,class TC> 391template<class TR,class TC, class TS>
383class PluginFactory : public PluginFactoryBase 392class PluginFactory : public PluginFactoryBase
384{ 393{
385 public: 394 public:
386 Resource *resource( const KConfig *config ) 395 Resource *resource( const KConfig *config, bool syncable )
387 { 396 {
388 return new TR( config ); 397 return new TR( config, syncable );
389 } 398 }
390 399
391 ConfigWidget *configWidget( QWidget *parent ) 400 ConfigWidget *configWidget( QWidget *parent )
392 { 401 {
393 return new TC( parent ); 402 return new TC( parent );
394 } 403 }
404
405 virtual SyncWidget *syncWidget( QWidget *parent )
406 {
407 return new TS( parent );
408 }
409
395}; 410};
396 411
397 412
398 413
399} 414}
400 415
401#endif 416#endif