summaryrefslogtreecommitdiffabout
path: root/kabc
Unidiff
Diffstat (limited to 'kabc') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/distributionlist.cpp5
-rw-r--r--kabc/distributionlist.h2
-rw-r--r--kabc/kabc.pro2
-rw-r--r--kabc/kabcE.pro2
-rw-r--r--kabc/plugins/dir/dir.pro4
-rw-r--r--kabc/plugins/dir/dirE.pro2
-rw-r--r--kabc/plugins/dir/resourcedir.cpp9
-rw-r--r--kabc/plugins/file/file.pro4
-rw-r--r--kabc/plugins/file/fileE.pro2
-rw-r--r--kabc/plugins/file/resourcefile.cpp14
-rw-r--r--kabc/plugins/opie/opieE.pro2
11 files changed, 16 insertions, 32 deletions
diff --git a/kabc/distributionlist.cpp b/kabc/distributionlist.cpp
index 0735aba..1fb186e 100644
--- a/kabc/distributionlist.cpp
+++ b/kabc/distributionlist.cpp
@@ -237,59 +237,56 @@ bool DistributionListManager::save()
237 if (( *it).email.isEmpty()) 237 if (( *it).email.isEmpty())
238 value.append( " " ); 238 value.append( " " );
239 else 239 else
240 value.append( (*it).email ); 240 value.append( (*it).email );
241 // qDebug("uid *%s* email *%s* ", (*it).addressee.uid().latin1(),(*it).email.latin1() ); 241 // qDebug("uid *%s* email *%s* ", (*it).addressee.uid().latin1(),(*it).email.latin1() );
242 } 242 }
243 cfg.writeEntry( list->name(), value ); 243 cfg.writeEntry( list->name(), value );
244 } 244 }
245 245
246//US for microKDE we have not yet sophisticated methods to load maps. 246//US for microKDE we have not yet sophisticated methods to load maps.
247// Because of that we store also a list of all distributionlists. 247// Because of that we store also a list of all distributionlists.
248 QStringList namelist; 248 QStringList namelist;
249 for( list = mLists.first(); list; list = mLists.next() ) { 249 for( list = mLists.first(); list; list = mLists.next() ) {
250 namelist.append( list->name() ); 250 namelist.append( list->name() );
251 } 251 }
252 cfg.writeEntry( "__Lists__List__", namelist ); 252 cfg.writeEntry( "__Lists__List__", namelist );
253 253
254 254
255 255
256 256
257 257
258 258
259 cfg.sync(); 259 cfg.sync();
260 260
261 return true; 261 return true;
262} 262}
263 263
264DistributionListWatcher* DistributionListWatcher::mSelf = 0; 264DistributionListWatcher* DistributionListWatcher::mSelf = 0;
265 265
266DistributionListWatcher::DistributionListWatcher() 266DistributionListWatcher::DistributionListWatcher()
267 : QObject( 0, "DistributionListWatcher" ) 267 : QObject( 0, "DistributionListWatcher" )
268{ 268{
269/*US 269
270 mDirWatch = new KDirWatch; 270 mDirWatch = new KDirWatch;
271 mDirWatch->addFile( locateLocal( "data", "kabc/distlists" ) ); 271 mDirWatch->addFile( locateLocal( "data", "kabc/distlists" ) );
272 272
273 connect( mDirWatch, SIGNAL( dirty( const QString& ) ), SIGNAL( changed() ) ); 273 connect( mDirWatch, SIGNAL( dirty( const QString& ) ), SIGNAL( changed() ) );
274 mDirWatch->startScan(); 274 mDirWatch->startScan();
275*/
276} 275}
277 276
278DistributionListWatcher::~DistributionListWatcher() 277DistributionListWatcher::~DistributionListWatcher()
279{ 278{
280/*US
281 delete mDirWatch; 279 delete mDirWatch;
282 mDirWatch = 0; 280 mDirWatch = 0;
283*/
284} 281}
285 282
286DistributionListWatcher *DistributionListWatcher::self() 283DistributionListWatcher *DistributionListWatcher::self()
287{ 284{
288 if ( !mSelf ) 285 if ( !mSelf )
289 mSelf = new DistributionListWatcher(); 286 mSelf = new DistributionListWatcher();
290 287
291 return mSelf; 288 return mSelf;
292} 289}
293 290
294//US #include "distributionlist.moc" 291//US #include "distributionlist.moc"
295 292
diff --git a/kabc/distributionlist.h b/kabc/distributionlist.h
index 5f091b1..584f287 100644
--- a/kabc/distributionlist.h
+++ b/kabc/distributionlist.h
@@ -181,37 +181,37 @@ class DistributionListManager
181 <pre> 181 <pre>
182 KABC::DistributionListWatcher *watchdog = KABC::DistributionListWatcher::self() 182 KABC::DistributionListWatcher *watchdog = KABC::DistributionListWatcher::self()
183 183
184 connect( watchdog, SIGNAL( changed() ), SLOT( doSomething() ) ); 184 connect( watchdog, SIGNAL( changed() ), SLOT( doSomething() ) );
185 </pre> 185 </pre>
186*/ 186*/
187 187
188class DistributionListWatcher : public QObject 188class DistributionListWatcher : public QObject
189{ 189{
190 Q_OBJECT 190 Q_OBJECT
191 191
192 public: 192 public:
193 /** 193 /**
194 * Returns the watcher object. 194 * Returns the watcher object.
195 */ 195 */
196 static DistributionListWatcher *self(); 196 static DistributionListWatcher *self();
197 197
198 198
199 signals: 199 signals:
200 /** 200 /**
201 * This signal is emmitted whenever the distribution lists has 201 * This signal is emmitted whenever the distribution lists has
202 * changed (if a list was added or removed, when a list was 202 * changed (if a list was added or removed, when a list was
203 * renamed or the entries of the list changed). 203 * renamed or the entries of the list changed).
204 */ 204 */
205 void changed(); 205 void changed();
206 206
207 protected: 207 protected:
208 DistributionListWatcher(); 208 DistributionListWatcher();
209 ~DistributionListWatcher(); 209 ~DistributionListWatcher();
210 210
211 private: 211 private:
212 static DistributionListWatcher* mSelf; 212 static DistributionListWatcher* mSelf;
213//US KDirWatch *mDirWatch; 213 KDirWatch *mDirWatch;
214}; 214};
215 215
216} 216}
217#endif 217#endif
diff --git a/kabc/kabc.pro b/kabc/kabc.pro
index 4a8d73a..a8cd695 100644
--- a/kabc/kabc.pro
+++ b/kabc/kabc.pro
@@ -1,42 +1,42 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2CONFIG += qt warn_on 2CONFIG += qt warn_on
3#release debug 3#release debug
4DESTDIR=../bin 4DESTDIR=../bin
5 5
6TARGET = microkabc 6TARGET = microkabc
7 7
8include( ../variables.pri ) 8include( ../variables.pri )
9 9
10INCLUDEPATH += . ./vcard/include ./vcard/include/generated ../microkde ../microkde/kdecore ../microkde/kio/kfile ../qtcompat ../microkde/kdeui 10INCLUDEPATH += . ./vcard/include ./vcard/include/generated ../microkde ../microkde/kdecore ../microkde/kio/kfile ../microkde/kio/kio ../qtcompat ../microkde/kdeui
11 11
12#LIBS += -lmicrokde -lldap 12#LIBS += -lmicrokde -lldap
13LIBS += -L$(QPEDIR)/lib 13LIBS += -L$(QPEDIR)/lib
14DEFINES += KAB_EMBEDDED DESKTOP_VERSION 14DEFINES += KAB_EMBEDDED DESKTOP_VERSION
15unix : { 15unix : {
16 16
17OBJECTS_DIR = obj/unix 17OBJECTS_DIR = obj/unix
18MOC_DIR = moc/unix 18MOC_DIR = moc/unix
19} 19}
20win32: { 20win32: {
21DEFINES += _WIN32_ 21DEFINES += _WIN32_
22OBJECTS_DIR = obj/win 22OBJECTS_DIR = obj/win
23MOC_DIR = moc/win 23MOC_DIR = moc/win
24} 24}
25INTERFACES = \ 25INTERFACES = \
26 26
27 27
28HEADERS = \ 28HEADERS = \
29 resource.h \ 29 resource.h \
30 stdaddressbook.h \ 30 stdaddressbook.h \
31 agent.h \ 31 agent.h \
32 geo.h \ 32 geo.h \
33 key.h \ 33 key.h \
34 field.h \ 34 field.h \
35 plugin.h \ 35 plugin.h \
36 address.h \ 36 address.h \
37 addresseelist.h \ 37 addresseelist.h \
38formatfactory.h \ 38formatfactory.h \
39 formatplugin.h \ 39 formatplugin.h \
40 phonenumber.h \ 40 phonenumber.h \
41distributionlist.h \ 41distributionlist.h \
42distributionlistdialog.h \ 42distributionlistdialog.h \
diff --git a/kabc/kabcE.pro b/kabc/kabcE.pro
index 840afb9..bc1c0ed 100644
--- a/kabc/kabcE.pro
+++ b/kabc/kabcE.pro
@@ -1,38 +1,38 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2CONFIG += qt warn_on 2CONFIG += qt warn_on
3TARGET = microkabc 3TARGET = microkabc
4 4
5 5
6INCLUDEPATH += . ./vcard/include ./vcard/include/generated ../microkde ../microkde/kdecore ../microkde/kdeui ../microkde/kio/kfile ../qtcompat $(QPEDIR)/include 6INCLUDEPATH += . ./vcard/include ./vcard/include/generated ../microkde ../microkde/kdecore ../microkde/kdeui ../microkde/kio/kfile ../microkde/kio/kio ../qtcompat $(QPEDIR)/include
7OBJECTS_DIR = obj/$(PLATFORM) 7OBJECTS_DIR = obj/$(PLATFORM)
8MOC_DIR = moc/$(PLATFORM) 8MOC_DIR = moc/$(PLATFORM)
9DESTDIR = $(QPEDIR)/lib 9DESTDIR = $(QPEDIR)/lib
10LIBS += -lmicrokde 10LIBS += -lmicrokde
11#LIBS += -lldap 11#LIBS += -lldap
12LIBS += -L$(QPEDIR)/lib 12LIBS += -L$(QPEDIR)/lib
13DEFINES += KAB_EMBEDDED 13DEFINES += KAB_EMBEDDED
14 14
15INTERFACES = \ 15INTERFACES = \
16 16
17HEADERS = \ 17HEADERS = \
18 address.h \ 18 address.h \
19 addressbook.h \ 19 addressbook.h \
20 addressee.h \ 20 addressee.h \
21 addresseedialog.h \ 21 addresseedialog.h \
22 addresseelist.h \ 22 addresseelist.h \
23 agent.h \ 23 agent.h \
24 distributionlist.h \ 24 distributionlist.h \
25 distributionlistdialog.h \ 25 distributionlistdialog.h \
26 distributionlisteditor.h \ 26 distributionlisteditor.h \
27 field.h \ 27 field.h \
28 formatfactory.h \ 28 formatfactory.h \
29 formatplugin.h \ 29 formatplugin.h \
30 geo.h \ 30 geo.h \
31 key.h \ 31 key.h \
32 phonenumber.h \ 32 phonenumber.h \
33 picture.h \ 33 picture.h \
34 plugin.h \ 34 plugin.h \
35 resource.h \ 35 resource.h \
36 secrecy.h \ 36 secrecy.h \
37 sound.h \ 37 sound.h \
38 stdaddressbook.h \ 38 stdaddressbook.h \
diff --git a/kabc/plugins/dir/dir.pro b/kabc/plugins/dir/dir.pro
index 0023029..0555484 100644
--- a/kabc/plugins/dir/dir.pro
+++ b/kabc/plugins/dir/dir.pro
@@ -1,34 +1,34 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release
3#release debug 3#release debug
4 4
5TARGET = microkabc_dir 5TARGET = microkabc_dir
6INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../qtcompat 6INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kio/kio ../../../qtcompat
7DESTDIR = ../../../bin 7DESTDIR = ../../../bin
8#LIBS += -lmicrokde -lmicrokabc 8#LIBS += -lmicrokde -lmicrokabc
9#LIBS += -L$(QPEDIR)/lib 9#LIBS += -L$(QPEDIR)/lib
10 10
11INTERFACES = \ 11INTERFACES = \
12 12
13HEADERS = \ 13HEADERS = \
14 resourcedir.h \ 14 resourcedir.h \
15 resourcedirconfig.h 15 resourcedirconfig.h
16 16
17SOURCES = \ 17SOURCES = \
18 resourcedir.cpp \ 18 resourcedir.cpp \
19 resourcedirconfig.cpp 19 resourcedirconfig.cpp
20 20
21unix : { 21unix : {
22OBJECTS_DIR = obj/unix 22OBJECTS_DIR = obj/unix
23MOC_DIR = moc/unix 23MOC_DIR = moc/unix
24} 24}
25win32: { 25win32: {
26CONFIG += dll 26CONFIG += dll
27DEFINES += _WIN32_ 27DEFINES += _WIN32_
28OBJECTS_DIR = obj/win 28OBJECTS_DIR = obj/win
29MOC_DIR = moc/win 29MOC_DIR = moc/win
30LIBS += ../../../bin/microkdepim.lib 30LIBS += ../../../bin/microkdepim.lib
31LIBS += ../../../bin/microkcal.lib 31LIBS += ../../../bin/microkcal.lib
32LIBS += ../../../bin/microkde.lib 32LIBS += ../../../bin/microkde.lib
33LIBS += ../../../bin/microkabc.lib 33LIBS += ../../../bin/microkabc.lib
34} \ No newline at end of file 34}
diff --git a/kabc/plugins/dir/dirE.pro b/kabc/plugins/dir/dirE.pro
index aceb28a..729f4ce 100644
--- a/kabc/plugins/dir/dirE.pro
+++ b/kabc/plugins/dir/dirE.pro
@@ -1,21 +1,21 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release
3#release debug 3#release debug
4 4
5TARGET = microkabc_dir 5TARGET = microkabc_dir
6INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../qtcompat 6INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kio/kio ../../../qtcompat
7OBJECTS_DIR = obj/$(PLATFORM) 7OBJECTS_DIR = obj/$(PLATFORM)
8MOC_DIR = moc/$(PLATFORM) 8MOC_DIR = moc/$(PLATFORM)
9DESTDIR = $(QPEDIR)/lib 9DESTDIR = $(QPEDIR)/lib
10LIBS += -lmicrokde -lmicrokabc 10LIBS += -lmicrokde -lmicrokabc
11LIBS += -L$(QPEDIR)/lib 11LIBS += -L$(QPEDIR)/lib
12 12
13INTERFACES = \ 13INTERFACES = \
14 14
15HEADERS = \ 15HEADERS = \
16 resourcedir.h \ 16 resourcedir.h \
17 resourcedirconfig.h 17 resourcedirconfig.h
18 18
19SOURCES = \ 19SOURCES = \
20 resourcedir.cpp \ 20 resourcedir.cpp \
21 resourcedirconfig.cpp 21 resourcedirconfig.cpp
diff --git a/kabc/plugins/dir/resourcedir.cpp b/kabc/plugins/dir/resourcedir.cpp
index 3cb5179..7825c6f 100644
--- a/kabc/plugins/dir/resourcedir.cpp
+++ b/kabc/plugins/dir/resourcedir.cpp
@@ -83,69 +83,67 @@ ResourceDir::ResourceDir( const KConfig *config )
83 QString path; 83 QString path;
84 84
85 KConfig *cfg = (KConfig *)config; 85 KConfig *cfg = (KConfig *)config;
86 if ( cfg ) { 86 if ( cfg ) {
87//US path = config->readEntry( "FilePath" ); 87//US path = config->readEntry( "FilePath" );
88 path = cfg->readEntry( "FilePath", StdAddressBook::directoryName() ); 88 path = cfg->readEntry( "FilePath", StdAddressBook::directoryName() );
89//US mFormatName = config->readEntry( "FileFormat" ); 89//US mFormatName = config->readEntry( "FileFormat" );
90 mFormatName = cfg->readEntry( "FileFormat", "vcard" ); 90 mFormatName = cfg->readEntry( "FileFormat", "vcard" );
91 } else { 91 } else {
92 path = StdAddressBook::directoryName(); 92 path = StdAddressBook::directoryName();
93 mFormatName = "vcard"; 93 mFormatName = "vcard";
94 } 94 }
95 95
96 96
97 FormatFactory *factory = FormatFactory::self(); 97 FormatFactory *factory = FormatFactory::self();
98 mFormat = factory->format( mFormatName ); 98 mFormat = factory->format( mFormatName );
99 99
100 if ( !mFormat ) { 100 if ( !mFormat ) {
101 mFormatName = "vcard"; 101 mFormatName = "vcard";
102 mFormat = factory->format( mFormatName ); 102 mFormat = factory->format( mFormatName );
103 } 103 }
104 104
105/*US 105/*US
106//US qDebug("ResourceDir::ResourceDir initialized with format %s ", mFormatName.latin1()); 106//US qDebug("ResourceDir::ResourceDir initialized with format %s ", mFormatName.latin1());
107 if (mFormatName == "vcard") 107 if (mFormatName == "vcard")
108 mFormat = new VCardFormatPlugin2(); 108 mFormat = new VCardFormatPlugin2();
109 else if (mFormatName == "binary") 109 else if (mFormatName == "binary")
110 mFormat = new BinaryFormat(); 110 mFormat = new BinaryFormat();
111 else 111 else
112 qDebug("ResourceFile::init format unknown !!! %s ", mFormatName.latin1()); 112 qDebug("ResourceFile::init format unknown !!! %s ", mFormatName.latin1());
113*/ 113*/
114 114
115/*US we have no KDirWatch. SO simulate the signals from inside the apropriate methods
116 connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( pathChanged() ) ); 115 connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( pathChanged() ) );
117 connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( pathChanged() ) ); 116 connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( pathChanged() ) );
118 connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( pathChanged() ) ); 117 connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( pathChanged() ) );
119*/
120 118
121 setPath( path ); 119 setPath( path );
122} 120}
123 121
124ResourceDir::~ResourceDir() 122ResourceDir::~ResourceDir()
125{ 123{
126 delete mFormat; 124 delete mFormat;
127 mFormat = 0; 125 mFormat = 0;
128} 126}
129 127
130void ResourceDir::writeConfig( KConfig *config ) 128void ResourceDir::writeConfig( KConfig *config )
131{ 129{
132 config->setGroup( "Resource_" + identifier() ); 130 config->setGroup( "Resource_" + identifier() );
133 Resource::writeConfig( config ); 131 Resource::writeConfig( config );
134 132
135 config->writeEntry( "FilePath", mPath ); 133 config->writeEntry( "FilePath", mPath );
136 config->writeEntry( "FileFormat", mFormatName ); 134 config->writeEntry( "FileFormat", mFormatName );
137} 135}
138 136
139Ticket *ResourceDir::requestSaveTicket() 137Ticket *ResourceDir::requestSaveTicket()
140{ 138{
141 kdDebug(5700) << "ResourceDir::requestSaveTicket()" << endl; 139 kdDebug(5700) << "ResourceDir::requestSaveTicket()" << endl;
142 140
143 if ( !addressBook() ) return 0; 141 if ( !addressBook() ) return 0;
144 142
145 if ( !lock( mPath ) ) { 143 if ( !lock( mPath ) ) {
146 kdDebug(5700) << "ResourceDir::requestSaveTicket(): Unable to lock path '" 144 kdDebug(5700) << "ResourceDir::requestSaveTicket(): Unable to lock path '"
147 << mPath << "'" << endl; 145 << mPath << "'" << endl;
148 return 0; 146 return 0;
149 } 147 }
150 return createTicket( this ); 148 return createTicket( this );
151} 149}
@@ -269,77 +267,74 @@ bool ResourceDir::lock( const QString &path )
269 // Create lock file 267 // Create lock file
270 int result = 0; 268 int result = 0;
271#ifndef _WIN32_ 269#ifndef _WIN32_
272 result = ::link( QFile::encodeName( mLockUniqueName ), 270 result = ::link( QFile::encodeName( mLockUniqueName ),
273 QFile::encodeName( lockName ) ); 271 QFile::encodeName( lockName ) );
274#endif 272#endif
275 if ( result == 0 ) { 273 if ( result == 0 ) {
276 addressBook()->emitAddressBookLocked(); 274 addressBook()->emitAddressBookLocked();
277 return true; 275 return true;
278 } 276 }
279 277
280 // TODO: check stat 278 // TODO: check stat
281 279
282 return false; 280 return false;
283} 281}
284 282
285void ResourceDir::unlock( const QString &path ) 283void ResourceDir::unlock( const QString &path )
286{ 284{
287 QString p = path; 285 QString p = path;
288//US change the implementation how the lockfilename is getting created 286//US change the implementation how the lockfilename is getting created
289//US p.replace( QRegExp( "/" ), "_" ); 287//US p.replace( QRegExp( "/" ), "_" );
290//US QString lockName = locate( "data", "kabc/lock/" + p + ".lock" ); 288//US QString lockName = locate( "data", "kabc/lock/" + p + ".lock" );
291 KURL url(p); 289 KURL url(p);
292 QString lockName = locate( "data", "kabc/lock/" + url.fileName() + ".lock" ); 290 QString lockName = locate( "data", "kabc/lock/" + url.fileName() + ".lock" );
293 291
294 ::unlink( QFile::encodeName( lockName ) ); 292 ::unlink( QFile::encodeName( lockName ) );
295 QFile::remove( mLockUniqueName ); 293 QFile::remove( mLockUniqueName );
296 addressBook()->emitAddressBookUnlocked(); 294 addressBook()->emitAddressBookUnlocked();
297} 295}
298 296
299void ResourceDir::setPath( const QString &path ) 297void ResourceDir::setPath( const QString &path )
300{ 298{
301/*US ToDo: no synchronization so far. Has to be changed in the future
302 mDirWatch.stopScan(); 299 mDirWatch.stopScan();
303 mDirWatch.removeDir( mPath ); 300 mDirWatch.removeDir( mPath );
304*/ 301
305 mPath = path; 302 mPath = path;
306 303
307/*US ToDo: no synchronization so far. Has to be changed in the future
308 mDirWatch.addDir( mPath, true ); 304 mDirWatch.addDir( mPath, true );
309 mDirWatch.startScan(); 305 mDirWatch.startScan();
310*/
311 306
312//US simulate KDirWatch event 307//US simulate KDirWatch event
313 pathChanged(); 308//US pathChanged();
314 309
315} 310}
316 311
317QString ResourceDir::path() const 312QString ResourceDir::path() const
318{ 313{
319 return mPath; 314 return mPath;
320} 315}
321 316
322void ResourceDir::setFormat( const QString &format ) 317void ResourceDir::setFormat( const QString &format )
323{ 318{
324 mFormatName = format; 319 mFormatName = format;
325 320
326 if ( mFormat ) 321 if ( mFormat )
327 delete mFormat; 322 delete mFormat;
328 323
329 FormatFactory *factory = FormatFactory::self(); 324 FormatFactory *factory = FormatFactory::self();
330 mFormat = factory->format( mFormatName ); 325 mFormat = factory->format( mFormatName );
331/*US 326/*US
332qDebug("ResourceDir::setFormat initialized with format %s ", format.latin1()); 327qDebug("ResourceDir::setFormat initialized with format %s ", format.latin1());
333 if (mFormatName == "vcard") 328 if (mFormatName == "vcard")
334 mFormat = new VCardFormatPlugin2(); 329 mFormat = new VCardFormatPlugin2();
335 else if (mFormatName == "binary") 330 else if (mFormatName == "binary")
336 mFormat = new BinaryFormat(); 331 mFormat = new BinaryFormat();
337 else 332 else
338 qDebug("ResourceDir::setFormat format unknown !!! %s ", format.latin1()); 333 qDebug("ResourceDir::setFormat format unknown !!! %s ", format.latin1());
339*/ 334*/
340 335
341} 336}
342 337
343QString ResourceDir::format() const 338QString ResourceDir::format() const
344{ 339{
345 return mFormatName; 340 return mFormatName;
diff --git a/kabc/plugins/file/file.pro b/kabc/plugins/file/file.pro
index 7cf7c58..32555a2 100644
--- a/kabc/plugins/file/file.pro
+++ b/kabc/plugins/file/file.pro
@@ -1,35 +1,35 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release
3#release debug 3#release debug
4 4
5TARGET = microkabc_file 5TARGET = microkabc_file
6INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../qtcompat 6INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kio/kio ../../../qtcompat
7 7
8DESTDIR = ../../../bin 8DESTDIR = ../../../bin
9#LIBS += -lmicrokde -lmicrokabc 9#LIBS += -lmicrokde -lmicrokabc
10#LIBS += -L$(QPEDIR)/lib 10#LIBS += -L$(QPEDIR)/lib
11 11
12INTERFACES = \ 12INTERFACES = \
13 13
14HEADERS = \ 14HEADERS = \
15 resourcefile.h \ 15 resourcefile.h \
16 resourcefileconfig.h 16 resourcefileconfig.h
17 17
18SOURCES = \ 18SOURCES = \
19 resourcefile.cpp \ 19 resourcefile.cpp \
20 resourcefileconfig.cpp 20 resourcefileconfig.cpp
21 21
22unix : { 22unix : {
23OBJECTS_DIR = obj/unix 23OBJECTS_DIR = obj/unix
24MOC_DIR = moc/unix 24MOC_DIR = moc/unix
25} 25}
26win32: { 26win32: {
27CONFIG += dll 27CONFIG += dll
28DEFINES += _WIN32_ 28DEFINES += _WIN32_
29OBJECTS_DIR = obj/win 29OBJECTS_DIR = obj/win
30MOC_DIR = moc/win 30MOC_DIR = moc/win
31LIBS += ../../../bin/microkdepim.lib 31LIBS += ../../../bin/microkdepim.lib
32LIBS += ../../../bin/microkcal.lib 32LIBS += ../../../bin/microkcal.lib
33LIBS += ../../../bin/microkde.lib 33LIBS += ../../../bin/microkde.lib
34LIBS += ../../../bin/microkabc.lib 34LIBS += ../../../bin/microkabc.lib
35} \ No newline at end of file 35}
diff --git a/kabc/plugins/file/fileE.pro b/kabc/plugins/file/fileE.pro
index 2d17a8f..d19a26d 100644
--- a/kabc/plugins/file/fileE.pro
+++ b/kabc/plugins/file/fileE.pro
@@ -1,21 +1,21 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release
3#release debug 3#release debug
4 4
5TARGET = microkabc_file 5TARGET = microkabc_file
6INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../qtcompat 6INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kio/kio ../../../qtcompat
7OBJECTS_DIR = obj/$(PLATFORM) 7OBJECTS_DIR = obj/$(PLATFORM)
8MOC_DIR = moc/$(PLATFORM) 8MOC_DIR = moc/$(PLATFORM)
9DESTDIR = $(QPEDIR)/lib 9DESTDIR = $(QPEDIR)/lib
10LIBS += -lmicrokde -lmicrokabc 10LIBS += -lmicrokde -lmicrokabc
11LIBS += -L$(QPEDIR)/lib 11LIBS += -L$(QPEDIR)/lib
12 12
13INTERFACES = \ 13INTERFACES = \
14 14
15HEADERS = \ 15HEADERS = \
16 resourcefile.h \ 16 resourcefile.h \
17 resourcefileconfig.h 17 resourcefileconfig.h
18 18
19SOURCES = \ 19SOURCES = \
20 resourcefile.cpp \ 20 resourcefile.cpp \
21 resourcefileconfig.cpp 21 resourcefileconfig.cpp
diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp
index 2d20706..9f9b00f 100644
--- a/kabc/plugins/file/resourcefile.cpp
+++ b/kabc/plugins/file/resourcefile.cpp
@@ -20,68 +20,64 @@
20 20
21/* 21/*
22Enhanced Version of the file for platform independent KDE tools. 22Enhanced Version of the file for platform independent KDE tools.
23Copyright (c) 2004 Ulf Schenk 23Copyright (c) 2004 Ulf Schenk
24 24
25$Id$ 25$Id$
26*/ 26*/
27 27
28#include <sys/types.h> 28#include <sys/types.h>
29#include <sys/stat.h> 29#include <sys/stat.h>
30#ifndef _WIN32_ 30#ifndef _WIN32_
31#include <unistd.h> 31#include <unistd.h>
32#endif 32#endif
33 33
34#include <qfile.h> 34#include <qfile.h>
35#include <qfileinfo.h> 35#include <qfileinfo.h>
36#include <qregexp.h> 36#include <qregexp.h>
37#include <qtimer.h> 37#include <qtimer.h>
38 38
39#include <kapplication.h> 39#include <kapplication.h>
40#include <kconfig.h> 40#include <kconfig.h>
41#include <kdebug.h> 41#include <kdebug.h>
42#include <klocale.h> 42#include <klocale.h>
43//US #include <ksavefile.h> 43//US #include <ksavefile.h>
44#include <kstandarddirs.h> 44#include <kstandarddirs.h>
45 45
46#include "formatfactory.h" 46#include "formatfactory.h"
47 47
48#include "resource.h" 48#include "resource.h"
49#include "resourcefileconfig.h" 49#include "resourcefileconfig.h"
50#include "stdaddressbook.h" 50#include "stdaddressbook.h"
51 51
52//US #include "../../formats/vcardformatplugin2.h"
53//US #include "../../formats/binaryformat.h"
54
55
56#include "resourcefile.h" 52#include "resourcefile.h"
57 53
58using namespace KABC; 54using namespace KABC;
59 55
60extern "C" 56extern "C"
61#ifdef _WIN32_ 57#ifdef _WIN32_
62__declspec(dllexport) 58__declspec(dllexport)
63#else 59#else
64{ 60{
65#endif 61#endif
66 62
67//US void *init_kabc_file() 63//US void *init_kabc_file()
68 void *init_microkabc_file() 64 void *init_microkabc_file()
69 { 65 {
70 return new KRES::PluginFactory<ResourceFile,ResourceFileConfig>(); 66 return new KRES::PluginFactory<ResourceFile,ResourceFileConfig>();
71 } 67 }
72#ifndef _WIN32_ 68#ifndef _WIN32_
73} 69}
74#endif 70#endif
75 71
76ResourceFile::ResourceFile( const KConfig *config ) 72ResourceFile::ResourceFile( const KConfig *config )
77 : Resource( config ) , mFormat( 0 ) 73 : Resource( config ) , mFormat( 0 )
78{ 74{
79 QString fileName, formatName; 75 QString fileName, formatName;
80 76
81 KConfig *cfg = (KConfig *)config; 77 KConfig *cfg = (KConfig *)config;
82 if ( cfg ) { 78 if ( cfg ) {
83 fileName = cfg->readEntry( "FileName", StdAddressBook::fileName() ); 79 fileName = cfg->readEntry( "FileName", StdAddressBook::fileName() );
84 formatName = cfg->readEntry( "FileFormat", "vcard" ); 80 formatName = cfg->readEntry( "FileFormat", "vcard" );
85// qDebug("ResourceFile::ResourceFile : 1 %s, %s", fileName.latin1(), formatName.latin1() ); 81// qDebug("ResourceFile::ResourceFile : 1 %s, %s", fileName.latin1(), formatName.latin1() );
86 } else { 82 } else {
87 fileName = StdAddressBook::fileName(); 83 fileName = StdAddressBook::fileName();
@@ -97,69 +93,67 @@ ResourceFile::ResourceFile( const QString &fileName,
97 : Resource( 0 ) 93 : Resource( 0 )
98{ 94{
99// qDebug("ResourceFile::ResourceFile : 3 %s, %s", fileName.latin1(), formatName.latin1()); 95// qDebug("ResourceFile::ResourceFile : 3 %s, %s", fileName.latin1(), formatName.latin1());
100 init( fileName, formatName ); 96 init( fileName, formatName );
101} 97}
102 98
103void ResourceFile::init( const QString &fileName, const QString &formatName ) 99void ResourceFile::init( const QString &fileName, const QString &formatName )
104{ 100{
105 mFormatName = formatName; 101 mFormatName = formatName;
106 102
107 FormatFactory *factory = FormatFactory::self(); 103 FormatFactory *factory = FormatFactory::self();
108 mFormat = factory->format( mFormatName ); 104 mFormat = factory->format( mFormatName );
109 105
110 if ( !mFormat ) { 106 if ( !mFormat ) {
111 mFormatName = "vcard"; 107 mFormatName = "vcard";
112 mFormat = factory->format( mFormatName ); 108 mFormat = factory->format( mFormatName );
113 } 109 }
114 110
115/*US 111/*US
116//US qDebug("ResourceFile::init initialized with format %s ", formatName.latin1()); 112//US qDebug("ResourceFile::init initialized with format %s ", formatName.latin1());
117 if (mFormatName == "vcard") { 113 if (mFormatName == "vcard") {
118 mFormat = new VCardFormatPlugin2(); 114 mFormat = new VCardFormatPlugin2();
119// qDebug("ResourceFile::init format VCardFormatPlugin2"); 115// qDebug("ResourceFile::init format VCardFormatPlugin2");
120 } 116 }
121 else if (mFormatName == "binary") { 117 else if (mFormatName == "binary") {
122 mFormat = new BinaryFormat(); 118 mFormat = new BinaryFormat();
123// qDebug("ResourceFile::init format BinaryFormat"); 119// qDebug("ResourceFile::init format BinaryFormat");
124 } 120 }
125 else 121 else
126 qDebug("ResourceFile::init format unknown !!! %s ", formatName.latin1()); 122 qDebug("ResourceFile::init format unknown !!! %s ", formatName.latin1());
127*/ 123*/
128 124
129/*US we have no KDirWatch. SO simulate the signals from inside the apropriate methods
130 connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); 125 connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) );
131 connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); 126 connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) );
132 connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); 127 connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) );
133*/
134 128
135 setFileName( fileName ); 129 setFileName( fileName );
136} 130}
137 131
138ResourceFile::~ResourceFile() 132ResourceFile::~ResourceFile()
139{ 133{
140 delete mFormat; 134 delete mFormat;
141 mFormat = 0; 135 mFormat = 0;
142} 136}
143 137
144void ResourceFile::writeConfig( KConfig *config ) 138void ResourceFile::writeConfig( KConfig *config )
145{ 139{
146 140
147 config->setGroup( "Resource_" + identifier() ); 141 config->setGroup( "Resource_" + identifier() );
148 Resource::writeConfig( config ); 142 Resource::writeConfig( config );
149 143
150 config->writeEntry( "FileName", mFileName ); 144 config->writeEntry( "FileName", mFileName );
151 config->writeEntry( "FileFormat", mFormatName ); 145 config->writeEntry( "FileFormat", mFormatName );
152 146
153// qDebug("ResourceFile::writeConfig format %s, %s", mFileName.latin1(), mFormatName.latin1()); 147// qDebug("ResourceFile::writeConfig format %s, %s", mFileName.latin1(), mFormatName.latin1());
154 148
155} 149}
156 150
157Ticket *ResourceFile::requestSaveTicket() 151Ticket *ResourceFile::requestSaveTicket()
158{ 152{
159 kdDebug(5700) << "ResourceFile::requestSaveTicket()" << endl; 153 kdDebug(5700) << "ResourceFile::requestSaveTicket()" << endl;
160 154
161 if ( !addressBook() ) return 0; 155 if ( !addressBook() ) return 0;
162 156
163 if ( !lock( mFileName ) ) { 157 if ( !lock( mFileName ) ) {
164 kdDebug(5700) << "ResourceFile::requestSaveTicket(): Unable to lock file '" 158 kdDebug(5700) << "ResourceFile::requestSaveTicket(): Unable to lock file '"
165 << mFileName << "'" << endl; 159 << mFileName << "'" << endl;
@@ -297,77 +291,75 @@ bool ResourceFile::lock( const QString &fileName )
297 int result = 0; 291 int result = 0;
298#ifndef _WIN32_ 292#ifndef _WIN32_
299 result = ::link( QFile::encodeName( mLockUniqueName ), 293 result = ::link( QFile::encodeName( mLockUniqueName ),
300 QFile::encodeName( lockName ) ); 294 QFile::encodeName( lockName ) );
301#endif 295#endif
302 if ( result == 0 ) { 296 if ( result == 0 ) {
303 addressBook()->emitAddressBookLocked(); 297 addressBook()->emitAddressBookLocked();
304 return true; 298 return true;
305 } 299 }
306 300
307 // TODO: check stat 301 // TODO: check stat
308 302
309 return false; 303 return false;
310} 304}
311 305
312void ResourceFile::unlock( const QString &fileName ) 306void ResourceFile::unlock( const QString &fileName )
313{ 307{
314 QString fn = fileName; 308 QString fn = fileName;
315//US change the implementation how the lockfilename is getting created 309//US change the implementation how the lockfilename is getting created
316//US fn.replace( QRegExp( "/" ), "_" ); 310//US fn.replace( QRegExp( "/" ), "_" );
317//US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" ); 311//US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" );
318//US QString lockName = fn + ".lock"; 312//US QString lockName = fn + ".lock";
319 KURL url(fn); 313 KURL url(fn);
320 QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); 314 QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" );
321 315
322 QFile::remove( lockName ); 316 QFile::remove( lockName );
323 QFile::remove( mLockUniqueName ); 317 QFile::remove( mLockUniqueName );
324 addressBook()->emitAddressBookUnlocked(); 318 addressBook()->emitAddressBookUnlocked();
325} 319}
326 320
327void ResourceFile::setFileName( const QString &fileName ) 321void ResourceFile::setFileName( const QString &fileName )
328{ 322{
329/*US ToDo: no synchronization so far. Has to be changed in the future
330 mDirWatch.stopScan(); 323 mDirWatch.stopScan();
331 mDirWatch.removeFile( mFileName ); 324 mDirWatch.removeFile( mFileName );
332*/ 325
333 mFileName = fileName; 326 mFileName = fileName;
334 327
335 328
336/*US ToDo: no synchronization so far. Has to be changed in the future
337 mDirWatch.addFile( mFileName ); 329 mDirWatch.addFile( mFileName );
338 mDirWatch.startScan(); 330 mDirWatch.startScan();
339*/ 331
340//US simulate KDirWatch event 332//US simulate KDirWatch event
341 fileChanged(); 333//US fileChanged();
342} 334}
343 335
344QString ResourceFile::fileName() const 336QString ResourceFile::fileName() const
345{ 337{
346 return mFileName; 338 return mFileName;
347} 339}
348 340
349void ResourceFile::setFormat( const QString &format ) 341void ResourceFile::setFormat( const QString &format )
350{ 342{
351 mFormatName = format; 343 mFormatName = format;
352 delete mFormat; 344 delete mFormat;
353 345
354 FormatFactory *factory = FormatFactory::self(); 346 FormatFactory *factory = FormatFactory::self();
355 mFormat = factory->format( mFormatName ); 347 mFormat = factory->format( mFormatName );
356/*US 348/*US
357//qDebug("ResourceFile::setFormat initialized with format %s ", format.latin1()); 349//qDebug("ResourceFile::setFormat initialized with format %s ", format.latin1());
358 if (mFormatName == "vcard") { 350 if (mFormatName == "vcard") {
359 mFormat = new VCardFormatPlugin2(); 351 mFormat = new VCardFormatPlugin2();
360// qDebug("ResourceFile::setFormat format %s", mFormatName.latin1()); 352// qDebug("ResourceFile::setFormat format %s", mFormatName.latin1());
361 } 353 }
362 else if (mFormatName == "binary") { 354 else if (mFormatName == "binary") {
363 mFormat = new BinaryFormat(); 355 mFormat = new BinaryFormat();
364// qDebug("ResourceFile::setFormat format %s", mFormatName.latin1()); 356// qDebug("ResourceFile::setFormat format %s", mFormatName.latin1());
365 } 357 }
366 else 358 else
367 qDebug("ResourceFile::setFormat format unknown !!! %s ", format.latin1()); 359 qDebug("ResourceFile::setFormat format unknown !!! %s ", format.latin1());
368*/ 360*/
369 361
370} 362}
371 363
372QString ResourceFile::format() const 364QString ResourceFile::format() const
373{ 365{
diff --git a/kabc/plugins/opie/opieE.pro b/kabc/plugins/opie/opieE.pro
index 75a5dab..4048cc0 100644
--- a/kabc/plugins/opie/opieE.pro
+++ b/kabc/plugins/opie/opieE.pro
@@ -1,32 +1,32 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2CONFIG += qt warn_on 2CONFIG += qt warn_on
3#release debug 3#release debug
4TARGET = microkabc_opie 4TARGET = microkabc_opie
5 5
6INCLUDEPATH += ../.. ../../converter/opie ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../qtcompat $(QPEDIR)/include $(OPIEDIR)/include 6INCLUDEPATH += ../.. ../../converter/opie ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kio/kio ../../../qtcompat $(QPEDIR)/include $(OPIEDIR)/include
7 7
8 8
9OBJECTS_DIR = obj/$(PLATFORM) 9OBJECTS_DIR = obj/$(PLATFORM)
10MOC_DIR = moc/$(PLATFORM) 10MOC_DIR = moc/$(PLATFORM)
11DESTDIR = $(QPEDIR)/lib 11DESTDIR = $(QPEDIR)/lib
12LIBS += -lmicrokde 12LIBS += -lmicrokde
13LIBS += -lmicrokabc 13LIBS += -lmicrokabc
14LIBS += -L$(QPEDIR)/lib 14LIBS += -L$(QPEDIR)/lib
15LIBS += -L$(OPIEDIR)/lib 15LIBS += -L$(OPIEDIR)/lib
16LIBS += -lopie 16LIBS += -lopie
17LIBS += -lqpe 17LIBS += -lqpe
18LIBS += -lqte 18LIBS += -lqte
19LIBS += -lmicrokabc_opieconverter 19LIBS += -lmicrokabc_opieconverter
20#LIBS += -L../../lib/$(PLATFORM) 20#LIBS += -L../../lib/$(PLATFORM)
21 21
22 22
23INTERFACES = \ 23INTERFACES = \
24 24
25HEADERS = \ 25HEADERS = \
26 resourceopie.h \ 26 resourceopie.h \
27 resourceopieconfig.h \ 27 resourceopieconfig.h \
28 28
29SOURCES = \ 29SOURCES = \
30 resourceopie.cpp \ 30 resourceopie.cpp \
31 resourceopieconfig.cpp \ 31 resourceopieconfig.cpp \
32 32