summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-11-26 11:20:22 (UTC)
committer zautrix <zautrix>2005-11-26 11:20:22 (UTC)
commit85bd9f05564e566b296c949ce6e214ebdbf573ac (patch) (unidiff)
treeb00eb9453ea06f2b43fd896a9a4840b7d64af69b /korganizer
parent3cd0013c04172b312ee21e80224a3b7734b4d413 (diff)
downloadkdepimpi-85bd9f05564e566b296c949ce6e214ebdbf573ac.zip
kdepimpi-85bd9f05564e566b296c949ce6e214ebdbf573ac.tar.gz
kdepimpi-85bd9f05564e566b296c949ce6e214ebdbf573ac.tar.bz2
sync
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 538325e..9571f16 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1625,303 +1625,303 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1625 mLastCalendarSync = QDateTime::currentDateTime(); 1625 mLastCalendarSync = QDateTime::currentDateTime();
1626 if ( mSyncManager->syncWithDesktop() ) { 1626 if ( mSyncManager->syncWithDesktop() ) {
1627 remote->resetPilotStat(1); 1627 remote->resetPilotStat(1);
1628 if ( KSyncManager::mRequestedSyncEvent.isValid() ) { 1628 if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
1629 mLastCalendarSync = KSyncManager::mRequestedSyncEvent; 1629 mLastCalendarSync = KSyncManager::mRequestedSyncEvent;
1630 qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); 1630 qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() );
1631 } else { 1631 } else {
1632 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); 1632 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime ");
1633 } 1633 }
1634 } 1634 }
1635 QDateTime modifiedCalendar = mLastCalendarSync; 1635 QDateTime modifiedCalendar = mLastCalendarSync;
1636 eventLSync = getLastSyncEvent(); 1636 eventLSync = getLastSyncEvent();
1637 eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); 1637 eventR = remote->event("last-syncEvent-"+mCurrentSyncName );
1638 if ( eventR ) { 1638 if ( eventR ) {
1639 qDebug("KO: Last-syncEvent on remote found "); 1639 qDebug("KO: Last-syncEvent on remote found ");
1640 eventRSync = (Event*) eventR->clone(); 1640 eventRSync = (Event*) eventR->clone();
1641 remote->deleteEvent(eventR ); 1641 remote->deleteEvent(eventR );
1642 1642
1643 } else { 1643 } else {
1644 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { 1644 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) {
1645 eventRSync = (Event*)eventLSync->clone(); 1645 eventRSync = (Event*)eventLSync->clone();
1646 } else { 1646 } else {
1647 fullDateRange = true; 1647 fullDateRange = true;
1648 eventRSync = new Event(); 1648 eventRSync = new Event();
1649 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); 1649 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event"));
1650 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); 1650 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName );
1651 eventRSync->setDtStart( mLastCalendarSync ); 1651 eventRSync->setDtStart( mLastCalendarSync );
1652 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 1652 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
1653 eventRSync->setCategories( i18n("SyncEvent") ); 1653 eventRSync->setCategories( i18n("SyncEvent") );
1654 } 1654 }
1655 } 1655 }
1656 if ( eventLSync->dtStart() == mLastCalendarSync ) 1656 if ( eventLSync->dtStart() == mLastCalendarSync )
1657 fullDateRange = true; 1657 fullDateRange = true;
1658 1658
1659 if ( ! fullDateRange ) { 1659 if ( ! fullDateRange ) {
1660 if ( eventLSync->dtStart() != eventRSync->dtStart() ) { 1660 if ( eventLSync->dtStart() != eventRSync->dtStart() ) {
1661 1661
1662 qDebug("KO: Sync: Set fulldate to true! Local: %s --- Remote: %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); 1662 qDebug("KO: Sync: Set fulldate to true! Local: %s --- Remote: %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() );
1663 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); 1663 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec());
1664 fullDateRange = true; 1664 fullDateRange = true;
1665 } 1665 }
1666 } 1666 }
1667 if ( mSyncManager->syncWithDesktop() ) { 1667 if ( mSyncManager->syncWithDesktop() ) {
1668 fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); 1668 fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync );
1669 } 1669 }
1670 if ( fullDateRange ) 1670 if ( fullDateRange )
1671 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); 1671 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
1672 else 1672 else
1673 mLastCalendarSync = eventLSync->dtStart(); 1673 mLastCalendarSync = eventLSync->dtStart();
1674 // for resyncing if own file has changed 1674 // for resyncing if own file has changed
1675 if ( mCurrentSyncDevice == "deleteaftersync" ) { 1675 if ( mCurrentSyncDevice == "deleteaftersync" ) {
1676 mLastCalendarSync = loadedFileVersion; 1676 mLastCalendarSync = loadedFileVersion;
1677 //qDebug("setting mLastCalendarSync "); 1677 //qDebug("setting mLastCalendarSync ");
1678 } 1678 }
1679 //qDebug("*************************** "); 1679 //qDebug("*************************** ");
1680 qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); 1680 qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange);
1681 QPtrList<Incidence> er = remote->rawIncidences(); 1681 QPtrList<Incidence> er = remote->rawIncidences();
1682 Incidence* inR = er.first(); 1682 Incidence* inR = er.first();
1683 Incidence* inL; 1683 Incidence* inL;
1684 QProgressBar bar( er.count(),0 ); 1684 QProgressBar bar( er.count(),0 );
1685 bar.setCaption (i18n("Syncing - close to abort!") ); 1685 bar.setCaption (i18n("Syncing - close to abort!") );
1686 1686
1687 // ************** setting up filter ************* 1687 // ************** setting up filter *************
1688 CalFilter *filterIN = 0; 1688 CalFilter *filterIN = 0;
1689 CalFilter *filterOUT = 0; 1689 CalFilter *filterOUT = 0;
1690 CalFilter *filter = mFilters.first(); 1690 CalFilter *filter = mFilters.first();
1691 while(filter) { 1691 while(filter) {
1692 if ( filter->name() == mSyncManager->mFilterInCal ) 1692 if ( filter->name() == mSyncManager->mFilterInCal )
1693 filterIN = filter; 1693 filterIN = filter;
1694 if ( filter->name() == mSyncManager->mFilterOutCal ) 1694 if ( filter->name() == mSyncManager->mFilterOutCal )
1695 filterOUT = filter; 1695 filterOUT = filter;
1696 filter = mFilters.next(); 1696 filter = mFilters.next();
1697 } 1697 }
1698 int w = 300; 1698 int w = 300;
1699 if ( QApplication::desktop()->width() < 320 ) 1699 if ( QApplication::desktop()->width() < 320 )
1700 w = 220; 1700 w = 220;
1701 int h = bar.sizeHint().height() ; 1701 int h = bar.sizeHint().height() ;
1702 int dw = QApplication::desktop()->width(); 1702 int dw = QApplication::desktop()->width();
1703 int dh = QApplication::desktop()->height(); 1703 int dh = QApplication::desktop()->height();
1704 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1704 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1705 bar.show(); 1705 bar.show();
1706 int modulo = (er.count()/10)+1; 1706 int modulo = (er.count()/10)+1;
1707 int incCounter = 0; 1707 int incCounter = 0;
1708 while ( inR ) { 1708 while ( inR ) {
1709 if ( ! bar.isVisible() ) 1709 if ( ! bar.isVisible() )
1710 return false; 1710 return false;
1711 if ( incCounter % modulo == 0 ) 1711 if ( incCounter % modulo == 0 )
1712 bar.setProgress( incCounter ); 1712 bar.setProgress( incCounter );
1713 ++incCounter; 1713 ++incCounter;
1714 uid = inR->uid(); 1714 uid = inR->uid();
1715 bool skipIncidence = false; 1715 bool skipIncidence = false;
1716 if ( uid.left(15) == QString("last-syncEvent-") ) 1716 if ( uid.left(15) == QString("last-syncEvent-") )
1717 skipIncidence = true; 1717 skipIncidence = true;
1718 QString idS; 1718 QString idS;
1719 qApp->processEvents(); 1719 qApp->processEvents();
1720 if ( !skipIncidence ) { 1720 if ( !skipIncidence ) {
1721 inL = local->incidenceForUid( uid , false ); 1721 inL = local->incidenceForUid( uid , false , true );
1722 if ( inL ) { // maybe conflict - same uid in both calendars 1722 if ( inL ) { // maybe conflict - same uid in both calendars
1723 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { 1723 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) {
1724 //qDebug("take %d %s ", take, inL->summary().latin1()); 1724 //qDebug("take %d %s ", take, inL->summary().latin1());
1725 if ( take == 3 ) 1725 if ( take == 3 )
1726 return false; 1726 return false;
1727 if ( take == 1 ) {// take local ********************** 1727 if ( take == 1 ) {// take local **********************
1728 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 1728 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
1729 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1729 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1730 else 1730 else
1731 idS = inR->IDStr(); 1731 idS = inR->IDStr();
1732 int calID = inR->calID(); 1732 int calID = inR->calID();
1733 remote->deleteIncidence( inR ); 1733 remote->deleteIncidence( inR );
1734 inR = inL->clone(); 1734 inR = inL->clone();
1735 inR->setCalID( calID ); 1735 inR->setCalID( calID );
1736 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1736 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1737 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) 1737 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL )
1738 inR->setIDStr( idS ); 1738 inR->setIDStr( idS );
1739 remote->addIncidence( inR ); 1739 remote->addIncidence( inR );
1740 if ( mSyncManager->syncWithDesktop() ) 1740 if ( mSyncManager->syncWithDesktop() )
1741 inR->setPilotId( 2 ); 1741 inR->setPilotId( 2 );
1742 ++changedRemote; 1742 ++changedRemote;
1743 } else {// take remote ********************** 1743 } else {// take remote **********************
1744 if ( !inL->isReadOnly() ) { 1744 if ( !inL->isReadOnly() ) {
1745 idS = inL->IDStr(); 1745 idS = inL->IDStr();
1746 int pid = inL->pilotId(); 1746 int pid = inL->pilotId();
1747 int calID = inL->calID(); 1747 int calID = inL->calID();
1748 local->deleteIncidence( inL ); 1748 local->deleteIncidence( inL );
1749 inL = inR->clone(); 1749 inL = inR->clone();
1750 inL->setCalID( calID ); 1750 inL->setCalID( calID );
1751 if ( mSyncManager->syncWithDesktop() ) 1751 if ( mSyncManager->syncWithDesktop() )
1752 inL->setPilotId( pid ); 1752 inL->setPilotId( pid );
1753 inL->setIDStr( idS ); 1753 inL->setIDStr( idS );
1754 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1754 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1755 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1755 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1756 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1756 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1757 } 1757 }
1758 local->addIncidence( inL ); 1758 local->addIncidence( inL );
1759 ++changedLocal; 1759 ++changedLocal;
1760 } 1760 }
1761 } 1761 }
1762 } 1762 }
1763 } else { // no conflict ********** add or delete remote 1763 } else { // no conflict ********** add or delete remote
1764 if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ 1764 if ( !filterIN || filterIN->filterCalendarItem( inR ) ){
1765 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1765 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1766 QString des = eventLSync->description(); 1766 QString des = eventLSync->description();
1767 QString pref = "e"; 1767 QString pref = "e";
1768 if ( inR->typeID() == todoID ) 1768 if ( inR->typeID() == todoID )
1769 pref = "t"; 1769 pref = "t";
1770 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 1770 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
1771 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 1771 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE );
1772 //remote->deleteIncidence( inR ); 1772 //remote->deleteIncidence( inR );
1773 ++deletedEventR; 1773 ++deletedEventR;
1774 } else { 1774 } else {
1775 inR->setLastModified( modifiedCalendar ); 1775 inR->setLastModified( modifiedCalendar );
1776 inL = inR->clone(); 1776 inL = inR->clone();
1777 inL->setIDStr( ":" ); 1777 inL->setIDStr( ":" );
1778 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1778 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1779 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1779 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1780 1780
1781 inL->setCalID( 0 );// add to default cal 1781 inL->setCalID( 0 );// add to default cal
1782 local->addIncidence( inL ); 1782 local->addIncidence( inL );
1783 ++addedEvent; 1783 ++addedEvent;
1784 1784
1785 } 1785 }
1786 } else { 1786 } else {
1787 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { 1787 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) {
1788 inR->setLastModified( modifiedCalendar ); 1788 inR->setLastModified( modifiedCalendar );
1789 inL = inR->clone(); 1789 inL = inR->clone();
1790 inL->setIDStr( ":" ); 1790 inL->setIDStr( ":" );
1791 inL->setCalID( 0 );// add to default cal 1791 inL->setCalID( 0 );// add to default cal
1792 local->addIncidence( inL ); 1792 local->addIncidence( inL );
1793 ++addedEvent; 1793 ++addedEvent;
1794 1794
1795 } else { 1795 } else {
1796 checkExternSyncEvent(eventRSyncSharp, inR); 1796 checkExternSyncEvent(eventRSyncSharp, inR);
1797 remote->deleteIncidence( inR ); 1797 remote->deleteIncidence( inR );
1798 ++deletedEventR; 1798 ++deletedEventR;
1799 } 1799 }
1800 } 1800 }
1801 } else { 1801 } else {
1802 ++filteredIN; 1802 ++filteredIN;
1803 } 1803 }
1804 } 1804 }
1805 } 1805 }
1806 inR = er.next(); 1806 inR = er.next();
1807 } 1807 }
1808 QPtrList<Incidence> el = local->rawIncidences(); 1808 QPtrList<Incidence> el = local->rawIncidences();
1809 inL = el.first(); 1809 inL = el.first();
1810 modulo = (el.count()/10)+1; 1810 modulo = (el.count()/10)+1;
1811 bar.setCaption (i18n("Add / remove events") ); 1811 bar.setCaption (i18n("Add / remove events") );
1812 bar.setTotalSteps ( el.count() ) ; 1812 bar.setTotalSteps ( el.count() ) ;
1813 bar.show(); 1813 bar.show();
1814 incCounter = 0; 1814 incCounter = 0;
1815 1815
1816 while ( inL ) { 1816 while ( inL ) {
1817 1817
1818 qApp->processEvents(); 1818 qApp->processEvents();
1819 if ( ! bar.isVisible() ) 1819 if ( ! bar.isVisible() )
1820 return false; 1820 return false;
1821 if ( incCounter % modulo == 0 ) 1821 if ( incCounter % modulo == 0 )
1822 bar.setProgress( incCounter ); 1822 bar.setProgress( incCounter );
1823 ++incCounter; 1823 ++incCounter;
1824 uid = inL->uid(); 1824 uid = inL->uid();
1825 bool skipIncidence = false; 1825 bool skipIncidence = false;
1826 if ( uid.left(15) == QString("last-syncEvent-") ) 1826 if ( uid.left(15) == QString("last-syncEvent-") )
1827 skipIncidence = true; 1827 skipIncidence = true;
1828 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->typeID() == journalID ) 1828 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->typeID() == journalID )
1829 skipIncidence = true; 1829 skipIncidence = true;
1830 if ( !skipIncidence ) { 1830 if ( !skipIncidence ) {
1831 inR = remote->incidenceForUid( uid , true ); 1831 inR = remote->incidenceForUid( uid , true, true );
1832 if ( ! inR ) { 1832 if ( ! inR ) {
1833 if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ 1833 if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){
1834 // no conflict ********** add or delete local 1834 // no conflict ********** add or delete local
1835 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1835 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1836 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 1836 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
1837 checkExternSyncEvent(eventLSyncSharp, inL); 1837 checkExternSyncEvent(eventLSyncSharp, inL);
1838 local->deleteIncidence( inL ); 1838 local->deleteIncidence( inL );
1839 ++deletedEventL; 1839 ++deletedEventL;
1840 } else { 1840 } else {
1841 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1841 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1842 inL->removeID(mCurrentSyncDevice ); 1842 inL->removeID(mCurrentSyncDevice );
1843 ++addedEventR; 1843 ++addedEventR;
1844 //qDebug("remote added Incidence %s ", inL->summary().latin1()); 1844 //qDebug("remote added Incidence %s ", inL->summary().latin1());
1845 inL->setLastModified( modifiedCalendar ); 1845 inL->setLastModified( modifiedCalendar );
1846 inR = inL->clone(); 1846 inR = inL->clone();
1847 inR->setIDStr( ":" ); 1847 inR->setIDStr( ":" );
1848 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1848 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1849 inR->setCalID( 0 );// add to default cal 1849 inR->setCalID( 0 );// add to default cal
1850 remote->addIncidence( inR ); 1850 remote->addIncidence( inR );
1851 } 1851 }
1852 } 1852 }
1853 } else { 1853 } else {
1854 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { 1854 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
1855 checkExternSyncEvent(eventLSyncSharp, inL); 1855 checkExternSyncEvent(eventLSyncSharp, inL);
1856 local->deleteIncidence( inL ); 1856 local->deleteIncidence( inL );
1857 ++deletedEventL; 1857 ++deletedEventL;
1858 } else { 1858 } else {
1859 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1859 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1860 ++addedEventR; 1860 ++addedEventR;
1861 inL->setLastModified( modifiedCalendar ); 1861 inL->setLastModified( modifiedCalendar );
1862 inR = inL->clone(); 1862 inR = inL->clone();
1863 inR->setIDStr( ":" ); 1863 inR->setIDStr( ":" );
1864 inR->setCalID( 0 );// add to default cal 1864 inR->setCalID( 0 );// add to default cal
1865 remote->addIncidence( inR ); 1865 remote->addIncidence( inR );
1866 } 1866 }
1867 } 1867 }
1868 } 1868 }
1869 } else { 1869 } else {
1870 ++filteredOUT; 1870 ++filteredOUT;
1871 } 1871 }
1872 } 1872 }
1873 } 1873 }
1874 inL = el.next(); 1874 inL = el.next();
1875 } 1875 }
1876 int delFut = 0; 1876 int delFut = 0;
1877 int remRem = 0; 1877 int remRem = 0;
1878 if ( mSyncManager->mWriteBackInFuture ) { 1878 if ( mSyncManager->mWriteBackInFuture ) {
1879 er = remote->rawIncidences(); 1879 er = remote->rawIncidences();
1880 remRem = er.count(); 1880 remRem = er.count();
1881 inR = er.first(); 1881 inR = er.first();
1882 QDateTime dt; 1882 QDateTime dt;
1883 QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) ); 1883 QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) );
1884 QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 ); 1884 QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 );
1885 while ( inR ) { 1885 while ( inR ) {
1886 if ( inR->typeID() == todoID ) { 1886 if ( inR->typeID() == todoID ) {
1887 Todo * t = (Todo*)inR; 1887 Todo * t = (Todo*)inR;
1888 if ( t->hasDueDate() ) 1888 if ( t->hasDueDate() )
1889 dt = t->dtDue(); 1889 dt = t->dtDue();
1890 else 1890 else
1891 dt = cur.addSecs( 62 ); 1891 dt = cur.addSecs( 62 );
1892 } 1892 }
1893 else if (inR->typeID() == eventID ) { 1893 else if (inR->typeID() == eventID ) {
1894 bool ok; 1894 bool ok;
1895 dt = inR->getNextOccurence( cur, &ok ); 1895 dt = inR->getNextOccurence( cur, &ok );
1896 if ( !ok ) 1896 if ( !ok )
1897 dt = cur.addSecs( -62 ); 1897 dt = cur.addSecs( -62 );
1898 } 1898 }
1899 else 1899 else
1900 dt = inR->dtStart(); 1900 dt = inR->dtStart();
1901 if ( dt < cur || dt > end ) { 1901 if ( dt < cur || dt > end ) {
1902 remote->deleteIncidence( inR ); 1902 remote->deleteIncidence( inR );
1903 ++delFut; 1903 ++delFut;
1904 } 1904 }
1905 inR = er.next(); 1905 inR = er.next();
1906 } 1906 }
1907 } 1907 }
1908 bar.hide(); 1908 bar.hide();
1909 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1909 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1910 if ( mMultiResourceSync ) { 1910 if ( mMultiResourceSync ) {
1911 remote->removeSyncInfo( "" ); //all 1911 remote->removeSyncInfo( "" ); //all
1912 qDebug("KO: Remoing all sync info on remote "); 1912 qDebug("KO: Remoing all sync info on remote ");
1913 } else { 1913 } else {
1914 eventLSync->setReadOnly( false ); 1914 eventLSync->setReadOnly( false );
1915 eventLSync->setDtStart( mLastCalendarSync ); 1915 eventLSync->setDtStart( mLastCalendarSync );
1916 eventRSync->setDtStart( mLastCalendarSync ); 1916 eventRSync->setDtStart( mLastCalendarSync );
1917 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1917 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1918 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1918 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1919 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1919 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1920 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1920 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1921 eventLSync->setReadOnly( true ); 1921 eventLSync->setReadOnly( true );
1922 } 1922 }
1923 qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL ); 1923 qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL );
1924 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop() && !mMultiResourceSync ) // kde is abnormal... 1924 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop() && !mMultiResourceSync ) // kde is abnormal...
1925 remote->addEvent( eventRSync ); 1925 remote->addEvent( eventRSync );
1926 else 1926 else
1927 delete eventRSync; 1927 delete eventRSync;