author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /microkde/kresources/manager.h | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
Diffstat (limited to 'microkde/kresources/manager.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | microkde/kresources/manager.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/microkde/kresources/manager.h b/microkde/kresources/manager.h index 69062da..88705d4 100644 --- a/microkde/kresources/manager.h +++ b/microkde/kresources/manager.h | |||
@@ -19,34 +19,36 @@ | |||
19 | You should have received a copy of the GNU Library General Public License | 19 | You should have received a copy of the GNU Library General Public License |
20 | along with this library; see the file COPYING.LIB. If not, write to | 20 | along with this library; see the file COPYING.LIB. If not, write to |
21 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 21 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
22 | Boston, MA 02111-1307, USA. | 22 | Boston, MA 02111-1307, USA. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | /* | 25 | /* |
26 | Enhanced Version of the file for platform independent KDE tools. | 26 | Enhanced Version of the file for platform independent KDE tools. |
27 | Copyright (c) 2004 Ulf Schenk | 27 | Copyright (c) 2004 Ulf Schenk |
28 | 28 | ||
29 | $Id$ | 29 | $Id$ |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #ifndef KRESOURCES_MANAGER_H | 32 | #ifndef KRESOURCES_MANAGER_H |
33 | #define KRESOURCES_MANAGER_H | 33 | #define KRESOURCES_MANAGER_H |
34 | 34 | ||
35 | #include <qdict.h> | 35 | #include <q3dict.h> |
36 | #include <qstringlist.h> | 36 | #include <qstringlist.h> |
37 | //Added by qt3to4: | ||
38 | #include <Q3PtrList> | ||
37 | 39 | ||
38 | #include "factory.h" | 40 | #include "factory.h" |
39 | #include "managerimpl.h" | 41 | #include "managerimpl.h" |
40 | 42 | ||
41 | namespace KRES { | 43 | namespace KRES { |
42 | 44 | ||
43 | class Resource; | 45 | class Resource; |
44 | 46 | ||
45 | template<class T> | 47 | template<class T> |
46 | class ManagerListener | 48 | class ManagerListener |
47 | { | 49 | { |
48 | public: | 50 | public: |
49 | virtual void resourceAdded( T *resource ) = 0; | 51 | virtual void resourceAdded( T *resource ) = 0; |
50 | virtual void resourceModified( T *resource ) = 0; | 52 | virtual void resourceModified( T *resource ) = 0; |
51 | virtual void resourceDeleted( T *resource ) = 0; | 53 | virtual void resourceDeleted( T *resource ) = 0; |
52 | }; | 54 | }; |
@@ -162,33 +164,33 @@ class Manager : private ManagerImplListener | |||
162 | ActiveIterator it; | 164 | ActiveIterator it; |
163 | it.mIt = mImpl->resourceList()->end(); | 165 | it.mIt = mImpl->resourceList()->end(); |
164 | it.mList = mImpl->resourceList(); | 166 | it.mList = mImpl->resourceList(); |
165 | return it; | 167 | return it; |
166 | } | 168 | } |
167 | 169 | ||
168 | bool isEmpty() const { return mImpl->resourceList()->isEmpty(); } | 170 | bool isEmpty() const { return mImpl->resourceList()->isEmpty(); } |
169 | 171 | ||
170 | Manager( const QString &family ) | 172 | Manager( const QString &family ) |
171 | { | 173 | { |
172 | mFactory = Factory::self( family ); | 174 | mFactory = Factory::self( family ); |
173 | // The managerimpl will use the same Factory object as the manager | 175 | // The managerimpl will use the same Factory object as the manager |
174 | // because of the Factory::self() pattern | 176 | // because of the Factory::self() pattern |
175 | mImpl = new ManagerImpl( family ); | 177 | mImpl = new ManagerImpl( family ); |
176 | mImpl->setListener( this ); | 178 | mImpl->setListener( this ); |
177 | 179 | ||
178 | mListeners = new QPtrList<ManagerListener<T> >; | 180 | mListeners = new Q3PtrList<ManagerListener<T> >; |
179 | } | 181 | } |
180 | 182 | ||
181 | virtual ~Manager() | 183 | virtual ~Manager() |
182 | { | 184 | { |
183 | mImpl->setListener( 0 ); | 185 | mImpl->setListener( 0 ); |
184 | delete mListeners; | 186 | delete mListeners; |
185 | delete mImpl; | 187 | delete mImpl; |
186 | } | 188 | } |
187 | 189 | ||
188 | /** | 190 | /** |
189 | Recreate Resource objects from configuration file. If cfg is 0, read standard | 191 | Recreate Resource objects from configuration file. If cfg is 0, read standard |
190 | configuration file. | 192 | configuration file. |
191 | */ | 193 | */ |
192 | void readConfig( KConfig *cfg = 0 ) | 194 | void readConfig( KConfig *cfg = 0 ) |
193 | { | 195 | { |
194 | mImpl->readConfig( cfg ); | 196 | mImpl->readConfig( cfg ); |
@@ -317,22 +319,22 @@ class Manager : private ManagerImplListener | |||
317 | listener->resourceModified( resource ); | 319 | listener->resourceModified( resource ); |
318 | } | 320 | } |
319 | 321 | ||
320 | virtual void resourceDeleted( Resource *res ) | 322 | virtual void resourceDeleted( Resource *res ) |
321 | { | 323 | { |
322 | 324 | ||
323 | T* resource = (T *)( res ); | 325 | T* resource = (T *)( res ); |
324 | ManagerListener<T> *listener; | 326 | ManagerListener<T> *listener; |
325 | for ( listener = mListeners->first(); listener; listener = mListeners->next() ) { | 327 | for ( listener = mListeners->first(); listener; listener = mListeners->next() ) { |
326 | listener->resourceDeleted( resource ); | 328 | listener->resourceDeleted( resource ); |
327 | } | 329 | } |
328 | } | 330 | } |
329 | 331 | ||
330 | private: | 332 | private: |
331 | ManagerImpl *mImpl; | 333 | ManagerImpl *mImpl; |
332 | Factory *mFactory; | 334 | Factory *mFactory; |
333 | QPtrList<ManagerListener<T> > *mListeners; | 335 | Q3PtrList<ManagerListener<T> > *mListeners; |
334 | }; | 336 | }; |
335 | 337 | ||
336 | } | 338 | } |
337 | 339 | ||
338 | #endif | 340 | #endif |