-rw-r--r-- | kabc/converter/opie/opieE.pro | 2 | ||||
-rw-r--r-- | kabc/plugins/opie/resourceopie.cpp | 7 |
2 files changed, 2 insertions, 7 deletions
diff --git a/kabc/converter/opie/opieE.pro b/kabc/converter/opie/opieE.pro index e026f2a..131c398 100644 --- a/kabc/converter/opie/opieE.pro +++ b/kabc/converter/opie/opieE.pro | |||
@@ -1,18 +1,18 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | INCLUDEPATH += . ../.. ../../../microkde ../../../microkde/kdecore $(OPIEDIR)/include $(OPEDIR)/include | 2 | INCLUDEPATH += . ../.. ../../../microkde ../../../microkde/kdecore $(OPIEDIR)/include |
3 | #CONFIG += staticlib | 3 | #CONFIG += staticlib |
4 | OBJECTS_DIR = obj/$(PLATFORM) | 4 | OBJECTS_DIR = obj/$(PLATFORM) |
5 | MOC_DIR = moc/$(PLATFORM) | 5 | MOC_DIR = moc/$(PLATFORM) |
6 | 6 | ||
7 | #for static linkage, put it here | 7 | #for static linkage, put it here |
8 | #DESTDIR=../../lib/$(PLATFORM) | 8 | #DESTDIR=../../lib/$(PLATFORM) |
9 | 9 | ||
10 | #for dynamic linkage, put it here | 10 | #for dynamic linkage, put it here |
11 | DESTDIR=$(QPEDIR)/lib | 11 | DESTDIR=$(QPEDIR)/lib |
12 | 12 | ||
13 | LIBS += -lmicrokde | 13 | LIBS += -lmicrokde |
14 | LIBS += -lmicrokabc | 14 | LIBS += -lmicrokabc |
15 | LIBS += -L$(QPEDIR)/lib | 15 | LIBS += -L$(QPEDIR)/lib |
16 | LIBS += -L$(OPIEDIR)/lib | 16 | LIBS += -L$(OPIEDIR)/lib |
17 | LIBS += -lopie | 17 | LIBS += -lopie |
18 | LIBS += -lqpe | 18 | LIBS += -lqpe |
diff --git a/kabc/plugins/opie/resourceopie.cpp b/kabc/plugins/opie/resourceopie.cpp index a7d271f..3a40ea2 100644 --- a/kabc/plugins/opie/resourceopie.cpp +++ b/kabc/plugins/opie/resourceopie.cpp | |||
@@ -20,48 +20,46 @@ | |||
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (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 | #include <unistd.h> | 30 | #include <unistd.h> |
31 | 31 | ||
32 | #include <qdir.h> | 32 | #include <qdir.h> |
33 | #include <qfile.h> | 33 | #include <qfile.h> |
34 | #include <qfileinfo.h> | 34 | #include <qfileinfo.h> |
35 | #include <qregexp.h> | 35 | #include <qregexp.h> |
36 | #include <qtimer.h> | ||
37 | 36 | ||
38 | #include <kapplication.h> | 37 | #include <kapplication.h> |
39 | #include <kconfig.h> | 38 | #include <kconfig.h> |
40 | #include <kdebug.h> | 39 | #include <kdebug.h> |
41 | #include <klocale.h> | 40 | #include <klocale.h> |
42 | //US #include <ksavefile.h> | 41 | //US #include <ksavefile.h> |
43 | #include <kstandarddirs.h> | 42 | #include <kstandarddirs.h> |
44 | 43 | ||
45 | //US #include "formatfactory.h" | 44 | //US #include "formatfactory.h" |
46 | //US #include <qpe/qpeapplication.h> | 45 | //US #include <qpe/qpeapplication.h> |
47 | 46 | ||
48 | #include <opie/ocontactaccess.h> | 47 | #include <opie/ocontactaccess.h> |
49 | #include <opie/ocontactaccessbackend_xml.h> | 48 | #include <opie/ocontactaccessbackend_xml.h> |
50 | 49 | ||
51 | #include "resource.h" | ||
52 | #include "resourceopieconfig.h" | 50 | #include "resourceopieconfig.h" |
53 | #include "stdaddressbook.h" | 51 | #include "stdaddressbook.h" |
54 | 52 | ||
55 | #include "opieconverter.h" | 53 | #include "opieconverter.h" |
56 | 54 | ||
57 | #include "resourceopie.h" | 55 | #include "resourceopie.h" |
58 | 56 | ||
59 | using namespace KABC; | 57 | using namespace KABC; |
60 | extern "C" | 58 | extern "C" |
61 | { | 59 | { |
62 | void *init_microkabc_opie() | 60 | void *init_microkabc_opie() |
63 | { | 61 | { |
64 | return new KRES::PluginFactory<ResourceOpie,ResourceOpieConfig>(); | 62 | return new KRES::PluginFactory<ResourceOpie,ResourceOpieConfig>(); |
65 | } | 63 | } |
66 | } | 64 | } |
67 | 65 | ||
@@ -98,35 +96,32 @@ void ResourceOpie::init( const QString &fileName ) | |||
98 | */ | 96 | */ |
99 | //US opie addressbook is always readonly | 97 | //US opie addressbook is always readonly |
100 | //US setReadOnly( true ); | 98 | //US setReadOnly( true ); |
101 | 99 | ||
102 | setFileName( fileName ); | 100 | setFileName( fileName ); |
103 | 101 | ||
104 | } | 102 | } |
105 | 103 | ||
106 | ResourceOpie::~ResourceOpie() | 104 | ResourceOpie::~ResourceOpie() |
107 | { | 105 | { |
108 | if (mConverter != 0) | 106 | if (mConverter != 0) |
109 | delete mConverter; | 107 | delete mConverter; |
110 | } | 108 | } |
111 | 109 | ||
112 | void ResourceOpie::writeConfig( KConfig *config ) | 110 | void ResourceOpie::writeConfig( KConfig *config ) |
113 | { | 111 | { |
114 | //US opie addressbook is always readonly | ||
115 | //US setReadOnly( true ); | ||
116 | |||
117 | Resource::writeConfig( config ); | 112 | Resource::writeConfig( config ); |
118 | 113 | ||
119 | config->writeEntry( "FileName", mFileName ); | 114 | config->writeEntry( "FileName", mFileName ); |
120 | 115 | ||
121 | // qDebug("ResourceFile::writeConfig format %s, %s", mFileName.latin1(), mFormatName.latin1()); | 116 | // qDebug("ResourceFile::writeConfig format %s, %s", mFileName.latin1(), mFormatName.latin1()); |
122 | 117 | ||
123 | } | 118 | } |
124 | 119 | ||
125 | Ticket *ResourceOpie::requestSaveTicket() | 120 | Ticket *ResourceOpie::requestSaveTicket() |
126 | { | 121 | { |
127 | kdDebug(5700) << "ResourceOpie::requestSaveTicket()" << endl; | 122 | kdDebug(5700) << "ResourceOpie::requestSaveTicket()" << endl; |
128 | 123 | ||
129 | if ( !addressBook() ) return 0; | 124 | if ( !addressBook() ) return 0; |
130 | 125 | ||
131 | if ( !lock( mFileName ) ) { | 126 | if ( !lock( mFileName ) ) { |
132 | kdDebug(5700) << "ResourceOpie::requestSaveTicket(): Unable to lock file '" | 127 | kdDebug(5700) << "ResourceOpie::requestSaveTicket(): Unable to lock file '" |
@@ -200,33 +195,33 @@ bool ResourceOpie::load() | |||
200 | mConverter = new OpieConverter(); | 195 | mConverter = new OpieConverter(); |
201 | res = mConverter->init(); | 196 | res = mConverter->init(); |
202 | if ( !res ) | 197 | if ( !res ) |
203 | { | 198 | { |
204 | qDebug("Unable to initialize opie converter. Most likely a problem with the category file"); | 199 | qDebug("Unable to initialize opie converter. Most likely a problem with the category file"); |
205 | addressBook()->error( i18n( "Unable to initialize opie converter. Most likely a problem with the category file" ) ); | 200 | addressBook()->error( i18n( "Unable to initialize opie converter. Most likely a problem with the category file" ) ); |
206 | delete access; | 201 | delete access; |
207 | return false; | 202 | return false; |
208 | } | 203 | } |
209 | } | 204 | } |
210 | 205 | ||
211 | 206 | ||
212 | OContactAccess::List::Iterator it; | 207 | OContactAccess::List::Iterator it; |
213 | OContactAccess::List allList = access->allRecords(); | 208 | OContactAccess::List allList = access->allRecords(); |
214 | for ( it = allList.begin(); it != allList.end(); ++it ) | 209 | for ( it = allList.begin(); it != allList.end(); ++it ) |
215 | { | 210 | { |
216 | OContact c = (*it); | 211 | const OContact c = (*it); |
217 | 212 | ||
218 | KABC::Addressee addressee; | 213 | KABC::Addressee addressee; |
219 | 214 | ||
220 | res = mConverter->opieToAddressee( c, addressee ); | 215 | res = mConverter->opieToAddressee( c, addressee ); |
221 | 216 | ||
222 | if ( !addressee.isEmpty() && res ) | 217 | if ( !addressee.isEmpty() && res ) |
223 | { | 218 | { |
224 | addressee.setResource( this ); | 219 | addressee.setResource( this ); |
225 | addressBook()->insertAddressee( addressee ); | 220 | addressBook()->insertAddressee( addressee ); |
226 | } | 221 | } |
227 | 222 | ||
228 | // qDebug("found %s", c.fullName().latin1()); | 223 | // qDebug("found %s", c.fullName().latin1()); |
229 | } | 224 | } |
230 | 225 | ||
231 | delete access; | 226 | delete access; |
232 | // it seems so, that deletion of access deletes backend as well | 227 | // it seems so, that deletion of access deletes backend as well |