summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp21
-rw-r--r--korganizer/mainwindow.cpp3
2 files changed, 13 insertions, 11 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 038da54..06454c2 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -919,114 +919,114 @@ void CalendarView::checkExternalId( Incidence * inc )
919{ 919{
920 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; 920 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ;
921 checkExternSyncEvent( lastSync, inc ); 921 checkExternSyncEvent( lastSync, inc );
922 922
923} 923}
924bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) 924bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode )
925{ 925{
926 bool syncOK = true; 926 bool syncOK = true;
927 int addedEvent = 0; 927 int addedEvent = 0;
928 int addedEventR = 0; 928 int addedEventR = 0;
929 int deletedEventR = 0; 929 int deletedEventR = 0;
930 int deletedEventL = 0; 930 int deletedEventL = 0;
931 int changedLocal = 0; 931 int changedLocal = 0;
932 int changedRemote = 0; 932 int changedRemote = 0;
933 int filteredIN = 0; 933 int filteredIN = 0;
934 int filteredOUT = 0; 934 int filteredOUT = 0;
935 //QPtrList<Event> el = local->rawEvents(); 935 //QPtrList<Event> el = local->rawEvents();
936 Event* eventR; 936 Event* eventR;
937 QString uid; 937 QString uid;
938 int take; 938 int take;
939 Event* eventL; 939 Event* eventL;
940 Event* eventRSync; 940 Event* eventRSync;
941 Event* eventLSync; 941 Event* eventLSync;
942 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); 942 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents();
943 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); 943 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents();
944 bool fullDateRange = false; 944 bool fullDateRange = false;
945 local->resetTempSyncStat(); 945 local->resetTempSyncStat();
946 mLastCalendarSync = QDateTime::currentDateTime(); 946 mLastCalendarSync = QDateTime::currentDateTime();
947 if ( mSyncManager->syncWithDesktop() ) { 947 if ( mSyncManager->syncWithDesktop() ) {
948 remote->resetPilotStat(1); 948 remote->resetPilotStat(1);
949 if ( KSyncManager::mRequestedSyncEvent.isValid() ) { 949 if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
950 mLastCalendarSync = KSyncManager::mRequestedSyncEvent; 950 mLastCalendarSync = KSyncManager::mRequestedSyncEvent;
951 qDebug("using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); 951 qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() );
952 } else { 952 } else {
953 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); 953 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime ");
954 } 954 }
955 } 955 }
956 QDateTime modifiedCalendar = mLastCalendarSync; 956 QDateTime modifiedCalendar = mLastCalendarSync;
957 eventLSync = getLastSyncEvent(); 957 eventLSync = getLastSyncEvent();
958 eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); 958 eventR = remote->event("last-syncEvent-"+mCurrentSyncName );
959 if ( eventR ) { 959 if ( eventR ) {
960 eventRSync = (Event*) eventR->clone(); 960 eventRSync = (Event*) eventR->clone();
961 remote->deleteEvent(eventR ); 961 remote->deleteEvent(eventR );
962 962
963 } else { 963 } else {
964 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { 964 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) {
965 eventRSync = (Event*)eventLSync->clone(); 965 eventRSync = (Event*)eventLSync->clone();
966 } else { 966 } else {
967 fullDateRange = true; 967 fullDateRange = true;
968 eventRSync = new Event(); 968 eventRSync = new Event();
969 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); 969 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event"));
970 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); 970 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName );
971 eventRSync->setDtStart( mLastCalendarSync ); 971 eventRSync->setDtStart( mLastCalendarSync );
972 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 972 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
973 eventRSync->setCategories( i18n("SyncEvent") ); 973 eventRSync->setCategories( i18n("SyncEvent") );
974 } 974 }
975 } 975 }
976 if ( eventLSync->dtStart() == mLastCalendarSync ) 976 if ( eventLSync->dtStart() == mLastCalendarSync )
977 fullDateRange = true; 977 fullDateRange = true;
978 978
979 if ( ! fullDateRange ) { 979 if ( ! fullDateRange ) {
980 if ( eventLSync->dtStart() != eventRSync->dtStart() ) { 980 if ( eventLSync->dtStart() != eventRSync->dtStart() ) {
981 981
982 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); 982 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() );
983 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); 983 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec());
984 fullDateRange = true; 984 fullDateRange = true;
985 } 985 }
986 } 986 }
987 if ( mSyncManager->syncWithDesktop() ) { 987 if ( mSyncManager->syncWithDesktop() ) {
988 fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); 988 fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync );
989 } 989 }
990 if ( fullDateRange ) 990 if ( fullDateRange )
991 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); 991 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
992 else 992 else
993 mLastCalendarSync = eventLSync->dtStart(); 993 mLastCalendarSync = eventLSync->dtStart();
994 // for resyncing if own file has changed 994 // for resyncing if own file has changed
995 if ( mCurrentSyncDevice == "deleteaftersync" ) { 995 if ( mCurrentSyncDevice == "deleteaftersync" ) {
996 mLastCalendarSync = loadedFileVersion; 996 mLastCalendarSync = loadedFileVersion;
997 //qDebug("setting mLastCalendarSync "); 997 //qDebug("setting mLastCalendarSync ");
998 } 998 }
999 //qDebug("*************************** "); 999 //qDebug("*************************** ");
1000 qDebug("mLastCalendarSync %s full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); 1000 qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange);
1001 QPtrList<Incidence> er = remote->rawIncidences(); 1001 QPtrList<Incidence> er = remote->rawIncidences();
1002 Incidence* inR = er.first(); 1002 Incidence* inR = er.first();
1003 Incidence* inL; 1003 Incidence* inL;
1004 QProgressBar bar( er.count(),0 ); 1004 QProgressBar bar( er.count(),0 );
1005 bar.setCaption (i18n("Syncing - close to abort!") ); 1005 bar.setCaption (i18n("Syncing - close to abort!") );
1006 1006
1007 // ************** setting up filter ************* 1007 // ************** setting up filter *************
1008 CalFilter *filterIN = 0; 1008 CalFilter *filterIN = 0;
1009 CalFilter *filterOUT = 0; 1009 CalFilter *filterOUT = 0;
1010 CalFilter *filter = mFilters.first(); 1010 CalFilter *filter = mFilters.first();
1011 while(filter) { 1011 while(filter) {
1012 if ( filter->name() == mSyncManager->mFilterInCal ) 1012 if ( filter->name() == mSyncManager->mFilterInCal )
1013 filterIN = filter; 1013 filterIN = filter;
1014 if ( filter->name() == mSyncManager->mFilterOutCal ) 1014 if ( filter->name() == mSyncManager->mFilterOutCal )
1015 filterOUT = filter; 1015 filterOUT = filter;
1016 filter = mFilters.next(); 1016 filter = mFilters.next();
1017 } 1017 }
1018 int w = 300; 1018 int w = 300;
1019 if ( QApplication::desktop()->width() < 320 ) 1019 if ( QApplication::desktop()->width() < 320 )
1020 w = 220; 1020 w = 220;
1021 int h = bar.sizeHint().height() ; 1021 int h = bar.sizeHint().height() ;
1022 int dw = QApplication::desktop()->width(); 1022 int dw = QApplication::desktop()->width();
1023 int dh = QApplication::desktop()->height(); 1023 int dh = QApplication::desktop()->height();
1024 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1024 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1025 bar.show(); 1025 bar.show();
1026 int modulo = (er.count()/10)+1; 1026 int modulo = (er.count()/10)+1;
1027 int incCounter = 0; 1027 int incCounter = 0;
1028 while ( inR ) { 1028 while ( inR ) {
1029 if ( ! bar.isVisible() ) 1029 if ( ! bar.isVisible() )
1030 return false; 1030 return false;
1031 if ( incCounter % modulo == 0 ) 1031 if ( incCounter % modulo == 0 )
1032 bar.setProgress( incCounter ); 1032 bar.setProgress( incCounter );
@@ -1195,83 +1195,84 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1195 if ( inR->type() == "Todo" ) { 1195 if ( inR->type() == "Todo" ) {
1196 Todo * t = (Todo*)inR; 1196 Todo * t = (Todo*)inR;
1197 if ( t->hasDueDate() ) 1197 if ( t->hasDueDate() )
1198 dt = t->dtDue(); 1198 dt = t->dtDue();
1199 else 1199 else
1200 dt = cur.addSecs( 62 ); 1200 dt = cur.addSecs( 62 );
1201 } 1201 }
1202 else if (inR->type() == "Event" ) { 1202 else if (inR->type() == "Event" ) {
1203 bool ok; 1203 bool ok;
1204 dt = inR->getNextOccurence( cur, &ok ); 1204 dt = inR->getNextOccurence( cur, &ok );
1205 if ( !ok ) 1205 if ( !ok )
1206 dt = cur.addSecs( -62 ); 1206 dt = cur.addSecs( -62 );
1207 } 1207 }
1208 else 1208 else
1209 dt = inR->dtStart(); 1209 dt = inR->dtStart();
1210 if ( dt < cur || dt > end ) { 1210 if ( dt < cur || dt > end ) {
1211 remote->deleteIncidence( inR ); 1211 remote->deleteIncidence( inR );
1212 ++delFut; 1212 ++delFut;
1213 } 1213 }
1214 inR = er.next(); 1214 inR = er.next();
1215 } 1215 }
1216 } 1216 }
1217 bar.hide(); 1217 bar.hide();
1218 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1218 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1219 eventLSync->setReadOnly( false ); 1219 eventLSync->setReadOnly( false );
1220 eventLSync->setDtStart( mLastCalendarSync ); 1220 eventLSync->setDtStart( mLastCalendarSync );
1221 eventRSync->setDtStart( mLastCalendarSync ); 1221 eventRSync->setDtStart( mLastCalendarSync );
1222 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1222 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1223 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1223 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1224 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1224 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1225 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1225 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1226 eventLSync->setReadOnly( true ); 1226 eventLSync->setReadOnly( true );
1227 qDebug("********** %d %d ", mGlobalSyncMode == SYNC_MODE_NORMAL, mSyncManager->syncWithDesktop() ); 1227 qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL );
1228 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... 1228 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal...
1229 remote->addEvent( eventRSync ); 1229 remote->addEvent( eventRSync );
1230 else 1230 else
1231 delete eventRSync; 1231 delete eventRSync;
1232 qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() );
1232 QString mes; 1233 QString mes;
1233 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT ); 1234 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT );
1234 QString delmess; 1235 QString delmess;
1235 if ( delFut ) { 1236 if ( delFut ) {
1236 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut); 1237 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut);
1237 mes += delmess; 1238 mes += delmess;
1238 } 1239 }
1239 mes = i18n("Local calendar changed!\n") +mes; 1240 mes = i18n("Local calendar changed!\n") +mes;
1240 mCalendar->checkAlarmForIncidence( 0, true ); 1241 mCalendar->checkAlarmForIncidence( 0, true );
1241 qDebug( mes ); 1242 qDebug( mes );
1242 if ( mSyncManager->mShowSyncSummary ) { 1243 if ( mSyncManager->mShowSyncSummary ) {
1243 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, 1244 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
1244 i18n("KO/Pi Synchronization"),i18n("Write back"))) { 1245 i18n("KO/Pi Synchronization"),i18n("Write back"))) {
1245 qDebug("cancelled "); 1246 qDebug("KO: WB cancelled ");
1246 return false; 1247 return false;
1247 } 1248 }
1248 } 1249 }
1249 return syncOK; 1250 return syncOK;
1250} 1251}
1251 1252
1252void CalendarView::setSyncDevice( QString s ) 1253void CalendarView::setSyncDevice( QString s )
1253{ 1254{
1254 mCurrentSyncDevice= s; 1255 mCurrentSyncDevice= s;
1255} 1256}
1256void CalendarView::setSyncName( QString s ) 1257void CalendarView::setSyncName( QString s )
1257{ 1258{
1258 mCurrentSyncName= s; 1259 mCurrentSyncName= s;
1259} 1260}
1260bool CalendarView::syncCalendar(QString filename, int mode) 1261bool CalendarView::syncCalendar(QString filename, int mode)
1261{ 1262{
1262 //qDebug("syncCalendar %s ", filename.latin1()); 1263 //qDebug("syncCalendar %s ", filename.latin1());
1263 mGlobalSyncMode = SYNC_MODE_NORMAL; 1264 mGlobalSyncMode = SYNC_MODE_NORMAL;
1264 CalendarLocal* calendar = new CalendarLocal(); 1265 CalendarLocal* calendar = new CalendarLocal();
1265 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1266 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1266 FileStorage* storage = new FileStorage( calendar ); 1267 FileStorage* storage = new FileStorage( calendar );
1267 bool syncOK = false; 1268 bool syncOK = false;
1268 storage->setFileName( filename ); 1269 storage->setFileName( filename );
1269 // qDebug("loading ... "); 1270 // qDebug("loading ... ");
1270 if ( storage->load() ) { 1271 if ( storage->load() ) {
1271 getEventViewerDialog()->setSyncMode( true ); 1272 getEventViewerDialog()->setSyncMode( true );
1272 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 1273 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
1273 getEventViewerDialog()->setSyncMode( false ); 1274 getEventViewerDialog()->setSyncMode( false );
1274 if ( syncOK ) { 1275 if ( syncOK ) {
1275 if ( mSyncManager->mWriteBackFile ) 1276 if ( mSyncManager->mWriteBackFile )
1276 { 1277 {
1277 storage->setSaveFormat( new ICalFormat() ); 1278 storage->setSaveFormat( new ICalFormat() );
@@ -1411,72 +1412,72 @@ bool CalendarView::importBday()
1411 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1412 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1412 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) 1413 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) )
1413 ++addCount; 1414 ++addCount;
1414 } 1415 }
1415 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); 1416 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d");
1416 if ( anni.isValid() ){ 1417 if ( anni.isValid() ){
1417 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1418 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1418 if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) 1419 if ( addAnniversary( anni, (*it).assembledName(), a, false ) )
1419 ++addCount; 1420 ++addCount;
1420 } 1421 }
1421 } 1422 }
1422 updateView(); 1423 updateView();
1423 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1424 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1424#else //DESKTOP_VERSION 1425#else //DESKTOP_VERSION
1425 1426
1426 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); 1427 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
1427 // the result should now arrive through method insertBirthdays 1428 // the result should now arrive through method insertBirthdays
1428 1429
1429#endif //DESKTOP_VERSION 1430#endif //DESKTOP_VERSION
1430 1431
1431#endif //KORG_NOKABC 1432#endif //KORG_NOKABC
1432 1433
1433 1434
1434 return true; 1435 return true;
1435} 1436}
1436 1437
1437// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI 1438// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI
1438void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, 1439void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList,
1439 const QStringList& anniversaryList, const QStringList& realNameList, 1440 const QStringList& anniversaryList, const QStringList& realNameList,
1440 const QStringList& emailList, const QStringList& assembledNameList, 1441 const QStringList& emailList, const QStringList& assembledNameList,
1441 const QStringList& uidList) 1442 const QStringList& uidList)
1442{ 1443{
1443 qDebug("CalendarView::insertBirthdays"); 1444 //qDebug("KO::CalendarView::insertBirthdays");
1444 if (uid == this->name()) 1445 if (uid == this->name())
1445 { 1446 {
1446 int count = birthdayList.count(); 1447 int count = birthdayList.count();
1447 int addCount = 0; 1448 int addCount = 0;
1448 KCal::Attendee* a = 0; 1449 KCal::Attendee* a = 0;
1449 1450
1450 qDebug("CalView 1 %i", count); 1451 //qDebug("CalView 1 %i", count);
1451 1452
1452 QProgressBar bar(count,0 ); 1453 QProgressBar bar(count,0 );
1453 int w = 300; 1454 int w = 300;
1454 if ( QApplication::desktop()->width() < 320 ) 1455 if ( QApplication::desktop()->width() < 320 )
1455 w = 220; 1456 w = 220;
1456 int h = bar.sizeHint().height() ; 1457 int h = bar.sizeHint().height() ;
1457 int dw = QApplication::desktop()->width(); 1458 int dw = QApplication::desktop()->width();
1458 int dh = QApplication::desktop()->height(); 1459 int dh = QApplication::desktop()->height();
1459 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1460 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1460 bar.show(); 1461 bar.show();
1461 bar.setCaption (i18n("inserting birthdays - close to abort!") ); 1462 bar.setCaption (i18n("inserting birthdays - close to abort!") );
1462 qApp->processEvents(); 1463 qApp->processEvents();
1463 1464
1464 QDate birthday; 1465 QDate birthday;
1465 QDate anniversary; 1466 QDate anniversary;
1466 QString realName; 1467 QString realName;
1467 QString email; 1468 QString email;
1468 QString assembledName; 1469 QString assembledName;
1469 QString uid; 1470 QString uid;
1470 bool ok = true; 1471 bool ok = true;
1471 for ( int i = 0; i < count; i++) 1472 for ( int i = 0; i < count; i++)
1472 { 1473 {
1473 if ( ! bar.isVisible() ) 1474 if ( ! bar.isVisible() )
1474 return; 1475 return;
1475 bar.setProgress( i ); 1476 bar.setProgress( i );
1476 qApp->processEvents(); 1477 qApp->processEvents();
1477 1478
1478 birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); 1479 birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok);
1479 if (!ok) { 1480 if (!ok) {
1480 ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); 1481 ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1());
1481 } 1482 }
1482 1483
@@ -2480,80 +2481,80 @@ void CalendarView::moveIncidence(Incidence * inc )
2480 da = QDate::currentDate(); 2481 da = QDate::currentDate();
2481 } else { 2482 } else {
2482 da = mMoveIncidence->dtStart().date(); 2483 da = mMoveIncidence->dtStart().date();
2483 } 2484 }
2484 //PENDING set date for recurring incidence to date of recurrence 2485 //PENDING set date for recurring incidence to date of recurrence
2485 //mMoveIncidenceOldDate; 2486 //mMoveIncidenceOldDate;
2486 mDatePicker->setDate( da ); 2487 mDatePicker->setDate( da );
2487} 2488}
2488void CalendarView::showDatePicker( ) 2489void CalendarView::showDatePicker( )
2489{ 2490{
2490 //qDebug("CalendarView::showDatePicker( ) "); 2491 //qDebug("CalendarView::showDatePicker( ) ");
2491 if ( mDateFrame->isVisible() ) 2492 if ( mDateFrame->isVisible() )
2492 mDateFrame->hide(); 2493 mDateFrame->hide();
2493 else { 2494 else {
2494 int w =mDatePicker->sizeHint().width() ; 2495 int w =mDatePicker->sizeHint().width() ;
2495 int h = mDatePicker->sizeHint().height() ; 2496 int h = mDatePicker->sizeHint().height() ;
2496 int dw = QApplication::desktop()->width(); 2497 int dw = QApplication::desktop()->width();
2497 int dh = QApplication::desktop()->height(); 2498 int dh = QApplication::desktop()->height();
2498 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2499 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2499 mDateFrame->show(); 2500 mDateFrame->show();
2500 } 2501 }
2501 mDatePickerMode = 1; 2502 mDatePickerMode = 1;
2502 mDatePicker->setDate( mNavigator->selectedDates().first() ); 2503 mDatePicker->setDate( mNavigator->selectedDates().first() );
2503} 2504}
2504 2505
2505void CalendarView::showEventEditor() 2506void CalendarView::showEventEditor()
2506{ 2507{
2507#ifdef DESKTOP_VERSION 2508#ifdef DESKTOP_VERSION
2508 mEventEditor->show(); 2509 mEventEditor->show();
2509#else 2510#else
2510 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { 2511 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) {
2511 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 2512 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
2512 qDebug("CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); 2513 qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() );
2513 delete mEventEditor; 2514 delete mEventEditor;
2514 mEventEditor = mDialogManager->getEventEditor(); 2515 mEventEditor = mDialogManager->getEventEditor();
2515 } 2516 }
2516 mEventEditor->showMaximized(); 2517 mEventEditor->showMaximized();
2517 topLevelWidget()->setCaption( i18n("") ); 2518 topLevelWidget()->setCaption( i18n("") );
2518#endif 2519#endif
2519} 2520}
2520void CalendarView::showTodoEditor() 2521void CalendarView::showTodoEditor()
2521{ 2522{
2522#ifdef DESKTOP_VERSION 2523#ifdef DESKTOP_VERSION
2523 mTodoEditor->show(); 2524 mTodoEditor->show();
2524#else 2525#else
2525 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { 2526 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) {
2526 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 2527 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
2527 qDebug("CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); 2528 qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() );
2528 delete mTodoEditor; 2529 delete mTodoEditor;
2529 mTodoEditor = mDialogManager->getTodoEditor(); 2530 mTodoEditor = mDialogManager->getTodoEditor();
2530 } 2531 }
2531 mTodoEditor->showMaximized(); 2532 mTodoEditor->showMaximized();
2532 topLevelWidget()->setCaption( i18n("") ); 2533 topLevelWidget()->setCaption( i18n("") );
2533#endif 2534#endif
2534} 2535}
2535 2536
2536void CalendarView::cloneIncidence() 2537void CalendarView::cloneIncidence()
2537{ 2538{
2538 Incidence *incidence = currentSelection(); 2539 Incidence *incidence = currentSelection();
2539 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2540 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2540 if ( incidence ) { 2541 if ( incidence ) {
2541 cloneIncidence(incidence); 2542 cloneIncidence(incidence);
2542 } 2543 }
2543} 2544}
2544void CalendarView::moveIncidence() 2545void CalendarView::moveIncidence()
2545{ 2546{
2546 Incidence *incidence = currentSelection(); 2547 Incidence *incidence = currentSelection();
2547 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2548 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2548 if ( incidence ) { 2549 if ( incidence ) {
2549 moveIncidence(incidence); 2550 moveIncidence(incidence);
2550 } 2551 }
2551} 2552}
2552void CalendarView::beamIncidence() 2553void CalendarView::beamIncidence()
2553{ 2554{
2554 Incidence *incidence = currentSelection(); 2555 Incidence *incidence = currentSelection();
2555 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2556 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2556 if ( incidence ) { 2557 if ( incidence ) {
2557 beamIncidence(incidence); 2558 beamIncidence(incidence);
2558 } 2559 }
2559} 2560}
@@ -3828,78 +3829,78 @@ void CalendarView::purgeCompleted()
3828 } 3829 }
3829 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 3830 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
3830 removeCompletedSubTodos( aTodo ); 3831 removeCompletedSubTodos( aTodo );
3831 } 3832 }
3832 3833
3833 updateView(); 3834 updateView();
3834 } 3835 }
3835} 3836}
3836 3837
3837void CalendarView::slotCalendarChanged() 3838void CalendarView::slotCalendarChanged()
3838{ 3839{
3839 ; 3840 ;
3840} 3841}
3841 3842
3842NavigatorBar *CalendarView::navigatorBar() 3843NavigatorBar *CalendarView::navigatorBar()
3843{ 3844{
3844 return mNavigatorBar; 3845 return mNavigatorBar;
3845} 3846}
3846 3847
3847 3848
3848 3849
3849void CalendarView::keyPressEvent ( QKeyEvent *e) 3850void CalendarView::keyPressEvent ( QKeyEvent *e)
3850{ 3851{
3851 //qDebug(" alendarView::keyPressEvent "); 3852 //qDebug(" alendarView::keyPressEvent ");
3852 e->ignore(); 3853 e->ignore();
3853} 3854}
3854 3855
3855 3856
3856bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) 3857bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
3857{ 3858{
3858 // mSyncManager = manager; 3859 // mSyncManager = manager;
3859 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { 3860 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
3860 qDebug("SyncKDE request detected!"); 3861 qDebug("KO: SyncKDE request detected!");
3861 } 3862 }
3862 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 3863 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
3863 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 3864 mCurrentSyncName = mSyncManager->getCurrentSyncName();
3864 return syncCalendar( filename, mode ); 3865 return syncCalendar( filename, mode );
3865} 3866}
3866bool CalendarView::syncExternal(KSyncManager* manager, QString resource) 3867bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
3867{ 3868{
3868 //mSyncManager = manager; 3869 //mSyncManager = manager;
3869 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 3870 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
3870 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 3871 mCurrentSyncName = mSyncManager->getCurrentSyncName();
3871 if ( resource == "sharp" ) 3872 if ( resource == "sharp" )
3872 syncExternal( 0 ); 3873 syncExternal( 0 );
3873 if ( resource == "phone" ) 3874 if ( resource == "phone" )
3874 syncExternal( 1 ); 3875 syncExternal( 1 );
3875 // pending setmodified 3876 // pending setmodified
3876 return true; 3877 return true;
3877} 3878}
3878void CalendarView::setSyncManager(KSyncManager* manager) 3879void CalendarView::setSyncManager(KSyncManager* manager)
3879{ 3880{
3880 mSyncManager = manager; 3881 mSyncManager = manager;
3881} 3882}
3882 3883
3883void CalendarView::removeSyncInfo( QString syncProfile) 3884void CalendarView::removeSyncInfo( QString syncProfile)
3884{ 3885{
3885 qDebug("removeSyncInfo for profile %s ", syncProfile.latin1()); 3886 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1());
3886 mCalendar->removeSyncInfo( syncProfile ); 3887 mCalendar->removeSyncInfo( syncProfile );
3887 3888
3888} 3889}
3889 3890
3890void CalendarView::undo_delete() 3891void CalendarView::undo_delete()
3891{ 3892{
3892 //qDebug("undo_delete() "); 3893 //qDebug("undo_delete() ");
3893 Incidence* undo = mCalendar->undoIncidence(); 3894 Incidence* undo = mCalendar->undoIncidence();
3894 if ( !undo ) { 3895 if ( !undo ) {
3895 KMessageBox::sorry(this,i18n("There is nothing to undo!"), 3896 KMessageBox::sorry(this,i18n("There is nothing to undo!"),
3896 i18n("KO/Pi")); 3897 i18n("KO/Pi"));
3897 return; 3898 return;
3898 } 3899 }
3899 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + 3900 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) +
3900 i18n("\nAre you sure you want\nto restore this?"), 3901 i18n("\nAre you sure you want\nto restore this?"),
3901 i18n("KO/Pi Confirmation"),i18n("Restore"))) { 3902 i18n("KO/Pi Confirmation"),i18n("Restore"))) {
3902 mCalendar->undoDeleteIncidence(); 3903 mCalendar->undoDeleteIncidence();
3903 updateView(); 3904 updateView();
3904 } 3905 }
3905} 3906}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 26ea1e2..877b6f2 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -578,65 +578,66 @@ void MainWindow::initActions()
578 actionMenu->insertSeparator(); 578 actionMenu->insertSeparator();
579 579
580 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 580 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
581 action->addTo( actionMenu ); 581 action->addTo( actionMenu );
582 connect( action, SIGNAL( activated() ), 582 connect( action, SIGNAL( activated() ),
583 mView, SLOT( undo_delete() ) ); 583 mView, SLOT( undo_delete() ) );
584 actionMenu->insertSeparator(); 584 actionMenu->insertSeparator();
585 585
586 icon = loadPixmap( pathString + "newevent" ); 586 icon = loadPixmap( pathString + "newevent" );
587 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 587 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
588 configureToolBarMenu->insertSeparator(); 588 configureToolBarMenu->insertSeparator();
589 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 589 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
590 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 590 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
591 ne_action->addTo( actionMenu ); 591 ne_action->addTo( actionMenu );
592 connect( ne_action, SIGNAL( activated() ), 592 connect( ne_action, SIGNAL( activated() ),
593 mView, SLOT( newEvent() ) ); 593 mView, SLOT( newEvent() ) );
594 icon = loadPixmap( pathString + "newtodo" ); 594 icon = loadPixmap( pathString + "newtodo" );
595 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 595 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
596 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 596 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
597 nt_action->addTo( actionMenu ); 597 nt_action->addTo( actionMenu );
598 connect( nt_action, SIGNAL( activated() ), 598 connect( nt_action, SIGNAL( activated() ),
599 mView, SLOT( newTodo() ) ); 599 mView, SLOT( newTodo() ) );
600 icon = loadPixmap( pathString + "navi" ); 600 icon = loadPixmap( pathString + "navi" );
601 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 601 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
602 action->addTo( viewMenu ); 602 action->addTo( viewMenu );
603 connect( action, SIGNAL( activated() ), 603 connect( action, SIGNAL( activated() ),
604 mView, SLOT( toggleDateNavigatorWidget() ) ); 604 mView, SLOT( toggleDateNavigatorWidget() ) );
605 icon = loadPixmap( pathString + "filter" ); 605 icon = loadPixmap( pathString + "filter" );
606 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 606 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
607 action->addTo( viewMenu ); 607 action->addTo( viewMenu );
608 connect( action, SIGNAL( activated() ), 608 connect( action, SIGNAL( activated() ),
609 mView, SLOT( toggleFilter() ) ); 609 mView, SLOT( toggleFilter() ) );
610 action = new QAction( i18n("Toggle Allday"), i18n("Toggle Allday"), 0, this ); 610 icon = loadPixmap( pathString + "allday" );
611 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
611 action->addTo( viewMenu ); 612 action->addTo( viewMenu );
612 connect( action, SIGNAL( activated() ), 613 connect( action, SIGNAL( activated() ),
613 mView, SLOT( toggleAllDaySize() ) ); 614 mView, SLOT( toggleAllDaySize() ) );
614 615
615 viewMenu->insertSeparator(); 616 viewMenu->insertSeparator();
616 icon = loadPixmap( pathString + "picker" ); 617 icon = loadPixmap( pathString + "picker" );
617 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 618 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
618 action->addTo( viewMenu ); 619 action->addTo( viewMenu );
619 connect( action, SIGNAL( activated() ), 620 connect( action, SIGNAL( activated() ),
620 mView, SLOT( showDatePicker() ) ); 621 mView, SLOT( showDatePicker() ) );
621 action->addTo( iconToolBar ); 622 action->addTo( iconToolBar );
622 viewMenu->insertSeparator(); 623 viewMenu->insertSeparator();
623 icon = loadPixmap( pathString + "list" ); 624 icon = loadPixmap( pathString + "list" );
624 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 625 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
625 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 626 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
626 showlist_action->addTo( viewMenu ); 627 showlist_action->addTo( viewMenu );
627 connect( showlist_action, SIGNAL( activated() ), 628 connect( showlist_action, SIGNAL( activated() ),
628 mView->viewManager(), SLOT( showListView() ) ); 629 mView->viewManager(), SLOT( showListView() ) );
629 630
630 631
631 icon = loadPixmap( pathString + "day" ); 632 icon = loadPixmap( pathString + "day" );
632 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 633 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
633 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 634 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
634 day1_action->addTo( viewMenu ); 635 day1_action->addTo( viewMenu );
635 // action->addTo( toolBar ); 636 // action->addTo( toolBar );
636 connect( day1_action, SIGNAL( activated() ), 637 connect( day1_action, SIGNAL( activated() ),
637 mView->viewManager(), SLOT( showDayView() ) ); 638 mView->viewManager(), SLOT( showDayView() ) );
638 639
639 icon = loadPixmap( pathString + "workweek" ); 640 icon = loadPixmap( pathString + "workweek" );
640 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 641 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
641 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 642 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
642 day5_action->addTo( viewMenu ); 643 day5_action->addTo( viewMenu );