summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2004-08-07 16:10:09 (UTC)
committer zautrix <zautrix>2004-08-07 16:10:09 (UTC)
commitef8a09ce74ad3f0a51484d03fdf009bd5b3677bf (patch) (unidiff)
tree7ff6c37e8ad6b7f1dbd672d28de6fcea916caf8f /korganizer
parenta9a774e19c02f03de948b6064804b913abd4f08b (diff)
downloadkdepimpi-ef8a09ce74ad3f0a51484d03fdf009bd5b3677bf.zip
kdepimpi-ef8a09ce74ad3f0a51484d03fdf009bd5b3677bf.tar.gz
kdepimpi-ef8a09ce74ad3f0a51484d03fdf009bd5b3677bf.tar.bz2
Fix of the syncprofiles
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
@@ -1152,48 +1152,52 @@ bool CalendarView::syncCalendar(QString filename, int mode)
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 ) {
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index d564473..b2838db 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -404,48 +404,49 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
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();
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 424fa98..446fe2e 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -189,48 +189,51 @@ class KOPrefs : public KPimPrefs
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;
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index c3c4c26..062c95f 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -876,49 +876,55 @@ int MainWindow::ringSync()
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;
@@ -2016,34 +2022,42 @@ void MainWindow::syncSSH()
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
@@ -54,48 +54,49 @@ class MainWindow : public QMainWindow
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;