Diffstat (limited to 'kabc/plugins/sharpdtm/resourcesharpdtm.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | kabc/plugins/sharpdtm/resourcesharpdtm.cpp | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp index 31b99ca..7b909de 100644 --- a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp +++ b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp | |||
@@ -1,9 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2004 Ulf Schenk |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
@@ -59,23 +59,23 @@ extern "C" | |||
59 | void *init_microkabc_sharpdtm() | 59 | void *init_microkabc_sharpdtm() |
60 | { | 60 | { |
61 | return new KRES::PluginFactory<ResourceSharpDTM,ResourceSharpDTMConfig>(); | 61 | return new KRES::PluginFactory<ResourceSharpDTM,ResourceSharpDTMConfig>(); |
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
65 | ResourceSharpDTM::ResourceSharpDTM( const KConfig *config ) | 65 | ResourceSharpDTM::ResourceSharpDTM( const KConfig *config, bool syncable ) |
66 | : Resource( config ), mConverter (0) | 66 | : Resource( config, syncable ), mConverter (0) |
67 | { | 67 | { |
68 | // we can not choose the filename. Therefore use the default to display | 68 | // we can not choose the filename. Therefore use the default to display |
69 | 69 | ||
70 | QString fileName = SlZDataBase::addressbookFileName(); | 70 | QString fileName = SlZDataBase::addressbookFileName(); |
71 | init( fileName ); | 71 | init( fileName ); |
72 | } | 72 | } |
73 | 73 | ||
74 | ResourceSharpDTM::ResourceSharpDTM( const QString &fileName ) | 74 | ResourceSharpDTM::ResourceSharpDTM( const QString &fileName, bool syncable ) |
75 | : Resource( 0 ) | 75 | : Resource( 0, syncable ) |
76 | { | 76 | { |
77 | // qDebug("ResourceFile::ResourceSharpDTM : 3 %s, %s", fileName.latin1(), formatName.latin1()); | 77 | // qDebug("ResourceFile::ResourceSharpDTM : 3 %s, %s", fileName.latin1(), formatName.latin1()); |
78 | init( fileName ); | 78 | init( fileName ); |
79 | } | 79 | } |
80 | 80 | ||
81 | void ResourceSharpDTM::init( const QString &fileName ) | 81 | void ResourceSharpDTM::init( const QString &fileName ) |
@@ -352,6 +352,31 @@ void ResourceSharpDTM::removeAddressee( const Addressee &addr ) | |||
352 | 352 | ||
353 | void ResourceSharpDTM::cleanUp() | 353 | void ResourceSharpDTM::cleanUp() |
354 | { | 354 | { |
355 | unlock( mFileName ); | 355 | unlock( mFileName ); |
356 | } | 356 | } |
357 | 357 | ||
358 | /** | ||
359 | * This method returns the number of elements that are currently in the resource. | ||
360 | */ | ||
361 | int ResourceSharpDTM::count() const | ||
362 | { | ||
363 | if (mAccess != 0) | ||
364 | return mAccess->count(); | ||
365 | else | ||
366 | return 0; | ||
367 | } | ||
368 | |||
369 | |||
370 | /** | ||
371 | * This method removes all elements from the resource!! (Not from the addressbook) | ||
372 | */ | ||
373 | bool ResourceSharpDTM::clear() | ||
374 | { | ||
375 | if (mAccess != 0) | ||
376 | return mAccess->deleteCard(0, SlZDataBase::AllCard ); | ||
377 | else | ||
378 | return false; | ||
379 | } | ||
380 | |||
381 | |||
382 | |||