summaryrefslogtreecommitdiffabout
path: root/microkde/kresources/managerimpl.h
authorzautrix <zautrix>2004-06-26 19:01:18 (UTC)
committer zautrix <zautrix>2004-06-26 19:01:18 (UTC)
commitb9aad1f15dc600e4dbe4c62d3fcced6363188ba3 (patch) (unidiff)
tree2c3d4004fb21c72cba65793859f9bcd8ffd3a49c /microkde/kresources/managerimpl.h
downloadkdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2
Initial revision
Diffstat (limited to 'microkde/kresources/managerimpl.h') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kresources/managerimpl.h113
1 files changed, 113 insertions, 0 deletions
diff --git a/microkde/kresources/managerimpl.h b/microkde/kresources/managerimpl.h
new file mode 100644
index 0000000..a049bcc
--- a/dev/null
+++ b/microkde/kresources/managerimpl.h
@@ -0,0 +1,113 @@
1/*
2 This file is part of libkresources.
3
4 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
5 Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
6 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details.
17
18 You should have received a copy of the GNU Library General Public License
19 along with this library; see the file COPYING.LIB. If not, write to
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA.
22*/
23
24#ifndef KRESOURCES_MANAGERIMPL_H
25#define KRESOURCES_MANAGERIMPL_H
26
27#include <qstring.h>
28#include <qptrlist.h>
29#include <qdict.h>
30//US
31#include <qobject.h>
32
33#include "resource.h"
34
35
36class KConfig;
37
38namespace KRES {
39
40class Resource;
41class Factory;
42
43class ManagerImplListener
44{
45 public:
46 virtual void resourceAdded( Resource *resource ) = 0;
47 virtual void resourceModified( Resource *resource ) = 0;
48 virtual void resourceDeleted( Resource *resource ) = 0;
49};
50
51
52/**
53 @internal
54
55 Do not use this class directly. Use ResourceManager instead
56*/
57class ManagerImpl : public QObject
58{
59 Q_OBJECT
60 public:
61 ManagerImpl( const QString &family );
62 ~ManagerImpl();
63
64 void readConfig( KConfig * );
65 void writeConfig( KConfig * );
66
67 void add( Resource *resource, bool useDCOP = true );
68 void remove( Resource *resource, bool useDCOP = true );
69
70 Resource *standardResource();
71 void setStandardResource( Resource *resource );
72
73 void setActive( Resource *resource, bool active );
74
75 Resource::List *resourceList();
76
77 QPtrList<Resource> resources();
78
79 // Get only active or passive resources
80 QPtrList<Resource> resources( bool active );
81
82 QStringList resourceNames();
83
84 void setListener( ManagerImplListener *listener );
85
86 public slots:
87 void resourceChanged( Resource *resource );
88
89 private:
90 // dcop calls
91
92 private:
93 void createStandardConfig();
94
95 Resource *readResourceConfig( const QString& identifier, bool checkActive );
96 void writeResourceConfig( Resource *resource, bool checkActive );
97
98 void removeResource( Resource *resource );
99 Resource *getResource( Resource *resource );
100 Resource *getResource( const QString& identifier );
101
102 QString mFamily;
103 KConfig *mConfig;
104 KConfig *mStdConfig;
105 Resource *mStandard;
106 Factory *mFactory;
107 Resource::List mResources;
108 ManagerImplListener *mListener;
109};
110
111}
112
113#endif