-rw-r--r-- | korganizer/calendarview.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 940ea91..ccacc52 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1446,30 +1446,34 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1446 | //qDebug("take %d %s ", take, inL->summary().latin1()); | 1446 | //qDebug("take %d %s ", take, inL->summary().latin1()); |
1447 | if ( take == 3 ) | 1447 | if ( take == 3 ) |
1448 | return false; | 1448 | return false; |
1449 | if ( take == 1 ) {// take local ********************** | 1449 | if ( take == 1 ) {// take local ********************** |
1450 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) | 1450 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) |
1451 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1451 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1452 | else | 1452 | else |
1453 | idS = inR->IDStr(); | 1453 | idS = inR->IDStr(); |
1454 | int calID = inR->calID(); | ||
1454 | remote->deleteIncidence( inR ); | 1455 | remote->deleteIncidence( inR ); |
1455 | inR = inL->clone(); | 1456 | inR = inL->clone(); |
1457 | inR->setCalID( calID ); | ||
1456 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1458 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1457 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) | 1459 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) |
1458 | inR->setIDStr( idS ); | 1460 | inR->setIDStr( idS ); |
1459 | remote->addIncidence( inR ); | 1461 | remote->addIncidence( inR ); |
1460 | if ( mSyncManager->syncWithDesktop() ) | 1462 | if ( mSyncManager->syncWithDesktop() ) |
1461 | inR->setPilotId( 2 ); | 1463 | inR->setPilotId( 2 ); |
1462 | ++changedRemote; | 1464 | ++changedRemote; |
1463 | } else {// take remote ********************** | 1465 | } else {// take remote ********************** |
1464 | idS = inL->IDStr(); | 1466 | idS = inL->IDStr(); |
1465 | int pid = inL->pilotId(); | 1467 | int pid = inL->pilotId(); |
1468 | int calID = inL->calID(); | ||
1466 | local->deleteIncidence( inL ); | 1469 | local->deleteIncidence( inL ); |
1467 | inL = inR->clone(); | 1470 | inL = inR->clone(); |
1471 | inL->setCalID( calID ); | ||
1468 | if ( mSyncManager->syncWithDesktop() ) | 1472 | if ( mSyncManager->syncWithDesktop() ) |
1469 | inL->setPilotId( pid ); | 1473 | inL->setPilotId( pid ); |
1470 | inL->setIDStr( idS ); | 1474 | inL->setIDStr( idS ); |
1471 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1475 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1472 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1476 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1473 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1477 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); |
1474 | } | 1478 | } |
1475 | local->addIncidence( inL ); | 1479 | local->addIncidence( inL ); |
@@ -1488,25 +1492,28 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1488 | //remote->deleteIncidence( inR ); | 1492 | //remote->deleteIncidence( inR ); |
1489 | ++deletedEventR; | 1493 | ++deletedEventR; |
1490 | } else { | 1494 | } else { |
1491 | inR->setLastModified( modifiedCalendar ); | 1495 | inR->setLastModified( modifiedCalendar ); |
1492 | inL = inR->clone(); | 1496 | inL = inR->clone(); |
1493 | inL->setIDStr( ":" ); | 1497 | inL->setIDStr( ":" ); |
1494 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1498 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1495 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1499 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); |
1500 | |||
1501 | inL->setCalID( 0 );// add to default cal | ||
1496 | local->addIncidence( inL ); | 1502 | local->addIncidence( inL ); |
1497 | ++addedEvent; | 1503 | ++addedEvent; |
1498 | 1504 | ||
1499 | } | 1505 | } |
1500 | } else { | 1506 | } else { |
1501 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { | 1507 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { |
1502 | inR->setLastModified( modifiedCalendar ); | 1508 | inR->setLastModified( modifiedCalendar ); |
1503 | inL = inR->clone(); | 1509 | inL = inR->clone(); |
1504 | inL->setIDStr( ":" ); | 1510 | inL->setIDStr( ":" ); |
1511 | inL->setCalID( 0 );// add to default cal | ||
1505 | local->addIncidence( inL ); | 1512 | local->addIncidence( inL ); |
1506 | ++addedEvent; | 1513 | ++addedEvent; |
1507 | 1514 | ||
1508 | } else { | 1515 | } else { |
1509 | checkExternSyncEvent(eventRSyncSharp, inR); | 1516 | checkExternSyncEvent(eventRSyncSharp, inR); |
1510 | remote->deleteIncidence( inR ); | 1517 | remote->deleteIncidence( inR ); |
1511 | ++deletedEventR; | 1518 | ++deletedEventR; |
1512 | } | 1519 | } |
@@ -1554,30 +1561,32 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1554 | if ( ! mSyncManager->mWriteBackExistingOnly ) { | 1561 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1555 | inL->removeID(mCurrentSyncDevice ); | 1562 | inL->removeID(mCurrentSyncDevice ); |
1556 | ++addedEventR; | 1563 | ++addedEventR; |
1557 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); | 1564 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); |
1558 | inL->setLastModified( modifiedCalendar ); | 1565 | inL->setLastModified( modifiedCalendar ); |
1559 | inR = inL->clone(); | 1566 | inR = inL->clone(); |
1560 | inR->setIDStr( ":" ); | 1567 | inR->setIDStr( ":" ); |
1561 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1568 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1569 | inR->setCalID( 0 );// add to default cal | ||
1562 | remote->addIncidence( inR ); | 1570 | remote->addIncidence( inR ); |
1563 | } | 1571 | } |
1564 | } | 1572 | } |
1565 | } else { | 1573 | } else { |
1566 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { | 1574 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { |
1567 | checkExternSyncEvent(eventLSyncSharp, inL); | 1575 | checkExternSyncEvent(eventLSyncSharp, inL); |
1568 | local->deleteIncidence( inL ); | 1576 | local->deleteIncidence( inL ); |
1569 | ++deletedEventL; | 1577 | ++deletedEventL; |
1570 | } else { | 1578 | } else { |
1571 | if ( ! mSyncManager->mWriteBackExistingOnly ) { | 1579 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1572 | ++addedEventR; | 1580 | ++addedEventR; |
1573 | inL->setLastModified( modifiedCalendar ); | 1581 | inL->setLastModified( modifiedCalendar ); |
1574 | inR = inL->clone(); | 1582 | inR = inL->clone(); |
1575 | inR->setIDStr( ":" ); | 1583 | inR->setIDStr( ":" ); |
1584 | inR->setCalID( 0 );// add to default cal | ||
1576 | remote->addIncidence( inR ); | 1585 | remote->addIncidence( inR ); |
1577 | } | 1586 | } |
1578 | } | 1587 | } |
1579 | } | 1588 | } |
1580 | } else { | 1589 | } else { |
1581 | ++filteredOUT; | 1590 | ++filteredOUT; |
1582 | } | 1591 | } |
1583 | } | 1592 | } |
@@ -2138,16 +2147,25 @@ bool CalendarView::openCalendar(QString filename, bool merge) | |||
2138 | globalFlagBlockAgenda = 2; | 2147 | globalFlagBlockAgenda = 2; |
2139 | mCalendar->reInitAlarmSettings(); | 2148 | mCalendar->reInitAlarmSettings(); |
2140 | setSyncEventsReadOnly(); | 2149 | setSyncEventsReadOnly(); |
2141 | updateUnmanagedViews(); | 2150 | updateUnmanagedViews(); |
2142 | updateView(); | 2151 | updateView(); |
2143 | } | 2152 | } |
2144 | return false; | 2153 | return false; |
2145 | } | 2154 | } |
2155 | void CalendarView::mergeFile( QString fn ) | ||
2156 | { | ||
2157 | clearAllViews(); | ||
2158 | mCalendar->mergeCalendarFile( fn ); | ||
2159 | mCalendar->reInitAlarmSettings(); | ||
2160 | setSyncEventsReadOnly(); | ||
2161 | updateUnmanagedViews(); | ||
2162 | updateView(); | ||
2163 | } | ||
2146 | void CalendarView::showOpenError() | 2164 | void CalendarView::showOpenError() |
2147 | { | 2165 | { |
2148 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); | 2166 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); |
2149 | } | 2167 | } |
2150 | void CalendarView::setLoadedFileVersion(QDateTime dt) | 2168 | void CalendarView::setLoadedFileVersion(QDateTime dt) |
2151 | { | 2169 | { |
2152 | loadedFileVersion = dt; | 2170 | loadedFileVersion = dt; |
2153 | } | 2171 | } |
@@ -3353,22 +3371,24 @@ void CalendarView::newEvent() | |||
3353 | } else { | 3371 | } else { |
3354 | newEvent(aView->selectionStart(),aView->selectionEnd()); | 3372 | newEvent(aView->selectionStart(),aView->selectionEnd()); |
3355 | } | 3373 | } |
3356 | return; | 3374 | return; |
3357 | } | 3375 | } |
3358 | } | 3376 | } |
3359 | 3377 | ||
3360 | QDate date = mNavigator->selectedDates().first(); | 3378 | QDate date = mNavigator->selectedDates().first(); |
3379 | #if 0 | ||
3361 | QDateTime current = QDateTime::currentDateTime(); | 3380 | QDateTime current = QDateTime::currentDateTime(); |
3362 | if ( date <= current.date() ) { | 3381 | if ( date <= current.date() ) { |
3363 | int hour = current.time().hour() +1; | 3382 | int hour = current.time().hour() +1; |
3364 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), | 3383 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), |
3365 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 3384 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
3366 | } else | 3385 | } else |
3386 | #endif | ||
3367 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), | 3387 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), |
3368 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + | 3388 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + |
3369 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 3389 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
3370 | } | 3390 | } |
3371 | 3391 | ||
3372 | void CalendarView::newEvent(QDateTime fh) | 3392 | void CalendarView::newEvent(QDateTime fh) |
3373 | { | 3393 | { |
3374 | newEvent(fh, | 3394 | newEvent(fh, |