summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-11-28 03:27:16 (UTC)
committer zautrix <zautrix>2005-11-28 03:27:16 (UTC)
commitb7522a13b64225bb91bdab4a21b44282f8c3e3b4 (patch) (side-by-side diff)
tree3aa005036dd83f3d0e5f57dd398dc260666daea1
parent084180efc1bccba341bf3f2f718fd10cdfdaf18e (diff)
downloadkdepimpi-b7522a13b64225bb91bdab4a21b44282f8c3e3b4.zip
kdepimpi-b7522a13b64225bb91bdab4a21b44282f8c3e3b4.tar.gz
kdepimpi-b7522a13b64225bb91bdab4a21b44282f8c3e3b4.tar.bz2
sync
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp24
-rw-r--r--libkcal/calendarlocal.cpp23
2 files changed, 29 insertions, 18 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 1800cf2..8385bcc 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1732,6 +1732,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
hasCalId = 0;
if ( inL ) { // maybe conflict - same uid in both calendars
- if ( hasCalId )
- qDebug("KO: Cal id %d conflict detected: %s ", hasCalId, inL->summary().latin1());
+
if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) {
//qDebug("take %d %s ", take, inL->summary().latin1());
@@ -1745,4 +1744,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
int calID = inR->calID();
remote->deleteIncidence( inR );
+ if ( !hasCalId ) {
inR = inL->clone();
inR->setCalID_block( calID );
@@ -1754,4 +1754,6 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
inR->setPilotId( 2 );
++changedRemote;
+ } else
+ ++deletedEventR;
} else {// take remote **********************
if ( !inL->isReadOnly() ) {
@@ -1760,5 +1762,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
int calID = inL->calID();
if ( hasCalId )
- calID = hasCalId;
+ calID = 0;// add to default calendar
local->deleteIncidence( inL );
inL = inR->clone();
@@ -1777,8 +1779,12 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
} else {
// take == 0; events equal
- if ( hasCalId )
- qDebug("EV EQUALLLL **************************** ");
+ if ( hasCalId ) {
+ qDebug("KO: Changing Cal id %d to %d for : %s ", hasCalId, local->defaultCalendar(),inL->summary().latin1());
+ inL->setCalID( local->defaultCalendar() );
+ }
}
+
+
} else { // no conflict ********** add or delete remote
if ( !filterIN || filterIN->filterCalendarItem( inR ) ){
@@ -2483,14 +2489,10 @@ void CalendarView::mergeFileResource( QString fn ,QString resource )
clearAllViews();
mCalendar->setCalendarRemove( exclusiveResource );
- int def = mCalendar->defaultCalendar();
mCalendar->setDefaultCalendar(exclusiveResource);
+ mCalendar->setAllCalendarEnabled( true );
if ( !mCalendar->addCalendarFile( fn, exclusiveResource )) {
qDebug("KO: CalendarView::mergeFileResource: error adding file %s", fn.latin1() );
}
- mCalendar->setDefaultCalendar( def );
- mCalendar->reInitAlarmSettings();
- setSyncEventsReadOnly();
- updateUnmanagedViews();
- updateView();
+ restoreCalendarSettings();
}
void CalendarView::showOpenError()
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 980663f..8a5a76f 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -260,15 +260,15 @@ void CalendarLocal::addCalendar( Calendar* cal )
cal->setDontDeleteIncidencesOnClose();
setSyncEventsEnabled();
+ QPtrList<Incidence> incList;
{
QPtrList<Event> EventList = cal->rawEvents();
- QPtrList<Event> el;
Event * ev = EventList.first();
while ( ev ) {
if ( ev->uid().left( 15 ) == QString("last-syncEvent-") ) {
- Event * se = event( ev->uid() );
- if ( se )
- el.append( se );
ev->setCalID_block( 1 );
}
+ Event * se = event( ev->uid() );
+ if ( se )
+ incList.append( se );
ev->unRegisterObserver( cal );
ev->registerObserver( this );
@@ -276,7 +276,5 @@ void CalendarLocal::addCalendar( Calendar* cal )
ev = EventList.next();
}
- for ( ev = el.first(); ev; ev = el.next() ) {
- deleteIncidence ( ev );
- }
+
}
{
@@ -291,4 +289,7 @@ void CalendarLocal::addCalendar( Calendar* cal )
ev = TodoList.first();
while ( ev ) {
+ Todo * se = todo( ev->uid() );
+ if ( se )
+ incList.append( se );
ev->unRegisterObserver( cal );
ev->registerObserver( this );
@@ -302,4 +303,7 @@ void CalendarLocal::addCalendar( Calendar* cal )
Journal * ev = JournalList.first();
while ( ev ) {
+ Journal * se = journal( ev->uid() );
+ if ( se )
+ incList.append( se );
ev->unRegisterObserver( cal );
ev->registerObserver( this );
@@ -308,4 +312,9 @@ void CalendarLocal::addCalendar( Calendar* cal )
}
}
+ {
+ for (Incidence * ev = incList.first(); ev; ev = incList.next() ) {
+ deleteIncidence ( ev );
+ }
+ }
setModified( true );
}