summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-07-14 14:55:56 (UTC)
committer ulf69 <ulf69>2004-07-14 14:55:56 (UTC)
commitf2779e5e7742103ce848ab11e6b9fe3661587f0b (patch) (unidiff)
treef858743398b61aa21eca09abc6d85a34a7d3f436
parentcf7175c9a6b96cd11fb7f3cba459f5223aa4aacb (diff)
downloadkdepimpi-f2779e5e7742103ce848ab11e6b9fe3661587f0b.zip
kdepimpi-f2779e5e7742103ce848ab11e6b9fe3661587f0b.tar.gz
kdepimpi-f2779e5e7742103ce848ab11e6b9fe3661587f0b.tar.bz2
added changes to support qtopia import/export and improved resource support
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile.Embedded8
-rw-r--r--kabc/converter/opie/opieconverter.h4
-rw-r--r--kabc/converter/qtopia/qtopiaconverter.cpp19
-rw-r--r--kabc/converter/qtopia/qtopiaconverter.h4
-rw-r--r--kaddressbook/xxportmanager.cpp10
5 files changed, 26 insertions, 19 deletions
diff --git a/Makefile.Embedded b/Makefile.Embedded
index 3160017..143e965 100644
--- a/Makefile.Embedded
+++ b/Makefile.Embedded
@@ -1,20 +1,20 @@
1DISTPATH = $(shell pwd) 1DISTPATH = $(shell pwd)
2DISTDIR = $(shell basename $(DISTPATH)) 2DISTDIR = $(shell basename $(DISTPATH))
3 3
4SUBDIRS = libical/src/libical libical/src/libicalss qtcompat microkde \ 4SUBDIRS = libical/src/libical libical/src/libicalss qtcompat microkde \
5 libkcal libkdepim kabc kabc/converter/opie kabc/converter/qtopia kabc/formats/binary \ 5 libkcal libkdepim kabc kabc/converter/opie kabc/converter/qtopia kabc/formats/binary \
6 kabc/plugins/file kabc/plugins/dir \ 6 kabc/plugins/file kabc/plugins/dir \
7 kabc/plugins/ldap kabc/plugins/opie kabc/plugins/qtopia \ 7 kabc/plugins/ldap kabc/plugins/opie kabc/plugins/qtopia \
8 korganizer kalarmd kaddressbook/xxport/opie kaddressbook 8 korganizer kalarmd kaddressbook/xxport/opie kaddressbook/xxport/qtopia kaddressbook
9all: tmake 9all: tmake
10 for i in $(SUBDIRS); do pushd $$i; \ 10 for i in $(SUBDIRS); do pushd $$i; \
11 make -f Makefile$(PLATFORM) || exit 1; popd; \ 11 make -f Makefile$(PLATFORM) || exit 1; popd; \
12 done 12 done
13 13
14objects: 14objects:
15 for i in $(SUBDIRS); do mkdir -p $$i/obj/$(PLATFORM); done 15 for i in $(SUBDIRS); do mkdir -p $$i/obj/$(PLATFORM); done
16 for i in $(SUBDIRS); do mkdir -p $$i/moc/$(PLATFORM); done 16 for i in $(SUBDIRS); do mkdir -p $$i/moc/$(PLATFORM); done
17 mkdir -p libical/lib/$(PLATFORM) 17 mkdir -p libical/lib/$(PLATFORM)
18 18
19clean: 19clean:
20 rm -f libical/lib/$(PLATFORM)/*; 20 rm -f libical/lib/$(PLATFORM)/*;
@@ -41,24 +41,25 @@ tmake: objects qtcompat/Makefile$(PLATFORM) microkde/Makefile$(PLATFORM) \
41 libical/src/libical/Makefile$(PLATFORM) \ 41 libical/src/libical/Makefile$(PLATFORM) \
42 libical/src/libicalss/Makefile$(PLATFORM) \ 42 libical/src/libicalss/Makefile$(PLATFORM) \
43 kabc/Makefile$(PLATFORM) \ 43 kabc/Makefile$(PLATFORM) \
44 kabc/converter/opie/Makefile$(PLATFORM) \ 44 kabc/converter/opie/Makefile$(PLATFORM) \
45 kabc/converter/qtopia/Makefile$(PLATFORM) \ 45 kabc/converter/qtopia/Makefile$(PLATFORM) \
46 kabc/formats/binary/Makefile$(PLATFORM) \ 46 kabc/formats/binary/Makefile$(PLATFORM) \
47 kabc/plugins/file/Makefile$(PLATFORM) \ 47 kabc/plugins/file/Makefile$(PLATFORM) \
48 kabc/plugins/dir/Makefile$(PLATFORM) \ 48 kabc/plugins/dir/Makefile$(PLATFORM) \
49 kabc/plugins/ldap/Makefile$(PLATFORM) \ 49 kabc/plugins/ldap/Makefile$(PLATFORM) \
50 kabc/plugins/opie/Makefile$(PLATFORM) \ 50 kabc/plugins/opie/Makefile$(PLATFORM) \
51 kabc/plugins/qtopia/Makefile$(PLATFORM) \ 51 kabc/plugins/qtopia/Makefile$(PLATFORM) \
52 kaddressbook/xxport/opie/Makefile$(PLATFORM) \ 52 kaddressbook/xxport/opie/Makefile$(PLATFORM) \
53 kaddressbook/xxport/qtopia/Makefile$(PLATFORM) \
53 kaddressbook/Makefile$(PLATFORM) 54 kaddressbook/Makefile$(PLATFORM)
54 55
55 56
56 57
57qtcompat/Makefile$(PLATFORM): qtcompat/qtcompat.pro 58qtcompat/Makefile$(PLATFORM): qtcompat/qtcompat.pro
58 cd qtcompat; tmake "CONFIG+=$(RELEASE_DEBUG)" qtcompat.pro -o Makefile$(PLATFORM) 59 cd qtcompat; tmake "CONFIG+=$(RELEASE_DEBUG)" qtcompat.pro -o Makefile$(PLATFORM)
59 60
60microkde/Makefile$(PLATFORM): microkde/microkdeE.pro 61microkde/Makefile$(PLATFORM): microkde/microkdeE.pro
61 cd microkde; tmake "CONFIG+=$(RELEASE_DEBUG)" microkdeE.pro -o Makefile$(PLATFORM) 62 cd microkde; tmake "CONFIG+=$(RELEASE_DEBUG)" microkdeE.pro -o Makefile$(PLATFORM)
62 63
63libkcal/Makefile$(PLATFORM): libkcal/libkcalE.pro 64libkcal/Makefile$(PLATFORM): libkcal/libkcalE.pro
64 cd libkcal; tmake "CONFIG+=$(RELEASE_DEBUG)" libkcalE.pro -o Makefile$(PLATFORM) 65 cd libkcal; tmake "CONFIG+=$(RELEASE_DEBUG)" libkcalE.pro -o Makefile$(PLATFORM)
@@ -99,16 +100,19 @@ kabc/plugins/dir/Makefile$(PLATFORM): kabc/plugins/dir/dirE.pro
99 100
100kabc/plugins/ldap/Makefile$(PLATFORM): kabc/plugins/ldap/ldapE.pro 101kabc/plugins/ldap/Makefile$(PLATFORM): kabc/plugins/ldap/ldapE.pro
101 cd kabc/plugins/ldap; tmake "CONFIG+=$(RELEASE_DEBUG)" ldapE.pro -o Makefile$(PLATFORM) 102 cd kabc/plugins/ldap; tmake "CONFIG+=$(RELEASE_DEBUG)" ldapE.pro -o Makefile$(PLATFORM)
102 103
103kabc/plugins/opie/Makefile$(PLATFORM): kabc/plugins/opie/opieE.pro 104kabc/plugins/opie/Makefile$(PLATFORM): kabc/plugins/opie/opieE.pro
104 cd kabc/plugins/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" opieE.pro -o Makefile$(PLATFORM) 105 cd kabc/plugins/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" opieE.pro -o Makefile$(PLATFORM)
105 106
106kabc/plugins/qtopia/Makefile$(PLATFORM): kabc/plugins/qtopia/qtopiaE.pro 107kabc/plugins/qtopia/Makefile$(PLATFORM): kabc/plugins/qtopia/qtopiaE.pro
107 cd kabc/plugins/qtopia; tmake "CONFIG+=$(RELEASE_DEBUG)" qtopiaE.pro -o Makefile$(PLATFORM) 108 cd kabc/plugins/qtopia; tmake "CONFIG+=$(RELEASE_DEBUG)" qtopiaE.pro -o Makefile$(PLATFORM)
108 109
109kaddressbook/xxport/opie/Makefile$(PLATFORM): kaddressbook/xxport/opie/opieE.pro 110kaddressbook/xxport/opie/Makefile$(PLATFORM): kaddressbook/xxport/opie/opieE.pro
110 cd kaddressbook/xxport/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" opieE.pro -o Makefile$(PLATFORM) 111 cd kaddressbook/xxport/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" opieE.pro -o Makefile$(PLATFORM)
111 112
113kaddressbook/xxport/qtopia/Makefile$(PLATFORM): kaddressbook/xxport/qtopia/qtopiaE.pro
114 cd kaddressbook/xxport/qtopia; tmake "CONFIG+=$(RELEASE_DEBUG)" qtopiaE.pro -o Makefile$(PLATFORM)
115
112kaddressbook/Makefile$(PLATFORM): kaddressbook/kaddressbookE.pro 116kaddressbook/Makefile$(PLATFORM): kaddressbook/kaddressbookE.pro
113 cd kaddressbook; tmake "CONFIG+=$(RELEASE_DEBUG)" kaddressbookE.pro -o Makefile$(PLATFORM) 117 cd kaddressbook; tmake "CONFIG+=$(RELEASE_DEBUG)" kaddressbookE.pro -o Makefile$(PLATFORM)
114 118
diff --git a/kabc/converter/opie/opieconverter.h b/kabc/converter/opie/opieconverter.h
index c7e691f..d251a24 100644
--- a/kabc/converter/opie/opieconverter.h
+++ b/kabc/converter/opie/opieconverter.h
@@ -42,26 +42,26 @@ class OpieConverter
42public: 42public:
43 43
44 /** 44 /**
45 * Constructor. 45 * Constructor.
46 */ 46 */
47 OpieConverter(); 47 OpieConverter();
48 48
49 /** 49 /**
50 * Destructor. 50 * Destructor.
51 */ 51 */
52 virtual ~OpieConverter(); 52 virtual ~OpieConverter();
53 53
54 virtual bool init(); 54 bool init();
55 virtual void deinit(); 55 void deinit();
56 56
57 /** 57 /**
58 * Converts a vcard string to an addressee. 58 * Converts a vcard string to an addressee.
59 * 59 *
60 * @param contact The opie contact. 60 * @param contact The opie contact.
61 * @param addr The addressee. 61 * @param addr The addressee.
62 */ 62 */
63 bool opieToAddressee( const OContact &contact, Addressee &addr ); 63 bool opieToAddressee( const OContact &contact, Addressee &addr );
64 64
65 /** 65 /**
66 * Converts an addressee to a vcard string. 66 * Converts an addressee to a vcard string.
67 * 67 *
diff --git a/kabc/converter/qtopia/qtopiaconverter.cpp b/kabc/converter/qtopia/qtopiaconverter.cpp
index e3dd3e6..f451b8b 100644
--- a/kabc/converter/qtopia/qtopiaconverter.cpp
+++ b/kabc/converter/qtopia/qtopiaconverter.cpp
@@ -40,33 +40,30 @@ using namespace KABC;
40QtopiaConverter::QtopiaConverter() : catDB(0) 40QtopiaConverter::QtopiaConverter() : catDB(0)
41{ 41{
42} 42}
43 43
44QtopiaConverter::~QtopiaConverter() 44QtopiaConverter::~QtopiaConverter()
45{ 45{
46 deinit(); 46 deinit();
47} 47}
48 48
49bool QtopiaConverter::init() 49bool QtopiaConverter::init()
50{ 50{
51 catDB = new Categories(); 51 catDB = new Categories();
52 if (catDB) 52
53 { 53 if (!catDB)
54 catDB->load( categoryFileName() );
55 return true;
56 }
57 else
58 {
59 return false; 54 return false;
60 } 55
56 catDB->load( categoryFileName() );
57 return true;
61} 58}
62 59
63void QtopiaConverter::deinit() 60void QtopiaConverter::deinit()
64{ 61{
65 if (catDB) 62 if (catDB)
66 { 63 {
67 delete catDB; 64 delete catDB;
68 catDB = 0; 65 catDB = 0;
69 } 66 }
70} 67}
71 68
72bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &addr ) 69bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &addr )
@@ -200,55 +197,55 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a
200 //personal 197 //personal
201 addr.insertCustom( "KADDRESSBOOK", "X-SpousesName", contact.spouse() ); 198 addr.insertCustom( "KADDRESSBOOK", "X-SpousesName", contact.spouse() );
202 // qtopia uses this categorization: 199 // qtopia uses this categorization:
203 // enum GenderType { UnspecifiedGender=0, Male, Female }; 200 // enum GenderType { UnspecifiedGender=0, Male, Female };
204 if (contact.gender() == PimContact::Male) 201 if (contact.gender() == PimContact::Male)
205 addr.insertCustom( "KADDRESSBOOK", "X-Gender", "male"); 202 addr.insertCustom( "KADDRESSBOOK", "X-Gender", "male");
206 else if (contact.gender() == PimContact::Female) 203 else if (contact.gender() == PimContact::Female)
207 addr.insertCustom( "KADDRESSBOOK", "X-Gender", "female"); 204 addr.insertCustom( "KADDRESSBOOK", "X-Gender", "female");
208 205
209 if (contact.anniversary().isValid()) { 206 if (contact.anniversary().isValid()) {
210 QString dt = KGlobal::locale()->formatDate(contact.anniversary(), true, KLocale::ISODate); 207 QString dt = KGlobal::locale()->formatDate(contact.anniversary(), true, KLocale::ISODate);
211//US 208//US
212 qDebug("OpieConverter::opieToAddressee found:%s", dt.latin1()); 209 qDebug("OpieConverter::qtopiaToAddressee found:%s", dt.latin1());
213 addr.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); 210 addr.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt);
214 } 211 }
215 212
216 addr.insertCustom( "KADDRESSBOOK", "X-Children", contact.children() ); 213 addr.insertCustom( "KADDRESSBOOK", "X-Children", contact.children() );
217 if (contact.birthday().isValid()) 214 if (contact.birthday().isValid())
218 addr.setBirthday( contact.birthday() ); 215 addr.setBirthday( contact.birthday() );
219 216
220 addr.setNickName( contact.nickname() ); 217 addr.setNickName( contact.nickname() );
221 218
222 // others 219 // others
223 //US I put opies BusinessWebPage into Ka/Pi's notes block, because no other native field is available. 220 //US I put opies BusinessWebPage into Ka/Pi's notes block, because no other native field is available.
224 QString notes = contact.notes(); 221 QString notes = contact.notes();
225 notes += "\nBusinessWebPage: " + contact.businessWebpage() + "\n"; 222 notes += "\nBusinessWebPage: " + contact.businessWebpage() + "\n";
226 223
227 addr.setNote( contact.notes() ); 224 addr.setNote( contact.notes() );
228 225
229 226
230 227
231//US QString groups() const { return find( Qtopia::Groups ); } 228//US QString groups() const { return find( Qtopia::Groups ); }
232//US QStringList groupList() const; 229//US QStringList groupList() const;
233 230
234 QArray<int> catArray = contact.categories(); 231 QArray<int> catArray = contact.categories();
235 QString cat; 232 QString cat;
236 233
237 for ( unsigned int i=0; i < catArray.size(); i++ ) { 234 for ( unsigned int i=0; i < catArray.size(); i++ ) {
238 cat = catDB->label("contact", catArray[i]); 235 cat = catDB->label("contact", catArray[i]);
239 if ( !cat.isEmpty() ) 236 if ( !cat.isEmpty() )
240 addr.insertCategory( cat ); 237 addr.insertCategory( cat );
241 } 238 }
242 239
243 return true; 240 return true;
244} 241}
245 242
246bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &contact ) 243bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &contact )
247{ 244{
248 // name 245 // name
249 contact.setLastName(addr.familyName()); 246 contact.setLastName(addr.familyName());
250 contact.setFirstName(addr.givenName()); 247 contact.setFirstName(addr.givenName());
251 contact.setMiddleName(addr.additionalName()); 248 contact.setMiddleName(addr.additionalName());
252 contact.setNameTitle(addr.prefix()); 249 contact.setNameTitle(addr.prefix());
253 contact.setSuffix(addr.suffix()); 250 contact.setSuffix(addr.suffix());
254 contact.setFileAs(); 251 contact.setFileAs();
diff --git a/kabc/converter/qtopia/qtopiaconverter.h b/kabc/converter/qtopia/qtopiaconverter.h
index 7397113..8f4c698 100644
--- a/kabc/converter/qtopia/qtopiaconverter.h
+++ b/kabc/converter/qtopia/qtopiaconverter.h
@@ -41,26 +41,26 @@ class QtopiaConverter
41public: 41public:
42 42
43 /** 43 /**
44 * Constructor. 44 * Constructor.
45 */ 45 */
46 QtopiaConverter(); 46 QtopiaConverter();
47 47
48 /** 48 /**
49 * Destructor. 49 * Destructor.
50 */ 50 */
51 virtual ~QtopiaConverter(); 51 virtual ~QtopiaConverter();
52 52
53 virtual bool init(); 53 bool init();
54 virtual void deinit(); 54 void deinit();
55 55
56 /** 56 /**
57 * Converts a vcard string to an addressee. 57 * Converts a vcard string to an addressee.
58 * 58 *
59 * @param contact The qtopia contact. 59 * @param contact The qtopia contact.
60 * @param addr The addressee. 60 * @param addr The addressee.
61 */ 61 */
62 bool qtopiaToAddressee( const PimContact &contact, Addressee &addr ); 62 bool qtopiaToAddressee( const PimContact &contact, Addressee &addr );
63 63
64 /** 64 /**
65 * Converts an addressee to a vcard string. 65 * Converts an addressee to a vcard string.
66 * 66 *
diff --git a/kaddressbook/xxportmanager.cpp b/kaddressbook/xxportmanager.cpp
index 248fcab..4798ffe 100644
--- a/kaddressbook/xxportmanager.cpp
+++ b/kaddressbook/xxportmanager.cpp
@@ -187,48 +187,54 @@ void XXPortManager::loadPlugins()
187 187
188 if ( !xxportFactory ) { 188 if ( !xxportFactory ) {
189 kdDebug(5720) << "XXPortManager::loadExtensions(): Cast failed" << endl; 189 kdDebug(5720) << "XXPortManager::loadExtensions(): Cast failed" << endl;
190 continue; 190 continue;
191 } 191 }
192 192
193#else //KAB_EMBEDDED 193#else //KAB_EMBEDDED
194 QList<XXPortFactory> factorylist; 194 QList<XXPortFactory> factorylist;
195 factorylist.append(static_cast<XXPortFactory*>(init_kaddrbk_csv_xxport())); 195 factorylist.append(static_cast<XXPortFactory*>(init_kaddrbk_csv_xxport()));
196 factorylist.append(static_cast<XXPortFactory*>(init_kaddrbk_kde2_xxport())); 196 factorylist.append(static_cast<XXPortFactory*>(init_kaddrbk_kde2_xxport()));
197 factorylist.append(static_cast<XXPortFactory*>(init_kaddrbk_vcard_xxport())); 197 factorylist.append(static_cast<XXPortFactory*>(init_kaddrbk_vcard_xxport()));
198 198
199 //now add the opie import library dynamically 199 //add the opie import library dynamically
200 KLibFactory *factory = KLibLoader::self()->factory( "microkaddrbk_opie_xxport" ); 200 KLibFactory *factory = KLibLoader::self()->factory( "microkaddrbk_opie_xxport" );
201 if ( factory ) { 201 if ( factory ) {
202 XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory ); 202 XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory );
203 factorylist.append(xxportFactory); 203 factorylist.append(xxportFactory);
204 } 204 }
205 205
206 //add the qtopia import library dynamically
207 factory = KLibLoader::self()->factory( "microkaddrbk_qtopia_xxport" );
208 if ( factory ) {
209 XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory );
210 factorylist.append(xxportFactory);
211 }
212
206 QListIterator<XXPortFactory> it(factorylist); 213 QListIterator<XXPortFactory> it(factorylist);
207 for ( ; it.current(); ++it ) 214 for ( ; it.current(); ++it )
208 { 215 {
209 XXPortFactory *xxportFactory = it.current(); 216 XXPortFactory *xxportFactory = it.current();
210#endif //KAB_EMBEDDED 217#endif //KAB_EMBEDDED
211 218
212 XXPortObject *obj = xxportFactory->xxportObject( mCore->addressBook(), mCore ); 219 XXPortObject *obj = xxportFactory->xxportObject( mCore->addressBook(), mCore );
213 if ( obj ) { 220 if ( obj ) {
214 mCore->addGUIClient( obj ); 221 mCore->addGUIClient( obj );
215 mXXPortObjects.insert( obj->identifier(), obj ); 222 mXXPortObjects.insert( obj->identifier(), obj );
216 connect( obj, SIGNAL( exportActivated( const QString&, const QString& ) ), 223 connect( obj, SIGNAL( exportActivated( const QString&, const QString& ) ),
217 this, SLOT( slotExport( const QString&, const QString& ) ) ); 224 this, SLOT( slotExport( const QString&, const QString& ) ) );
218 connect( obj, SIGNAL( importActivated( const QString&, const QString& ) ), 225 connect( obj, SIGNAL( importActivated( const QString&, const QString& ) ),
219 this, SLOT( slotImport( const QString&, const QString& ) ) ); 226 this, SLOT( slotImport( const QString&, const QString& ) ) );
220 } 227 }
221 } 228 }
222
223} 229}
224 230
225 231
226PreviewDialog::PreviewDialog( const KABC::Addressee &addr, QWidget *parent, 232PreviewDialog::PreviewDialog( const KABC::Addressee &addr, QWidget *parent,
227 const char *name ) 233 const char *name )
228 : KDialogBase( Plain, i18n( "Contact Preview" ), Ok | Cancel, Ok, parent, 234 : KDialogBase( Plain, i18n( "Contact Preview" ), Ok | Cancel, Ok, parent,
229 name, true, true ) 235 name, true, true )
230{ 236{
231 QWidget *page = plainPage(); 237 QWidget *page = plainPage();
232 QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() ); 238 QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() );
233 239
234 KPIM::AddresseeView *view = new KPIM::AddresseeView( page ); 240 KPIM::AddresseeView *view = new KPIM::AddresseeView( page );