-rw-r--r-- | kaddressbook/xxport/opie/opie_xxport.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/kaddressbook/xxport/opie/opie_xxport.cpp b/kaddressbook/xxport/opie/opie_xxport.cpp index 90d05cd..f30a205 100644 --- a/kaddressbook/xxport/opie/opie_xxport.cpp +++ b/kaddressbook/xxport/opie/opie_xxport.cpp | |||
@@ -31,12 +31,14 @@ $Id$ | |||
31 | #include <qdir.h> | 31 | #include <qdir.h> |
32 | 32 | ||
33 | #include <kfiledialog.h> | 33 | #include <kfiledialog.h> |
34 | #include <kmessagebox.h> | 34 | #include <kmessagebox.h> |
35 | 35 | ||
36 | #include <opie/ocontactaccess.h> | 36 | #include <opie/ocontactaccess.h> |
37 | #include <opie/ocontactaccessbackend_xml.h> | ||
38 | |||
37 | #include "stdaddressbook.h" | 39 | #include "stdaddressbook.h" |
38 | 40 | ||
39 | /*US | 41 | /*US |
40 | #include <qfile.h> | 42 | #include <qfile.h> |
41 | #include <qtextstream.h> | 43 | #include <qtextstream.h> |
42 | 44 | ||
@@ -93,13 +95,14 @@ bool OpieXXPort::exportContacts( const KABC::AddresseeList &list, const QString | |||
93 | QString fileName = KFileDialog::getSaveFileName( name, i18n("Save file"), parentWidget() ); | 95 | QString fileName = KFileDialog::getSaveFileName( name, i18n("Save file"), parentWidget() ); |
94 | #endif //KAB_EMBEDDED | 96 | #endif //KAB_EMBEDDED |
95 | 97 | ||
96 | if ( fileName.isEmpty() ) | 98 | if ( fileName.isEmpty() ) |
97 | return true; | 99 | return true; |
98 | 100 | ||
99 | OContactAccess* access = new OContactAccess("KA/Pi", fileName, 0l, false); | 101 | OContactAccessBackend_XML* backend = new OContactAccessBackend_XML( "KA/Pi", fileName ); |
102 | OContactAccess* access = new OContactAccess("KA/Pi", 0l, backend, false); | ||
100 | 103 | ||
101 | if ( !access ) { | 104 | if ( !access ) { |
102 | qDebug("Unable to access file() %s", fileName.latin1()); | 105 | qDebug("Unable to access file() %s", fileName.latin1()); |
103 | addressBook()->error( i18n( "Unable to access file '%1'." ).arg( fileName ) ); | 106 | addressBook()->error( i18n( "Unable to access file '%1'." ).arg( fileName ) ); |
104 | return false; | 107 | return false; |
105 | } | 108 | } |
@@ -136,13 +139,14 @@ bool OpieXXPort::exportContacts( const KABC::AddresseeList &list, const QString | |||
136 | } | 139 | } |
137 | } | 140 | } |
138 | 141 | ||
139 | access->save(); | 142 | access->save(); |
140 | 143 | ||
141 | delete access; | 144 | delete access; |
142 | 145 | delete backend; | |
146 | |||
143 | return true; | 147 | return true; |
144 | } | 148 | } |
145 | 149 | ||
146 | KABC::AddresseeList OpieXXPort::importContacts( const QString& ) const | 150 | KABC::AddresseeList OpieXXPort::importContacts( const QString& ) const |
147 | { | 151 | { |
148 | KABC::AddresseeList adrlst; | 152 | KABC::AddresseeList adrlst; |
@@ -155,13 +159,14 @@ KABC::AddresseeList OpieXXPort::importContacts( const QString& ) const | |||
155 | QString fileName = KFileDialog::getOpenFileName( name, i18n("Load file"), parentWidget() ); | 159 | QString fileName = KFileDialog::getOpenFileName( name, i18n("Load file"), parentWidget() ); |
156 | #endif //KAB_EMBEDDED | 160 | #endif //KAB_EMBEDDED |
157 | 161 | ||
158 | if ( fileName.isEmpty() ) | 162 | if ( fileName.isEmpty() ) |
159 | return KABC::AddresseeList(); | 163 | return KABC::AddresseeList(); |
160 | 164 | ||
161 | OContactAccess* access = new OContactAccess("KA/Pi", fileName, 0l, false); | 165 | OContactAccessBackend_XML* backend = new OContactAccessBackend_XML( "KA/Pi", fileName ); |
166 | OContactAccess* access = new OContactAccess("KA/Pi", 0l, backend, false); | ||
162 | 167 | ||
163 | if ( !access ) { | 168 | if ( !access ) { |
164 | qDebug("Unable to access file() %s", fileName.latin1()); | 169 | qDebug("Unable to access file() %s", fileName.latin1()); |
165 | addressBook()->error( i18n( "Unable to access file '%1'." ).arg( fileName ) ); | 170 | addressBook()->error( i18n( "Unable to access file '%1'." ).arg( fileName ) ); |
166 | return KABC::AddresseeList(); | 171 | return KABC::AddresseeList(); |
167 | } | 172 | } |
@@ -187,10 +192,11 @@ KABC::AddresseeList OpieXXPort::importContacts( const QString& ) const | |||
187 | } | 192 | } |
188 | 193 | ||
189 | // qDebug("found %s", c.fullName().latin1()); | 194 | // qDebug("found %s", c.fullName().latin1()); |
190 | } | 195 | } |
191 | 196 | ||
192 | delete access; | 197 | delete access; |
198 | delete backend; | ||
193 | 199 | ||
194 | return adrlst; | 200 | return adrlst; |
195 | 201 | ||
196 | } | 202 | } |