summaryrefslogtreecommitdiffabout
path: root/libkcal
Unidiff
Diffstat (limited to 'libkcal') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/sharpformat.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/libkcal/sharpformat.cpp b/libkcal/sharpformat.cpp
index 24b8349..c2ee2c9 100644
--- a/libkcal/sharpformat.cpp
+++ b/libkcal/sharpformat.cpp
@@ -209,98 +209,101 @@ class SharpParser : public QObject
209// 0 1 2 3 4 5 6 7 8 209// 0 1 2 3 4 5 6 7 8
210//1,,,,,1,4,Loch zumachen,"" 210//1,,,,,1,4,Loch zumachen,""
211//3,Privat,20040317T000000,20040318T000000,20040319T000000,0,5,Call bbb,"notes123 bbb gggg ""bb "" " 211//3,Privat,20040317T000000,20040318T000000,20040319T000000,0,5,Call bbb,"notes123 bbb gggg ""bb "" "
212//2,"Familie,Freunde,Holiday",20040318T000000,20040324T000000,20040317T000000,1,2,tod2,notes 212//2,"Familie,Freunde,Holiday",20040318T000000,20040324T000000,20040317T000000,1,2,tod2,notes
213 213
214 todo->setID( "Sharp_DTM", attList[0]); 214 todo->setID( "Sharp_DTM", attList[0]);
215 todo->setCsum( "Sharp_DTM", QString::number( cSum )); 215 todo->setCsum( "Sharp_DTM", QString::number( cSum ));
216 todo->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); 216 todo->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL );
217 217
218 todo->setSummary( attList[7] ); 218 todo->setSummary( attList[7] );
219 todo->setDescription( attList[8]); 219 todo->setDescription( attList[8]);
220 220
221 int priority = attList[6].toInt(); 221 int priority = attList[6].toInt();
222 if ( priority == 0 ) priority = 3; 222 if ( priority == 0 ) priority = 3;
223 todo->setPriority( priority ); 223 todo->setPriority( priority );
224 224
225 QString categoryList = attList[1]; 225 QString categoryList = attList[1];
226 todo->setCategories( categoryList ); 226 todo->setCategories( categoryList );
227 227
228 228
229 229
230 QString hasDateStr = attList[3]; // due 230 QString hasDateStr = attList[3]; // due
231 if ( !hasDateStr.isEmpty() ) { 231 if ( !hasDateStr.isEmpty() ) {
232 if ( hasDateStr.right(6) == "000000" ) { 232 if ( hasDateStr.right(6) == "000000" ) {
233 todo->setDtDue( QDateTime(fromString( hasDateStr, false ).date(), QTime(0,0,0 )) ); 233 todo->setDtDue( QDateTime(fromString( hasDateStr, false ).date(), QTime(0,0,0 )) );
234 todo->setFloats( true ); 234 todo->setFloats( true );
235 } 235 }
236 else { 236 else {
237 todo->setDtDue( fromString( hasDateStr ) ); 237 todo->setDtDue( fromString( hasDateStr ) );
238 todo->setFloats( false ); 238 todo->setFloats( false );
239 } 239 }
240 240
241 todo->setHasDueDate( true ); 241 todo->setHasDueDate( true );
242 } 242 }
243 hasDateStr = attList[2];//start 243 hasDateStr = attList[2];//start
244 if ( !hasDateStr.isEmpty() ) { 244 if ( !hasDateStr.isEmpty() ) {
245 245
246 todo->setDtStart( fromString( hasDateStr ) ); 246 todo->setDtStart( fromString( hasDateStr ) );
247 todo->setHasStartDate( true); 247 todo->setHasStartDate( true);
248 } else 248 } else
249 todo->setHasStartDate( false ); 249 todo->setHasStartDate( false );
250 hasDateStr = attList[4];//completed 250 hasDateStr = attList[4];//completed
251 if ( !hasDateStr.isEmpty() ) { 251 if ( !hasDateStr.isEmpty() ) {
252 todo->setCompleted(fromString( hasDateStr ) ); 252 todo->setCompleted(fromString( hasDateStr ) );
253 } 253 }
254 QString completedStr = attList[5]; 254 QString completedStr = attList[5];
255 if ( completedStr == "0" ) 255 if ( completedStr == "0" )
256 todo->setCompleted( true ); 256 todo->setCompleted( true );
257 else 257 else {
258 // do not change percent complete
259 if ( todo->isCompleted() )
258 todo->setCompleted( false ); 260 todo->setCompleted( false );
261 }
259 mCalendar->addTodo( todo ); 262 mCalendar->addTodo( todo );
260 263
261 } else if ( qName == "Category" ) { 264 } else if ( qName == "Category" ) {
262 /* 265 /*
263 QString id = attributes.value( "id" ); 266 QString id = attributes.value( "id" );
264 QString name = attributes.value( "name" ); 267 QString name = attributes.value( "name" );
265 setCategory( id, name ); 268 setCategory( id, name );
266 */ 269 */
267 } 270 }
268 //qDebug("end "); 271 //qDebug("end ");
269 return true; 272 return true;
270 } 273 }
271 274
272 275
273 QDateTime fromString ( QString s, bool useTz = true ) { 276 QDateTime fromString ( QString s, bool useTz = true ) {
274 QDateTime dt; 277 QDateTime dt;
275 int y,m,t,h,min,sec; 278 int y,m,t,h,min,sec;
276 y = s.mid(0,4).toInt(); 279 y = s.mid(0,4).toInt();
277 m = s.mid(4,2).toInt(); 280 m = s.mid(4,2).toInt();
278 t = s.mid(6,2).toInt(); 281 t = s.mid(6,2).toInt();
279 h = s.mid(9,2).toInt(); 282 h = s.mid(9,2).toInt();
280 min = s.mid(11,2).toInt(); 283 min = s.mid(11,2).toInt();
281 sec = s.mid(13,2).toInt(); 284 sec = s.mid(13,2).toInt();
282 dt = QDateTime(QDate(y,m,t), QTime(h,min,sec)); 285 dt = QDateTime(QDate(y,m,t), QTime(h,min,sec));
283 int offset = KGlobal::locale()->localTimeOffset( dt ); 286 int offset = KGlobal::locale()->localTimeOffset( dt );
284 if ( useTz ) 287 if ( useTz )
285 dt = dt.addSecs ( offset*60); 288 dt = dt.addSecs ( offset*60);
286 return dt; 289 return dt;
287 290
288 } 291 }
289 protected: 292 protected:
290 QDateTime toDateTime( const QString &value ) 293 QDateTime toDateTime( const QString &value )
291 { 294 {
292 QDateTime dt; 295 QDateTime dt;
293 dt.setTime_t( value.toUInt() ); 296 dt.setTime_t( value.toUInt() );
294 297
295 return dt; 298 return dt;
296 } 299 }
297 300
298 private: 301 private:
299 Calendar *mCalendar; 302 Calendar *mCalendar;
300}; 303};
301 304
302 305
303SharpFormat::SharpFormat() 306SharpFormat::SharpFormat()
304{ 307{
305 308
306} 309}