summaryrefslogtreecommitdiffabout
path: root/microkde
Unidiff
Diffstat (limited to 'microkde') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kresources/manager.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/microkde/kresources/manager.h b/microkde/kresources/manager.h
index 0e6f838..69062da 100644
--- a/microkde/kresources/manager.h
+++ b/microkde/kresources/manager.h
@@ -182,159 +182,157 @@ class Manager : private ManagerImplListener
182 { 182 {
183 mImpl->setListener( 0 ); 183 mImpl->setListener( 0 );
184 delete mListeners; 184 delete mListeners;
185 delete mImpl; 185 delete mImpl;
186 } 186 }
187 187
188 /** 188 /**
189 Recreate Resource objects from configuration file. If cfg is 0, read standard 189 Recreate Resource objects from configuration file. If cfg is 0, read standard
190 configuration file. 190 configuration file.
191 */ 191 */
192 void readConfig( KConfig *cfg = 0 ) 192 void readConfig( KConfig *cfg = 0 )
193 { 193 {
194 mImpl->readConfig( cfg ); 194 mImpl->readConfig( cfg );
195 } 195 }
196 196
197 /** 197 /**
198 Write configuration of Resource objects to configuration file. If cfg is 0, write 198 Write configuration of Resource objects to configuration file. If cfg is 0, write
199 to standard configuration file. 199 to standard configuration file.
200 */ 200 */
201 void writeConfig( KConfig *cfg = 0 ) 201 void writeConfig( KConfig *cfg = 0 )
202 { 202 {
203 mImpl->writeConfig( cfg ); 203 mImpl->writeConfig( cfg );
204 } 204 }
205 205
206 /** 206 /**
207 Add resource to manager. This passes ownership of the Resource object 207 Add resource to manager. This passes ownership of the Resource object
208 to the manager. 208 to the manager.
209 */ 209 */
210 void add( Resource *resource ) 210 void add( Resource *resource )
211 { 211 {
212 if ( resource ) mImpl->add( resource ); 212 if ( resource ) mImpl->add( resource );
213 } 213 }
214 214
215 void remove( Resource *resource ) 215 void remove( Resource *resource )
216 { 216 {
217 if ( resource ) mImpl->remove( resource ); 217 if ( resource ) mImpl->remove( resource );
218 } 218 }
219 219
220 T* standardResource() 220 T* standardResource()
221 { 221 {
222 return static_cast<T *>( mImpl->standardResource() ); 222 return static_cast<T *>( mImpl->standardResource() );
223 } 223 }
224 224
225 void setStandardResource( T *resource ) 225 void setStandardResource( T *resource )
226 { 226 {
227 if ( resource ) mImpl->setStandardResource( resource ); 227 if ( resource ) mImpl->setStandardResource( resource );
228 } 228 }
229 229
230 void setActive( Resource *resource, bool active ) 230 void setActive( Resource *resource, bool active )
231 { 231 {
232 if ( resource ) mImpl->setActive( resource, active ); 232 if ( resource ) mImpl->setActive( resource, active );
233 } 233 }
234 234
235 /** 235 /**
236 Returns a list of the names of the reources managed by the 236 Returns a list of the names of the reources managed by the
237 Manager for this family. 237 Manager for this family.
238 */ 238 */
239 QStringList resourceNames() const 239 QStringList resourceNames() const
240 { 240 {
241 return mImpl->resourceNames(); 241 return mImpl->resourceNames();
242 } 242 }
243 243
244 ConfigWidget *configWidget( const QString& type, QWidget *parent = 0 ) 244 ConfigWidget *configWidget( const QString& type, QWidget *parent = 0 )
245 { 245 {
246 return mFactory->resourceConfigWidget( type, parent ); 246 return mFactory->configWidget( type, parent );
247 } 247 }
248 248
249 /** 249 /**
250 Creates a new resource of type @param type, with default 250 Creates a new resource of type @param type, with default
251 settings. The resource is 251 settings. The resource is
252 not added to the manager, the application has to do that. 252 not added to the manager, the application has to do that.
253 Returns a pointer to a resource object or a null pointer 253 Returns a pointer to a resource object or a null pointer
254 if resource type doesn't exist. 254 if resource type doesn't exist.
255 255
256 @param type The type of the resource, one of those returned 256 @param type The type of the resource, one of those returned
257 by @ref resourceTypeNames() 257 by @ref resourceTypeNames()
258 */ 258 */
259 T *createResource( const QString& type ) 259 T *createResource( const QString& type )
260 { 260 {
261 return (T *)( mFactory->resource( type, 0 ) ); 261 return (T *)( mFactory->resource( type, 0 ) );
262 } 262 }
263 263
264 /** 264 /**
265 Returns a list of the names of all available resource types. 265 Returns a list of the names of all available resource types.
266 */ 266 */
267 QStringList resourceTypeNames() const 267 QStringList resourceTypeNames() const
268 { 268 {
269 return mFactory->typeNames(); 269 return mFactory->typeNames();
270 } 270 }
271 271
272 QStringList resourceTypeDescriptions() const 272 QStringList resourceTypeDescriptions() const
273 { 273 {
274 QStringList typeDescs; 274 QStringList typeDescs;
275 QStringList types = mFactory->typeNames(); 275 QStringList types = mFactory->typeNames();
276 276
277 for ( QStringList::ConstIterator it = types.begin(); it != types.end(); ++it ) { 277 for ( QStringList::ConstIterator it = types.begin(); it != types.end(); ++it ) {
278 QString desc = mFactory->typeName( *it ); 278 QString desc = mFactory->typeName( *it );
279 if ( !mFactory->typeDescription( *it ).isEmpty() ) 279 if ( !mFactory->typeDescription( *it ).isEmpty() )
280 desc += " (" + mFactory->typeDescription( *it ) + ")"; 280 desc += " (" + mFactory->typeDescription( *it ) + ")";
281 281
282 typeDescs.append( desc ); 282 typeDescs.append( desc );
283 } 283 }
284 284
285 return typeDescs; 285 return typeDescs;
286 } 286 }
287 287
288 void resourceChanged( T *resource ) 288 void resourceChanged( T *resource )
289 { 289 {
290 mImpl->resourceChanged( resource ); 290 mImpl->resourceChanged( resource );
291 } 291 }
292 292
293 void addListener( ManagerListener<T> *listener ) 293 void addListener( ManagerListener<T> *listener )
294 { 294 {
295 mListeners->append( listener ); 295 mListeners->append( listener );
296 } 296 }
297 297
298 void removeListener( ManagerListener<T> *listener ) 298 void removeListener( ManagerListener<T> *listener )
299 { 299 {
300 mListeners->remove( listener ); 300 mListeners->remove( listener );
301 } 301 }
302 302
303 virtual void resourceAdded( Resource *res ) 303 virtual void resourceAdded( Resource *res )
304 { 304 {
305 kdDebug(5650) << "Manager::resourceAdded " << res->resourceName() << endl;
306 T* resource = (T *)( res ); 305 T* resource = (T *)( res );
307 ManagerListener<T> *listener; 306 ManagerListener<T> *listener;
308 for ( listener = mListeners->first(); listener; listener = mListeners->next() ) 307 for ( listener = mListeners->first(); listener; listener = mListeners->next() )
309 listener->resourceAdded( resource ); 308 listener->resourceAdded( resource );
310 } 309 }
311 310
312 virtual void resourceModified( Resource *res ) 311 virtual void resourceModified( Resource *res )
313 { 312 {
314 kdDebug(5650) << "Manager::resourceModified " << res->resourceName() << endl; 313
315 T* resource = (T *)( res ); 314 T* resource = (T *)( res );
316 ManagerListener<T> *listener; 315 ManagerListener<T> *listener;
317 for ( listener = mListeners->first(); listener; listener = mListeners->next() ) 316 for ( listener = mListeners->first(); listener; listener = mListeners->next() )
318 listener->resourceModified( resource ); 317 listener->resourceModified( resource );
319 } 318 }
320 319
321 virtual void resourceDeleted( Resource *res ) 320 virtual void resourceDeleted( Resource *res )
322 { 321 {
323 kdDebug(5650) << "Manager::resourceDeleted " << res->resourceName() << endl; 322
324 T* resource = (T *)( res ); 323 T* resource = (T *)( res );
325 ManagerListener<T> *listener; 324 ManagerListener<T> *listener;
326 for ( listener = mListeners->first(); listener; listener = mListeners->next() ) { 325 for ( listener = mListeners->first(); listener; listener = mListeners->next() ) {
327 kdDebug(5650) << "Notifying a listener to Manager..." << endl;
328 listener->resourceDeleted( resource ); 326 listener->resourceDeleted( resource );
329 } 327 }
330 } 328 }
331 329
332 private: 330 private:
333 ManagerImpl *mImpl; 331 ManagerImpl *mImpl;
334 Factory *mFactory; 332 Factory *mFactory;
335 QPtrList<ManagerListener<T> > *mListeners; 333 QPtrList<ManagerListener<T> > *mListeners;
336}; 334};
337 335
338} 336}
339 337
340#endif 338#endif