author | ulf69 <ulf69> | 2004-07-20 21:28:10 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-07-20 21:28:10 (UTC) |
commit | 6f2ccd235ef49d5606ecf4e540e8884f7a9b7ec4 (patch) (side-by-side diff) | |
tree | 8ce4d24be2dfd04c386665723530435b66701286 /kaddressbook | |
parent | fba0c028ac0ce15d0f7473439e025c56f108145e (diff) | |
download | kdepimpi-6f2ccd235ef49d5606ecf4e540e8884f7a9b7ec4.zip kdepimpi-6f2ccd235ef49d5606ecf4e540e8884f7a9b7ec4.tar.gz kdepimpi-6f2ccd235ef49d5606ecf4e540e8884f7a9b7ec4.tar.bz2 |
remove the export was successfull dialog if the user canceled the operation
-rw-r--r-- | kaddressbook/xxport/csv_xxport.cpp | 6 | ||||
-rw-r--r-- | kaddressbook/xxport/opie/opie_xxport.cpp | 54 | ||||
-rw-r--r-- | kaddressbook/xxport/vcard_xxport.cpp | 30 |
3 files changed, 45 insertions, 45 deletions
diff --git a/kaddressbook/xxport/csv_xxport.cpp b/kaddressbook/xxport/csv_xxport.cpp index caee66d..d4d5475 100644 --- a/kaddressbook/xxport/csv_xxport.cpp +++ b/kaddressbook/xxport/csv_xxport.cpp @@ -115,5 +115,5 @@ bool CSVXXPort::exportContacts( const KABC::AddresseeList &list, const QString& return true; } - + #else //KAB_EMBEDDED @@ -121,5 +121,5 @@ bool CSVXXPort::exportContacts( const KABC::AddresseeList &list, const QString& if ( fileName.isEmpty() ) - return true; + return false; QFile file( fileName ); @@ -137,5 +137,5 @@ bool CSVXXPort::exportContacts( const KABC::AddresseeList &list, const QString& #endif //KAB_EMBEDDED - + } diff --git a/kaddressbook/xxport/opie/opie_xxport.cpp b/kaddressbook/xxport/opie/opie_xxport.cpp index db30d34..c9b0163 100644 --- a/kaddressbook/xxport/opie/opie_xxport.cpp +++ b/kaddressbook/xxport/opie/opie_xxport.cpp @@ -89,5 +89,5 @@ bool OpieXXPort::exportContacts( const KABC::AddresseeList &list, const QString { QString name = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml"; - + #ifndef KAB_EMBEDDED QString fileName = KFileDialog::getSaveFileName( name ); @@ -95,11 +95,11 @@ bool OpieXXPort::exportContacts( const KABC::AddresseeList &list, const QString QString fileName = KFileDialog::getSaveFileName( name, i18n("Save file"), parentWidget() ); #endif //KAB_EMBEDDED - + if ( fileName.isEmpty() ) - return true; + return false; OContactAccessBackend_XML* backend = new OContactAccessBackend_XML( "KA/Pi", fileName ); OContactAccess* access = new OContactAccess("KA/Pi", 0l, backend, false); - + if ( !access ) { qDebug("Unable to access file() %s", fileName.latin1()); @@ -109,5 +109,5 @@ bool OpieXXPort::exportContacts( const KABC::AddresseeList &list, const QString KABC::OpieConverter mConverter; - + bool res = mConverter.init(); if (!res) @@ -117,7 +117,7 @@ bool OpieXXPort::exportContacts( const KABC::AddresseeList &list, const QString KMessageBox::error( parentWidget(), text ); delete access; - return false; + return false; } - + //Now check if the file has already entries, and ask the user if he wants to delete them first. OContactAccess::List contactList = access->allRecords(); @@ -130,11 +130,11 @@ bool OpieXXPort::exportContacts( const KABC::AddresseeList &list, const QString } } - - + + KABC::Addressee::List::ConstIterator it; for ( it = list.begin(); it != list.end(); ++it ) { OContact c; KABC::Addressee addressee = (*it); - + res = mConverter.addresseeToOpie( *it, c ); if (res == true) @@ -149,10 +149,10 @@ bool OpieXXPort::exportContacts( const KABC::AddresseeList &list, const QString } } - + access->save(); delete access; //US the deletion of the access object deletes the backend object as well. - + return true; } @@ -161,7 +161,7 @@ KABC::AddresseeList OpieXXPort::importContacts( const QString& ) const { KABC::AddresseeList adrlst; - + QString name = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml"; - + #ifndef KAB_EMBEDDED QString fileName = KFileDialog::getOpenFileName( name ); @@ -169,5 +169,5 @@ KABC::AddresseeList OpieXXPort::importContacts( const QString& ) const QString fileName = KFileDialog::getOpenFileName( name, i18n("Load file"), parentWidget() ); #endif //KAB_EMBEDDED - + if ( fileName.isEmpty() ) return KABC::AddresseeList(); @@ -175,5 +175,5 @@ KABC::AddresseeList OpieXXPort::importContacts( const QString& ) const OContactAccessBackend_XML* backend = new OContactAccessBackend_XML( "KA/Pi", fileName ); OContactAccess* access = new OContactAccess("KA/Pi", 0l, backend, false); - + if ( !access ) { qDebug("Unable to access file() %s", fileName.latin1()); @@ -183,5 +183,5 @@ KABC::AddresseeList OpieXXPort::importContacts( const QString& ) const access -> setReadAhead( 32 ); // Use ReadAhead-Cache if available - + KABC::OpieConverter mConverter; @@ -195,6 +195,6 @@ KABC::AddresseeList OpieXXPort::importContacts( const QString& ) const return KABC::AddresseeList(); } - - + + OContactAccess::List::Iterator it; OContactAccess::List allList = access->allRecords(); @@ -202,20 +202,20 @@ KABC::AddresseeList OpieXXPort::importContacts( const QString& ) const { OContact c = (*it); - + KABC::Addressee addressee; - - res = mConverter.opieToAddressee( c, addressee ); - + + res = mConverter.opieToAddressee( c, addressee ); + if ( !addressee.isEmpty() && res ) { adrlst.append( addressee ); } - + // qDebug("found %s", c.fullName().latin1()); } - + delete access; //US the deletion of the access object deletes the backend object as well. - + return adrlst; - + } diff --git a/kaddressbook/xxport/vcard_xxport.cpp b/kaddressbook/xxport/vcard_xxport.cpp index adf47cd..4819341 100644 --- a/kaddressbook/xxport/vcard_xxport.cpp +++ b/kaddressbook/xxport/vcard_xxport.cpp @@ -91,5 +91,5 @@ bool VCardXXPort::exportContacts( const KABC::AddresseeList &list, const QString else name = "addressbook.vcf"; - + #ifndef KAB_EMBEDDED QString fileName = KFileDialog::getSaveFileName( name ); @@ -97,7 +97,7 @@ bool VCardXXPort::exportContacts( const KABC::AddresseeList &list, const QString QString fileName = KFileDialog::getSaveFileName( name, i18n("Save file"), parentWidget() ); #endif //KAB_EMBEDDED - + if ( fileName.isEmpty() ) - return true; + return false; QFile outFile( fileName ); @@ -169,11 +169,11 @@ KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const KMessageBox::error( parentWidget(), text.arg( url.url() ), caption ); } - + } - + #else //KAB_EMBEDDED - - + + if ( !XXPortManager::importData.isEmpty() ) addrList = parseVCard( XXPortManager::importData ); @@ -184,5 +184,5 @@ KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const if ( fileName.isEmpty() ) return addrList; - + } else @@ -192,8 +192,8 @@ KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const if ( url.isEmpty() ) return addrList; - + } - + QFile file( fileName ); @@ -204,14 +204,14 @@ KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const QString data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); addrList = parseVCard( data ); - + } -#endif //KAB_EMBEDDED - +#endif //KAB_EMBEDDED + return addrList; } KABC::AddresseeList VCardXXPort::parseVCard( const QString &data ) const -{ - +{ + KABC::VCardTool tool; KABC::AddresseeList addrList; |