author | zautrix <zautrix> | 2004-10-22 10:07:21 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-22 10:07:21 (UTC) |
commit | a97485bb2ff1b4f274d9cf0fba9e2f122297deed (patch) (unidiff) | |
tree | e28b897185c7ee09d6fa22efbb44e6886905a619 /kaddressbook | |
parent | e61ce30fc3f2376d8e9caff421495496344a8359 (diff) | |
download | kdepimpi-a97485bb2ff1b4f274d9cf0fba9e2f122297deed.zip kdepimpi-a97485bb2ff1b4f274d9cf0fba9e2f122297deed.tar.gz kdepimpi-a97485bb2ff1b4f274d9cf0fba9e2f122297deed.tar.bz2 |
fixed vcard export bug
-rw-r--r-- | kaddressbook/xxport/vcard_xxport.cpp | 1 | ||||
-rw-r--r-- | kaddressbook/xxportmanager.cpp | 1 |
2 files changed, 0 insertions, 2 deletions
diff --git a/kaddressbook/xxport/vcard_xxport.cpp b/kaddressbook/xxport/vcard_xxport.cpp index 3079d42..acf6419 100644 --- a/kaddressbook/xxport/vcard_xxport.cpp +++ b/kaddressbook/xxport/vcard_xxport.cpp | |||
@@ -100,49 +100,48 @@ 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; | ||
125 | converter.addresseeToVCard( *it, vcard, version ); | 124 | converter.addresseeToVCard( *it, vcard, version ); |
126 | t << vcard << "\r\n\r\n"; | 125 | t << vcard << "\r\n\r\n"; |
127 | } | 126 | } |
128 | 127 | ||
129 | outFile.close(); | 128 | outFile.close(); |
130 | 129 | ||
131 | return true; | 130 | return true; |
132 | } | 131 | } |
133 | 132 | ||
134 | KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const | 133 | KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const |
135 | { | 134 | { |
136 | QString fileName; | 135 | QString fileName; |
137 | KABC::AddresseeList addrList; | 136 | KABC::AddresseeList addrList; |
138 | KURL url; | 137 | KURL url; |
139 | 138 | ||
140 | #ifndef KAB_EMBEDDED | 139 | #ifndef KAB_EMBEDDED |
141 | if ( !XXPortManager::importData.isEmpty() ) | 140 | if ( !XXPortManager::importData.isEmpty() ) |
142 | addrList = parseVCard( XXPortManager::importData ); | 141 | addrList = parseVCard( XXPortManager::importData ); |
143 | else { | 142 | else { |
144 | if ( XXPortManager::importURL.isEmpty() ) | 143 | if ( XXPortManager::importURL.isEmpty() ) |
145 | { | 144 | { |
146 | url = KFileDialog::getLoadFileName( QString::null, i18n("Select vCard to Import"), parentWidget() ); | 145 | url = KFileDialog::getLoadFileName( QString::null, i18n("Select vCard to Import"), parentWidget() ); |
147 | } | 146 | } |
148 | else | 147 | else |
diff --git a/kaddressbook/xxportmanager.cpp b/kaddressbook/xxportmanager.cpp index 810c3e2..1f0c9ea 100644 --- a/kaddressbook/xxportmanager.cpp +++ b/kaddressbook/xxportmanager.cpp | |||
@@ -141,49 +141,48 @@ void XXPortManager::slotImport( const QString &identifier, const QString &data ) | |||
141 | imported = true; | 141 | imported = true; |
142 | } | 142 | } |
143 | 143 | ||
144 | if ( imported ) { | 144 | if ( imported ) { |
145 | KMessageBox::information( mCore, i18n( "contacts successfully imported." ) ); | 145 | KMessageBox::information( mCore, i18n( "contacts successfully imported." ) ); |
146 | 146 | ||
147 | emit modified(); | 147 | emit modified(); |
148 | } | 148 | } |
149 | } | 149 | } |
150 | 150 | ||
151 | void XXPortManager::slotExport( const QString &identifier, const QString &data ) | 151 | void XXPortManager::slotExport( const QString &identifier, const QString &data ) |
152 | { | 152 | { |
153 | XXPortObject *obj = mXXPortObjects[ identifier ]; | 153 | XXPortObject *obj = mXXPortObjects[ identifier ]; |
154 | if ( !obj ) { | 154 | if ( !obj ) { |
155 | KMessageBox::error( mCore, i18n( "<qt>No export plugin available for <b>%1</b>.</qt>" ).arg( identifier ) ); | 155 | KMessageBox::error( mCore, i18n( "<qt>No export plugin available for <b>%1</b>.</qt>" ).arg( identifier ) ); |
156 | return; | 156 | return; |
157 | } | 157 | } |
158 | 158 | ||
159 | KABC::AddresseeList addrList; | 159 | KABC::AddresseeList addrList; |
160 | XXPortSelectDialog dlg( mCore, obj->requiresSorting(), mCore ); | 160 | XXPortSelectDialog dlg( mCore, obj->requiresSorting(), mCore ); |
161 | if ( dlg.exec() ) | 161 | if ( dlg.exec() ) |
162 | addrList = dlg.contacts(); | 162 | addrList = dlg.contacts(); |
163 | else | 163 | else |
164 | return; | 164 | return; |
165 | |||
166 | if ( !obj->exportContacts( addrList, data ) ) | 165 | if ( !obj->exportContacts( addrList, data ) ) |
167 | KMessageBox::error( mCore, i18n( "Unable to export contacts." ) ); | 166 | KMessageBox::error( mCore, i18n( "Unable to export contacts." ) ); |
168 | else | 167 | else |
169 | KMessageBox::information( mCore, i18n( "contacts successfully exported." ) ); | 168 | KMessageBox::information( mCore, i18n( "contacts successfully exported." ) ); |
170 | } | 169 | } |
171 | 170 | ||
172 | void XXPortManager::loadPlugins() | 171 | void XXPortManager::loadPlugins() |
173 | { | 172 | { |
174 | mXXPortObjects.clear(); | 173 | mXXPortObjects.clear(); |
175 | 174 | ||
176 | #ifndef KAB_EMBEDDED | 175 | #ifndef KAB_EMBEDDED |
177 | KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/XXPort" ); | 176 | KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/XXPort" ); |
178 | KTrader::OfferList::ConstIterator it; | 177 | KTrader::OfferList::ConstIterator it; |
179 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { | 178 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { |
180 | if ( !(*it)->hasServiceType( "KAddressBook/XXPort" ) ) | 179 | if ( !(*it)->hasServiceType( "KAddressBook/XXPort" ) ) |
181 | continue; | 180 | continue; |
182 | 181 | ||
183 | KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() ); | 182 | KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() ); |
184 | if ( !factory ) { | 183 | if ( !factory ) { |
185 | kdDebug(5720) << "XXPortManager::loadExtensions(): Factory creation failed" << endl; | 184 | kdDebug(5720) << "XXPortManager::loadExtensions(): Factory creation failed" << endl; |
186 | continue; | 185 | continue; |
187 | } | 186 | } |
188 | 187 | ||
189 | XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory ); | 188 | XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory ); |