summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-07-09 08:07:47 (UTC)
committer ulf69 <ulf69>2004-07-09 08:07:47 (UTC)
commitd56bb523048598245ac4ffcb16689687e082f831 (patch) (side-by-side diff)
tree6db6859ad1246fec51f7b93b77a16b5afe21f733
parent259a7a50e4f8138cedfc2004fbde3b37cedcc49f (diff)
downloadkdepimpi-d56bb523048598245ac4ffcb16689687e082f831.zip
kdepimpi-d56bb523048598245ac4ffcb16689687e082f831.tar.gz
kdepimpi-d56bb523048598245ac4ffcb16689687e082f831.tar.bz2
export of kde 2.1 vcards is not supported by the converter
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/xxport/vcard_xxport.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/kaddressbook/xxport/vcard_xxport.cpp b/kaddressbook/xxport/vcard_xxport.cpp
index b53f873..adf47cd 100644
--- a/kaddressbook/xxport/vcard_xxport.cpp
+++ b/kaddressbook/xxport/vcard_xxport.cpp
@@ -32,97 +32,98 @@ $Id$
#include <qtextstream.h>
#include <kabc/vcardconverter.h>
#include <kabc/vcardparser/vcardtool.h>
#include <kfiledialog.h>
#ifndef KAB_EMBEDDED
#include <kio/netaccess.h>
#endif //KAB_EMBEDDED
#include <klocale.h>
#include <kmessagebox.h>
#include <ktempfile.h>
#include <kurl.h>
#include "xxportmanager.h"
#include "vcard_xxport.h"
#ifndef KAB_EMBEDDED
class VCardXXPortFactory : public XXPortFactory
{
public:
XXPortObject *xxportObject( KABC::AddressBook *ab, QWidget *parent, const char *name )
{
return new VCardXXPort( ab, parent, name );
}
};
#endif //KAB_EMBEDDED
extern "C"
{
#ifndef KAB_EMBEDDED
void *init_libkaddrbk_vcard_xxport()
#else //KAB_EMBEDDED
void *init_kaddrbk_vcard_xxport()
#endif //KAB_EMBEDDED
{
return ( new VCardXXPortFactory() );
}
}
VCardXXPort::VCardXXPort( KABC::AddressBook *ab, QWidget *parent, const char *name )
: XXPortObject( ab, parent, name )
{
createImportAction( i18n( "Import vCard..." ) );
- createExportAction( i18n( "Export vCard 2.1..." ), "v21" );
+//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;
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";
}
outFile.close();