author | zautrix <zautrix> | 2004-08-02 00:09:04 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-08-02 00:09:04 (UTC) |
commit | 3ebd85e83e6f9d4ac59ce1828548f7236e2b1af0 (patch) (side-by-side diff) | |
tree | fdff56329649c084b6f5af8d8e96c0157686575e /korganizer | |
parent | 3b4aa1cd78395c0f94b99decd901842944765746 (diff) | |
download | kdepimpi-3ebd85e83e6f9d4ac59ce1828548f7236e2b1af0.zip kdepimpi-3ebd85e83e6f9d4ac59ce1828548f7236e2b1af0.tar.gz kdepimpi-3ebd85e83e6f9d4ac59ce1828548f7236e2b1af0.tar.bz2 |
More sync hacking
-rw-r--r-- | korganizer/calendarview.cpp | 76 | ||||
-rw-r--r-- | korganizer/calendarview.h | 5 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 27 | ||||
-rw-r--r-- | korganizer/koprefs.h | 1 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 3 |
5 files changed, 72 insertions, 40 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 ); |