-rw-r--r-- | microkde/kresources/managerimpl.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/microkde/kresources/managerimpl.cpp b/microkde/kresources/managerimpl.cpp index 5bd9eb7..566b8f4 100644 --- a/microkde/kresources/managerimpl.cpp +++ b/microkde/kresources/managerimpl.cpp | |||
@@ -96,141 +96,141 @@ void ManagerImpl::readConfig( KConfig *cfg ) | |||
96 | 96 | ||
97 | mStandard = 0; | 97 | mStandard = 0; |
98 | 98 | ||
99 | mConfig->setGroup( "General" ); | 99 | mConfig->setGroup( "General" ); |
100 | 100 | ||
101 | QStringList keys = mConfig->readListEntry( "ResourceKeys" ); | 101 | QStringList keys = mConfig->readListEntry( "ResourceKeys" ); |
102 | keys += mConfig->readListEntry( "PassiveResourceKeys" ); | 102 | keys += mConfig->readListEntry( "PassiveResourceKeys" ); |
103 | 103 | ||
104 | QString standardKey = mConfig->readEntry( "Standard" ); | 104 | QString standardKey = mConfig->readEntry( "Standard" ); |
105 | 105 | ||
106 | for ( QStringList::Iterator it = keys.begin(); it != keys.end(); ++it ) { | 106 | for ( QStringList::Iterator it = keys.begin(); it != keys.end(); ++it ) { |
107 | readResourceConfig( *it, false ); | 107 | readResourceConfig( *it, false ); |
108 | } | 108 | } |
109 | 109 | ||
110 | } | 110 | } |
111 | 111 | ||
112 | void ManagerImpl::writeConfig( KConfig *cfg ) | 112 | void ManagerImpl::writeConfig( KConfig *cfg ) |
113 | { | 113 | { |
114 | //USqDebug("ManagerImpl::writeConfig begin this= %ul cfg=%ul", this, cfg); | 114 | //USqDebug("ManagerImpl::writeConfig begin this= %ul cfg=%ul", this, cfg); |
115 | 115 | ||
116 | 116 | ||
117 | kdDebug(5650) << "ManagerImpl::writeConfig()" << endl; | 117 | kdDebug(5650) << "ManagerImpl::writeConfig()" << endl; |
118 | 118 | ||
119 | if ( !cfg ) { | 119 | if ( !cfg ) { |
120 | createStandardConfig(); | 120 | createStandardConfig(); |
121 | } else { | 121 | } else { |
122 | mConfig = cfg; | 122 | mConfig = cfg; |
123 | } | 123 | } |
124 | 124 | ||
125 | QStringList activeKeys; | 125 | QStringList activeKeys; |
126 | QStringList passiveKeys; | 126 | QStringList passiveKeys; |
127 | 127 | ||
128 | // First write all keys, collect active and passive keys on the way | 128 | // First write all keys, collect active and passive keys on the way |
129 | Resource::List::Iterator it; | 129 | Resource::List::Iterator it; |
130 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { | 130 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { |
131 | writeResourceConfig( *it, false ); | 131 | writeResourceConfig( *it, false ); |
132 | 132 | ||
133 | QString key = (*it)->identifier(); | 133 | QString key = (*it)->identifier(); |
134 | if( (*it)->isActive() ) | 134 | if( (*it)->isActive() ) |
135 | activeKeys.append( key ); | 135 | activeKeys.append( key ); |
136 | else | 136 | else |
137 | passiveKeys.append( key ); | 137 | passiveKeys.append( key ); |
138 | } | 138 | } |
139 | 139 | ||
140 | // And then the general group | 140 | // And then the general group |
141 | 141 | ||
142 | kdDebug(5650) << "Saving general info" << endl; | 142 | kdDebug(5650) << "Saving general info" << endl; |
143 | mConfig->setGroup( "General" ); | 143 | mConfig->setGroup( "General" ); |
144 | mConfig->writeEntry( "ResourceKeys", activeKeys ); | 144 | mConfig->writeEntry( "ResourceKeys", activeKeys ); |
145 | mConfig->writeEntry( "PassiveResourceKeys", passiveKeys ); | 145 | mConfig->writeEntry( "PassiveResourceKeys", passiveKeys ); |
146 | if ( mStandard ) | 146 | if ( mStandard ) |
147 | mConfig->writeEntry( "Standard", mStandard->identifier() ); | 147 | mConfig->writeEntry( "Standard", mStandard->identifier() ); |
148 | else | 148 | else |
149 | mConfig->writeEntry( "Standard", "" ); | 149 | mConfig->writeEntry( "Standard", "" ); |
150 | 150 | ||
151 | mConfig->sync(); | 151 | mConfig->sync(); |
152 | kdDebug(5650) << "ManagerImpl::save() finished" << endl; | 152 | kdDebug(5650) << "ManagerImpl::save() finished" << endl; |
153 | 153 | ||
154 | //US qDebug("ManagerImpl::writeConfig end this= %ul cfg=%ul", this, cfg); | 154 | //US qDebug("ManagerImpl::writeConfig end this= %ul cfg=%ul", this, cfg); |
155 | 155 | ||
156 | } | 156 | } |
157 | 157 | ||
158 | void ManagerImpl::add( Resource *resource, bool useDCOP ) | 158 | void ManagerImpl::add( Resource *resource, bool useDCOP ) |
159 | { | 159 | { |
160 | qDebug("ManagerImpl::add begin this= %ul resource=%ul", this, resource); | 160 | //qDebug("ManagerImpl::add begin this= %ul resource=%ul", this, resource); |
161 | 161 | ||
162 | resource->setActive( true ); | 162 | resource->setActive( true ); |
163 | 163 | ||
164 | if ( mResources.isEmpty() ) { | 164 | if ( mResources.isEmpty() ) { |
165 | mStandard = resource; | 165 | mStandard = resource; |
166 | } | 166 | } |
167 | 167 | ||
168 | mResources.append( resource ); | 168 | mResources.append( resource ); |
169 | 169 | ||
170 | writeResourceConfig( resource, true ); | 170 | writeResourceConfig( resource, true ); |
171 | 171 | ||
172 | qDebug("ManagerImpl::add end this= %ul resource=%ul", this, resource); | 172 | //qDebug("ManagerImpl::add end this= %ul resource=%ul", this, resource); |
173 | 173 | ||
174 | } | 174 | } |
175 | 175 | ||
176 | void ManagerImpl::remove( Resource *resource, bool useDCOP ) | 176 | void ManagerImpl::remove( Resource *resource, bool useDCOP ) |
177 | { | 177 | { |
178 | if ( mStandard == resource ) mStandard = 0; | 178 | if ( mStandard == resource ) mStandard = 0; |
179 | removeResource( resource ); | 179 | removeResource( resource ); |
180 | 180 | ||
181 | mResources.remove( resource ); | 181 | mResources.remove( resource ); |
182 | 182 | ||
183 | delete resource; | 183 | delete resource; |
184 | 184 | ||
185 | kdDebug(5650) << "Finished ManagerImpl::remove()" << endl; | 185 | kdDebug(5650) << "Finished ManagerImpl::remove()" << endl; |
186 | } | 186 | } |
187 | 187 | ||
188 | void ManagerImpl::setActive( Resource *resource, bool active ) | 188 | void ManagerImpl::setActive( Resource *resource, bool active ) |
189 | { | 189 | { |
190 | if ( resource && resource->isActive() != active ) { | 190 | if ( resource && resource->isActive() != active ) { |
191 | resource->setActive( active ); | 191 | resource->setActive( active ); |
192 | } | 192 | } |
193 | } | 193 | } |
194 | 194 | ||
195 | Resource *ManagerImpl::standardResource() | 195 | Resource *ManagerImpl::standardResource() |
196 | { | 196 | { |
197 | return mStandard; | 197 | return mStandard; |
198 | } | 198 | } |
199 | 199 | ||
200 | void ManagerImpl::setStandardResource( Resource *resource ) | 200 | void ManagerImpl::setStandardResource( Resource *resource ) |
201 | { | 201 | { |
202 | mStandard = resource; | 202 | mStandard = resource; |
203 | } | 203 | } |
204 | 204 | ||
205 | void ManagerImpl::resourceChanged( Resource *resource ) | 205 | void ManagerImpl::resourceChanged( Resource *resource ) |
206 | { | 206 | { |
207 | writeResourceConfig( resource, true ); | 207 | writeResourceConfig( resource, true ); |
208 | 208 | ||
209 | 209 | ||
210 | // ManagerIface_stub allManagers( "*", "ManagerIface_" + mFamily.utf8() ); | 210 | // ManagerIface_stub allManagers( "*", "ManagerIface_" + mFamily.utf8() ); |
211 | // allManagers.dcopResourceModified( resource->identifier() ); | 211 | // allManagers.dcopResourceModified( resource->identifier() ); |
212 | } | 212 | } |
213 | 213 | ||
214 | // DCOP asynchronous functions | 214 | // DCOP asynchronous functions |
215 | //US since we work from inside the application, we call the methods directly. | 215 | //US since we work from inside the application, we call the methods directly. |
216 | 216 | ||
217 | QStringList ManagerImpl::resourceNames() | 217 | QStringList ManagerImpl::resourceNames() |
218 | { | 218 | { |
219 | QStringList result; | 219 | QStringList result; |
220 | 220 | ||
221 | Resource::List::ConstIterator it; | 221 | Resource::List::ConstIterator it; |
222 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { | 222 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { |
223 | result.append( (*it)->resourceName() ); | 223 | result.append( (*it)->resourceName() ); |
224 | } | 224 | } |
225 | return result; | 225 | return result; |
226 | } | 226 | } |
227 | 227 | ||
228 | Resource::List *ManagerImpl::resourceList() | 228 | Resource::List *ManagerImpl::resourceList() |
229 | { | 229 | { |
230 | return &mResources; | 230 | return &mResources; |
231 | } | 231 | } |
232 | 232 | ||
233 | QPtrList<Resource> ManagerImpl::resources() | 233 | QPtrList<Resource> ManagerImpl::resources() |
234 | { | 234 | { |
235 | QPtrList<Resource> result; | 235 | QPtrList<Resource> result; |
236 | 236 | ||