author | zautrix <zautrix> | 2004-10-29 11:23:51 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-29 11:23:51 (UTC) |
commit | 2d28a226645f56a96fe0a8252e0d7e7b2cc4df2e (patch) (unidiff) | |
tree | 183624f038dc3176e89db748f25b024aa75b6365 | |
parent | 67146a3d92727f6fe3e92eacdb51da58bc7b0adf (diff) | |
download | kdepimpi-2d28a226645f56a96fe0a8252e0d7e7b2cc4df2e.zip kdepimpi-2d28a226645f56a96fe0a8252e0d7e7b2cc4df2e.tar.gz kdepimpi-2d28a226645f56a96fe0a8252e0d7e7b2cc4df2e.tar.bz2 |
added filedialog to xml im/export
-rw-r--r-- | kabc/plugins/qtopia/resourceqtopia.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/xxport/qtopia_xxport.cpp | 16 | ||||
-rw-r--r-- | kaddressbook/xxportobject.cpp | 9 |
3 files changed, 19 insertions, 8 deletions
diff --git a/kabc/plugins/qtopia/resourceqtopia.cpp b/kabc/plugins/qtopia/resourceqtopia.cpp index d6df981..cf6b11a 100644 --- a/kabc/plugins/qtopia/resourceqtopia.cpp +++ b/kabc/plugins/qtopia/resourceqtopia.cpp | |||
@@ -163,7 +163,7 @@ bool ResourceQtopia::load() | |||
163 | QDomDocument doc("mydocument" ); | 163 | QDomDocument doc("mydocument" ); |
164 | if ( !doc.setContent( &file ) ) { | 164 | if ( !doc.setContent( &file ) ) { |
165 | file.close(); | 165 | file.close(); |
166 | return false; | 166 | return true; |
167 | } | 167 | } |
168 | bool res; | 168 | bool res; |
169 | QDomElement docElem = doc.documentElement( ); | 169 | QDomElement docElem = doc.documentElement( ); |
diff --git a/kaddressbook/xxport/qtopia_xxport.cpp b/kaddressbook/xxport/qtopia_xxport.cpp index 0cf6546..fc4abbb 100644 --- a/kaddressbook/xxport/qtopia_xxport.cpp +++ b/kaddressbook/xxport/qtopia_xxport.cpp | |||
@@ -33,6 +33,7 @@ $Id$ | |||
33 | #include "addressee.h" | 33 | #include "addressee.h" |
34 | #include "xxportmanager.h" | 34 | #include "xxportmanager.h" |
35 | #include "qtopia_xxport.h" | 35 | #include "qtopia_xxport.h" |
36 | #include <kfiledialog.h> | ||
36 | 37 | ||
37 | /*US | 38 | /*US |
38 | class QtopiaXXPortFactory : public XXPortFactory | 39 | class QtopiaXXPortFactory : public XXPortFactory |
@@ -62,17 +63,24 @@ QtopiaXXPort::QtopiaXXPort( KABC::AddressBook *ab, QWidget *parent, const char * | |||
62 | 63 | ||
63 | if ( mFactory && !mFactory->typeName( "qtopia" ).isEmpty() ) | 64 | if ( mFactory && !mFactory->typeName( "qtopia" ).isEmpty() ) |
64 | { | 65 | { |
65 | createImportAction( i18n( "Import Qtopia..." ) ); | 66 | createImportAction( i18n( "Import xml (Qtopia)..." ) ); |
66 | createExportAction( i18n( "Export Qtopia..." ) ); | 67 | createExportAction( i18n( "Export xml (Qtopia)..." ) ); |
67 | } | 68 | } |
68 | } | 69 | } |
69 | 70 | ||
70 | bool QtopiaXXPort::exportContacts( const KABC::AddresseeList &list, const QString &identifier ) | 71 | bool QtopiaXXPort::exportContacts( const KABC::AddresseeList &list, const QString &identifier ) |
71 | { | 72 | { |
72 | return _exportContacts( list, identifier, defaultFileName ); | 73 | QString fn =KFileDialog::getSaveFileName( defaultFileName, i18n("Import xml file"), 0 ); |
74 | if ( fn == "" ) | ||
75 | return false; | ||
76 | |||
77 | return _exportContacts( list, identifier, fn ); | ||
73 | } | 78 | } |
74 | 79 | ||
75 | KABC::AddresseeList QtopiaXXPort::importContacts( const QString &identifier ) const | 80 | KABC::AddresseeList QtopiaXXPort::importContacts( const QString &identifier ) const |
76 | { | 81 | { |
77 | return _importContacts( identifier, defaultFileName ); | 82 | QString fn =KFileDialog::getOpenFileName( defaultFileName, i18n("Import xml file"), 0 ); |
83 | if ( fn == "" ) | ||
84 | return KABC::AddresseeList() ; | ||
85 | return _importContacts( identifier, fn ); | ||
78 | } | 86 | } |
diff --git a/kaddressbook/xxportobject.cpp b/kaddressbook/xxportobject.cpp index 67e8406..bd9d986 100644 --- a/kaddressbook/xxportobject.cpp +++ b/kaddressbook/xxportobject.cpp | |||
@@ -29,6 +29,7 @@ $Id$ | |||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <qmap.h> | 31 | #include <qmap.h> |
32 | #include <qfile.h> | ||
32 | #include <qsignalmapper.h> | 33 | #include <qsignalmapper.h> |
33 | 34 | ||
34 | #include <kaction.h> | 35 | #include <kaction.h> |
@@ -181,8 +182,10 @@ bool XXPortResourceObject::_exportContacts( const KABC::AddresseeList &list, con | |||
181 | if (mResource == 0) | 182 | if (mResource == 0) |
182 | return false; | 183 | return false; |
183 | 184 | ||
184 | if (fileName != QString::null) | 185 | if (fileName != QString::null) { |
185 | mResource->setFileName( fileName ); | 186 | mResource->setFileName( fileName ); |
187 | } else | ||
188 | return false; | ||
186 | 189 | ||
187 | 190 | ||
188 | KABC::TmpAddressBook tmpAB; | 191 | KABC::TmpAddressBook tmpAB; |
@@ -193,7 +196,7 @@ bool XXPortResourceObject::_exportContacts( const KABC::AddresseeList &list, con | |||
193 | delete mResource; | 196 | delete mResource; |
194 | return false; | 197 | return false; |
195 | } | 198 | } |
196 | 199 | if ( QFile::exists ( fileName ) ) { | |
197 | res = tmpAB.load(); | 200 | res = tmpAB.load(); |
198 | if (res == false) | 201 | if (res == false) |
199 | { | 202 | { |
@@ -212,7 +215,7 @@ bool XXPortResourceObject::_exportContacts( const KABC::AddresseeList &list, con | |||
212 | tmpAB.clear(); | 215 | tmpAB.clear(); |
213 | } | 216 | } |
214 | } | 217 | } |
215 | 218 | } | |
216 | 219 | ||
217 | KABC::Addressee::List::ConstIterator it; | 220 | KABC::Addressee::List::ConstIterator it; |
218 | for ( it = list.begin(); it != list.end(); ++it ) { | 221 | for ( it = list.begin(); it != list.end(); ++it ) { |