kpilot
todoRecord.ccGo to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include "options.h"
00031
00032 #include <libkcal/calendar.h>
00033 #include <libkcal/calendarlocal.h>
00034 #include <libkcal/recurrence.h>
00035 #include <libkcal/vcalformat.h>
00036
00037 #include "pilot.h"
00038 #include "pilotTodoEntry.h"
00039
00040 #include "kcalRecord.h"
00041 #include "todoRecord.h"
00042
00043 bool KCalSync::setTodoEntry(PilotTodoEntry *de,
00044 const KCal::Todo *todo,
00045 const CategoryAppInfo &info)
00046 {
00047 FUNCTIONSETUP;
00048 if (!de || !todo) {
00049 DEBUGKPILOT << fname << ": NULL todo given... Skipping it" << endl;
00050 return false;
00051 }
00052
00053
00054 if (todo->secrecy()!=KCal::Todo::SecrecyPublic)
00055 {
00056 de->setSecret( true );
00057 }
00058
00059
00060
00061 if (todo->hasDueDate()) {
00062 struct tm t = writeTm(todo->dtDue());
00063 de->setDueDate(t);
00064 de->setIndefinite(0);
00065 } else {
00066 de->setIndefinite(1);
00067 }
00068
00069
00070
00071 setCategory(de, todo, info);
00072
00073
00074 de->setPriority(todo->priority());
00075
00076 de->setComplete(todo->isCompleted());
00077
00078
00079 de->setDescription(todo->summary());
00080
00081
00082 de->setNote(todo->description());
00083
00084 DEBUGKPILOT << "-------- " << todo->summary() << endl;
00085 return de->pack();
00086 }
00087
00088 bool KCalSync::setTodo(KCal::Todo *e,
00089 const PilotTodoEntry *de,
00090 const CategoryAppInfo &info)
00091 {
00092 FUNCTIONSETUP;
00093
00094 if (!e)
00095 {
00096 DEBUGKPILOT << fname
00097 << ": null todo entry given. skipping..." << endl;
00098 return false;
00099 }
00100 if (!de)
00101 {
00102 DEBUGKPILOT << fname
00103 << "! NULL todo entry given... Skipping it" << endl;
00104 return false;
00105 }
00106
00107
00108 e->setPilotId(de->id());
00109 DEBUGKPILOT<<fname<<": set KCal item to pilotId: [" << e->pilotId() << "] ..."<<endl;
00110
00111 e->setSecrecy(de->isSecret() ? KCal::Todo::SecrecyPrivate : KCal::Todo::SecrecyPublic);
00112
00113 if (de->getIndefinite()) {
00114 e->setHasDueDate(false);
00115 } else {
00116 e->setDtDue(readTm(de->getDueDate()));
00117 e->setHasDueDate(true);
00118 }
00119
00120
00121 setCategory(e, de, info);
00122
00123
00124 e->setPriority(de->getPriority());
00125
00126
00127 e->setCompleted(de->getComplete());
00128 if ( de->getComplete() && !e->hasCompletedDate() ) {
00129 e->setCompleted( QDateTime::currentDateTime() );
00130 }
00131
00132 e->setSummary(de->getDescription());
00133 e->setDescription(de->getNote());
00134
00135
00136
00137
00138 e->setSyncStatus(KCal::Incidence::SYNCNONE);
00139
00140 return true;
00141 }
|