From cc29364f06178f8f6b457384f2ec37a042bd9d43 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 1 Sep 2010 00:37:02 +0000 Subject: * Massive set of changes to bring in all fixes and enhancements from the Enterprise PIM branch * Ensured that the Trinity changes were applied on top of those enhancements, and any redundancy removed * Added journal read support to the CalDAV resource * Fixed CalDAV resource to use events URL for tasks and journals when separate URL checkbox unchecked git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1170461 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kaddressbook/xxport/bookmark_xxport.desktop | 2 - kaddressbook/xxport/csv_xxport.cpp | 5 ++ kaddressbook/xxport/csv_xxport.desktop | 2 - kaddressbook/xxport/csvimportdialog.cpp | 4 ++ kaddressbook/xxport/eudora_xxport.desktop | 2 - kaddressbook/xxport/gnokii_xxport.desktop | 2 - kaddressbook/xxport/kde2_xxport.cpp | 5 +- kaddressbook/xxport/kde2_xxport.desktop | 5 +- kaddressbook/xxport/ldif_xxport.cpp | 6 +++ kaddressbook/xxport/ldif_xxport.desktop | 2 - kaddressbook/xxport/opera_xxport.desktop | 2 - kaddressbook/xxport/pab_xxport.desktop | 2 - kaddressbook/xxport/vcard_xxport.cpp | 79 ++++++++++++++++++++++++++--- kaddressbook/xxport/vcard_xxport.desktop | 2 - kaddressbook/xxport/vcard_xxport.h | 10 +++- 15 files changed, 100 insertions(+), 30 deletions(-) (limited to 'kaddressbook/xxport') diff --git a/kaddressbook/xxport/bookmark_xxport.desktop b/kaddressbook/xxport/bookmark_xxport.desktop index 54d337162..186d1378e 100644 --- a/kaddressbook/xxport/bookmark_xxport.desktop +++ b/kaddressbook/xxport/bookmark_xxport.desktop @@ -24,7 +24,6 @@ Name[hi]=केएबी पसंदीदा XXपोर्ट प्लग Name[hu]=KAB könyvjelzőkezelő XXPort bővítőmodul Name[is]=Íforrit fyrir KAB XXPort bókarmerki Name[ja]=KAB ブックマーク インポート/エクスポートプラグイン -Name[ka]=KAB სანიშნეების ექსპორტის მოდული Name[kk]=Бетбелгіні экспорт ету Name[km]=កម្មវិធី​ជំនួយ KAB Bookmark XXPort Name[lt]=KAB žymelių XXPort priedas @@ -72,7 +71,6 @@ Comment[hu]=Bővítőmodul webcímek exportáláshoz, könyvjelzőként Comment[is]=Íforrit til að skrá vefföng tengiliða sem bókarmerki Comment[it]=Plugin per esportare come segnalibro gli indirizzi web dei contatti Comment[ja]=連絡先のウェブアドレスをブックマークとしてエクスポートするプラグイン -Comment[ka]= კონტაქტების ვებ-მისამართების სანიშნეებად ექსპორტის მოდული Comment[kk]=Контакттың веб адрестерін бетбелгіге экспорттау модулі Comment[km]=កម្មវិធី​ជំនួយ​ដើម្បី​នាំចេញ​អាសយដ្ឋាន​បណ្ដាញ​របស់​ទំនាក់ទំនង ជា​ចំណាំ Comment[lt]=Priedas skirtas žiniatinklio adresų kontaktuose eksportavimui į žymeles diff --git a/kaddressbook/xxport/csv_xxport.cpp b/kaddressbook/xxport/csv_xxport.cpp index fa4be2c9b..b1ee94047 100644 --- a/kaddressbook/xxport/csv_xxport.cpp +++ b/kaddressbook/xxport/csv_xxport.cpp @@ -49,6 +49,11 @@ bool CSVXXPort::exportContacts( const KABC::AddresseeList &list, const TQString& if ( url.isEmpty() ) return true; + if( TQFileInfo(url.path()).exists() ) { + if(KMessageBox::questionYesNo( parentWidget(), i18n("Do you want to overwrite file \"%1\"").arg( url.path()) ) == KMessageBox::No) + return false; + } + if ( !url.isLocalFile() ) { KTempFile tmpFile; if ( tmpFile.status() != 0 ) { diff --git a/kaddressbook/xxport/csv_xxport.desktop b/kaddressbook/xxport/csv_xxport.desktop index de6a51c42..9031c2226 100644 --- a/kaddressbook/xxport/csv_xxport.desktop +++ b/kaddressbook/xxport/csv_xxport.desktop @@ -24,7 +24,6 @@ Name[hi]=केएबी सीएसवी XXपोर्ट प्लगइन Name[hu]=KAB XXPort bővítőmodul Name[is]=Íforrit fyrir KAV CSV XXPort Name[ja]=KAB CSV インポート/エクスポートプラグイン -Name[ka]=KAB CSV ექსპორტის მოდული Name[kk]=CSV файлды экспорт/импорт ету Name[km]=កម្មវិធី​ជំនួយ KAB CSV XXPort Name[lt]=KAB CSV XXPort priedas @@ -71,7 +70,6 @@ Comment[hu]=Bővítőmodul névjegyek importálásához/exportálásához, CSV f Comment[is]=Íforrit til að flytja tengiliði inn og út í CSV sniði Comment[it]=Plugin per importare ed esportare contatti in formato CSV Comment[ja]=CSV フォーマットで連絡先をインポート/エクスポートするプラグイン -Comment[ka]=კონტაქტების CSV ფორმატით იმპორტ/ექსპორტის მოდული Comment[kk]=Контакттарды CSV пішіміне экспорт/импорт ету модулі Comment[km]=កម្មវិធី ជំនួយ​ដើម្បី​នាំចូល និង​នាំចេញ​ទំនាក់ទំនង​ក្នុង​ទ្រង់ទ្រាយ​ជា CSV ។ Comment[lt]=Priedas, skirtas kontaktų eksportui ir importui CSV formatu diff --git a/kaddressbook/xxport/csvimportdialog.cpp b/kaddressbook/xxport/csvimportdialog.cpp index cfcac0fec..bbcd74d2a 100644 --- a/kaddressbook/xxport/csvimportdialog.cpp +++ b/kaddressbook/xxport/csvimportdialog.cpp @@ -857,6 +857,10 @@ void CSVImportDialog::saveTemplate() if ( !fileName.contains( ".desktop" ) ) fileName += ".desktop"; + if( TQFileInfo(fileName).exists() ) { + if(KMessageBox::questionYesNo( this, i18n("Do you want to overwrite file \"%1\"").arg(fileName) ) == KMessageBox::No) + return; + } TQString name = KInputDialog::getText( i18n( "Template Name" ), i18n( "Please enter a name for the template:" ) ); if ( name.isEmpty() ) diff --git a/kaddressbook/xxport/eudora_xxport.desktop b/kaddressbook/xxport/eudora_xxport.desktop index a075f3f83..10adbfa7e 100644 --- a/kaddressbook/xxport/eudora_xxport.desktop +++ b/kaddressbook/xxport/eudora_xxport.desktop @@ -24,7 +24,6 @@ Name[hi]=केएबी यूडोरा XXपोर्ट प्लगइन Name[hu]=KAB Eudora XXPort bővítőmodul Name[is]=Íforrit fyrir KAB Eudora XXPort Name[ja]=KAB Eudora インポート/エクスポートプラグイン -Name[ka]= KAB Eudora-სთან ექსპორტის მოდული Name[kk]=Eudora-ға экспорт/импорт ету Name[km]=កម្មវិធី​ជំនួយ KAB Eudora XXPort Name[lt]=KAB Eudora XXPort priedas @@ -72,7 +71,6 @@ Comment[hu]=Bővítőmodul Eudora névjegyek importálásához/exportálásához Comment[is]=Íforrit til að flytja inn og út Eudora tengiliði Comment[it]=Plugin importare ed esportare contatti Eudora Comment[ja]=Eudora の連絡先をインポート/エクスポートするプラグイン -Comment[ka]=Eudora-ს კონტაქტების იმპორტ/ექსპორტის მოდული Comment[kk]=Eudora контакттарды экспорт/импорт ету модулі Comment[km]=កម្មវិធី​ជំនួយ​ដើម្បី​នាំចូល និង​នាំចេញ​ទំនាក់ទំនង​របស់ Eudora Comment[lt]=Priedas Eudora kontaktų importui ir eksportui diff --git a/kaddressbook/xxport/gnokii_xxport.desktop b/kaddressbook/xxport/gnokii_xxport.desktop index c937a7d70..e6152fd73 100644 --- a/kaddressbook/xxport/gnokii_xxport.desktop +++ b/kaddressbook/xxport/gnokii_xxport.desktop @@ -24,7 +24,6 @@ Name[hu]=KAB mobiltelefon XXPort bővítőmodul Name[is]=Íforrit fyrir KAB farsíma XXPort Name[it]=Plugin KAB telefono cellulare XXPort Name[ja]=KAB 携帯電話インポート/エクスポートプラグイン -Name[ka]=KAB მობილურ ტელეფონთან ექსპორტის მოდული Name[kk]=Қалта телефонға экспорт/импорт ету Name[km]=កម្មវិធី​ជំនួយ KAB Mobile Phone XXPort Name[lt]=KAB mobilaus telefono XXPort priedas @@ -72,7 +71,6 @@ Comment[hu]=Mobiltelefonos bővítőmodul címbejegyzések importálásához/exp Comment[is]=Íforrit til að færa tengilið milli póstfangaskrár og farsíma Comment[it]=Plugin per importare ed esportare voci della rubrica da un telefono cellulare Comment[ja]=アドレス帳のエントリをインポート/エクスポートする携帯電話用プラグイン -Comment[ka]=მობილური ტელეფონის მოდული წიგნაკის ელემენტების იმპორტ/ექსპორტისათვის Comment[kk]=Қалта телефонға адр. кітапша жазуын экспорт/импорт ету модулі Comment[km]=កម្មវិធី​ជំនួយ​ទូរស័ព្ទ​ចល័ត​ដើម្បី​នាំចូល និង​នាំចេញ​ធាតុ​សៀវភៅ​អាសយដ្ឋាន Comment[lt]=Priedas skirtas importuoti ir eksportuoti adresų knygelės įrašus į mobiliuosius telefonus diff --git a/kaddressbook/xxport/kde2_xxport.cpp b/kaddressbook/xxport/kde2_xxport.cpp index 8e754b39c..92a311023 100644 --- a/kaddressbook/xxport/kde2_xxport.cpp +++ b/kaddressbook/xxport/kde2_xxport.cpp @@ -66,9 +66,10 @@ KABC::AddresseeList KDE2XXPort::importContacts( const TQString& ) const proc << "--override"; } else if ( result == KMessageBox::No ) proc << "kab2kabc"; - else + else { kdDebug(5720) << "KAddressBook::importKDE2(): Unknow return value." << endl; - + return KABC::AddresseeList(); + } proc.start( KProcess::Block ); addressBook()->load(); diff --git a/kaddressbook/xxport/kde2_xxport.desktop b/kaddressbook/xxport/kde2_xxport.desktop index f2c20026c..d47d108f5 100644 --- a/kaddressbook/xxport/kde2_xxport.desktop +++ b/kaddressbook/xxport/kde2_xxport.desktop @@ -25,7 +25,6 @@ Name[hi]=केएबी केडीई2 XXपोर्ट प्लगइन Name[hu]=KAB KDE2 XXPort bővítőmodul Name[is]=Íforrit fyrir KAB KDE2 XXPort Name[ja]=KAB KDE2 インポート/プラグイン -Name[ka]=KAB KDE2-ს ექსპორტის მოდული Name[kk]=KDE2 пішімінен импорт ету Name[km]=កម្មវិធី​ជំនួយ KAB KDE2 XXPort Name[lt]=KAB KDE2 XXPort priedas @@ -73,7 +72,6 @@ Comment[hu]=Bővítőmodul KDE2-es címjegyzék importálásához Comment[is]=Íforrit til að færa inn gömlu KDE2 vistfangaskrána Comment[it]=Plugin per importare le vecchie voci della rubrica di KDE2 Comment[ja]=古い KDE 2 アドレス帳をインポートするプラグイン -Comment[ka]=ძველი KDE2-ს წიგნაკის იმპორტის მოდული Comment[kk]=Ескі KDE2 адр.кітапшасынан импорт ету модулі Comment[km]=កម្មវិធី​ជំនួយ​ដើម្បី​នាំចូល​សៀវភៅ​អាសយដ្ឋាន KDE 2 ចាស់ៗ Comment[lt]=Priedas senosios KDE 2 adresų knygelės importui @@ -97,8 +95,7 @@ Comment[ta]=பழைய KDE 2 கேமுகவரிபுத்தகத் Comment[tg]=Модул барои воридоти файлҳои китобиадресии KDE2 Comment[tr]=KDE 2 adres defteri bilgilerini alma eklentisi Comment[uk]=Втулок для імпорту адресної книги старого формату часів KDE 2 -Comment[uz]=Eski KDE 2 manzillar daftarini import qilish uchun plagin -Comment[uz@cyrillic]=Эски KDE 2 манзиллар дафтарини импорт қилиш учун плагин +Comment[uz]=Эски KDE 2 манзиллар дафтарини импорт қилиш учун плагин Comment[zh_CN]=导入旧的 KDE 2 地址簿的插件 Comment[zh_TW]=匯入舊的 KDE2 通訊錄的外掛程式 Type=Service diff --git a/kaddressbook/xxport/ldif_xxport.cpp b/kaddressbook/xxport/ldif_xxport.cpp index d632d449b..92143c7e2 100644 --- a/kaddressbook/xxport/ldif_xxport.cpp +++ b/kaddressbook/xxport/ldif_xxport.cpp @@ -96,6 +96,12 @@ bool LDIFXXPort::exportContacts( const KABC::AddresseeList &list, const TQString if ( url.isEmpty() ) return true; + if( TQFileInfo(url.path()).exists() ) { + if(KMessageBox::questionYesNo( parentWidget(), i18n("Do you want to overwrite file \"%1\"").arg( url.path()) ) == KMessageBox::No) + return false; + } + + if ( !url.isLocalFile() ) { KTempFile tmpFile; if ( tmpFile.status() != 0 ) { diff --git a/kaddressbook/xxport/ldif_xxport.desktop b/kaddressbook/xxport/ldif_xxport.desktop index abdc10958..1274b4d86 100644 --- a/kaddressbook/xxport/ldif_xxport.desktop +++ b/kaddressbook/xxport/ldif_xxport.desktop @@ -25,7 +25,6 @@ Name[hi]=केएबी एलडीआईएफ XXपोर्ट प्लग Name[hu]=KAB LDIF XXPort bővítőmodul Name[is]=Íforrit fyrir KAB LDIF XXPort Name[ja]=KAB LDIF インポート/エクスポートプラグイン -Name[ka]=KAB LDIF-ის ექსპორტის მოდული Name[kk]=LDIF пішіміне экспорт/импорт ету Name[km]=កម្មវិធី​ជំនួយ KAB LDIF XXPort Name[lt]=KAB LDIF XXPort priedas @@ -74,7 +73,6 @@ Comment[hu]=Bővítőmodul Netscape és Mozilla LDIF formátumú névjegyek impo Comment[is]=Íforrit sem flytur flytja inn eða út tengiliði í Netscape og Mozilla LDIF sniði Comment[it]=Plugin per importare ed esportare contatti in formato Netscape e Mozilla LDIF Comment[ja]=Netscape と Mozilla の LDIF フォーマットで連絡先をインポート/エクスポートするプラグイン -Comment[ka]= Netscape-სა და Mozilla-ს კონტაქტების იმპორტ/ექსპორტის მოდული LDIF ფორმატით Comment[kk]=Netscape пен Mozilla LDIF пішіміне экспорт/импорт ету модулі Comment[km]=កម្មវិធី​ជំនួយ​ដើម្បី​នាំចូល និង​នាំចេញ​ទំនាក់ទំនង​ក្នុង​ទ្រង់ទ្រាយ​ជា Netscape និង Mozilla LDIF Comment[lt]=Priedas, skirtas kontaktų importavimui ir eksportavimui Netscape ir Mozilla LDIFF formatu diff --git a/kaddressbook/xxport/opera_xxport.desktop b/kaddressbook/xxport/opera_xxport.desktop index ddbcff7bf..c1d3c2002 100644 --- a/kaddressbook/xxport/opera_xxport.desktop +++ b/kaddressbook/xxport/opera_xxport.desktop @@ -24,7 +24,6 @@ Name[hi]=केएबी ऑपेरा XXपोर्ट प्लगइन Name[hu]=KAB Opera XXPort bővítőmodul Name[is]=Íforrit fyrir KAP Opera XXPort Name[ja]=KAB Opera インポート/エクスポートプラグイン -Name[ka]=KAB Opera-ს ექსპორტის მოდული Name[kk]=Opera пішіміне экспорт/импорт ету Name[km]=កម្មវិធី​ជំនួយ KAB Opera XXPort Name[lt]=KAB Opera XXPort priedas @@ -72,7 +71,6 @@ Comment[hu]=Bővítőmodul Opera névjegyek importálásához Comment[is]=Íforrit til flytja inn eða út Opera tengiliði Comment[it]=Plugin per importare contatti da Opera Comment[ja]=Opera の連絡先をインポートするプラグイン -Comment[ka]=Opera-ს კონტაქტების იმპორტის მოდული Comment[kk]=Opera контактарын экспорт/импорт ету модулі Comment[km]=កម្មវិធី​ជំនួយ​ដើម្បី​នាំចូល​ទំនាក់ទំនង​របស់ Opera Comment[lt]=Priedas Opera kontaktų importui diff --git a/kaddressbook/xxport/pab_xxport.desktop b/kaddressbook/xxport/pab_xxport.desktop index e35ad24d4..c0af8e3d6 100644 --- a/kaddressbook/xxport/pab_xxport.desktop +++ b/kaddressbook/xxport/pab_xxport.desktop @@ -23,7 +23,6 @@ Name[hi]=केएबी एमएस एक्सचेंज निजी प Name[hu]=KAB XXPort bővítőmodul MS Exchange személyes címjegyzékekhez Name[is]=Íforrit fyrir KAB MS Exchange Personal Addressbook XXPort Name[ja]=KAB MS Exchange パーソナルアドレス帳インポート/エクスポートプラグイン -Name[ka]= MS Exchange-ის პერსონალური წიგნაკის ექსპორტის მოდული Name[kk]=MS Exchange адрестік кітапшасына экспорт/импорт ету Name[km]=កម្មវិធី​ជំនួយ KAB MS Exchange Personal Addressbook XXPort Name[lt]=KAB MS Exchange asmeninės adresų knygelės XXPort priedas @@ -72,7 +71,6 @@ Comment[hu]=Bővítőmodul MS Exchange személyes címjegyzékek importálásáh Comment[is]=Íforrit til að flytja tengiliði í eða úr MS Exchange Personal Address Book Comment[it]=Plugin per importare rubriche personali da MS Exchange Comment[ja]=MS Exchange パーソナルアドレス帳をインポートするプラグイン -Comment[ka]=MS Exchange-ის პერსონალური წიგნაკის იმპორტის მოდული Comment[kk]=MS Exchange адрестік кітапшасына экспорт/импорт ету модулі Comment[km]=កម្មវិធី​ជំនួយ​ដើម្បី​នាំចូល​សៀវភៅ​អាសយដ្ឋាន​ផ្ទាល់​ខ្លួន​របស់ MS Exchange Comment[lt]=Priedas leidžiantis importuoti MS Exchange asmenines adresų knygeles diff --git a/kaddressbook/xxport/vcard_xxport.cpp b/kaddressbook/xxport/vcard_xxport.cpp index 85cf8c763..1dfc9bcc4 100644 --- a/kaddressbook/xxport/vcard_xxport.cpp +++ b/kaddressbook/xxport/vcard_xxport.cpp @@ -118,9 +118,15 @@ bool VCardXXPort::exportContacts( const KABC::AddresseeList &addrList, const TQS return true; if ( data == "v21" ) +#if defined(KABC_VCARD_ENCODING_FIX) + ok = doExport( url, converter.createVCardsRaw( list, KABC::VCardConverter::v2_1 ) ); + else + ok = doExport( url, converter.createVCardsRaw( list, KABC::VCardConverter::v3_0 ) ); +#else ok = doExport( url, converter.createVCards( list, KABC::VCardConverter::v2_1 ) ); else ok = doExport( url, converter.createVCards( list, KABC::VCardConverter::v3_0 ) ); +#endif } else { TQString msg = i18n( "You have selected a list of contacts, shall they be " "exported to several files?" ); @@ -151,10 +157,15 @@ bool VCardXXPort::exportContacts( const KABC::AddresseeList &addrList, const TQS tmpList.append( *it ); if ( data == "v21" ) +#if defined(KABC_VCARD_ENCODING_FIX) + tmpOk = doExport( url, converter.createVCardsRaw( tmpList, KABC::VCardConverter::v2_1 ) ); + else + tmpOk = doExport( url, converter.createVCardsRaw( tmpList, KABC::VCardConverter::v3_0 ) ); +#else tmpOk = doExport( url, converter.createVCards( tmpList, KABC::VCardConverter::v2_1 ) ); else tmpOk = doExport( url, converter.createVCards( tmpList, KABC::VCardConverter::v3_0 ) ); - +#endif ok = ok && tmpOk; } break; @@ -166,9 +177,15 @@ bool VCardXXPort::exportContacts( const KABC::AddresseeList &addrList, const TQS return true; if ( data == "v21" ) +#if defined(KABC_VCARD_ENCODING_FIX) + ok = doExport( url, converter.createVCardsRaw( list, KABC::VCardConverter::v2_1 ) ); + else + ok = doExport( url, converter.createVCardsRaw( list, KABC::VCardConverter::v3_0 ) ); +#else ok = doExport( url, converter.createVCards( list, KABC::VCardConverter::v2_1 ) ); else ok = doExport( url, converter.createVCards( list, KABC::VCardConverter::v3_0 ) ); +#endif } } } @@ -182,9 +199,14 @@ KABC::AddresseeList VCardXXPort::importContacts( const TQString& ) const KABC::AddresseeList addrList; KURL::List urls; - if ( !XXPortManager::importData.isEmpty() ) + if ( !XXPortManager::importData.isEmpty() ) { +#if defined(KABC_VCARD_ENCODING_FIX) + TQCString data = XXPortManager::importData.ascii(); + addrList = parseVCard( data ); +#else addrList = parseVCard( XXPortManager::importData ); - else { +#endif + } else { if ( XXPortManager::importURL.isEmpty() ) urls = KFileDialog::getOpenURLs( TQString::null, "*.vcf|vCards", parentWidget(), i18n( "Select vCard to Import" ) ); @@ -203,11 +225,28 @@ KABC::AddresseeList VCardXXPort::importContacts( const TQString& ) const TQFile file( fileName ); if ( file.open( IO_ReadOnly ) ) { +#if defined(KABC_VCARD_ENCODING_FIX) + TQByteArray data = file.readAll(); + file.close(); + if ( data.size() > 0 ) + addrList += parseVCard( data ); +#else TQByteArray rawData = file.readAll(); file.close(); - if ( rawData.size() > 0 ) - addrList += parseVCard( rawData ); - + if ( rawData.size() > 0 ) { + + TQString vCardText; + + // With version 3.0, vCards are encoded with UTF-8 by default. Otherwise, use fromLatin1() + // and hope that are fields are encoded correctly. + if ( TQString::fromLatin1( rawData ).lower().contains( "version:3.0" ) ) { + vCardText = TQString::fromUtf8( rawData ); + } else { + vCardText = TQString::fromLatin1( rawData ); + } + addrList += parseVCard( vCardText ); + } +#endif KIO::NetAccess::removeTempFile( fileName ); } else { TQString text = i18n( "When trying to read the vCard, there was an error opening the file '%1': %2" ); @@ -243,6 +282,29 @@ KABC::AddresseeList VCardXXPort::importContacts( const TQString& ) const return addrList; } +#if defined(KABC_VCARD_ENCODING_FIX) +KABC::AddresseeList VCardXXPort::parseVCard( const TQByteArray &data ) const +{ + KABC::VCardConverter converter; + + return converter.parseVCardsRaw( data.data() ); +} + +bool VCardXXPort::doExport( const KURL &url, const TQByteArray &data ) +{ + if( TQFileInfo(url.path()).exists() ) { + if(KMessageBox::questionYesNo( parentWidget(), i18n("Do you want to overwrite file \"%1\"").arg( url.path()) ) == KMessageBox::No) + return false; + } + KTempFile tmpFile; + tmpFile.setAutoDelete( true ); + + tmpFile.file()->writeBlock( data.data(), data.size() ); + tmpFile.close(); + + return KIO::NetAccess::upload( tmpFile.name(), url, parentWidget() ); +} +#else KABC::AddresseeList VCardXXPort::parseVCard( const TQString &data ) const { KABC::VCardConverter converter; @@ -252,6 +314,10 @@ KABC::AddresseeList VCardXXPort::parseVCard( const TQString &data ) const bool VCardXXPort::doExport( const KURL &url, const TQString &data ) { + if( TQFileInfo(url.path()).exists() ) { + if(KMessageBox::questionYesNo( parentWidget(), i18n("Do you want to overwrite file \"%1\"").arg( url.path()) ) == KMessageBox::No) + return false; + } KTempFile tmpFile; tmpFile.setAutoDelete( true ); @@ -263,6 +329,7 @@ bool VCardXXPort::doExport( const KURL &url, const TQString &data ) return KIO::NetAccess::upload( tmpFile.name(), url, parentWidget() ); } +#endif KABC::AddresseeList VCardXXPort::filterContacts( const KABC::AddresseeList &addrList ) { diff --git a/kaddressbook/xxport/vcard_xxport.desktop b/kaddressbook/xxport/vcard_xxport.desktop index d0a0146a2..0745d5a52 100644 --- a/kaddressbook/xxport/vcard_xxport.desktop +++ b/kaddressbook/xxport/vcard_xxport.desktop @@ -25,7 +25,6 @@ Name[hi]=केएबी वी-कार्डXXपोर्ट प्लगइ Name[hu]=KAB vCard XXPort bővítőmodul Name[is]=Íforrit fyrir KAB vCard XXPort Name[ja]=KAB vCazrd インポート/エクスポートプラグイン -Name[ka]=KAB vCard ექსპორტის მოდული Name[kk]=vCard-ты экспорт/импорт ету Name[km]=កម្មវិធី​ជំនួយ KAB vCard XXPort Name[lt]=KAB vCard XXPort priedas @@ -74,7 +73,6 @@ Comment[hu]=Bővítőmodul vCard névjegyek importálásához/exportálásához Comment[is]=Íforrit til að flytja inn eða út tengiliði í vCard sniði Comment[it]=Plugin per importare ed esportare contatti in formato vCard Comment[ja]=vCard フォーマットで連絡先をインポート/エクスポートするプラグイン -Comment[ka]=კონტაქტების vCard-ის ფორმატით იმპორტ/ექსპორტის მოდული Comment[kk]=vCard пішіміне экспорт/импорт ету модулі Comment[km]=កម្មវិធី​ជំនួយ​ដើម្បី​នាំចូល និង​នាំចេញ​ទំនាក់ទំនង​ក្នុង​ទ្រង់ទ្រាយ​ជា vCard Comment[lt]=Įskiepis kontaktų importavimui ir eksportavimui vCard formatu diff --git a/kaddressbook/xxport/vcard_xxport.h b/kaddressbook/xxport/vcard_xxport.h index 8208e23c6..191d37a39 100644 --- a/kaddressbook/xxport/vcard_xxport.h +++ b/kaddressbook/xxport/vcard_xxport.h @@ -25,6 +25,7 @@ #define VCARD_XXPORT_H #include +#include // for KABC_VCARD_ENCODING_FIX define class VCardXXPort : public KAB::XXPort { @@ -40,8 +41,13 @@ class VCardXXPort : public KAB::XXPort KABC::AddresseeList importContacts( const TQString &data ) const; private: - KABC::AddresseeList parseVCard( const TQString &data ) const; - bool doExport( const KURL &url, const TQString &data ); +#if defined(KABC_VCARD_ENCODING_FIX) + KABC::AddresseeList parseVCard( const TQByteArray &data ) const; + bool doExport( const KURL &url, const TQByteArray &data ); +#else + KABC::AddresseeList parseVCard( const TQString &data ) const; + bool doExport( const KURL &url, const TQString &data ); +#endif void addKey( KABC::Addressee &addr, KABC::Key::Types type ); KABC::AddresseeList filterContacts( const KABC::AddresseeList& ); -- cgit v1.2.1