author | zautrix <zautrix> | 2005-11-25 20:49:16 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-11-25 20:49:16 (UTC) |
commit | 2468bddcb380d8621d5bb49b69b3492d90562d93 (patch) (unidiff) | |
tree | c310f4fff5e476087e8406614e57a7f258f1b14f /korganizer | |
parent | 7a439999b9fa2bd7ad76e195cdf95bf5211952cb (diff) | |
download | kdepimpi-2468bddcb380d8621d5bb49b69b3492d90562d93.zip kdepimpi-2468bddcb380d8621d5bb49b69b3492d90562d93.tar.gz kdepimpi-2468bddcb380d8621d5bb49b69b3492d90562d93.tar.bz2 |
sync
-rw-r--r-- | korganizer/calendarview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 307027a..e45240a 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1531,257 +1531,257 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b | |||
1531 | return 2; | 1531 | return 2; |
1532 | break; | 1532 | break; |
1533 | 1533 | ||
1534 | default: | 1534 | default: |
1535 | // SYNC_PREF_TAKE_BOTH not implemented | 1535 | // SYNC_PREF_TAKE_BOTH not implemented |
1536 | break; | 1536 | break; |
1537 | } | 1537 | } |
1538 | return 0; | 1538 | return 0; |
1539 | } | 1539 | } |
1540 | Event* CalendarView::getLastSyncEvent() | 1540 | Event* CalendarView::getLastSyncEvent() |
1541 | { | 1541 | { |
1542 | Event* lse; | 1542 | Event* lse; |
1543 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 1543 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
1544 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); | 1544 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); |
1545 | if (!lse) { | 1545 | if (!lse) { |
1546 | lse = new Event(); | 1546 | lse = new Event(); |
1547 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); | 1547 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); |
1548 | QString sum = ""; | 1548 | QString sum = ""; |
1549 | if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) | 1549 | if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) |
1550 | sum = "E: "; | 1550 | sum = "E: "; |
1551 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); | 1551 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); |
1552 | lse->setDtStart( mLastCalendarSync ); | 1552 | lse->setDtStart( mLastCalendarSync ); |
1553 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 1553 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
1554 | lse->setCategories( i18n("SyncEvent") ); | 1554 | lse->setCategories( i18n("SyncEvent") ); |
1555 | lse->setReadOnly( true ); | 1555 | lse->setReadOnly( true ); |
1556 | lse->setCalID( 1 ); | 1556 | lse->setCalID( 1 ); |
1557 | mCalendar->addEvent( lse ); | 1557 | mCalendar->addEvent( lse ); |
1558 | } | 1558 | } |
1559 | 1559 | ||
1560 | return lse; | 1560 | return lse; |
1561 | 1561 | ||
1562 | } | 1562 | } |
1563 | 1563 | ||
1564 | // we check, if the to delete event has a id for a profile | 1564 | // we check, if the to delete event has a id for a profile |
1565 | // if yes, we set this id in the profile to delete | 1565 | // if yes, we set this id in the profile to delete |
1566 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) | 1566 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) |
1567 | { | 1567 | { |
1568 | if ( lastSync.count() == 0 ) { | 1568 | if ( lastSync.count() == 0 ) { |
1569 | //qDebug(" lastSync.count() == 0"); | 1569 | //qDebug(" lastSync.count() == 0"); |
1570 | return; | 1570 | return; |
1571 | } | 1571 | } |
1572 | if ( toDelete->typeID() == journalID ) | 1572 | if ( toDelete->typeID() == journalID ) |
1573 | return; | 1573 | return; |
1574 | 1574 | ||
1575 | Event* eve = lastSync.first(); | 1575 | Event* eve = lastSync.first(); |
1576 | 1576 | ||
1577 | while ( eve ) { | 1577 | while ( eve ) { |
1578 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name | 1578 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name |
1579 | if ( !id.isEmpty() ) { | 1579 | if ( !id.isEmpty() ) { |
1580 | QString des = eve->description(); | 1580 | QString des = eve->description(); |
1581 | QString pref = "e"; | 1581 | QString pref = "e"; |
1582 | if ( toDelete->typeID() == todoID ) | 1582 | if ( toDelete->typeID() == todoID ) |
1583 | pref = "t"; | 1583 | pref = "t"; |
1584 | des += pref+ id + ","; | 1584 | des += pref+ id + ","; |
1585 | eve->setReadOnly( false ); | 1585 | eve->setReadOnly( false ); |
1586 | eve->setDescription( des ); | 1586 | eve->setDescription( des ); |
1587 | //qDebug("setdes %s ", des.latin1()); | 1587 | //qDebug("setdes %s ", des.latin1()); |
1588 | eve->setReadOnly( true ); | 1588 | eve->setReadOnly( true ); |
1589 | } | 1589 | } |
1590 | eve = lastSync.next(); | 1590 | eve = lastSync.next(); |
1591 | } | 1591 | } |
1592 | 1592 | ||
1593 | } | 1593 | } |
1594 | void CalendarView::checkExternalId( Incidence * inc ) | 1594 | void CalendarView::checkExternalId( Incidence * inc ) |
1595 | { | 1595 | { |
1596 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; | 1596 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; |
1597 | checkExternSyncEvent( lastSync, inc ); | 1597 | checkExternSyncEvent( lastSync, inc ); |
1598 | 1598 | ||
1599 | } | 1599 | } |
1600 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) | 1600 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) |
1601 | { | 1601 | { |
1602 | bool syncOK = true; | 1602 | bool syncOK = true; |
1603 | int addedEvent = 0; | 1603 | int addedEvent = 0; |
1604 | int addedEventR = 0; | 1604 | int addedEventR = 0; |
1605 | int deletedEventR = 0; | 1605 | int deletedEventR = 0; |
1606 | int deletedEventL = 0; | 1606 | int deletedEventL = 0; |
1607 | int changedLocal = 0; | 1607 | int changedLocal = 0; |
1608 | int changedRemote = 0; | 1608 | int changedRemote = 0; |
1609 | int filteredIN = 0; | 1609 | int filteredIN = 0; |
1610 | int filteredOUT = 0; | 1610 | int filteredOUT = 0; |
1611 | //QPtrList<Event> el = local->rawEvents(); | 1611 | //QPtrList<Event> el = local->rawEvents(); |
1612 | Event* eventR; | 1612 | Event* eventR; |
1613 | QString uid; | 1613 | QString uid; |
1614 | int take; | 1614 | int take; |
1615 | Event* eventRSync; | 1615 | Event* eventRSync; |
1616 | Event* eventLSync; | 1616 | Event* eventLSync; |
1617 | clearAllViews(); | 1617 | clearAllViews(); |
1618 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); | 1618 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); |
1619 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); | 1619 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); |
1620 | bool fullDateRange = false; | 1620 | bool fullDateRange = false; |
1621 | local->resetTempSyncStat(); | 1621 | local->resetTempSyncStat(); |
1622 | mLastCalendarSync = QDateTime::currentDateTime(); | 1622 | mLastCalendarSync = QDateTime::currentDateTime(); |
1623 | if ( mSyncManager->syncWithDesktop() ) { | 1623 | if ( mSyncManager->syncWithDesktop() ) { |
1624 | remote->resetPilotStat(1); | 1624 | remote->resetPilotStat(1); |
1625 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { | 1625 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { |
1626 | mLastCalendarSync = KSyncManager::mRequestedSyncEvent; | 1626 | mLastCalendarSync = KSyncManager::mRequestedSyncEvent; |
1627 | qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); | 1627 | qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); |
1628 | } else { | 1628 | } else { |
1629 | qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); | 1629 | qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); |
1630 | } | 1630 | } |
1631 | } | 1631 | } |
1632 | QDateTime modifiedCalendar = mLastCalendarSync; | 1632 | QDateTime modifiedCalendar = mLastCalendarSync; |
1633 | eventLSync = getLastSyncEvent(); | 1633 | eventLSync = getLastSyncEvent(); |
1634 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); | 1634 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); |
1635 | if ( eventR ) { | 1635 | if ( eventR ) { |
1636 | qDebug("last-syncEvent on remote found "); | 1636 | qDebug("last-syncEvent on remote found "); |
1637 | eventRSync = (Event*) eventR->clone(); | 1637 | eventRSync = (Event*) eventR->clone(); |
1638 | remote->deleteEvent(eventR ); | 1638 | remote->deleteEvent(eventR ); |
1639 | 1639 | ||
1640 | } else { | 1640 | } else { |
1641 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { | 1641 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { |
1642 | eventRSync = (Event*)eventLSync->clone(); | 1642 | eventRSync = (Event*)eventLSync->clone(); |
1643 | } else { | 1643 | } else { |
1644 | fullDateRange = true; | 1644 | fullDateRange = true; |
1645 | eventRSync = new Event(); | 1645 | eventRSync = new Event(); |
1646 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); | 1646 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); |
1647 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); | 1647 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); |
1648 | eventRSync->setDtStart( mLastCalendarSync ); | 1648 | eventRSync->setDtStart( mLastCalendarSync ); |
1649 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 1649 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
1650 | eventRSync->setCategories( i18n("SyncEvent") ); | 1650 | eventRSync->setCategories( i18n("SyncEvent") ); |
1651 | } | 1651 | } |
1652 | } | 1652 | } |
1653 | if ( eventLSync->dtStart() == mLastCalendarSync ) | 1653 | if ( eventLSync->dtStart() == mLastCalendarSync ) |
1654 | fullDateRange = true; | 1654 | fullDateRange = true; |
1655 | 1655 | ||
1656 | if ( ! fullDateRange ) { | 1656 | if ( ! fullDateRange ) { |
1657 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { | 1657 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { |
1658 | 1658 | ||
1659 | qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); | 1659 | qDebug("KO: Sync: Set fulldate to true! Local: %s --- Remote: %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); |
1660 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); | 1660 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); |
1661 | fullDateRange = true; | 1661 | fullDateRange = true; |
1662 | } | 1662 | } |
1663 | } | 1663 | } |
1664 | if ( mSyncManager->syncWithDesktop() ) { | 1664 | if ( mSyncManager->syncWithDesktop() ) { |
1665 | fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); | 1665 | fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); |
1666 | } | 1666 | } |
1667 | if ( fullDateRange ) | 1667 | if ( fullDateRange ) |
1668 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); | 1668 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); |
1669 | else | 1669 | else |
1670 | mLastCalendarSync = eventLSync->dtStart(); | 1670 | mLastCalendarSync = eventLSync->dtStart(); |
1671 | // for resyncing if own file has changed | 1671 | // for resyncing if own file has changed |
1672 | if ( mCurrentSyncDevice == "deleteaftersync" ) { | 1672 | if ( mCurrentSyncDevice == "deleteaftersync" ) { |
1673 | mLastCalendarSync = loadedFileVersion; | 1673 | mLastCalendarSync = loadedFileVersion; |
1674 | //qDebug("setting mLastCalendarSync "); | 1674 | //qDebug("setting mLastCalendarSync "); |
1675 | } | 1675 | } |
1676 | //qDebug("*************************** "); | 1676 | //qDebug("*************************** "); |
1677 | qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); | 1677 | qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); |
1678 | QPtrList<Incidence> er = remote->rawIncidences(); | 1678 | QPtrList<Incidence> er = remote->rawIncidences(); |
1679 | Incidence* inR = er.first(); | 1679 | Incidence* inR = er.first(); |
1680 | Incidence* inL; | 1680 | Incidence* inL; |
1681 | QProgressBar bar( er.count(),0 ); | 1681 | QProgressBar bar( er.count(),0 ); |
1682 | bar.setCaption (i18n("Syncing - close to abort!") ); | 1682 | bar.setCaption (i18n("Syncing - close to abort!") ); |
1683 | 1683 | ||
1684 | // ************** setting up filter ************* | 1684 | // ************** setting up filter ************* |
1685 | CalFilter *filterIN = 0; | 1685 | CalFilter *filterIN = 0; |
1686 | CalFilter *filterOUT = 0; | 1686 | CalFilter *filterOUT = 0; |
1687 | CalFilter *filter = mFilters.first(); | 1687 | CalFilter *filter = mFilters.first(); |
1688 | while(filter) { | 1688 | while(filter) { |
1689 | if ( filter->name() == mSyncManager->mFilterInCal ) | 1689 | if ( filter->name() == mSyncManager->mFilterInCal ) |
1690 | filterIN = filter; | 1690 | filterIN = filter; |
1691 | if ( filter->name() == mSyncManager->mFilterOutCal ) | 1691 | if ( filter->name() == mSyncManager->mFilterOutCal ) |
1692 | filterOUT = filter; | 1692 | filterOUT = filter; |
1693 | filter = mFilters.next(); | 1693 | filter = mFilters.next(); |
1694 | } | 1694 | } |
1695 | int w = 300; | 1695 | int w = 300; |
1696 | if ( QApplication::desktop()->width() < 320 ) | 1696 | if ( QApplication::desktop()->width() < 320 ) |
1697 | w = 220; | 1697 | w = 220; |
1698 | int h = bar.sizeHint().height() ; | 1698 | int h = bar.sizeHint().height() ; |
1699 | int dw = QApplication::desktop()->width(); | 1699 | int dw = QApplication::desktop()->width(); |
1700 | int dh = QApplication::desktop()->height(); | 1700 | int dh = QApplication::desktop()->height(); |
1701 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1701 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1702 | bar.show(); | 1702 | bar.show(); |
1703 | int modulo = (er.count()/10)+1; | 1703 | int modulo = (er.count()/10)+1; |
1704 | int incCounter = 0; | 1704 | int incCounter = 0; |
1705 | while ( inR ) { | 1705 | while ( inR ) { |
1706 | if ( ! bar.isVisible() ) | 1706 | if ( ! bar.isVisible() ) |
1707 | return false; | 1707 | return false; |
1708 | if ( incCounter % modulo == 0 ) | 1708 | if ( incCounter % modulo == 0 ) |
1709 | bar.setProgress( incCounter ); | 1709 | bar.setProgress( incCounter ); |
1710 | ++incCounter; | 1710 | ++incCounter; |
1711 | uid = inR->uid(); | 1711 | uid = inR->uid(); |
1712 | bool skipIncidence = false; | 1712 | bool skipIncidence = false; |
1713 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1713 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1714 | skipIncidence = true; | 1714 | skipIncidence = true; |
1715 | QString idS; | 1715 | QString idS; |
1716 | qApp->processEvents(); | 1716 | qApp->processEvents(); |
1717 | if ( !skipIncidence ) { | 1717 | if ( !skipIncidence ) { |
1718 | inL = local->incidenceForUid( uid , false ); | 1718 | inL = local->incidenceForUid( uid , false ); |
1719 | if ( inL ) { // maybe conflict - same uid in both calendars | 1719 | if ( inL ) { // maybe conflict - same uid in both calendars |
1720 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { | 1720 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { |
1721 | //qDebug("take %d %s ", take, inL->summary().latin1()); | 1721 | //qDebug("take %d %s ", take, inL->summary().latin1()); |
1722 | if ( take == 3 ) | 1722 | if ( take == 3 ) |
1723 | return false; | 1723 | return false; |
1724 | if ( take == 1 ) {// take local ********************** | 1724 | if ( take == 1 ) {// take local ********************** |
1725 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) | 1725 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) |
1726 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1726 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1727 | else | 1727 | else |
1728 | idS = inR->IDStr(); | 1728 | idS = inR->IDStr(); |
1729 | int calID = inR->calID(); | 1729 | int calID = inR->calID(); |
1730 | remote->deleteIncidence( inR ); | 1730 | remote->deleteIncidence( inR ); |
1731 | inR = inL->clone(); | 1731 | inR = inL->clone(); |
1732 | inR->setCalID( calID ); | 1732 | inR->setCalID( calID ); |
1733 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1733 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1734 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) | 1734 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) |
1735 | inR->setIDStr( idS ); | 1735 | inR->setIDStr( idS ); |
1736 | remote->addIncidence( inR ); | 1736 | remote->addIncidence( inR ); |
1737 | if ( mSyncManager->syncWithDesktop() ) | 1737 | if ( mSyncManager->syncWithDesktop() ) |
1738 | inR->setPilotId( 2 ); | 1738 | inR->setPilotId( 2 ); |
1739 | ++changedRemote; | 1739 | ++changedRemote; |
1740 | } else {// take remote ********************** | 1740 | } else {// take remote ********************** |
1741 | if ( !inL->isReadOnly() ) { | 1741 | if ( !inL->isReadOnly() ) { |
1742 | idS = inL->IDStr(); | 1742 | idS = inL->IDStr(); |
1743 | int pid = inL->pilotId(); | 1743 | int pid = inL->pilotId(); |
1744 | int calID = inL->calID(); | 1744 | int calID = inL->calID(); |
1745 | local->deleteIncidence( inL ); | 1745 | local->deleteIncidence( inL ); |
1746 | inL = inR->clone(); | 1746 | inL = inR->clone(); |
1747 | inL->setCalID( calID ); | 1747 | inL->setCalID( calID ); |
1748 | if ( mSyncManager->syncWithDesktop() ) | 1748 | if ( mSyncManager->syncWithDesktop() ) |
1749 | inL->setPilotId( pid ); | 1749 | inL->setPilotId( pid ); |
1750 | inL->setIDStr( idS ); | 1750 | inL->setIDStr( idS ); |
1751 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1751 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1752 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1752 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1753 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1753 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); |
1754 | } | 1754 | } |
1755 | local->addIncidence( inL ); | 1755 | local->addIncidence( inL ); |
1756 | ++changedLocal; | 1756 | ++changedLocal; |
1757 | } | 1757 | } |
1758 | } | 1758 | } |
1759 | } | 1759 | } |
1760 | } else { // no conflict ********** add or delete remote | 1760 | } else { // no conflict ********** add or delete remote |
1761 | if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ | 1761 | if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ |
1762 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1762 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1763 | QString des = eventLSync->description(); | 1763 | QString des = eventLSync->description(); |
1764 | QString pref = "e"; | 1764 | QString pref = "e"; |
1765 | if ( inR->typeID() == todoID ) | 1765 | if ( inR->typeID() == todoID ) |
1766 | pref = "t"; | 1766 | pref = "t"; |
1767 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it | 1767 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
1768 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 1768 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
1769 | //remote->deleteIncidence( inR ); | 1769 | //remote->deleteIncidence( inR ); |
1770 | ++deletedEventR; | 1770 | ++deletedEventR; |
1771 | } else { | 1771 | } else { |
1772 | inR->setLastModified( modifiedCalendar ); | 1772 | inR->setLastModified( modifiedCalendar ); |
1773 | inL = inR->clone(); | 1773 | inL = inR->clone(); |
1774 | inL->setIDStr( ":" ); | 1774 | inL->setIDStr( ":" ); |
1775 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1775 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1776 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1776 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); |
1777 | 1777 | ||
1778 | inL->setCalID( 0 );// add to default cal | 1778 | inL->setCalID( 0 );// add to default cal |
1779 | local->addIncidence( inL ); | 1779 | local->addIncidence( inL ); |
1780 | ++addedEvent; | 1780 | ++addedEvent; |
1781 | 1781 | ||
1782 | } | 1782 | } |
1783 | } else { | 1783 | } else { |
1784 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { | 1784 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { |
1785 | inR->setLastModified( modifiedCalendar ); | 1785 | inR->setLastModified( modifiedCalendar ); |
1786 | inL = inR->clone(); | 1786 | inL = inR->clone(); |
1787 | inL->setIDStr( ":" ); | 1787 | inL->setIDStr( ":" ); |