summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2004-08-02 00:09:04 (UTC)
committer zautrix <zautrix>2004-08-02 00:09:04 (UTC)
commit3ebd85e83e6f9d4ac59ce1828548f7236e2b1af0 (patch) (side-by-side diff)
treefdff56329649c084b6f5af8d8e96c0157686575e /korganizer
parent3b4aa1cd78395c0f94b99decd901842944765746 (diff)
downloadkdepimpi-3ebd85e83e6f9d4ac59ce1828548f7236e2b1af0.zip
kdepimpi-3ebd85e83e6f9d4ac59ce1828548f7236e2b1af0.tar.gz
kdepimpi-3ebd85e83e6f9d4ac59ce1828548f7236e2b1af0.tar.bz2
More sync hacking
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp70
-rw-r--r--korganizer/calendarview.h5
-rw-r--r--korganizer/koprefs.cpp27
-rw-r--r--korganizer/koprefs.h1
-rw-r--r--korganizer/mainwindow.cpp3
5 files changed, 69 insertions, 37 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index cfc6b10..9160e1d 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -851,9 +851,12 @@ Event* CalendarView::getLastSyncEvent()
Event* lse;
//qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
- lse = mCalendar->event( "last-syncEvent-device-"+mCurrentSyncDevice );
+ lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice );
if (!lse) {
lse = new Event();
- lse->setUid( "last-syncEvent-device-"+mCurrentSyncDevice );
- lse->setSummary(mCurrentSyncDevice + i18n(" - sync event"));
+ lse->setUid( "last-syncEvent-"+mCurrentSyncDevice );
+ QString sum = "";
+ if ( KOPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
+ sum = "E: ";
+ lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event"));
lse->setDtStart( mLastCalendarSync );
lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
@@ -866,20 +869,43 @@ Event* CalendarView::getLastSyncEvent()
}
-void CalendarView::checkSharpEvent( Event* lastSync, Incidence* toDelete )
+void CalendarView::setupExternSyncProfiles()
{
- if ( ! lastSync )
- return;
- if ( toDelete->zaurusId() < 0 )
+ Event* lse;
+ mExternLastSyncEvent.clear();
+ int i;
+ for ( i = 0; i < KOPrefs::instance()->mExternSyncProfiles.count(); ++i ) {
+ lse = mCalendar->event( "last-syncEvent-"+ KOPrefs::instance()->mExternSyncProfiles[i] );
+ if ( lse )
+ mExternLastSyncEvent.append( lse );
+ else
+ qDebug("Last Sync event not found for %s ", KOPrefs::instance()->mExternSyncProfiles[i].latin1());
+ }
+
+}
+// we check, if the to delete event has a id for a profile
+// if yes, we set this id in the profile to delete
+void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete )
+{
+ if ( ! lastSync.count() == 0 )
return;
if ( toDelete->type() == "Journal" )
return;
- QString des = lastSync->description();
+
+ Event* eve = lastSync.first();
+
+ while ( eve ) {
+ int id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name
+ if ( id >= 0 ) {
+ QString des = eve->description();
QString pref = "e";
if ( toDelete->type() == "Todo" )
pref = "t";
- des += pref+ QString::number ( toDelete->zaurusId() ) + ",";
- lastSync->setReadOnly( false );
- lastSync->setDescription( des );
- lastSync->setReadOnly( true );
+ des += pref+ QString::number ( id ) + ",";
+ eve->setReadOnly( false );
+ eve->setDescription( des );
+ eve->setReadOnly( true );
+ }
+ eve = lastSync.next();
+ }
}
@@ -900,10 +926,10 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
Event* eventRSync;
Event* eventLSync;
- Event* eventRSyncSharp = remote->event( "last-syncEvent-device-Sharp-DTM");
- Event* eventLSyncSharp = local->event( "last-syncEvent-device-Sharp-DTM");
+ QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents();
+ QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents();
bool fullDateRange = false;
mLastCalendarSync = QDateTime::currentDateTime();
QDateTime modifiedCalendar = mLastCalendarSync;;
- eventR = remote->event("last-syncEvent-device-"+mCurrentSyncName );
+ eventR = remote->event("last-syncEvent-"+mCurrentSyncName );
if ( eventR ) {
eventRSync = (Event*) eventR->clone();
@@ -914,5 +940,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
eventRSync = new Event();
eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event"));
- eventRSync->setUid("last-syncEvent-device-"+mCurrentSyncName );
+ eventRSync->setUid("last-syncEvent-"+mCurrentSyncName );
eventRSync->setDtStart( mLastCalendarSync );
eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
@@ -966,5 +992,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
uid = inR->uid();
bool skipIncidence = false;
- if ( uid.left(21) == QString("last-syncEvent-device") )
+ if ( uid.left(15) == QString("last-syncEvent-") )
skipIncidence = true;
@@ -1016,5 +1042,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
++addedEvent;
} else {
- checkSharpEvent(eventRSyncSharp, inR);
+ checkExternSyncEvent(eventRSyncSharp, inR);
remote->deleteIncidence( inR );
++deletedEventR;
@@ -1043,5 +1069,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
uid = inL->uid();
bool skipIncidence = false;
- if ( uid.left(21) == QString("last-syncEvent-device") )
+ if ( uid.left(15) == QString("last-syncEvent-") )
skipIncidence = true;
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" )
@@ -1064,5 +1090,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
} else {
if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
- checkSharpEvent(eventLSyncSharp, inL);
+ checkExternSyncEvent(eventLSyncSharp, inL);
local->deleteIncidence( inL );
++deletedEventL;
@@ -1343,5 +1369,5 @@ void CalendarView::setSyncEventsReadOnly()
ev = eL.first();
while ( ev ) {
- if ( ev->uid().left(21) == QString("last-syncEvent-device") )
+ if ( ev->uid().left(15) == QString("last-syncEvent-") )
ev->setReadOnly( true );
ev = eL.next();
@@ -1807,5 +1833,5 @@ void CalendarView::checkZaurusId( int id, bool todo )
{
if ( id >= 0 ) {
- Incidence* lse = mCalendar->event( "last-syncEvent-device-Sharp-DTM");
+ Incidence* lse = mCalendar->event( "last-syncEvent-Sharp-DTM");
if ( lse ) {
QString des = lse->description();
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 8aa5e1c..557554f 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -114,4 +114,5 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
KOEventViewerDialog* getEventViewerDialog();
Incidence *currentSelection();
+ void setupExternSyncProfiles();
signals:
@@ -482,5 +483,5 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
QDateTime loadedFileVersion;
- void checkSharpEvent( Event* lastSync, Incidence* toDelete );
+ void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
void checkZaurusId( int id, bool todo = false );
int mGlobalSyncMode;
@@ -535,5 +536,5 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
Incidence *mSelectedIncidence;
Incidence *mMoveIncidence;
-
+ QPtrList<Event> mExternLastSyncEvent;
KOTodoView *mTodoList;
KOEventEditor * mEventEditor;
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 3ba5ab2..f3231ff 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -178,14 +178,15 @@ KOPrefs::KOPrefs() :
addItemFont("EventView Font",&mEventViewFont);
- KPrefs::setCurrentGroup("SyncProfiles");
- addItemString("LocalMachineName",&mLocalMachineName, "undefined");
- addItemStringList("SyncProfileNames",&mSyncProfileNames);
+// KPrefs::setCurrentGroup("SyncProfiles");
+// addItemString("LocalMachineName",&mLocalMachineName, "undefined");
+// addItemStringList("SyncProfileNames",&mSyncProfileNames);
+// addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames);
KPrefs::setCurrentGroup("RemoteSyncing");
- addItemBool("UsePasswd",&mUsePassWd,false);
- addItemBool("WriteBackFile",&mWriteBackFile,true);
- addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false);
- addItemBool("AskForPreferences",&mAskForPreferences,true);
- addItemBool("ShowSyncSummary",&mShowSyncSummary,true);
+// addItemBool("UsePasswd",&mUsePassWd,false);
+// addItemBool("WriteBackFile",&mWriteBackFile,true);
+// addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false);
+// addItemBool("AskForPreferences",&mAskForPreferences,true);
+// addItemBool("ShowSyncSummary",&mShowSyncSummary,true);
addItemBool("ShowSyncEvents",&mShowSyncEvents,false);
addItemInt("LastSyncTime",&mLastSyncTime,0);
@@ -198,9 +199,9 @@ KOPrefs::KOPrefs() :
QString hdp= locateLocal("data","korganizer")+"/";
#endif
- addItemString("RemoteIP",&mRemoteIP, "192.168.0.65");
- addItemString("RemoteUser",&mRemoteUser, "zaurus");
- addItemString("RemotePassWd",&mRemotePassWd, "");
- addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics");
- addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" );
+// addItemString("RemoteIP",&mRemoteIP, "192.168.0.65");
+// addItemString("RemoteUser",&mRemoteUser, "zaurus");
+// addItemString("RemotePassWd",&mRemotePassWd, "");
+// addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics");
+// addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" );
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index fe044e6..424fa98 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -216,4 +216,5 @@ class KOPrefs : public KPimPrefs
int mRingSyncAlgoPrefs;
QStringList mSyncProfileNames;
+ QStringList mExternSyncProfiles;
QString mLocalMachineName;
void setCategoryColor(QString cat,const QColor & color);
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 44b1264..6020a46 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -837,7 +837,9 @@ void MainWindow::fillSyncMenu()
config.setGroup("General");
config.writeEntry("SyncProfileNames",prof);
+ config.writeEntry("ExternSyncProfiles","Sharp_DTM");
config.sync();
delete temp;
}
+ KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles");
KOPrefs::instance()->mSyncProfileNames = prof;
int i;
@@ -852,4 +854,5 @@ void MainWindow::fillSyncMenu()
syncMenu->setItemEnabled( false , 1000 );
}
+ mView->setupExternSyncProfiles();
}