26 #include "kdedmodule.h"
27 #include "tdeconfigdata.h"
29 typedef TQMap<KEntryKey, TDESharedPtr<TDEShared> > KDEDObjectMap;
31 class KDEDModulePrivate
34 KDEDObjectMap *objMap;
41 d =
new KDEDModulePrivate;
44 connect(&(d->timer), TQ_SIGNAL(timeout()),
this, TQ_SLOT(
idle()));
47 KDEDModule::~KDEDModule()
55 d->timeout = secs*1000;
61 if (!d->objMap || d->objMap->isEmpty())
62 d->timer.start(d->timeout,
true);
68 d->objMap =
new KDEDObjectMap;
71 KEntryKey appKey(app, 0);
72 d->objMap->replace(appKey, 0);
74 KEntryKey indexKey(app, key);
77 TDESharedPtr<TDEShared> _obj = obj;
79 d->objMap->replace(indexKey, _obj);
87 KEntryKey indexKey(app, key);
89 KDEDObjectMap::Iterator it = d->objMap->find(indexKey);
90 if (it == d->objMap->end())
93 return it.data().data();
100 KEntryKey indexKey(app, key);
102 d->objMap->remove(indexKey);
111 KEntryKey indexKey(app, 0);
114 KDEDObjectMap::Iterator it = d->objMap->find(indexKey);
115 while (it != d->objMap->end())
117 KDEDObjectMap::Iterator it2 = it++;
118 if (it2.key().mGroup != app)
120 d->objMap->remove(it2);
127 return Kded::self()->isWindowRegistered(windowId);
129 #include "kdedmodule.moc"
void remove(const TQCString &app, const TQCString &key)
remove object indexed with app and key.
virtual void idle()
Called whenever the last referenced object gets dereferenced.
void setIdleTimeout(int secs)
Specifies the idle timeout in seconds.
KDEDModule(const TQCString &name)
Create a DCOPObject named name.
bool isWindowRegistered(long windowId)
Returns whether a certain mainwindow has registered itself with KDED.
void resetIdle()
Reset the idle timeout counter.
void insert(const TQCString &app, const TQCString &key, TDEShared *obj)
Insert obj indexed with app and key.
void removeAll(const TQCString &app)
remove all objects indexed with app.
TDEShared * find(const TQCString &app, const TQCString &key)
Lookup object indexed with app and key.
void moduleDeleted(KDEDModule *)
Emitted when the module is being deleted.