summaryrefslogtreecommitdiffabout
path: root/kabc/plugins/file
Unidiff
Diffstat (limited to 'kabc/plugins/file') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/plugins/file/file.pro4
-rw-r--r--kabc/plugins/file/fileE.pro2
-rw-r--r--kabc/plugins/file/resourcefile.cpp14
3 files changed, 6 insertions, 14 deletions
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,18 +1,18 @@
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 = \
@@ -23,13 +23,13 @@ unix : {
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,18 +1,18 @@
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
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
@@ -40,28 +40,24 @@ $Id$
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()
@@ -117,29 +113,27 @@ void ResourceFile::init( const QString &fileName, const QString &formatName )
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{
@@ -317,37 +311,35 @@ void ResourceFile::unlock( const QString &fileName )
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