summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2004-10-27 12:27:39 (UTC)
committer zautrix <zautrix>2004-10-27 12:27:39 (UTC)
commit2f3396d84d2f3c92e1e0e420d677892c1f9c0778 (patch) (side-by-side diff)
tree1ebab5dc6d00cb09720789897ce2c86df05cc9ab /korganizer
parentf73d249579d52d7aeaacde2dcb23abeb42f9ee95 (diff)
downloadkdepimpi-2f3396d84d2f3c92e1e0e420d677892c1f9c0778.zip
kdepimpi-2f3396d84d2f3c92e1e0e420d677892c1f9c0778.tar.gz
kdepimpi-2f3396d84d2f3c92e1e0e420d677892c1f9c0778.tar.bz2
completed KDE AB sync. but will it work ...?
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp15
-rw-r--r--korganizer/calendarview.h1
2 files changed, 6 insertions, 10 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 326db88..6e61351 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -918,65 +918,65 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
//QPtrList<Event> el = local->rawEvents();
Event* eventR;
QString uid;
int take;
Event* eventL;
Event* eventRSync;
Event* eventLSync;
QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents();
QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents();
bool fullDateRange = false;
local->resetTempSyncStat();
mLastCalendarSync = QDateTime::currentDateTime();
- if ( mSyncKDE ) {
+ if ( mSyncManager->syncWithDesktop() ) {
remote->resetPilotStat(1);
if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
mLastCalendarSync = KSyncManager::mRequestedSyncEvent;
qDebug("using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() );
} else {
qDebug("ERROR: KSyncManager::mRequestedSyncEvent has invalid datatime ");
}
}
QDateTime modifiedCalendar = mLastCalendarSync;;
eventLSync = getLastSyncEvent();
eventR = remote->event("last-syncEvent-"+mCurrentSyncName );
if ( eventR ) {
eventRSync = (Event*) eventR->clone();
remote->deleteEvent(eventR );
} else {
- if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncKDE) {
+ if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) {
eventRSync = (Event*)eventLSync->clone();
} else {
fullDateRange = true;
eventRSync = new Event();
eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event"));
eventRSync->setUid("last-syncEvent-"+mCurrentSyncName );
eventRSync->setDtStart( mLastCalendarSync );
eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
eventRSync->setCategories( i18n("SyncEvent") );
}
}
if ( eventLSync->dtStart() == mLastCalendarSync )
fullDateRange = true;
if ( ! fullDateRange ) {
if ( eventLSync->dtStart() != eventRSync->dtStart() ) {
// qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() );
//qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec());
fullDateRange = true;
}
}
- if ( mSyncKDE ) {
+ if ( mSyncManager->syncWithDesktop() ) {
fullDateRange = ( eventLSync->dtStart() == mLastCalendarSync );
}
if ( fullDateRange )
mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
else
mLastCalendarSync = eventLSync->dtStart();
// for resyncing if own file has changed
if ( mCurrentSyncDevice == "deleteaftersync" ) {
mLastCalendarSync = loadedFileVersion;
//qDebug("setting mLastCalendarSync ");
}
//qDebug("*************************** ");
@@ -1018,33 +1018,33 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
return false;
if ( take == 1 ) {// take local
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
else
idS = inR->IDStr();
remote->deleteIncidence( inR );
inR = inL->clone();
inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL )
inR->setIDStr( idS );
remote->addIncidence( inR );
- if ( mSyncKDE )
+ if ( mSyncManager->syncWithDesktop() )
inR->setPilotId( 2 );
++changedRemote;
} else {
idS = inL->IDStr();
int pid = inL->pilotId();
local->deleteIncidence( inL );
inL = inR->clone();
- if ( mSyncKDE )
+ if ( mSyncManager->syncWithDesktop() )
inL->setPilotId( pid );
inL->setIDStr( idS );
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
}
local->addIncidence( inL );
++changedLocal;
}
}
} else { // no conflict
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
@@ -1174,25 +1174,25 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
}
}
bar.hide();
mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
eventLSync->setReadOnly( false );
eventLSync->setDtStart( mLastCalendarSync );
eventRSync->setDtStart( mLastCalendarSync );
eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
eventLSync->setReadOnly( true );
- if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncKDE) // kde is abnormal...
+ if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal...
remote->addEvent( eventRSync );
else
delete eventRSync;
QString mes;
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"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR );
QString delmess;
if ( delFut ) {
delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut);
mes += delmess;
}
if ( mSyncManager->mShowSyncSummary ) {
KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") );
@@ -3736,36 +3736,33 @@ NavigatorBar *CalendarView::navigatorBar()
void CalendarView::keyPressEvent ( QKeyEvent *e)
{
//qDebug(" alendarView::keyPressEvent ");
e->ignore();
}
bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
{
// mSyncManager = manager;
- mSyncKDE = false;
if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
qDebug("SyncKDE request detected!");
- mSyncKDE = true;
}
mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
mCurrentSyncName = mSyncManager->getCurrentSyncName();
return syncCalendar( filename, mode );
}
bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
{
- mSyncKDE = false;
//mSyncManager = manager;
mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
mCurrentSyncName = mSyncManager->getCurrentSyncName();
if ( resource == "sharp" )
syncExternal( 0 );
if ( resource == "phone" )
syncExternal( 1 );
// pending setmodified
return true;
}
void CalendarView::setSyncManager(KSyncManager* manager)
{
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index acc20d6..437a51c 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -480,25 +480,24 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
//Attendee* getYourAttendee(Event *event);
protected:
void schedule(Scheduler::Method, Incidence *incidence = 0);
// returns KMsgBox::OKCandel()
int msgItemDelete();
void showEventEditor();
void showTodoEditor();
void writeLocale();
Todo *selectedTodo();
private:
- bool mSyncKDE;
KSyncManager* mSyncManager;
AlarmDialog * mAlarmDialog;
QString mAlarmNotification;
QString mSuspendAlarmNotification;
QTimer* mSuspendTimer;
QTimer* mAlarmTimer;
QTimer* mRecheckAlarmTimer;
void computeAlarm( QString );
void startAlarm( QString, QString );
void setSyncEventsReadOnly();
QDateTime loadedFileVersion;