summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp76
-rw-r--r--korganizer/calendarview.h5
-rw-r--r--korganizer/koprefs.cpp27
-rw-r--r--korganizer/koprefs.h1
-rw-r--r--korganizer/mainwindow.cpp3
-rw-r--r--libkcal/calendar.h2
-rw-r--r--libkcal/calendarlocal.cpp14
-rw-r--r--libkcal/calendarlocal.h2
8 files changed, 87 insertions, 43 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index cfc6b10..9160e1d 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -829,112 +829,138 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
//qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() );
getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!"));
getEventViewerDialog()->showMe();
result = getEventViewerDialog()->executeS( localIsNew );
return result;
break;
case SYNC_PREF_FORCE_LOCAL:
return 1;
break;
case SYNC_PREF_FORCE_REMOTE:
return 2;
break;
default:
// SYNC_PREF_TAKE_BOTH not implemented
break;
}
return 0;
}
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 ) );
lse->setCategories( i18n("SyncEvent") );
lse->setReadOnly( true );
mCalendar->addEvent( lse );
}
return lse;
}
-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();
- QString pref = "e";
- if ( toDelete->type() == "Todo" )
- pref = "t";
- des += pref+ QString::number ( toDelete->zaurusId() ) + ",";
- lastSync->setReadOnly( false );
- lastSync->setDescription( des );
- lastSync->setReadOnly( true );
+
+ 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 ( id ) + ",";
+ eve->setReadOnly( false );
+ eve->setDescription( des );
+ eve->setReadOnly( true );
+ }
+ eve = lastSync.next();
+ }
}
bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode )
{
bool syncOK = true;
int addedEvent = 0;
int addedEventR = 0;
int deletedEventR = 0;
int deletedEventL = 0;
int changedLocal = 0;
int changedRemote = 0;
//QPtrList<Event> el = local->rawEvents();
Event* eventR;
QString uid;
int take;
Event* eventL;
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();
remote->deleteEvent(eventR );
} else {
fullDateRange = true;
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 ) );
eventRSync->setCategories( i18n("SyncEvent") );
}
eventLSync = getLastSyncEvent();
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 ( 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 ");
@@ -944,49 +970,49 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
QPtrList<Incidence> er = remote->rawIncidences();
Incidence* inR = er.first();
Incidence* inL;
QProgressBar bar( er.count(),0 );
bar.setCaption (i18n("Syncing - close to abort!") );
int w = 300;
if ( QApplication::desktop()->width() < 320 )
w = 220;
int h = bar.sizeHint().height() ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
bar.show();
int modulo = (er.count()/10)+1;
int incCounter = 0;
while ( inR ) {
if ( ! bar.isVisible() )
return false;
if ( incCounter % modulo == 0 )
bar.setProgress( incCounter );
++incCounter;
uid = inR->uid();
bool skipIncidence = false;
- if ( uid.left(21) == QString("last-syncEvent-device") )
+ if ( uid.left(15) == QString("last-syncEvent-") )
skipIncidence = true;
qApp->processEvents();
if ( !skipIncidence ) {
inL = local->incidence( uid );
if ( inL ) { // maybe conflict - same uid in both calendars
int maxrev = inL->revision();
if ( maxrev < inR->revision() )
maxrev = inR->revision();
if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) {
//qDebug("take %d %s ", take, inL->summary().latin1());
if ( take == 3 )
return false;
if ( take == 1 ) {// take local
inL->setZaurusUid( inR->zaurusUid() );
remote->deleteIncidence( inR );
if ( inL->revision() < maxrev )
inL->setRevision( maxrev );
remote->addIncidence( inL->clone() );
++changedRemote;
} else {
if ( inR->revision() < maxrev )
inR->setRevision( maxrev );
local->deleteIncidence( inL );
@@ -994,97 +1020,97 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
++changedLocal;
}
}
} else { // no conflict
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
QString des = eventLSync->description();
QString pref = "e";
if ( inR->type() == "Todo" )
pref = "t";
if ( des.find(pref+QString::number( inR->zaurusId() ) +"," ) >= 0 && mode != 5) { // delete it
inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE );
//remote->deleteIncidence( inR );
++deletedEventR;
} else {
inR->setLastModified( modifiedCalendar );
local->addIncidence( inR->clone() );
++addedEvent;
}
} else {
if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) {
inR->setLastModified( modifiedCalendar );
local->addIncidence( inR->clone() );
++addedEvent;
} else {
- checkSharpEvent(eventRSyncSharp, inR);
+ checkExternSyncEvent(eventRSyncSharp, inR);
remote->deleteIncidence( inR );
++deletedEventR;
}
}
}
}
inR = er.next();
}
QPtrList<Incidence> el = local->rawIncidences();
inL = el.first();
modulo = (el.count()/10)+1;
bar.setCaption (i18n("Add / remove events") );
bar.setTotalSteps ( el.count() ) ;
bar.show();
incCounter = 0;
while ( inL ) {
qApp->processEvents();
if ( ! bar.isVisible() )
return false;
if ( incCounter % modulo == 0 )
bar.setProgress( incCounter );
++incCounter;
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" )
skipIncidence = true;
if ( !skipIncidence ) {
inR = remote->incidence( uid );
if ( ! inR ) {
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
if ( inL->zaurusId() >= 0 && mode != 4 ) {
local->deleteIncidence( inL );
++deletedEventL;
} else {
if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) {
inL->setZaurusId( -1 );
++addedEventR;
inL->setLastModified( modifiedCalendar );
remote->addIncidence( inL->clone() );
}
}
} else {
if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
- checkSharpEvent(eventLSyncSharp, inL);
+ checkExternSyncEvent(eventLSyncSharp, inL);
local->deleteIncidence( inL );
++deletedEventL;
} else {
if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) {
++addedEventR;
inL->setLastModified( modifiedCalendar );
remote->addIncidence( inL->clone() );
}
}
}
}
}
inL = el.next();
}
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 );
@@ -1321,49 +1347,49 @@ bool CalendarView::importQtopia( const QString &categories,
}
setModified( true );
}
} else {
QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ;
QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"),
question, i18n("Ok")) ;
}
delete calendar;
updateView();
return syncOK;
#endif
}
void CalendarView::setSyncEventsReadOnly()
{
Event * ev;
QPtrList<Event> eL = mCalendar->rawEvents();
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();
}
}
bool CalendarView::openCalendar(QString filename, bool merge)
{
if (filename.isEmpty()) {
return false;
}
if (!QFile::exists(filename)) {
KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename));
return false;
}
globalFlagBlockAgenda = 1;
if (!merge) mCalendar->close();
mStorage->setFileName( filename );
if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) {
if ( merge ) ;//setModified( true );
else {
@@ -1785,49 +1811,49 @@ void CalendarView::eventChanged(Event *event)
//updateUnmanagedViews();
}
void CalendarView::eventAdded(Event *event)
{
changeEventDisplay(event,KOGlobals::EVENTADDED);
}
void CalendarView::eventToBeDeleted(Event *)
{
kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
}
void CalendarView::eventDeleted()
{
changeEventDisplay(0,KOGlobals::EVENTDELETED);
}
void CalendarView::changeTodoDisplay(Todo *which, int action)
{
changeIncidenceDisplay((Incidence *)which, action);
}
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();
QString pref = "e";
if ( todo )
pref = "t";
des += pref+ QString::number ( id ) + ",";
lse->setReadOnly( false );
lse->setDescription( des );
lse->setReadOnly( true );
}
}
}
void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
{
updateUnmanagedViews();
//qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
if ( action == KOGlobals::EVENTDELETED ) { //delete
mCalendar->checkAlarmForIncidence( 0, true );
if ( mEventViewerDialog )
mEventViewerDialog->hide();
}
else
mCalendar->checkAlarmForIncidence( which , false );
}
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 8aa5e1c..557554f 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -92,48 +92,49 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
const char *name = 0 );
CalendarView( Calendar *calendar, QWidget *parent = 0,
const char *name = 0 );
virtual ~CalendarView();
Calendar *calendar() { return mCalendar; }
KOViewManager *viewManager();
KODialogManager *dialogManager();
QDate startDate();
QDate endDate();
QWidgetStack *viewStack();
QWidget *leftFrame();
NavigatorBar *navigatorBar();
DateNavigator *dateNavigator();
KDateNavigator *dateNavigatorWidget();
void addView(KOrg::BaseView *);
void showView(KOrg::BaseView *);
KOEventViewerDialog* getEventViewerDialog();
Incidence *currentSelection();
+ void setupExternSyncProfiles();
signals:
/** This todo has been modified */
void todoModified(Todo *, int);
/** when change is made to options dialog, the topwidget will catch this
* and emit this signal which notifies all widgets which have registered
* for notification to update their settings. */
void configChanged();
/** emitted when the topwidget is closing down, so that any attached
child windows can also close. */
void closingDown();
/** emitted right before we die */
void closed(QWidget *);
/** Emitted when state of modified flag changes */
void modifiedChanged(bool);
void signalmodified();
/** Emitted when state of read-only flag changes */
void readOnlyChanged(bool);
/** Emitted when the unit of navigation changes */
void changeNavStringPrev(const QString &);
@@ -460,49 +461,49 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false );
//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:
AlarmDialog * mAlarmDialog;
QString mAlarmNotification;
QString mSuspendAlarmNotification;
QTimer* mSuspendTimer;
QTimer* mAlarmTimer;
QTimer* mRecheckAlarmTimer;
void computeAlarm( QString );
void startAlarm( QString, QString );
void setSyncEventsReadOnly();
QDateTime loadedFileVersion;
- void checkSharpEvent( Event* lastSync, Incidence* toDelete );
+ void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
void checkZaurusId( int id, bool todo = false );
int mGlobalSyncMode;
QString mCurrentSyncDevice;
QString mCurrentSyncName;
KOBeamPrefs* beamDialog;
void init();
int mDatePickerMode;
bool mFlagEditDescription;
QDateTime mLastCalendarSync;
void createPrinter();
void calendarModified( bool, Calendar * );
CalPrinter *mCalPrinter;
QSplitter *mPanner;
QSplitter *mLeftSplitter;
QWidget *mLeftFrame;
QWidgetStack *mRightFrame;
KDatePicker* mDatePicker;
QVBox* mDateFrame;
NavigatorBar *mNavigatorBar;
@@ -513,49 +514,49 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
ResourceView *mResourceView;
// calendar object for this viewing instance
Calendar *mCalendar;
CalendarResourceManager *mResourceManager;
FileStorage *mStorage;
DateNavigator *mNavigator;
KOViewManager *mViewManager;
KODialogManager *mDialogManager;
// Calendar filters
QPtrList<CalFilter> mFilters;
// various housekeeping variables.
bool mModified; // flag indicating if calendar is modified
bool mReadOnly; // flag indicating if calendar is read-only
QDate mSaveSingleDate;
Incidence *mSelectedIncidence;
Incidence *mMoveIncidence;
-
+ QPtrList<Event> mExternLastSyncEvent;
KOTodoView *mTodoList;
KOEventEditor * mEventEditor;
KOTodoEditor * mTodoEditor;
KOEventViewerDialog * mEventViewerDialog;
void keyPressEvent ( QKeyEvent *e) ;
//QMap<Incidence*,KOIncidenceEditor*> mDialogList;
};
class CalendarViewVisitor : public Incidence::Visitor
{
public:
CalendarViewVisitor() : mView( 0 ) {}
bool act( Incidence *incidence, CalendarView *view )
{
mView = view;
return incidence->accept( *this );
}
protected:
CalendarView *mView;
};
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 3ba5ab2..f3231ff 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -156,73 +156,74 @@ KOPrefs::KOPrefs() :
addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7);
addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5);
addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3);
KPrefs::setCurrentGroup("Calendar");
addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar);
KPrefs::setCurrentGroup("Fonts");
// qDebug(" KPrefs::setCurrentGroup(Fonts); ");
addItemFont("TimeBar Font",&mTimeBarFont);
addItemFont("MonthView Font",&mMonthViewFont);
addItemFont("AgendaView Font",&mAgendaViewFont);
addItemFont("MarcusBains Font",&mMarcusBainsFont);
addItemFont("TimeLabels Font",&mTimeLabelsFont);
addItemFont("TodoView Font",&mTodoViewFont);
addItemFont("ListView Font",&mListViewFont);
addItemFont("DateNavigator Font",&mDateNavigatorFont);
addItemFont("EditBox Font",&mEditBoxFont);
addItemFont("JournalView Font",&mJornalViewFont);
addItemFont("WhatsNextView Font",&mWhatsNextFont);
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);
addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3);
addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3);
#ifdef _WIN32_
QString hdp= locateLocal("data","korganizer")+"\\\\";
#else
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" );
KPrefs::setCurrentGroup("LoadSaveFileNames");
addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" );
addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" );
addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" );
addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" );
addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" );
KPrefs::setCurrentGroup("Locale");
addItemInt("PreferredLanguage",&mPreferredLanguage,0);
addItemInt("PreferredTime",&mPreferredTime,0);
addItemInt("PreferredDate",&mPreferredDate,0);
addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false);
addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false);
addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y");
addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
KPrefs::setCurrentGroup("Colors");
addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor);
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index fe044e6..424fa98 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -194,48 +194,49 @@ class KOPrefs : public KPimPrefs
bool mToolBarHor;
bool mToolBarUp;
bool mToolBarMiniIcons;
bool mAskForQuit;
bool mUsePassWd;
bool mWriteBackFile;
bool mAskForPreferences;
bool mShowSyncSummary;
bool mShowSyncEvents;
bool mShowTodoInAgenda;
bool mWriteBackExistingOnly;
QString mRemoteIP;
QString mRemoteUser;
QString mRemotePassWd;
QString mRemoteFile;
QString mLocalTempFile;
int mLastSyncTime;
int mSyncAlgoPrefs;
int mRingSyncAlgoPrefs;
QStringList mSyncProfileNames;
+ QStringList mExternSyncProfiles;
QString mLocalMachineName;
void setCategoryColor(QString cat,const QColor & color);
QColor *categoryColor(QString cat);
QString mArchiveFile;
QString mHtmlExportFile;
bool mHtmlWithSave;
QStringList mSelectedPlugins;
QString mLastImportFile;
QString mLastVcalFile;
QString mLastSaveFile;
QString mLastLoadFile;
QString mLastSyncedLocalFile;
QString mDefaultAlarmFile;
int mIMIPScheduler;
int mIMIPSend;
QStringList mAdditionalMails;
int mIMIPAutoRefresh;
int mIMIPAutoInsertReply;
int mIMIPAutoInsertRequest;
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 44b1264..6020a46 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -815,63 +815,66 @@ void MainWindow::fillSyncMenu()
{
syncMenu->clear();
syncMenu->insertItem( i18n("Configure..."), 0 );
syncMenu->insertSeparator();
syncMenu->insertItem( i18n("Multiple sync"), 1 );
syncMenu->insertSeparator();
KConfig config ( locateLocal( "config","syncprofilesrc" ) );
config.setGroup("General");
QStringList prof = config.readListEntry("SyncProfileNames");
KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined");
if ( prof.count() < 3 ) {
prof.clear();
prof << i18n("Sharp_DTM");
prof << i18n("Local_file");
prof << i18n("Last_file");
KSyncProfile* temp = new KSyncProfile ();
temp->setName( prof[0] );
temp->writeConfig(&config);
temp->setName( prof[1] );
temp->writeConfig(&config);
temp->setName( prof[2] );
temp->writeConfig(&config);
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;
for ( i = 0; i < prof.count(); ++i ) {
syncMenu->insertItem( prof[i], 1000+i );
if ( i == 2 )
syncMenu->insertSeparator();
}
QDir app_dir;
if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) {
syncMenu->setItemEnabled( false , 1000 );
}
+ mView->setupExternSyncProfiles();
}
int MainWindow::ringSync()
{
int syncedProfiles = 0;
int i;
QTime timer;
KConfig config ( locateLocal( "config","syncprofilesrc" ) );
QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames;
KSyncProfile* temp = new KSyncProfile ();
KOPrefs::instance()->mAskForPreferences = false;
for ( i = 0; i < syncProfileNames.count(); ++i ) {
mCurrentSyncProfile = i;
temp->setName(syncProfileNames[mCurrentSyncProfile]);
temp->readConfig(&config);
if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) {
setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
++syncedProfiles;
// KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
KOPrefs::instance()->mShowSyncSummary = false;
mView->setSyncDevice(syncProfileNames[i] );
mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index 7d23619..df5bbcf 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -54,49 +54,49 @@ class CalFilter;
Calendar by addEvent() it is owned by the Calendar object. The Calendar takes
care of deleting it. All Events returned by the query functions are returned
as pointers, that means all changes to the returned events are immediately
visible in the Calendar. You shouldn't delete any Event object you get from
Calendar.
*/
class Calendar : public QObject, public CustomProperties,
public IncidenceBase::Observer
{
Q_OBJECT
public:
Calendar();
Calendar(const QString &timeZoneId);
virtual ~Calendar();
void deleteIncidence(Incidence *in);
/**
Clears out the current calendar, freeing all used memory etc.
*/
virtual void close() = 0;
/**
Sync changes in memory to persistant storage.
*/
virtual void save() = 0;
-
+ virtual QPtrList<Event> getExternLastSyncEvents() = 0;
virtual bool isSaving() { return false; }
/**
Return the owner of the calendar's full name.
*/
const QString &getOwner() const;
/**
Set the owner of the calendar. Should be owner's full name.
*/
void setOwner( const QString &os );
/**
Return the email address of the calendar owner.
*/
const QString &getEmail();
/**
Set the email address of the calendar owner.
*/
void setEmail( const QString & );
/**
Set time zone from a timezone string (e.g. -2:00)
*/
void setTimeZone( const QString &tz );
/**
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 3c572f0..09ce9f0 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -201,48 +201,61 @@ bool CalendarLocal::addTodo( Todo *todo )
void CalendarLocal::deleteTodo( Todo *todo )
{
// Handle orphaned children
removeRelations( todo );
if ( mTodoList.removeRef( todo ) ) {
setModified( true );
}
}
QPtrList<Todo> CalendarLocal::rawTodos()
{
return mTodoList;
}
Todo *CalendarLocal::todo( int id )
{
Todo *todo;
for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
if ( todo->zaurusId() == id ) return todo;
}
return 0;
}
+QPtrList<Event> CalendarLocal::getExternLastSyncEvents()
+{
+ QPtrList<Event> el;
+ Event *todo;
+ for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
+ if ( todo->uid().left( 15 ) == QString("last-syncEvent-") )
+ if ( todo->summary().left(3) == "E: " )
+ el.append( todo );
+ }
+
+ return el;
+
+}
Event *CalendarLocal::event( int id )
{
Event *todo;
for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
if ( todo->zaurusId() == id ) return todo;
}
return 0;
}
Todo *CalendarLocal::todo( const QString &uid )
{
Todo *todo;
for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
if ( todo->uid() == uid ) return todo;
}
return 0;
}
QString CalendarLocal::nextSummary() const
{
return mNextSummary;
}
QDateTime CalendarLocal::nextAlarmEventDateTime() const
{
@@ -299,49 +312,48 @@ void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted
}
newNextAlarm = true;
}
if ( newNextAlarm )
registerAlarm();
}
QString CalendarLocal:: getAlarmNotification()
{
QString ret;
// this should not happen
if (! mNextAlarmIncidence )
return "cal_alarm"+ mNextSummary.left( 25 )+"\n"+mNextAlarmEventDateTimeString;
Alarm* alarm = mNextAlarmIncidence->alarms().first();
if ( alarm->type() == Alarm::Procedure ) {
ret = "proc_alarm" + alarm->programFile()+"+++";
} else {
ret = "audio_alarm" +alarm->audioFile() +"+++";
}
ret += "cal_alarm"+ mNextSummary.left( 25 );
if ( mNextSummary.length() > 25 )
ret += "\n" + mNextSummary.mid(25, 25 );
ret+= "\n"+mNextAlarmEventDateTimeString;
return ret;
}
-
void CalendarLocal::registerAlarm()
{
mLastAlarmNotificationString = getAlarmNotification();
// qDebug("++ register Alarm %s %s",mNextAlarmDateTime.toString().latin1(), mLastAlarmNotificationString.latin1() );
emit addAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString );
// #ifndef DESKTOP_VERSION
// AlarmServer::addAlarm ( mNextAlarmDateTime,"koalarm", mLastAlarmNotificationString.latin1() );
// #endif
}
void CalendarLocal::deRegisterAlarm()
{
if ( mLastAlarmNotificationString.isNull() )
return;
//qDebug("-- deregister Alarm %s ", mLastAlarmNotificationString.latin1() );
emit removeAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString );
// #ifndef DESKTOP_VERSION
// AlarmServer::deleteAlarm (mNextAlarmDateTime ,"koalarm" ,mLastAlarmNotificationString.latin1() );
// #endif
}
QPtrList<Todo> CalendarLocal::todos( const QDate &date )
{
QPtrList<Todo> todos;
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index a2e50e3..3257198 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -64,49 +64,49 @@ class CalendarLocal : public Calendar
*/
void close();
void save() {}
/**
Add Event to calendar.
*/
bool addAnniversaryNoDup( Event *event );
bool addEventNoDup( Event *event );
bool addEvent( Event *event );
/**
Deletes an event from this calendar.
*/
void deleteEvent( Event *event );
/**
Retrieves an event on the basis of the unique string ID.
*/
Event *event( const QString &uid );
/**
Return unfiltered list of all events in calendar.
*/
QPtrList<Event> rawEvents();
-
+ QPtrList<Event> getExternLastSyncEvents();
/**
Add a todo to the todolist.
*/
bool addTodo( Todo *todo );
bool addTodoNoDup( Todo *todo );
/**
Remove a todo from the todolist.
*/
void deleteTodo( Todo * );
/**
Searches todolist for an event with this unique string identifier,
returns a pointer or null.
*/
Todo *todo( const QString &uid );
/**
Return list of all todos.
*/
QPtrList<Todo> rawTodos();
/**
Returns list of todos due on the specified date.
*/
QPtrList<Todo> todos( const QDate &date );
/**
Return list of all todos.