summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp62
-rw-r--r--korganizer/koagenda.cpp4
-rw-r--r--korganizer/koagendaitem.cpp16
-rw-r--r--korganizer/kolistview.cpp12
-rw-r--r--korganizer/kotodoview.cpp4
-rw-r--r--korganizer/kowhatsnextview.cpp10
-rw-r--r--korganizer/mainwindow.cpp10
-rw-r--r--libkcal/calendar.cpp6
-rw-r--r--libkcal/calendarlocal.cpp6
-rw-r--r--libkcal/calfilter.cpp6
-rw-r--r--libkcal/event.h1
-rw-r--r--libkcal/freebusy.h1
-rw-r--r--libkcal/icalformat.cpp4
-rw-r--r--libkcal/icalformatimpl.cpp6
-rw-r--r--libkcal/incidence.cpp6
-rw-r--r--libkcal/incidencebase.h2
-rw-r--r--libkcal/journal.h1
-rw-r--r--libkcal/kincidenceformatter.cpp4
-rw-r--r--libkcal/todo.cpp5
-rw-r--r--libkcal/todo.h1
20 files changed, 85 insertions, 82 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 720ad78..7c7466b 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -149,55 +149,55 @@ MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Inciden
149 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; 149 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>";
150#else 150#else
151 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>"; 151 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>";
152#endif 152#endif
153 // mText += "<img src=\""; 153 // mText += "<img src=\"";
154 // mText += ipath; 154 // mText += ipath;
155 // mText += "\">"; 155 // mText += "\">";
156 //mEventDate = QDate::currentDate(); 156 //mEventDate = QDate::currentDate();
157#ifdef DESKTOP_VERSION 157#ifdef DESKTOP_VERSION
158 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>"; 158 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>";
159#else 159#else
160 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h3>"; 160 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h3>";
161#endif 161#endif
162 //mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; 162 //mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>";
163 163
164 Incidence * inc = getNextInc( start ); 164 Incidence * inc = getNextInc( start );
165 int time = 0; 165 int time = 0;
166 //mText += "<table>"; 166 //mText += "<table>";
167 while ( inc ) { 167 while ( inc ) {
168 QDateTime dt ; 168 QDateTime dt ;
169 QString tempText = "<a "; 169 QString tempText = "<a ";
170 bool ok; 170 bool ok;
171 dt = inc->getNextOccurence( start, &ok ); 171 dt = inc->getNextOccurence( start, &ok );
172 if ( !ok ) continue; 172 if ( !ok ) continue;
173 if ( inc->type() == "Event" ) { 173 if ( inc->typeID() == eventID ) {
174 tempText += "href=\"event:"; 174 tempText += "href=\"event:";
175 } else if ( inc->type() == "Todo" ) { 175 } else if ( inc->typeID() == todoID ) {
176 tempText += "href=\"todo:"; 176 tempText += "href=\"todo:";
177 } 177 }
178 tempText += inc->uid() + "\">"; 178 tempText += inc->uid() + "\">";
179 if ( inc->type() == "Todo" ) 179 if ( inc->typeID() == todoID )
180 tempText += i18n("Todo: "); 180 tempText += i18n("Todo: ");
181 if ( inc->summary().length() > 0 ) 181 if ( inc->summary().length() > 0 )
182 tempText += inc->summary(); 182 tempText += inc->summary();
183 else 183 else
184 tempText += i18n("-no summary-"); 184 tempText += i18n("-no summary-");
185 QString timestr; 185 QString timestr;
186 if (!inc->doesFloat()) 186 if (!inc->doesFloat())
187 timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": "; 187 timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": ";
188 else 188 else
189 timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": "; 189 timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
190 if ( dt.date() < QDate::currentDate() && time == 0 ) { 190 if ( dt.date() < QDate::currentDate() && time == 0 ) {
191 mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; 191 mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>";
192 mText += "<table>"; 192 mText += "<table>";
193 time = 1; 193 time = 1;
194 } 194 }
195 if ( dt.date() == QDate::currentDate() && time <= 1 ) { 195 if ( dt.date() == QDate::currentDate() && time <= 1 ) {
196 if ( time > 0 ) 196 if ( time > 0 )
197 mText +="</table>"; 197 mText +="</table>";
198 mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>"; 198 mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>";
199 mText += "<table>"; 199 mText += "<table>";
200 time = 2; 200 time = 2;
201 201
202 } 202 }
203 if ( dt.date() > QDate::currentDate() && time <= 2 ) { 203 if ( dt.date() > QDate::currentDate() && time <= 2 ) {
@@ -952,54 +952,54 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
952 } else { 952 } else {
953 //qDebug(" not loc changed "); 953 //qDebug(" not loc changed ");
954 lastSync = localMod.addDays( 1 ); 954 lastSync = localMod.addDays( 1 );
955 if ( remCh ) 955 if ( remCh )
956 remoteMod =( lastSync.addDays( 1 ) ); 956 remoteMod =( lastSync.addDays( 1 ) );
957 957
958 } 958 }
959 } 959 }
960 full = true; 960 full = true;
961 if ( mode < SYNC_PREF_ASK ) 961 if ( mode < SYNC_PREF_ASK )
962 mode = SYNC_PREF_ASK; 962 mode = SYNC_PREF_ASK;
963 } else { 963 } else {
964 if ( localMod == remoteMod ) 964 if ( localMod == remoteMod )
965 // if ( local->revision() == remote->revision() ) 965 // if ( local->revision() == remote->revision() )
966 return 0; 966 return 0;
967 967
968 } 968 }
969 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 969 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
970 970
971 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); 971 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision());
972 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); 972 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() );
973 //full = true; //debug only 973 //full = true; //debug only
974 if ( full ) { 974 if ( full ) {
975 bool equ = false; 975 bool equ = false;
976 if ( local->type() == "Event" ) { 976 if ( local->typeID() == eventID ) {
977 equ = (*((Event*) local) == *((Event*) remote)); 977 equ = (*((Event*) local) == *((Event*) remote));
978 } 978 }
979 else if ( local->type() =="Todo" ) 979 else if ( local->typeID() == todoID )
980 equ = (*((Todo*) local) == (*(Todo*) remote)); 980 equ = (*((Todo*) local) == (*(Todo*) remote));
981 else if ( local->type() =="Journal" ) 981 else if ( local->typeID() == journalID )
982 equ = (*((Journal*) local) == *((Journal*) remote)); 982 equ = (*((Journal*) local) == *((Journal*) remote));
983 if ( equ ) { 983 if ( equ ) {
984 //qDebug("equal "); 984 //qDebug("equal ");
985 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 985 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
986 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 986 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
987 } 987 }
988 if ( mode < SYNC_PREF_FORCE_LOCAL ) 988 if ( mode < SYNC_PREF_FORCE_LOCAL )
989 return 0; 989 return 0;
990 990
991 }//else //debug only 991 }//else //debug only
992 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 992 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
993 } 993 }
994 int result; 994 int result;
995 bool localIsNew; 995 bool localIsNew;
996 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); 996 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() );
997 997
998 998
999 // ************************************************ 999 // ************************************************
1000 // ************************************************ 1000 // ************************************************
1001 // ************************************************ 1001 // ************************************************
1002 // We may have that lastSync > remoteMod AND lastSync > localMod 1002 // We may have that lastSync > remoteMod AND lastSync > localMod
1003 // BUT remoteMod != localMod 1003 // BUT remoteMod != localMod
1004 1004
1005 1005
@@ -1078,59 +1078,59 @@ Event* CalendarView::getLastSyncEvent()
1078 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); 1078 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice );
1079 QString sum = ""; 1079 QString sum = "";
1080 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) 1080 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
1081 sum = "E: "; 1081 sum = "E: ";
1082 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); 1082 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event"));
1083 lse->setDtStart( mLastCalendarSync ); 1083 lse->setDtStart( mLastCalendarSync );
1084 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 1084 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
1085 lse->setCategories( i18n("SyncEvent") ); 1085 lse->setCategories( i18n("SyncEvent") );
1086 lse->setReadOnly( true ); 1086 lse->setReadOnly( true );
1087 mCalendar->addEvent( lse ); 1087 mCalendar->addEvent( lse );
1088 } 1088 }
1089 1089
1090 return lse; 1090 return lse;
1091 1091
1092} 1092}
1093 1093
1094// we check, if the to delete event has a id for a profile 1094// we check, if the to delete event has a id for a profile
1095// if yes, we set this id in the profile to delete 1095// if yes, we set this id in the profile to delete
1096void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) 1096void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete )
1097{ 1097{
1098 if ( lastSync.count() == 0 ) { 1098 if ( lastSync.count() == 0 ) {
1099 //qDebug(" lastSync.count() == 0"); 1099 //qDebug(" lastSync.count() == 0");
1100 return; 1100 return;
1101 } 1101 }
1102 if ( toDelete->type() == "Journal" ) 1102 if ( toDelete->typeID() == journalID )
1103 return; 1103 return;
1104 1104
1105 Event* eve = lastSync.first(); 1105 Event* eve = lastSync.first();
1106 1106
1107 while ( eve ) { 1107 while ( eve ) {
1108 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name 1108 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name
1109 if ( !id.isEmpty() ) { 1109 if ( !id.isEmpty() ) {
1110 QString des = eve->description(); 1110 QString des = eve->description();
1111 QString pref = "e"; 1111 QString pref = "e";
1112 if ( toDelete->type() == "Todo" ) 1112 if ( toDelete->typeID() == todoID )
1113 pref = "t"; 1113 pref = "t";
1114 des += pref+ id + ","; 1114 des += pref+ id + ",";
1115 eve->setReadOnly( false ); 1115 eve->setReadOnly( false );
1116 eve->setDescription( des ); 1116 eve->setDescription( des );
1117 //qDebug("setdes %s ", des.latin1()); 1117 //qDebug("setdes %s ", des.latin1());
1118 eve->setReadOnly( true ); 1118 eve->setReadOnly( true );
1119 } 1119 }
1120 eve = lastSync.next(); 1120 eve = lastSync.next();
1121 } 1121 }
1122 1122
1123} 1123}
1124void CalendarView::checkExternalId( Incidence * inc ) 1124void CalendarView::checkExternalId( Incidence * inc )
1125{ 1125{
1126 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; 1126 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ;
1127 checkExternSyncEvent( lastSync, inc ); 1127 checkExternSyncEvent( lastSync, inc );
1128 1128
1129} 1129}
1130bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) 1130bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode )
1131{ 1131{
1132 bool syncOK = true; 1132 bool syncOK = true;
1133 int addedEvent = 0; 1133 int addedEvent = 0;
1134 int addedEventR = 0; 1134 int addedEventR = 0;
1135 int deletedEventR = 0; 1135 int deletedEventR = 0;
1136 int deletedEventL = 0; 1136 int deletedEventL = 0;
@@ -1265,49 +1265,49 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1265 if ( mSyncManager->syncWithDesktop() ) 1265 if ( mSyncManager->syncWithDesktop() )
1266 inR->setPilotId( 2 ); 1266 inR->setPilotId( 2 );
1267 ++changedRemote; 1267 ++changedRemote;
1268 } else {// take remote ********************** 1268 } else {// take remote **********************
1269 idS = inL->IDStr(); 1269 idS = inL->IDStr();
1270 int pid = inL->pilotId(); 1270 int pid = inL->pilotId();
1271 local->deleteIncidence( inL ); 1271 local->deleteIncidence( inL );
1272 inL = inR->clone(); 1272 inL = inR->clone();
1273 if ( mSyncManager->syncWithDesktop() ) 1273 if ( mSyncManager->syncWithDesktop() )
1274 inL->setPilotId( pid ); 1274 inL->setPilotId( pid );
1275 inL->setIDStr( idS ); 1275 inL->setIDStr( idS );
1276 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1276 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1277 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1277 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1278 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1278 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1279 } 1279 }
1280 local->addIncidence( inL ); 1280 local->addIncidence( inL );
1281 ++changedLocal; 1281 ++changedLocal;
1282 } 1282 }
1283 } 1283 }
1284 } else { // no conflict ********** add or delete remote 1284 } else { // no conflict ********** add or delete remote
1285 if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ 1285 if ( !filterIN || filterIN->filterCalendarItem( inR ) ){
1286 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1286 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1287 QString des = eventLSync->description(); 1287 QString des = eventLSync->description();
1288 QString pref = "e"; 1288 QString pref = "e";
1289 if ( inR->type() == "Todo" ) 1289 if ( inR->typeID() == todoID )
1290 pref = "t"; 1290 pref = "t";
1291 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 1291 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
1292 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 1292 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE );
1293 //remote->deleteIncidence( inR ); 1293 //remote->deleteIncidence( inR );
1294 ++deletedEventR; 1294 ++deletedEventR;
1295 } else { 1295 } else {
1296 inR->setLastModified( modifiedCalendar ); 1296 inR->setLastModified( modifiedCalendar );
1297 inL = inR->clone(); 1297 inL = inR->clone();
1298 inL->setIDStr( ":" ); 1298 inL->setIDStr( ":" );
1299 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1299 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1300 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1300 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1301 local->addIncidence( inL ); 1301 local->addIncidence( inL );
1302 ++addedEvent; 1302 ++addedEvent;
1303 1303
1304 } 1304 }
1305 } else { 1305 } else {
1306 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { 1306 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) {
1307 inR->setLastModified( modifiedCalendar ); 1307 inR->setLastModified( modifiedCalendar );
1308 inL = inR->clone(); 1308 inL = inR->clone();
1309 inL->setIDStr( ":" ); 1309 inL->setIDStr( ":" );
1310 local->addIncidence( inL ); 1310 local->addIncidence( inL );
1311 ++addedEvent; 1311 ++addedEvent;
1312 1312
1313 } else { 1313 } else {
@@ -1322,49 +1322,49 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1322 } 1322 }
1323 } 1323 }
1324 inR = er.next(); 1324 inR = er.next();
1325 } 1325 }
1326 QPtrList<Incidence> el = local->rawIncidences(); 1326 QPtrList<Incidence> el = local->rawIncidences();
1327 inL = el.first(); 1327 inL = el.first();
1328 modulo = (el.count()/10)+1; 1328 modulo = (el.count()/10)+1;
1329 bar.setCaption (i18n("Add / remove events") ); 1329 bar.setCaption (i18n("Add / remove events") );
1330 bar.setTotalSteps ( el.count() ) ; 1330 bar.setTotalSteps ( el.count() ) ;
1331 bar.show(); 1331 bar.show();
1332 incCounter = 0; 1332 incCounter = 0;
1333 1333
1334 while ( inL ) { 1334 while ( inL ) {
1335 1335
1336 qApp->processEvents(); 1336 qApp->processEvents();
1337 if ( ! bar.isVisible() ) 1337 if ( ! bar.isVisible() )
1338 return false; 1338 return false;
1339 if ( incCounter % modulo == 0 ) 1339 if ( incCounter % modulo == 0 )
1340 bar.setProgress( incCounter ); 1340 bar.setProgress( incCounter );
1341 ++incCounter; 1341 ++incCounter;
1342 uid = inL->uid(); 1342 uid = inL->uid();
1343 bool skipIncidence = false; 1343 bool skipIncidence = false;
1344 if ( uid.left(15) == QString("last-syncEvent-") ) 1344 if ( uid.left(15) == QString("last-syncEvent-") )
1345 skipIncidence = true; 1345 skipIncidence = true;
1346 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) 1346 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->typeID() == journalID )
1347 skipIncidence = true; 1347 skipIncidence = true;
1348 if ( !skipIncidence ) { 1348 if ( !skipIncidence ) {
1349 inR = remote->incidence( uid ); 1349 inR = remote->incidence( uid );
1350 if ( ! inR ) { 1350 if ( ! inR ) {
1351 if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ 1351 if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){
1352 // no conflict ********** add or delete local 1352 // no conflict ********** add or delete local
1353 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1353 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1354 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 1354 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
1355 checkExternSyncEvent(eventLSyncSharp, inL); 1355 checkExternSyncEvent(eventLSyncSharp, inL);
1356 local->deleteIncidence( inL ); 1356 local->deleteIncidence( inL );
1357 ++deletedEventL; 1357 ++deletedEventL;
1358 } else { 1358 } else {
1359 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1359 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1360 inL->removeID(mCurrentSyncDevice ); 1360 inL->removeID(mCurrentSyncDevice );
1361 ++addedEventR; 1361 ++addedEventR;
1362 //qDebug("remote added Incidence %s ", inL->summary().latin1()); 1362 //qDebug("remote added Incidence %s ", inL->summary().latin1());
1363 inL->setLastModified( modifiedCalendar ); 1363 inL->setLastModified( modifiedCalendar );
1364 inR = inL->clone(); 1364 inR = inL->clone();
1365 inR->setIDStr( ":" ); 1365 inR->setIDStr( ":" );
1366 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1366 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1367 remote->addIncidence( inR ); 1367 remote->addIncidence( inR );
1368 } 1368 }
1369 } 1369 }
1370 } else { 1370 } else {
@@ -1378,56 +1378,56 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1378 inL->setLastModified( modifiedCalendar ); 1378 inL->setLastModified( modifiedCalendar );
1379 inR = inL->clone(); 1379 inR = inL->clone();
1380 inR->setIDStr( ":" ); 1380 inR->setIDStr( ":" );
1381 remote->addIncidence( inR ); 1381 remote->addIncidence( inR );
1382 } 1382 }
1383 } 1383 }
1384 } 1384 }
1385 } else { 1385 } else {
1386 ++filteredOUT; 1386 ++filteredOUT;
1387 } 1387 }
1388 } 1388 }
1389 } 1389 }
1390 inL = el.next(); 1390 inL = el.next();
1391 } 1391 }
1392 int delFut = 0; 1392 int delFut = 0;
1393 int remRem = 0; 1393 int remRem = 0;
1394 if ( mSyncManager->mWriteBackInFuture ) { 1394 if ( mSyncManager->mWriteBackInFuture ) {
1395 er = remote->rawIncidences(); 1395 er = remote->rawIncidences();
1396 remRem = er.count(); 1396 remRem = er.count();
1397 inR = er.first(); 1397 inR = er.first();
1398 QDateTime dt; 1398 QDateTime dt;
1399 QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) ); 1399 QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) );
1400 QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 ); 1400 QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 );
1401 while ( inR ) { 1401 while ( inR ) {
1402 if ( inR->type() == "Todo" ) { 1402 if ( inR->typeID() == todoID ) {
1403 Todo * t = (Todo*)inR; 1403 Todo * t = (Todo*)inR;
1404 if ( t->hasDueDate() ) 1404 if ( t->hasDueDate() )
1405 dt = t->dtDue(); 1405 dt = t->dtDue();
1406 else 1406 else
1407 dt = cur.addSecs( 62 ); 1407 dt = cur.addSecs( 62 );
1408 } 1408 }
1409 else if (inR->type() == "Event" ) { 1409 else if (inR->typeID() == eventID ) {
1410 bool ok; 1410 bool ok;
1411 dt = inR->getNextOccurence( cur, &ok ); 1411 dt = inR->getNextOccurence( cur, &ok );
1412 if ( !ok ) 1412 if ( !ok )
1413 dt = cur.addSecs( -62 ); 1413 dt = cur.addSecs( -62 );
1414 } 1414 }
1415 else 1415 else
1416 dt = inR->dtStart(); 1416 dt = inR->dtStart();
1417 if ( dt < cur || dt > end ) { 1417 if ( dt < cur || dt > end ) {
1418 remote->deleteIncidence( inR ); 1418 remote->deleteIncidence( inR );
1419 ++delFut; 1419 ++delFut;
1420 } 1420 }
1421 inR = er.next(); 1421 inR = er.next();
1422 } 1422 }
1423 } 1423 }
1424 bar.hide(); 1424 bar.hide();
1425 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1425 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1426 eventLSync->setReadOnly( false ); 1426 eventLSync->setReadOnly( false );
1427 eventLSync->setDtStart( mLastCalendarSync ); 1427 eventLSync->setDtStart( mLastCalendarSync );
1428 eventRSync->setDtStart( mLastCalendarSync ); 1428 eventRSync->setDtStart( mLastCalendarSync );
1429 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1429 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1430 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1430 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1431 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1431 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1432 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1432 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1433 eventLSync->setReadOnly( true ); 1433 eventLSync->setReadOnly( true );
@@ -2456,70 +2456,70 @@ void CalendarView::updateView()
2456 // We assume that the navigator only selects consecutive days. 2456 // We assume that the navigator only selects consecutive days.
2457 updateView( tmpList.first(), tmpList.last() ); 2457 updateView( tmpList.first(), tmpList.last() );
2458} 2458}
2459 2459
2460void CalendarView::updateUnmanagedViews() 2460void CalendarView::updateUnmanagedViews()
2461{ 2461{
2462 mDateNavigator->updateDayMatrix(); 2462 mDateNavigator->updateDayMatrix();
2463} 2463}
2464 2464
2465int CalendarView::msgItemDelete(const QString name) 2465int CalendarView::msgItemDelete(const QString name)
2466{ 2466{
2467 return KMessageBox::warningContinueCancel(this,name +"\n\n"+ 2467 return KMessageBox::warningContinueCancel(this,name +"\n\n"+
2468 i18n("This item will be\npermanently deleted."), 2468 i18n("This item will be\npermanently deleted."),
2469 i18n("KO/Pi Confirmation"),i18n("Delete")); 2469 i18n("KO/Pi Confirmation"),i18n("Delete"));
2470} 2470}
2471 2471
2472 2472
2473void CalendarView::edit_cut() 2473void CalendarView::edit_cut()
2474{ 2474{
2475 Event *anEvent=0; 2475 Event *anEvent=0;
2476 2476
2477 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2477 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2478 2478
2479 if (mViewManager->currentView()->isEventView()) { 2479 if (mViewManager->currentView()->isEventView()) {
2480 if ( incidence && incidence->type() == "Event" ) { 2480 if ( incidence && incidence->typeID() == eventID ) {
2481 anEvent = static_cast<Event *>(incidence); 2481 anEvent = static_cast<Event *>(incidence);
2482 } 2482 }
2483 } 2483 }
2484 2484
2485 if (!anEvent) { 2485 if (!anEvent) {
2486 KNotifyClient::beep(); 2486 KNotifyClient::beep();
2487 return; 2487 return;
2488 } 2488 }
2489 DndFactory factory( mCalendar ); 2489 DndFactory factory( mCalendar );
2490 factory.cutIncidence(anEvent); 2490 factory.cutIncidence(anEvent);
2491 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2491 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2492} 2492}
2493 2493
2494void CalendarView::edit_copy() 2494void CalendarView::edit_copy()
2495{ 2495{
2496 Event *anEvent=0; 2496 Event *anEvent=0;
2497 2497
2498 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2498 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2499 2499
2500 if (mViewManager->currentView()->isEventView()) { 2500 if (mViewManager->currentView()->isEventView()) {
2501 if ( incidence && incidence->type() == "Event" ) { 2501 if ( incidence && incidence->typeID() == eventID ) {
2502 anEvent = static_cast<Event *>(incidence); 2502 anEvent = static_cast<Event *>(incidence);
2503 } 2503 }
2504 } 2504 }
2505 2505
2506 if (!anEvent) { 2506 if (!anEvent) {
2507 KNotifyClient::beep(); 2507 KNotifyClient::beep();
2508 return; 2508 return;
2509 } 2509 }
2510 DndFactory factory( mCalendar ); 2510 DndFactory factory( mCalendar );
2511 factory.copyIncidence(anEvent); 2511 factory.copyIncidence(anEvent);
2512} 2512}
2513 2513
2514void CalendarView::edit_paste() 2514void CalendarView::edit_paste()
2515{ 2515{
2516 QDate date = mNavigator->selectedDates().first(); 2516 QDate date = mNavigator->selectedDates().first();
2517 2517
2518 DndFactory factory( mCalendar ); 2518 DndFactory factory( mCalendar );
2519 Event *pastedEvent = (Event *)factory.pasteIncidence( date ); 2519 Event *pastedEvent = (Event *)factory.pasteIncidence( date );
2520 2520
2521 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2521 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2522} 2522}
2523 2523
2524void CalendarView::edit_options() 2524void CalendarView::edit_options()
2525{ 2525{
@@ -2529,80 +2529,80 @@ void CalendarView::edit_options()
2529 mDialogManager->showOptionsDialog(); 2529 mDialogManager->showOptionsDialog();
2530 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { 2530 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) {
2531 emit saveStopTimer(); 2531 emit saveStopTimer();
2532 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), 2532 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"),
2533 i18n("Timezone settings"),i18n("Reload"))) { 2533 i18n("Timezone settings"),i18n("Reload"))) {
2534 qDebug("KO: TZ reload cancelled "); 2534 qDebug("KO: TZ reload cancelled ");
2535 return; 2535 return;
2536 } 2536 }
2537 qDebug("KO: Timezone change "); 2537 qDebug("KO: Timezone change ");
2538 openCalendar( MainWindow::defaultFileName() ); 2538 openCalendar( MainWindow::defaultFileName() );
2539 setModified(true); 2539 setModified(true);
2540 } 2540 }
2541 else 2541 else
2542 qDebug("KO: No tz change "); 2542 qDebug("KO: No tz change ");
2543 2543
2544} 2544}
2545 2545
2546 2546
2547void CalendarView::slotSelectPickerDate( QDate d) 2547void CalendarView::slotSelectPickerDate( QDate d)
2548{ 2548{
2549 mDateFrame->hide(); 2549 mDateFrame->hide();
2550 if ( mDatePickerMode == 1 ) { 2550 if ( mDatePickerMode == 1 ) {
2551 mNavigator->slotDaySelect( d ); 2551 mNavigator->slotDaySelect( d );
2552 } else if ( mDatePickerMode == 2 ) { 2552 } else if ( mDatePickerMode == 2 ) {
2553 if ( mMoveIncidence->type() == "Todo" ) { 2553 if ( mMoveIncidence->typeID() == todoID ) {
2554 Todo * to = (Todo *) mMoveIncidence; 2554 Todo * to = (Todo *) mMoveIncidence;
2555 QTime tim; 2555 QTime tim;
2556 int len = 0; 2556 int len = 0;
2557 if ( to->hasStartDate() && to->hasDueDate() ) 2557 if ( to->hasStartDate() && to->hasDueDate() )
2558 len = to->dtStart().secsTo( to->dtDue()); 2558 len = to->dtStart().secsTo( to->dtDue());
2559 if ( to->hasDueDate() ) 2559 if ( to->hasDueDate() )
2560 tim = to->dtDue().time(); 2560 tim = to->dtDue().time();
2561 else { 2561 else {
2562 tim = QTime ( 0,0,0 ); 2562 tim = QTime ( 0,0,0 );
2563 to->setFloats( true ); 2563 to->setFloats( true );
2564 to->setHasDueDate( true ); 2564 to->setHasDueDate( true );
2565 } 2565 }
2566 QDateTime dt ( d,tim ); 2566 QDateTime dt ( d,tim );
2567 to->setDtDue( dt ); 2567 to->setDtDue( dt );
2568 2568
2569 if ( to->hasStartDate() ) { 2569 if ( to->hasStartDate() ) {
2570 if ( len>0 ) 2570 if ( len>0 )
2571 to->setDtStart(to->dtDue().addSecs( -len )); 2571 to->setDtStart(to->dtDue().addSecs( -len ));
2572 else 2572 else
2573 if (to->dtStart() > to->dtDue() ) 2573 if (to->dtStart() > to->dtDue() )
2574 to->setDtStart(to->dtDue().addDays( -3 )); 2574 to->setDtStart(to->dtDue().addDays( -3 ));
2575 } 2575 }
2576 2576
2577 todoChanged( to ); 2577 todoChanged( to );
2578 } else { 2578 } else {
2579 if ( mMoveIncidence->doesRecur() ) { 2579 if ( mMoveIncidence->doesRecur() ) {
2580#if 0 2580#if 0
2581 // PENDING implement this 2581 // PENDING implement this
2582 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); 2582 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate );
2583 mCalendar()->addIncidence( newInc ); 2583 mCalendar()->addIncidence( newInc );
2584 if ( mMoveIncidence->type() == "Todo" ) 2584 if ( mMoveIncidence->typeID() == todoID )
2585 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); 2585 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED );
2586 else 2586 else
2587 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); 2587 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED);
2588 mMoveIncidence = newInc; 2588 mMoveIncidence = newInc;
2589 2589
2590#endif 2590#endif
2591 } 2591 }
2592 QTime tim = mMoveIncidence->dtStart().time(); 2592 QTime tim = mMoveIncidence->dtStart().time();
2593 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); 2593 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
2594 QDateTime dt ( d,tim ); 2594 QDateTime dt ( d,tim );
2595 mMoveIncidence->setDtStart( dt ); 2595 mMoveIncidence->setDtStart( dt );
2596 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); 2596 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
2597 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); 2597 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
2598 } 2598 }
2599 2599
2600 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); 2600 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
2601 } 2601 }
2602} 2602}
2603 2603
2604void CalendarView::removeCategories() 2604void CalendarView::removeCategories()
2605{ 2605{
2606 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2606 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2607 QStringList catList = KOPrefs::instance()->mCustomCategories; 2607 QStringList catList = KOPrefs::instance()->mCustomCategories;
2608 QStringList catIncList; 2608 QStringList catIncList;
@@ -2746,49 +2746,49 @@ void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2746 KApplication::convert2latin1( fn ); 2746 KApplication::convert2latin1( fn );
2747#ifndef DESKTOP_VERSION 2747#ifndef DESKTOP_VERSION
2748 Ir *ir = new Ir( this ); 2748 Ir *ir = new Ir( this );
2749 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 2749 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
2750 ir->send( fn, description, "text/x-vCalendar" ); 2750 ir->send( fn, description, "text/x-vCalendar" );
2751#endif 2751#endif
2752 } 2752 }
2753} 2753}
2754void CalendarView::beamDone( Ir *ir ) 2754void CalendarView::beamDone( Ir *ir )
2755{ 2755{
2756#ifndef DESKTOP_VERSION 2756#ifndef DESKTOP_VERSION
2757 delete ir; 2757 delete ir;
2758#endif 2758#endif
2759 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); 2759 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") );
2760 topLevelWidget()->raise(); 2760 topLevelWidget()->raise();
2761} 2761}
2762 2762
2763void CalendarView::moveIncidence(Incidence * inc ) 2763void CalendarView::moveIncidence(Incidence * inc )
2764{ 2764{
2765 if ( !inc ) return; 2765 if ( !inc ) return;
2766 showDatePickerPopup(); 2766 showDatePickerPopup();
2767 mDatePickerMode = 2; 2767 mDatePickerMode = 2;
2768 mMoveIncidence = inc ; 2768 mMoveIncidence = inc ;
2769 QDate da; 2769 QDate da;
2770 if ( mMoveIncidence->type() == "Todo" ) { 2770 if ( mMoveIncidence->typeID() == todoID ) {
2771 Todo * to = (Todo *) mMoveIncidence; 2771 Todo * to = (Todo *) mMoveIncidence;
2772 if ( to->hasDueDate() ) 2772 if ( to->hasDueDate() )
2773 da = to->dtDue().date(); 2773 da = to->dtDue().date();
2774 else 2774 else
2775 da = QDate::currentDate(); 2775 da = QDate::currentDate();
2776 } else { 2776 } else {
2777 da = mMoveIncidence->dtStart().date(); 2777 da = mMoveIncidence->dtStart().date();
2778 } 2778 }
2779 //PENDING set date for recurring incidence to date of recurrence 2779 //PENDING set date for recurring incidence to date of recurrence
2780 //mMoveIncidenceOldDate; 2780 //mMoveIncidenceOldDate;
2781 mDatePicker->setDate( da ); 2781 mDatePicker->setDate( da );
2782} 2782}
2783void CalendarView::showDatePickerPopup() 2783void CalendarView::showDatePickerPopup()
2784{ 2784{
2785 if ( mDateFrame->isVisible() ) 2785 if ( mDateFrame->isVisible() )
2786 mDateFrame->hide(); 2786 mDateFrame->hide();
2787 else { 2787 else {
2788 int offX = 0, offY = 0; 2788 int offX = 0, offY = 0;
2789#ifdef DESKTOP_VERSION 2789#ifdef DESKTOP_VERSION
2790 int w =mDatePicker->sizeHint().width() ; 2790 int w =mDatePicker->sizeHint().width() ;
2791 int h = mDatePicker->sizeHint().height() ; 2791 int h = mDatePicker->sizeHint().height() ;
2792 int dw = topLevelWidget()->width(); 2792 int dw = topLevelWidget()->width();
2793 int dh = topLevelWidget()->height(); 2793 int dh = topLevelWidget()->height();
2794 offX = topLevelWidget()->x(); 2794 offX = topLevelWidget()->x();
@@ -2879,49 +2879,49 @@ void CalendarView::beamIncidence()
2879 beamIncidence(incidence); 2879 beamIncidence(incidence);
2880 } 2880 }
2881} 2881}
2882void CalendarView::toggleCancelIncidence() 2882void CalendarView::toggleCancelIncidence()
2883{ 2883{
2884 Incidence *incidence = currentSelection(); 2884 Incidence *incidence = currentSelection();
2885 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2885 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2886 if ( incidence ) { 2886 if ( incidence ) {
2887 cancelIncidence(incidence); 2887 cancelIncidence(incidence);
2888 } 2888 }
2889} 2889}
2890 2890
2891 2891
2892void CalendarView::cancelIncidence(Incidence * inc ) 2892void CalendarView::cancelIncidence(Incidence * inc )
2893{ 2893{
2894 inc->setCancelled( ! inc->cancelled() ); 2894 inc->setCancelled( ! inc->cancelled() );
2895 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); 2895 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED );
2896 updateView(); 2896 updateView();
2897} 2897}
2898void CalendarView::cloneIncidence(Incidence * orgInc ) 2898void CalendarView::cloneIncidence(Incidence * orgInc )
2899{ 2899{
2900 Incidence * newInc = orgInc->clone(); 2900 Incidence * newInc = orgInc->clone();
2901 newInc->recreate(); 2901 newInc->recreate();
2902 2902
2903 if ( newInc->type() == "Todo" ) { 2903 if ( newInc->typeID() == todoID ) {
2904 Todo* t = (Todo*) newInc; 2904 Todo* t = (Todo*) newInc;
2905 bool cloneSub = false; 2905 bool cloneSub = false;
2906 if ( orgInc->relations().count() ) { 2906 if ( orgInc->relations().count() ) {
2907 int result = KMessageBox::warningYesNoCancel(this, 2907 int result = KMessageBox::warningYesNoCancel(this,
2908 i18n("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( newInc->summary().left ( 25 ) ), 2908 i18n("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( newInc->summary().left ( 25 ) ),
2909 i18n("Todo has subtodos"), 2909 i18n("Todo has subtodos"),
2910 i18n("Yes"), 2910 i18n("Yes"),
2911 i18n("No")); 2911 i18n("No"));
2912 2912
2913 if ( result == KMessageBox::Cancel ) { 2913 if ( result == KMessageBox::Cancel ) {
2914 delete t; 2914 delete t;
2915 return; 2915 return;
2916 } 2916 }
2917 if (result == KMessageBox::Yes) cloneSub = true; 2917 if (result == KMessageBox::Yes) cloneSub = true;
2918 } 2918 }
2919 showTodoEditor(); 2919 showTodoEditor();
2920 mTodoEditor->editTodo( t ); 2920 mTodoEditor->editTodo( t );
2921 if ( mTodoEditor->exec() ) { 2921 if ( mTodoEditor->exec() ) {
2922 if ( cloneSub ) { 2922 if ( cloneSub ) {
2923 orgInc->cloneRelations( t ); 2923 orgInc->cloneRelations( t );
2924 mCalendar->addIncidenceBranch( t ); 2924 mCalendar->addIncidenceBranch( t );
2925 updateView(); 2925 updateView();
2926 2926
2927 } else { 2927 } else {
@@ -3143,89 +3143,89 @@ void CalendarView::showJournal( Journal *jour )
3143{ 3143{
3144 getEventViewerDialog()->setJournal(jour); 3144 getEventViewerDialog()->setJournal(jour);
3145 getEventViewerDialog()->showMe(); 3145 getEventViewerDialog()->showMe();
3146 3146
3147} 3147}
3148// void CalendarView::todoModified (Todo *event, int changed) 3148// void CalendarView::todoModified (Todo *event, int changed)
3149// { 3149// {
3150// // if (mDialogList.find (event) != mDialogList.end ()) { 3150// // if (mDialogList.find (event) != mDialogList.end ()) {
3151// // kdDebug() << "Todo modified and open" << endl; 3151// // kdDebug() << "Todo modified and open" << endl;
3152// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; 3152// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event];
3153// // temp->modified (changed); 3153// // temp->modified (changed);
3154 3154
3155// // } 3155// // }
3156 3156
3157// mViewManager->updateView(); 3157// mViewManager->updateView();
3158// } 3158// }
3159 3159
3160void CalendarView::appointment_show() 3160void CalendarView::appointment_show()
3161{ 3161{
3162 Event *anEvent = 0; 3162 Event *anEvent = 0;
3163 3163
3164 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 3164 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
3165 3165
3166 if (mViewManager->currentView()->isEventView()) { 3166 if (mViewManager->currentView()->isEventView()) {
3167 if ( incidence && incidence->type() == "Event" ) { 3167 if ( incidence && incidence->typeID() == eventID ) {
3168 anEvent = static_cast<Event *>(incidence); 3168 anEvent = static_cast<Event *>(incidence);
3169 } 3169 }
3170 } 3170 }
3171 3171
3172 if (!anEvent) { 3172 if (!anEvent) {
3173 KNotifyClient::beep(); 3173 KNotifyClient::beep();
3174 return; 3174 return;
3175 } 3175 }
3176 3176
3177 showEvent(anEvent); 3177 showEvent(anEvent);
3178} 3178}
3179 3179
3180void CalendarView::appointment_edit() 3180void CalendarView::appointment_edit()
3181{ 3181{
3182 Event *anEvent = 0; 3182 Event *anEvent = 0;
3183 3183
3184 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 3184 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
3185 3185
3186 if (mViewManager->currentView()->isEventView()) { 3186 if (mViewManager->currentView()->isEventView()) {
3187 if ( incidence && incidence->type() == "Event" ) { 3187 if ( incidence && incidence->typeID() == eventID ) {
3188 anEvent = static_cast<Event *>(incidence); 3188 anEvent = static_cast<Event *>(incidence);
3189 } 3189 }
3190 } 3190 }
3191 3191
3192 if (!anEvent) { 3192 if (!anEvent) {
3193 KNotifyClient::beep(); 3193 KNotifyClient::beep();
3194 return; 3194 return;
3195 } 3195 }
3196 3196
3197 editEvent(anEvent); 3197 editEvent(anEvent);
3198} 3198}
3199 3199
3200void CalendarView::appointment_delete() 3200void CalendarView::appointment_delete()
3201{ 3201{
3202 Event *anEvent = 0; 3202 Event *anEvent = 0;
3203 3203
3204 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 3204 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
3205 3205
3206 if (mViewManager->currentView()->isEventView()) { 3206 if (mViewManager->currentView()->isEventView()) {
3207 if ( incidence && incidence->type() == "Event" ) { 3207 if ( incidence && incidence->typeID() == eventID ) {
3208 anEvent = static_cast<Event *>(incidence); 3208 anEvent = static_cast<Event *>(incidence);
3209 } 3209 }
3210 } 3210 }
3211 3211
3212 if (!anEvent) { 3212 if (!anEvent) {
3213 KNotifyClient::beep(); 3213 KNotifyClient::beep();
3214 return; 3214 return;
3215 } 3215 }
3216 3216
3217 deleteEvent(anEvent); 3217 deleteEvent(anEvent);
3218} 3218}
3219 3219
3220void CalendarView::todo_resub( Todo * parent, Todo * sub ) 3220void CalendarView::todo_resub( Todo * parent, Todo * sub )
3221{ 3221{
3222 if (!sub) return; 3222 if (!sub) return;
3223 if ( sub->relatedTo() == parent ) 3223 if ( sub->relatedTo() == parent )
3224 return; 3224 return;
3225 sub->setRelatedTo(parent); 3225 sub->setRelatedTo(parent);
3226 sub->updated(); 3226 sub->updated();
3227 setModified(true); 3227 setModified(true);
3228 updateView(); 3228 updateView();
3229} 3229}
3230void CalendarView::todo_unsub(Todo *anTodo ) 3230void CalendarView::todo_unsub(Todo *anTodo )
3231{ 3231{
@@ -3384,97 +3384,97 @@ bool CalendarView::deleteEvent(const QString &uid)
3384} 3384}
3385 3385
3386/*****************************************************************************/ 3386/*****************************************************************************/
3387 3387
3388void CalendarView::action_mail() 3388void CalendarView::action_mail()
3389{ 3389{
3390#ifndef KORG_NOMAIL 3390#ifndef KORG_NOMAIL
3391 KOMailClient mailClient; 3391 KOMailClient mailClient;
3392 3392
3393 Incidence *incidence = currentSelection(); 3393 Incidence *incidence = currentSelection();
3394 3394
3395 if (!incidence) { 3395 if (!incidence) {
3396 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); 3396 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected."));
3397 return; 3397 return;
3398 } 3398 }
3399 if(incidence->attendeeCount() == 0 ) { 3399 if(incidence->attendeeCount() == 0 ) {
3400 KMessageBox::sorry(this, 3400 KMessageBox::sorry(this,
3401 i18n("Can't generate mail:\nNo attendees defined.\n")); 3401 i18n("Can't generate mail:\nNo attendees defined.\n"));
3402 return; 3402 return;
3403 } 3403 }
3404 3404
3405 CalendarLocal cal_tmp; 3405 CalendarLocal cal_tmp;
3406 Event *event = 0; 3406 Event *event = 0;
3407 Event *ev = 0; 3407 Event *ev = 0;
3408 if ( incidence && incidence->type() == "Event" ) { 3408 if ( incidence && incidence->typeID() == eventID ) {
3409 event = static_cast<Event *>(incidence); 3409 event = static_cast<Event *>(incidence);
3410 ev = new Event(*event); 3410 ev = new Event(*event);
3411 cal_tmp.addEvent(ev); 3411 cal_tmp.addEvent(ev);
3412 } 3412 }
3413 ICalFormat mForm(); 3413 ICalFormat mForm();
3414 QString attachment = mForm.toString( &cal_tmp ); 3414 QString attachment = mForm.toString( &cal_tmp );
3415 if (ev) delete(ev); 3415 if (ev) delete(ev);
3416 3416
3417 mailClient.mailAttendees(currentSelection(), attachment); 3417 mailClient.mailAttendees(currentSelection(), attachment);
3418 3418
3419#endif 3419#endif
3420 3420
3421#if 0 3421#if 0
3422 Event *anEvent = 0; 3422 Event *anEvent = 0;
3423 if (mViewManager->currentView()->isEventView()) { 3423 if (mViewManager->currentView()->isEventView()) {
3424 anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); 3424 anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first());
3425 } 3425 }
3426 3426
3427 if (!anEvent) { 3427 if (!anEvent) {
3428 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); 3428 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected."));
3429 return; 3429 return;
3430 } 3430 }
3431 if(anEvent->attendeeCount() == 0 ) { 3431 if(anEvent->attendeeCount() == 0 ) {
3432 KMessageBox::sorry(this, 3432 KMessageBox::sorry(this,
3433 i18n("Can't generate mail:\nNo attendees defined.\n")); 3433 i18n("Can't generate mail:\nNo attendees defined.\n"));
3434 return; 3434 return;
3435 } 3435 }
3436 3436
3437 mailobject.emailEvent(anEvent); 3437 mailobject.emailEvent(anEvent);
3438#endif 3438#endif
3439} 3439}
3440 3440
3441 3441
3442void CalendarView::schedule_publish(Incidence *incidence) 3442void CalendarView::schedule_publish(Incidence *incidence)
3443{ 3443{
3444 Event *event = 0; 3444 Event *event = 0;
3445 Todo *todo = 0; 3445 Todo *todo = 0;
3446 3446
3447 if (incidence == 0) { 3447 if (incidence == 0) {
3448 incidence = mViewManager->currentView()->selectedIncidences().first(); 3448 incidence = mViewManager->currentView()->selectedIncidences().first();
3449 if (incidence == 0) { 3449 if (incidence == 0) {
3450 incidence = mTodoList->selectedIncidences().first(); 3450 incidence = mTodoList->selectedIncidences().first();
3451 } 3451 }
3452 } 3452 }
3453 if ( incidence && incidence->type() == "Event" ) { 3453 if ( incidence && incidence->typeID() == eventID ) {
3454 event = static_cast<Event *>(incidence); 3454 event = static_cast<Event *>(incidence);
3455 } else { 3455 } else {
3456 if ( incidence && incidence->type() == "Todo" ) { 3456 if ( incidence && incidence->typeID() == todoID ) {
3457 todo = static_cast<Todo *>(incidence); 3457 todo = static_cast<Todo *>(incidence);
3458 } 3458 }
3459 } 3459 }
3460 3460
3461 if (!event && !todo) { 3461 if (!event && !todo) {
3462 KMessageBox::sorry(this,i18n("No event selected.")); 3462 KMessageBox::sorry(this,i18n("No event selected."));
3463 return; 3463 return;
3464 } 3464 }
3465 3465
3466 PublishDialog *publishdlg = new PublishDialog(); 3466 PublishDialog *publishdlg = new PublishDialog();
3467 if (incidence->attendeeCount()>0) { 3467 if (incidence->attendeeCount()>0) {
3468 QPtrList<Attendee> attendees = incidence->attendees(); 3468 QPtrList<Attendee> attendees = incidence->attendees();
3469 attendees.first(); 3469 attendees.first();
3470 while ( attendees.current()!=0 ) { 3470 while ( attendees.current()!=0 ) {
3471 publishdlg->addAttendee(attendees.current()); 3471 publishdlg->addAttendee(attendees.current());
3472 attendees.next(); 3472 attendees.next();
3473 } 3473 }
3474 } 3474 }
3475 bool send = true; 3475 bool send = true;
3476 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { 3476 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) {
3477 if ( publishdlg->exec() != QDialog::Accepted ) 3477 if ( publishdlg->exec() != QDialog::Accepted )
3478 send = false; 3478 send = false;
3479 } 3479 }
3480 if ( send ) { 3480 if ( send ) {
@@ -3544,52 +3544,52 @@ void CalendarView::schedule_publish_freebusy(int daysToPublish)
3544 freebusy->setOrganizer(KOPrefs::instance()->email()); 3544 freebusy->setOrganizer(KOPrefs::instance()->email());
3545 3545
3546 3546
3547 PublishDialog *publishdlg = new PublishDialog(); 3547 PublishDialog *publishdlg = new PublishDialog();
3548 if ( publishdlg->exec() == QDialog::Accepted ) { 3548 if ( publishdlg->exec() == QDialog::Accepted ) {
3549 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3549 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3550 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { 3550 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) {
3551 delete(freebusy); 3551 delete(freebusy);
3552 } 3552 }
3553 } 3553 }
3554 delete publishdlg; 3554 delete publishdlg;
3555} 3555}
3556 3556
3557void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) 3557void CalendarView::schedule(Scheduler::Method method, Incidence *incidence)
3558{ 3558{
3559 Event *event = 0; 3559 Event *event = 0;
3560 Todo *todo = 0; 3560 Todo *todo = 0;
3561 3561
3562 if (incidence == 0) { 3562 if (incidence == 0) {
3563 incidence = mViewManager->currentView()->selectedIncidences().first(); 3563 incidence = mViewManager->currentView()->selectedIncidences().first();
3564 if (incidence == 0) { 3564 if (incidence == 0) {
3565 incidence = mTodoList->selectedIncidences().first(); 3565 incidence = mTodoList->selectedIncidences().first();
3566 } 3566 }
3567 } 3567 }
3568 if ( incidence && incidence->type() == "Event" ) { 3568 if ( incidence && incidence->typeID() == eventID ) {
3569 event = static_cast<Event *>(incidence); 3569 event = static_cast<Event *>(incidence);
3570 } 3570 }
3571 if ( incidence && incidence->type() == "Todo" ) { 3571 if ( incidence && incidence->typeID() == todoID ) {
3572 todo = static_cast<Todo *>(incidence); 3572 todo = static_cast<Todo *>(incidence);
3573 } 3573 }
3574 3574
3575 if (!event && !todo) { 3575 if (!event && !todo) {
3576 KMessageBox::sorry(this,i18n("No event selected.")); 3576 KMessageBox::sorry(this,i18n("No event selected."));
3577 return; 3577 return;
3578 } 3578 }
3579 3579
3580 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { 3580 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) {
3581 KMessageBox::sorry(this,i18n("The event has no attendees.")); 3581 KMessageBox::sorry(this,i18n("The event has no attendees."));
3582 return; 3582 return;
3583 } 3583 }
3584 3584
3585 Event *ev = 0; 3585 Event *ev = 0;
3586 if (event) ev = new Event(*event); 3586 if (event) ev = new Event(*event);
3587 Todo *to = 0; 3587 Todo *to = 0;
3588 if (todo) to = new Todo(*todo); 3588 if (todo) to = new Todo(*todo);
3589 3589
3590 if (method == Scheduler::Reply || method == Scheduler::Refresh) { 3590 if (method == Scheduler::Reply || method == Scheduler::Refresh) {
3591 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 3591 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
3592 if (!me) { 3592 if (!me) {
3593 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); 3593 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails."));
3594 return; 3594 return;
3595 } 3595 }
@@ -3751,87 +3751,87 @@ void CalendarView::adaptNavigationUnits()
3751} 3751}
3752 3752
3753void CalendarView::processMainViewSelection( Incidence *incidence ) 3753void CalendarView::processMainViewSelection( Incidence *incidence )
3754{ 3754{
3755 if ( incidence ) mTodoList->clearSelection(); 3755 if ( incidence ) mTodoList->clearSelection();
3756 processIncidenceSelection( incidence ); 3756 processIncidenceSelection( incidence );
3757} 3757}
3758 3758
3759void CalendarView::processTodoListSelection( Incidence *incidence ) 3759void CalendarView::processTodoListSelection( Incidence *incidence )
3760{ 3760{
3761 if ( incidence && mViewManager->currentView() ) { 3761 if ( incidence && mViewManager->currentView() ) {
3762 mViewManager->currentView()->clearSelection(); 3762 mViewManager->currentView()->clearSelection();
3763 } 3763 }
3764 processIncidenceSelection( incidence ); 3764 processIncidenceSelection( incidence );
3765} 3765}
3766 3766
3767void CalendarView::processIncidenceSelection( Incidence *incidence ) 3767void CalendarView::processIncidenceSelection( Incidence *incidence )
3768{ 3768{
3769 if ( incidence == mSelectedIncidence ) return; 3769 if ( incidence == mSelectedIncidence ) return;
3770 3770
3771 mSelectedIncidence = incidence; 3771 mSelectedIncidence = incidence;
3772 3772
3773 emit incidenceSelected( mSelectedIncidence ); 3773 emit incidenceSelected( mSelectedIncidence );
3774 3774
3775 if ( incidence && incidence->type() == "Event" ) { 3775 if ( incidence && incidence->typeID() == eventID ) {
3776 Event *event = static_cast<Event *>( incidence ); 3776 Event *event = static_cast<Event *>( incidence );
3777 if ( event->organizer() == KOPrefs::instance()->email() ) { 3777 if ( event->organizer() == KOPrefs::instance()->email() ) {
3778 emit organizerEventsSelected( true ); 3778 emit organizerEventsSelected( true );
3779 } else { 3779 } else {
3780 emit organizerEventsSelected(false); 3780 emit organizerEventsSelected(false);
3781 } 3781 }
3782 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3782 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3783 KOPrefs::instance()->email() ) ) { 3783 KOPrefs::instance()->email() ) ) {
3784 emit groupEventsSelected( true ); 3784 emit groupEventsSelected( true );
3785 } else { 3785 } else {
3786 emit groupEventsSelected(false); 3786 emit groupEventsSelected(false);
3787 } 3787 }
3788 return; 3788 return;
3789 } else { 3789 } else {
3790 if ( incidence && incidence->type() == "Todo" ) { 3790 if ( incidence && incidence->typeID() == todoID ) {
3791 emit todoSelected( true ); 3791 emit todoSelected( true );
3792 Todo *event = static_cast<Todo *>( incidence ); 3792 Todo *event = static_cast<Todo *>( incidence );
3793 if ( event->organizer() == KOPrefs::instance()->email() ) { 3793 if ( event->organizer() == KOPrefs::instance()->email() ) {
3794 emit organizerEventsSelected( true ); 3794 emit organizerEventsSelected( true );
3795 } else { 3795 } else {
3796 emit organizerEventsSelected(false); 3796 emit organizerEventsSelected(false);
3797 } 3797 }
3798 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3798 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3799 KOPrefs::instance()->email() ) ) { 3799 KOPrefs::instance()->email() ) ) {
3800 emit groupEventsSelected( true ); 3800 emit groupEventsSelected( true );
3801 } else { 3801 } else {
3802 emit groupEventsSelected(false); 3802 emit groupEventsSelected(false);
3803 } 3803 }
3804 return; 3804 return;
3805 } else { 3805 } else {
3806 emit todoSelected( false ); 3806 emit todoSelected( false );
3807 emit organizerEventsSelected(false); 3807 emit organizerEventsSelected(false);
3808 emit groupEventsSelected(false); 3808 emit groupEventsSelected(false);
3809 } 3809 }
3810 return; 3810 return;
3811 } 3811 }
3812 3812
3813 /* if ( incidence && incidence->type() == "Todo" ) { 3813 /* if ( incidence && incidence->typeID() == todoID ) {
3814 emit todoSelected( true ); 3814 emit todoSelected( true );
3815 } else { 3815 } else {
3816 emit todoSelected( false ); 3816 emit todoSelected( false );
3817 }*/ 3817 }*/
3818} 3818}
3819 3819
3820 3820
3821void CalendarView::checkClipboard() 3821void CalendarView::checkClipboard()
3822{ 3822{
3823#ifndef KORG_NODND 3823#ifndef KORG_NODND
3824 if (ICalDrag::canDecode(QApplication::clipboard()->data())) { 3824 if (ICalDrag::canDecode(QApplication::clipboard()->data())) {
3825 emit pasteEnabled(true); 3825 emit pasteEnabled(true);
3826 } else { 3826 } else {
3827 emit pasteEnabled(false); 3827 emit pasteEnabled(false);
3828 } 3828 }
3829#endif 3829#endif
3830} 3830}
3831 3831
3832void CalendarView::showDates(const DateList &selectedDates) 3832void CalendarView::showDates(const DateList &selectedDates)
3833{ 3833{
3834 // kdDebug() << "CalendarView::selectDates()" << endl; 3834 // kdDebug() << "CalendarView::selectDates()" << endl;
3835 3835
3836 3836
3837 if ( !mBlockShowDates ) { 3837 if ( !mBlockShowDates ) {
@@ -4044,54 +4044,54 @@ void CalendarView::toggleExpand()
4044{ 4044{
4045 // if ( mLeftFrame->isHidden() ) { 4045 // if ( mLeftFrame->isHidden() ) {
4046 // mLeftFrame->show(); 4046 // mLeftFrame->show();
4047 // emit calendarViewExpanded( false ); 4047 // emit calendarViewExpanded( false );
4048 // } else { 4048 // } else {
4049 // mLeftFrame->hide(); 4049 // mLeftFrame->hide();
4050 // emit calendarViewExpanded( true ); 4050 // emit calendarViewExpanded( true );
4051 // } 4051 // }
4052 //qDebug(" CalendarView::toggleExpand()"); 4052 //qDebug(" CalendarView::toggleExpand()");
4053 globalFlagBlockAgenda = 1; 4053 globalFlagBlockAgenda = 1;
4054 emit calendarViewExpanded( !mLeftFrame->isHidden() ); 4054 emit calendarViewExpanded( !mLeftFrame->isHidden() );
4055 globalFlagBlockAgenda = 5; 4055 globalFlagBlockAgenda = 5;
4056 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); 4056 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() );
4057 //mViewManager->showView( 0, true ); 4057 //mViewManager->showView( 0, true );
4058} 4058}
4059 4059
4060void CalendarView::calendarModified( bool modified, Calendar * ) 4060void CalendarView::calendarModified( bool modified, Calendar * )
4061{ 4061{
4062 setModified( modified ); 4062 setModified( modified );
4063} 4063}
4064 4064
4065Todo *CalendarView::selectedTodo() 4065Todo *CalendarView::selectedTodo()
4066{ 4066{
4067 Incidence *incidence = currentSelection(); 4067 Incidence *incidence = currentSelection();
4068 if ( incidence && incidence->type() == "Todo" ) { 4068 if ( incidence && incidence->typeID() == todoID ) {
4069 return static_cast<Todo *>( incidence ); 4069 return static_cast<Todo *>( incidence );
4070 } 4070 }
4071 4071
4072 incidence = mTodoList->selectedIncidences().first(); 4072 incidence = mTodoList->selectedIncidences().first();
4073 if ( incidence && incidence->type() == "Todo" ) { 4073 if ( incidence && incidence->typeID() == todoID ) {
4074 return static_cast<Todo *>( incidence ); 4074 return static_cast<Todo *>( incidence );
4075 } 4075 }
4076 4076
4077 return 0; 4077 return 0;
4078} 4078}
4079 4079
4080void CalendarView::dialogClosing(Incidence *in) 4080void CalendarView::dialogClosing(Incidence *in)
4081{ 4081{
4082 // mDialogList.remove(in); 4082 // mDialogList.remove(in);
4083} 4083}
4084 4084
4085void CalendarView::showIncidence() 4085void CalendarView::showIncidence()
4086{ 4086{
4087 mViewerCallerIsSearchDialog = false; 4087 mViewerCallerIsSearchDialog = false;
4088 Incidence *incidence = currentSelection(); 4088 Incidence *incidence = currentSelection();
4089 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4089 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
4090 if ( incidence ) { 4090 if ( incidence ) {
4091 ShowIncidenceVisitor v; 4091 ShowIncidenceVisitor v;
4092 v.act( incidence, this ); 4092 v.act( incidence, this );
4093 } 4093 }
4094} 4094}
4095void CalendarView::editIncidenceDescription() 4095void CalendarView::editIncidenceDescription()
4096{ 4096{
4097 mFlagEditDescription = true; 4097 mFlagEditDescription = true;
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 2a2acb1..fc213d8 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -732,49 +732,49 @@ void KOAgenda::startItemAction(QPoint viewportPos)
732 contentsToGrid(x,y,gx,gy); 732 contentsToGrid(x,y,gx,gy);
733 733
734 mStartCellX = gx; 734 mStartCellX = gx;
735 mStartCellY = gy; 735 mStartCellY = gy;
736 mCurrentCellX = gx; 736 mCurrentCellX = gx;
737 mCurrentCellY = gy; 737 mCurrentCellY = gy;
738 738
739 if (mAllDayMode) { 739 if (mAllDayMode) {
740 int gridDistanceX = (x - gx * mGridSpacingX); 740 int gridDistanceX = (x - gx * mGridSpacingX);
741 if (gridDistanceX < mResizeBorderWidth && 741 if (gridDistanceX < mResizeBorderWidth &&
742 mActionItem->cellX() == mCurrentCellX) { 742 mActionItem->cellX() == mCurrentCellX) {
743 mActionType = RESIZELEFT; 743 mActionType = RESIZELEFT;
744 setCursor(sizeHorCursor); 744 setCursor(sizeHorCursor);
745 } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && 745 } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth &&
746 mActionItem->cellXWidth() == mCurrentCellX) { 746 mActionItem->cellXWidth() == mCurrentCellX) {
747 mActionType = RESIZERIGHT; 747 mActionType = RESIZERIGHT;
748 setCursor(sizeHorCursor); 748 setCursor(sizeHorCursor);
749 } else { 749 } else {
750 mActionType = MOVE; 750 mActionType = MOVE;
751 mActionItem->startMove(); 751 mActionItem->startMove();
752 setCursor(sizeAllCursor); 752 setCursor(sizeAllCursor);
753 } 753 }
754 } else { 754 } else {
755 int gridDistanceY = (y - gy * mGridSpacingY); 755 int gridDistanceY = (y - gy * mGridSpacingY);
756 bool allowResize = ( mActionItem->incidence()->type() != "Todo" ); 756 bool allowResize = ( mActionItem->incidence()->typeID() != todoID );
757 if (allowResize && gridDistanceY < mResizeBorderWidth && 757 if (allowResize && gridDistanceY < mResizeBorderWidth &&
758 mActionItem->cellYTop() == mCurrentCellY && 758 mActionItem->cellYTop() == mCurrentCellY &&
759 !mActionItem->firstMultiItem()) { 759 !mActionItem->firstMultiItem()) {
760 mActionType = RESIZETOP; 760 mActionType = RESIZETOP;
761 setCursor(sizeVerCursor); 761 setCursor(sizeVerCursor);
762 } else if (allowResize &&(mGridSpacingY - gridDistanceY) < mResizeBorderWidth && 762 } else if (allowResize &&(mGridSpacingY - gridDistanceY) < mResizeBorderWidth &&
763 mActionItem->cellYBottom() == mCurrentCellY && 763 mActionItem->cellYBottom() == mCurrentCellY &&
764 !mActionItem->lastMultiItem()) { 764 !mActionItem->lastMultiItem()) {
765 mActionType = RESIZEBOTTOM; 765 mActionType = RESIZEBOTTOM;
766 setCursor(sizeVerCursor); 766 setCursor(sizeVerCursor);
767 } else { 767 } else {
768 mActionType = MOVE; 768 mActionType = MOVE;
769 mActionItem->startMove(); 769 mActionItem->startMove();
770 setCursor(sizeAllCursor); 770 setCursor(sizeAllCursor);
771 } 771 }
772 } 772 }
773} 773}
774 774
775void KOAgenda::performItemAction(QPoint viewportPos) 775void KOAgenda::performItemAction(QPoint viewportPos)
776{ 776{
777// kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; 777// kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl;
778// QPoint point = viewport()->mapToGlobal(viewportPos); 778// QPoint point = viewport()->mapToGlobal(viewportPos);
779// kdDebug() << "Global: " << point.x() << "," << point.y() << endl; 779// kdDebug() << "Global: " << point.x() << "," << point.y() << endl;
780// point = clipper()->mapFromGlobal(point); 780// point = clipper()->mapFromGlobal(point);
@@ -891,49 +891,49 @@ void KOAgenda::performItemAction(QPoint viewportPos)
891 } 891 }
892} 892}
893 893
894void KOAgenda::endItemAction() 894void KOAgenda::endItemAction()
895{ 895{
896 896
897 if ( mItemMoved ) { 897 if ( mItemMoved ) {
898 KOAgendaItem *placeItem = mActionItem->firstMultiItem(); 898 KOAgendaItem *placeItem = mActionItem->firstMultiItem();
899 if ( !placeItem ) { 899 if ( !placeItem ) {
900 placeItem = mActionItem; 900 placeItem = mActionItem;
901 } 901 }
902 if ( placeItem->incidence()->recurrence()->doesRecur() ) { 902 if ( placeItem->incidence()->recurrence()->doesRecur() ) {
903 Incidence* oldInc = placeItem->incidence(); 903 Incidence* oldInc = placeItem->incidence();
904 placeItem->recreateIncidence(); 904 placeItem->recreateIncidence();
905 emit addToCalSignal(placeItem->incidence(), oldInc ); 905 emit addToCalSignal(placeItem->incidence(), oldInc );
906 } 906 }
907 int type = mActionType; 907 int type = mActionType;
908 if ( mAllDayMode ) 908 if ( mAllDayMode )
909 type = -1; 909 type = -1;
910 KOAgendaItem *modifiedItem = placeItem; 910 KOAgendaItem *modifiedItem = placeItem;
911 //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */); 911 //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */);
912 QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems(); 912 QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems();
913 KOAgendaItem *item; 913 KOAgendaItem *item;
914 914
915 if ( placeItem->incidence()->type() == "Todo" ) { 915 if ( placeItem->incidence()->typeID() == todoID ) {
916 mSelectedItem = 0; 916 mSelectedItem = 0;
917 //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth()); 917 //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth());
918 modifiedItem->mLastMoveXPos = mCurrentCellX; 918 modifiedItem->mLastMoveXPos = mCurrentCellX;
919 emit itemModified( modifiedItem, mActionType ); 919 emit itemModified( modifiedItem, mActionType );
920 } 920 }
921 else { 921 else {
922 922
923 923
924 globalFlagBlockAgendaItemPaint = 1; 924 globalFlagBlockAgendaItemPaint = 1;
925 for ( item=oldconflictItems.first(); item != 0; 925 for ( item=oldconflictItems.first(); item != 0;
926 item=oldconflictItems.next() ) { 926 item=oldconflictItems.next() ) {
927 placeSubCells(item); 927 placeSubCells(item);
928 } 928 }
929 while ( placeItem ) { 929 while ( placeItem ) {
930 //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); 930 //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1());
931 oldconflictItems = placeItem->conflictItems(); 931 oldconflictItems = placeItem->conflictItems();
932 for ( item=oldconflictItems.first(); item != 0; 932 for ( item=oldconflictItems.first(); item != 0;
933 item=oldconflictItems.next() ) { 933 item=oldconflictItems.next() ) {
934 placeSubCells(item); 934 placeSubCells(item);
935 } 935 }
936 placeSubCells( placeItem ); 936 placeSubCells( placeItem );
937 placeItem = placeItem->nextMultiItem(); 937 placeItem = placeItem->nextMultiItem();
938 } 938 }
939 globalFlagBlockAgendaItemPaint = 0; 939 globalFlagBlockAgendaItemPaint = 0;
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index df2e478..5a3c4d2 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -85,67 +85,67 @@ KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool
85 init ( incidence, qd ); 85 init ( incidence, qd );
86 //setMouseTracking(true); 86 //setMouseTracking(true);
87 //setAcceptDrops(true); 87 //setAcceptDrops(true);
88 xPaintCoord = -1; 88 xPaintCoord = -1;
89 yPaintCoord = -1; 89 yPaintCoord = -1;
90} 90}
91QString KOAgendaItem::getWhatsThisText() 91QString KOAgendaItem::getWhatsThisText()
92{ 92{
93 if ( mIncidence ) 93 if ( mIncidence )
94 return KIncidenceFormatter::instance()->getFormattedText( mIncidence, 94 return KIncidenceFormatter::instance()->getFormattedText( mIncidence,
95 KOPrefs::instance()->mWTshowDetails, 95 KOPrefs::instance()->mWTshowDetails,
96 KOPrefs::instance()->mWTshowCreated, 96 KOPrefs::instance()->mWTshowCreated,
97 KOPrefs::instance()->mWTshowChanged); 97 KOPrefs::instance()->mWTshowChanged);
98 return "KOAgendaItem::getWhatsThisText()::internal error"; 98 return "KOAgendaItem::getWhatsThisText()::internal error";
99} 99}
100void KOAgendaItem::init ( Incidence *incidence, QDate qd ) 100void KOAgendaItem::init ( Incidence *incidence, QDate qd )
101{ 101{
102 mIncidence = incidence; 102 mIncidence = incidence;
103 mDate = qd; 103 mDate = qd;
104 mFirstMultiItem = 0; 104 mFirstMultiItem = 0;
105 mNextMultiItem = 0; 105 mNextMultiItem = 0;
106 mLastMultiItem = 0; 106 mLastMultiItem = 0;
107 computeText(); 107 computeText();
108 108
109 if ( (incidence->type() == "Todo") && 109 if ( (incidence->typeID() == todoID ) &&
110 ( !((static_cast<Todo*>(incidence))->isCompleted()) && 110 ( !((static_cast<Todo*>(incidence))->isCompleted()) &&
111 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { 111 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) {
112 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) 112 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date())
113 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; 113 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ;
114 else 114 else
115 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; 115 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor;
116 } 116 }
117 else { 117 else {
118 QStringList categories = mIncidence->categories(); 118 QStringList categories = mIncidence->categories();
119 QString cat = categories.first(); 119 QString cat = categories.first();
120 if (cat.isEmpty()) { 120 if (cat.isEmpty()) {
121 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) 121 if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) )
122 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; 122 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
123 else 123 else
124 mBackgroundColor =KOPrefs::instance()->mEventColor; 124 mBackgroundColor =KOPrefs::instance()->mEventColor;
125 } else { 125 } else {
126 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); 126 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat);
127 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) { 127 if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) {
128 if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) 128 if ( mBackgroundColor == KOPrefs::instance()->mEventColor )
129 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; 129 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
130 } 130 }
131 } 131 }
132 132
133 } 133 }
134 mColorGroup = QColorGroup( mBackgroundColor.light(), 134 mColorGroup = QColorGroup( mBackgroundColor.light(),
135 mBackgroundColor.dark(),mBackgroundColor.light(), 135 mBackgroundColor.dark(),mBackgroundColor.light(),
136 mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; 136 mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ;
137 setBackgroundColor( mBackgroundColor ); 137 setBackgroundColor( mBackgroundColor );
138 138
139 mConflictItems.clear(); 139 mConflictItems.clear();
140 setCellXY(0,0,1); 140 setCellXY(0,0,1);
141 setCellXWidth(0); 141 setCellXWidth(0);
142 setSubCell(0); 142 setSubCell(0);
143 setSubCells(1); 143 setSubCells(1);
144 setMultiItem(0,0,0); 144 setMultiItem(0,0,0);
145 startMove(); 145 startMove();
146 mSelected = true; 146 mSelected = true;
147 select(false); 147 select(false);
148 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); 148 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont);
149 mFontPixelSize = fontinf.height();; 149 mFontPixelSize = fontinf.height();;
150 hide(); 150 hide();
151 xPaintCoord = -1; 151 xPaintCoord = -1;
@@ -338,49 +338,49 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint )
338 hPaintCoord = height(); 338 hPaintCoord = height();
339 //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); 339 //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height());
340 if ( paint == 0 ) 340 if ( paint == 0 )
341 paint = &pa; 341 paint = &pa;
342 bool horLayout = ( w < h ); 342 bool horLayout = ( w < h );
343 int maxhei = mFontPixelSize+4; 343 int maxhei = mFontPixelSize+4;
344 if ( horLayout ) 344 if ( horLayout )
345 maxhei += AGENDA_ICON_SIZE -4; 345 maxhei += AGENDA_ICON_SIZE -4;
346 bool small = ( h < maxhei ); 346 bool small = ( h < maxhei );
347 if ( ! small ) 347 if ( ! small )
348 paint->setFont(KOPrefs::instance()->mAgendaViewFont); 348 paint->setFont(KOPrefs::instance()->mAgendaViewFont);
349 else { 349 else {
350 QFont f = KOPrefs::instance()->mAgendaViewFont; 350 QFont f = KOPrefs::instance()->mAgendaViewFont;
351 f.setBold( false ); 351 f.setBold( false );
352 int fh = f.pointSize(); 352 int fh = f.pointSize();
353 nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; 353 nfh = (((float)height())/(float)(mFontPixelSize+4))*fh;
354 if ( nfh < 6 ) 354 if ( nfh < 6 )
355 nfh = 6; 355 nfh = 6;
356 f.setPointSize( nfh ); 356 f.setPointSize( nfh );
357 paint->setFont(f); 357 paint->setFont(f);
358 } 358 }
359 paint->fillRect ( x, yy, w, h, mBackgroundColor ); 359 paint->fillRect ( x, yy, w, h, mBackgroundColor );
360 static const QPixmap completedPxmp = SmallIcon("greenhook16"); 360 static const QPixmap completedPxmp = SmallIcon("greenhook16");
361 static const QPixmap overduePxmp = SmallIcon("redcross16"); 361 static const QPixmap overduePxmp = SmallIcon("redcross16");
362 if ( mIncidence->type() == "Todo" ) { 362 if ( mIncidence->typeID() == todoID ) {
363 Todo* tempTodo = static_cast<Todo*>(mIncidence); 363 Todo* tempTodo = static_cast<Todo*>(mIncidence);
364 int xx = pos().x()+(width()-completedPxmp.width()-3 ); 364 int xx = pos().x()+(width()-completedPxmp.width()-3 );
365 int yyy = yy+3; 365 int yyy = yy+3;
366 if ( tempTodo->isCompleted() ) 366 if ( tempTodo->isCompleted() )
367 paint->drawPixmap ( xx, yyy, completedPxmp ); 367 paint->drawPixmap ( xx, yyy, completedPxmp );
368 else { 368 else {
369 paint->drawPixmap ( xx, yyy, overduePxmp ); 369 paint->drawPixmap ( xx, yyy, overduePxmp );
370 370
371 } 371 }
372 } 372 }
373 bool addIcon = false; 373 bool addIcon = false;
374 if ( ! small || w > 3 * h || h > 3* w ) 374 if ( ! small || w > 3 * h || h > 3* w )
375 addIcon = updateIcons( paint, horLayout ); 375 addIcon = updateIcons( paint, horLayout );
376 376
377 qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0); 377 qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0);
378 //qDebug("draw rect %d %d %d %d ",x, yy, w, h ); 378 //qDebug("draw rect %d %d %d %d ",x, yy, w, h );
379 if ( ! small ) { 379 if ( ! small ) {
380 x += 3; yy += 3;w -= 6; h-= 5; 380 x += 3; yy += 3;w -= 6; h-= 5;
381 } else { 381 } else {
382 x += 2; yy += 1;w -= 4; h-= 4; 382 x += 2; yy += 1;w -= 4; h-= 4;
383 if ( nfh < 6.01 ) { 383 if ( nfh < 6.01 ) {
384 yy -= 2; 384 yy -= 2;
385 h += 4; 385 h += 4;
386 } 386 }
@@ -519,97 +519,97 @@ void KOAgendaItem::paintEvent ( QPaintEvent *e )
519 xx += rx; 519 xx += rx;
520 520
521 if ( xx < 0 ) { 521 if ( xx < 0 ) {
522 rw = rw + xx; 522 rw = rw + xx;
523 rx -= xx; 523 rx -= xx;
524 xx = 0; 524 xx = 0;
525 if ( rw <= 1 ) { 525 if ( rw <= 1 ) {
526 //qDebug("KOAgendaItem::Width1 <= 1 (%d). Returning. %s",rw,mDisplayedText.latin1()); 526 //qDebug("KOAgendaItem::Width1 <= 1 (%d). Returning. %s",rw,mDisplayedText.latin1());
527 return; 527 return;
528 } 528 }
529 } 529 }
530 if ( paintFrom->width() < xx+rw ) { 530 if ( paintFrom->width() < xx+rw ) {
531 rw = paintFrom->width() - xx; 531 rw = paintFrom->width() - xx;
532 if ( rw <= 1 ) { 532 if ( rw <= 1 ) {
533 //qDebug("KOAgendaItem::Width2 <= 1 (%d). Returning.%s ",rw,mDisplayedText.latin1() ); 533 //qDebug("KOAgendaItem::Width2 <= 1 (%d). Returning.%s ",rw,mDisplayedText.latin1() );
534 return; 534 return;
535 } 535 }
536 } 536 }
537 //qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh); 537 //qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh);
538 bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,CopyROP); 538 bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,CopyROP);
539} 539}
540void KOAgendaItem::computeText() 540void KOAgendaItem::computeText()
541{ 541{
542 mDisplayedText = mIncidence->summary(); 542 mDisplayedText = mIncidence->summary();
543 if ( (mIncidence->type() == "Todo") ) { 543 if ( (mIncidence->typeID() == todoID ) ) {
544 if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { 544 if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) {
545 if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) 545 if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() )
546 mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; 546 mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")";
547 else if ( !(mIncidence->doesFloat())) 547 else if ( !(mIncidence->doesFloat()))
548 mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; 548 mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")";
549 } 549 }
550 } else { 550 } else {
551 if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) 551 if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda)
552 mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + " - " + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; 552 mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + " - " + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ;
553 553
554 if ( mAllDay ) { 554 if ( mAllDay ) {
555 if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { 555 if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) {
556 if ( mIncidence->doesRecur() ) { 556 if ( mIncidence->doesRecur() ) {
557 mDisplayedText += " (" + mIncidence->recurrence()->recurrenceText() + ")"; 557 mDisplayedText += " (" + mIncidence->recurrence()->recurrenceText() + ")";
558 } else { 558 } else {
559 mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; 559 mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ;
560 } 560 }
561 } 561 }
562 } 562 }
563 } 563 }
564 564
565 if ( !mIncidence->location().isEmpty() ) { 565 if ( !mIncidence->location().isEmpty() ) {
566 if ( mAllDay ) 566 if ( mAllDay )
567 mDisplayedText += " ("; 567 mDisplayedText += " (";
568 else 568 else
569 mDisplayedText += "\n("; 569 mDisplayedText += "\n(";
570 mDisplayedText += mIncidence->location() +")"; 570 mDisplayedText += mIncidence->location() +")";
571 } 571 }
572#ifdef DESKTOP_VERSION 572#ifdef DESKTOP_VERSION
573 QString tipText = mIncidence->summary(); 573 QString tipText = mIncidence->summary();
574 if ( !mIncidence->doesFloat() ) { 574 if ( !mIncidence->doesFloat() ) {
575 if ( mIncidence->type() == "Event" ) { 575 if ( mIncidence->typeID() == eventID ) {
576 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { 576 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) {
577 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); 577 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr();
578 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); 578 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr();
579 } 579 }
580 else { 580 else {
581 tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); 581 tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr();
582 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); 582 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr();
583 } 583 }
584 } 584 }
585 else if ( mIncidence->type() == "Todo" ) { 585 else if ( mIncidence->typeID() == todoID ) {
586 if (mIncidence->hasStartDate()) 586 if (mIncidence->hasStartDate())
587 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr(); 587 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr();
588 if (((Todo*)mIncidence)->hasDueDate()) 588 if (((Todo*)mIncidence)->hasDueDate())
589 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr(); 589 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr();
590 } 590 }
591 } else if ( mIncidence->type() == "Todo" ) { 591 } else if ( mIncidence->typeID() == todoID ) {
592 if (mIncidence->hasStartDate()) 592 if (mIncidence->hasStartDate())
593 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr(); 593 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr();
594 if (((Todo*)mIncidence)->hasDueDate()) 594 if (((Todo*)mIncidence)->hasDueDate())
595 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr(); 595 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr();
596 } 596 }
597 597
598 if (!mIncidence->location().isEmpty()) { 598 if (!mIncidence->location().isEmpty()) {
599 tipText += "\n"+i18n("Location: ")+mIncidence->location(); 599 tipText += "\n"+i18n("Location: ")+mIncidence->location();
600 } 600 }
601 QToolTip::add(this,tipText,toolTipGroup(),""); 601 QToolTip::add(this,tipText,toolTipGroup(),"");
602#endif 602#endif
603} 603}
604void KOAgendaItem::updateItem() 604void KOAgendaItem::updateItem()
605{ 605{
606 computeText(); 606 computeText();
607 607
608 //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y()); 608 //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y());
609 paintMe( mSelected ); 609 paintMe( mSelected );
610 repaint( false); 610 repaint( false);
611} 611}
612 612
613void KOAgendaItem::resizeEvent ( QResizeEvent *ev ) 613void KOAgendaItem::resizeEvent ( QResizeEvent *ev )
614{ 614{
615 //qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1()); 615 //qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1());
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 7022e02..be51694 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -379,50 +379,50 @@ void KOListView::updateList()
379 379
380void KOListView::clearList() 380void KOListView::clearList()
381{ 381{
382 clear (); 382 clear ();
383} 383}
384void KOListView::addCat( ) 384void KOListView::addCat( )
385{ 385{
386 setCategories( false ); 386 setCategories( false );
387} 387}
388void KOListView::setCat() 388void KOListView::setCat()
389{ 389{
390 setCategories( true ); 390 setCategories( true );
391} 391}
392void KOListView::setAlarm() 392void KOListView::setAlarm()
393{ 393{
394 KOAlarmPrefs kap( this); 394 KOAlarmPrefs kap( this);
395 if ( !kap.exec() ) 395 if ( !kap.exec() )
396 return; 396 return;
397 QStringList itemList; 397 QStringList itemList;
398 QPtrList<KOListViewItem> sel ; 398 QPtrList<KOListViewItem> sel ;
399 QListViewItem *qitem = mListView->firstChild (); 399 QListViewItem *qitem = mListView->firstChild ();
400 while ( qitem ) { 400 while ( qitem ) {
401 if ( qitem->isSelected() ) { 401 if ( qitem->isSelected() ) {
402 Incidence* inc = ((KOListViewItem *) qitem)->data(); 402 Incidence* inc = ((KOListViewItem *) qitem)->data();
403 if ( inc->type() != "Journal" ) { 403 if ( inc->typeID() != journalID ) {
404 if ( inc->type() == "Todo" ) { 404 if ( inc->typeID() == todoID ) {
405 if ( ((Todo*)inc)->hasDueDate() ) 405 if ( ((Todo*)inc)->hasDueDate() )
406 sel.append(((KOListViewItem *)qitem)); 406 sel.append(((KOListViewItem *)qitem));
407 } else 407 } else
408 sel.append(((KOListViewItem *)qitem)); 408 sel.append(((KOListViewItem *)qitem));
409 } 409 }
410 } 410 }
411 qitem = qitem->nextSibling(); 411 qitem = qitem->nextSibling();
412 } 412 }
413 int count = 0; 413 int count = 0;
414 KOListViewItem * item, *temp; 414 KOListViewItem * item, *temp;
415 item = sel.first(); 415 item = sel.first();
416 Incidence* inc; 416 Incidence* inc;
417 while ( item ) { 417 while ( item ) {
418 inc = item->data(); 418 inc = item->data();
419 ++count; 419 ++count;
420 if (kap.mAlarmButton->isChecked()) { 420 if (kap.mAlarmButton->isChecked()) {
421 if (inc->alarms().count() == 0) 421 if (inc->alarms().count() == 0)
422 inc->newAlarm(); 422 inc->newAlarm();
423 QPtrList<Alarm> alarms = inc->alarms(); 423 QPtrList<Alarm> alarms = inc->alarms();
424 Alarm *alarm; 424 Alarm *alarm;
425 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { 425 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
426 alarm->setEnabled(true); 426 alarm->setEnabled(true);
427 int j = kap.mAlarmTimeEdit->value()* -60; 427 int j = kap.mAlarmTimeEdit->value()* -60;
428 if (kap.mAlarmIncrCombo->currentItem() == 1) 428 if (kap.mAlarmIncrCombo->currentItem() == 1)
@@ -467,49 +467,49 @@ void KOListView::setCategories( bool removeOld )
467 delete csd; 467 delete csd;
468 return; 468 return;
469 } 469 }
470 QStringList catList = csd->selectedCategories(); 470 QStringList catList = csd->selectedCategories();
471 delete csd; 471 delete csd;
472 // if ( catList.count() == 0 ) 472 // if ( catList.count() == 0 )
473 // return; 473 // return;
474 //catList.sort(); 474 //catList.sort();
475 QString categoriesStr = catList.join(","); 475 QString categoriesStr = catList.join(",");
476 int i; 476 int i;
477 QStringList itemList; 477 QStringList itemList;
478 QPtrList<KOListViewItem> sel ; 478 QPtrList<KOListViewItem> sel ;
479 QListViewItem *qitem = mListView->firstChild (); 479 QListViewItem *qitem = mListView->firstChild ();
480 while ( qitem ) { 480 while ( qitem ) {
481 if ( qitem->isSelected() ) { 481 if ( qitem->isSelected() ) {
482 sel.append(((KOListViewItem *)qitem)); 482 sel.append(((KOListViewItem *)qitem));
483 } 483 }
484 qitem = qitem->nextSibling(); 484 qitem = qitem->nextSibling();
485 } 485 }
486 KOListViewItem * item, *temp; 486 KOListViewItem * item, *temp;
487 item = sel.first(); 487 item = sel.first();
488 if( item ) { 488 if( item ) {
489 Incidence* inc = item->data() ; 489 Incidence* inc = item->data() ;
490 bool setSub = false; 490 bool setSub = false;
491 if( inc->type() == "Todo" && sel.count() == 1 && inc->relations().count() > 0 ) { 491 if( inc->typeID() == todoID && sel.count() == 1 && inc->relations().count() > 0 ) {
492 int result = KMessageBox::warningYesNoCancel(this, 492 int result = KMessageBox::warningYesNoCancel(this,
493 i18n("The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?").arg( inc->summary().left ( 25 ) ), 493 i18n("The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?").arg( inc->summary().left ( 25 ) ),
494 i18n("Todo has subtodos"), 494 i18n("Todo has subtodos"),
495 i18n("Yes"), 495 i18n("Yes"),
496 i18n("No")); 496 i18n("No"));
497 if (result == KMessageBox::Cancel) item = 0; 497 if (result == KMessageBox::Cancel) item = 0;
498 if (result == KMessageBox::Yes) setSub = true; 498 if (result == KMessageBox::Yes) setSub = true;
499 } 499 }
500 while ( item ) { 500 while ( item ) {
501 inc = item->data(); 501 inc = item->data();
502 if ( removeOld ) { 502 if ( removeOld ) {
503 inc->setCategories( catList, setSub ); 503 inc->setCategories( catList, setSub );
504 } else { 504 } else {
505 inc->addCategories( catList, setSub ); 505 inc->addCategories( catList, setSub );
506 } 506 }
507 ListItemVisitor v(item, mStartDate ); 507 ListItemVisitor v(item, mStartDate );
508 inc->accept(v); 508 inc->accept(v);
509 item = sel.next(); 509 item = sel.next();
510 } 510 }
511 } 511 }
512 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); 512 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
513} 513}
514 514
515void KOListView::beamSelected() 515void KOListView::beamSelected()
@@ -590,107 +590,107 @@ void KOListView::saveDescriptionToFile()
590 QString fn = KOPrefs::instance()->mLastSaveFile; 590 QString fn = KOPrefs::instance()->mLastSaveFile;
591 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 591 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
592 592
593 if ( fn == "" ) 593 if ( fn == "" )
594 return; 594 return;
595 QFileInfo info; 595 QFileInfo info;
596 info.setFile( fn ); 596 info.setFile( fn );
597 QString mes; 597 QString mes;
598 bool createbup = true; 598 bool createbup = true;
599 if ( info. exists() ) { 599 if ( info. exists() ) {
600 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 600 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
601 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 601 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
602 i18n("Overwrite!"), i18n("Cancel"), 0, 602 i18n("Overwrite!"), i18n("Cancel"), 0,
603 0, 1 ); 603 0, 1 );
604 if ( result != 0 ) { 604 if ( result != 0 ) {
605 createbup = false; 605 createbup = false;
606 } 606 }
607 } 607 }
608 if ( createbup ) { 608 if ( createbup ) {
609 QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + 609 QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") +
610 KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); 610 KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false);
611 Incidence *incidence = delSel.first(); 611 Incidence *incidence = delSel.first();
612 icount = 0; 612 icount = 0;
613 while ( incidence ) { 613 while ( incidence ) {
614 if ( incidence->type() == "Journal" ) { 614 if ( incidence->typeID() == journalID ) {
615 text += "\n************************************\n"; 615 text += "\n************************************\n";
616 text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); 616 text += i18n("Journal from: ") +incidence->dtStartDateStr( false );
617 text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); 617 text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
618 text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); 618 text +="\n" + i18n("Description: ") + "\n"+ incidence->description();
619 ++icount; 619 ++icount;
620 620
621 } else { 621 } else {
622 if ( !incidence->description().isEmpty() ) { 622 if ( !incidence->description().isEmpty() ) {
623 text += "\n************************************\n"; 623 text += "\n************************************\n";
624 if ( incidence->type() == "Todo" ) 624 if ( incidence->typeID() == todoID )
625 text += i18n("To-Do: "); 625 text += i18n("To-Do: ");
626 text += incidence->summary(); 626 text += incidence->summary();
627 if ( incidence->hasStartDate() ) 627 if ( incidence->hasStartDate() )
628 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); 628 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false );
629 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); 629 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
630 if ( !incidence->location().isEmpty() ) 630 if ( !incidence->location().isEmpty() )
631 text += "\n" +i18n("Location: ") + incidence->location(); 631 text += "\n" +i18n("Location: ") + incidence->location();
632 text += "\n" + i18n("Description: ") + "\n" + incidence->description(); 632 text += "\n" + i18n("Description: ") + "\n" + incidence->description();
633 ++icount; 633 ++icount;
634 634
635 } 635 }
636 } 636 }
637 incidence = delSel.next(); 637 incidence = delSel.next();
638 } 638 }
639 QFile file( fn ); 639 QFile file( fn );
640 if (!file.open( IO_WriteOnly ) ) { 640 if (!file.open( IO_WriteOnly ) ) {
641 topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); 641 topLevelWidget()->setCaption(i18n("File open error - nothing saved!") );
642 return; 642 return;
643 } 643 }
644 QTextStream ts( &file ); 644 QTextStream ts( &file );
645 ts << text; 645 ts << text;
646 file.close(); 646 file.close();
647 //qDebug("%s ", text.latin1()); 647 //qDebug("%s ", text.latin1());
648 mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); 648 mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount );
649 KOPrefs::instance()->mLastSaveFile = fn; 649 KOPrefs::instance()->mLastSaveFile = fn;
650 topLevelWidget()->setCaption(mes); 650 topLevelWidget()->setCaption(mes);
651 } 651 }
652 } 652 }
653} 653}
654void KOListView::saveToFileVCS() 654void KOListView::saveToFileVCS()
655{ 655{
656 writeToFile( false ); 656 writeToFile( false );
657} 657}
658void KOListView::saveToFile() 658void KOListView::saveToFile()
659{ 659{
660 writeToFile( true ); 660 writeToFile( true );
661} 661}
662void KOListView::writeToFile( bool iCal ) 662void KOListView::writeToFile( bool iCal )
663{ 663{
664 664
665 int icount = 0; 665 int icount = 0;
666 QPtrList<Incidence> delSel ; 666 QPtrList<Incidence> delSel ;
667 QListViewItem *item = mListView->firstChild (); 667 QListViewItem *item = mListView->firstChild ();
668 bool journal = iCal; // warn only for vCal 668 bool journal = iCal; // warn only for vCal
669 while ( item ) { 669 while ( item ) {
670 if ( item->isSelected() ) { 670 if ( item->isSelected() ) {
671 if ( !journal ) 671 if ( !journal )
672 if ( ((KOListViewItem *)item)->data()->type() == "Journal") 672 if ( ((KOListViewItem *)item)->data()->typeID() == journalID )
673 journal = true; 673 journal = true;
674 delSel.append(((KOListViewItem *)item)->data()); 674 delSel.append(((KOListViewItem *)item)->data());
675 ++icount; 675 ++icount;
676 } 676 }
677 677
678 item = item->nextSibling(); 678 item = item->nextSibling();
679 } 679 }
680 if ( !iCal && journal ) { 680 if ( !iCal && journal ) {
681 int result = KMessageBox::warningContinueCancel(this, 681 int result = KMessageBox::warningContinueCancel(this,
682 i18n("The journal entries can not be\nexported to a vCalendar file."), 682 i18n("The journal entries can not be\nexported to a vCalendar file."),
683 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), 683 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"),
684 true); 684 true);
685 if (result != KMessageBox::Continue) return; 685 if (result != KMessageBox::Continue) return;
686 } 686 }
687 if ( icount ) { 687 if ( icount ) {
688 QString fn = KOPrefs::instance()->mLastSaveFile; 688 QString fn = KOPrefs::instance()->mLastSaveFile;
689 QString extension; 689 QString extension;
690 if ( iCal ) { 690 if ( iCal ) {
691 if ( fn.right( 4 ).lower() == ".vcs" ) { 691 if ( fn.right( 4 ).lower() == ".vcs" ) {
692 fn = fn.left( fn.length() -3) + "ics"; 692 fn = fn.left( fn.length() -3) + "ics";
693 } 693 }
694 } else { 694 } else {
695 if ( fn.right( 4 ).lower() == ".ics" ) { 695 if ( fn.right( 4 ).lower() == ".ics" ) {
696 fn = fn.left( fn.length() -3) + "vcs"; 696 fn = fn.left( fn.length() -3) + "vcs";
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 5aaf360..2602487 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -681,49 +681,49 @@ void KOTodoView::updateView()
681 681
682 if (t->getRelatedTo()) { 682 if (t->getRelatedTo()) {
683 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; 683 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl;
684 } 684 }
685 685
686 QPtrList<Event> l = t->getRelations(); 686 QPtrList<Event> l = t->getRelations();
687 Event *c; 687 Event *c;
688 for(c=l.first();c;c=l.next()) { 688 for(c=l.first();c;c=l.next()) {
689 kdDebug() << " - relation: " << c->getSummary() << endl; 689 kdDebug() << " - relation: " << c->getSummary() << endl;
690 } 690 }
691 } 691 }
692*/ 692*/
693 693
694 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a 694 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a
695 // specific order of events. That means that we have to generate parent items 695 // specific order of events. That means that we have to generate parent items
696 // recursively for proper hierarchical display of Todos. 696 // recursively for proper hierarchical display of Todos.
697 mTodoMap.clear(); 697 mTodoMap.clear();
698 Todo *todo; 698 Todo *todo;
699 todo = todoList.first();// todo; todo = todoList.next()) { 699 todo = todoList.first();// todo; todo = todoList.next()) {
700 while ( todo ) { 700 while ( todo ) {
701 bool next = true; 701 bool next = true;
702 // qDebug("todo %s ", todo->summary().latin1()); 702 // qDebug("todo %s ", todo->summary().latin1());
703 Incidence *incidence = todo->relatedTo(); 703 Incidence *incidence = todo->relatedTo();
704 while ( incidence ) { 704 while ( incidence ) {
705 if ( incidence->type() == "Todo") { 705 if ( incidence->typeID() == todoID ) {
706 //qDebug("related %s ",incidence->summary().latin1() ); 706 //qDebug("related %s ",incidence->summary().latin1() );
707 if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { 707 if ( !(todoList.contains ( ((Todo* )incidence ) ) )) {
708 //qDebug("related not found "); 708 //qDebug("related not found ");
709 todoList.remove( ); 709 todoList.remove( );
710 todo = todoList.current(); 710 todo = todoList.current();
711 next = false; 711 next = false;
712 incidence = 0; 712 incidence = 0;
713 713
714 } else { 714 } else {
715 //qDebug("related found "); 715 //qDebug("related found ");
716 incidence = incidence->relatedTo(); 716 incidence = incidence->relatedTo();
717 } 717 }
718 } else 718 } else
719 incidence = 0; 719 incidence = 0;
720 } 720 }
721 if ( next ) 721 if ( next )
722 todo = todoList.next(); 722 todo = todoList.next();
723 } 723 }
724 724
725 for(todo = todoList.first(); todo; todo = todoList.next()) { 725 for(todo = todoList.first(); todo; todo = todoList.next()) {
726 if (!mTodoMap.contains(todo) && checkTodo( todo ) ) 726 if (!mTodoMap.contains(todo) && checkTodo( todo ) )
727 { 727 {
728 insertTodoItem(todo); 728 insertTodoItem(todo);
729 } 729 }
@@ -823,49 +823,49 @@ bool KOTodoView::checkTodo( Todo * todo )
823 return true; 823 return true;
824} 824}
825 825
826void KOTodoView::restoreItemState( QListViewItem *item ) 826void KOTodoView::restoreItemState( QListViewItem *item )
827{ 827{
828 pendingSubtodo = 0; 828 pendingSubtodo = 0;
829 while( item ) { 829 while( item ) {
830 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 830 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
831 todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); 831 todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) );
832 if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); 832 if( item->childCount() > 0 ) restoreItemState( item->firstChild() );
833 item = item->nextSibling(); 833 item = item->nextSibling();
834 } 834 }
835} 835}
836 836
837 837
838QMap<Todo *,KOTodoViewItem *>::ConstIterator 838QMap<Todo *,KOTodoViewItem *>::ConstIterator
839 KOTodoView::insertTodoItem(Todo *todo) 839 KOTodoView::insertTodoItem(Todo *todo)
840{ 840{
841 841
842// kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; 842// kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl;
843 // TODO: Check, if dynmaic cast is necessary 843 // TODO: Check, if dynmaic cast is necessary
844 844
845 pendingSubtodo = 0; 845 pendingSubtodo = 0;
846 Incidence *incidence = todo->relatedTo(); 846 Incidence *incidence = todo->relatedTo();
847 if (incidence && incidence->type() == "Todo") { 847 if (incidence && incidence->typeID() == todoID ) {
848 Todo *relatedTodo = static_cast<Todo *>(incidence); 848 Todo *relatedTodo = static_cast<Todo *>(incidence);
849 849
850// kdDebug() << " has Related" << endl; 850// kdDebug() << " has Related" << endl;
851 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; 851 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator;
852 itemIterator = mTodoMap.find(relatedTodo); 852 itemIterator = mTodoMap.find(relatedTodo);
853 if (itemIterator == mTodoMap.end()) { 853 if (itemIterator == mTodoMap.end()) {
854// kdDebug() << " related not yet in list" << endl; 854// kdDebug() << " related not yet in list" << endl;
855 itemIterator = insertTodoItem (relatedTodo); 855 itemIterator = insertTodoItem (relatedTodo);
856 } 856 }
857 // isn't this pretty stupid? We give one Todo to the KOTodoViewItem 857 // isn't this pretty stupid? We give one Todo to the KOTodoViewItem
858 // and one into the map. Sure finding is more easy but why? -zecke 858 // and one into the map. Sure finding is more easy but why? -zecke
859 KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); 859 KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this);
860 return mTodoMap.insert(todo,todoItem); 860 return mTodoMap.insert(todo,todoItem);
861 } else { 861 } else {
862// kdDebug() << " no Related" << endl; 862// kdDebug() << " no Related" << endl;
863 // see above -zecke 863 // see above -zecke
864 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); 864 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
865 return mTodoMap.insert(todo,todoItem); 865 return mTodoMap.insert(todo,todoItem);
866 } 866 }
867} 867}
868 868
869 869
870void KOTodoView::updateConfig() 870void KOTodoView::updateConfig()
871{ 871{
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 62d7ede..e8574a0 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -468,56 +468,56 @@ void KOWhatsNextView::changeEventDisplay(Event *, int action)
468 updateView(); 468 updateView();
469 break; 469 break;
470 case KOGlobals::EVENTDELETED: 470 case KOGlobals::EVENTDELETED:
471 updateView(); 471 updateView();
472 break; 472 break;
473 default: 473 default:
474 updateView(); 474 updateView();
475 kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; 475 kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl;
476 } 476 }
477} 477}
478 478
479bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool appendTable ) 479bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool appendTable )
480{ 480{
481 if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) 481 if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") )
482 return false; 482 return false;
483 QDateTime cdt = QDateTime::currentDateTime(); 483 QDateTime cdt = QDateTime::currentDateTime();
484 QDateTime noc; 484 QDateTime noc;
485 QString tempText; 485 QString tempText;
486 if ( appendTable && !notRed ) { 486 if ( appendTable && !notRed ) {
487 tempText = "<table>"; 487 tempText = "<table>";
488 } 488 }
489 bool ok = true; 489 bool ok = true;
490 if ( reply ) { 490 if ( reply ) {
491 noc = ev->getNextOccurence( cdt, &ok ); 491 noc = ev->getNextOccurence( cdt, &ok );
492 if (! ok && ev->type() == "Event") 492 if (! ok && ev->typeID() == eventID)
493 return false; 493 return false;
494 } 494 }
495 bool bDay = false; 495 bool bDay = false;
496 if ( ev->isBirthday() || ev->isAnniversary() ) 496 if ( ev->isBirthday() || ev->isAnniversary() )
497 bDay = true; 497 bDay = true;
498 tempText += "<tr><td><b>"; 498 tempText += "<tr><td><b>";
499 if (ev->type()=="Event") { 499 if (ev->typeID() == eventID ) {
500 if (reply) { 500 if (reply) {
501 if (!ev->doesFloat()) 501 if (!ev->doesFloat())
502 tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; 502 tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": ";
503 else 503 else
504 tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; 504 tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
505 505
506 } else { 506 } else {
507 if (!ev->doesFloat()) { 507 if (!ev->doesFloat()) {
508 Event *event = static_cast<Event *>(ev); 508 Event *event = static_cast<Event *>(ev);
509 QDateTime st,end; 509 QDateTime st,end;
510 if ( event->recurrence()->doesRecur() ) { 510 if ( event->recurrence()->doesRecur() ) {
511 QDate recDate= mEventDate; 511 QDate recDate= mEventDate;
512 int days = event->dtStart().date().daysTo (event->dtEnd().date() ); 512 int days = event->dtStart().date().daysTo (event->dtEnd().date() );
513 while ( ! event->recursOn( recDate ) ) { 513 while ( ! event->recursOn( recDate ) ) {
514 recDate = recDate.addDays( -1 ); 514 recDate = recDate.addDays( -1 );
515 515
516 } 516 }
517 st = QDateTime ( recDate, event->dtStart().time() ); 517 st = QDateTime ( recDate, event->dtStart().time() );
518 end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); 518 end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() );
519 } 519 }
520 else { 520 else {
521 st = event->dtStart(); 521 st = event->dtStart();
522 end = event->dtEnd(); 522 end = event->dtEnd();
523 } 523 }
@@ -599,60 +599,60 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
599 if ( !needClose) 599 if ( !needClose)
600 tempText +="["; 600 tempText +="[";
601 tempText += "a"; 601 tempText += "a";
602 needClose =true; 602 needClose =true;
603 603
604 } 604 }
605 if ( ev->description().length() > 0 ) { 605 if ( ev->description().length() > 0 ) {
606 if ( !needClose) 606 if ( !needClose)
607 tempText +="["; 607 tempText +="[";
608 tempText += "i"; 608 tempText += "i";
609 needClose =true; 609 needClose =true;
610 } 610 }
611 if ( ev->recurrence()->doesRecur() ) { 611 if ( ev->recurrence()->doesRecur() ) {
612 if ( !needClose) 612 if ( !needClose)
613 tempText +="["; 613 tempText +="[";
614 tempText += "r"; 614 tempText += "r";
615 needClose =true; 615 needClose =true;
616 } 616 }
617 if ( needClose ) { 617 if ( needClose ) {
618 tempText += "] "; 618 tempText += "] ";
619 } 619 }
620 if ( ev->cancelled() ) 620 if ( ev->cancelled() )
621 tempText += "</font>"; 621 tempText += "</font>";
622 tempText += "<a "; 622 tempText += "<a ";
623 if (ev->type()=="Event") tempText += "href=\"event:"; 623 if (ev->typeID() == eventID ) tempText += "href=\"event:";
624 if (ev->type()=="Todo") tempText += "href=\"todo:"; 624 if (ev->typeID() == todoID ) tempText += "href=\"todo:";
625 tempText += ev->uid() + "\">"; 625 tempText += ev->uid() + "\">";
626 if ( ev->summary().length() > 0 ) 626 if ( ev->summary().length() > 0 )
627 tempText += ev->summary(); 627 tempText += ev->summary();
628 else 628 else
629 tempText += i18n("-no summary-"); 629 tempText += i18n("-no summary-");
630 if ( bDay ) { 630 if ( bDay ) {
631 noc = ev->getNextOccurence( cdt.addDays(-1), &ok ); 631 noc = ev->getNextOccurence( cdt.addDays(-1), &ok );
632 if ( ok ) { 632 if ( ok ) {
633 int years = 0; 633 int years = 0;
634 if ( ev->type() =="Todo" ) { 634 if ( ev->typeID() == todoID ) {
635 years = noc.date().year() -((Todo*)ev)->dtDue().date().year(); 635 years = noc.date().year() -((Todo*)ev)->dtDue().date().year();
636 } else 636 } else
637 years = noc.date().year() - ev->dtStart().date().year(); 637 years = noc.date().year() - ev->dtStart().date().year();
638 tempText += i18n(" (%1 y.)"). arg( years ); 638 tempText += i18n(" (%1 y.)"). arg( years );
639 } 639 }
640 } 640 }
641 641
642 tempText += "</a>"; 642 tempText += "</a>";
643 if ( KOPrefs::instance()->mWNViewShowLocation ) 643 if ( KOPrefs::instance()->mWNViewShowLocation )
644 if ( !ev->location().isEmpty() ) 644 if ( !ev->location().isEmpty() )
645 tempText += " ("+ev->location() +")"; 645 tempText += " ("+ev->location() +")";
646 if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) 646 if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents)
647 tempText += " ["+ev->relatedTo()->summary() +"]"; 647 tempText += " ["+ev->relatedTo()->summary() +"]";
648 tempText += "</td></tr>\n"; 648 tempText += "</td></tr>\n";
649 mText += tempText; 649 mText += tempText;
650 return true; 650 return true;
651} 651}
652 652
653bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) 653bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub )
654{ 654{
655 if ( mTodos.find( ev ) != mTodos.end() ) return false; 655 if ( mTodos.find( ev ) != mTodos.end() ) return false;
656 656
657 mTodos.append( ev ); 657 mTodos.append( ev );
658 if ( !isSub ) 658 if ( !isSub )
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 53b65b2..481eab4 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1311,53 +1311,53 @@ void MainWindow::exportToPhone( int mode )
1311 if ( mode == 2 ) 1311 if ( mode == 2 )
1312 ex2phone.setCaption(i18n("Export filtered calendar")); 1312 ex2phone.setCaption(i18n("Export filtered calendar"));
1313 1313
1314 if ( !ex2phone.exec() ) { 1314 if ( !ex2phone.exec() ) {
1315 return; 1315 return;
1316 } 1316 }
1317 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1317 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1318 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1318 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1319 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1319 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1320 1320
1321 int inFuture = 0; 1321 int inFuture = 0;
1322 if ( ex2phone.mWriteBackFuture->isChecked() ) 1322 if ( ex2phone.mWriteBackFuture->isChecked() )
1323 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1323 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1324 QPtrList<Incidence> delSel; 1324 QPtrList<Incidence> delSel;
1325 if ( mode == 1 ) 1325 if ( mode == 1 )
1326 delSel = mCalendar->rawIncidences(); 1326 delSel = mCalendar->rawIncidences();
1327 if ( mode == 2 ) 1327 if ( mode == 2 )
1328 delSel = mCalendar->incidences(); 1328 delSel = mCalendar->incidences();
1329 CalendarLocal* cal = new CalendarLocal(); 1329 CalendarLocal* cal = new CalendarLocal();
1330 cal->setLocalTime(); 1330 cal->setLocalTime();
1331 Incidence *incidence = delSel.first(); 1331 Incidence *incidence = delSel.first();
1332 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1332 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1333 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1333 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1334 while ( incidence ) { 1334 while ( incidence ) {
1335 if ( incidence->type() != "Journal" ) { 1335 if ( incidence->typeID() != journalID ) {
1336 bool add = true; 1336 bool add = true;
1337 if ( inFuture ) { 1337 if ( inFuture ) {
1338 QDateTime dt; 1338 QDateTime dt;
1339 if ( incidence->type() == "Todo" ) { 1339 if ( incidence->typeID() == todoID ) {
1340 Todo * t = (Todo*)incidence; 1340 Todo * t = (Todo*)incidence;
1341 if ( t->hasDueDate() ) 1341 if ( t->hasDueDate() )
1342 dt = t->dtDue(); 1342 dt = t->dtDue();
1343 else 1343 else
1344 dt = cur.addSecs( 62 ); 1344 dt = cur.addSecs( 62 );
1345 } 1345 }
1346 else { 1346 else {
1347 bool ok; 1347 bool ok;
1348 dt = incidence->getNextOccurence( cur, &ok ); 1348 dt = incidence->getNextOccurence( cur, &ok );
1349 if ( !ok ) 1349 if ( !ok )
1350 dt = cur.addSecs( -62 ); 1350 dt = cur.addSecs( -62 );
1351 } 1351 }
1352 if ( dt < cur || dt > end ) { 1352 if ( dt < cur || dt > end ) {
1353 add = false; 1353 add = false;
1354 } 1354 }
1355 } 1355 }
1356 if ( add ) { 1356 if ( add ) {
1357 Incidence *in = incidence->clone(); 1357 Incidence *in = incidence->clone();
1358 cal->addIncidence( in ); 1358 cal->addIncidence( in );
1359 } 1359 }
1360 } 1360 }
1361 incidence = delSel.next(); 1361 incidence = delSel.next();
1362 } 1362 }
1363 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1363 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
@@ -1575,93 +1575,93 @@ void MainWindow::updateWeek(QDate seda)
1575 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1575 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
1576 p.end(); 1576 p.end();
1577 QIconSet icon3 ( mWeekPixmap ); 1577 QIconSet icon3 ( mWeekPixmap );
1578 mWeekAction->setIconSet ( icon3 ); 1578 mWeekAction->setIconSet ( icon3 );
1579 1579
1580} 1580}
1581void MainWindow::updateWeekNum(const DateList &selectedDates) 1581void MainWindow::updateWeekNum(const DateList &selectedDates)
1582{ 1582{
1583 updateWeek( selectedDates.first() ); 1583 updateWeek( selectedDates.first() );
1584} 1584}
1585void MainWindow::processIncidenceSelection( Incidence *incidence ) 1585void MainWindow::processIncidenceSelection( Incidence *incidence )
1586{ 1586{
1587 1587
1588 if ( !incidence ) { 1588 if ( !incidence ) {
1589 enableIncidenceActions( false ); 1589 enableIncidenceActions( false );
1590 1590
1591 mNewSubTodoAction->setEnabled( false ); 1591 mNewSubTodoAction->setEnabled( false );
1592 setCaptionToDates(); 1592 setCaptionToDates();
1593 return; 1593 return;
1594 1594
1595 } 1595 }
1596 1596
1597 //KGlobal::locale()->formatDateTime(nextA, true); 1597 //KGlobal::locale()->formatDateTime(nextA, true);
1598 QString startString = ""; 1598 QString startString = "";
1599 if ( incidence->type() != "Todo" ) { 1599 if ( incidence->typeID() != todoID ) {
1600 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1600 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1601 if ( incidence->doesFloat() ) { 1601 if ( incidence->doesFloat() ) {
1602 startString += ": "+incidence->dtStartDateStr( true ); 1602 startString += ": "+incidence->dtStartDateStr( true );
1603 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1603 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1604 1604
1605 } else { 1605 } else {
1606 startString = ": "+incidence->dtStartStr(true); 1606 startString = ": "+incidence->dtStartStr(true);
1607 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1607 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1608 1608
1609 } 1609 }
1610 1610
1611 } else { 1611 } else {
1612 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1612 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1613 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1613 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1614 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1614 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1615 1615
1616 if ( incidence->isBirthday() || incidence->isAnniversary() ) { 1616 if ( incidence->isBirthday() || incidence->isAnniversary() ) {
1617 bool ok; 1617 bool ok;
1618 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1618 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1619 if ( ok ) { 1619 if ( ok ) {
1620 int years = noc.date().year() - incidence->dtStart().date().year(); 1620 int years = noc.date().year() - incidence->dtStart().date().year();
1621 startString += i18n(" (%1 y.)"). arg( years ); 1621 startString += i18n(" (%1 y.)"). arg( years );
1622 } 1622 }
1623 } 1623 }
1624 else 1624 else
1625 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1625 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1626 } 1626 }
1627 1627
1628 } 1628 }
1629 else 1629 else
1630 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1630 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1631 if ( !incidence->location().isEmpty() ) 1631 if ( !incidence->location().isEmpty() )
1632 startString += " (" +incidence->location()+")"; 1632 startString += " (" +incidence->location()+")";
1633 setCaption( incidence->summary()+startString); 1633 setCaption( incidence->summary()+startString);
1634 1634
1635 enableIncidenceActions( true ); 1635 enableIncidenceActions( true );
1636 1636
1637 if ( incidence->type() == "Event" ) { 1637 if ( incidence->typeID() == eventID ) {
1638 mShowAction->setText( i18n("Show Event...") ); 1638 mShowAction->setText( i18n("Show Event...") );
1639 mEditAction->setText( i18n("Edit Event...") ); 1639 mEditAction->setText( i18n("Edit Event...") );
1640 mDeleteAction->setText( i18n("Delete Event...") ); 1640 mDeleteAction->setText( i18n("Delete Event...") );
1641 1641
1642 mNewSubTodoAction->setEnabled( false ); 1642 mNewSubTodoAction->setEnabled( false );
1643 } else if ( incidence->type() == "Todo" ) { 1643 } else if ( incidence->typeID() == todoID ) {
1644 mShowAction->setText( i18n("Show Todo...") ); 1644 mShowAction->setText( i18n("Show Todo...") );
1645 mEditAction->setText( i18n("Edit Todo...") ); 1645 mEditAction->setText( i18n("Edit Todo...") );
1646 mDeleteAction->setText( i18n("Delete Todo...") ); 1646 mDeleteAction->setText( i18n("Delete Todo...") );
1647 1647
1648 mNewSubTodoAction->setEnabled( true ); 1648 mNewSubTodoAction->setEnabled( true );
1649 } else { 1649 } else {
1650 mShowAction->setText( i18n("Show...") ); 1650 mShowAction->setText( i18n("Show...") );
1651 mShowAction->setText( i18n("Edit...") ); 1651 mShowAction->setText( i18n("Edit...") );
1652 mShowAction->setText( i18n("Delete...") ); 1652 mShowAction->setText( i18n("Delete...") );
1653 1653
1654 mNewSubTodoAction->setEnabled( false ); 1654 mNewSubTodoAction->setEnabled( false );
1655 } 1655 }
1656} 1656}
1657 1657
1658void MainWindow::enableIncidenceActions( bool enabled ) 1658void MainWindow::enableIncidenceActions( bool enabled )
1659{ 1659{
1660 mShowAction->setEnabled( enabled ); 1660 mShowAction->setEnabled( enabled );
1661 mEditAction->setEnabled( enabled ); 1661 mEditAction->setEnabled( enabled );
1662 mDeleteAction->setEnabled( enabled ); 1662 mDeleteAction->setEnabled( enabled );
1663 1663
1664 mCloneAction->setEnabled( enabled ); 1664 mCloneAction->setEnabled( enabled );
1665 mMoveAction->setEnabled( enabled ); 1665 mMoveAction->setEnabled( enabled );
1666 mBeamAction->setEnabled( enabled ); 1666 mBeamAction->setEnabled( enabled );
1667 mCancelAction->setEnabled( enabled ); 1667 mCancelAction->setEnabled( enabled );
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp
index ed39ddb..7e8e2c5 100644
--- a/libkcal/calendar.cpp
+++ b/libkcal/calendar.cpp
@@ -332,53 +332,53 @@ QPtrList<Event> Calendar::events( const QDate &start, const QDate &end,
332QPtrList<Event> Calendar::events() 332QPtrList<Event> Calendar::events()
333{ 333{
334 QPtrList<Event> el = rawEvents(); 334 QPtrList<Event> el = rawEvents();
335 mFilter->apply(&el); 335 mFilter->apply(&el);
336 return el; 336 return el;
337} 337}
338void Calendar::addIncidenceBranch(Incidence *i) 338void Calendar::addIncidenceBranch(Incidence *i)
339{ 339{
340 addIncidence( i ); 340 addIncidence( i );
341 Incidence * inc; 341 Incidence * inc;
342 QPtrList<Incidence> Relations = i->relations(); 342 QPtrList<Incidence> Relations = i->relations();
343 for (inc=Relations.first();inc;inc=Relations.next()) { 343 for (inc=Relations.first();inc;inc=Relations.next()) {
344 addIncidenceBranch( inc ); 344 addIncidenceBranch( inc );
345 } 345 }
346} 346}
347 347
348bool Calendar::addIncidence(Incidence *i) 348bool Calendar::addIncidence(Incidence *i)
349{ 349{
350 Incidence::AddVisitor<Calendar> v(this); 350 Incidence::AddVisitor<Calendar> v(this);
351 351
352 return i->accept(v); 352 return i->accept(v);
353} 353}
354void Calendar::deleteIncidence(Incidence *in) 354void Calendar::deleteIncidence(Incidence *in)
355{ 355{
356 if ( in->type() == "Event" ) 356 if ( in->typeID() == eventID )
357 deleteEvent( (Event*) in ); 357 deleteEvent( (Event*) in );
358 else if ( in->type() =="Todo" ) 358 else if ( in->typeID() == todoID )
359 deleteTodo( (Todo*) in); 359 deleteTodo( (Todo*) in);
360 else if ( in->type() =="Journal" ) 360 else if ( in->typeID() == journalID )
361 deleteJournal( (Journal*) in ); 361 deleteJournal( (Journal*) in );
362} 362}
363 363
364Incidence* Calendar::incidence( const QString& uid ) 364Incidence* Calendar::incidence( const QString& uid )
365{ 365{
366 Incidence* i; 366 Incidence* i;
367 367
368 if( (i = todo( uid )) != 0 ) 368 if( (i = todo( uid )) != 0 )
369 return i; 369 return i;
370 if( (i = event( uid )) != 0 ) 370 if( (i = event( uid )) != 0 )
371 return i; 371 return i;
372 if( (i = journal( uid )) != 0 ) 372 if( (i = journal( uid )) != 0 )
373 return i; 373 return i;
374 374
375 return 0; 375 return 0;
376} 376}
377 377
378QPtrList<Todo> Calendar::todos() 378QPtrList<Todo> Calendar::todos()
379{ 379{
380 QPtrList<Todo> tl = rawTodos(); 380 QPtrList<Todo> tl = rawTodos();
381 mFilter->apply( &tl ); 381 mFilter->apply( &tl );
382 return tl; 382 return tl;
383} 383}
384 384
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index bc76c0b..fe74052 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -437,80 +437,76 @@ QDateTime CalendarLocal::nextAlarm( int daysTo )
437 next = t->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; 437 next = t->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
438 if ( ok ) { 438 if ( ok ) {
439 if ( next < nextA ) { 439 if ( next < nextA ) {
440 nextA = next; 440 nextA = next;
441 found = true; 441 found = true;
442 mNextSummary = t->summary(); 442 mNextSummary = t->summary();
443 mNextAlarmEventDateTime = next.addSecs(offset ); 443 mNextAlarmEventDateTime = next.addSecs(offset );
444 mNextAlarmIncidence = (Incidence *) t; 444 mNextAlarmIncidence = (Incidence *) t;
445 } 445 }
446 } 446 }
447 } 447 }
448 if ( mNextAlarmIncidence ) { 448 if ( mNextAlarmIncidence ) {
449 mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); 449 mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime);
450 mNextAlarmDateTime = nextA; 450 mNextAlarmDateTime = nextA;
451 } 451 }
452 return nextA; 452 return nextA;
453} 453}
454Alarm::List CalendarLocal::alarmsTo( const QDateTime &to ) 454Alarm::List CalendarLocal::alarmsTo( const QDateTime &to )
455{ 455{
456 return alarms( QDateTime( QDate( 1900, 1, 1 ) ), to ); 456 return alarms( QDateTime( QDate( 1900, 1, 1 ) ), to );
457} 457}
458 458
459Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to ) 459Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to )
460{ 460{
461 kdDebug(5800) << "CalendarLocal::alarms(" << from.toString() << " - " 461
462 << to.toString() << ")\n";
463
464 Alarm::List alarms; 462 Alarm::List alarms;
465 463
466 Event *e; 464 Event *e;
467 465
468 for( e = mEventList.first(); e; e = mEventList.next() ) { 466 for( e = mEventList.first(); e; e = mEventList.next() ) {
469 if ( e->doesRecur() ) appendRecurringAlarms( alarms, e, from, to ); 467 if ( e->doesRecur() ) appendRecurringAlarms( alarms, e, from, to );
470 else appendAlarms( alarms, e, from, to ); 468 else appendAlarms( alarms, e, from, to );
471 } 469 }
472 470
473 Todo *t; 471 Todo *t;
474 for( t = mTodoList.first(); t; t = mTodoList.next() ) { 472 for( t = mTodoList.first(); t; t = mTodoList.next() ) {
475 appendAlarms( alarms, t, from, to ); 473 appendAlarms( alarms, t, from, to );
476 } 474 }
477 475
478 return alarms; 476 return alarms;
479} 477}
480 478
481void CalendarLocal::appendAlarms( Alarm::List &alarms, Incidence *incidence, 479void CalendarLocal::appendAlarms( Alarm::List &alarms, Incidence *incidence,
482 const QDateTime &from, const QDateTime &to ) 480 const QDateTime &from, const QDateTime &to )
483{ 481{
484 QPtrList<Alarm> alarmList = incidence->alarms(); 482 QPtrList<Alarm> alarmList = incidence->alarms();
485 Alarm *alarm; 483 Alarm *alarm;
486 for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { 484 for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) {
487// kdDebug(5800) << "CalendarLocal::appendAlarms() '" << alarm->text() 485// kdDebug(5800) << "CalendarLocal::appendAlarms() '" << alarm->text()
488// << "': " << alarm->time().toString() << " - " << alarm->enabled() << endl; 486// << "': " << alarm->time().toString() << " - " << alarm->enabled() << endl;
489 if ( alarm->enabled() ) { 487 if ( alarm->enabled() ) {
490 if ( alarm->time() >= from && alarm->time() <= to ) { 488 if ( alarm->time() >= from && alarm->time() <= to ) {
491 kdDebug(5800) << "CalendarLocal::appendAlarms() '" << incidence->summary()
492 << "': " << alarm->time().toString() << endl;
493 alarms.append( alarm ); 489 alarms.append( alarm );
494 } 490 }
495 } 491 }
496 } 492 }
497} 493}
498 494
499void CalendarLocal::appendRecurringAlarms( Alarm::List &alarms, 495void CalendarLocal::appendRecurringAlarms( Alarm::List &alarms,
500 Incidence *incidence, 496 Incidence *incidence,
501 const QDateTime &from, 497 const QDateTime &from,
502 const QDateTime &to ) 498 const QDateTime &to )
503{ 499{
504 500
505 QPtrList<Alarm> alarmList = incidence->alarms(); 501 QPtrList<Alarm> alarmList = incidence->alarms();
506 Alarm *alarm; 502 Alarm *alarm;
507 QDateTime qdt; 503 QDateTime qdt;
508 for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { 504 for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) {
509 if (incidence->recursOn(from.date())) { 505 if (incidence->recursOn(from.date())) {
510 qdt.setTime(alarm->time().time()); 506 qdt.setTime(alarm->time().time());
511 qdt.setDate(from.date()); 507 qdt.setDate(from.date());
512 } 508 }
513 else qdt = alarm->time(); 509 else qdt = alarm->time();
514 // qDebug("1 %s %s %s", qdt.toString().latin1(), from.toString().latin1(), to.toString().latin1()); 510 // qDebug("1 %s %s %s", qdt.toString().latin1(), from.toString().latin1(), to.toString().latin1());
515 if ( alarm->enabled() ) { 511 if ( alarm->enabled() ) {
516 if ( qdt >= from && qdt <= to ) { 512 if ( qdt >= from && qdt <= to ) {
diff --git a/libkcal/calfilter.cpp b/libkcal/calfilter.cpp
index c425dfc..20078a7 100644
--- a/libkcal/calfilter.cpp
+++ b/libkcal/calfilter.cpp
@@ -57,53 +57,53 @@ void CalFilter::apply(QPtrList<Event> *eventlist)
57 } 57 }
58 } 58 }
59 59
60// kdDebug(5800) << "CalFilter::apply() done" << endl; 60// kdDebug(5800) << "CalFilter::apply() done" << endl;
61} 61}
62 62
63// TODO: avoid duplicating apply() code 63// TODO: avoid duplicating apply() code
64void CalFilter::apply(QPtrList<Todo> *eventlist) 64void CalFilter::apply(QPtrList<Todo> *eventlist)
65{ 65{
66 if (!mEnabled) return; 66 if (!mEnabled) return;
67 Todo *event = eventlist->first(); 67 Todo *event = eventlist->first();
68 while(event) { 68 while(event) {
69 if (!filterTodo(event)) { 69 if (!filterTodo(event)) {
70 eventlist->remove(); 70 eventlist->remove();
71 event = eventlist->current(); 71 event = eventlist->current();
72 } else { 72 } else {
73 event = eventlist->next(); 73 event = eventlist->next();
74 } 74 }
75 } 75 }
76 76
77// kdDebug(5800) << "CalFilter::apply() done" << endl; 77// kdDebug(5800) << "CalFilter::apply() done" << endl;
78} 78}
79bool CalFilter::filterCalendarItem(Incidence *in) 79bool CalFilter::filterCalendarItem(Incidence *in)
80{ 80{
81 if ( in->type() == "Event" ) 81 if ( in->typeID() == eventID )
82 return filterEvent( (Event*) in ); 82 return filterEvent( (Event*) in );
83 else if ( in->type() =="Todo" ) 83 else if ( in->typeID() == todoID )
84 return filterTodo( (Todo*) in); 84 return filterTodo( (Todo*) in);
85 else if ( in->type() =="Journal" ) 85 else if ( in->typeID () == journalID )
86 return filterJournal( (Journal*) in ); 86 return filterJournal( (Journal*) in );
87 return false; 87 return false;
88} 88}
89bool CalFilter::filterEvent(Event *event) 89bool CalFilter::filterEvent(Event *event)
90{ 90{
91 if (mCriteria & HideEvents) 91 if (mCriteria & HideEvents)
92 return false; 92 return false;
93 if (mCriteria & HideRecurring) { 93 if (mCriteria & HideRecurring) {
94 if (event->recurrence()->doesRecur()) return false; 94 if (event->recurrence()->doesRecur()) return false;
95 } 95 }
96 96
97 return filterIncidence(event); 97 return filterIncidence(event);
98} 98}
99bool CalFilter::filterJournal(Journal *j) 99bool CalFilter::filterJournal(Journal *j)
100{ 100{
101 if (mCriteria & HideJournals) 101 if (mCriteria & HideJournals)
102 return false; 102 return false;
103 return true; 103 return true;
104} 104}
105bool CalFilter::filterTodo(Todo *todo) 105bool CalFilter::filterTodo(Todo *todo)
106{ 106{
107 if (mCriteria & HideTodos) 107 if (mCriteria & HideTodos)
108 return false; 108 return false;
109 if (mCriteria & HideCompleted) { 109 if (mCriteria & HideCompleted) {
diff --git a/libkcal/event.h b/libkcal/event.h
index 8729956..287d403 100644
--- a/libkcal/event.h
+++ b/libkcal/event.h
@@ -19,48 +19,49 @@
19*/ 19*/
20 20
21#ifndef EVENT_H 21#ifndef EVENT_H
22#define EVENT_H 22#define EVENT_H
23// 23//
24// Event component, representing a VEVENT object 24// Event component, representing a VEVENT object
25// 25//
26 26
27#include "incidence.h" 27#include "incidence.h"
28namespace KCal { 28namespace KCal {
29 29
30/** 30/**
31 This class provides an Event in the sense of RFC2445. 31 This class provides an Event in the sense of RFC2445.
32*/ 32*/
33class Event : public Incidence 33class Event : public Incidence
34{ 34{
35 public: 35 public:
36 enum Transparency { Opaque, Transparent }; 36 enum Transparency { Opaque, Transparent };
37 typedef ListBase<Event> List; 37 typedef ListBase<Event> List;
38 Event(); 38 Event();
39 Event(const Event &); 39 Event(const Event &);
40 ~Event(); 40 ~Event();
41 41
42 QCString type() const { return "Event"; } 42 QCString type() const { return "Event"; }
43 IncTypeID typeID() const { return eventID; }
43 44
44 Incidence *clone(); 45 Incidence *clone();
45 QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const; 46 QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const;
46 47
47 /** for setting an event's ending date/time with a QDateTime. */ 48 /** for setting an event's ending date/time with a QDateTime. */
48 void setDtEnd(const QDateTime &dtEnd); 49 void setDtEnd(const QDateTime &dtEnd);
49 /** Return the event's ending date/time as a QDateTime. */ 50 /** Return the event's ending date/time as a QDateTime. */
50 virtual QDateTime dtEnd() const; 51 virtual QDateTime dtEnd() const;
51 /** returns an event's end time as a string formatted according to the 52 /** returns an event's end time as a string formatted according to the
52 users locale settings */ 53 users locale settings */
53 QString dtEndTimeStr() const; 54 QString dtEndTimeStr() const;
54 /** returns an event's end date as a string formatted according to the 55 /** returns an event's end date as a string formatted according to the
55 users locale settings */ 56 users locale settings */
56 QString dtEndDateStr(bool shortfmt=true) const; 57 QString dtEndDateStr(bool shortfmt=true) const;
57 /** returns an event's end date and time as a string formatted according 58 /** returns an event's end date and time as a string formatted according
58 to the users locale settings */ 59 to the users locale settings */
59 QString dtEndStr(bool shortfmt=true) const; 60 QString dtEndStr(bool shortfmt=true) const;
60 void setHasEndDate(bool); 61 void setHasEndDate(bool);
61 /** Return whether the event has an end date/time. */ 62 /** Return whether the event has an end date/time. */
62 bool hasEndDate() const; 63 bool hasEndDate() const;
63 64
64 /** Return true if the event spans multiple days, otherwise return false. */ 65 /** Return true if the event spans multiple days, otherwise return false. */
65 bool isMultiDay() const; 66 bool isMultiDay() const;
66 67
diff --git a/libkcal/freebusy.h b/libkcal/freebusy.h
index 054feda..d741c72 100644
--- a/libkcal/freebusy.h
+++ b/libkcal/freebusy.h
@@ -27,46 +27,47 @@
27#include <qvaluelist.h> 27#include <qvaluelist.h>
28#include <qptrlist.h> 28#include <qptrlist.h>
29 29
30#include "period.h" 30#include "period.h"
31#include "calendar.h" 31#include "calendar.h"
32 32
33#include "incidencebase.h" 33#include "incidencebase.h"
34 34
35namespace KCal { 35namespace KCal {
36 36
37/** 37/**
38 This class provides information about free/busy time of a calendar user. 38 This class provides information about free/busy time of a calendar user.
39*/ 39*/
40class FreeBusy : public IncidenceBase 40class FreeBusy : public IncidenceBase
41{ 41{
42 public: 42 public:
43 FreeBusy(); 43 FreeBusy();
44 FreeBusy(const QDateTime &start, const QDateTime &end); 44 FreeBusy(const QDateTime &start, const QDateTime &end);
45 FreeBusy(Calendar *calendar, const QDateTime &start, const QDateTime &end); 45 FreeBusy(Calendar *calendar, const QDateTime &start, const QDateTime &end);
46 FreeBusy(QValueList<Period> busyPeriods); 46 FreeBusy(QValueList<Period> busyPeriods);
47 47
48 ~FreeBusy(); 48 ~FreeBusy();
49 49
50 QCString type() const { return "FreeBusy"; } 50 QCString type() const { return "FreeBusy"; }
51 IncTypeID typeID() const { return freebusyID; }
51 52
52 virtual QDateTime dtEnd() const; 53 virtual QDateTime dtEnd() const;
53 bool setDtEnd( const QDateTime &end ); 54 bool setDtEnd( const QDateTime &end );
54 55
55 QValueList<Period> busyPeriods() const; 56 QValueList<Period> busyPeriods() const;
56 57
57 void addPeriod(const QDateTime &start, const QDateTime &end); 58 void addPeriod(const QDateTime &start, const QDateTime &end);
58 void sortList(); 59 void sortList();
59 60
60 private: 61 private:
61 62
62 //This is used for creating a freebusy object for the current user 63 //This is used for creating a freebusy object for the current user
63 bool addLocalPeriod(const QDateTime &start, const QDateTime &end); 64 bool addLocalPeriod(const QDateTime &start, const QDateTime &end);
64 65
65 QDateTime mDtEnd; 66 QDateTime mDtEnd;
66 QValueList<Period> mBusyPeriods; 67 QValueList<Period> mBusyPeriods;
67 Calendar *mCalendar; 68 Calendar *mCalendar;
68}; 69};
69 70
70} 71}
71 72
72#endif 73#endif
diff --git a/libkcal/icalformat.cpp b/libkcal/icalformat.cpp
index 3a2aac6..d9fe40b 100644
--- a/libkcal/icalformat.cpp
+++ b/libkcal/icalformat.cpp
@@ -363,54 +363,54 @@ ScheduleMessage *ICalFormat::parseScheduleMessage( Calendar *cal,
363 method = Scheduler::Counter; 363 method = Scheduler::Counter;
364 break; 364 break;
365 case ICAL_METHOD_DECLINECOUNTER: 365 case ICAL_METHOD_DECLINECOUNTER:
366 method = Scheduler::Declinecounter; 366 method = Scheduler::Declinecounter;
367 break; 367 break;
368 default: 368 default:
369 method = Scheduler::NoMethod; 369 method = Scheduler::NoMethod;
370 kdDebug(5800) << "ICalFormat::parseScheduleMessage(): Unknow method" << endl; 370 kdDebug(5800) << "ICalFormat::parseScheduleMessage(): Unknow method" << endl;
371 break; 371 break;
372 } 372 }
373 373
374 374
375 if (!icalrestriction_check(message)) { 375 if (!icalrestriction_check(message)) {
376 setException(new ErrorFormat(ErrorFormat::Restriction, 376 setException(new ErrorFormat(ErrorFormat::Restriction,
377 Scheduler::translatedMethodName(method) + ": " + 377 Scheduler::translatedMethodName(method) + ": " +
378 mImpl->extractErrorProperty(c))); 378 mImpl->extractErrorProperty(c)));
379 return 0; 379 return 0;
380 } 380 }
381 381
382 icalcomponent *calendarComponent = mImpl->createCalendarComponent(cal); 382 icalcomponent *calendarComponent = mImpl->createCalendarComponent(cal);
383 383
384 Incidence *existingIncidence = cal->event(incidence->uid()); 384 Incidence *existingIncidence = cal->event(incidence->uid());
385 if (existingIncidence) { 385 if (existingIncidence) {
386 // TODO: check, if cast is required, or if it can be done by virtual funcs. 386 // TODO: check, if cast is required, or if it can be done by virtual funcs.
387 if (existingIncidence->type() == "Todo") { 387 if (existingIncidence->typeID() == todoID ) {
388 Todo *todo = static_cast<Todo *>(existingIncidence); 388 Todo *todo = static_cast<Todo *>(existingIncidence);
389 icalcomponent_add_component(calendarComponent, 389 icalcomponent_add_component(calendarComponent,
390 mImpl->writeTodo(todo)); 390 mImpl->writeTodo(todo));
391 } 391 }
392 if (existingIncidence->type() == "Event") { 392 if (existingIncidence->typeID() == eventID ) {
393 Event *event = static_cast<Event *>(existingIncidence); 393 Event *event = static_cast<Event *>(existingIncidence);
394 icalcomponent_add_component(calendarComponent, 394 icalcomponent_add_component(calendarComponent,
395 mImpl->writeEvent(event)); 395 mImpl->writeEvent(event));
396 } 396 }
397 } else { 397 } else {
398 calendarComponent = 0; 398 calendarComponent = 0;
399 } 399 }
400 qDebug("icalclassify commented out "); 400 qDebug("icalclassify commented out ");
401 ScheduleMessage::Status status; 401 ScheduleMessage::Status status;
402#if 0 402#if 0
403 403
404 icalclass result = icalclassify(message,calendarComponent,(char *)""); 404 icalclass result = icalclassify(message,calendarComponent,(char *)"");
405 405
406 406
407 407
408 switch (result) { 408 switch (result) {
409 case ICAL_PUBLISH_NEW_CLASS: 409 case ICAL_PUBLISH_NEW_CLASS:
410 status = ScheduleMessage::PublishNew; 410 status = ScheduleMessage::PublishNew;
411 break; 411 break;
412 case ICAL_OBSOLETE_CLASS: 412 case ICAL_OBSOLETE_CLASS:
413 status = ScheduleMessage::Obsolete; 413 status = ScheduleMessage::Obsolete;
414 break; 414 break;
415 case ICAL_REQUEST_NEW_CLASS: 415 case ICAL_REQUEST_NEW_CLASS:
416 status = ScheduleMessage::RequestNew; 416 status = ScheduleMessage::RequestNew;
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp
index 2405682..3e28714 100644
--- a/libkcal/icalformatimpl.cpp
+++ b/libkcal/icalformatimpl.cpp
@@ -2134,39 +2134,39 @@ icalcomponent *ICalFormatImpl::createScheduleComponent(IncidenceBase *incidence,
2134 break; 2134 break;
2135 case Scheduler::Cancel: 2135 case Scheduler::Cancel:
2136 icalmethod = ICAL_METHOD_CANCEL; 2136 icalmethod = ICAL_METHOD_CANCEL;
2137 break; 2137 break;
2138 case Scheduler::Add: 2138 case Scheduler::Add:
2139 icalmethod = ICAL_METHOD_ADD; 2139 icalmethod = ICAL_METHOD_ADD;
2140 break; 2140 break;
2141 case Scheduler::Reply: 2141 case Scheduler::Reply:
2142 icalmethod = ICAL_METHOD_REPLY; 2142 icalmethod = ICAL_METHOD_REPLY;
2143 break; 2143 break;
2144 case Scheduler::Counter: 2144 case Scheduler::Counter:
2145 icalmethod = ICAL_METHOD_COUNTER; 2145 icalmethod = ICAL_METHOD_COUNTER;
2146 break; 2146 break;
2147 case Scheduler::Declinecounter: 2147 case Scheduler::Declinecounter:
2148 icalmethod = ICAL_METHOD_DECLINECOUNTER; 2148 icalmethod = ICAL_METHOD_DECLINECOUNTER;
2149 break; 2149 break;
2150 default: 2150 default:
2151 2151
2152 return message; 2152 return message;
2153 } 2153 }
2154 2154
2155 icalcomponent_add_property(message,icalproperty_new_method(icalmethod)); 2155 icalcomponent_add_property(message,icalproperty_new_method(icalmethod));
2156 2156
2157 // TODO: check, if dynamic cast is required 2157 // TODO: check, if dynamic cast is required
2158 if(incidence->type() == "Todo") { 2158 if(incidence->typeID() == todoID ) {
2159 Todo *todo = static_cast<Todo *>(incidence); 2159 Todo *todo = static_cast<Todo *>(incidence);
2160 icalcomponent_add_component(message,writeTodo(todo)); 2160 icalcomponent_add_component(message,writeTodo(todo));
2161 } 2161 }
2162 if(incidence->type() == "Event") { 2162 if(incidence->typeID() == eventID ) {
2163 Event *event = static_cast<Event *>(incidence); 2163 Event *event = static_cast<Event *>(incidence);
2164 icalcomponent_add_component(message,writeEvent(event)); 2164 icalcomponent_add_component(message,writeEvent(event));
2165 } 2165 }
2166 if(incidence->type() == "FreeBusy") { 2166 if(incidence->typeID() == freebusyID) {
2167 FreeBusy *freebusy = static_cast<FreeBusy *>(incidence); 2167 FreeBusy *freebusy = static_cast<FreeBusy *>(incidence);
2168 icalcomponent_add_component(message,writeFreeBusy(freebusy, method)); 2168 icalcomponent_add_component(message,writeFreeBusy(freebusy, method));
2169 } 2169 }
2170 2170
2171 return message; 2171 return message;
2172} 2172}
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index 762103f..f446197 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -215,49 +215,49 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 )
215 return 215 return
216 // i1.created() == i2.created() && 216 // i1.created() == i2.created() &&
217 stringCompare( i1.description(), i2.description() ) && 217 stringCompare( i1.description(), i2.description() ) &&
218 stringCompare( i1.summary(), i2.summary() ) && 218 stringCompare( i1.summary(), i2.summary() ) &&
219 i1.categories() == i2.categories() && 219 i1.categories() == i2.categories() &&
220 // no need to compare mRelatedTo 220 // no need to compare mRelatedTo
221 stringCompare( i1.relatedToUid(), i2.relatedToUid() ) && 221 stringCompare( i1.relatedToUid(), i2.relatedToUid() ) &&
222 // i1.relations() == i2.relations() && 222 // i1.relations() == i2.relations() &&
223 i1.exDates() == i2.exDates() && 223 i1.exDates() == i2.exDates() &&
224 i1.attachments() == i2.attachments() && 224 i1.attachments() == i2.attachments() &&
225 i1.resources() == i2.resources() && 225 i1.resources() == i2.resources() &&
226 i1.secrecy() == i2.secrecy() && 226 i1.secrecy() == i2.secrecy() &&
227 i1.priority() == i2.priority() && 227 i1.priority() == i2.priority() &&
228 i1.cancelled() == i2.cancelled() && 228 i1.cancelled() == i2.cancelled() &&
229 stringCompare( i1.location(), i2.location() ); 229 stringCompare( i1.location(), i2.location() );
230} 230}
231 231
232Incidence* Incidence::recreateCloneException( QDate d ) 232Incidence* Incidence::recreateCloneException( QDate d )
233{ 233{
234 Incidence* newInc = clone(); 234 Incidence* newInc = clone();
235 newInc->recreate(); 235 newInc->recreate();
236 if ( doesRecur() ) { 236 if ( doesRecur() ) {
237 addExDate( d ); 237 addExDate( d );
238 newInc->recurrence()->unsetRecurs(); 238 newInc->recurrence()->unsetRecurs();
239 if ( type() == "Event") { 239 if ( typeID() == eventID ) {
240 int len = dtStart().secsTo( ((Event*)this)->dtEnd()); 240 int len = dtStart().secsTo( ((Event*)this)->dtEnd());
241 QTime tim = dtStart().time(); 241 QTime tim = dtStart().time();
242 newInc->setDtStart( QDateTime(d, tim) ); 242 newInc->setDtStart( QDateTime(d, tim) );
243 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); 243 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) );
244 } else { 244 } else {
245 int len = dtStart().secsTo( ((Todo*)this)->dtDue()); 245 int len = dtStart().secsTo( ((Todo*)this)->dtDue());
246 QTime tim = ((Todo*)this)->dtDue().time(); 246 QTime tim = ((Todo*)this)->dtDue().time();
247 ((Todo*)newInc)->setDtDue( QDateTime(d, tim) ); 247 ((Todo*)newInc)->setDtDue( QDateTime(d, tim) );
248 ((Todo*)newInc)->setDtStart( ((Todo*)newInc)->dtDue().addSecs( -len ) ); 248 ((Todo*)newInc)->setDtStart( ((Todo*)newInc)->dtDue().addSecs( -len ) );
249 ((Todo*)this)->setRecurDates(); 249 ((Todo*)this)->setRecurDates();
250 } 250 }
251 newInc->setExDates( DateList () ); 251 newInc->setExDates( DateList () );
252 } 252 }
253 return newInc; 253 return newInc;
254} 254}
255 255
256void Incidence::recreate() 256void Incidence::recreate()
257{ 257{
258 setCreated(QDateTime::currentDateTime()); 258 setCreated(QDateTime::currentDateTime());
259 259
260 setUid(CalFormat::createUniqueId()); 260 setUid(CalFormat::createUniqueId());
261 261
262 setRevision(0); 262 setRevision(0);
263 setIDStr( ":" ); 263 setIDStr( ":" );
@@ -703,42 +703,42 @@ QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const
703 while ( !last ) { 703 while ( !last ) {
704 ++count; 704 ++count;
705 incidenceStart = recurrence()->getNextDateTime( incidenceStart, &last ); 705 incidenceStart = recurrence()->getNextDateTime( incidenceStart, &last );
706 if ( recursOn( incidenceStart.date() ) ) { 706 if ( recursOn( incidenceStart.date() ) ) {
707 last = true; // exit while llop 707 last = true; // exit while llop
708 } else { 708 } else {
709 if ( last ) { // no alarm on last recurrence 709 if ( last ) { // no alarm on last recurrence
710 return QDateTime (); 710 return QDateTime ();
711 } 711 }
712 int year = incidenceStart.date().year(); 712 int year = incidenceStart.date().year();
713 // workaround for bug in recurrence 713 // workaround for bug in recurrence
714 if ( count == 100 || year < 1000 || year > 5000 ) { 714 if ( count == 100 || year < 1000 || year > 5000 ) {
715 return QDateTime (); 715 return QDateTime ();
716 } 716 }
717 incidenceStart = incidenceStart.addSecs( 1 ); 717 incidenceStart = incidenceStart.addSecs( 1 );
718 } 718 }
719 } 719 }
720 } else { 720 } else {
721 return QDateTime (); 721 return QDateTime ();
722 } 722 }
723 } else { 723 } else {
724 if ( hasStartDate () ) { 724 if ( hasStartDate () ) {
725 incidenceStart = dtStart(); 725 incidenceStart = dtStart();
726 } 726 }
727 if ( type() =="Todo" ) { 727 if ( typeID() == todoID ) {
728 if ( ((Todo*)this)->hasDueDate() ) 728 if ( ((Todo*)this)->hasDueDate() )
729 incidenceStart = ((Todo*)this)->dtDue(); 729 incidenceStart = ((Todo*)this)->dtDue();
730 } 730 }
731 } 731 }
732 if ( incidenceStart > dt ) 732 if ( incidenceStart > dt )
733 *ok = true; 733 *ok = true;
734 return incidenceStart; 734 return incidenceStart;
735} 735}
736QDateTime Incidence::dtStart() const 736QDateTime Incidence::dtStart() const
737{ 737{
738 if ( doesRecur() ) { 738 if ( doesRecur() ) {
739 if ( type() == "Todo" ) { 739 if ( typeID() == todoID ) {
740 ((Todo*)this)->checkSetCompletedFalse(); 740 ((Todo*)this)->checkSetCompletedFalse();
741 } 741 }
742 } 742 }
743 return mDtStart; 743 return mDtStart;
744} 744}
diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h
index 8624786..05209e0 100644
--- a/libkcal/incidencebase.h
+++ b/libkcal/incidencebase.h
@@ -13,65 +13,67 @@
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20#ifndef KCAL_INCIDENCEBASE_H 20#ifndef KCAL_INCIDENCEBASE_H
21#define KCAL_INCIDENCEBASE_H 21#define KCAL_INCIDENCEBASE_H
22// 22//
23// Incidence - base class of calendaring components 23// Incidence - base class of calendaring components
24// 24//
25 25
26#include <qdatetime.h> 26#include <qdatetime.h>
27#include <qstringlist.h> 27#include <qstringlist.h>
28#include <qvaluelist.h> 28#include <qvaluelist.h>
29#include <qptrlist.h> 29#include <qptrlist.h>
30 30
31#include "customproperties.h" 31#include "customproperties.h"
32#include "attendee.h" 32#include "attendee.h"
33 33
34namespace KCal { 34namespace KCal {
35 35
36typedef QValueList<QDate> DateList; 36typedef QValueList<QDate> DateList;
37 enum IncTypeID { eventID,todoID,journalID,freebusyID };
37 38
38/** 39/**
39 This class provides the base class common to all calendar components. 40 This class provides the base class common to all calendar components.
40*/ 41*/
41class IncidenceBase : public CustomProperties 42class IncidenceBase : public CustomProperties
42{ 43{
43 public: 44 public:
44 class Observer { 45 class Observer {
45 public: 46 public:
46 virtual void incidenceUpdated( IncidenceBase * ) = 0; 47 virtual void incidenceUpdated( IncidenceBase * ) = 0;
47 }; 48 };
48 49
49 IncidenceBase(); 50 IncidenceBase();
50 IncidenceBase(const IncidenceBase &); 51 IncidenceBase(const IncidenceBase &);
51 virtual ~IncidenceBase(); 52 virtual ~IncidenceBase();
52 53
53 virtual QCString type() const = 0; 54 virtual QCString type() const = 0;
55 virtual IncTypeID typeID() const = 0;
54 56
55 /** Set the unique id for the event */ 57 /** Set the unique id for the event */
56 void setUid(const QString &); 58 void setUid(const QString &);
57 /** Return the unique id for the event */ 59 /** Return the unique id for the event */
58 QString uid() const; 60 QString uid() const;
59 61
60 /** Sets the time the incidence was last modified. */ 62 /** Sets the time the incidence was last modified. */
61 void setLastModified(const QDateTime &lm); 63 void setLastModified(const QDateTime &lm);
62 /** Return the time the incidence was last modified. */ 64 /** Return the time the incidence was last modified. */
63 QDateTime lastModified() const; 65 QDateTime lastModified() const;
64 66
65 /** sets the organizer for the event */ 67 /** sets the organizer for the event */
66 void setOrganizer(const QString &o); 68 void setOrganizer(const QString &o);
67 QString organizer() const; 69 QString organizer() const;
68 70
69 /** Set readonly status. */ 71 /** Set readonly status. */
70 virtual void setReadOnly( bool ); 72 virtual void setReadOnly( bool );
71 /** Return if the object is read-only. */ 73 /** Return if the object is read-only. */
72 bool isReadOnly() const { return mReadOnly; } 74 bool isReadOnly() const { return mReadOnly; }
73 75
74 /** for setting the event's starting date/time with a QDateTime. */ 76 /** for setting the event's starting date/time with a QDateTime. */
75 virtual void setDtStart(const QDateTime &dtStart); 77 virtual void setDtStart(const QDateTime &dtStart);
76 /** returns an event's starting date/time as a QDateTime. */ 78 /** returns an event's starting date/time as a QDateTime. */
77 virtual QDateTime dtStart() const; 79 virtual QDateTime dtStart() const;
diff --git a/libkcal/journal.h b/libkcal/journal.h
index 2c1d7ea..1cd0a22 100644
--- a/libkcal/journal.h
+++ b/libkcal/journal.h
@@ -16,35 +16,36 @@
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20#ifndef JOURNAL_H 20#ifndef JOURNAL_H
21#define JOURNAL_H 21#define JOURNAL_H
22// 22//
23// Journal component, representing a VJOURNAL object 23// Journal component, representing a VJOURNAL object
24// 24//
25 25
26#include "incidence.h" 26#include "incidence.h"
27 27
28namespace KCal { 28namespace KCal {
29 29
30/** 30/**
31 This class provides a Journal in the sense of RFC2445. 31 This class provides a Journal in the sense of RFC2445.
32*/ 32*/
33class Journal : public Incidence 33class Journal : public Incidence
34{ 34{
35 public: 35 public:
36 Journal(); 36 Journal();
37 ~Journal(); 37 ~Journal();
38 38
39 QCString type() const { return "Journal"; } 39 QCString type() const { return "Journal"; }
40 IncTypeID typeID() const { return journalID; }
40 41
41 Incidence *clone(); 42 Incidence *clone();
42 QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const; 43 QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const;
43private: 44private:
44 bool accept(Visitor &v) { return v.visit(this); } 45 bool accept(Visitor &v) { return v.visit(this); }
45}; 46};
46 47
47 bool operator==( const Journal&, const Journal& ); 48 bool operator==( const Journal&, const Journal& );
48} 49}
49 50
50#endif 51#endif
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index 7d61b7f..d1ace4f 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -1,50 +1,50 @@
1#include "kincidenceformatter.h" 1#include "kincidenceformatter.h"
2#include <kstaticdeleter.h> 2#include <kstaticdeleter.h>
3#include <kglobal.h> 3#include <kglobal.h>
4#include <klocale.h> 4#include <klocale.h>
5#ifdef DEKTOP_VERSION 5#ifdef DEKTOP_VERSION
6#include <kabc/stdaddressbook.h> 6#include <kabc/stdaddressbook.h>
7#define size count 7#define size count
8#endif 8#endif
9 9
10KIncidenceFormatter* KIncidenceFormatter::mInstance = 0; 10KIncidenceFormatter* KIncidenceFormatter::mInstance = 0;
11static KStaticDeleter<KIncidenceFormatter> insd; 11static KStaticDeleter<KIncidenceFormatter> insd;
12 12
13QString KIncidenceFormatter::getFormattedText( Incidence * inc, bool details, bool created , bool modified ) 13QString KIncidenceFormatter::getFormattedText( Incidence * inc, bool details, bool created , bool modified )
14{ 14{
15// #ifndef QT_NO_INPUTDIALOG 15// #ifndef QT_NO_INPUTDIALOG
16// return QInputDialog::getItem( caption, label, items, current, editable ); 16// return QInputDialog::getItem( caption, label, items, current, editable );
17// #else 17// #else
18// return QString::null; 18// return QString::null;
19// #endif 19// #endif
20 mDetails = details; 20 mDetails = details;
21 mCreated = created ; 21 mCreated = created ;
22 mModified = modified; 22 mModified = modified;
23 mText = ""; 23 mText = "";
24 if ( inc->type() == "Event" ) 24 if ( inc->typeID() == eventID )
25 setEvent((Event *) inc ); 25 setEvent((Event *) inc );
26 else if ( inc->type() == "Todo" ) 26 else if ( inc->typeID() == todoID )
27 setTodo((Todo *) inc ); 27 setTodo((Todo *) inc );
28 return mText; 28 return mText;
29} 29}
30 30
31KIncidenceFormatter* KIncidenceFormatter::instance() 31KIncidenceFormatter* KIncidenceFormatter::instance()
32{ 32{
33 if (!mInstance) { 33 if (!mInstance) {
34 mInstance = insd.setObject(new KIncidenceFormatter()); 34 mInstance = insd.setObject(new KIncidenceFormatter());
35 } 35 }
36 return mInstance; 36 return mInstance;
37} 37}
38KIncidenceFormatter::~KIncidenceFormatter() 38KIncidenceFormatter::~KIncidenceFormatter()
39{ 39{
40 if (mInstance == this) 40 if (mInstance == this)
41 mInstance = insd.setObject(0); 41 mInstance = insd.setObject(0);
42 //qDebug("KIncidenceFormatter::~KIncidenceFormatter "); 42 //qDebug("KIncidenceFormatter::~KIncidenceFormatter ");
43} 43}
44KIncidenceFormatter::KIncidenceFormatter() 44KIncidenceFormatter::KIncidenceFormatter()
45{ 45{
46 mColorMode = 0; 46 mColorMode = 0;
47} 47}
48void KIncidenceFormatter::setEvent(Event *event) 48void KIncidenceFormatter::setEvent(Event *event)
49{ 49{
50 int mode = 0; 50 int mode = 0;
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 38ba2c7..c97a61e 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -109,49 +109,49 @@ void Todo::saveRunningInfoToFile( QString comment )
109 to->setDtStart( mRunStart ); 109 to->setDtStart( mRunStart );
110 to->setHasStartDate( true ); 110 to->setHasStartDate( true );
111 to->setDtDue( QDateTime::currentDateTime() ); 111 to->setDtDue( QDateTime::currentDateTime() );
112 to->setHasDueDate( true ); 112 to->setHasDueDate( true );
113 to->setUid( file ); 113 to->setUid( file );
114 if ( !comment.isEmpty() ) { 114 if ( !comment.isEmpty() ) {
115 QString des = to->description(); 115 QString des = to->description();
116 if ( des.isEmpty () ) 116 if ( des.isEmpty () )
117 to->setDescription( "TT-Note: " + comment ); 117 to->setDescription( "TT-Note: " + comment );
118 else 118 else
119 to->setDescription( "TT-Note: " + comment +"\n" + des ); 119 to->setDescription( "TT-Note: " + comment +"\n" + des );
120 } 120 }
121 cal.addIncidence( to ); 121 cal.addIncidence( to );
122 ICalFormat format; 122 ICalFormat format;
123 file = dir +"/" +file +".ics"; 123 file = dir +"/" +file +".ics";
124 format.save( &cal, file ); 124 format.save( &cal, file );
125 saveParents(); 125 saveParents();
126 126
127} 127}
128void Todo::saveParents() 128void Todo::saveParents()
129{ 129{
130 if (!relatedTo() ) 130 if (!relatedTo() )
131 return; 131 return;
132 Incidence * inc = relatedTo(); 132 Incidence * inc = relatedTo();
133 if ( inc->type() != "Todo" ) 133 if ( inc->typeID() != todoID )
134 return; 134 return;
135 Todo* to = (Todo*)inc; 135 Todo* to = (Todo*)inc;
136 bool saveTodo = false; 136 bool saveTodo = false;
137 QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics"; 137 QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics";
138 QFileInfo fi ( file ); 138 QFileInfo fi ( file );
139 if ( fi.exists() ) { 139 if ( fi.exists() ) {
140 if ( fi.lastModified () < to->lastModified ()) 140 if ( fi.lastModified () < to->lastModified ())
141 saveTodo = true; 141 saveTodo = true;
142 } else { 142 } else {
143 saveTodo = true; 143 saveTodo = true;
144 } 144 }
145 if ( saveTodo ) { 145 if ( saveTodo ) {
146 CalendarLocal cal; 146 CalendarLocal cal;
147 cal.setLocalTime(); 147 cal.setLocalTime();
148 Todo * par = (Todo *) to->clone(); 148 Todo * par = (Todo *) to->clone();
149 cal.addIncidence( par ); 149 cal.addIncidence( par );
150 ICalFormat format; 150 ICalFormat format;
151 format.save( &cal, file ); 151 format.save( &cal, file );
152 } 152 }
153 to->saveParents(); 153 to->saveParents();
154} 154}
155 155
156int Todo::runTime() 156int Todo::runTime()
157{ 157{
@@ -543,38 +543,39 @@ QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_d
543 } else { 543 } else {
544 int secs = alarm->startOffset().asSeconds(); 544 int secs = alarm->startOffset().asSeconds();
545 if ( incidenceStart.addSecs( secs ) < alarmStart ) { 545 if ( incidenceStart.addSecs( secs ) < alarmStart ) {
546 alarmStart = incidenceStart.addSecs( secs ); 546 alarmStart = incidenceStart.addSecs( secs );
547 enabled = true; 547 enabled = true;
548 off = -secs; 548 off = -secs;
549 } 549 }
550 } 550 }
551 } 551 }
552 } 552 }
553 if ( enabled ) { 553 if ( enabled ) {
554 if ( alarmStart > start_dt ) { 554 if ( alarmStart > start_dt ) {
555 *ok = true; 555 *ok = true;
556 * offset = off; 556 * offset = off;
557 return alarmStart; 557 return alarmStart;
558 } 558 }
559 } 559 }
560 *ok = false; 560 *ok = false;
561 return QDateTime (); 561 return QDateTime ();
562 562
563} 563}
564 564
565void Todo::checkSetCompletedFalse() 565void Todo::checkSetCompletedFalse()
566{ 566{
567 if ( !hasRecurrenceID() ) { 567 if ( !mHasRecurrenceID ) {
568 qDebug("ERROR 1 in Todo::checkSetCompletedFalse"); 568 qDebug("ERROR 1 in Todo::checkSetCompletedFalse");
569 return;
569 } 570 }
570 // qDebug("Todo::checkSetCompletedFalse()"); 571 // qDebug("Todo::checkSetCompletedFalse()");
571 //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); 572 //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() );
572 if ( mPercentComplete == 100 ) { 573 if ( mPercentComplete == 100 ) {
573 QDateTime dt = QDateTime::currentDateTime(); 574 QDateTime dt = QDateTime::currentDateTime();
574 if ( dt > mDtStart && dt > mRecurrenceID ) { 575 if ( dt > mDtStart && dt > mRecurrenceID ) {
575 qDebug("start: %s --due: %s --recID: %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); 576 qDebug("start: %s --due: %s --recID: %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() );
576 setCompleted( false ); 577 setCompleted( false );
577 qDebug("Todo::checkSetCompletedFalse "); 578 qDebug("Todo::checkSetCompletedFalse ");
578 } 579 }
579 } 580 }
580} 581}
diff --git a/libkcal/todo.h b/libkcal/todo.h
index ab8fdf1..501c2ba 100644
--- a/libkcal/todo.h
+++ b/libkcal/todo.h
@@ -20,48 +20,49 @@
20#ifndef TODO_H 20#ifndef TODO_H
21#define TODO_H 21#define TODO_H
22// 22//
23// Todo component, representing a VTODO object 23// Todo component, representing a VTODO object
24// 24//
25 25
26#include "incidence.h" 26#include "incidence.h"
27 27
28#include <qtimer.h> 28#include <qtimer.h>
29 29
30namespace KCal { 30namespace KCal {
31 31
32/** 32/**
33 This class provides a Todo in the sense of RFC2445. 33 This class provides a Todo in the sense of RFC2445.
34*/ 34*/
35 class Todo : public QObject,public Incidence 35 class Todo : public QObject,public Incidence
36{ 36{
37 Q_OBJECT 37 Q_OBJECT
38 public: 38 public:
39 Todo(); 39 Todo();
40 Todo(const Todo &); 40 Todo(const Todo &);
41 ~Todo(); 41 ~Todo();
42 typedef ListBase<Todo> List; 42 typedef ListBase<Todo> List;
43 QCString type() const { return "Todo"; } 43 QCString type() const { return "Todo"; }
44 IncTypeID typeID() const { return todoID; }
44 45
45 /** Return an exact copy of this todo. */ 46 /** Return an exact copy of this todo. */
46 Incidence *clone(); 47 Incidence *clone();
47 QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const; 48 QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const;
48 49
49 /** for setting the todo's due date/time with a QDateTime. */ 50 /** for setting the todo's due date/time with a QDateTime. */
50 void setDtDue(const QDateTime &dtDue); 51 void setDtDue(const QDateTime &dtDue);
51 /** returns an event's Due date/time as a QDateTime. */ 52 /** returns an event's Due date/time as a QDateTime. */
52 QDateTime dtDue() const; 53 QDateTime dtDue() const;
53 /** returns an event's due time as a string formatted according to the 54 /** returns an event's due time as a string formatted according to the
54 users locale settings */ 55 users locale settings */
55 QString dtDueTimeStr() const; 56 QString dtDueTimeStr() const;
56 /** returns an event's due date as a string formatted according to the 57 /** returns an event's due date as a string formatted according to the
57 users locale settings */ 58 users locale settings */
58 QString dtDueDateStr(bool shortfmt=true) const; 59 QString dtDueDateStr(bool shortfmt=true) const;
59 /** returns an event's due date and time as a string formatted according 60 /** returns an event's due date and time as a string formatted according
60 to the users locale settings */ 61 to the users locale settings */
61 QString dtDueStr(bool shortfmt=true) const; 62 QString dtDueStr(bool shortfmt=true) const;
62 63
63 /** returns TRUE or FALSE depending on whether the todo has a due date */ 64 /** returns TRUE or FALSE depending on whether the todo has a due date */
64 bool hasDueDate() const; 65 bool hasDueDate() const;
65 /** sets the event's hasDueDate value. */ 66 /** sets the event's hasDueDate value. */
66 void setHasDueDate(bool f); 67 void setHasDueDate(bool f);
67 68