diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2014-01-18 14:13:43 +0100 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2014-01-18 14:13:43 +0100 |
commit | 5a692370051844e966a42abcfc48beae75112539 (patch) | |
tree | 27d440e95022da3cc7f3a67c49a3eed5c344e4fc | |
parent | b415f1f1f41873febdad7448ad04648a148b1ad5 (diff) | |
download | tdepim-5a692370051844e966a42abcfc48beae75112539.tar.gz tdepim-5a692370051844e966a42abcfc48beae75112539.zip |
Fix utf8 and html entities handling in CalDAV and CardDAV resources
-rw-r--r-- | libtdepim/tdeabcresourcecached.cpp | 6 | ||||
-rw-r--r-- | tderesources/caldav/reader.cpp | 7 | ||||
-rw-r--r-- | tderesources/caldav/writer.h | 6 | ||||
-rw-r--r-- | tderesources/carddav/reader.cpp | 3 | ||||
-rw-r--r-- | tderesources/carddav/resource.cpp | 4 | ||||
-rw-r--r-- | tderesources/carddav/writer.h | 2 |
6 files changed, 15 insertions, 13 deletions
diff --git a/libtdepim/tdeabcresourcecached.cpp b/libtdepim/tdeabcresourcecached.cpp index 3bb96112d..5cae5882d 100644 --- a/libtdepim/tdeabcresourcecached.cpp +++ b/libtdepim/tdeabcresourcecached.cpp @@ -217,7 +217,7 @@ void ResourceCached::loadCache() #if defined(KABC_VCARD_ENCODING_FIX) TDEABC::Addressee::List list = converter.parseVCardsRaw( file.readAll().data() ); #else - TDEABC::Addressee::List list = converter.parseVCards( TQString::fromUtf8( file.readAll() ) ); + TDEABC::Addressee::List list = converter.parseVCards( file.readAll() ); #endif TDEABC::Addressee::List::Iterator it; @@ -271,7 +271,7 @@ void ResourceCached::cleanUpCache( const TDEABC::Addressee::List &addrList ) #if defined(KABC_VCARD_ENCODING_FIX) TDEABC::Addressee::List list = converter.parseVCardsRaw( file.readAll().data() ); #else - TDEABC::Addressee::List list = converter.parseVCards( TQString::fromUtf8( file.readAll() ) ); + TDEABC::Addressee::List list = converter.parseVCards( file.readAll() ); #endif TDEABC::Addressee::List::Iterator cacheIt; TDEABC::Addressee::List::ConstIterator it; @@ -393,7 +393,7 @@ void ResourceCached::loadChangesCache( TQMap<TQString, TDEABC::Addressee> &map, #if defined(KABC_VCARD_ENCODING_FIX) const TDEABC::Addressee::List list = converter.parseVCardsRaw( file.readAll().data() ); #else - const TDEABC::Addressee::List list = converter.parseVCards( TQString::fromUtf8( file.readAll() ) ); + const TDEABC::Addressee::List list = converter.parseVCards( file.readAll() ); #endif TDEABC::Addressee::List::ConstIterator it; for ( it = list.begin(); it != list.end(); ++it ) diff --git a/tderesources/caldav/reader.cpp b/tderesources/caldav/reader.cpp index 92501e4f7..6d7400340 100644 --- a/tderesources/caldav/reader.cpp +++ b/tderesources/caldav/reader.cpp @@ -16,6 +16,7 @@ #include "reader.h" #include <kdebug.h> +#include <kcharsets.h> #include <string> /*========================================================================= @@ -61,7 +62,7 @@ int CalDavReader::runJob(runtime_info* RT) { if (OK == res) { kdDebug() << "success" << '\n'; if (result->msg) { - mData = result->msg; + mData = KCharsets::resolveEntities(TQString::fromUtf8(result->msg)); } else { kdDebug() << "empty collection" << '\n'; // empty collection @@ -95,7 +96,7 @@ int CalDavReader::runTasksJob(runtime_info* RT) { if (OK == tasksres) { kdDebug() << "success" << '\n'; if (result->msg) { - mTasksData = result->msg; + mTasksData = KCharsets::resolveEntities(TQString::fromUtf8(result->msg)); } else { kdDebug() << "empty collection" << '\n'; // empty collection @@ -129,7 +130,7 @@ int CalDavReader::runJournalsJob(runtime_info* RT) { if (OK == journalsres) { kdDebug() << "success" << '\n'; if (result->msg) { - mJournalsData = result->msg; + mJournalsData = KCharsets::resolveEntities(TQString::fromUtf8(result->msg)); } else { kdDebug() << "empty collection" << '\n'; // empty collection diff --git a/tderesources/caldav/writer.h b/tderesources/caldav/writer.h index 437eeed0e..893fc0e81 100644 --- a/tderesources/caldav/writer.h +++ b/tderesources/caldav/writer.h @@ -156,7 +156,7 @@ protected: int pushObjects(const TQString& data, Operation op, int okCode, runtime_info* RT) { int r = okCode; if (!data.isNull() && !data.isEmpty()) { - r = op(std::string(data.ascii()).c_str(), std::string(url().ascii()).c_str(), RT); + r = op(std::string(data.utf8()).c_str(), std::string(url().ascii()).c_str(), RT); } return r; } @@ -166,7 +166,7 @@ protected: int pushTasksObjects(const TQString& data, Operation op, int okCode, runtime_info* RT) { int r = okCode; if (!data.isNull() && !data.isEmpty()) { - r = op(std::string(data.ascii()).c_str(), std::string(tasksUrl().ascii()).c_str(), RT); + r = op(std::string(data.utf8()).c_str(), std::string(tasksUrl().ascii()).c_str(), RT); } return r; } @@ -176,7 +176,7 @@ protected: int pushJournalsObjects(const TQString& data, Operation op, int okCode, runtime_info* RT) { int r = okCode; // if (!data.isNull() && !data.isEmpty()) { -// r = op(std::string(data.ascii()).c_str(), std::string(journalsUrl().ascii()).c_str(), RT); +// r = op(std::string(data.utf8()).c_str(), std::string(journalsUrl().ascii()).c_str(), RT); // } return r; } diff --git a/tderesources/carddav/reader.cpp b/tderesources/carddav/reader.cpp index 5836bbccc..eb5625060 100644 --- a/tderesources/carddav/reader.cpp +++ b/tderesources/carddav/reader.cpp @@ -15,6 +15,7 @@ #include "reader.h" #include <kdebug.h> +#include <kcharsets.h> #include <string> /*========================================================================= @@ -47,7 +48,7 @@ int CardDavReader::runJob(runtime_info* RT) { if (OK == res) { kdDebug() << "success" << '\n'; if (result->msg) { - mData = result->msg; + mData = KCharsets::resolveEntities(TQString::fromUtf8(result->msg)); } else { kdDebug() << "empty collection" << '\n'; // empty collection diff --git a/tderesources/carddav/resource.cpp b/tderesources/carddav/resource.cpp index c9993abb5..9fc54692e 100644 --- a/tderesources/carddav/resource.cpp +++ b/tderesources/carddav/resource.cpp @@ -425,7 +425,7 @@ bool ResourceCardDav::checkData(const TQString& data) { TDEABC::VCardConverter converter; bool ret = true; TDEABC::VCardConverter conv; - Addressee::List addressees = conv.parseVCards( data ); + Addressee::List addressees = conv.parseVCards( data.utf8() ); if (addressees.isEmpty() == true) { ret = false; } @@ -454,7 +454,7 @@ bool ResourceCardDav::parseData(const TQString& data) { log("actually parsing the data"); TDEABC::VCardConverter conv; - Addressee::List addressees = conv.parseVCards( data ); + Addressee::List addressees = conv.parseVCards( data.utf8() ); Addressee::List::ConstIterator it; for( it = addressees.begin(); it != addressees.end(); ++it ) { TDEABC::Addressee addr = *it; diff --git a/tderesources/carddav/writer.h b/tderesources/carddav/writer.h index 9bd9429ab..3bfa76c3c 100644 --- a/tderesources/carddav/writer.h +++ b/tderesources/carddav/writer.h @@ -91,7 +91,7 @@ protected: int pushObjects(const TQString& data, Operation op, int okCode, runtime_info* RT) { int r = okCode; if (!data.isNull() && !data.isEmpty()) { - r = op(std::string(data.ascii()).c_str(), std::string(url().ascii()).c_str(), RT); + r = op(std::string(data.utf8()).c_str(), std::string(url().ascii()).c_str(), RT); } return r; } |