summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kresources/resource.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/microkde/kresources/resource.h b/microkde/kresources/resource.h
index 7ff4f23..64e7424 100644
--- a/microkde/kresources/resource.h
+++ b/microkde/kresources/resource.h
@@ -4,69 +4,70 @@
4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org> 5 Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
11 11
12 This library is distributed in the hope that it will be useful, 12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details. 15 Library General Public License for more details.
16 16
17 You should have received a copy of the GNU Library General Public License 17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to 18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. 20 Boston, MA 02111-1307, USA.
21*/ 21*/
22 22
23#ifndef KRESOURCES_RESOURCE_H 23#ifndef KRESOURCES_RESOURCE_H
24#define KRESOURCES_RESOURCE_H 24#define KRESOURCES_RESOURCE_H
25 25
26//US 26//US
27#ifdef QT_THREAD_SUPPORT 27#ifdef QT_THREAD_SUPPORT
28#include <qmutex.h> 28#include <qmutex.h>
29#endif //QT_THREAD_SUPPORT 29#endif //QT_THREAD_SUPPORT
30 30
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>
37
36class KConfig; 38class KConfig;
37 39
38namespace KRES { 40namespace KRES {
39 41
40class KLibFactory;
41class ConfigWidget; 42class ConfigWidget;
42 43
43/** 44/**
44 * @internal 45 * @internal
45 * @libdoc The KDE Resource library 46 * @libdoc The KDE Resource library
46 * 47 *
47 * NOTE: this library is NOT (YET?) PUBLIC. Do not publish this 48 * NOTE: this library is NOT (YET?) PUBLIC. Do not publish this
48 * interface, it is in constant flux. 49 * interface, it is in constant flux.
49 * 50 *
50 * The KDE Resource framework can be used to manage resources of 51 * The KDE Resource framework can be used to manage resources of
51 * different types, organized in families. The Resource framework 52 * different types, organized in families. The Resource framework
52 * is currently used for addressbook resources in libkabc and for 53 * is currently used for addressbook resources in libkabc and for
53 * calendar resources in libkcal. 54 * calendar resources in libkcal.
54 * 55 *
55 * When you want to use the framework for a new family, you need to 56 * When you want to use the framework for a new family, you need to
56 * <ul><li>Define a name for your resource family</li> 57 * <ul><li>Define a name for your resource family</li>
57 * <li>subclass Resource and add the fields and method that are needed 58 * <li>subclass Resource and add the fields and method that are needed
58 * in your application</li> 59 * in your application</li>
59 * <li>If needed, override the doOpen() and doClose() methods. 60 * <li>If needed, override the doOpen() and doClose() methods.
60 * <li> Provide a configuration possibility for resources in your 61 * <li> Provide a configuration possibility for resources in your
61 * new family. You can use @ref ResourcesConfigPage to easily create a 62 * new family. You can use @ref ResourcesConfigPage to easily create a
62 * KControl applet</li> 63 * KControl applet</li>
63 * <li>In your application, you can use @ref ResourceManager to keep track 64 * <li>In your application, you can use @ref ResourceManager to keep track
64 * of the resources in your family, and you can use @ref ResourceSelectDialog 65 * of the resources in your family, and you can use @ref ResourceSelectDialog
65 * to let the user select a single resource.</li> 66 * to let the user select a single resource.</li>
66 * </ul> 67 * </ul>
67 * 68 *
68 * When you want to add a new resource type to an existing resource family, 69 * When you want to add a new resource type to an existing resource family,
69 * you need to 70 * you need to
70 * <ul><li>Further subclass the family-specific Resource to implement 71 * <ul><li>Further subclass the family-specific Resource to implement
71 * resource type-specific operation</li> 72 * resource type-specific operation</li>
72 * <li>Subclass ResourceConfigWidget to provide a configuration widget 73 * <li>Subclass ResourceConfigWidget to provide a configuration widget
@@ -334,66 +335,65 @@ class Resource : public QObject
334 335
335 /** 336 /**
336 Print resource information as debug output. 337 Print resource information as debug output.
337 */ 338 */
338 virtual void dump() const; 339 virtual void dump() const;
339 340
340 protected: 341 protected:
341 /** 342 /**
342 * Open this resource. When called, the resource must be in 343 * Open this resource. When called, the resource must be in
343 * a closed state. 344 * a closed state.
344 * 345 *
345 * Returns true if the resource was opened successfully; 346 * Returns true if the resource was opened successfully;
346 * returns false if the resource was not opened successfully. 347 * returns false if the resource was not opened successfully.
347 * 348 *
348 * The result of this call can be accessed later by @ref isOpen() 349 * The result of this call can be accessed later by @ref isOpen()
349 */ 350 */
350 virtual bool doOpen() { return true; } 351 virtual bool doOpen() { return true; }
351 352
352 /** 353 /**
353 * Close this resource. Pre-condition: resource is open. 354 * Close this resource. Pre-condition: resource is open.
354 * Post-condition: resource is closed. 355 * Post-condition: resource is closed.
355 */ 356 */
356 virtual void doClose() {} 357 virtual void doClose() {}
357 358
358 void setIdentifier( const QString& identifier ); 359 void setIdentifier( const QString& identifier );
359 void setType( const QString& type ); 360 void setType( const QString& type );
360 361
361 private: 362 private:
362 class ResourcePrivate; 363 class ResourcePrivate;
363 ResourcePrivate *d; 364 ResourcePrivate *d;
364}; 365};
365 366
366//US class PluginFactoryBase : public KLibFactory 367class PluginFactoryBase : public KLibFactory
367class PluginFactoryBase
368{ 368{
369 public: 369 public:
370 virtual Resource *resource( const KConfig *config ) = 0; 370 virtual Resource *resource( const KConfig *config ) = 0;
371 371
372 virtual ConfigWidget *configWidget( QWidget *parent ) = 0; 372 virtual ConfigWidget *configWidget( QWidget *parent ) = 0;
373 373
374 protected: 374 protected:
375 virtual QObject* createObject( QObject*, const char*, const char*, 375 virtual QObject* createObject( QObject*, const char*, const char*,
376 const QStringList & ) 376 const QStringList & )
377 { 377 {
378 return 0; 378 return 0;
379 } 379 }
380}; 380};
381 381
382template<class TR,class TC> 382template<class TR,class TC>
383class PluginFactory : public PluginFactoryBase 383class PluginFactory : public PluginFactoryBase
384{ 384{
385 public: 385 public:
386 Resource *resource( const KConfig *config ) 386 Resource *resource( const KConfig *config )
387 { 387 {
388 return new TR( config ); 388 return new TR( config );
389 } 389 }
390 390
391 ConfigWidget *configWidget( QWidget *parent ) 391 ConfigWidget *configWidget( QWidget *parent )
392 { 392 {
393 return new TC( parent ); 393 return new TC( parent );
394 } 394 }
395}; 395};
396 396
397 397
398 398
399} 399}