summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/xxport/csv_xxport.cpp2
-rw-r--r--kaddressbook/xxport/opie/opie_xxport.cpp2
-rw-r--r--kaddressbook/xxport/vcard_xxport.cpp2
3 files changed, 3 insertions, 3 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
@@ -99,49 +99,49 @@ bool CSVXXPort::exportContacts( const KABC::AddresseeList &list, const QString&
doExport( tmpFile.file(), list );
tmpFile.close();
return KIO::NetAccess::upload( tmpFile.name(), url, parentWidget() );
} else {
QFile file( url.path() );
if ( !file.open( IO_WriteOnly ) ) {
QString txt = i18n( "<qt>Unable to open file <b>%1</b>.</qt>" );
KMessageBox::error( parentWidget(), txt.arg( url.path() ) );
return false;
}
doExport( &file, list );
file.close();
return true;
}
#else //KAB_EMBEDDED
QString fileName = KFileDialog::getSaveFileName( "addressbook.csv", i18n("Save file"), parentWidget() );
if ( fileName.isEmpty() )
- return true;
+ return false;
QFile file( fileName );
if ( !file.open( IO_WriteOnly ) ) {
QString txt = i18n( "<qt>Unable to open file <b>%1</b>.</qt>" );
KMessageBox::error( parentWidget(), txt.arg( fileName ) );
return false;
}
doExport( &file, list );
file.close();
return true;
#endif //KAB_EMBEDDED
}
KABC::AddresseeList CSVXXPort::importContacts( const QString& ) const
{
CSVImportDialog dlg( addressBook(), parentWidget() );
if ( dlg.exec() )
return dlg.contacts();
else
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
@@ -75,49 +75,49 @@ extern "C"
{
return ( new OpieXXPortFactory() );
}
}
OpieXXPort::OpieXXPort( KABC::AddressBook *ab, QWidget *parent, const char *name )
: XXPortObject( ab, parent, name )
{
createImportAction( i18n( "Import Opie..." ) );
createExportAction( i18n( "Export Opie..." ) );
}
bool OpieXXPort::exportContacts( const KABC::AddresseeList &list, const QString &data )
{
QString name = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml";
#ifndef KAB_EMBEDDED
QString fileName = KFileDialog::getSaveFileName( name );
#else //KAB_EMBEDDED
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());
addressBook()->error( i18n( "Unable to access file '%1'." ).arg( fileName ) );
return false;
}
KABC::OpieConverter mConverter;
bool res = mConverter.init();
if (!res)
{
QString text( i18n( "Unable to initialize opie converter.<br>Most likely a problem with the category file." ) );
qDebug(text);
KMessageBox::error( parentWidget(), text );
delete access;
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();
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
@@ -77,49 +77,49 @@ VCardXXPort::VCardXXPort( KABC::AddressBook *ab, QWidget *parent, const char *na
: XXPortObject( ab, parent, name )
{
createImportAction( i18n( "Import vCard..." ) );
//US KABC::VCardConverter does not support the export of 2.1 addressbooks.
//US createExportAction( i18n( "Export vCard 2.1..." ), "v21" );
createExportAction( i18n( "Export vCard 3.0..." ), "v30" );
}
bool VCardXXPort::exportContacts( const KABC::AddresseeList &list, const QString &data )
{
QString name;
if ( list.count() == 1 )
name = list[ 0 ].givenName() + "_" + list[ 0 ].familyName() + ".vcf";
else
name = "addressbook.vcf";
#ifndef KAB_EMBEDDED
QString fileName = KFileDialog::getSaveFileName( name );
#else //KAB_EMBEDDED
QString fileName = KFileDialog::getSaveFileName( name, i18n("Save file"), parentWidget() );
#endif //KAB_EMBEDDED
if ( fileName.isEmpty() )
- return true;
+ return false;
QFile outFile( fileName );
if ( !outFile.open( IO_WriteOnly ) ) {
QString text = i18n( "<qt>Unable to open file <b>%1</b> for export.</qt>" );
KMessageBox::error( parentWidget(), text.arg( fileName ) );
return false;
}
QTextStream t( &outFile );
t.setEncoding( QTextStream::UnicodeUTF8 );
KABC::Addressee::List::ConstIterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
KABC::VCardConverter converter;
QString vcard;
KABC::VCardConverter::Version version;
if ( data == "v21" )
version = KABC::VCardConverter::v2_1;
else
version = KABC::VCardConverter::v3_0;
converter.addresseeToVCard( *it, vcard, version );
t << vcard << "\r\n\r\n";