author | zautrix <zautrix> | 2005-10-27 10:34:56 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-10-27 10:34:56 (UTC) |
commit | 29c7448b3c54e8d579732d10f144e12f7167c3c3 (patch) (unidiff) | |
tree | ae613037eaa897d2f7bc084d0b9e6954c630d985 /kabc/plugins/olaccess/resourceolaccess.cpp | |
parent | eb83d8b5542de9ca0c421ad6aca2913b502bbe78 (diff) | |
download | kdepimpi-29c7448b3c54e8d579732d10f144e12f7167c3c3.zip kdepimpi-29c7448b3c54e8d579732d10f144e12f7167c3c3.tar.gz kdepimpi-29c7448b3c54e8d579732d10f144e12f7167c3c3.tar.bz2 |
commit
Diffstat (limited to 'kabc/plugins/olaccess/resourceolaccess.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kabc/plugins/olaccess/resourceolaccess.cpp | 69 |
1 files changed, 35 insertions, 34 deletions
diff --git a/kabc/plugins/olaccess/resourceolaccess.cpp b/kabc/plugins/olaccess/resourceolaccess.cpp index e8f8bdd..7113e0e 100644 --- a/kabc/plugins/olaccess/resourceolaccess.cpp +++ b/kabc/plugins/olaccess/resourceolaccess.cpp | |||
@@ -27,7 +27,6 @@ $Id$ | |||
27 | 27 | ||
28 | #include <sys/types.h> | 28 | #include <sys/types.h> |
29 | #include <sys/stat.h> | 29 | #include <sys/stat.h> |
30 | #include <unistd.h> | ||
31 | 30 | ||
32 | #include <qdir.h> | 31 | #include <qdir.h> |
33 | #include <qfile.h> | 32 | #include <qfile.h> |
@@ -43,46 +42,45 @@ $Id$ | |||
43 | #include <kstandarddirs.h> | 42 | #include <kstandarddirs.h> |
44 | #include <kmessagebox.h> | 43 | #include <kmessagebox.h> |
45 | 44 | ||
46 | #include <sl/slzdb.h> | ||
47 | 45 | ||
48 | #include <libkdepim/ksyncprofile.h> | 46 | #include <libkdepim/ksyncprofile.h> |
49 | 47 | ||
50 | #include "resourcesharpdtmconfig.h" | 48 | #include "resourceolaccessconfig.h" |
51 | #include "resourcesharpdtm.h" | 49 | #include "resourceolaccess.h" |
52 | 50 | ||
53 | #include "stdaddressbook.h" | 51 | #include "stdaddressbook.h" |
54 | 52 | ||
55 | #include "sharpdtmconverter.h" | 53 | #include "olaccessconverter.h" |
56 | //#define ALLOW_LOCKING | 54 | //#define ALLOW_LOCKING |
57 | using namespace KABC; | 55 | using namespace KABC; |
58 | extern "C" | 56 | extern "C" |
59 | { | 57 | { |
60 | void *init_microkabc_sharpdtm() | 58 | void *init_microkabc_olaccess() |
61 | { | 59 | { |
62 | return new KRES::PluginFactory<ResourceSharpDTM,ResourceSharpDTMConfig>(); | 60 | return new KRES::PluginFactory<Resourceolaccess,ResourceolaccessConfig>(); |
63 | } | 61 | } |
64 | } | 62 | } |
65 | 63 | ||
66 | ResourceSharpDTM::ResourceSharpDTM( const KConfig *config ) | 64 | Resourceolaccess::Resourceolaccess( const KConfig *config ) |
67 | : Resource( config ), mConverter (0) | 65 | : Resource( config ), mConverter (0) |
68 | { | 66 | { |
69 | // we can not choose the filename. Therefore use the default to display | 67 | // we can not choose the filename. Therefore use the default to display |
70 | mAccess = 0; | 68 | //mAccess = 0; |
71 | QString fileName = SlZDataBase::addressbookFileName(); | 69 | QString fileName;// = SlZDataBase::addressbookFileName(); |
72 | init( fileName ); | 70 | init( fileName ); |
73 | } | 71 | } |
74 | 72 | ||
75 | ResourceSharpDTM::ResourceSharpDTM( const QString &fileName ) | 73 | Resourceolaccess::Resourceolaccess( const QString &fileName ) |
76 | : Resource( 0 ) | 74 | : Resource( 0 ) |
77 | { | 75 | { |
78 | mAccess = 0; | 76 | //mAccess = 0; |
79 | init( fileName ); | 77 | init( fileName ); |
80 | } | 78 | } |
81 | 79 | ||
82 | void ResourceSharpDTM::init( const QString &fileName ) | 80 | void Resourceolaccess::init( const QString &fileName ) |
83 | { | 81 | { |
84 | if (mConverter == 0) { | 82 | if (mConverter == 0) { |
85 | mConverter = new SharpDTMConverter(); | 83 | mConverter = new OlaccessConverter(); |
86 | bool res = mConverter->init(); | 84 | bool res = mConverter->init(); |
87 | if ( !res ) | 85 | if ( !res ) |
88 | { | 86 | { |
@@ -94,47 +92,48 @@ void ResourceSharpDTM::init( const QString &fileName ) | |||
94 | setFileName( fileName ); | 92 | setFileName( fileName ); |
95 | } | 93 | } |
96 | 94 | ||
97 | ResourceSharpDTM::~ResourceSharpDTM() | 95 | Resourceolaccess::~Resourceolaccess() |
98 | { | 96 | { |
99 | if (mConverter != 0) | 97 | if (mConverter != 0) |
100 | delete mConverter; | 98 | delete mConverter; |
101 | 99 | ||
102 | if(mAccess != 0) | 100 | //if(mAccess != 0) |
103 | delete mAccess; | 101 | //delete mAccess; |
104 | } | 102 | } |
105 | 103 | ||
106 | void ResourceSharpDTM::writeConfig( KConfig *config ) | 104 | void Resourceolaccess::writeConfig( KConfig *config ) |
107 | { | 105 | { |
108 | Resource::writeConfig( config ); | 106 | Resource::writeConfig( config ); |
109 | } | 107 | } |
110 | 108 | ||
111 | Ticket *ResourceSharpDTM::requestSaveTicket() | 109 | Ticket *Resourceolaccess::requestSaveTicket() |
112 | { | 110 | { |
113 | 111 | ||
114 | qDebug("ResourceSharpDTM::requestSaveTicket: %s", fileName().latin1()); | 112 | qDebug("Resourceolaccess::requestSaveTicket: %s", fileName().latin1()); |
115 | 113 | ||
116 | if ( !addressBook() ) return 0; | 114 | if ( !addressBook() ) return 0; |
117 | return createTicket( this ); | 115 | return createTicket( this ); |
118 | } | 116 | } |
119 | 117 | ||
120 | 118 | ||
121 | bool ResourceSharpDTM::doOpen() | 119 | bool Resourceolaccess::doOpen() |
122 | { | 120 | { |
123 | if (!mConverter) | 121 | if (!mConverter) |
124 | return false; | 122 | return false; |
125 | return true; | 123 | return true; |
126 | } | 124 | } |
127 | 125 | ||
128 | void ResourceSharpDTM::doClose() | 126 | void Resourceolaccess::doClose() |
129 | { | 127 | { |
130 | return; | 128 | return; |
131 | } | 129 | } |
132 | 130 | ||
133 | bool ResourceSharpDTM::load() | 131 | bool Resourceolaccess::load() |
134 | { | 132 | { |
135 | if (!mConverter) | 133 | if (!mConverter) |
136 | return false; | 134 | return false; |
137 | QString fileN = SlZDataBase::addressbookFileName(); | 135 | QString fileN ;//= SlZDataBase::addressbookFileName(); |
136 | #if 0 | ||
138 | if ( ! mAccess ) { | 137 | if ( ! mAccess ) { |
139 | mAccess = new SlZDataBase(fileN, | 138 | mAccess = new SlZDataBase(fileN, |
140 | SlZDataBase::addressbookItems(), | 139 | SlZDataBase::addressbookItems(), |
@@ -143,7 +142,7 @@ bool ResourceSharpDTM::load() | |||
143 | if(mAccess == 0) | 142 | if(mAccess == 0) |
144 | return false; | 143 | return false; |
145 | 144 | ||
146 | qDebug("ResourceSharpDTM:: %x load: %s",this, fileName().latin1()); | 145 | qDebug("Resourceolaccess:: %x load: %s",this, fileName().latin1()); |
147 | bool res = false; | 146 | bool res = false; |
148 | CardId id; | 147 | CardId id; |
149 | for (bool res=mAccess->first(); res == true; res=mAccess->next()) | 148 | for (bool res=mAccess->first(); res == true; res=mAccess->next()) |
@@ -160,12 +159,13 @@ bool ResourceSharpDTM::load() | |||
160 | if(mAccess != 0) | 159 | if(mAccess != 0) |
161 | delete mAccess; | 160 | delete mAccess; |
162 | mAccess = 0; | 161 | mAccess = 0; |
163 | 162 | #endif | |
164 | return true; | 163 | return true; |
165 | } | 164 | } |
166 | 165 | ||
167 | bool ResourceSharpDTM::save( Ticket *ticket ) | 166 | bool Resourceolaccess::save( Ticket *ticket ) |
168 | { | 167 | { |
168 | #if 0 | ||
169 | if (!mConverter) | 169 | if (!mConverter) |
170 | return false; | 170 | return false; |
171 | QString fileN = SlZDataBase::addressbookFileName(); | 171 | QString fileN = SlZDataBase::addressbookFileName(); |
@@ -176,7 +176,7 @@ bool ResourceSharpDTM::save( Ticket *ticket ) | |||
176 | } | 176 | } |
177 | if(mAccess == 0) | 177 | if(mAccess == 0) |
178 | return false; | 178 | return false; |
179 | qDebug("ResourceSharpDTM::save: %s", fileName().latin1()); | 179 | qDebug("Resourceolaccess::save: %s", fileName().latin1()); |
180 | KABC::AddressBook::Iterator it; | 180 | KABC::AddressBook::Iterator it; |
181 | bool res; | 181 | bool res; |
182 | KABC::Addressee::List changedAddressees; | 182 | KABC::Addressee::List changedAddressees; |
@@ -267,34 +267,35 @@ bool ResourceSharpDTM::save( Ticket *ticket ) | |||
267 | if(mAccess != 0) | 267 | if(mAccess != 0) |
268 | delete mAccess; | 268 | delete mAccess; |
269 | mAccess = 0; | 269 | mAccess = 0; |
270 | #endif | ||
270 | return true; | 271 | return true; |
271 | } | 272 | } |
272 | 273 | ||
273 | bool ResourceSharpDTM::lock( const QString &lockfileName ) | 274 | bool Resourceolaccess::lock( const QString &lockfileName ) |
274 | { | 275 | { |
275 | return true; | 276 | return true; |
276 | } | 277 | } |
277 | 278 | ||
278 | void ResourceSharpDTM::unlock( const QString &fileName ) | 279 | void Resourceolaccess::unlock( const QString &fileName ) |
279 | { | 280 | { |
280 | 281 | ||
281 | } | 282 | } |
282 | 283 | ||
283 | void ResourceSharpDTM::setFileName( const QString &newFileName ) | 284 | void Resourceolaccess::setFileName( const QString &newFileName ) |
284 | { | 285 | { |
285 | Resource::setFileName( newFileName ); | 286 | Resource::setFileName( newFileName ); |
286 | } | 287 | } |
287 | 288 | ||
288 | void ResourceSharpDTM::fileChanged() | 289 | void Resourceolaccess::fileChanged() |
289 | { | 290 | { |
290 | 291 | ||
291 | } | 292 | } |
292 | 293 | ||
293 | void ResourceSharpDTM::removeAddressee( const Addressee &addr ) | 294 | void Resourceolaccess::removeAddressee( const Addressee &addr ) |
294 | { | 295 | { |
295 | } | 296 | } |
296 | 297 | ||
297 | void ResourceSharpDTM::cleanUp() | 298 | void Resourceolaccess::cleanUp() |
298 | { | 299 | { |
299 | 300 | ||
300 | } | 301 | } |