managerimpl.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef KRESOURCES_MANAGERIMPL_H
00024 #define KRESOURCES_MANAGERIMPL_H
00025
00026 #include <qstring.h>
00027 #include <qptrlist.h>
00028 #include <qdict.h>
00029
00030 #include "manageriface.h"
00031 #include <kresources/resource.h>
00032
00033 class KConfig;
00034
00035 namespace KRES {
00036
00037 class Resource;
00038 class Factory;
00039 class ManagerNotifier;
00040
00046 class KRESOURCES_EXPORT ManagerImpl : virtual public ManagerIface
00047 {
00048 public:
00049 ManagerImpl( ManagerNotifier *, const QString &family );
00050 ~ManagerImpl();
00051
00052 void readConfig( KConfig * );
00053 void writeConfig( KConfig * );
00054
00055 void add( Resource *resource );
00056 void remove( Resource *resource );
00057 void change( Resource *resource );
00058
00059 Resource *standardResource();
00060 void setStandardResource( Resource *resource );
00061
00062 void setActive( Resource *resource, bool active );
00063
00064 Resource::List *resourceList();
00065
00066 QPtrList<Resource> resources();
00067
00068
00069 QPtrList<Resource> resources( bool active );
00070
00071 QStringList resourceNames();
00072
00073 static QString defaultConfigFile( const QString &family );
00074
00075 private:
00076
00077 void dcopKResourceAdded( QString managerId, QString resourceId );
00078 void dcopKResourceModified( QString managerId, QString resourceId );
00079 void dcopKResourceDeleted( QString managerId, QString resourceId );
00080
00081 private:
00082 void createStandardConfig();
00083
00084 Resource *readResourceConfig( const QString& identifier, bool checkActive );
00085 void writeResourceConfig( Resource *resource, bool checkActive );
00086
00087 void removeResource( Resource *resource );
00088 Resource *getResource( Resource *resource );
00089 Resource *getResource( const QString& identifier );
00090
00091 ManagerNotifier *mNotifier;
00092 QString mFamily;
00093 KConfig *mConfig;
00094 KConfig *mStdConfig;
00095 Resource *mStandard;
00096 Factory *mFactory;
00097 Resource::List mResources;
00098 QString mId;
00099 bool mConfigRead;
00100
00101 class ManagerImplPrivate;
00102 ManagerImplPrivate *d;
00103 };
00104
00105 }
00106
00107 #endif
|