author | zautrix <zautrix> | 2004-07-07 03:28:52 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-07-07 03:28:52 (UTC) |
commit | 816db8f76a1fd8b5cc586dfd5ebf8d6298221801 (patch) (unidiff) | |
tree | e418207a02e60c0807e75731a19c44a58d0fb896 | |
parent | 3db5c4e190d1031f2471516f8a52114f06d1a3eb (diff) | |
download | kdepimpi-816db8f76a1fd8b5cc586dfd5ebf8d6298221801.zip kdepimpi-816db8f76a1fd8b5cc586dfd5ebf8d6298221801.tar.gz kdepimpi-816db8f76a1fd8b5cc586dfd5ebf8d6298221801.tar.bz2 |
Changed some strings. Removed some kdebug
-rw-r--r-- | kabc/addressbook.cpp | 2 | ||||
-rw-r--r-- | kabc/plugins/file/resourcefile.cpp | 8 | ||||
-rw-r--r-- | kabc/stdaddressbook.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 2 | ||||
-rw-r--r-- | microkde/kresources/factory.cpp | 10 | ||||
-rw-r--r-- | microkde/kresources/resource.cpp | 3 |
6 files changed, 14 insertions, 13 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index 97bd3ef..0838157 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -158,193 +158,193 @@ AddressBook::ConstIterator::ConstIterator( const AddressBook::ConstIterator &i ) | |||
158 | AddressBook::ConstIterator &AddressBook::ConstIterator::operator=( const AddressBook::ConstIterator &i ) | 158 | AddressBook::ConstIterator &AddressBook::ConstIterator::operator=( const AddressBook::ConstIterator &i ) |
159 | { | 159 | { |
160 | if( this == &i ) return *this; // guard for self assignment | 160 | if( this == &i ) return *this; // guard for self assignment |
161 | delete d; // delete the old data because the Iterator was really constructed before | 161 | delete d; // delete the old data because the Iterator was really constructed before |
162 | d = new ConstIteratorData; | 162 | d = new ConstIteratorData; |
163 | d->mIt = i.d->mIt; | 163 | d->mIt = i.d->mIt; |
164 | return *this; | 164 | return *this; |
165 | } | 165 | } |
166 | 166 | ||
167 | AddressBook::ConstIterator::~ConstIterator() | 167 | AddressBook::ConstIterator::~ConstIterator() |
168 | { | 168 | { |
169 | delete d; | 169 | delete d; |
170 | } | 170 | } |
171 | 171 | ||
172 | const Addressee &AddressBook::ConstIterator::operator*() const | 172 | const Addressee &AddressBook::ConstIterator::operator*() const |
173 | { | 173 | { |
174 | return *(d->mIt); | 174 | return *(d->mIt); |
175 | } | 175 | } |
176 | 176 | ||
177 | const Addressee* AddressBook::ConstIterator::operator->() const | 177 | const Addressee* AddressBook::ConstIterator::operator->() const |
178 | { | 178 | { |
179 | return &(*(d->mIt)); | 179 | return &(*(d->mIt)); |
180 | } | 180 | } |
181 | 181 | ||
182 | AddressBook::ConstIterator &AddressBook::ConstIterator::operator++() | 182 | AddressBook::ConstIterator &AddressBook::ConstIterator::operator++() |
183 | { | 183 | { |
184 | (d->mIt)++; | 184 | (d->mIt)++; |
185 | return *this; | 185 | return *this; |
186 | } | 186 | } |
187 | 187 | ||
188 | AddressBook::ConstIterator &AddressBook::ConstIterator::operator++(int) | 188 | AddressBook::ConstIterator &AddressBook::ConstIterator::operator++(int) |
189 | { | 189 | { |
190 | (d->mIt)++; | 190 | (d->mIt)++; |
191 | return *this; | 191 | return *this; |
192 | } | 192 | } |
193 | 193 | ||
194 | AddressBook::ConstIterator &AddressBook::ConstIterator::operator--() | 194 | AddressBook::ConstIterator &AddressBook::ConstIterator::operator--() |
195 | { | 195 | { |
196 | (d->mIt)--; | 196 | (d->mIt)--; |
197 | return *this; | 197 | return *this; |
198 | } | 198 | } |
199 | 199 | ||
200 | AddressBook::ConstIterator &AddressBook::ConstIterator::operator--(int) | 200 | AddressBook::ConstIterator &AddressBook::ConstIterator::operator--(int) |
201 | { | 201 | { |
202 | (d->mIt)--; | 202 | (d->mIt)--; |
203 | return *this; | 203 | return *this; |
204 | } | 204 | } |
205 | 205 | ||
206 | bool AddressBook::ConstIterator::operator==( const ConstIterator &it ) | 206 | bool AddressBook::ConstIterator::operator==( const ConstIterator &it ) |
207 | { | 207 | { |
208 | return ( d->mIt == it.d->mIt ); | 208 | return ( d->mIt == it.d->mIt ); |
209 | } | 209 | } |
210 | 210 | ||
211 | bool AddressBook::ConstIterator::operator!=( const ConstIterator &it ) | 211 | bool AddressBook::ConstIterator::operator!=( const ConstIterator &it ) |
212 | { | 212 | { |
213 | return ( d->mIt != it.d->mIt ); | 213 | return ( d->mIt != it.d->mIt ); |
214 | } | 214 | } |
215 | 215 | ||
216 | 216 | ||
217 | AddressBook::AddressBook() | 217 | AddressBook::AddressBook() |
218 | { | 218 | { |
219 | init(0); | 219 | init(0); |
220 | } | 220 | } |
221 | 221 | ||
222 | AddressBook::AddressBook( const QString &config ) | 222 | AddressBook::AddressBook( const QString &config ) |
223 | { | 223 | { |
224 | init(config); | 224 | init(config); |
225 | } | 225 | } |
226 | 226 | ||
227 | void AddressBook::init(const QString &config) | 227 | void AddressBook::init(const QString &config) |
228 | { | 228 | { |
229 | d = new AddressBookData; | 229 | d = new AddressBookData; |
230 | if (config != 0) { | 230 | if (config != 0) { |
231 | d->mConfig = new KConfig( config ); | 231 | d->mConfig = new KConfig( config ); |
232 | // qDebug("AddressBook::init 1 config=%s",config.latin1() ); | 232 | // qDebug("AddressBook::init 1 config=%s",config.latin1() ); |
233 | } | 233 | } |
234 | else { | 234 | else { |
235 | d->mConfig = 0; | 235 | d->mConfig = 0; |
236 | // qDebug("AddressBook::init 1 config=0"); | 236 | // qDebug("AddressBook::init 1 config=0"); |
237 | } | 237 | } |
238 | 238 | ||
239 | //US d->mErrorHandler = 0; | 239 | //US d->mErrorHandler = 0; |
240 | d->mManager = new KRES::Manager<Resource>( "contact" ); | 240 | d->mManager = new KRES::Manager<Resource>( "contact" ); |
241 | d->mManager->readConfig( d->mConfig ); | 241 | d->mManager->readConfig( d->mConfig ); |
242 | } | 242 | } |
243 | 243 | ||
244 | AddressBook::~AddressBook() | 244 | AddressBook::~AddressBook() |
245 | { | 245 | { |
246 | delete d->mConfig; d->mConfig = 0; | 246 | delete d->mConfig; d->mConfig = 0; |
247 | delete d->mManager; d->mManager = 0; | 247 | delete d->mManager; d->mManager = 0; |
248 | //US delete d->mErrorHandler; d->mErrorHandler = 0; | 248 | //US delete d->mErrorHandler; d->mErrorHandler = 0; |
249 | delete d; d = 0; | 249 | delete d; d = 0; |
250 | } | 250 | } |
251 | 251 | ||
252 | bool AddressBook::load() | 252 | bool AddressBook::load() |
253 | { | 253 | { |
254 | kdDebug(5700) << "AddressBook::load()" << endl; | 254 | |
255 | 255 | ||
256 | clear(); | 256 | clear(); |
257 | 257 | ||
258 | KRES::Manager<Resource>::ActiveIterator it; | 258 | KRES::Manager<Resource>::ActiveIterator it; |
259 | bool ok = true; | 259 | bool ok = true; |
260 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) | 260 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) |
261 | if ( !(*it)->load() ) { | 261 | if ( !(*it)->load() ) { |
262 | error( i18n("Unable to load resource '%1'").arg( (*it)->resourceName() ) ); | 262 | error( i18n("Unable to load resource '%1'").arg( (*it)->resourceName() ) ); |
263 | ok = false; | 263 | ok = false; |
264 | } | 264 | } |
265 | 265 | ||
266 | // mark all addressees as unchanged | 266 | // mark all addressees as unchanged |
267 | Addressee::List::Iterator addrIt; | 267 | Addressee::List::Iterator addrIt; |
268 | for ( addrIt = d->mAddressees.begin(); addrIt != d->mAddressees.end(); ++addrIt ) | 268 | for ( addrIt = d->mAddressees.begin(); addrIt != d->mAddressees.end(); ++addrIt ) |
269 | (*addrIt).setChanged( false ); | 269 | (*addrIt).setChanged( false ); |
270 | 270 | ||
271 | return ok; | 271 | return ok; |
272 | } | 272 | } |
273 | 273 | ||
274 | bool AddressBook::save( Ticket *ticket ) | 274 | bool AddressBook::save( Ticket *ticket ) |
275 | { | 275 | { |
276 | kdDebug(5700) << "AddressBook::save()"<< endl; | 276 | kdDebug(5700) << "AddressBook::save()"<< endl; |
277 | 277 | ||
278 | if ( ticket->resource() ) { | 278 | if ( ticket->resource() ) { |
279 | deleteRemovedAddressees(); | 279 | deleteRemovedAddressees(); |
280 | 280 | ||
281 | return ticket->resource()->save( ticket ); | 281 | return ticket->resource()->save( ticket ); |
282 | } | 282 | } |
283 | 283 | ||
284 | return false; | 284 | return false; |
285 | } | 285 | } |
286 | 286 | ||
287 | AddressBook::Iterator AddressBook::begin() | 287 | AddressBook::Iterator AddressBook::begin() |
288 | { | 288 | { |
289 | Iterator it = Iterator(); | 289 | Iterator it = Iterator(); |
290 | it.d->mIt = d->mAddressees.begin(); | 290 | it.d->mIt = d->mAddressees.begin(); |
291 | return it; | 291 | return it; |
292 | } | 292 | } |
293 | 293 | ||
294 | AddressBook::ConstIterator AddressBook::begin() const | 294 | AddressBook::ConstIterator AddressBook::begin() const |
295 | { | 295 | { |
296 | ConstIterator it = ConstIterator(); | 296 | ConstIterator it = ConstIterator(); |
297 | it.d->mIt = d->mAddressees.begin(); | 297 | it.d->mIt = d->mAddressees.begin(); |
298 | return it; | 298 | return it; |
299 | } | 299 | } |
300 | 300 | ||
301 | AddressBook::Iterator AddressBook::end() | 301 | AddressBook::Iterator AddressBook::end() |
302 | { | 302 | { |
303 | Iterator it = Iterator(); | 303 | Iterator it = Iterator(); |
304 | it.d->mIt = d->mAddressees.end(); | 304 | it.d->mIt = d->mAddressees.end(); |
305 | return it; | 305 | return it; |
306 | } | 306 | } |
307 | 307 | ||
308 | AddressBook::ConstIterator AddressBook::end() const | 308 | AddressBook::ConstIterator AddressBook::end() const |
309 | { | 309 | { |
310 | ConstIterator it = ConstIterator(); | 310 | ConstIterator it = ConstIterator(); |
311 | it.d->mIt = d->mAddressees.end(); | 311 | it.d->mIt = d->mAddressees.end(); |
312 | return it; | 312 | return it; |
313 | } | 313 | } |
314 | 314 | ||
315 | void AddressBook::clear() | 315 | void AddressBook::clear() |
316 | { | 316 | { |
317 | d->mAddressees.clear(); | 317 | d->mAddressees.clear(); |
318 | } | 318 | } |
319 | 319 | ||
320 | Ticket *AddressBook::requestSaveTicket( Resource *resource ) | 320 | Ticket *AddressBook::requestSaveTicket( Resource *resource ) |
321 | { | 321 | { |
322 | kdDebug(5700) << "AddressBook::requestSaveTicket()" << endl; | 322 | kdDebug(5700) << "AddressBook::requestSaveTicket()" << endl; |
323 | 323 | ||
324 | if ( !resource ) | 324 | if ( !resource ) |
325 | { | 325 | { |
326 | qDebug("AddressBook::requestSaveTicket no resource" ); | 326 | qDebug("AddressBook::requestSaveTicket no resource" ); |
327 | resource = standardResource(); | 327 | resource = standardResource(); |
328 | } | 328 | } |
329 | 329 | ||
330 | KRES::Manager<Resource>::ActiveIterator it; | 330 | KRES::Manager<Resource>::ActiveIterator it; |
331 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { | 331 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { |
332 | if ( (*it) == resource ) { | 332 | if ( (*it) == resource ) { |
333 | if ( (*it)->readOnly() || !(*it)->isOpen() ) | 333 | if ( (*it)->readOnly() || !(*it)->isOpen() ) |
334 | return 0; | 334 | return 0; |
335 | else | 335 | else |
336 | return (*it)->requestSaveTicket(); | 336 | return (*it)->requestSaveTicket(); |
337 | } | 337 | } |
338 | } | 338 | } |
339 | 339 | ||
340 | return 0; | 340 | return 0; |
341 | } | 341 | } |
342 | 342 | ||
343 | void AddressBook::insertAddressee( const Addressee &a ) | 343 | void AddressBook::insertAddressee( const Addressee &a ) |
344 | { | 344 | { |
345 | Addressee::List::Iterator it; | 345 | Addressee::List::Iterator it; |
346 | for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) { | 346 | for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) { |
347 | if ( a.uid() == (*it).uid() ) { | 347 | if ( a.uid() == (*it).uid() ) { |
348 | bool changed = false; | 348 | bool changed = false; |
349 | Addressee addr = a; | 349 | Addressee addr = a; |
350 | if ( addr != (*it) ) | 350 | if ( addr != (*it) ) |
diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp index 80af841..3920f69 100644 --- a/kabc/plugins/file/resourcefile.cpp +++ b/kabc/plugins/file/resourcefile.cpp | |||
@@ -101,267 +101,267 @@ void ResourceFile::init( const QString &fileName, const QString &formatName ) | |||
101 | FormatFactory *factory = FormatFactory::self(); | 101 | FormatFactory *factory = FormatFactory::self(); |
102 | mFormat = factory->format( mFormatName ); | 102 | mFormat = factory->format( mFormatName ); |
103 | 103 | ||
104 | if ( !mFormat ) { | 104 | if ( !mFormat ) { |
105 | mFormatName = "vcard"; | 105 | mFormatName = "vcard"; |
106 | mFormat = factory->format( mFormatName ); | 106 | mFormat = factory->format( mFormatName ); |
107 | } | 107 | } |
108 | 108 | ||
109 | /*US | 109 | /*US |
110 | //US qDebug("ResourceFile::init initialized with format %s ", formatName.latin1()); | 110 | //US qDebug("ResourceFile::init initialized with format %s ", formatName.latin1()); |
111 | if (mFormatName == "vcard") { | 111 | if (mFormatName == "vcard") { |
112 | mFormat = new VCardFormatPlugin2(); | 112 | mFormat = new VCardFormatPlugin2(); |
113 | // qDebug("ResourceFile::init format VCardFormatPlugin2"); | 113 | // qDebug("ResourceFile::init format VCardFormatPlugin2"); |
114 | } | 114 | } |
115 | else if (mFormatName == "binary") { | 115 | else if (mFormatName == "binary") { |
116 | mFormat = new BinaryFormat(); | 116 | mFormat = new BinaryFormat(); |
117 | // qDebug("ResourceFile::init format BinaryFormat"); | 117 | // qDebug("ResourceFile::init format BinaryFormat"); |
118 | } | 118 | } |
119 | else | 119 | else |
120 | qDebug("ResourceFile::init format unknown !!! %s ", formatName.latin1()); | 120 | qDebug("ResourceFile::init format unknown !!! %s ", formatName.latin1()); |
121 | */ | 121 | */ |
122 | 122 | ||
123 | /*US we have no KDirWatch. SO simulate the signals from inside the apropriate methods | 123 | /*US we have no KDirWatch. SO simulate the signals from inside the apropriate methods |
124 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); | 124 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); |
125 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); | 125 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); |
126 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); | 126 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); |
127 | */ | 127 | */ |
128 | 128 | ||
129 | setFileName( fileName ); | 129 | setFileName( fileName ); |
130 | } | 130 | } |
131 | 131 | ||
132 | ResourceFile::~ResourceFile() | 132 | ResourceFile::~ResourceFile() |
133 | { | 133 | { |
134 | delete mFormat; | 134 | delete mFormat; |
135 | mFormat = 0; | 135 | mFormat = 0; |
136 | } | 136 | } |
137 | 137 | ||
138 | void ResourceFile::writeConfig( KConfig *config ) | 138 | void ResourceFile::writeConfig( KConfig *config ) |
139 | { | 139 | { |
140 | Resource::writeConfig( config ); | 140 | Resource::writeConfig( config ); |
141 | 141 | ||
142 | config->writeEntry( "FileName", mFileName ); | 142 | config->writeEntry( "FileName", mFileName ); |
143 | config->writeEntry( "FileFormat", mFormatName ); | 143 | config->writeEntry( "FileFormat", mFormatName ); |
144 | 144 | ||
145 | // qDebug("ResourceFile::writeConfig format %s, %s", mFileName.latin1(), mFormatName.latin1()); | 145 | // qDebug("ResourceFile::writeConfig format %s, %s", mFileName.latin1(), mFormatName.latin1()); |
146 | 146 | ||
147 | } | 147 | } |
148 | 148 | ||
149 | Ticket *ResourceFile::requestSaveTicket() | 149 | Ticket *ResourceFile::requestSaveTicket() |
150 | { | 150 | { |
151 | kdDebug(5700) << "ResourceFile::requestSaveTicket()" << endl; | 151 | kdDebug(5700) << "ResourceFile::requestSaveTicket()" << endl; |
152 | 152 | ||
153 | if ( !addressBook() ) return 0; | 153 | if ( !addressBook() ) return 0; |
154 | 154 | ||
155 | if ( !lock( mFileName ) ) { | 155 | if ( !lock( mFileName ) ) { |
156 | kdDebug(5700) << "ResourceFile::requestSaveTicket(): Unable to lock file '" | 156 | kdDebug(5700) << "ResourceFile::requestSaveTicket(): Unable to lock file '" |
157 | << mFileName << "'" << endl; | 157 | << mFileName << "'" << endl; |
158 | return 0; | 158 | return 0; |
159 | } | 159 | } |
160 | return createTicket( this ); | 160 | return createTicket( this ); |
161 | } | 161 | } |
162 | 162 | ||
163 | 163 | ||
164 | bool ResourceFile::doOpen() | 164 | bool ResourceFile::doOpen() |
165 | { | 165 | { |
166 | QFile file( mFileName ); | 166 | QFile file( mFileName ); |
167 | 167 | ||
168 | if ( !file.exists() ) { | 168 | if ( !file.exists() ) { |
169 | // try to create the file | 169 | // try to create the file |
170 | bool ok = file.open( IO_WriteOnly ); | 170 | bool ok = file.open( IO_WriteOnly ); |
171 | if ( ok ) | 171 | if ( ok ) |
172 | file.close(); | 172 | file.close(); |
173 | 173 | ||
174 | return ok; | 174 | return ok; |
175 | } else { | 175 | } else { |
176 | if ( !file.open( IO_ReadWrite ) ) | 176 | if ( !file.open( IO_ReadWrite ) ) |
177 | return false; | 177 | return false; |
178 | 178 | ||
179 | if ( file.size() == 0 ) { | 179 | if ( file.size() == 0 ) { |
180 | file.close(); | 180 | file.close(); |
181 | return true; | 181 | return true; |
182 | } | 182 | } |
183 | 183 | ||
184 | bool ok = mFormat->checkFormat( &file ); | 184 | bool ok = mFormat->checkFormat( &file ); |
185 | file.close(); | 185 | file.close(); |
186 | 186 | ||
187 | return ok; | 187 | return ok; |
188 | } | 188 | } |
189 | } | 189 | } |
190 | 190 | ||
191 | void ResourceFile::doClose() | 191 | void ResourceFile::doClose() |
192 | { | 192 | { |
193 | } | 193 | } |
194 | 194 | ||
195 | bool ResourceFile::load() | 195 | bool ResourceFile::load() |
196 | { | 196 | { |
197 | kdDebug(5700) << "ResourceFile::load(): '" << mFileName << "'" << endl; | 197 | |
198 | 198 | ||
199 | QFile file( mFileName ); | 199 | QFile file( mFileName ); |
200 | if ( !file.open( IO_ReadOnly ) ) { | 200 | if ( !file.open( IO_ReadOnly ) ) { |
201 | addressBook()->error( i18n( "Unable to open file '%1'." ).arg( mFileName ) ); | 201 | addressBook()->error( i18n( "Unable to open file '%1'." ).arg( mFileName ) ); |
202 | return false; | 202 | return false; |
203 | } | 203 | } |
204 | 204 | ||
205 | // qDebug("ResourceFile::load format %s, %s", mFileName.latin1(), mFormatName.latin1()); | 205 | // qDebug("ResourceFile::load format %s, %s", mFileName.latin1(), mFormatName.latin1()); |
206 | 206 | ||
207 | return mFormat->loadAll( addressBook(), this, &file ); | 207 | return mFormat->loadAll( addressBook(), this, &file ); |
208 | } | 208 | } |
209 | 209 | ||
210 | bool ResourceFile::save( Ticket *ticket ) | 210 | bool ResourceFile::save( Ticket *ticket ) |
211 | { | 211 | { |
212 | // qDebug("ResourceFile::save format %s, %s", mFileName.latin1(), mFormatName.latin1()); | 212 | // qDebug("ResourceFile::save format %s, %s", mFileName.latin1(), mFormatName.latin1()); |
213 | kdDebug(5700) << "ResourceFile::save()" << endl; | 213 | |
214 | 214 | ||
215 | // create backup file | 215 | // create backup file |
216 | QString extension = "_" + QString::number( QDate::currentDate().dayOfWeek() ); | 216 | QString extension = "_" + QString::number( QDate::currentDate().dayOfWeek() ); |
217 | 217 | ||
218 | /*US we use a simpler method to create a backupfile | 218 | /*US we use a simpler method to create a backupfile |
219 | 219 | ||
220 | (void) KSaveFile::backupFile( mFileName, QString::null | 220 | (void) KSaveFile::backupFile( mFileName, QString::null |
221 | ,extension ); | 221 | ,extension ); |
222 | 222 | ||
223 | KSaveFile saveFile( mFileName ); | 223 | KSaveFile saveFile( mFileName ); |
224 | bool ok = false; | 224 | bool ok = false; |
225 | if ( saveFile.status() == 0 && saveFile.file() ) | 225 | if ( saveFile.status() == 0 && saveFile.file() ) |
226 | { | 226 | { |
227 | mFormat->saveAll( addressBook(), this, saveFile.file() ); | 227 | mFormat->saveAll( addressBook(), this, saveFile.file() ); |
228 | ok = saveFile.close(); | 228 | ok = saveFile.close(); |
229 | } | 229 | } |
230 | */ | 230 | */ |
231 | 231 | ||
232 | //US ToDo: write backupfile | 232 | //US ToDo: write backupfile |
233 | QFile info; | 233 | QFile info; |
234 | info.setName( mFileName ); | 234 | info.setName( mFileName ); |
235 | bool ok = info.open( IO_WriteOnly ); | 235 | bool ok = info.open( IO_WriteOnly ); |
236 | if ( ok ) { | 236 | if ( ok ) { |
237 | mFormat->saveAll( addressBook(), this, &info ); | 237 | mFormat->saveAll( addressBook(), this, &info ); |
238 | 238 | ||
239 | info.close(); | 239 | info.close(); |
240 | ok = true; | 240 | ok = true; |
241 | } | 241 | } |
242 | else { | 242 | else { |
243 | 243 | ||
244 | } | 244 | } |
245 | 245 | ||
246 | if ( !ok ) | 246 | if ( !ok ) |
247 | addressBook()->error( i18n( "Unable to save file '%1'." ).arg( mFileName ) ); | 247 | addressBook()->error( i18n( "Unable to save file '%1'." ).arg( mFileName ) ); |
248 | 248 | ||
249 | delete ticket; | 249 | delete ticket; |
250 | unlock( mFileName ); | 250 | unlock( mFileName ); |
251 | 251 | ||
252 | return ok; | 252 | return ok; |
253 | 253 | ||
254 | qDebug("ResourceFile::save has to be changed"); | 254 | qDebug("ResourceFile::save has to be changed"); |
255 | return true; | 255 | return true; |
256 | } | 256 | } |
257 | 257 | ||
258 | bool ResourceFile::lock( const QString &fileName ) | 258 | bool ResourceFile::lock( const QString &fileName ) |
259 | { | 259 | { |
260 | kdDebug(5700) << "ResourceFile::lock()" << endl; | 260 | |
261 | 261 | ||
262 | QString fn = fileName; | 262 | QString fn = fileName; |
263 | 263 | ||
264 | //US change the implementation how the lockfilename is getting created | 264 | //US change the implementation how the lockfilename is getting created |
265 | //US fn.replace( QRegExp("/"), "_" ); | 265 | //US fn.replace( QRegExp("/"), "_" ); |
266 | //US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" ); | 266 | //US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" ); |
267 | 267 | ||
268 | KURL url(fn); | 268 | KURL url(fn); |
269 | QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); | 269 | QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); |
270 | 270 | ||
271 | kdDebug(5700) << "-- lock name: " << lockName << endl; | 271 | |
272 | 272 | ||
273 | if (QFile::exists( lockName )) return false; | 273 | if (QFile::exists( lockName )) return false; |
274 | 274 | ||
275 | QString lockUniqueName; | 275 | QString lockUniqueName; |
276 | lockUniqueName = fn + KApplication::randomString( 8 ); | 276 | lockUniqueName = fn + KApplication::randomString( 8 ); |
277 | 277 | ||
278 | url = lockUniqueName; | 278 | url = lockUniqueName; |
279 | //US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName ); | 279 | //US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName ); |
280 | mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() ); | 280 | mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() ); |
281 | kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl; | 281 | kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl; |
282 | 282 | ||
283 | // Create unique file | 283 | // Create unique file |
284 | QFile file( mLockUniqueName ); | 284 | QFile file( mLockUniqueName ); |
285 | file.open( IO_WriteOnly ); | 285 | file.open( IO_WriteOnly ); |
286 | file.close(); | 286 | file.close(); |
287 | 287 | ||
288 | // Create lock file | 288 | // Create lock file |
289 | int result = ::link( QFile::encodeName( mLockUniqueName ), | 289 | int result = ::link( QFile::encodeName( mLockUniqueName ), |
290 | QFile::encodeName( lockName ) ); | 290 | QFile::encodeName( lockName ) ); |
291 | 291 | ||
292 | if ( result == 0 ) { | 292 | if ( result == 0 ) { |
293 | addressBook()->emitAddressBookLocked(); | 293 | addressBook()->emitAddressBookLocked(); |
294 | return true; | 294 | return true; |
295 | } | 295 | } |
296 | 296 | ||
297 | // TODO: check stat | 297 | // TODO: check stat |
298 | 298 | ||
299 | return false; | 299 | return false; |
300 | } | 300 | } |
301 | 301 | ||
302 | void ResourceFile::unlock( const QString &fileName ) | 302 | void ResourceFile::unlock( const QString &fileName ) |
303 | { | 303 | { |
304 | QString fn = fileName; | 304 | QString fn = fileName; |
305 | //US change the implementation how the lockfilename is getting created | 305 | //US change the implementation how the lockfilename is getting created |
306 | //US fn.replace( QRegExp( "/" ), "_" ); | 306 | //US fn.replace( QRegExp( "/" ), "_" ); |
307 | //US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" ); | 307 | //US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" ); |
308 | //US QString lockName = fn + ".lock"; | 308 | //US QString lockName = fn + ".lock"; |
309 | KURL url(fn); | 309 | KURL url(fn); |
310 | QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); | 310 | QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); |
311 | 311 | ||
312 | QFile::remove( lockName ); | 312 | QFile::remove( lockName ); |
313 | QFile::remove( mLockUniqueName ); | 313 | QFile::remove( mLockUniqueName ); |
314 | addressBook()->emitAddressBookUnlocked(); | 314 | addressBook()->emitAddressBookUnlocked(); |
315 | } | 315 | } |
316 | 316 | ||
317 | void ResourceFile::setFileName( const QString &fileName ) | 317 | void ResourceFile::setFileName( const QString &fileName ) |
318 | { | 318 | { |
319 | /*US ToDo: no synchronization so far. Has to be changed in the future | 319 | /*US ToDo: no synchronization so far. Has to be changed in the future |
320 | mDirWatch.stopScan(); | 320 | mDirWatch.stopScan(); |
321 | mDirWatch.removeFile( mFileName ); | 321 | mDirWatch.removeFile( mFileName ); |
322 | */ | 322 | */ |
323 | mFileName = fileName; | 323 | mFileName = fileName; |
324 | 324 | ||
325 | 325 | ||
326 | /*US ToDo: no synchronization so far. Has to be changed in the future | 326 | /*US ToDo: no synchronization so far. Has to be changed in the future |
327 | mDirWatch.addFile( mFileName ); | 327 | mDirWatch.addFile( mFileName ); |
328 | mDirWatch.startScan(); | 328 | mDirWatch.startScan(); |
329 | */ | 329 | */ |
330 | //US simulate KDirWatch event | 330 | //US simulate KDirWatch event |
331 | fileChanged(); | 331 | fileChanged(); |
332 | } | 332 | } |
333 | 333 | ||
334 | QString ResourceFile::fileName() const | 334 | QString ResourceFile::fileName() const |
335 | { | 335 | { |
336 | return mFileName; | 336 | return mFileName; |
337 | } | 337 | } |
338 | 338 | ||
339 | void ResourceFile::setFormat( const QString &format ) | 339 | void ResourceFile::setFormat( const QString &format ) |
340 | { | 340 | { |
341 | mFormatName = format; | 341 | mFormatName = format; |
342 | delete mFormat; | 342 | delete mFormat; |
343 | 343 | ||
344 | FormatFactory *factory = FormatFactory::self(); | 344 | FormatFactory *factory = FormatFactory::self(); |
345 | mFormat = factory->format( mFormatName ); | 345 | mFormat = factory->format( mFormatName ); |
346 | /*US | 346 | /*US |
347 | //qDebug("ResourceFile::setFormat initialized with format %s ", format.latin1()); | 347 | //qDebug("ResourceFile::setFormat initialized with format %s ", format.latin1()); |
348 | if (mFormatName == "vcard") { | 348 | if (mFormatName == "vcard") { |
349 | mFormat = new VCardFormatPlugin2(); | 349 | mFormat = new VCardFormatPlugin2(); |
350 | // qDebug("ResourceFile::setFormat format %s", mFormatName.latin1()); | 350 | // qDebug("ResourceFile::setFormat format %s", mFormatName.latin1()); |
351 | } | 351 | } |
352 | else if (mFormatName == "binary") { | 352 | else if (mFormatName == "binary") { |
353 | mFormat = new BinaryFormat(); | 353 | mFormat = new BinaryFormat(); |
354 | // qDebug("ResourceFile::setFormat format %s", mFormatName.latin1()); | 354 | // qDebug("ResourceFile::setFormat format %s", mFormatName.latin1()); |
355 | } | 355 | } |
356 | else | 356 | else |
357 | qDebug("ResourceFile::setFormat format unknown !!! %s ", format.latin1()); | 357 | qDebug("ResourceFile::setFormat format unknown !!! %s ", format.latin1()); |
358 | */ | 358 | */ |
359 | 359 | ||
360 | } | 360 | } |
361 | 361 | ||
362 | QString ResourceFile::format() const | 362 | QString ResourceFile::format() const |
363 | { | 363 | { |
364 | return mFormatName; | 364 | return mFormatName; |
365 | } | 365 | } |
366 | 366 | ||
367 | void ResourceFile::fileChanged() | 367 | void ResourceFile::fileChanged() |
diff --git a/kabc/stdaddressbook.cpp b/kabc/stdaddressbook.cpp index 075f12f..1e00cc6 100644 --- a/kabc/stdaddressbook.cpp +++ b/kabc/stdaddressbook.cpp | |||
@@ -59,170 +59,170 @@ void StdAddressBook::handleCrash() | |||
59 | 59 | ||
60 | StdAddressBook *StdAddressBook::self() | 60 | StdAddressBook *StdAddressBook::self() |
61 | { | 61 | { |
62 | 62 | ||
63 | if ( !mSelf ) | 63 | if ( !mSelf ) |
64 | { | 64 | { |
65 | QString appdir = StdAddressBook::setTempAppDir(); | 65 | QString appdir = StdAddressBook::setTempAppDir(); |
66 | 66 | ||
67 | kdDebug(5700) << "StdAddressBook::self()" << endl; | 67 | kdDebug(5700) << "StdAddressBook::self()" << endl; |
68 | // US im am not sure why I have to use the other format here?? | 68 | // US im am not sure why I have to use the other format here?? |
69 | #ifdef KAB_EMBEDDED | 69 | #ifdef KAB_EMBEDDED |
70 | mSelf = addressBookDeleter.setObject( new StdAddressBook ); | 70 | mSelf = addressBookDeleter.setObject( new StdAddressBook ); |
71 | #else //KAB_EMBEDDED | 71 | #else //KAB_EMBEDDED |
72 | addressBookDeleter.setObject( mSelf, new StdAddressBook ); | 72 | addressBookDeleter.setObject( mSelf, new StdAddressBook ); |
73 | #endif //KAB_EMBEDDED | 73 | #endif //KAB_EMBEDDED |
74 | KStandardDirs::setAppDir( appdir ); | 74 | KStandardDirs::setAppDir( appdir ); |
75 | } | 75 | } |
76 | 76 | ||
77 | return mSelf; | 77 | return mSelf; |
78 | } | 78 | } |
79 | 79 | ||
80 | QString StdAddressBook::setTempAppDir() | 80 | QString StdAddressBook::setTempAppDir() |
81 | { | 81 | { |
82 | QString appDIR = KStandardDirs::appDir(); | 82 | QString appDIR = KStandardDirs::appDir(); |
83 | #ifdef DESKTOP_VERSION | 83 | #ifdef DESKTOP_VERSION |
84 | QString appdir = QDir::homeDirPath(); | 84 | QString appdir = QDir::homeDirPath(); |
85 | if ( appdir.right(1) == "\\" || appdir.right(1) == "/" ) | 85 | if ( appdir.right(1) == "\\" || appdir.right(1) == "/" ) |
86 | appdir += "kaddressbook/"; | 86 | appdir += "kaddressbook/"; |
87 | else | 87 | else |
88 | appdir += "/kaddressbook/"; | 88 | appdir += "/kaddressbook/"; |
89 | KStandardDirs::setAppDir( QDir::convertSeparators( appdir )); | 89 | KStandardDirs::setAppDir( QDir::convertSeparators( appdir )); |
90 | #else | 90 | #else |
91 | QString appdir = QDir::homeDirPath() + "/kdepim/apps/kaddressbook"; | 91 | QString appdir = QDir::homeDirPath() + "/kdepim/apps/kaddressbook"; |
92 | 92 | ||
93 | KStandardDirs::setAppDir( appdir ); | 93 | KStandardDirs::setAppDir( appdir ); |
94 | #endif | 94 | #endif |
95 | 95 | ||
96 | return appDIR; | 96 | return appDIR; |
97 | } | 97 | } |
98 | StdAddressBook *StdAddressBook::self( bool onlyFastResources ) | 98 | StdAddressBook *StdAddressBook::self( bool onlyFastResources ) |
99 | { | 99 | { |
100 | 100 | ||
101 | if ( !mSelf ) | 101 | if ( !mSelf ) |
102 | { | 102 | { |
103 | QString appdir =StdAddressBook::setTempAppDir(); | 103 | QString appdir =StdAddressBook::setTempAppDir(); |
104 | #ifdef KAB_EMBEDDED | 104 | #ifdef KAB_EMBEDDED |
105 | mSelf = addressBookDeleter.setObject( new StdAddressBook( onlyFastResources ) ); | 105 | mSelf = addressBookDeleter.setObject( new StdAddressBook( onlyFastResources ) ); |
106 | #else //KAB_EMBEDDED | 106 | #else //KAB_EMBEDDED |
107 | addressBookDeleter.setObject( mSelf, new StdAddressBook( onlyFastResources ) ); | 107 | addressBookDeleter.setObject( mSelf, new StdAddressBook( onlyFastResources ) ); |
108 | #endif //KAB_EMBEDDED | 108 | #endif //KAB_EMBEDDED |
109 | KStandardDirs::setAppDir( appdir ); | 109 | KStandardDirs::setAppDir( appdir ); |
110 | } | 110 | } |
111 | return mSelf; | 111 | return mSelf; |
112 | } | 112 | } |
113 | 113 | ||
114 | StdAddressBook::StdAddressBook() | 114 | StdAddressBook::StdAddressBook() |
115 | //US : AddressBook( "kabcrc" ) | 115 | //US : AddressBook( "kabcrc" ) |
116 | : AddressBook( locateLocal( "config", "kabcrc") ) | 116 | : AddressBook( locateLocal( "config", "kabcrc") ) |
117 | { | 117 | { |
118 | 118 | ||
119 | init( false ); | 119 | init( false ); |
120 | } | 120 | } |
121 | 121 | ||
122 | StdAddressBook::StdAddressBook( bool onlyFastResources ) | 122 | StdAddressBook::StdAddressBook( bool onlyFastResources ) |
123 | //US : AddressBook( "kabcrc" ) | 123 | //US : AddressBook( "kabcrc" ) |
124 | : AddressBook( locateLocal( "config", "kabcrc") ) | 124 | : AddressBook( locateLocal( "config", "kabcrc") ) |
125 | { | 125 | { |
126 | 126 | ||
127 | init( onlyFastResources ); | 127 | init( onlyFastResources ); |
128 | } | 128 | } |
129 | 129 | ||
130 | StdAddressBook::~StdAddressBook() | 130 | StdAddressBook::~StdAddressBook() |
131 | { | 131 | { |
132 | if ( mAutomaticSave ) | 132 | if ( mAutomaticSave ) |
133 | save(); | 133 | save(); |
134 | } | 134 | } |
135 | 135 | ||
136 | void StdAddressBook::init( bool ) | 136 | void StdAddressBook::init( bool ) |
137 | { | 137 | { |
138 | KRES::Manager<Resource> *manager = resourceManager(); | 138 | KRES::Manager<Resource> *manager = resourceManager(); |
139 | KRES::Manager<Resource>::ActiveIterator it; | 139 | KRES::Manager<Resource>::ActiveIterator it; |
140 | 140 | ||
141 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { | 141 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { |
142 | (*it)->setAddressBook( this ); | 142 | (*it)->setAddressBook( this ); |
143 | if ( !(*it)->open() ) | 143 | if ( !(*it)->open() ) |
144 | error( QString( "Unable to open resource '%1'!" ).arg( (*it)->resourceName() ) ); | 144 | error( QString( "Unable to open resource '%1'!" ).arg( (*it)->resourceName() ) ); |
145 | } | 145 | } |
146 | 146 | ||
147 | Resource *res = standardResource(); | 147 | Resource *res = standardResource(); |
148 | if ( !res ) { | 148 | if ( !res ) { |
149 | res = manager->createResource( "file" ); | 149 | res = manager->createResource( "file" ); |
150 | if ( res ) | 150 | if ( res ) |
151 | { | 151 | { |
152 | addResource( res ); | 152 | addResource( res ); |
153 | } | 153 | } |
154 | else | 154 | else |
155 | kdDebug(5700) << "No resource available!!!" << endl; | 155 | qDebug(" No resource available!!!"); |
156 | } | 156 | } |
157 | 157 | ||
158 | setStandardResource( res ); | 158 | setStandardResource( res ); |
159 | manager->writeConfig(); | 159 | manager->writeConfig(); |
160 | 160 | ||
161 | load(); | 161 | load(); |
162 | } | 162 | } |
163 | 163 | ||
164 | bool StdAddressBook::save() | 164 | bool StdAddressBook::save() |
165 | { | 165 | { |
166 | kdDebug(5700) << "StdAddressBook::save()" << endl; | 166 | kdDebug(5700) << "StdAddressBook::save()" << endl; |
167 | 167 | ||
168 | bool ok = true; | 168 | bool ok = true; |
169 | AddressBook *ab = self(); | 169 | AddressBook *ab = self(); |
170 | 170 | ||
171 | ab->deleteRemovedAddressees(); | 171 | ab->deleteRemovedAddressees(); |
172 | 172 | ||
173 | KRES::Manager<Resource>::ActiveIterator it; | 173 | KRES::Manager<Resource>::ActiveIterator it; |
174 | KRES::Manager<Resource> *manager = ab->resourceManager(); | 174 | KRES::Manager<Resource> *manager = ab->resourceManager(); |
175 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { | 175 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { |
176 | if ( !(*it)->readOnly() && (*it)->isOpen() ) { | 176 | if ( !(*it)->readOnly() && (*it)->isOpen() ) { |
177 | Ticket *ticket = ab->requestSaveTicket( *it ); | 177 | Ticket *ticket = ab->requestSaveTicket( *it ); |
178 | // qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() ); | 178 | // qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() ); |
179 | if ( !ticket ) { | 179 | if ( !ticket ) { |
180 | ab->error( i18n( "Unable to save to resource '%1'. It is locked." ) | 180 | ab->error( i18n( "Unable to save to resource '%1'. It is locked." ) |
181 | .arg( (*it)->resourceName() ) ); | 181 | .arg( (*it)->resourceName() ) ); |
182 | return false; | 182 | return false; |
183 | } | 183 | } |
184 | 184 | ||
185 | if ( !ab->save( ticket ) ) | 185 | if ( !ab->save( ticket ) ) |
186 | ok = false; | 186 | ok = false; |
187 | } | 187 | } |
188 | } | 188 | } |
189 | 189 | ||
190 | return ok; | 190 | return ok; |
191 | } | 191 | } |
192 | 192 | ||
193 | void StdAddressBook::close() | 193 | void StdAddressBook::close() |
194 | { | 194 | { |
195 | //US destructObject is not defined on my system???. Is setObject(0) the same ??? | 195 | //US destructObject is not defined on my system???. Is setObject(0) the same ??? |
196 | //US addressBookDeleter.destructObject(); | 196 | //US addressBookDeleter.destructObject(); |
197 | addressBookDeleter.setObject(0); | 197 | addressBookDeleter.setObject(0); |
198 | 198 | ||
199 | } | 199 | } |
200 | 200 | ||
201 | void StdAddressBook::setAutomaticSave( bool enable ) | 201 | void StdAddressBook::setAutomaticSave( bool enable ) |
202 | { | 202 | { |
203 | mAutomaticSave = enable; | 203 | mAutomaticSave = enable; |
204 | } | 204 | } |
205 | 205 | ||
206 | bool StdAddressBook::automaticSave() | 206 | bool StdAddressBook::automaticSave() |
207 | { | 207 | { |
208 | return mAutomaticSave; | 208 | return mAutomaticSave; |
209 | } | 209 | } |
210 | 210 | ||
211 | // should get const for 4.X | 211 | // should get const for 4.X |
212 | Addressee StdAddressBook::whoAmI() | 212 | Addressee StdAddressBook::whoAmI() |
213 | { | 213 | { |
214 | //US KConfig config( "kabcrc" ); | 214 | //US KConfig config( "kabcrc" ); |
215 | KConfig config( locateLocal("config", "kabcrc") ); | 215 | KConfig config( locateLocal("config", "kabcrc") ); |
216 | config.setGroup( "General" ); | 216 | config.setGroup( "General" ); |
217 | 217 | ||
218 | return findByUid( config.readEntry( "WhoAmI" ) ); | 218 | return findByUid( config.readEntry( "WhoAmI" ) ); |
219 | } | 219 | } |
220 | 220 | ||
221 | void StdAddressBook::setWhoAmI( const Addressee &addr ) | 221 | void StdAddressBook::setWhoAmI( const Addressee &addr ) |
222 | { | 222 | { |
223 | //US KConfig config( "kabcrc" ); | 223 | //US KConfig config( "kabcrc" ); |
224 | KConfig config( locateLocal("config", "kabcrc") ); | 224 | KConfig config( locateLocal("config", "kabcrc") ); |
225 | config.setGroup( "General" ); | 225 | config.setGroup( "General" ); |
226 | 226 | ||
227 | config.writeEntry( "WhoAmI", addr.uid() ); | 227 | config.writeEntry( "WhoAmI", addr.uid() ); |
228 | } | 228 | } |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 3ae23e8..a0fec91 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -38,193 +38,193 @@ | |||
38 | #include <kabc/errorhandler.h> | 38 | #include <kabc/errorhandler.h> |
39 | #include <kabc/resource.h> | 39 | #include <kabc/resource.h> |
40 | #include <kabc/vcardconverter.h> | 40 | #include <kabc/vcardconverter.h> |
41 | #include <kapplication.h> | 41 | #include <kapplication.h> |
42 | #include <kactionclasses.h> | 42 | #include <kactionclasses.h> |
43 | #include <kcmultidialog.h> | 43 | #include <kcmultidialog.h> |
44 | #include <kdebug.h> | 44 | #include <kdebug.h> |
45 | #include <kdeversion.h> | 45 | #include <kdeversion.h> |
46 | #include <kkeydialog.h> | 46 | #include <kkeydialog.h> |
47 | #include <kmessagebox.h> | 47 | #include <kmessagebox.h> |
48 | #include <kprinter.h> | 48 | #include <kprinter.h> |
49 | #include <kprotocolinfo.h> | 49 | #include <kprotocolinfo.h> |
50 | #include <kresources/selectdialog.h> | 50 | #include <kresources/selectdialog.h> |
51 | #include <kstandarddirs.h> | 51 | #include <kstandarddirs.h> |
52 | #include <ktempfile.h> | 52 | #include <ktempfile.h> |
53 | #include <kxmlguiclient.h> | 53 | #include <kxmlguiclient.h> |
54 | #include <kaboutdata.h> | 54 | #include <kaboutdata.h> |
55 | #include <libkdepim/categoryselectdialog.h> | 55 | #include <libkdepim/categoryselectdialog.h> |
56 | 56 | ||
57 | #include "addresseeutil.h" | 57 | #include "addresseeutil.h" |
58 | #include "addresseeeditordialog.h" | 58 | #include "addresseeeditordialog.h" |
59 | #include "extensionmanager.h" | 59 | #include "extensionmanager.h" |
60 | #include "kstdaction.h" | 60 | #include "kstdaction.h" |
61 | #include "kaddressbookservice.h" | 61 | #include "kaddressbookservice.h" |
62 | #include "ldapsearchdialog.h" | 62 | #include "ldapsearchdialog.h" |
63 | #include "printing/printingwizard.h" | 63 | #include "printing/printingwizard.h" |
64 | #else // KAB_EMBEDDED | 64 | #else // KAB_EMBEDDED |
65 | 65 | ||
66 | #include <kapplication.h> | 66 | #include <kapplication.h> |
67 | #include "KDGanttMinimizeSplitter.h" | 67 | #include "KDGanttMinimizeSplitter.h" |
68 | #include "kaddressbookmain.h" | 68 | #include "kaddressbookmain.h" |
69 | #include "kactioncollection.h" | 69 | #include "kactioncollection.h" |
70 | #include <qapp.h> | 70 | #include <qapp.h> |
71 | #include <qmenubar.h> | 71 | #include <qmenubar.h> |
72 | //#include <qtoolbar.h> | 72 | //#include <qtoolbar.h> |
73 | #include <qmessagebox.h> | 73 | #include <qmessagebox.h> |
74 | #include <kdebug.h> | 74 | #include <kdebug.h> |
75 | #include <kiconloader.h> // needed for SmallIcon | 75 | #include <kiconloader.h> // needed for SmallIcon |
76 | #include <kresources/kcmkresources.h> | 76 | #include <kresources/kcmkresources.h> |
77 | #include <ktoolbar.h> | 77 | #include <ktoolbar.h> |
78 | 78 | ||
79 | #include <kcmkabconfig.h> | 79 | #include <kcmkabconfig.h> |
80 | 80 | ||
81 | //US#include <qpe/resource.h> // needed for Resource::loadPixmap | 81 | //US#include <qpe/resource.h> // needed for Resource::loadPixmap |
82 | //#include <qlabel.h> | 82 | //#include <qlabel.h> |
83 | #endif // KAB_EMBEDDED | 83 | #endif // KAB_EMBEDDED |
84 | #include <kcmkabconfig.h> | 84 | #include <kcmkabconfig.h> |
85 | 85 | ||
86 | 86 | ||
87 | #include <kresources/selectdialog.h> | 87 | #include <kresources/selectdialog.h> |
88 | #include <kmessagebox.h> | 88 | #include <kmessagebox.h> |
89 | 89 | ||
90 | #include <picture.h> | 90 | #include <picture.h> |
91 | #include <resource.h> | 91 | #include <resource.h> |
92 | 92 | ||
93 | //US#include <qsplitter.h> | 93 | //US#include <qsplitter.h> |
94 | #include <qvbox.h> | 94 | #include <qvbox.h> |
95 | #include <qlayout.h> | 95 | #include <qlayout.h> |
96 | #include <qclipboard.h> | 96 | #include <qclipboard.h> |
97 | 97 | ||
98 | #include <libkdepim/categoryselectdialog.h> | 98 | #include <libkdepim/categoryselectdialog.h> |
99 | 99 | ||
100 | #include "addresseeutil.h" | 100 | #include "addresseeutil.h" |
101 | #include "undocmds.h" | 101 | #include "undocmds.h" |
102 | #include "addresseeeditordialog.h" | 102 | #include "addresseeeditordialog.h" |
103 | #include "viewmanager.h" | 103 | #include "viewmanager.h" |
104 | #include "details/detailsviewcontainer.h" | 104 | #include "details/detailsviewcontainer.h" |
105 | #include "kabprefs.h" | 105 | #include "kabprefs.h" |
106 | #include "xxportmanager.h" | 106 | #include "xxportmanager.h" |
107 | #include "incsearchwidget.h" | 107 | #include "incsearchwidget.h" |
108 | #include "jumpbuttonbar.h" | 108 | #include "jumpbuttonbar.h" |
109 | #include "extensionmanager.h" | 109 | #include "extensionmanager.h" |
110 | #include "addresseeconfig.h" | 110 | #include "addresseeconfig.h" |
111 | #include <kcmultidialog.h> | 111 | #include <kcmultidialog.h> |
112 | 112 | ||
113 | 113 | ||
114 | #ifdef KAB_EMBEDDED | 114 | #ifdef KAB_EMBEDDED |
115 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 115 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
116 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), | 116 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), |
117 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 117 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
118 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 118 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
119 | #else //KAB_EMBEDDED | 119 | #else //KAB_EMBEDDED |
120 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 120 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
121 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), | 121 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), |
122 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 122 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
123 | mReadWrite( readWrite ), mModified( false ) | 123 | mReadWrite( readWrite ), mModified( false ) |
124 | #endif //KAB_EMBEDDED | 124 | #endif //KAB_EMBEDDED |
125 | { | 125 | { |
126 | #ifdef KAB_EMBEDDED | 126 | #ifdef KAB_EMBEDDED |
127 | //US we define here our own global actioncollection. | 127 | //US we define here our own global actioncollection. |
128 | //mActionCollection = new KActionCollection(this); | 128 | //mActionCollection = new KActionCollection(this); |
129 | #endif //KAB_EMBEDDED | 129 | #endif //KAB_EMBEDDED |
130 | mExtensionBarSplitter = 0; | 130 | mExtensionBarSplitter = 0; |
131 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 131 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
132 | 132 | ||
133 | mAddressBook = KABC::StdAddressBook::self(); | 133 | mAddressBook = KABC::StdAddressBook::self(); |
134 | KABC::StdAddressBook::setAutomaticSave( true ); | 134 | KABC::StdAddressBook::setAutomaticSave( false ); |
135 | 135 | ||
136 | #ifndef KAB_EMBEDDED | 136 | #ifndef KAB_EMBEDDED |
137 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 137 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
138 | #endif //KAB_EMBEDDED | 138 | #endif //KAB_EMBEDDED |
139 | 139 | ||
140 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 140 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
141 | SLOT( addressBookChanged() ) ); | 141 | SLOT( addressBookChanged() ) ); |
142 | 142 | ||
143 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 143 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
144 | "X-Department", "KADDRESSBOOK" ); | 144 | "X-Department", "KADDRESSBOOK" ); |
145 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 145 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
146 | "X-Profession", "KADDRESSBOOK" ); | 146 | "X-Profession", "KADDRESSBOOK" ); |
147 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 147 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
148 | "X-AssistantsName", "KADDRESSBOOK" ); | 148 | "X-AssistantsName", "KADDRESSBOOK" ); |
149 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 149 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
150 | "X-ManagersName", "KADDRESSBOOK" ); | 150 | "X-ManagersName", "KADDRESSBOOK" ); |
151 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 151 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
152 | "X-SpousesName", "KADDRESSBOOK" ); | 152 | "X-SpousesName", "KADDRESSBOOK" ); |
153 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, | 153 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, |
154 | "X-Office", "KADDRESSBOOK" ); | 154 | "X-Office", "KADDRESSBOOK" ); |
155 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 155 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
156 | "X-IMAddress", "KADDRESSBOOK" ); | 156 | "X-IMAddress", "KADDRESSBOOK" ); |
157 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 157 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
158 | "X-Anniversary", "KADDRESSBOOK" ); | 158 | "X-Anniversary", "KADDRESSBOOK" ); |
159 | 159 | ||
160 | //US added this field to become compatible with Opie addressbook | 160 | //US added this field to become compatible with Opie addressbook |
161 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 161 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
162 | "X-Gender", "KADDRESSBOOK" ); | 162 | "X-Gender", "KADDRESSBOOK" ); |
163 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 163 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
164 | "X-Children", "KADDRESSBOOK" ); | 164 | "X-Children", "KADDRESSBOOK" ); |
165 | 165 | ||
166 | initGUI(); | 166 | initGUI(); |
167 | 167 | ||
168 | mIncSearchWidget->setFocus(); | 168 | mIncSearchWidget->setFocus(); |
169 | 169 | ||
170 | 170 | ||
171 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 171 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
172 | SLOT( setContactSelected( const QString& ) ) ); | 172 | SLOT( setContactSelected( const QString& ) ) ); |
173 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 173 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
174 | SLOT( editContact( const QString& ) ) ); | 174 | SLOT( editContact( const QString& ) ) ); |
175 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 175 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
176 | SLOT( deleteContacts( ) ) ); | 176 | SLOT( deleteContacts( ) ) ); |
177 | connect( mViewManager, SIGNAL( modified() ), | 177 | connect( mViewManager, SIGNAL( modified() ), |
178 | SLOT( setModified() ) ); | 178 | SLOT( setModified() ) ); |
179 | 179 | ||
180 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 180 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
181 | 181 | ||
182 | connect( mXXPortManager, SIGNAL( modified() ), | 182 | connect( mXXPortManager, SIGNAL( modified() ), |
183 | SLOT( setModified() ) ); | 183 | SLOT( setModified() ) ); |
184 | 184 | ||
185 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 185 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
186 | SLOT( incrementalSearch( const QString& ) ) ); | 186 | SLOT( incrementalSearch( const QString& ) ) ); |
187 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 187 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
188 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 188 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
189 | 189 | ||
190 | #ifndef KAB_EMBEDDED | 190 | #ifndef KAB_EMBEDDED |
191 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 191 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
192 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 192 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
193 | 193 | ||
194 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 194 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
195 | SLOT( sendMail( const QString& ) ) ); | 195 | SLOT( sendMail( const QString& ) ) ); |
196 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 196 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
197 | SLOT( browse( const QString& ) ) ); | 197 | SLOT( browse( const QString& ) ) ); |
198 | 198 | ||
199 | mAddressBookService = new KAddressBookService( this ); | 199 | mAddressBookService = new KAddressBookService( this ); |
200 | 200 | ||
201 | #endif //KAB_EMBEDDED | 201 | #endif //KAB_EMBEDDED |
202 | mEditorDialog = 0; | 202 | mEditorDialog = 0; |
203 | createAddresseeEditorDialog( this ); | 203 | createAddresseeEditorDialog( this ); |
204 | setModified( false ); | 204 | setModified( false ); |
205 | } | 205 | } |
206 | 206 | ||
207 | KABCore::~KABCore() | 207 | KABCore::~KABCore() |
208 | { | 208 | { |
209 | // save(); | 209 | // save(); |
210 | //saveSettings(); | 210 | //saveSettings(); |
211 | //KABPrefs::instance()->writeConfig(); | 211 | //KABPrefs::instance()->writeConfig(); |
212 | delete AddresseeConfig::instance(); | 212 | delete AddresseeConfig::instance(); |
213 | mAddressBook = 0; | 213 | mAddressBook = 0; |
214 | KABC::StdAddressBook::close(); | 214 | KABC::StdAddressBook::close(); |
215 | 215 | ||
216 | #ifdef KAB_EMBEDDED | 216 | #ifdef KAB_EMBEDDED |
217 | //US we define here our own global actioncollection. | 217 | //US we define here our own global actioncollection. |
218 | // delete mActionCollection; | 218 | // delete mActionCollection; |
219 | #endif //KAB_EMBEDDED | 219 | #endif //KAB_EMBEDDED |
220 | 220 | ||
221 | } | 221 | } |
222 | 222 | ||
223 | void KABCore::restoreSettings() | 223 | void KABCore::restoreSettings() |
224 | { | 224 | { |
225 | bool state = KABPrefs::instance()->mJumpButtonBarVisible; | 225 | bool state = KABPrefs::instance()->mJumpButtonBarVisible; |
226 | 226 | ||
227 | mActionJumpBar->setChecked( state ); | 227 | mActionJumpBar->setChecked( state ); |
228 | setJumpButtonBarVisible( state ); | 228 | setJumpButtonBarVisible( state ); |
229 | 229 | ||
230 | state = KABPrefs::instance()->mDetailsPageVisible; | 230 | state = KABPrefs::instance()->mDetailsPageVisible; |
diff --git a/microkde/kresources/factory.cpp b/microkde/kresources/factory.cpp index 56b0ef3..827ec38 100644 --- a/microkde/kresources/factory.cpp +++ b/microkde/kresources/factory.cpp | |||
@@ -1,242 +1,242 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkresources. | 2 | This file is part of libkresources. |
3 | 3 | ||
4 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 4 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
5 | Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org> | 5 | Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org> |
6 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> | 6 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> |
7 | 7 | ||
8 | This library is free software; you can redistribute it and/or | 8 | This library is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU Library General Public | 9 | modify it under the terms of the GNU Library General Public |
10 | License as published by the Free Software Foundation; either | 10 | License as published by the Free Software Foundation; either |
11 | version 2 of the License, or (at your option) any later version. | 11 | version 2 of the License, or (at your option) any later version. |
12 | 12 | ||
13 | This library is distributed in the hope that it will be useful, | 13 | This library is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | Library General Public License for more details. | 16 | Library General Public License for more details. |
17 | 17 | ||
18 | You should have received a copy of the GNU Library General Public License | 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 | 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, | 20 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
21 | Boston, MA 02111-1307, USA. | 21 | Boston, MA 02111-1307, USA. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <kdebug.h> | 24 | #include <kdebug.h> |
25 | #include <klocale.h> | 25 | #include <klocale.h> |
26 | #include <ksimpleconfig.h> | 26 | #include <ksimpleconfig.h> |
27 | #include <kstandarddirs.h> | 27 | #include <kstandarddirs.h> |
28 | #include <kstaticdeleter.h> | 28 | #include <kstaticdeleter.h> |
29 | #include <klibloader.h> | 29 | #include <klibloader.h> |
30 | 30 | ||
31 | #include <qfile.h> | 31 | #include <qfile.h> |
32 | 32 | ||
33 | #include "resource.h" | 33 | #include "resource.h" |
34 | #include "factory.h" | 34 | #include "factory.h" |
35 | 35 | ||
36 | using namespace KRES; | 36 | using namespace KRES; |
37 | 37 | ||
38 | QDict<Factory> *Factory::mSelves = 0; | 38 | QDict<Factory> *Factory::mSelves = 0; |
39 | static KStaticDeleter< QDict<Factory> > staticDeleter; | 39 | static KStaticDeleter< QDict<Factory> > staticDeleter; |
40 | 40 | ||
41 | Factory *Factory::self( const QString& resourceFamily ) | 41 | Factory *Factory::self( const QString& resourceFamily ) |
42 | { | 42 | { |
43 | kdDebug(5650) << "Factory::self()" << endl; | 43 | |
44 | 44 | ||
45 | Factory *factory = 0; | 45 | Factory *factory = 0; |
46 | if ( !mSelves ) | 46 | if ( !mSelves ) |
47 | { | 47 | { |
48 | mSelves = staticDeleter.setObject( new QDict<Factory> ); | 48 | mSelves = staticDeleter.setObject( new QDict<Factory> ); |
49 | } | 49 | } |
50 | 50 | ||
51 | factory = mSelves->find( resourceFamily ); | 51 | factory = mSelves->find( resourceFamily ); |
52 | 52 | ||
53 | if ( !factory ) { | 53 | if ( !factory ) { |
54 | factory = new Factory( resourceFamily ); | 54 | factory = new Factory( resourceFamily ); |
55 | mSelves->insert( resourceFamily, factory ); | 55 | mSelves->insert( resourceFamily, factory ); |
56 | } | 56 | } |
57 | 57 | ||
58 | return factory; | 58 | return factory; |
59 | } | 59 | } |
60 | 60 | ||
61 | Factory::Factory( const QString& resourceFamily ) : | 61 | Factory::Factory( const QString& resourceFamily ) : |
62 | mResourceFamily( resourceFamily ) | 62 | mResourceFamily( resourceFamily ) |
63 | { | 63 | { |
64 | //US so far we have three types available for resourceFamily "contact" | 64 | //US so far we have three types available for resourceFamily "contact" |
65 | // and that are "file", "dir", "ldap" | 65 | // and that are "file", "dir", "ldap" |
66 | /*US | 66 | /*US |
67 | 67 | ||
68 | KTrader::OfferList plugins = KTrader::self()->query( "KResources/Plugin", QString( "[X-KDE-ResourceFamily] == '%1'" ) | 68 | KTrader::OfferList plugins = KTrader::self()->query( "KResources/Plugin", QString( "[X-KDE-ResourceFamily] == '%1'" ) |
69 | .arg( resourceFamily ) ); | 69 | .arg( resourceFamily ) ); |
70 | KTrader::OfferList::ConstIterator it; | 70 | KTrader::OfferList::ConstIterator it; |
71 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { | 71 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { |
72 | QVariant type = (*it)->property( "X-KDE-ResourceType" ); | 72 | QVariant type = (*it)->property( "X-KDE-ResourceType" ); |
73 | if ( !type.toString().isEmpty() ) | 73 | if ( !type.toString().isEmpty() ) |
74 | mTypeMap.insert( type.toString(), *it ); | 74 | mTypeMap.insert( type.toString(), *it ); |
75 | } | 75 | } |
76 | */ | 76 | */ |
77 | 77 | ||
78 | //US new | 78 | //US new |
79 | PluginInfo* info = new PluginInfo; | 79 | PluginInfo* info = new PluginInfo; |
80 | info->library = "microkabc_file"; | 80 | info->library = "microkabc_file"; |
81 | info->nameLabel = i18n( "file" ); | 81 | info->nameLabel = i18n( "file" ); |
82 | info->descriptionLabel = i18n( "No description available." ); | 82 | info->descriptionLabel = i18n( "Choose one file" ); |
83 | mTypeMap.insert( "file", info ); | 83 | mTypeMap.insert( "file", info ); |
84 | 84 | ||
85 | info = new PluginInfo; | 85 | info = new PluginInfo; |
86 | info->library = "microkabc_dir"; | 86 | info->library = "microkabc_dir"; |
87 | info->nameLabel = i18n( "dir" ); | 87 | info->nameLabel = i18n( "dir" ); |
88 | info->descriptionLabel = i18n( "No description available." ); | 88 | info->descriptionLabel = i18n( "Choose a directory with may files" ); |
89 | mTypeMap.insert( "dir", info ); | 89 | mTypeMap.insert( "dir", info ); |
90 | 90 | ||
91 | info = new PluginInfo; | 91 | info = new PluginInfo; |
92 | info->library = "microkabc_ldap"; | 92 | info->library = "microkabc_ldap"; |
93 | info->nameLabel = i18n( "ldap" ); | 93 | info->nameLabel = i18n( "ldap" ); |
94 | info->descriptionLabel = i18n( "No description available." ); | 94 | info->descriptionLabel = i18n( "No description available" ); |
95 | mTypeMap.insert( "ldap", info ); | 95 | mTypeMap.insert( "ldap", info ); |
96 | 96 | ||
97 | //US add opie plugin only, if the library exists | 97 | //US add opie plugin only, if the library exists |
98 | QString libname = "microkabc_opie"; | 98 | QString libname = "microkabc_opie"; |
99 | QString path = KLibLoader::findLibrary( QFile::encodeName( libname ) ); | 99 | QString path = KLibLoader::findLibrary( QFile::encodeName( libname ) ); |
100 | if ( !path.isEmpty() ) | 100 | if ( !path.isEmpty() ) |
101 | { | 101 | { |
102 | info = new PluginInfo; | 102 | info = new PluginInfo; |
103 | info->library = libname; | 103 | info->library = libname; |
104 | info->nameLabel = i18n( "opie" ); | 104 | info->nameLabel = i18n( "opie" ); |
105 | info->descriptionLabel = i18n( "Opie PIM Addressbook." ); | 105 | info->descriptionLabel = i18n( "Opie PIM Addressbook." ); |
106 | mTypeMap.insert( "opie", info ); | 106 | mTypeMap.insert( "opie", info ); |
107 | } | 107 | } |
108 | 108 | ||
109 | //US add qtopia plugin only, if the library exists | 109 | //US add qtopia plugin only, if the library exists |
110 | libname = "microkabc_qtopia"; | 110 | libname = "microkabc_qtopia"; |
111 | path = KLibLoader::findLibrary( QFile::encodeName( libname ) ); | 111 | path = KLibLoader::findLibrary( QFile::encodeName( libname ) ); |
112 | if ( !path.isEmpty() ) | 112 | if ( !path.isEmpty() ) |
113 | { | 113 | { |
114 | info = new PluginInfo; | 114 | info = new PluginInfo; |
115 | info->library = libname; | 115 | info->library = libname; |
116 | info->nameLabel = i18n( "qtopia" ); | 116 | info->nameLabel = i18n( "qtopia" ); |
117 | info->descriptionLabel = i18n( "Qtopia PIM Addressbook." ); | 117 | info->descriptionLabel = i18n( "Qtopia PIM Addressbook." ); |
118 | mTypeMap.insert( "qtopia", info ); | 118 | mTypeMap.insert( "qtopia", info ); |
119 | } | 119 | } |
120 | 120 | ||
121 | 121 | ||
122 | } | 122 | } |
123 | 123 | ||
124 | Factory::~Factory() | 124 | Factory::~Factory() |
125 | { | 125 | { |
126 | } | 126 | } |
127 | 127 | ||
128 | QStringList Factory::typeNames() const | 128 | QStringList Factory::typeNames() const |
129 | { | 129 | { |
130 | //US method QMap::keys() not available yet. SO collect the data manually | 130 | //US method QMap::keys() not available yet. SO collect the data manually |
131 | //US return mTypeMap.keys(); | 131 | //US return mTypeMap.keys(); |
132 | 132 | ||
133 | QStringList result; | 133 | QStringList result; |
134 | 134 | ||
135 | QMap<QString, PluginInfo*>::ConstIterator it; | 135 | QMap<QString, PluginInfo*>::ConstIterator it; |
136 | for( it = mTypeMap.begin(); it != mTypeMap.end(); ++it ) { | 136 | for( it = mTypeMap.begin(); it != mTypeMap.end(); ++it ) { |
137 | result << it.key().latin1(); | 137 | result << it.key().latin1(); |
138 | // qDebug("Factory::typeNames() : %s ", it.key().latin1()); | 138 | // qDebug("Factory::typeNames() : %s ", it.key().latin1()); |
139 | 139 | ||
140 | } | 140 | } |
141 | return result; | 141 | return result; |
142 | } | 142 | } |
143 | 143 | ||
144 | ConfigWidget *Factory::configWidget( const QString& type, QWidget *parent ) | 144 | ConfigWidget *Factory::configWidget( const QString& type, QWidget *parent ) |
145 | { | 145 | { |
146 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) | 146 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) |
147 | return 0; | 147 | return 0; |
148 | 148 | ||
149 | //US KService::Ptr ptr = mTypeMap[ type ]; | 149 | //US KService::Ptr ptr = mTypeMap[ type ]; |
150 | //US KLibFactory *factory = KLibLoader::self()->factory( ptr->library().latin1() ); | 150 | //US KLibFactory *factory = KLibLoader::self()->factory( ptr->library().latin1() ); |
151 | PluginInfo* pi = mTypeMap[ type ]; | 151 | PluginInfo* pi = mTypeMap[ type ]; |
152 | KLibFactory *factory = (KLibFactory *)KLibLoader::self()->factory( pi->library.latin1() ); | 152 | KLibFactory *factory = (KLibFactory *)KLibLoader::self()->factory( pi->library.latin1() ); |
153 | if ( !factory ) { | 153 | if ( !factory ) { |
154 | qDebug("KRES::Factory::configWidget(): Factory creation failed for library %s", pi->library.latin1()); | 154 | qDebug("KRES::Factory::configWidget(): Factory creation failed for library %s", pi->library.latin1()); |
155 | kdDebug() << "KRES::Factory::configWidget(): Factory creation failed" << endl; | 155 | kdDebug() << "KRES::Factory::configWidget(): Factory creation failed" << endl; |
156 | return 0; | 156 | return 0; |
157 | } | 157 | } |
158 | 158 | ||
159 | PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory ); | 159 | PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory ); |
160 | 160 | ||
161 | if ( !pluginFactory ) { | 161 | if ( !pluginFactory ) { |
162 | qDebug("KRES::Factory::configWidget(): no plugin factory for library %s", pi->library.latin1()); | 162 | qDebug("KRES::Factory::configWidget(): no plugin factory for library %s", pi->library.latin1()); |
163 | kdDebug() << "KRES::Factory::configWidget(): no plugin factory." << endl; | 163 | kdDebug() << "KRES::Factory::configWidget(): no plugin factory." << endl; |
164 | return 0; | 164 | return 0; |
165 | } | 165 | } |
166 | 166 | ||
167 | ConfigWidget *wdg = pluginFactory->configWidget( parent ); | 167 | ConfigWidget *wdg = pluginFactory->configWidget( parent ); |
168 | if ( !wdg ) { | 168 | if ( !wdg ) { |
169 | //US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl; | 169 | //US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl; |
170 | qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1()); | 170 | qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1()); |
171 | return 0; | 171 | return 0; |
172 | } | 172 | } |
173 | return wdg; | 173 | return wdg; |
174 | 174 | ||
175 | } | 175 | } |
176 | 176 | ||
177 | QString Factory::typeName( const QString &type ) const | 177 | QString Factory::typeName( const QString &type ) const |
178 | { | 178 | { |
179 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) | 179 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) |
180 | return QString(); | 180 | return QString(); |
181 | 181 | ||
182 | 182 | ||
183 | //US KService::Ptr ptr = mTypeMap[ type ]; | 183 | //US KService::Ptr ptr = mTypeMap[ type ]; |
184 | //US return ptr->name(); | 184 | //US return ptr->name(); |
185 | PluginInfo* pi = mTypeMap[ type ]; | 185 | PluginInfo* pi = mTypeMap[ type ]; |
186 | return pi->nameLabel; | 186 | return pi->nameLabel; |
187 | 187 | ||
188 | } | 188 | } |
189 | 189 | ||
190 | QString Factory::typeDescription( const QString &type ) const | 190 | QString Factory::typeDescription( const QString &type ) const |
191 | { | 191 | { |
192 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) | 192 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) |
193 | return QString(); | 193 | return QString(); |
194 | 194 | ||
195 | //US KService::Ptr ptr = mTypeMap[ type ]; | 195 | //US KService::Ptr ptr = mTypeMap[ type ]; |
196 | //US return ptr->comment(); | 196 | //US return ptr->comment(); |
197 | PluginInfo* pi = mTypeMap[ type ]; | 197 | PluginInfo* pi = mTypeMap[ type ]; |
198 | return pi->descriptionLabel; | 198 | return pi->descriptionLabel; |
199 | } | 199 | } |
200 | 200 | ||
201 | Resource *Factory::resource( const QString& type, const KConfig *config ) | 201 | Resource *Factory::resource( const QString& type, const KConfig *config ) |
202 | { | 202 | { |
203 | kdDebug() << "Factory::resource( " << type << ", config)" << endl; | 203 | |
204 | 204 | ||
205 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) | 205 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) |
206 | return 0; | 206 | return 0; |
207 | 207 | ||
208 | /*US load the lib not dynamicly. !! | 208 | /*US load the lib not dynamicly. !! |
209 | KService::Ptr ptr = mTypeMap[ type ]; | 209 | KService::Ptr ptr = mTypeMap[ type ]; |
210 | KLibFactory *factory = KLibLoader::self()->factory( ptr->library().latin1() ); | 210 | KLibFactory *factory = KLibLoader::self()->factory( ptr->library().latin1() ); |
211 | if ( !factory ) { | 211 | if ( !factory ) { |
212 | kdDebug() << "KRES::Factory::resource(): Factory creation failed" << endl; | 212 | kdDebug() << "KRES::Factory::resource(): Factory creation failed" << endl; |
213 | return 0; | 213 | return 0; |
214 | } | 214 | } |
215 | */ | 215 | */ |
216 | PluginInfo* pi = mTypeMap[ type ]; | 216 | PluginInfo* pi = mTypeMap[ type ]; |
217 | KLibFactory *factory = (KLibFactory *)KLibLoader::self()->factory( pi->library.latin1() ); | 217 | KLibFactory *factory = (KLibFactory *)KLibLoader::self()->factory( pi->library.latin1() ); |
218 | if ( !factory ) { | 218 | if ( !factory ) { |
219 | qDebug("KRES::Factory::resource(): Factory creation failed for library %s", pi->library.latin1()); | 219 | qDebug("KRES::Factory::resource(): Factory creation failed for library %s", pi->library.latin1()); |
220 | kdDebug() << "KRES::Factory::resource(): Factory creation failed" << endl; | 220 | kdDebug() << "KRES::Factory::resource(): Factory creation failed" << endl; |
221 | return 0; | 221 | return 0; |
222 | } | 222 | } |
223 | 223 | ||
224 | PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory ); | 224 | PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory ); |
225 | 225 | ||
226 | if ( !pluginFactory ) { | 226 | if ( !pluginFactory ) { |
227 | qDebug("KRES::Factory::resource(): no plugin factory for library %s", pi->library.latin1()); | 227 | qDebug("KRES::Factory::resource(): no plugin factory for library %s", pi->library.latin1()); |
228 | kdDebug() << "KRES::Factory::resource(): no plugin factory." << endl; | 228 | kdDebug() << "KRES::Factory::resource(): no plugin factory." << endl; |
229 | return 0; | 229 | return 0; |
230 | } | 230 | } |
231 | 231 | ||
232 | Resource *resource = pluginFactory->resource( config ); | 232 | Resource *resource = pluginFactory->resource( config ); |
233 | if ( !resource ) { | 233 | if ( !resource ) { |
234 | //US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl; | 234 | //US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl; |
235 | qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1()); | 235 | qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1()); |
236 | return 0; | 236 | return 0; |
237 | } | 237 | } |
238 | 238 | ||
239 | resource->setType( type ); | 239 | resource->setType( type ); |
240 | 240 | ||
241 | return resource; | 241 | return resource; |
242 | } | 242 | } |
diff --git a/microkde/kresources/resource.cpp b/microkde/kresources/resource.cpp index 169eaa4..7827a67 100644 --- a/microkde/kresources/resource.cpp +++ b/microkde/kresources/resource.cpp | |||
@@ -1,185 +1,186 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkresources. | 2 | This file is part of libkresources. |
3 | 3 | ||
4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
5 | Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org> | 5 | Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org> |
6 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> | 6 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> |
7 | 7 | ||
8 | This library is free software; you can redistribute it and/or | 8 | This library is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU Library General Public | 9 | modify it under the terms of the GNU Library General Public |
10 | License as published by the Free Software Foundation; either | 10 | License as published by the Free Software Foundation; either |
11 | version 2 of the License, or (at your option) any later version. | 11 | version 2 of the License, or (at your option) any later version. |
12 | 12 | ||
13 | This library is distributed in the hope that it will be useful, | 13 | This library is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | Library General Public License for more details. | 16 | Library General Public License for more details. |
17 | 17 | ||
18 | You should have received a copy of the GNU Library General Public License | 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 | 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, | 20 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
21 | Boston, MA 02111-1307, USA. | 21 | Boston, MA 02111-1307, USA. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <kdebug.h> | 24 | #include <kdebug.h> |
25 | #include <kapplication.h> | 25 | #include <kapplication.h> |
26 | #include <kconfig.h> | 26 | #include <kconfig.h> |
27 | 27 | ||
28 | #include "resource.h" | 28 | #include "resource.h" |
29 | 29 | ||
30 | using namespace KRES; | 30 | using namespace KRES; |
31 | 31 | ||
32 | class Resource::ResourcePrivate | 32 | class Resource::ResourcePrivate |
33 | { | 33 | { |
34 | public: | 34 | public: |
35 | #ifdef QT_THREAD_SUPPORT | 35 | #ifdef QT_THREAD_SUPPORT |
36 | QMutex mMutex; | 36 | QMutex mMutex; |
37 | #endif | 37 | #endif |
38 | int mOpenCount; | 38 | int mOpenCount; |
39 | QString mType; | 39 | QString mType; |
40 | QString mIdentifier; | 40 | QString mIdentifier; |
41 | bool mReadOnly; | 41 | bool mReadOnly; |
42 | QString mName; | 42 | QString mName; |
43 | bool mActive; | 43 | bool mActive; |
44 | bool mIsOpen; | 44 | bool mIsOpen; |
45 | }; | 45 | }; |
46 | 46 | ||
47 | Resource::Resource( const KConfig* config ) | 47 | Resource::Resource( const KConfig* config ) |
48 | : QObject( 0, "" ), d( new ResourcePrivate ) | 48 | : QObject( 0, "" ), d( new ResourcePrivate ) |
49 | { | 49 | { |
50 | d->mOpenCount = 0; | 50 | d->mOpenCount = 0; |
51 | d->mIsOpen = false; | 51 | d->mIsOpen = false; |
52 | 52 | ||
53 | //US compiler claimed that const discards qualifier | 53 | //US compiler claimed that const discards qualifier |
54 | KConfig* cfg = (KConfig*)config; | 54 | KConfig* cfg = (KConfig*)config; |
55 | if ( cfg ) { | 55 | if ( cfg ) { |
56 | d->mType = cfg->readEntry( "ResourceType" ); | 56 | d->mType = cfg->readEntry( "ResourceType" ); |
57 | d->mName = cfg->readEntry( "ResourceName" ); | 57 | d->mName = cfg->readEntry( "ResourceName" ); |
58 | d->mReadOnly = cfg->readBoolEntry( "ResourceIsReadOnly", false ); | 58 | d->mReadOnly = cfg->readBoolEntry( "ResourceIsReadOnly", false ); |
59 | d->mActive = cfg->readBoolEntry( "ResourceIsActive", true ); | 59 | d->mActive = cfg->readBoolEntry( "ResourceIsActive", true ); |
60 | d->mIdentifier = cfg->readEntry( "ResourceIdentifier" ); | 60 | d->mIdentifier = cfg->readEntry( "ResourceIdentifier" ); |
61 | } else { | 61 | } else { |
62 | d->mType = "type"; | 62 | d->mType = "type"; |
63 | d->mName = "resource-name"; | 63 | d->mName = "resource-name"; |
64 | d->mReadOnly = false; | 64 | d->mReadOnly = false; |
65 | d->mActive = true; | 65 | d->mActive = true; |
66 | d->mIdentifier = KApplication::randomString( 10 ); | 66 | d->mIdentifier = KApplication::randomString( 10 ); |
67 | } | 67 | } |
68 | } | 68 | } |
69 | 69 | ||
70 | Resource::~Resource() | 70 | Resource::~Resource() |
71 | { | 71 | { |
72 | delete d; | 72 | delete d; |
73 | d = 0; | 73 | d = 0; |
74 | } | 74 | } |
75 | 75 | ||
76 | void Resource::writeConfig( KConfig* config ) | 76 | void Resource::writeConfig( KConfig* config ) |
77 | { | 77 | { |
78 | kdDebug(5650) << "Resource::writeConfig()" << endl; | 78 | |
79 | 79 | ||
80 | config->writeEntry( "ResourceType", d->mType ); | 80 | config->writeEntry( "ResourceType", d->mType ); |
81 | config->writeEntry( "ResourceName", d->mName ); | 81 | config->writeEntry( "ResourceName", d->mName ); |
82 | config->writeEntry( "ResourceIsReadOnly", d->mReadOnly ); | 82 | config->writeEntry( "ResourceIsReadOnly", d->mReadOnly ); |
83 | config->writeEntry( "ResourceIsActive", d->mActive ); | 83 | config->writeEntry( "ResourceIsActive", d->mActive ); |
84 | config->writeEntry( "ResourceIdentifier", d->mIdentifier ); | 84 | config->writeEntry( "ResourceIdentifier", d->mIdentifier ); |
85 | } | 85 | } |
86 | 86 | ||
87 | bool Resource::open() | 87 | bool Resource::open() |
88 | { | 88 | { |
89 | d->mIsOpen = true; | 89 | d->mIsOpen = true; |
90 | #ifdef QT_THREAD_SUPPORT | 90 | #ifdef QT_THREAD_SUPPORT |
91 | QMutexLocker guard( &(d->mMutex) ); | 91 | QMutexLocker guard( &(d->mMutex) ); |
92 | #endif | 92 | #endif |
93 | if ( !d->mOpenCount ) { | 93 | if ( !d->mOpenCount ) { |
94 | kdDebug(5650) << "Opening resource " << resourceName() << endl; | 94 | kdDebug(5650) << "Opening resource " << resourceName() << endl; |
95 | d->mIsOpen = doOpen(); | 95 | d->mIsOpen = doOpen(); |
96 | } | 96 | } |
97 | d->mOpenCount++; | 97 | d->mOpenCount++; |
98 | return d->mIsOpen; | 98 | return d->mIsOpen; |
99 | } | 99 | } |
100 | 100 | ||
101 | void Resource::close() | 101 | void Resource::close() |
102 | { | 102 | { |
103 | #ifdef QT_THREAD_SUPPORT | 103 | #ifdef QT_THREAD_SUPPORT |
104 | QMutexLocker guard( &(d->mMutex) ); | 104 | QMutexLocker guard( &(d->mMutex) ); |
105 | #endif | 105 | #endif |
106 | if ( !d->mOpenCount ) { | 106 | if ( !d->mOpenCount ) { |
107 | kdDebug(5650) << "ERROR: Resource " << resourceName() << " closed more times than previously opened" << endl; | 107 | kdDebug(5650) << "ERROR: Resource " << resourceName() << " closed more times than previously opened" << endl; |
108 | return; | 108 | return; |
109 | } | 109 | } |
110 | d->mOpenCount--; | 110 | d->mOpenCount--; |
111 | if ( !d->mOpenCount ) { | 111 | if ( !d->mOpenCount ) { |
112 | kdDebug(5650) << "Closing resource " << resourceName() << endl; | 112 | kdDebug(5650) << "Closing resource " << resourceName() << endl; |
113 | doClose(); | 113 | doClose(); |
114 | d->mIsOpen = false; | 114 | d->mIsOpen = false; |
115 | } else { | 115 | } else { |
116 | kdDebug(5650) << "Not yet closing resource " << resourceName() << ", open count = " << d->mOpenCount << endl; | 116 | kdDebug(5650) << "Not yet closing resource " << resourceName() << ", open count = " << d->mOpenCount << endl; |
117 | } | 117 | } |
118 | } | 118 | } |
119 | 119 | ||
120 | bool Resource::isOpen() const | 120 | bool Resource::isOpen() const |
121 | { | 121 | { |
122 | return d->mIsOpen; | 122 | return d->mIsOpen; |
123 | } | 123 | } |
124 | 124 | ||
125 | void Resource::setIdentifier( const QString& identifier ) | 125 | void Resource::setIdentifier( const QString& identifier ) |
126 | { | 126 | { |
127 | d->mIdentifier = identifier; | 127 | d->mIdentifier = identifier; |
128 | } | 128 | } |
129 | 129 | ||
130 | QString Resource::identifier() const | 130 | QString Resource::identifier() const |
131 | { | 131 | { |
132 | return d->mIdentifier; | 132 | return d->mIdentifier; |
133 | } | 133 | } |
134 | 134 | ||
135 | void Resource::setType( const QString& type ) | 135 | void Resource::setType( const QString& type ) |
136 | { | 136 | { |
137 | d->mType = type; | 137 | d->mType = type; |
138 | } | 138 | } |
139 | 139 | ||
140 | QString Resource::type() const | 140 | QString Resource::type() const |
141 | { | 141 | { |
142 | return d->mType; | 142 | return d->mType; |
143 | } | 143 | } |
144 | 144 | ||
145 | void Resource::setReadOnly( bool value ) | 145 | void Resource::setReadOnly( bool value ) |
146 | { | 146 | { |
147 | d->mReadOnly = value; | 147 | d->mReadOnly = value; |
148 | } | 148 | } |
149 | 149 | ||
150 | bool Resource::readOnly() const | 150 | bool Resource::readOnly() const |
151 | { | 151 | { |
152 | return d->mReadOnly; | 152 | return d->mReadOnly; |
153 | } | 153 | } |
154 | 154 | ||
155 | void Resource::setResourceName( const QString &name ) | 155 | void Resource::setResourceName( const QString &name ) |
156 | { | 156 | { |
157 | d->mName = name; | 157 | d->mName = name; |
158 | } | 158 | } |
159 | 159 | ||
160 | QString Resource::resourceName() const | 160 | QString Resource::resourceName() const |
161 | { | 161 | { |
162 | return d->mName; | 162 | return d->mName; |
163 | } | 163 | } |
164 | 164 | ||
165 | void Resource::setActive( bool value ) | 165 | void Resource::setActive( bool value ) |
166 | { | 166 | { |
167 | d->mActive = value; | 167 | d->mActive = value; |
168 | } | 168 | } |
169 | 169 | ||
170 | bool Resource::isActive() const | 170 | bool Resource::isActive() const |
171 | { | 171 | { |
172 | return d->mActive; | 172 | return d->mActive; |
173 | } | 173 | } |
174 | 174 | ||
175 | void Resource::dump() const | 175 | void Resource::dump() const |
176 | { | 176 | { |
177 | qDebug("Resource::dump() "); | ||
177 | kdDebug(5650) << "Resource:" << endl; | 178 | kdDebug(5650) << "Resource:" << endl; |
178 | kdDebug(5650) << " Name: " << d->mName << endl; | 179 | kdDebug(5650) << " Name: " << d->mName << endl; |
179 | kdDebug(5650) << " Identifier: " << d->mIdentifier << endl; | 180 | kdDebug(5650) << " Identifier: " << d->mIdentifier << endl; |
180 | kdDebug(5650) << " Type: " << d->mType << endl; | 181 | kdDebug(5650) << " Type: " << d->mType << endl; |
181 | kdDebug(5650) << " OpenCount: " << d->mOpenCount << endl; | 182 | kdDebug(5650) << " OpenCount: " << d->mOpenCount << endl; |
182 | kdDebug(5650) << " ReadOnly: " << ( d->mReadOnly ? "yes" : "no" ) << endl; | 183 | kdDebug(5650) << " ReadOnly: " << ( d->mReadOnly ? "yes" : "no" ) << endl; |
183 | kdDebug(5650) << " Active: " << ( d->mActive ? "yes" : "no" ) << endl; | 184 | kdDebug(5650) << " Active: " << ( d->mActive ? "yes" : "no" ) << endl; |
184 | kdDebug(5650) << " IsOpen: " << ( d->mIsOpen ? "yes" : "no" ) << endl; | 185 | kdDebug(5650) << " IsOpen: " << ( d->mIsOpen ? "yes" : "no" ) << endl; |
185 | } | 186 | } |