author | ulf69 <ulf69> | 2004-07-09 08:05:25 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-07-09 08:05:25 (UTC) |
commit | 259a7a50e4f8138cedfc2004fbde3b37cedcc49f (patch) (unidiff) | |
tree | dfd2e89f169ba65ffd250f9b52f8f4efcd62d8b3 /kaddressbook | |
parent | d91c533ffc42d7bf48fa1326754894b2c30b6831 (diff) | |
download | kdepimpi-259a7a50e4f8138cedfc2004fbde3b37cedcc49f.zip kdepimpi-259a7a50e4f8138cedfc2004fbde3b37cedcc49f.tar.gz kdepimpi-259a7a50e4f8138cedfc2004fbde3b37cedcc49f.tar.bz2 |
support for export of categories und supression of empty fields
-rw-r--r-- | kaddressbook/xxport/opie/opie_xxport.cpp | 16 | ||||
-rw-r--r-- | kaddressbook/xxport/opie/opie_xxportE.pro | 3 |
2 files changed, 15 insertions, 4 deletions
diff --git a/kaddressbook/xxport/opie/opie_xxport.cpp b/kaddressbook/xxport/opie/opie_xxport.cpp index d1def18..8ee0725 100644 --- a/kaddressbook/xxport/opie/opie_xxport.cpp +++ b/kaddressbook/xxport/opie/opie_xxport.cpp | |||
@@ -98,37 +98,47 @@ bool OpieXXPort::exportContacts( const KABC::AddresseeList &list, const QString | |||
98 | if ( fileName.isEmpty() ) | 98 | if ( fileName.isEmpty() ) |
99 | return true; | 99 | return true; |
100 | 100 | ||
101 | OContactAccessBackend_XML* backend = new OContactAccessBackend_XML( "KA/Pi", fileName ); | 101 | OContactAccessBackend_XML* backend = new OContactAccessBackend_XML( "KA/Pi", fileName ); |
102 | OContactAccess* access = new OContactAccess("KA/Pi", 0l, backend, false); | 102 | OContactAccess* access = new OContactAccess("KA/Pi", 0l, backend, false); |
103 | 103 | ||
104 | if ( !access ) { | 104 | if ( !access ) { |
105 | qDebug("Unable to access file() %s", fileName.latin1()); | 105 | qDebug("Unable to access file() %s", fileName.latin1()); |
106 | addressBook()->error( i18n( "Unable to access file '%1'." ).arg( fileName ) ); | 106 | addressBook()->error( i18n( "Unable to access file '%1'." ).arg( fileName ) ); |
107 | return false; | 107 | return false; |
108 | } | 108 | } |
109 | 109 | ||
110 | KABC::OpieConverter mConverter; | ||
111 | |||
112 | bool res = mConverter.init(); | ||
113 | if (!res) | ||
114 | { | ||
115 | QString text( i18n( "Unable to initialize opie converter.<br>Most likely a problem with the category file." ) ); | ||
116 | qDebug(text); | ||
117 | KMessageBox::error( parentWidget(), text ); | ||
118 | delete access; | ||
119 | return false; | ||
120 | } | ||
121 | |||
110 | //Now check if the file has already entries, and ask the user if he wants to delete them first. | 122 | //Now check if the file has already entries, and ask the user if he wants to delete them first. |
111 | OContactAccess::List contactList = access->allRecords(); | 123 | OContactAccess::List contactList = access->allRecords(); |
112 | if (contactList.count() > 0) | 124 | if (contactList.count() > 0) |
113 | { | 125 | { |
114 | QString text( i18n( "Do you want to remove<br>all existing entries from<br>%1<br>before exporting.?" ) ); | 126 | QString text( i18n( "Do you want to remove<br>all existing entries from<br>%1<br>before exporting.?" ) ); |
115 | if ( KMessageBox::questionYesNo( parentWidget(), text.arg( fileName ) ) == KMessageBox::Yes ) { | 127 | if ( KMessageBox::questionYesNo( parentWidget(), text.arg( fileName ) ) == KMessageBox::Yes ) { |
116 | // Clean the database.. | 128 | // Clean the database.. |
117 | access->clear(); | 129 | access->clear(); |
118 | } | 130 | } |
119 | } | 131 | } |
120 | 132 | ||
121 | KABC::OpieConverter mConverter; | ||
122 | bool res; | ||
123 | 133 | ||
124 | KABC::Addressee::List::ConstIterator it; | 134 | KABC::Addressee::List::ConstIterator it; |
125 | for ( it = list.begin(); it != list.end(); ++it ) { | 135 | for ( it = list.begin(); it != list.end(); ++it ) { |
126 | OContact c; | 136 | OContact c; |
127 | KABC::Addressee addressee = (*it); | 137 | KABC::Addressee addressee = (*it); |
128 | 138 | ||
129 | res = mConverter.addresseeToOpie( *it, c ); | 139 | res = mConverter.addresseeToOpie( *it, c ); |
130 | if (res == true) | 140 | if (res == true) |
131 | { | 141 | { |
132 | res = access->add(c); | 142 | res = access->add(c); |
133 | if (res == false) | 143 | if (res == false) |
134 | qDebug("Unable to append Contact %s", c.fullName().latin1()); | 144 | qDebug("Unable to append Contact %s", c.fullName().latin1()); |
diff --git a/kaddressbook/xxport/opie/opie_xxportE.pro b/kaddressbook/xxport/opie/opie_xxportE.pro index a660a48..c373e37 100644 --- a/kaddressbook/xxport/opie/opie_xxportE.pro +++ b/kaddressbook/xxport/opie/opie_xxportE.pro | |||
@@ -1,24 +1,25 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | TARGET = kaddrbk_opie_xxport | 3 | TARGET = kaddrbk_opie_xxport |
4 | 4 | ||
5 | OBJECTS_DIR = obj/$(PLATFORM) | 5 | OBJECTS_DIR = obj/$(PLATFORM) |
6 | MOC_DIR = moc/$(PLATFORM) | 6 | MOC_DIR = moc/$(PLATFORM) |
7 | DESTDIR = $(QPEDIR)/lib | 7 | DESTDIR = $(QPEDIR)/lib |
8 | 8 | ||
9 | DEFINES += KAB_EMBEDDED | 9 | DEFINES += KAB_EMBEDDED |
10 | 10 | ||
11 | INCLUDEPATH += ../.. ../../.. ../../../kabc ../../../kabc/converter/opie ../../../microkde ../../../microkde/kdeui ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../qtcompat $(QPEDIR)/include | 11 | INCLUDEPATH += ../.. ../../.. ../../../kabc ../../../kabc/converter/opie ../../../microkde ../../../microkde/kdeui ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../qtcompat $(OPIEDIR)/include |
12 | LIBS += -L$(QPEDIR)/lib | 12 | LIBS += -L$(QPEDIR)/lib |
13 | LIBS += -L$(OPIEDIR)/lib | ||
13 | LIBS += -lmicrokde | 14 | LIBS += -lmicrokde |
14 | LIBS += -lmicrokabc | 15 | LIBS += -lmicrokabc |
15 | LIBS += -lopie | 16 | LIBS += -lopie |
16 | LIBS += -lqpe | 17 | LIBS += -lqpe |
17 | LIBS += -lqte | 18 | LIBS += -lqte |
18 | LIBS += -lmicrokabc_opieconverter | 19 | LIBS += -lmicrokabc_opieconverter |
19 | 20 | ||
20 | INTERFACES = \ | 21 | INTERFACES = \ |
21 | 22 | ||
22 | HEADERS = \ | 23 | HEADERS = \ |
23 | opie_xxport.h \ | 24 | opie_xxport.h \ |
24 | 25 | ||