summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp4
-rw-r--r--korganizer/calendarview.h1
-rw-r--r--korganizer/koprefs.h3
-rw-r--r--korganizer/mainwindow.cpp16
-rw-r--r--korganizer/mainwindow.h1
5 files changed, 24 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index f859b90..689618d 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1128,96 +1128,100 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1128 if ( mGlobalSyncMode == SYNC_MODE_NORMAL) 1128 if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
1129 remote->addEvent( eventRSync ); 1129 remote->addEvent( eventRSync );
1130 QString mes; 1130 QString mes;
1131 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 ); 1131 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 );
1132 if ( KOPrefs::instance()->mShowSyncSummary ) { 1132 if ( KOPrefs::instance()->mShowSyncSummary ) {
1133 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); 1133 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") );
1134 } 1134 }
1135 qDebug( mes ); 1135 qDebug( mes );
1136 mCalendar->checkAlarmForIncidence( 0, true ); 1136 mCalendar->checkAlarmForIncidence( 0, true );
1137 return syncOK; 1137 return syncOK;
1138} 1138}
1139 1139
1140void CalendarView::setSyncDevice( QString s ) 1140void CalendarView::setSyncDevice( QString s )
1141{ 1141{
1142 mCurrentSyncDevice= s; 1142 mCurrentSyncDevice= s;
1143} 1143}
1144void CalendarView::setSyncName( QString s ) 1144void CalendarView::setSyncName( QString s )
1145{ 1145{
1146 mCurrentSyncName= s; 1146 mCurrentSyncName= s;
1147} 1147}
1148bool CalendarView::syncCalendar(QString filename, int mode) 1148bool CalendarView::syncCalendar(QString filename, int mode)
1149{ 1149{
1150 mGlobalSyncMode = SYNC_MODE_NORMAL; 1150 mGlobalSyncMode = SYNC_MODE_NORMAL;
1151 CalendarLocal* calendar = new CalendarLocal(); 1151 CalendarLocal* calendar = new CalendarLocal();
1152 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1152 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1153 FileStorage* storage = new FileStorage( calendar ); 1153 FileStorage* storage = new FileStorage( calendar );
1154 bool syncOK = false; 1154 bool syncOK = false;
1155 storage->setFileName( filename ); 1155 storage->setFileName( filename );
1156 // qDebug("loading ... "); 1156 // qDebug("loading ... ");
1157 if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { 1157 if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) {
1158 getEventViewerDialog()->setSyncMode( true ); 1158 getEventViewerDialog()->setSyncMode( true );
1159 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 1159 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
1160 getEventViewerDialog()->setSyncMode( false ); 1160 getEventViewerDialog()->setSyncMode( false );
1161 if ( syncOK ) { 1161 if ( syncOK ) {
1162 if ( KOPrefs::instance()->mWriteBackFile ) 1162 if ( KOPrefs::instance()->mWriteBackFile )
1163 { 1163 {
1164 storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); 1164 storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) );
1165 storage->save(); 1165 storage->save();
1166 } 1166 }
1167 } 1167 }
1168 setModified( true ); 1168 setModified( true );
1169 } 1169 }
1170 delete storage; 1170 delete storage;
1171 delete calendar; 1171 delete calendar;
1172 if ( syncOK ) 1172 if ( syncOK )
1173 updateView(); 1173 updateView();
1174 return syncOK; 1174 return syncOK;
1175} 1175}
1176void CalendarView::syncPhone()
1177{
1178 qDebug("CalendarView::syncPhone() ");
1179}
1176void CalendarView::syncSharp() 1180void CalendarView::syncSharp()
1177{ 1181{
1178#ifndef DESKTOP_VERSION 1182#ifndef DESKTOP_VERSION
1179 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 1183 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1180 //mCurrentSyncDevice = "sharp-DTM"; 1184 //mCurrentSyncDevice = "sharp-DTM";
1181 if ( KOPrefs::instance()->mAskForPreferences ) 1185 if ( KOPrefs::instance()->mAskForPreferences )
1182 edit_sync_options(); 1186 edit_sync_options();
1183 qApp->processEvents(); 1187 qApp->processEvents();
1184 CalendarLocal* calendar = new CalendarLocal(); 1188 CalendarLocal* calendar = new CalendarLocal();
1185 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1189 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1186 bool syncOK = false; 1190 bool syncOK = false;
1187 SharpFormat sharpFormat; 1191 SharpFormat sharpFormat;
1188 if ( sharpFormat.load( calendar, mCalendar ) ) { 1192 if ( sharpFormat.load( calendar, mCalendar ) ) {
1189 getEventViewerDialog()->setSyncMode( true ); 1193 getEventViewerDialog()->setSyncMode( true );
1190 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); 1194 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs );
1191 getEventViewerDialog()->setSyncMode( false ); 1195 getEventViewerDialog()->setSyncMode( false );
1192 qApp->processEvents(); 1196 qApp->processEvents();
1193 if ( syncOK ) { 1197 if ( syncOK ) {
1194 if ( KOPrefs::instance()->mWriteBackFile ) 1198 if ( KOPrefs::instance()->mWriteBackFile )
1195 { 1199 {
1196 QPtrList<Incidence> iL = mCalendar->rawIncidences(); 1200 QPtrList<Incidence> iL = mCalendar->rawIncidences();
1197 Incidence* inc = iL.first(); 1201 Incidence* inc = iL.first();
1198 /* obsolete 1202 /* obsolete
1199 while ( inc ) { 1203 while ( inc ) {
1200 inc->setZaurusStat( inc->revision () ); 1204 inc->setZaurusStat( inc->revision () );
1201 inc = iL.next(); 1205 inc = iL.next();
1202 } 1206 }
1203 */ 1207 */
1204 // pending: clean last sync event description 1208 // pending: clean last sync event description
1205 sharpFormat.save(calendar); 1209 sharpFormat.save(calendar);
1206 iL = calendar->rawIncidences(); 1210 iL = calendar->rawIncidences();
1207 inc = iL.first(); 1211 inc = iL.first();
1208 Incidence* loc; 1212 Incidence* loc;
1209 while ( inc ) { 1213 while ( inc ) {
1210 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { 1214 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
1211 loc = mCalendar->incidence(inc->uid() ); 1215 loc = mCalendar->incidence(inc->uid() );
1212 if ( loc ) { 1216 if ( loc ) {
1213 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); 1217 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
1214 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); 1218 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) );
1215 } 1219 }
1216 } 1220 }
1217 inc = iL.next(); 1221 inc = iL.next();
1218 } 1222 }
1219 Incidence* lse = getLastSyncEvent(); 1223 Incidence* lse = getLastSyncEvent();
1220 if ( lse ) { 1224 if ( lse ) {
1221 lse->setReadOnly( false ); 1225 lse->setReadOnly( false );
1222 lse->setDescription( "" ); 1226 lse->setDescription( "" );
1223 lse->setReadOnly( true ); 1227 lse->setReadOnly( true );
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index d564473..b2838db 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -380,96 +380,97 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
380 QPtrList<CalFilter> filters(); 380 QPtrList<CalFilter> filters();
381 void toggleFilter(); 381 void toggleFilter();
382 void showFilter(bool visible); 382 void showFilter(bool visible);
383 void updateFilter(); 383 void updateFilter();
384 void filterEdited(); 384 void filterEdited();
385 void selectFilter( int ); 385 void selectFilter( int );
386 KOFilterView *filterView(); 386 KOFilterView *filterView();
387 387
388 void showIntro(); 388 void showIntro();
389 389
390 /** Move the curdatepient view date to today */ 390 /** Move the curdatepient view date to today */
391 void goToday(); 391 void goToday();
392 392
393 /** Move to the next date(s) in the current view */ 393 /** Move to the next date(s) in the current view */
394 void goNext(); 394 void goNext();
395 395
396 /** Move to the previous date(s) in the current view */ 396 /** Move to the previous date(s) in the current view */
397 void goPrevious(); 397 void goPrevious();
398 /** Move to the next date(s) in the current view */ 398 /** Move to the next date(s) in the current view */
399 void goNextMonth(); 399 void goNextMonth();
400 400
401 /** Move to the previous date(s) in the current view */ 401 /** Move to the previous date(s) in the current view */
402 void goPreviousMonth(); 402 void goPreviousMonth();
403 403
404 void toggleExpand(); 404 void toggleExpand();
405 void toggleDateNavigatorWidget(); 405 void toggleDateNavigatorWidget();
406 void toggleAllDaySize(); 406 void toggleAllDaySize();
407 void dialogClosing(Incidence *); 407 void dialogClosing(Incidence *);
408 408
409 /** Look for new messages in the inbox */ 409 /** Look for new messages in the inbox */
410 void lookForIncomingMessages(); 410 void lookForIncomingMessages();
411 /** Look for new messages in the outbox */ 411 /** Look for new messages in the outbox */
412 void lookForOutgoingMessages(); 412 void lookForOutgoingMessages();
413 413
414 void processMainViewSelection( Incidence * ); 414 void processMainViewSelection( Incidence * );
415 void processTodoListSelection( Incidence * ); 415 void processTodoListSelection( Incidence * );
416 416
417 void processIncidenceSelection( Incidence * ); 417 void processIncidenceSelection( Incidence * );
418 418
419 void purgeCompleted(); 419 void purgeCompleted();
420 bool removeCompletedSubTodos( Todo* ); 420 bool removeCompletedSubTodos( Todo* );
421 void slotCalendarChanged(); 421 void slotCalendarChanged();
422 bool importBday(); 422 bool importBday();
423 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); 423 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday );
424 bool importQtopia( const QString &categoriesFile, 424 bool importQtopia( const QString &categoriesFile,
425 const QString &datebookFile, 425 const QString &datebookFile,
426 const QString &tasklistFile ); 426 const QString &tasklistFile );
427 void syncSharp( ); 427 void syncSharp( );
428 void syncPhone( );
428 void slotSelectPickerDate( QDate ) ; 429 void slotSelectPickerDate( QDate ) ;
429 void showDatePicker( ) ; 430 void showDatePicker( ) ;
430 void moveIncidence(Incidence *) ; 431 void moveIncidence(Incidence *) ;
431 void beamIncidence(Incidence *) ; 432 void beamIncidence(Incidence *) ;
432 void beamCalendar() ; 433 void beamCalendar() ;
433 void beamFilteredCalendar() ; 434 void beamFilteredCalendar() ;
434 void beamIncidenceList(QPtrList<Incidence>) ; 435 void beamIncidenceList(QPtrList<Incidence>) ;
435 void manageCategories(); 436 void manageCategories();
436 int addCategories(); 437 int addCategories();
437 void removeCategories(); 438 void removeCategories();
438 void setSyncDevice( QString ); 439 void setSyncDevice( QString );
439 void setSyncName( QString ); 440 void setSyncName( QString );
440 protected slots: 441 protected slots:
441 void timerAlarm(); 442 void timerAlarm();
442 void suspendAlarm(); 443 void suspendAlarm();
443 void beamDone( Ir *ir ); 444 void beamDone( Ir *ir );
444 /** Select a view or adapt the current view to display the specified dates. */ 445 /** Select a view or adapt the current view to display the specified dates. */
445 void showDates( const KCal::DateList & ); 446 void showDates( const KCal::DateList & );
446 void selectWeekNum ( int ); 447 void selectWeekNum ( int );
447 448
448 public: 449 public:
449 // show a standard warning 450 // show a standard warning
450 // returns KMsgBox::yesNoCancel() 451 // returns KMsgBox::yesNoCancel()
451 int msgCalModified(); 452 int msgCalModified();
452 void confSync(); 453 void confSync();
453 void setLoadedFileVersion(QDateTime); 454 void setLoadedFileVersion(QDateTime);
454 bool checkFileVersion(QString fn); 455 bool checkFileVersion(QString fn);
455 bool checkFileChanged(QString fn); 456 bool checkFileChanged(QString fn);
456 Event* getLastSyncEvent(); 457 Event* getLastSyncEvent();
457 /** Adapt navigation units correpsonding to step size of navigation of the 458 /** Adapt navigation units correpsonding to step size of navigation of the
458 * current view. 459 * current view.
459 */ 460 */
460 void adaptNavigationUnits(); 461 void adaptNavigationUnits();
461 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); 462 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode );
462 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); 463 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false );
463 //Attendee* getYourAttendee(Event *event); 464 //Attendee* getYourAttendee(Event *event);
464 protected: 465 protected:
465 void schedule(Scheduler::Method, Incidence *incidence = 0); 466 void schedule(Scheduler::Method, Incidence *incidence = 0);
466 467
467 // returns KMsgBox::OKCandel() 468 // returns KMsgBox::OKCandel()
468 int msgItemDelete(); 469 int msgItemDelete();
469 void showEventEditor(); 470 void showEventEditor();
470 void showTodoEditor(); 471 void showTodoEditor();
471 void writeLocale(); 472 void writeLocale();
472 Todo *selectedTodo(); 473 Todo *selectedTodo();
473 474
474 private: 475 private:
475 AlarmDialog * mAlarmDialog; 476 AlarmDialog * mAlarmDialog;
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 424fa98..446fe2e 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -165,96 +165,99 @@ class KOPrefs : public KPimPrefs
165 int mNextXDays; 165 int mNextXDays;
166 int mWhatsNextDays; 166 int mWhatsNextDays;
167 int mWhatsNextPrios; 167 int mWhatsNextPrios;
168 bool mEnableQuickTodo; 168 bool mEnableQuickTodo;
169 bool mLanguageChanged; 169 bool mLanguageChanged;
170 170
171 bool mCompactDialogs; 171 bool mCompactDialogs;
172 bool mVerticalScreen; 172 bool mVerticalScreen;
173 173
174 bool mShowIconNewTodo; 174 bool mShowIconNewTodo;
175 bool mShowIconNewEvent; 175 bool mShowIconNewEvent;
176 bool mShowIconSearch; 176 bool mShowIconSearch;
177 bool mShowIconList; 177 bool mShowIconList;
178 bool mShowIconDay1; 178 bool mShowIconDay1;
179 bool mShowIconDay5; 179 bool mShowIconDay5;
180 bool mShowIconDay7; 180 bool mShowIconDay7;
181 bool mShowIconMonth; 181 bool mShowIconMonth;
182 bool mShowIconTodoview; 182 bool mShowIconTodoview;
183 bool mShowIconBackFast; 183 bool mShowIconBackFast;
184 bool mShowIconBack; 184 bool mShowIconBack;
185 bool mShowIconToday; 185 bool mShowIconToday;
186 bool mShowIconForward; 186 bool mShowIconForward;
187 bool mShowIconForwardFast; 187 bool mShowIconForwardFast;
188 bool mShowIconWhatsThis; 188 bool mShowIconWhatsThis;
189 bool mShowIconNextDays; 189 bool mShowIconNextDays;
190 bool mShowIconNext; 190 bool mShowIconNext;
191 bool mShowIconJournal; 191 bool mShowIconJournal;
192 192
193 bool mShowIconStretch; 193 bool mShowIconStretch;
194 194
195 bool mToolBarHor; 195 bool mToolBarHor;
196 bool mToolBarUp; 196 bool mToolBarUp;
197 bool mToolBarMiniIcons; 197 bool mToolBarMiniIcons;
198 198
199 bool mAskForQuit; 199 bool mAskForQuit;
200 bool mUsePassWd; 200 bool mUsePassWd;
201 bool mWriteBackFile; 201 bool mWriteBackFile;
202 bool mAskForPreferences; 202 bool mAskForPreferences;
203 bool mShowSyncSummary; 203 bool mShowSyncSummary;
204 bool mShowSyncEvents; 204 bool mShowSyncEvents;
205 bool mShowTodoInAgenda; 205 bool mShowTodoInAgenda;
206 bool mWriteBackExistingOnly; 206 bool mWriteBackExistingOnly;
207 207
208 QString mRemoteIP; 208 QString mRemoteIP;
209 QString mRemoteUser; 209 QString mRemoteUser;
210 QString mRemotePassWd; 210 QString mRemotePassWd;
211 QString mRemoteFile; 211 QString mRemoteFile;
212 QString mLocalTempFile; 212 QString mLocalTempFile;
213 QString mPhoneDevice;
214 QString mPhoneConnection;
215 QString mPhoneModel;
213 216
214 int mLastSyncTime; 217 int mLastSyncTime;
215 int mSyncAlgoPrefs; 218 int mSyncAlgoPrefs;
216 int mRingSyncAlgoPrefs; 219 int mRingSyncAlgoPrefs;
217 QStringList mSyncProfileNames; 220 QStringList mSyncProfileNames;
218 QStringList mExternSyncProfiles; 221 QStringList mExternSyncProfiles;
219 QString mLocalMachineName; 222 QString mLocalMachineName;
220 void setCategoryColor(QString cat,const QColor & color); 223 void setCategoryColor(QString cat,const QColor & color);
221 QColor *categoryColor(QString cat); 224 QColor *categoryColor(QString cat);
222 225
223 QString mArchiveFile; 226 QString mArchiveFile;
224 QString mHtmlExportFile; 227 QString mHtmlExportFile;
225 bool mHtmlWithSave; 228 bool mHtmlWithSave;
226 229
227 QStringList mSelectedPlugins; 230 QStringList mSelectedPlugins;
228 231
229 QString mLastImportFile; 232 QString mLastImportFile;
230 QString mLastVcalFile; 233 QString mLastVcalFile;
231 QString mLastSaveFile; 234 QString mLastSaveFile;
232 QString mLastLoadFile; 235 QString mLastLoadFile;
233 QString mLastSyncedLocalFile; 236 QString mLastSyncedLocalFile;
234 237
235 238
236 QString mDefaultAlarmFile; 239 QString mDefaultAlarmFile;
237 int mIMIPScheduler; 240 int mIMIPScheduler;
238 int mIMIPSend; 241 int mIMIPSend;
239 QStringList mAdditionalMails; 242 QStringList mAdditionalMails;
240 int mIMIPAutoRefresh; 243 int mIMIPAutoRefresh;
241 int mIMIPAutoInsertReply; 244 int mIMIPAutoInsertReply;
242 int mIMIPAutoInsertRequest; 245 int mIMIPAutoInsertRequest;
243 int mIMIPAutoFreeBusy; 246 int mIMIPAutoFreeBusy;
244 int mIMIPAutoFreeBusyReply; 247 int mIMIPAutoFreeBusyReply;
245 248
246 QStringList mTodoTemplates; 249 QStringList mTodoTemplates;
247 QStringList mEventTemplates; 250 QStringList mEventTemplates;
248 251
249 int mDestination; 252 int mDestination;
250 253
251 254
252 bool mEditOnDoubleClick; 255 bool mEditOnDoubleClick;
253 bool mViewChangeHoldFullscreen; 256 bool mViewChangeHoldFullscreen;
254 bool mViewChangeHoldNonFullscreen; 257 bool mViewChangeHoldNonFullscreen;
255 bool mCenterOnCurrentTime; 258 bool mCenterOnCurrentTime;
256 bool mSetTimeToDayStartAt; 259 bool mSetTimeToDayStartAt;
257 bool mHighlightCurrentDay; 260 bool mHighlightCurrentDay;
258 bool mUseHighlightLightColor; 261 bool mUseHighlightLightColor;
259 bool mListViewMonthTimespan; 262 bool mListViewMonthTimespan;
260 bool mWNViewShowsParents; 263 bool mWNViewShowsParents;
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index c3c4c26..062c95f 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -852,97 +852,103 @@ void MainWindow::fillSyncMenu()
852 config.sync(); 852 config.sync();
853 delete temp; 853 delete temp;
854 } 854 }
855 KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); 855 KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles");
856 KOPrefs::instance()->mSyncProfileNames = prof; 856 KOPrefs::instance()->mSyncProfileNames = prof;
857 int i; 857 int i;
858 for ( i = 0; i < prof.count(); ++i ) { 858 for ( i = 0; i < prof.count(); ++i ) {
859 859
860 syncMenu->insertItem( prof[i], 1000+i ); 860 syncMenu->insertItem( prof[i], 1000+i );
861 if ( i == 2 ) 861 if ( i == 2 )
862 syncMenu->insertSeparator(); 862 syncMenu->insertSeparator();
863 } 863 }
864 QDir app_dir; 864 QDir app_dir;
865 if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { 865 if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) {
866 syncMenu->setItemEnabled( false , 1000 ); 866 syncMenu->setItemEnabled( false , 1000 );
867 } 867 }
868 mView->setupExternSyncProfiles(); 868 mView->setupExternSyncProfiles();
869} 869}
870 870
871int MainWindow::ringSync() 871int MainWindow::ringSync()
872{ 872{
873 int syncedProfiles = 0; 873 int syncedProfiles = 0;
874 int i; 874 int i;
875 QTime timer; 875 QTime timer;
876 KConfig config ( locateLocal( "config","syncprofilesrc" ) ); 876 KConfig config ( locateLocal( "config","syncprofilesrc" ) );
877 QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; 877 QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames;
878 KSyncProfile* temp = new KSyncProfile (); 878 KSyncProfile* temp = new KSyncProfile ();
879 KOPrefs::instance()->mAskForPreferences = false; 879 KOPrefs::instance()->mAskForPreferences = false;
880 for ( i = 0; i < syncProfileNames.count(); ++i ) { 880 for ( i = 0; i < syncProfileNames.count(); ++i ) {
881 mCurrentSyncProfile = i; 881 mCurrentSyncProfile = i;
882 temp->setName(syncProfileNames[mCurrentSyncProfile]); 882 temp->setName(syncProfileNames[mCurrentSyncProfile]);
883 temp->readConfig(&config); 883 temp->readConfig(&config);
884 if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { 884 if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) {
885 setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); 885 setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
886 ++syncedProfiles; 886 ++syncedProfiles;
887 // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); 887 // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
888 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); 888 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
889 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); 889 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
890 KOPrefs::instance()->mShowSyncSummary = false; 890 KOPrefs::instance()->mShowSyncSummary = false;
891 mView->setSyncDevice(syncProfileNames[i] ); 891 mView->setSyncDevice(syncProfileNames[i] );
892 mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); 892 mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
893 if ( i == 0 ) { 893 if ( i == 0 ) {
894 syncSharp(); 894 syncSharp();
895 } else { 895 } else {
896 if ( temp->getIsLocalFileSync() ) { 896 if ( temp->getIsLocalFileSync() ) {
897 if ( syncWithFile( temp->getRemoteFileName( ), true ) ) 897 if ( syncWithFile( temp->getRemoteFileName( ), true ) )
898 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); 898 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
899 } else { 899 } else {
900 syncRemote( temp, false ); 900 if ( temp->getIsPhoneSync() ) {
901 KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ;
902 KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( );
903 KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( );
904 syncPhone();
905 } else
906 syncRemote( temp, false );
901 907
902 } 908 }
903 } 909 }
904 timer.start(); 910 timer.start();
905 setCaption(i18n("Multiple sync in progress ... please wait!") ); 911 setCaption(i18n("Multiple sync in progress ... please wait!") );
906 while ( timer.elapsed () < 2000 ) { 912 while ( timer.elapsed () < 2000 ) {
907 qApp->processEvents(); 913 qApp->processEvents();
908#ifndef _WIN32_ 914#ifndef _WIN32_
909 sleep (1); 915 sleep (1);
910#endif 916#endif
911 } 917 }
912 918
913 } 919 }
914 920
915 } 921 }
916 delete temp; 922 delete temp;
917 return syncedProfiles; 923 return syncedProfiles;
918} 924}
919 925
920void MainWindow::multiSync( bool askforPrefs ) 926void MainWindow::multiSync( bool askforPrefs )
921{ 927{
922 if (mBlockSaveFlag) 928 if (mBlockSaveFlag)
923 return; 929 return;
924 mBlockSaveFlag = true; 930 mBlockSaveFlag = true;
925 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 931 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
926 if ( QMessageBox::information( this, i18n("KO/Pi Sync"), 932 if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
927 question, 933 question,
928 i18n("Yes"), i18n("No"), 934 i18n("Yes"), i18n("No"),
929 0, 0 ) != 0 ) { 935 0, 0 ) != 0 ) {
930 mBlockSaveFlag = false; 936 mBlockSaveFlag = false;
931 setCaption(i18n("Aborted! Nothing synced!")); 937 setCaption(i18n("Aborted! Nothing synced!"));
932 return; 938 return;
933 } 939 }
934 mView->setSyncDevice(i18n("Multiple profiles") ); 940 mView->setSyncDevice(i18n("Multiple profiles") );
935 KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; 941 KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs;
936 if ( askforPrefs ) { 942 if ( askforPrefs ) {
937 mView->edit_sync_options(); 943 mView->edit_sync_options();
938 KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; 944 KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs;
939 } 945 }
940 setCaption(i18n("Multiple sync started.") ); 946 setCaption(i18n("Multiple sync started.") );
941 qApp->processEvents(); 947 qApp->processEvents();
942 int num = ringSync() ; 948 int num = ringSync() ;
943 if ( num > 1 ) 949 if ( num > 1 )
944 ringSync(); 950 ringSync();
945 mBlockSaveFlag = false; 951 mBlockSaveFlag = false;
946 if ( num ) 952 if ( num )
947 save(); 953 save();
948 if ( num ) 954 if ( num )
@@ -1992,58 +1998,66 @@ void MainWindow::syncSSH()
1992// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); 1998// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
1993// e->setReadOnly( true ); 1999// e->setReadOnly( true );
1994 if ( KOPrefs::instance()->mWriteBackFile ) { 2000 if ( KOPrefs::instance()->mWriteBackFile ) {
1995 command = "scp " + localFile +" " +remoteUser + "@" + remoteIP +":" + remoteFile ; 2001 command = "scp " + localFile +" " +remoteUser + "@" + remoteIP +":" + remoteFile ;
1996 setCaption ( i18n( "Writing back file ..." ) ); 2002 setCaption ( i18n( "Writing back file ..." ) );
1997 result = system ( command ); 2003 result = system ( command );
1998 if ( result != 0 ) { 2004 if ( result != 0 ) {
1999 int len = maxlen; 2005 int len = maxlen;
2000 while ( len < command.length() ) { 2006 while ( len < command.length() ) {
2001 command.insert( len , "\n" ); 2007 command.insert( len , "\n" );
2002 len += maxlen +2; 2008 len += maxlen +2;
2003 } 2009 }
2004 question = i18n("Sorry, the copy back command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; 2010 question = i18n("Sorry, the copy back command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ;
2005 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), 2011 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"),
2006 question, 2012 question,
2007 i18n("Okay!")) ; 2013 i18n("Okay!")) ;
2008 setCaption ("KO/Pi"); 2014 setCaption ("KO/Pi");
2009 return; 2015 return;
2010 } else { 2016 } else {
2011 setCaption ( i18n( "Syncronization sucessfully completed" ) ); 2017 setCaption ( i18n( "Syncronization sucessfully completed" ) );
2012 } 2018 }
2013 } 2019 }
2014 } 2020 }
2015 return; 2021 return;
2016#if 0 2022#if 0
2017 system ("scp zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics /home/polo/Applications/korganizer/z_sync.ics"); 2023 system ("scp zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics /home/polo/Applications/korganizer/z_sync.ics");
2018 while ( timer.elapsed() < 5000 ) 2024 while ( timer.elapsed() < 5000 )
2019 qApp->processEvents(); 2025 qApp->processEvents();
2020 2026
2021 qDebug("MainWindow::merging) "); 2027 qDebug("MainWindow::merging) ");
2022 mView->syncCalendar( "/home/polo/Applications/korganizer/z_sync.ics", 0 ); 2028 mView->syncCalendar( "/home/polo/Applications/korganizer/z_sync.ics", 0 );
2023 while ( mBlockSaveFlag ) 2029 while ( mBlockSaveFlag )
2024 qApp->processEvents(); 2030 qApp->processEvents();
2025 save(); 2031 save();
2026 system ("scp /home/polo/Applications/korganizer/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics"); 2032 system ("scp /home/polo/Applications/korganizer/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics");
2027#endif 2033#endif
2028 2034
2029} 2035}
2030 2036
2031 2037
2032void MainWindow::syncSharp() 2038void MainWindow::syncSharp()
2033{ 2039{
2034 if ( mCalendarModifiedFlag ) 2040 if ( mCalendarModifiedFlag )
2035 save(); 2041 save();
2036 mView->syncSharp(); 2042 mView->syncSharp();
2037 slotModifiedChanged( true ); 2043 slotModifiedChanged( true );
2038 2044
2039} 2045}
2046void MainWindow::syncPhone()
2047{
2048 if ( mCalendarModifiedFlag )
2049 save();
2050 mView->syncPhone();
2051 slotModifiedChanged( true );
2052
2053}
2040 2054
2041void MainWindow::printSel( ) 2055void MainWindow::printSel( )
2042{ 2056{
2043 mView->viewManager()->agendaView()->agenda()->printSelection(); 2057 mView->viewManager()->agendaView()->agenda()->printSelection();
2044} 2058}
2045 2059
2046void MainWindow::printCal() 2060void MainWindow::printCal()
2047{ 2061{
2048 mView->print();//mCp->showDialog(); 2062 mView->print();//mCp->showDialog();
2049} 2063}
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index fba8c52..1d87db0 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -30,91 +30,92 @@ class MainWindow : public QMainWindow
30 public: 30 public:
31 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); 31 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
32 ~MainWindow(); 32 ~MainWindow();
33 public slots: 33 public slots:
34 void configureAgenda( int ); 34 void configureAgenda( int );
35 void recieve( const QCString& msg, const QByteArray& data ); 35 void recieve( const QCString& msg, const QByteArray& data );
36 static QString defaultFileName(); 36 static QString defaultFileName();
37 static QString resourcePath(); 37 static QString resourcePath();
38 protected slots: 38 protected slots:
39 void setCaptionToDates(); 39 void setCaptionToDates();
40 int ringSync(); 40 int ringSync();
41 void multiSync( bool askforPrefs = false ); 41 void multiSync( bool askforPrefs = false );
42 void about(); 42 void about();
43 void licence(); 43 void licence();
44 void faq(); 44 void faq();
45 void usertrans(); 45 void usertrans();
46 void features(); 46 void features();
47 void synchowto(); 47 void synchowto();
48 void whatsNew(); 48 void whatsNew();
49 void keyBindings(); 49 void keyBindings();
50 void aboutAutoSaving();; 50 void aboutAutoSaving();;
51 void aboutKnownBugs(); 51 void aboutKnownBugs();
52 52
53 void processIncidenceSelection( Incidence * ); 53 void processIncidenceSelection( Incidence * );
54 54
55 void importQtopia(); 55 void importQtopia();
56 void importBday(); 56 void importBday();
57 void importOL(); 57 void importOL();
58 void importIcal(); 58 void importIcal();
59 void importFile( QString, bool ); 59 void importFile( QString, bool );
60 void quickImportIcal(); 60 void quickImportIcal();
61 61
62 void slotModifiedChanged( bool ); 62 void slotModifiedChanged( bool );
63 63
64 void save(); 64 void save();
65 void configureToolBar( int ); 65 void configureToolBar( int );
66 void printSel(); 66 void printSel();
67 void printCal(); 67 void printCal();
68 void saveCalendar(); 68 void saveCalendar();
69 void loadCalendar(); 69 void loadCalendar();
70 void exportVCalendar(); 70 void exportVCalendar();
71 void fillFilterMenu(); 71 void fillFilterMenu();
72 void selectFilter( int ); 72 void selectFilter( int );
73 73
74 void slotSyncMenu( int ); 74 void slotSyncMenu( int );
75 void syncSSH(); 75 void syncSSH();
76 void confSync(); 76 void confSync();
77 void syncSharp(); 77 void syncSharp();
78 void syncPhone();
78 void syncLocalFile(); 79 void syncLocalFile();
79 bool syncWithFile( QString, bool ); 80 bool syncWithFile( QString, bool );
80 void quickSyncLocalFile(); 81 void quickSyncLocalFile();
81 82
82 83
83 protected: 84 protected:
84 void displayText( QString, QString); 85 void displayText( QString, QString);
85 void displayFile( QString, QString); 86 void displayFile( QString, QString);
86 87
87 void enableIncidenceActions( bool ); 88 void enableIncidenceActions( bool );
88 89
89 private: 90 private:
90 void saveOnClose(); 91 void saveOnClose();
91 int mCurrentSyncProfile; 92 int mCurrentSyncProfile;
92 void syncRemote( KSyncProfile* , bool ask = true); 93 void syncRemote( KSyncProfile* , bool ask = true);
93 void fillSyncMenu(); 94 void fillSyncMenu();
94 bool mFlagKeyPressed; 95 bool mFlagKeyPressed;
95 bool mBlockAtStartup; 96 bool mBlockAtStartup;
96 QPEToolBar *iconToolBar; 97 QPEToolBar *iconToolBar;
97 void initActions(); 98 void initActions();
98 void setDefaultPreferences(); 99 void setDefaultPreferences();
99 void keyPressEvent ( QKeyEvent * ) ; 100 void keyPressEvent ( QKeyEvent * ) ;
100 void keyReleaseEvent ( QKeyEvent * ) ; 101 void keyReleaseEvent ( QKeyEvent * ) ;
101 QPopupMenu *configureToolBarMenu; 102 QPopupMenu *configureToolBarMenu;
102 QPopupMenu *selectFilterMenu; 103 QPopupMenu *selectFilterMenu;
103 QPopupMenu *configureAgendaMenu, *syncMenu; 104 QPopupMenu *configureAgendaMenu, *syncMenu;
104 CalendarLocal *mCalendar; 105 CalendarLocal *mCalendar;
105 CalendarView *mView; 106 CalendarView *mView;
106 QString getPassword(); 107 QString getPassword();
107 QAction *mNewSubTodoAction; 108 QAction *mNewSubTodoAction;
108 109
109 QAction *mShowAction; 110 QAction *mShowAction;
110 QAction *mEditAction; 111 QAction *mEditAction;
111 QAction *mDeleteAction; 112 QAction *mDeleteAction;
112 void closeEvent( QCloseEvent* ce ); 113 void closeEvent( QCloseEvent* ce );
113 SimpleAlarmClient mAlarmClient; 114 SimpleAlarmClient mAlarmClient;
114 QTimer mSaveTimer; 115 QTimer mSaveTimer;
115 bool mBlockSaveFlag; 116 bool mBlockSaveFlag;
116 bool mCalendarModifiedFlag; 117 bool mCalendarModifiedFlag;
117 QPixmap loadPixmap( QString ); 118 QPixmap loadPixmap( QString );
118}; 119};
119 120
120#endif 121#endif