summaryrefslogtreecommitdiffabout
path: root/kaddressbook/xxport/vcard_xxport.cpp
Unidiff
Diffstat (limited to 'kaddressbook/xxport/vcard_xxport.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/xxport/vcard_xxport.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/kaddressbook/xxport/vcard_xxport.cpp b/kaddressbook/xxport/vcard_xxport.cpp
index acf6419..3079d42 100644
--- a/kaddressbook/xxport/vcard_xxport.cpp
+++ b/kaddressbook/xxport/vcard_xxport.cpp
@@ -100,48 +100,49 @@ bool VCardXXPort::exportContacts( const KABC::AddresseeList &list, const QString
100 if ( fileName.isEmpty() ) 100 if ( fileName.isEmpty() )
101 return false; 101 return false;
102 102
103 QFile outFile( fileName ); 103 QFile outFile( fileName );
104 if ( !outFile.open( IO_WriteOnly ) ) { 104 if ( !outFile.open( IO_WriteOnly ) ) {
105 QString text = i18n( "<qt>Unable to open file <b>%1</b> for export.</qt>" ); 105 QString text = i18n( "<qt>Unable to open file <b>%1</b> for export.</qt>" );
106 KMessageBox::error( parentWidget(), text.arg( fileName ) ); 106 KMessageBox::error( parentWidget(), text.arg( fileName ) );
107 return false; 107 return false;
108 } 108 }
109 109
110 QTextStream t( &outFile ); 110 QTextStream t( &outFile );
111 t.setEncoding( QTextStream::UnicodeUTF8 ); 111 t.setEncoding( QTextStream::UnicodeUTF8 );
112 112
113 KABC::Addressee::List::ConstIterator it; 113 KABC::Addressee::List::ConstIterator it;
114 for ( it = list.begin(); it != list.end(); ++it ) { 114 for ( it = list.begin(); it != list.end(); ++it ) {
115 KABC::VCardConverter converter; 115 KABC::VCardConverter converter;
116 QString vcard; 116 QString vcard;
117 117
118 KABC::VCardConverter::Version version; 118 KABC::VCardConverter::Version version;
119 if ( data == "v21" ) 119 if ( data == "v21" )
120 version = KABC::VCardConverter::v2_1; 120 version = KABC::VCardConverter::v2_1;
121 else 121 else
122 version = KABC::VCardConverter::v3_0; 122 version = KABC::VCardConverter::v3_0;
123 123
124 version = KABC::VCardConverter::v2_1;
124 converter.addresseeToVCard( *it, vcard, version ); 125 converter.addresseeToVCard( *it, vcard, version );
125 t << vcard << "\r\n\r\n"; 126 t << vcard << "\r\n\r\n";
126 } 127 }
127 128
128 outFile.close(); 129 outFile.close();
129 130
130 return true; 131 return true;
131} 132}
132 133
133KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const 134KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const
134{ 135{
135 QString fileName; 136 QString fileName;
136 KABC::AddresseeList addrList; 137 KABC::AddresseeList addrList;
137 KURL url; 138 KURL url;
138 139
139#ifndef KAB_EMBEDDED 140#ifndef KAB_EMBEDDED
140 if ( !XXPortManager::importData.isEmpty() ) 141 if ( !XXPortManager::importData.isEmpty() )
141 addrList = parseVCard( XXPortManager::importData ); 142 addrList = parseVCard( XXPortManager::importData );
142 else { 143 else {
143 if ( XXPortManager::importURL.isEmpty() ) 144 if ( XXPortManager::importURL.isEmpty() )
144 { 145 {
145 url = KFileDialog::getLoadFileName( QString::null, i18n("Select vCard to Import"), parentWidget() ); 146 url = KFileDialog::getLoadFileName( QString::null, i18n("Select vCard to Import"), parentWidget() );
146 } 147 }
147 else 148 else