diff options
author | Timotheus Pokorra <tp@tbits.net> | 2015-03-18 14:21:29 (GMT) |
---|---|---|
committer | Timotheus Pokorra <timotheus.pokorra@solidcharity.com> | 2015-03-18 14:25:50 (GMT) |
commit | 91147fcef499f6db0f731f714f9b5c303e4df1e2 (patch) | |
tree | 4d5f2f34fa682190b512131e0f40829686c153bb /kolabformatV2 | |
parent | fefdb55de34826c63e75ebfb46518c4eeaa1db14 (diff) | |
download | libkolab-master.tar.gz |
Diffstat (limited to 'kolabformatV2')
-rw-r--r-- | kolabformatV2/incidence.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/kolabformatV2/incidence.cpp b/kolabformatV2/incidence.cpp index 9f0e381..d46beb1 100644 --- a/kolabformatV2/incidence.cpp +++ b/kolabformatV2/incidence.cpp @@ -41,6 +41,8 @@ #include <kurl.h> #include <QBitArray> +#include <string> +#include <boost/algorithm/string.hpp> using namespace KolabV2; @@ -357,7 +359,20 @@ void Incidence::loadRecurrence( const QDomElement& element ) mRecurrence.rangeType = e.attribute( "type" ); mRecurrence.range = e.text(); } else if ( tagName == "exclusion" ) { - mRecurrence.exclusions.append( stringToDate( e.text() ) ); + std::string exclusionDate = e.text().toStdString(); + // need to fix the date, eg. 2013-1-1 to ISO format 2013-01-01 + if (exclusionDate.length() != 10) { + std::vector<std::string> strs; + boost::split(strs, exclusionDate, boost::is_any_of("-")); + char buff[100]; + sprintf(buff, "%04d-%02d-%02d", + QString::fromStdString(strs[0]).toInt(), + QString::fromStdString(strs[1]).toInt(), + QString::fromStdString(strs[2]).toInt() + ); + exclusionDate = buff; + } + mRecurrence.exclusions.append( stringToDate( QString::fromStdString(exclusionDate) ) ); } else // TODO: Unhandled tag - save for later storage kDebug() <<"Warning: Unhandled tag" << e.tagName(); |