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 --- libkdepim/kvcarddrag.cpp | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'libkdepim/kvcarddrag.cpp') diff --git a/libkdepim/kvcarddrag.cpp b/libkdepim/kvcarddrag.cpp index 2008f7a92..b8057367a 100644 --- a/libkdepim/kvcarddrag.cpp +++ b/libkdepim/kvcarddrag.cpp @@ -25,8 +25,11 @@ static const char vcard_mime_string[] = "text/x-vcard"; -KVCardDrag::KVCardDrag( const TQString &content, TQWidget *dragsource, - const char *name ) +#if defined(KABC_VCARD_ENCODING_FIX) +KVCardDrag::KVCardDrag( const TQByteArray &content, TQWidget *dragsource, const char *name ) +#else +KVCardDrag::KVCardDrag( const TQString &content, TQWidget *dragsource, const char *name ) +#endif : TQStoredDrag( vcard_mime_string, dragsource, name ) { setVCard( content ); @@ -35,28 +38,60 @@ KVCardDrag::KVCardDrag( const TQString &content, TQWidget *dragsource, KVCardDrag::KVCardDrag( TQWidget *dragsource, const char *name ) : TQStoredDrag( vcard_mime_string, dragsource, name ) { +#if defined(KABC_VCARD_ENCODING_FIX) + setVCard( TQByteArray() ); +#else setVCard( TQString::null ); +#endif } +#if defined(KABC_VCARD_ENCODING_FIX) +void KVCardDrag::setVCard( const TQByteArray &content ) +{ + setEncodedData( content ); +} +#else void KVCardDrag::setVCard( const TQString &content ) { setEncodedData( content.utf8() ); } +#endif bool KVCardDrag::canDecode( TQMimeSource *e ) { return e->provides( vcard_mime_string ); } +#if defined(KABC_VCARD_ENCODING_FIX) +bool KVCardDrag::decode( TQMimeSource *e, TQByteArray &content ) +{ + if ( !canDecode( e ) ) { + return false; + } + content = e->encodedData( vcard_mime_string ); + return true; +} +#else bool KVCardDrag::decode( TQMimeSource *e, TQString &content ) { + if ( !canDecode( e ) ) { + return false; + } content = TQString::fromUtf8( e->encodedData( vcard_mime_string ) ); return true; } +#endif bool KVCardDrag::decode( TQMimeSource *e, KABC::Addressee::List& addressees ) { + if ( !canDecode( e ) ) { + return false; + } +#if defined(KABC_VCARD_ENCODING_FIX) + addressees = KABC::VCardConverter().parseVCardsRaw( e->encodedData( vcard_mime_string ).data() ); +#else addressees = KABC::VCardConverter().parseVCards( e->encodedData( vcard_mime_string ) ); +#endif return true; } -- cgit v1.2.1