Fix utf8 and html entities handling in CalDAV and CardDAV resources

pull/21/head
Slávek Banko 11 years ago
parent b415f1f1f4
commit 5a69237005

@ -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 )

@ -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

@ -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;
}

@ -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

@ -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;

@ -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;
}

Loading…
Cancel
Save