-rw-r--r-- | kaddressbook/kabcore.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 2 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 19 | ||||
-rw-r--r-- | korganizer/calendarview.h | 2 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 10 | ||||
-rw-r--r-- | korganizer/koprefs.h | 1 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 51 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.h | 8 | ||||
-rw-r--r-- | libkdepim/ksyncprefsdialog.cpp | 6 |
9 files changed, 80 insertions, 21 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 033e537..2dea619 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -3260,97 +3260,97 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
3260 | } | 3260 | } |
3261 | } | 3261 | } |
3262 | } | 3262 | } |
3263 | } else { | 3263 | } else { |
3264 | ++filteredOUT; | 3264 | ++filteredOUT; |
3265 | } | 3265 | } |
3266 | } | 3266 | } |
3267 | } | 3267 | } |
3268 | } | 3268 | } |
3269 | ++incCounter; | 3269 | ++incCounter; |
3270 | } | 3270 | } |
3271 | el.clear(); | 3271 | el.clear(); |
3272 | syncManager->hideProgressBar(); | 3272 | syncManager->hideProgressBar(); |
3273 | mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); | 3273 | mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); |
3274 | // get rid of micro seconds | 3274 | // get rid of micro seconds |
3275 | QTime t = mLastAddressbookSync.time(); | 3275 | QTime t = mLastAddressbookSync.time(); |
3276 | mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); | 3276 | mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); |
3277 | addresseeLSync.setRevision( mLastAddressbookSync ); | 3277 | addresseeLSync.setRevision( mLastAddressbookSync ); |
3278 | addresseeRSync.setRevision( mLastAddressbookSync ); | 3278 | addresseeRSync.setRevision( mLastAddressbookSync ); |
3279 | addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; | 3279 | addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; |
3280 | addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); | 3280 | addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); |
3281 | addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; | 3281 | addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; |
3282 | addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); | 3282 | addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); |
3283 | addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; | 3283 | addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; |
3284 | addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); | 3284 | addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); |
3285 | addresseeRSync.setNote( "" ) ; | 3285 | addresseeRSync.setNote( "" ) ; |
3286 | addresseeLSync.setNote( "" ); | 3286 | addresseeLSync.setNote( "" ); |
3287 | 3287 | ||
3288 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) | 3288 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) |
3289 | remote->insertAddressee( addresseeRSync, false ); | 3289 | remote->insertAddressee( addresseeRSync, false ); |
3290 | local->insertAddressee( addresseeLSync, false ); | 3290 | local->insertAddressee( addresseeLSync, false ); |
3291 | QString mes; | 3291 | QString mes; |
3292 | 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 %d incoming filtered out\n %d outgoing filtered out"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR, filteredIN, filteredOUT ); | 3292 | 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 %d incoming filtered out\n %d outgoing filtered out"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR, filteredIN, filteredOUT ); |
3293 | qDebug( mes ); | 3293 | qDebug( mes ); |
3294 | mes = i18n("Local addressbook changed!\n") +mes; | 3294 | mes = i18n("Local addressbook changed!\n") +mes; |
3295 | if ( syncManager->mShowSyncSummary ) { | 3295 | if ( syncManager->mShowSyncSummary ) { |
3296 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, | 3296 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, |
3297 | i18n("KA/Pi Synchronization"),i18n("Write back"))) { | 3297 | i18n("KA/Pi Synchronization"),i18n("Write back"))) { |
3298 | qDebug("KA: WB cancelled "); | 3298 | qDebug("KA: WB cancelled "); |
3299 | syncManager->mWriteBackFile = false; | 3299 | syncManager->mWriteBackFile = false; |
3300 | return syncOK; | 3300 | return syncOK; |
3301 | } | 3301 | } |
3302 | } | 3302 | } |
3303 | return syncOK; | 3303 | return syncOK; |
3304 | } | 3304 | } |
3305 | 3305 | ||
3306 | 3306 | ||
3307 | //this is a overwritten callbackmethods from the syncinterface | 3307 | //this is a overwritten callbackmethods from the syncinterface |
3308 | bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | 3308 | bool KABCore::sync(KSyncManager* manager, QString filename, int mode,QString resource) |
3309 | { | 3309 | { |
3310 | 3310 | ||
3311 | //pending prepare addresseeview for output | 3311 | //pending prepare addresseeview for output |
3312 | //pending detect, if remote file has REV field. if not switch to external sync | 3312 | //pending detect, if remote file has REV field. if not switch to external sync |
3313 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 3313 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
3314 | if ( manager != syncManager ) | 3314 | if ( manager != syncManager ) |
3315 | qDebug("KABCore::sync:: ERROR! :: manager != syncManager "); | 3315 | qDebug("KABCore::sync:: ERROR! :: manager != syncManager "); |
3316 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 3316 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
3317 | 3317 | ||
3318 | AddressBook abLocal(filename,"syncContact"); | 3318 | AddressBook abLocal(filename,"syncContact"); |
3319 | bool syncOK = false; | 3319 | bool syncOK = false; |
3320 | if ( abLocal.load() ) { | 3320 | if ( abLocal.load() ) { |
3321 | qDebug("KA: Sync::AB loaded %s,sync mode %d",filename.latin1(), mode ); | 3321 | qDebug("KA: Sync::AB loaded %s,sync mode %d",filename.latin1(), mode ); |
3322 | bool external = false; | 3322 | bool external = false; |
3323 | bool isXML = false; | 3323 | bool isXML = false; |
3324 | if ( filename.right(4) == ".xml") { | 3324 | if ( filename.right(4) == ".xml") { |
3325 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3325 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3326 | isXML = true; | 3326 | isXML = true; |
3327 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); | 3327 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); |
3328 | } else { | 3328 | } else { |
3329 | external = !manager->mIsKapiFile; | 3329 | external = !manager->mIsKapiFile; |
3330 | if ( external ) { | 3330 | if ( external ) { |
3331 | qDebug("KA: Sync::Setting vcf mode to external "); | 3331 | qDebug("KA: Sync::Setting vcf mode to external "); |
3332 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3332 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3333 | AddressBook::Iterator it; | 3333 | AddressBook::Iterator it; |
3334 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | 3334 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |
3335 | (*it).setID( mCurrentSyncDevice, (*it).uid() ); | 3335 | (*it).setID( mCurrentSyncDevice, (*it).uid() ); |
3336 | (*it).computeCsum( mCurrentSyncDevice ); | 3336 | (*it).computeCsum( mCurrentSyncDevice ); |
3337 | } | 3337 | } |
3338 | } | 3338 | } |
3339 | } | 3339 | } |
3340 | //AddressBook::Iterator it; | 3340 | //AddressBook::Iterator it; |
3341 | //QStringList vcards; | 3341 | //QStringList vcards; |
3342 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | 3342 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |
3343 | // qDebug("Name %s ", (*it).familyName().latin1()); | 3343 | // qDebug("Name %s ", (*it).familyName().latin1()); |
3344 | //} | 3344 | //} |
3345 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); | 3345 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); |
3346 | syncManager->hideProgressBar(); | 3346 | syncManager->hideProgressBar(); |
3347 | if ( syncOK ) { | 3347 | if ( syncOK ) { |
3348 | if ( syncManager->mWriteBackFile ) | 3348 | if ( syncManager->mWriteBackFile ) |
3349 | { | 3349 | { |
3350 | if ( external ) | 3350 | if ( external ) |
3351 | abLocal.removeSyncAddressees( !isXML); | 3351 | abLocal.removeSyncAddressees( !isXML); |
3352 | qDebug("KA: Sync::Saving remote AB "); | 3352 | qDebug("KA: Sync::Saving remote AB "); |
3353 | if ( ! abLocal.saveAB()) | 3353 | if ( ! abLocal.saveAB()) |
3354 | qDebug("KA: sync::Error writing back AB to file "); | 3354 | qDebug("KA: sync::Error writing back AB to file "); |
3355 | if ( external ) { | 3355 | if ( external ) { |
3356 | // afterwrite processing | 3356 | // afterwrite processing |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 42b7709..c4a0b3b 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -467,69 +467,69 @@ class KABCore : public QWidget, public KSyncInterface | |||
467 | KAction *mActionConfigGlobal; | 467 | KAction *mActionConfigGlobal; |
468 | KAction *mActionConfigKAddressbook; | 468 | KAction *mActionConfigKAddressbook; |
469 | KAction *mActionConfigShortcuts; | 469 | KAction *mActionConfigShortcuts; |
470 | KAction *mActionConfigureToolbars; | 470 | KAction *mActionConfigureToolbars; |
471 | KAction *mActionKeyBindings; | 471 | KAction *mActionKeyBindings; |
472 | KToggleAction *mActionJumpBar; | 472 | KToggleAction *mActionJumpBar; |
473 | KToggleAction *mActionDetails; | 473 | KToggleAction *mActionDetails; |
474 | KAction *mActionWhoAmI; | 474 | KAction *mActionWhoAmI; |
475 | KAction *mActionCategories; | 475 | KAction *mActionCategories; |
476 | KAction *mActionEditCategories; | 476 | KAction *mActionEditCategories; |
477 | KAction *mActionManageCategories; | 477 | KAction *mActionManageCategories; |
478 | KAction *mActionAboutKAddressbook; | 478 | KAction *mActionAboutKAddressbook; |
479 | KAction *mActionLicence; | 479 | KAction *mActionLicence; |
480 | KAction *mActionFaq; | 480 | KAction *mActionFaq; |
481 | KAction *mActionWN; | 481 | KAction *mActionWN; |
482 | KAction *mActionSyncHowto; | 482 | KAction *mActionSyncHowto; |
483 | KAction *mActionStorageHowto; | 483 | KAction *mActionStorageHowto; |
484 | KAction *mActionKdeSyncHowto; | 484 | KAction *mActionKdeSyncHowto; |
485 | KAction *mActionMultiSyncHowto; | 485 | KAction *mActionMultiSyncHowto; |
486 | 486 | ||
487 | KAction *mActionDeleteView; | 487 | KAction *mActionDeleteView; |
488 | 488 | ||
489 | QPopupMenu *viewMenu; | 489 | QPopupMenu *viewMenu; |
490 | QPopupMenu *filterMenu; | 490 | QPopupMenu *filterMenu; |
491 | QPopupMenu *settingsMenu; | 491 | QPopupMenu *settingsMenu; |
492 | QPopupMenu *changeMenu; | 492 | QPopupMenu *changeMenu; |
493 | QPopupMenu *beamMenu; | 493 | QPopupMenu *beamMenu; |
494 | //US QAction *mActionSave; | 494 | //US QAction *mActionSave; |
495 | QPopupMenu *ImportMenu; | 495 | QPopupMenu *ImportMenu; |
496 | QPopupMenu *ExportMenu; | 496 | QPopupMenu *ExportMenu; |
497 | //LR additional methods | 497 | //LR additional methods |
498 | KAction *mActionRemoveVoice; | 498 | KAction *mActionRemoveVoice; |
499 | KAction *mActionSetFormattedName; | 499 | KAction *mActionSetFormattedName; |
500 | KAction * mActionImportOL; | 500 | KAction * mActionImportOL; |
501 | 501 | ||
502 | #ifndef KAB_EMBEDDED | 502 | #ifndef KAB_EMBEDDED |
503 | KAddressBookService *mAddressBookService; | 503 | KAddressBookService *mAddressBookService; |
504 | #endif //KAB_EMBEDDED | 504 | #endif //KAB_EMBEDDED |
505 | 505 | ||
506 | class KABCorePrivate; | 506 | class KABCorePrivate; |
507 | KABCorePrivate *d; | 507 | KABCorePrivate *d; |
508 | //US bool mBlockSaveFlag; | 508 | //US bool mBlockSaveFlag; |
509 | 509 | ||
510 | #ifdef KAB_EMBEDDED | 510 | #ifdef KAB_EMBEDDED |
511 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient | 511 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient |
512 | #endif //KAB_EMBEDDED | 512 | #endif //KAB_EMBEDDED |
513 | 513 | ||
514 | //this are the overwritten callbackmethods from the syncinterface | 514 | //this are the overwritten callbackmethods from the syncinterface |
515 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 515 | virtual bool sync(KSyncManager* manager, QString filename, int mode,QString resource); |
516 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 516 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
517 | virtual void removeSyncInfo( QString syncProfile); | 517 | virtual void removeSyncInfo( QString syncProfile); |
518 | bool syncPhone(); | 518 | bool syncPhone(); |
519 | void message( QString m , bool startTimer = true); | 519 | void message( QString m , bool startTimer = true); |
520 | 520 | ||
521 | // LR ******************************* | 521 | // LR ******************************* |
522 | // sync stuff! | 522 | // sync stuff! |
523 | QString sentSyncFile(); | 523 | QString sentSyncFile(); |
524 | QPopupMenu *syncMenu; | 524 | QPopupMenu *syncMenu; |
525 | KSyncManager* syncManager; | 525 | KSyncManager* syncManager; |
526 | int mGlobalSyncMode; | 526 | int mGlobalSyncMode; |
527 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); | 527 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); |
528 | KABC::Addressee getLastSyncAddressee(); | 528 | KABC::Addressee getLastSyncAddressee(); |
529 | QDateTime mLastAddressbookSync; | 529 | QDateTime mLastAddressbookSync; |
530 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); | 530 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); |
531 | // ********************* | 531 | // ********************* |
532 | 532 | ||
533 | }; | 533 | }; |
534 | 534 | ||
535 | #endif | 535 | #endif |
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 31e103d..8965d3b 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1933,97 +1933,96 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1933 | mSyncManager->mWriteBackFile = false; | 1933 | mSyncManager->mWriteBackFile = false; |
1934 | return syncOK; | 1934 | return syncOK; |
1935 | } | 1935 | } |
1936 | } | 1936 | } |
1937 | return syncOK; | 1937 | return syncOK; |
1938 | } | 1938 | } |
1939 | 1939 | ||
1940 | void CalendarView::setSyncDevice( QString s ) | 1940 | void CalendarView::setSyncDevice( QString s ) |
1941 | { | 1941 | { |
1942 | mCurrentSyncDevice= s; | 1942 | mCurrentSyncDevice= s; |
1943 | } | 1943 | } |
1944 | void CalendarView::setSyncName( QString s ) | 1944 | void CalendarView::setSyncName( QString s ) |
1945 | { | 1945 | { |
1946 | mCurrentSyncName= s; | 1946 | mCurrentSyncName= s; |
1947 | } | 1947 | } |
1948 | bool CalendarView::syncCalendar(QString filename, int mode) | 1948 | bool CalendarView::syncCalendar(QString filename, int mode) |
1949 | { | 1949 | { |
1950 | //qDebug("syncCalendar %s ", filename.latin1()); | 1950 | //qDebug("syncCalendar %s ", filename.latin1()); |
1951 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 1951 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
1952 | CalendarLocal* calendar = new CalendarLocal(); | 1952 | CalendarLocal* calendar = new CalendarLocal(); |
1953 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1953 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1954 | FileStorage* storage = new FileStorage( calendar ); | 1954 | FileStorage* storage = new FileStorage( calendar ); |
1955 | bool syncOK = false; | 1955 | bool syncOK = false; |
1956 | storage->setFileName( filename ); | 1956 | storage->setFileName( filename ); |
1957 | // qDebug("loading ... "); | 1957 | // qDebug("loading ... "); |
1958 | if ( storage->load() ) { | 1958 | if ( storage->load() ) { |
1959 | getEventViewerDialog()->setSyncMode( true ); | 1959 | getEventViewerDialog()->setSyncMode( true ); |
1960 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); | 1960 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); |
1961 | getEventViewerDialog()->setSyncMode( false ); | 1961 | getEventViewerDialog()->setSyncMode( false ); |
1962 | if ( syncOK ) { | 1962 | if ( syncOK ) { |
1963 | if ( mSyncManager->mWriteBackFile ) | 1963 | if ( mSyncManager->mWriteBackFile ) |
1964 | { | 1964 | { |
1965 | storage->setSaveFormat( new ICalFormat() ); | 1965 | storage->setSaveFormat( new ICalFormat() ); |
1966 | storage->save(); | 1966 | storage->save(); |
1967 | } | 1967 | } |
1968 | } | 1968 | } |
1969 | setModified( true ); | 1969 | setModified( true ); |
1970 | } | 1970 | } |
1971 | delete storage; | 1971 | delete storage; |
1972 | delete calendar; | 1972 | delete calendar; |
1973 | if ( syncOK ) | 1973 | if ( syncOK ) |
1974 | updateView(); | 1974 | updateView(); |
1975 | return syncOK; | 1975 | return syncOK; |
1976 | } | 1976 | } |
1977 | 1977 | ||
1978 | void CalendarView::syncExternal( int mode ) | 1978 | void CalendarView::syncExternal( int mode ) |
1979 | { | 1979 | { |
1980 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 1980 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
1981 | |||
1982 | qApp->processEvents(); | 1981 | qApp->processEvents(); |
1983 | CalendarLocal* calendar = new CalendarLocal(); | 1982 | CalendarLocal* calendar = new CalendarLocal(); |
1984 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1983 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1985 | bool syncOK = false; | 1984 | bool syncOK = false; |
1986 | bool loadSuccess = false; | 1985 | bool loadSuccess = false; |
1987 | PhoneFormat* phoneFormat = 0; | 1986 | PhoneFormat* phoneFormat = 0; |
1988 | emit tempDisableBR(true); | 1987 | emit tempDisableBR(true); |
1989 | #ifndef DESKTOP_VERSION | 1988 | #ifndef DESKTOP_VERSION |
1990 | SharpFormat* sharpFormat = 0; | 1989 | SharpFormat* sharpFormat = 0; |
1991 | if ( mode == 0 ) { // sharp | 1990 | if ( mode == 0 ) { // sharp |
1992 | sharpFormat = new SharpFormat () ; | 1991 | sharpFormat = new SharpFormat () ; |
1993 | loadSuccess = sharpFormat->load( calendar, mCalendar ); | 1992 | loadSuccess = sharpFormat->load( calendar, mCalendar ); |
1994 | 1993 | ||
1995 | } else | 1994 | } else |
1996 | #endif | 1995 | #endif |
1997 | if ( mode == 1 ) { // phone | 1996 | if ( mode == 1 ) { // phone |
1998 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, | 1997 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, |
1999 | mSyncManager->mPhoneDevice, | 1998 | mSyncManager->mPhoneDevice, |
2000 | mSyncManager->mPhoneConnection, | 1999 | mSyncManager->mPhoneConnection, |
2001 | mSyncManager->mPhoneModel); | 2000 | mSyncManager->mPhoneModel); |
2002 | loadSuccess = phoneFormat->load( calendar,mCalendar); | 2001 | loadSuccess = phoneFormat->load( calendar,mCalendar); |
2003 | 2002 | ||
2004 | } else { | 2003 | } else { |
2005 | emit tempDisableBR(false); | 2004 | emit tempDisableBR(false); |
2006 | return; | 2005 | return; |
2007 | } | 2006 | } |
2008 | if ( loadSuccess ) { | 2007 | if ( loadSuccess ) { |
2009 | getEventViewerDialog()->setSyncMode( true ); | 2008 | getEventViewerDialog()->setSyncMode( true ); |
2010 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); | 2009 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
2011 | getEventViewerDialog()->setSyncMode( false ); | 2010 | getEventViewerDialog()->setSyncMode( false ); |
2012 | qApp->processEvents(); | 2011 | qApp->processEvents(); |
2013 | if ( syncOK ) { | 2012 | if ( syncOK ) { |
2014 | if ( mSyncManager->mWriteBackFile ) | 2013 | if ( mSyncManager->mWriteBackFile ) |
2015 | { | 2014 | { |
2016 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); | 2015 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); |
2017 | Incidence* inc = iL.first(); | 2016 | Incidence* inc = iL.first(); |
2018 | if ( phoneFormat ) { | 2017 | if ( phoneFormat ) { |
2019 | while ( inc ) { | 2018 | while ( inc ) { |
2020 | inc->removeID(mCurrentSyncDevice); | 2019 | inc->removeID(mCurrentSyncDevice); |
2021 | inc = iL.next(); | 2020 | inc = iL.next(); |
2022 | } | 2021 | } |
2023 | } | 2022 | } |
2024 | #ifndef DESKTOP_VERSION | 2023 | #ifndef DESKTOP_VERSION |
2025 | if ( sharpFormat ) | 2024 | if ( sharpFormat ) |
2026 | sharpFormat->save(calendar); | 2025 | sharpFormat->save(calendar); |
2027 | #endif | 2026 | #endif |
2028 | if ( phoneFormat ) | 2027 | if ( phoneFormat ) |
2029 | phoneFormat->save(calendar); | 2028 | phoneFormat->save(calendar); |
@@ -4989,107 +4988,121 @@ bool CalendarView::removeCompletedSubTodos( Todo* t ) | |||
4989 | if ( deleteTodo ) { | 4988 | if ( deleteTodo ) { |
4990 | if ( t->isCompleted() && !t->doesRecur()) { | 4989 | if ( t->isCompleted() && !t->doesRecur()) { |
4991 | checkExternalId( t ); | 4990 | checkExternalId( t ); |
4992 | mCalendar->deleteTodo( t ); | 4991 | mCalendar->deleteTodo( t ); |
4993 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); | 4992 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); |
4994 | } | 4993 | } |
4995 | else | 4994 | else |
4996 | deleteTodo = false; | 4995 | deleteTodo = false; |
4997 | } | 4996 | } |
4998 | return deleteTodo; | 4997 | return deleteTodo; |
4999 | 4998 | ||
5000 | } | 4999 | } |
5001 | void CalendarView::purgeCompleted() | 5000 | void CalendarView::purgeCompleted() |
5002 | { | 5001 | { |
5003 | int result = KMessageBox::warningContinueCancel(this, | 5002 | int result = KMessageBox::warningContinueCancel(this, |
5004 | i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); | 5003 | i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); |
5005 | 5004 | ||
5006 | if (result == KMessageBox::Continue) { | 5005 | if (result == KMessageBox::Continue) { |
5007 | 5006 | ||
5008 | QPtrList<Todo> todoCal; | 5007 | QPtrList<Todo> todoCal; |
5009 | QPtrList<Todo> rootTodos; | 5008 | QPtrList<Todo> rootTodos; |
5010 | //QPtrList<Incidence> rel; | 5009 | //QPtrList<Incidence> rel; |
5011 | Todo *aTodo; | 5010 | Todo *aTodo; |
5012 | todoCal = calendar()->todos(); | 5011 | todoCal = calendar()->todos(); |
5013 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { | 5012 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { |
5014 | if ( !aTodo->relatedTo() ) | 5013 | if ( !aTodo->relatedTo() ) |
5015 | rootTodos.append( aTodo ); | 5014 | rootTodos.append( aTodo ); |
5016 | } | 5015 | } |
5017 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { | 5016 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { |
5018 | removeCompletedSubTodos( aTodo ); | 5017 | removeCompletedSubTodos( aTodo ); |
5019 | } | 5018 | } |
5020 | 5019 | ||
5021 | updateView(); | 5020 | updateView(); |
5022 | } | 5021 | } |
5023 | } | 5022 | } |
5024 | 5023 | ||
5025 | void CalendarView::slotCalendarChanged() | 5024 | void CalendarView::slotCalendarChanged() |
5026 | { | 5025 | { |
5027 | ; | 5026 | ; |
5028 | } | 5027 | } |
5029 | 5028 | ||
5030 | void CalendarView::keyPressEvent ( QKeyEvent *e) | 5029 | void CalendarView::keyPressEvent ( QKeyEvent *e) |
5031 | { | 5030 | { |
5032 | //qDebug("CalendarView::keyPressEvent "); | 5031 | //qDebug("CalendarView::keyPressEvent "); |
5033 | e->ignore(); | 5032 | e->ignore(); |
5034 | } | 5033 | } |
5035 | 5034 | ||
5036 | 5035 | ||
5037 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) | 5036 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode,QString resource) |
5038 | { | 5037 | { |
5039 | 5038 | ||
5040 | if ( manager != mSyncManager) | 5039 | if ( manager != mSyncManager) |
5041 | qDebug("KO: Internal error-1. SyncManager mismatch "); | 5040 | qDebug("KO: Internal error-1. SyncManager mismatch "); |
5042 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { | 5041 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { |
5043 | qDebug("KO: SyncKDE request detected!"); | 5042 | qDebug("KO: SyncKDE request detected!"); |
5044 | } | 5043 | } |
5045 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 5044 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
5046 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 5045 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
5047 | return syncCalendar( filename, mode ); | 5046 | if ( !resource.isEmpty() ) { |
5047 | int exclusiveSyncResource = KOPrefs::instance()->getFuzzyCalendarID( resource ); | ||
5048 | qDebug( "KO: Sync request for resource: %s", resource.latin1() ); | ||
5049 | |||
5050 | if ( !exclusiveSyncResource ) { | ||
5051 | qDebug( "KO: Requested sync resource not found: %s", resource.latin1() ); | ||
5052 | return false; | ||
5053 | } | ||
5054 | mCalendar->setDefaultCalendar( exclusiveSyncResource ); | ||
5055 | mCalendar->setDefaultCalendarEnabledOnly(); | ||
5056 | } | ||
5057 | bool result = syncCalendar( filename, mode ); | ||
5058 | if ( !resource.isEmpty() ) | ||
5059 | restoreCalendarSettings(); | ||
5060 | return result; | ||
5048 | } | 5061 | } |
5049 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) | 5062 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) |
5050 | { | 5063 | { |
5051 | //mSyncManager = manager; | 5064 | //mSyncManager = manager; |
5052 | if ( manager != mSyncManager) | 5065 | if ( manager != mSyncManager) |
5053 | qDebug("KO: Internal error-2. SyncManager mismatch "); | 5066 | qDebug("KO: Internal error-2. SyncManager mismatch "); |
5054 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 5067 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
5055 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 5068 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
5056 | if ( resource == "sharp" ) | 5069 | if ( resource == "sharp" ) |
5057 | syncExternal( 0 ); | 5070 | syncExternal( 0 ); |
5058 | if ( resource == "phone" ) | 5071 | if ( resource == "phone" ) |
5059 | syncExternal( 1 ); | 5072 | syncExternal( 1 ); |
5060 | // pending setmodified | 5073 | // pending setmodified |
5061 | return true; | 5074 | return true; |
5062 | } | 5075 | } |
5063 | void CalendarView::setSyncManager(KSyncManager* manager) | 5076 | void CalendarView::setSyncManager(KSyncManager* manager) |
5064 | { | 5077 | { |
5065 | mSyncManager = manager; | 5078 | mSyncManager = manager; |
5066 | } | 5079 | } |
5067 | 5080 | ||
5068 | void CalendarView::removeSyncInfo( QString syncProfile) | 5081 | void CalendarView::removeSyncInfo( QString syncProfile) |
5069 | { | 5082 | { |
5070 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); | 5083 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); |
5071 | mCalendar->removeSyncInfo( syncProfile ); | 5084 | mCalendar->removeSyncInfo( syncProfile ); |
5072 | 5085 | ||
5073 | } | 5086 | } |
5074 | 5087 | ||
5075 | void CalendarView::undo_delete() | 5088 | void CalendarView::undo_delete() |
5076 | { | 5089 | { |
5077 | //qDebug("undo_delete() "); | 5090 | //qDebug("undo_delete() "); |
5078 | Incidence* undo = mCalendar->undoIncidence(); | 5091 | Incidence* undo = mCalendar->undoIncidence(); |
5079 | if ( !undo ) { | 5092 | if ( !undo ) { |
5080 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), | 5093 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), |
5081 | i18n("KO/Pi")); | 5094 | i18n("KO/Pi")); |
5082 | return; | 5095 | return; |
5083 | } | 5096 | } |
5084 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( undo->summary(),0 ) + | 5097 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( undo->summary(),0 ) + |
5085 | i18n("\nAre you sure you want\nto restore this?"), | 5098 | i18n("\nAre you sure you want\nto restore this?"), |
5086 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { | 5099 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { |
5087 | mCalendar->undoDeleteIncidence(); | 5100 | mCalendar->undoDeleteIncidence(); |
5088 | updateView(); | 5101 | updateView(); |
5089 | } | 5102 | } |
5090 | } | 5103 | } |
5091 | 5104 | ||
5092 | void CalendarView::slotViewerClosed() | 5105 | void CalendarView::slotViewerClosed() |
5093 | { | 5106 | { |
5094 | QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); | 5107 | QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); |
5095 | } | 5108 | } |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 80f7ed4..f85b6a3 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -473,97 +473,97 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
473 | 473 | ||
474 | void processMainViewSelection( Incidence * ); | 474 | void processMainViewSelection( Incidence * ); |
475 | void processTodoListSelection( Incidence * ); | 475 | void processTodoListSelection( Incidence * ); |
476 | 476 | ||
477 | void processIncidenceSelection( Incidence * ); | 477 | void processIncidenceSelection( Incidence * ); |
478 | 478 | ||
479 | void purgeCompleted(); | 479 | void purgeCompleted(); |
480 | bool removeCompletedSubTodos( Todo* ); | 480 | bool removeCompletedSubTodos( Todo* ); |
481 | void slotCalendarChanged(); | 481 | void slotCalendarChanged(); |
482 | bool importBday(); | 482 | bool importBday(); |
483 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); | 483 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); |
484 | bool importQtopia( const QString &categoriesFile, | 484 | bool importQtopia( const QString &categoriesFile, |
485 | const QString &datebookFile, | 485 | const QString &datebookFile, |
486 | const QString &tasklistFile ); | 486 | const QString &tasklistFile ); |
487 | void syncExternal( int mode ); | 487 | void syncExternal( int mode ); |
488 | void slotSelectPickerDate( QDate ) ; | 488 | void slotSelectPickerDate( QDate ) ; |
489 | void showDatePicker() ; | 489 | void showDatePicker() ; |
490 | void showDatePickerPopup() ; | 490 | void showDatePickerPopup() ; |
491 | void moveIncidence(Incidence *) ; | 491 | void moveIncidence(Incidence *) ; |
492 | void beamIncidence(Incidence *) ; | 492 | void beamIncidence(Incidence *) ; |
493 | void beamCalendar() ; | 493 | void beamCalendar() ; |
494 | void beamFilteredCalendar() ; | 494 | void beamFilteredCalendar() ; |
495 | void beamIncidenceList(QPtrList<Incidence>) ; | 495 | void beamIncidenceList(QPtrList<Incidence>) ; |
496 | void manageCategories(); | 496 | void manageCategories(); |
497 | void editCategories(); | 497 | void editCategories(); |
498 | int addCategories(); | 498 | int addCategories(); |
499 | void removeCategories(); | 499 | void removeCategories(); |
500 | void setSyncDevice( QString ); | 500 | void setSyncDevice( QString ); |
501 | void setSyncName( QString ); | 501 | void setSyncName( QString ); |
502 | void showDay( QDate ); | 502 | void showDay( QDate ); |
503 | void undo_delete(); | 503 | void undo_delete(); |
504 | protected slots: | 504 | protected slots: |
505 | void resetFocus(); | 505 | void resetFocus(); |
506 | void scrollBarValue(int); | 506 | void scrollBarValue(int); |
507 | void slotViewerClosed(); | 507 | void slotViewerClosed(); |
508 | void timerAlarm(); | 508 | void timerAlarm(); |
509 | void suspendAlarm(); | 509 | void suspendAlarm(); |
510 | void beamDone( Ir *ir ); | 510 | void beamDone( Ir *ir ); |
511 | /** Select a view or adapt the current view to display the specified dates. */ | 511 | /** Select a view or adapt the current view to display the specified dates. */ |
512 | void showDates( const KCal::DateList & ); | 512 | void showDates( const KCal::DateList & ); |
513 | void selectWeekNum ( int ); | 513 | void selectWeekNum ( int ); |
514 | void checkConflictForEvent(); | 514 | void checkConflictForEvent(); |
515 | 515 | ||
516 | public: | 516 | public: |
517 | void createRunningDate4Todo( Todo * runT, QDateTime start , QDateTime end, int secLenRunning, int secLenPausing,int dayInterval ); | 517 | void createRunningDate4Todo( Todo * runT, QDateTime start , QDateTime end, int secLenRunning, int secLenPausing,int dayInterval ); |
518 | // show a standard warning | 518 | // show a standard warning |
519 | // returns KMsgBox::yesNoCancel() | 519 | // returns KMsgBox::yesNoCancel() |
520 | int msgCalModified(); | 520 | int msgCalModified(); |
521 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 521 | virtual bool sync(KSyncManager* manager, QString filename, int mode, QString resource); |
522 | 522 | ||
523 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 523 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
524 | virtual void removeSyncInfo( QString syncProfile); | 524 | virtual void removeSyncInfo( QString syncProfile); |
525 | void setSyncManager(KSyncManager* manager); | 525 | void setSyncManager(KSyncManager* manager); |
526 | void setLoadedFileVersion(QDateTime); | 526 | void setLoadedFileVersion(QDateTime); |
527 | bool checkFileVersion(QString fn); | 527 | bool checkFileVersion(QString fn); |
528 | bool checkAllFileVersions(); | 528 | bool checkAllFileVersions(); |
529 | bool checkFileChanged(QString fn); | 529 | bool checkFileChanged(QString fn); |
530 | Event* getLastSyncEvent(); | 530 | Event* getLastSyncEvent(); |
531 | /** Adapt navigation units correpsonding to step size of navigation of the | 531 | /** Adapt navigation units correpsonding to step size of navigation of the |
532 | * current view. | 532 | * current view. |
533 | */ | 533 | */ |
534 | void adaptNavigationUnits(); | 534 | void adaptNavigationUnits(); |
535 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); | 535 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); |
536 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); | 536 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); |
537 | //Attendee* getYourAttendee(Event *event); | 537 | //Attendee* getYourAttendee(Event *event); |
538 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} | 538 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} |
539 | void setScrollBarStep(int val ); | 539 | void setScrollBarStep(int val ); |
540 | 540 | ||
541 | protected: | 541 | protected: |
542 | Event *mConflictingEvent; | 542 | Event *mConflictingEvent; |
543 | void schedule(Scheduler::Method, Incidence *incidence = 0); | 543 | void schedule(Scheduler::Method, Incidence *incidence = 0); |
544 | 544 | ||
545 | // returns KMsgBox::OKCandel() | 545 | // returns KMsgBox::OKCandel() |
546 | int msgItemDelete(const QString name); | 546 | int msgItemDelete(const QString name); |
547 | void showEventEditor(); | 547 | void showEventEditor(); |
548 | void showTodoEditor(); | 548 | void showTodoEditor(); |
549 | Todo *selectedTodo(); | 549 | Todo *selectedTodo(); |
550 | private: | 550 | private: |
551 | #ifdef DESKTOP_VERSION | 551 | #ifdef DESKTOP_VERSION |
552 | QScrollBar * mDateScrollBar; | 552 | QScrollBar * mDateScrollBar; |
553 | #endif | 553 | #endif |
554 | bool flag_blockConflict; | 554 | bool flag_blockConflict; |
555 | bool flag_blockScrollBar; | 555 | bool flag_blockScrollBar; |
556 | bool flag_checkFileFirsttime; | 556 | bool flag_checkFileFirsttime; |
557 | bool flag_clearallviewsEventDisplay; | 557 | bool flag_clearallviewsEventDisplay; |
558 | bool flag_clearallviewsupdateView; | 558 | bool flag_clearallviewsupdateView; |
559 | QDateTime mNextAlarmDateTime; | 559 | QDateTime mNextAlarmDateTime; |
560 | bool mViewerCallerIsSearchDialog; | 560 | bool mViewerCallerIsSearchDialog; |
561 | bool mBlockShowDates; | 561 | bool mBlockShowDates; |
562 | KSyncManager* mSyncManager; | 562 | KSyncManager* mSyncManager; |
563 | AlarmDialog * mAlarmDialog; | 563 | AlarmDialog * mAlarmDialog; |
564 | QString mAlarmNotification; | 564 | QString mAlarmNotification; |
565 | QString mSuspendAlarmNotification; | 565 | QString mSuspendAlarmNotification; |
566 | QTimer* mSuspendTimer; | 566 | QTimer* mSuspendTimer; |
567 | QTimer* mAlarmTimer; | 567 | QTimer* mAlarmTimer; |
568 | QTimer* mRecheckAlarmTimer; | 568 | QTimer* mRecheckAlarmTimer; |
569 | void computeAlarm( QString ); | 569 | void computeAlarm( QString ); |
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 1b0e5f4..31ef338 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -483,96 +483,106 @@ void KOPrefs::usrReadConfig() | |||
483 | } | 483 | } |
484 | if ( kkf->isRelative ) | 484 | if ( kkf->isRelative ) |
485 | kkf->mFileName = QDir::convertSeparators( KGlobalSettings::calendarDir() + kkf->mSavedFileName ); | 485 | kkf->mFileName = QDir::convertSeparators( KGlobalSettings::calendarDir() + kkf->mSavedFileName ); |
486 | } | 486 | } |
487 | 487 | ||
488 | KPimPrefs::usrReadConfig(); | 488 | KPimPrefs::usrReadConfig(); |
489 | } | 489 | } |
490 | 490 | ||
491 | KopiCalendarFile * KOPrefs::getCalendar( int num ) | 491 | KopiCalendarFile * KOPrefs::getCalendar( int num ) |
492 | { | 492 | { |
493 | return mDefCalColors[num-1]; | 493 | return mDefCalColors[num-1]; |
494 | } | 494 | } |
495 | 495 | ||
496 | KopiCalendarFile * KOPrefs::getNewCalendar() | 496 | KopiCalendarFile * KOPrefs::getNewCalendar() |
497 | { | 497 | { |
498 | KopiCalendarFile * kkf = new KopiCalendarFile(); | 498 | KopiCalendarFile * kkf = new KopiCalendarFile(); |
499 | kkf->mCalNumber = mNextAvailableCalendar; | 499 | kkf->mCalNumber = mNextAvailableCalendar; |
500 | mDefCalColors.resize( mNextAvailableCalendar ); | 500 | mDefCalColors.resize( mNextAvailableCalendar ); |
501 | mDefCalColors[mNextAvailableCalendar-1] = kkf; | 501 | mDefCalColors[mNextAvailableCalendar-1] = kkf; |
502 | ++mNextAvailableCalendar; | 502 | ++mNextAvailableCalendar; |
503 | kkf->mDefaultColor = mEventColor; | 503 | kkf->mDefaultColor = mEventColor; |
504 | kkf->mName = i18n("New Calendar"); | 504 | kkf->mName = i18n("New Calendar"); |
505 | mCalendars.append( kkf ); | 505 | mCalendars.append( kkf ); |
506 | return kkf; | 506 | return kkf; |
507 | } | 507 | } |
508 | void KOPrefs::deleteCalendar( int num ) | 508 | void KOPrefs::deleteCalendar( int num ) |
509 | { | 509 | { |
510 | KopiCalendarFile * kkf = mCalendars.first(); | 510 | KopiCalendarFile * kkf = mCalendars.first(); |
511 | while ( kkf ) { | 511 | while ( kkf ) { |
512 | if ( kkf->mCalNumber == num ) { | 512 | if ( kkf->mCalNumber == num ) { |
513 | qDebug("KOPrefs::deleteCalendar %d ", num ); | 513 | qDebug("KOPrefs::deleteCalendar %d ", num ); |
514 | mCalendars.remove( kkf ); | 514 | mCalendars.remove( kkf ); |
515 | delete kkf; | 515 | delete kkf; |
516 | return; | 516 | return; |
517 | } | 517 | } |
518 | kkf = mCalendars.next(); | 518 | kkf = mCalendars.next(); |
519 | } | 519 | } |
520 | } | 520 | } |
521 | int KOPrefs::getCalendarID( const QString & name ) | 521 | int KOPrefs::getCalendarID( const QString & name ) |
522 | { | 522 | { |
523 | KopiCalendarFile * kkf = mCalendars.first(); | 523 | KopiCalendarFile * kkf = mCalendars.first(); |
524 | while ( kkf ) { | 524 | while ( kkf ) { |
525 | if ( name == kkf->mName) | 525 | if ( name == kkf->mName) |
526 | return kkf->mCalNumber; | 526 | return kkf->mCalNumber; |
527 | kkf = mCalendars.next(); | 527 | kkf = mCalendars.next(); |
528 | } | 528 | } |
529 | return 1; | 529 | return 1; |
530 | } | 530 | } |
531 | int KOPrefs::getFuzzyCalendarID( const QString & name ) | ||
532 | { | ||
533 | KopiCalendarFile * kkf = mCalendars.first(); | ||
534 | while ( kkf ) { | ||
535 | if ( name.lower() == kkf->mName.lower()) | ||
536 | return kkf->mCalNumber; | ||
537 | kkf = mCalendars.next(); | ||
538 | } | ||
539 | return 0; | ||
540 | } | ||
531 | QString KOPrefs::calName( int calNum) const | 541 | QString KOPrefs::calName( int calNum) const |
532 | { | 542 | { |
533 | return (mDefCalColors[calNum-1])->mName; | 543 | return (mDefCalColors[calNum-1])->mName; |
534 | } | 544 | } |
535 | QColor KOPrefs::defaultColor( int calNum ) const | 545 | QColor KOPrefs::defaultColor( int calNum ) const |
536 | { | 546 | { |
537 | if ( calNum == 1 ) return mEventColor; | 547 | if ( calNum == 1 ) return mEventColor; |
538 | return (mDefCalColors[calNum-1])->mDefaultColor; | 548 | return (mDefCalColors[calNum-1])->mDefaultColor; |
539 | } | 549 | } |
540 | void KOPrefs::usrWriteConfig() | 550 | void KOPrefs::usrWriteConfig() |
541 | { | 551 | { |
542 | config()->setGroup("General"); | 552 | config()->setGroup("General"); |
543 | config()->writeEntry("Custom Categories",mCustomCategories); | 553 | config()->writeEntry("Custom Categories",mCustomCategories); |
544 | 554 | ||
545 | config()->setGroup("Personal Settings"); | 555 | config()->setGroup("Personal Settings"); |
546 | config()->writeEntry("user_name",mName); | 556 | config()->writeEntry("user_name",mName); |
547 | config()->writeEntry("user_email",mEmail); | 557 | config()->writeEntry("user_email",mEmail); |
548 | 558 | ||
549 | config()->setGroup("Category Colors"); | 559 | config()->setGroup("Category Colors"); |
550 | QDictIterator<QColor> it(mCategoryColors); | 560 | QDictIterator<QColor> it(mCategoryColors); |
551 | while (it.current()) { | 561 | while (it.current()) { |
552 | config()->writeEntry(it.currentKey(),*(it.current())); | 562 | config()->writeEntry(it.currentKey(),*(it.current())); |
553 | ++it; | 563 | ++it; |
554 | } | 564 | } |
555 | KConfig fc (locateLocal("config","kopicalendarrc")); | 565 | KConfig fc (locateLocal("config","kopicalendarrc")); |
556 | fc.setGroup("CC"); | 566 | fc.setGroup("CC"); |
557 | fc.deleteGroup( "CC"); | 567 | fc.deleteGroup( "CC"); |
558 | fc.setGroup("CC"); | 568 | fc.setGroup("CC"); |
559 | fc.writeEntry("NumberCalendars",mCalendars.count()); | 569 | fc.writeEntry("NumberCalendars",mCalendars.count()); |
560 | int numCal = 1; | 570 | int numCal = 1; |
561 | int writeCal = 0; | 571 | int writeCal = 0; |
562 | while ( numCal < mNextAvailableCalendar ) { | 572 | while ( numCal < mNextAvailableCalendar ) { |
563 | KopiCalendarFile * kkf = mCalendars.first(); | 573 | KopiCalendarFile * kkf = mCalendars.first(); |
564 | while ( kkf ) { | 574 | while ( kkf ) { |
565 | //qDebug("cal num %d %d ", kkf->mCalNumber, numCal); | 575 | //qDebug("cal num %d %d ", kkf->mCalNumber, numCal); |
566 | if ( kkf->mCalNumber == numCal ) { | 576 | if ( kkf->mCalNumber == numCal ) { |
567 | ++writeCal; | 577 | ++writeCal; |
568 | //qDebug("Write calendar %d %d ", numCal , writeCal); | 578 | //qDebug("Write calendar %d %d ", numCal , writeCal); |
569 | QString prefix = "Cal_" + QString::number( writeCal ); | 579 | QString prefix = "Cal_" + QString::number( writeCal ); |
570 | fc.writeEntry( prefix+"_isStandard", kkf->isStandard ); | 580 | fc.writeEntry( prefix+"_isStandard", kkf->isStandard ); |
571 | fc.writeEntry( prefix+"_isEnabled", kkf->isEnabled ); | 581 | fc.writeEntry( prefix+"_isEnabled", kkf->isEnabled ); |
572 | fc.writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled ); | 582 | fc.writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled ); |
573 | fc.writeEntry( prefix+"_isReadOnly", kkf->isReadOnly ); | 583 | fc.writeEntry( prefix+"_isReadOnly", kkf->isReadOnly ); |
574 | fc.writeEntry( prefix+"_isRelative", kkf->isRelative ); | 584 | fc.writeEntry( prefix+"_isRelative", kkf->isRelative ); |
575 | fc.writeEntry( prefix+"_Name", kkf->mName); | 585 | fc.writeEntry( prefix+"_Name", kkf->mName); |
576 | fc.writeEntry( prefix+"_FileName", kkf->mFileName); | 586 | fc.writeEntry( prefix+"_FileName", kkf->mFileName); |
577 | fc.writeEntry( prefix+"_SavedFileName", kkf->mSavedFileName); | 587 | fc.writeEntry( prefix+"_SavedFileName", kkf->mSavedFileName); |
578 | fc.writeEntry( prefix+"_Color",kkf->mDefaultColor); | 588 | fc.writeEntry( prefix+"_Color",kkf->mDefaultColor); |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index bac8010..70da096 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -60,96 +60,97 @@ class KopiCalendarFile : public QObject | |||
60 | mErrorOnLoad = false; | 60 | mErrorOnLoad = false; |
61 | isRelative = false; | 61 | isRelative = false; |
62 | } | 62 | } |
63 | bool isStandard; | 63 | bool isStandard; |
64 | bool isEnabled; | 64 | bool isEnabled; |
65 | bool isAlarmEnabled; | 65 | bool isAlarmEnabled; |
66 | bool isReadOnly; | 66 | bool isReadOnly; |
67 | bool mErrorOnLoad; | 67 | bool mErrorOnLoad; |
68 | QString mName; | 68 | QString mName; |
69 | QString mFileName; | 69 | QString mFileName; |
70 | QString mSavedFileName; | 70 | QString mSavedFileName; |
71 | bool isRelative; | 71 | bool isRelative; |
72 | int mCalNumber; | 72 | int mCalNumber; |
73 | QColor mDefaultColor; | 73 | QColor mDefaultColor; |
74 | QDateTime mLoadDt; | 74 | QDateTime mLoadDt; |
75 | }; | 75 | }; |
76 | class KOPrefs : public KPimPrefs | 76 | class KOPrefs : public KPimPrefs |
77 | { | 77 | { |
78 | public: | 78 | public: |
79 | enum { FormatVCalendar, FormatICalendar }; | 79 | enum { FormatVCalendar, FormatICalendar }; |
80 | enum { MailClientKMail, MailClientSendmail }; | 80 | enum { MailClientKMail, MailClientSendmail }; |
81 | enum { IMIPDummy, IMIPKMail }; | 81 | enum { IMIPDummy, IMIPKMail }; |
82 | enum { IMIPOutbox, IMIPdirectsend }; | 82 | enum { IMIPOutbox, IMIPdirectsend }; |
83 | enum { neverAuto, addressbookAuto, selectedAuto }; | 83 | enum { neverAuto, addressbookAuto, selectedAuto }; |
84 | enum { standardDestination, askDestination }; | 84 | enum { standardDestination, askDestination }; |
85 | 85 | ||
86 | virtual ~KOPrefs(); | 86 | virtual ~KOPrefs(); |
87 | 87 | ||
88 | /** Get instance of KOPrefs. It is made sure that there is only one | 88 | /** Get instance of KOPrefs. It is made sure that there is only one |
89 | instance. */ | 89 | instance. */ |
90 | static KOPrefs *instance(); | 90 | static KOPrefs *instance(); |
91 | 91 | ||
92 | /** Set preferences to default values */ | 92 | /** Set preferences to default values */ |
93 | void usrSetDefaults(); | 93 | void usrSetDefaults(); |
94 | 94 | ||
95 | /** Read preferences from config file */ | 95 | /** Read preferences from config file */ |
96 | void usrReadConfig(); | 96 | void usrReadConfig(); |
97 | 97 | ||
98 | /** Write preferences to config file */ | 98 | /** Write preferences to config file */ |
99 | void usrWriteConfig(); | 99 | void usrWriteConfig(); |
100 | void setCategoryDefaults(); | 100 | void setCategoryDefaults(); |
101 | void setAllDefaults(); | 101 | void setAllDefaults(); |
102 | KopiCalendarFile * getNewCalendar(); | 102 | KopiCalendarFile * getNewCalendar(); |
103 | KopiCalendarFile * getCalendar( int ); | 103 | KopiCalendarFile * getCalendar( int ); |
104 | void deleteCalendar( int ); | 104 | void deleteCalendar( int ); |
105 | QColor defaultColor( int ) const; | 105 | QColor defaultColor( int ) const; |
106 | QString calName( int ) const; | 106 | QString calName( int ) const; |
107 | int getCalendarID( const QString & name ); | 107 | int getCalendarID( const QString & name ); |
108 | int getFuzzyCalendarID( const QString & name ); | ||
108 | protected: | 109 | protected: |
109 | void setTimeZoneIdDefault(); | 110 | void setTimeZoneIdDefault(); |
110 | 111 | ||
111 | /** Fill empty mail fields with default values. */ | 112 | /** Fill empty mail fields with default values. */ |
112 | void fillMailDefaults(); | 113 | void fillMailDefaults(); |
113 | 114 | ||
114 | private: | 115 | private: |
115 | /** Constructor disabled for public. Use instance() to create a KOPrefs | 116 | /** Constructor disabled for public. Use instance() to create a KOPrefs |
116 | object. */ | 117 | object. */ |
117 | KOPrefs(); | 118 | KOPrefs(); |
118 | 119 | ||
119 | static KOPrefs *mInstance; | 120 | static KOPrefs *mInstance; |
120 | QStringList getDefaultList(); | 121 | QStringList getDefaultList(); |
121 | QStringList getLocationDefaultList(); | 122 | QStringList getLocationDefaultList(); |
122 | public: | 123 | public: |
123 | // preferences data | 124 | // preferences data |
124 | KConfig* getConfig(); | 125 | KConfig* getConfig(); |
125 | void setFullName(const QString &); | 126 | void setFullName(const QString &); |
126 | QString fullName(); | 127 | QString fullName(); |
127 | void setEmail(const QString &); | 128 | void setEmail(const QString &); |
128 | QString email(); | 129 | QString email(); |
129 | 130 | ||
130 | QString mAdditional; | 131 | QString mAdditional; |
131 | 132 | ||
132 | bool mEmailControlCenter; | 133 | bool mEmailControlCenter; |
133 | 134 | ||
134 | bool mBcc; | 135 | bool mBcc; |
135 | bool mAutoSave; | 136 | bool mAutoSave; |
136 | int mAutoSaveInterval; | 137 | int mAutoSaveInterval; |
137 | bool mConfirm; | 138 | bool mConfirm; |
138 | 139 | ||
139 | bool mEnableGroupScheduling; | 140 | bool mEnableGroupScheduling; |
140 | bool mEnableProjectView; | 141 | bool mEnableProjectView; |
141 | 142 | ||
142 | int mDefaultFormat; | 143 | int mDefaultFormat; |
143 | int mMailClient; | 144 | int mMailClient; |
144 | 145 | ||
145 | int mStartTime; | 146 | int mStartTime; |
146 | int mDefaultDuration; | 147 | int mDefaultDuration; |
147 | int mAlarmTime; | 148 | int mAlarmTime; |
148 | 149 | ||
149 | int mWorkingHoursStart; | 150 | int mWorkingHoursStart; |
150 | int mWorkingHoursEnd; | 151 | int mWorkingHoursEnd; |
151 | bool mExcludeHolidays; | 152 | bool mExcludeHolidays; |
152 | bool mExcludeSaturdays; | 153 | bool mExcludeSaturdays; |
153 | bool mMarcusBainsShowSeconds; | 154 | bool mMarcusBainsShowSeconds; |
154 | 155 | ||
155 | QFont mTimeBarFont; | 156 | QFont mTimeBarFont; |
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index d71264f..a64eb34 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -151,96 +151,97 @@ void KSyncManager::fillSyncMenu() | |||
151 | insertText = "Sharp_DTM"; | 151 | insertText = "Sharp_DTM"; |
152 | #endif | 152 | #endif |
153 | } | 153 | } |
154 | mSyncMenu->insertItem( insertText, 1000+i ); | 154 | mSyncMenu->insertItem( insertText, 1000+i ); |
155 | clearMenu->insertItem( insertText, 1000+i ); | 155 | clearMenu->insertItem( insertText, 1000+i ); |
156 | if ( i == 2 ) | 156 | if ( i == 2 ) |
157 | mSyncMenu->insertSeparator(); | 157 | mSyncMenu->insertSeparator(); |
158 | } | 158 | } |
159 | QDir app_dir; | 159 | QDir app_dir; |
160 | //US do not display SharpDTM if app is pwmpi, or no sharpfiles available | 160 | //US do not display SharpDTM if app is pwmpi, or no sharpfiles available |
161 | if ( mTargetApp == PWMPI) { | 161 | if ( mTargetApp == PWMPI) { |
162 | mSyncMenu->removeItem( 1000 ); | 162 | mSyncMenu->removeItem( 1000 ); |
163 | clearMenu->removeItem( 1000 ); | 163 | clearMenu->removeItem( 1000 ); |
164 | } | 164 | } |
165 | #ifndef DESKTOP_VERSION | 165 | #ifndef DESKTOP_VERSION |
166 | else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { | 166 | else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { |
167 | mSyncMenu->removeItem( 1000 ); | 167 | mSyncMenu->removeItem( 1000 ); |
168 | clearMenu->removeItem( 1000 ); | 168 | clearMenu->removeItem( 1000 ); |
169 | } | 169 | } |
170 | #endif | 170 | #endif |
171 | mSyncMenu->removeItem( 1002 ); | 171 | mSyncMenu->removeItem( 1002 ); |
172 | clearMenu->removeItem( 1002 ); | 172 | clearMenu->removeItem( 1002 ); |
173 | } | 173 | } |
174 | void KSyncManager::slotClearMenu( int action ) | 174 | void KSyncManager::slotClearMenu( int action ) |
175 | { | 175 | { |
176 | QString syncDevice; | 176 | QString syncDevice; |
177 | if ( action > 999 ) { | 177 | if ( action > 999 ) { |
178 | syncDevice = mSyncProfileNames[action - 1000] ; | 178 | syncDevice = mSyncProfileNames[action - 1000] ; |
179 | } | 179 | } |
180 | 180 | ||
181 | 181 | ||
182 | 182 | ||
183 | int result = 0; | 183 | int result = 0; |
184 | QString sd; | 184 | QString sd; |
185 | if ( syncDevice.isEmpty() ) | 185 | if ( syncDevice.isEmpty() ) |
186 | sd = i18n("Do you want to\nclear all sync info\nof all profiles?"); | 186 | sd = i18n("Do you want to\nclear all sync info\nof all profiles?"); |
187 | else | 187 | else |
188 | sd = i18n("Do you want to\nclear the sync\ninfo of profile\n%1?\n"). arg( syncDevice ); | 188 | sd = i18n("Do you want to\nclear the sync\ninfo of profile\n%1?\n"). arg( syncDevice ); |
189 | 189 | ||
190 | result = QMessageBox::warning( mParent, i18n("Warning!"),sd,i18n("OK"), i18n("Cancel"), 0, | 190 | result = QMessageBox::warning( mParent, i18n("Warning!"),sd,i18n("OK"), i18n("Cancel"), 0, |
191 | 0, 1 ); | 191 | 0, 1 ); |
192 | if ( result ) | 192 | if ( result ) |
193 | return; | 193 | return; |
194 | mImplementation->removeSyncInfo( syncDevice ); | 194 | mImplementation->removeSyncInfo( syncDevice ); |
195 | } | 195 | } |
196 | void KSyncManager::slotSyncMenu( int action ) | 196 | void KSyncManager::slotSyncMenu( int action ) |
197 | { | 197 | { |
198 | qDebug("KSM::syncaction %d ", action); | 198 | qDebug("KSM::syncaction %d ", action); |
199 | mCurrentResourceLocal = ""; | ||
199 | if ( action == 5000 ) | 200 | if ( action == 5000 ) |
200 | return; | 201 | return; |
201 | mSyncWithDesktop = false; | 202 | mSyncWithDesktop = false; |
202 | if ( action == 0 ) { | 203 | if ( action == 0 ) { |
203 | 204 | ||
204 | // seems to be a Qt2 event handling bug | 205 | // seems to be a Qt2 event handling bug |
205 | // syncmenu.clear causes a segfault at first time | 206 | // syncmenu.clear causes a segfault at first time |
206 | // when we call it after the main event loop, it is ok | 207 | // when we call it after the main event loop, it is ok |
207 | // same behaviour when calling OM/Pi via QCOP for the first time | 208 | // same behaviour when calling OM/Pi via QCOP for the first time |
208 | QTimer::singleShot ( 1, this, SLOT ( confSync() ) ); | 209 | QTimer::singleShot ( 1, this, SLOT ( confSync() ) ); |
209 | //confSync(); | 210 | //confSync(); |
210 | 211 | ||
211 | return; | 212 | return; |
212 | } | 213 | } |
213 | if ( action == 1 ) { | 214 | if ( action == 1 ) { |
214 | multiSync( true ); | 215 | multiSync( true ); |
215 | return; | 216 | return; |
216 | } | 217 | } |
217 | if ( action == 2 ) { | 218 | if ( action == 2 ) { |
218 | enableQuick(); | 219 | enableQuick(); |
219 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); | 220 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); |
220 | return; | 221 | return; |
221 | } | 222 | } |
222 | if ( action == 3 ) { | 223 | if ( action == 3 ) { |
223 | delete mServerSocket; | 224 | delete mServerSocket; |
224 | mServerSocket = 0; | 225 | mServerSocket = 0; |
225 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); | 226 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); |
226 | return; | 227 | return; |
227 | } | 228 | } |
228 | 229 | ||
229 | if (blockSave()) | 230 | if (blockSave()) |
230 | return; | 231 | return; |
231 | 232 | ||
232 | setBlockSave(true); | 233 | setBlockSave(true); |
233 | bool silent = false; | 234 | bool silent = false; |
234 | if ( action == 999 ) { | 235 | if ( action == 999 ) { |
235 | //special mode for silent syncing | 236 | //special mode for silent syncing |
236 | action = 1000; | 237 | action = 1000; |
237 | silent = true; | 238 | silent = true; |
238 | } | 239 | } |
239 | 240 | ||
240 | mCurrentSyncProfile = action - 1000 ; | 241 | mCurrentSyncProfile = action - 1000 ; |
241 | mCurrentSyncDevice = mSyncProfileNames[mCurrentSyncProfile] ; | 242 | mCurrentSyncDevice = mSyncProfileNames[mCurrentSyncProfile] ; |
242 | mCurrentSyncName = mLocalMachineName ; | 243 | mCurrentSyncName = mLocalMachineName ; |
243 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 244 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
244 | KSyncProfile* temp = new KSyncProfile (); | 245 | KSyncProfile* temp = new KSyncProfile (); |
245 | temp->setName(mSyncProfileNames[mCurrentSyncProfile]); | 246 | temp->setName(mSyncProfileNames[mCurrentSyncProfile]); |
246 | temp->readConfig(&config); | 247 | temp->readConfig(&config); |
@@ -268,102 +269,105 @@ void KSyncManager::slotSyncMenu( int action ) | |||
268 | mFilterInAB = temp->getFilterInAB(); | 269 | mFilterInAB = temp->getFilterInAB(); |
269 | mFilterOutAB = temp->getFilterOutAB(); | 270 | mFilterOutAB = temp->getFilterOutAB(); |
270 | 271 | ||
271 | if ( action == 1000 ) { | 272 | if ( action == 1000 ) { |
272 | mIsKapiFile = false; | 273 | mIsKapiFile = false; |
273 | #ifdef DESKTOP_VERSION | 274 | #ifdef DESKTOP_VERSION |
274 | syncKDE(); | 275 | syncKDE(); |
275 | #else | 276 | #else |
276 | syncSharp(); | 277 | syncSharp(); |
277 | #endif | 278 | #endif |
278 | 279 | ||
279 | } else if ( action == 1001 ) { | 280 | } else if ( action == 1001 ) { |
280 | syncLocalFile(); | 281 | syncLocalFile(); |
281 | 282 | ||
282 | } else if ( action == 1002 ) { | 283 | } else if ( action == 1002 ) { |
283 | mWriteBackFile = false; | 284 | mWriteBackFile = false; |
284 | mAskForPreferences = false; | 285 | mAskForPreferences = false; |
285 | mShowSyncSummary = false; | 286 | mShowSyncSummary = false; |
286 | mSyncAlgoPrefs = 3; | 287 | mSyncAlgoPrefs = 3; |
287 | quickSyncLocalFile(); | 288 | quickSyncLocalFile(); |
288 | 289 | ||
289 | } else if ( action >= 1003 ) { | 290 | } else if ( action >= 1003 ) { |
290 | if ( temp->getIsLocalFileSync() ) { | 291 | if ( temp->getIsLocalFileSync() ) { |
291 | switch(mTargetApp) | 292 | switch(mTargetApp) |
292 | { | 293 | { |
293 | case (KAPI): | 294 | case (KAPI): |
294 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) | 295 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) |
295 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); | 296 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); |
296 | break; | 297 | break; |
297 | case (KOPI): | 298 | case (KOPI): |
298 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 299 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
299 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); | 300 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); |
300 | break; | 301 | break; |
301 | case (PWMPI): | 302 | case (PWMPI): |
302 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) | 303 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) |
303 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); | 304 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); |
304 | break; | 305 | break; |
305 | default: | 306 | default: |
306 | qDebug("KSM::slotSyncMenu: invalid apptype selected"); | 307 | qDebug("KSM::slotSyncMenu: invalid apptype selected"); |
307 | break; | 308 | break; |
308 | 309 | ||
309 | } | 310 | } |
310 | } else { | 311 | } else { |
311 | if ( temp->getIsPhoneSync() ) { | 312 | if ( temp->getIsPhoneSync() ) { |
312 | mPhoneDevice = temp->getPhoneDevice( ) ; | 313 | mPhoneDevice = temp->getPhoneDevice( ) ; |
313 | mPhoneConnection = temp->getPhoneConnection( ); | 314 | mPhoneConnection = temp->getPhoneConnection( ); |
314 | mPhoneModel = temp->getPhoneModel( ); | 315 | mPhoneModel = temp->getPhoneModel( ); |
315 | syncPhone(); | 316 | syncPhone(); |
316 | } else if ( temp->getIsPiSync() ) { | 317 | } else if ( temp->getIsPiSync()|| temp->getIsPiSyncSpec()) { |
318 | mSpecificResources.clear(); | ||
317 | if ( mTargetApp == KAPI ) { | 319 | if ( mTargetApp == KAPI ) { |
318 | mPassWordPiSync = temp->getRemotePwAB(); | 320 | mPassWordPiSync = temp->getRemotePwAB(); |
319 | mActiveSyncPort = temp->getRemotePortAB(); | 321 | mActiveSyncPort = temp->getRemotePortAB(); |
320 | mActiveSyncIP = temp->getRemoteIPAB(); | 322 | mActiveSyncIP = temp->getRemoteIPAB(); |
321 | } else if ( mTargetApp == KOPI ) { | 323 | } else if ( mTargetApp == KOPI ) { |
324 | if ( temp->getIsPiSyncSpec() ) | ||
325 | mSpecificResources = QStringList::split( ":", temp->getResSpecKopi() ); | ||
322 | mPassWordPiSync = temp->getRemotePw(); | 326 | mPassWordPiSync = temp->getRemotePw(); |
323 | mActiveSyncPort = temp->getRemotePort(); | 327 | mActiveSyncPort = temp->getRemotePort(); |
324 | mActiveSyncIP = temp->getRemoteIP(); | 328 | mActiveSyncIP = temp->getRemoteIP(); |
325 | } else { | 329 | } else { |
326 | mPassWordPiSync = temp->getRemotePwPWM(); | 330 | mPassWordPiSync = temp->getRemotePwPWM(); |
327 | mActiveSyncPort = temp->getRemotePortPWM(); | 331 | mActiveSyncPort = temp->getRemotePortPWM(); |
328 | mActiveSyncIP = temp->getRemoteIPPWM(); | 332 | mActiveSyncIP = temp->getRemoteIPPWM(); |
329 | } | 333 | } |
330 | syncPi(); | 334 | syncPi(); |
331 | while ( !mPisyncFinished ) { | 335 | while ( !mPisyncFinished ) { |
332 | //qDebug("waiting "); | 336 | //qDebug("waiting "); |
333 | qApp->processEvents(); | 337 | qApp->processEvents(); |
334 | } | 338 | } |
335 | } else | 339 | } else |
336 | syncRemote( temp ); | 340 | syncRemote( temp ); |
337 | 341 | ||
338 | } | 342 | } |
339 | } | 343 | } |
340 | delete temp; | 344 | delete temp; |
341 | setBlockSave(false); | 345 | setBlockSave(false); |
342 | } | 346 | } |
343 | 347 | ||
344 | void KSyncManager::enableQuick( bool ask ) | 348 | void KSyncManager::enableQuick( bool ask ) |
345 | { | 349 | { |
346 | bool autoStart; | 350 | bool autoStart; |
347 | bool changed = false; | 351 | bool changed = false; |
348 | if ( ask ) { | 352 | if ( ask ) { |
349 | QDialog dia ( 0, "input-dialog", true ); | 353 | QDialog dia ( 0, "input-dialog", true ); |
350 | QLineEdit lab ( &dia ); | 354 | QLineEdit lab ( &dia ); |
351 | QVBoxLayout lay( &dia ); | 355 | QVBoxLayout lay( &dia ); |
352 | lab.setText( mPrefs->mPassiveSyncPort ); | 356 | lab.setText( mPrefs->mPassiveSyncPort ); |
353 | lay.setMargin(7); | 357 | lay.setMargin(7); |
354 | lay.setSpacing(7); | 358 | lay.setSpacing(7); |
355 | int po = 9197+mTargetApp; | 359 | int po = 9197+mTargetApp; |
356 | QLabel label ( i18n("Port number (Default: %1)\nValid range from 1 to 65535").arg(po), &dia ); | 360 | QLabel label ( i18n("Port number (Default: %1)\nValid range from 1 to 65535").arg(po), &dia ); |
357 | lay.addWidget( &label); | 361 | lay.addWidget( &label); |
358 | lay.addWidget( &lab); | 362 | lay.addWidget( &lab); |
359 | 363 | ||
360 | QLineEdit lepw ( &dia ); | 364 | QLineEdit lepw ( &dia ); |
361 | lepw.setText( mPrefs->mPassiveSyncPw ); | 365 | lepw.setText( mPrefs->mPassiveSyncPw ); |
362 | QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); | 366 | QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); |
363 | lay.addWidget( &label2); | 367 | lay.addWidget( &label2); |
364 | lay.addWidget( &lepw); | 368 | lay.addWidget( &lepw); |
365 | QCheckBox autostart(i18n("Automatically start\nat application startup"), &dia ); | 369 | QCheckBox autostart(i18n("Automatically start\nat application startup"), &dia ); |
366 | lay.addWidget( &autostart); | 370 | lay.addWidget( &autostart); |
367 | autostart.setChecked( mPrefs->mPassiveSyncAutoStart ); | 371 | autostart.setChecked( mPrefs->mPassiveSyncAutoStart ); |
368 | #ifdef DESKTOP_VERSION | 372 | #ifdef DESKTOP_VERSION |
369 | #ifdef _WIN32_ | 373 | #ifdef _WIN32_ |
@@ -458,248 +462,252 @@ void KSyncManager::syncLocalFile() | |||
458 | break; | 462 | break; |
459 | case (PWMPI): | 463 | case (PWMPI): |
460 | ext = "(*.pwm)"; | 464 | ext = "(*.pwm)"; |
461 | break; | 465 | break; |
462 | default: | 466 | default: |
463 | qDebug("KSM::syncLocalFile: invalid apptype selected"); | 467 | qDebug("KSM::syncLocalFile: invalid apptype selected"); |
464 | break; | 468 | break; |
465 | 469 | ||
466 | } | 470 | } |
467 | 471 | ||
468 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent ); | 472 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent ); |
469 | if ( fn == "" ) | 473 | if ( fn == "" ) |
470 | return; | 474 | return; |
471 | if ( syncWithFile( fn, false ) ) { | 475 | if ( syncWithFile( fn, false ) ) { |
472 | qDebug("KSM::syncLocalFile() successful "); | 476 | qDebug("KSM::syncLocalFile() successful "); |
473 | } | 477 | } |
474 | 478 | ||
475 | } | 479 | } |
476 | 480 | ||
477 | bool KSyncManager::syncWithFile( QString fn , bool quick ) | 481 | bool KSyncManager::syncWithFile( QString fn , bool quick ) |
478 | { | 482 | { |
479 | bool ret = false; | 483 | bool ret = false; |
480 | QFileInfo info; | 484 | QFileInfo info; |
481 | info.setFile( fn ); | 485 | info.setFile( fn ); |
482 | QString mess; | 486 | QString mess; |
483 | if ( !info. exists() ) { | 487 | if ( !info. exists() ) { |
484 | mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); | 488 | mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); |
485 | QMessageBox::warning( mParent, i18n("Warning!"), | 489 | QMessageBox::warning( mParent, i18n("Warning!"), |
486 | mess ); | 490 | mess ); |
487 | return ret; | 491 | return ret; |
488 | } | 492 | } |
489 | int result = 0; | 493 | int result = 0; |
490 | if ( !quick ) { | 494 | if ( !quick ) { |
491 | mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 495 | mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
492 | result = QMessageBox::warning( mParent, i18n("Warning!"), | 496 | result = QMessageBox::warning( mParent, i18n("Warning!"), |
493 | mess, | 497 | mess, |
494 | i18n("Sync"), i18n("Cancel"), 0, | 498 | i18n("Sync"), i18n("Cancel"), 0, |
495 | 0, 1 ); | 499 | 0, 1 ); |
496 | if ( result ) | 500 | if ( result ) |
497 | return false; | 501 | return false; |
498 | } | 502 | } |
499 | if ( mAskForPreferences ) | 503 | if ( mAskForPreferences ) |
500 | if ( !edit_sync_options()) { | 504 | if ( !edit_sync_options()) { |
501 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); | 505 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); |
502 | return false; | 506 | return false; |
503 | } | 507 | } |
504 | if ( result == 0 ) { | 508 | if ( result == 0 ) { |
505 | //qDebug("Now sycing ... "); | 509 | //qDebug("Now sycing ... "); |
506 | if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) | 510 | if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ,mCurrentResourceLocal ) ) |
507 | mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); | 511 | mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); |
508 | else | 512 | else |
509 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); | 513 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); |
510 | if ( ! quick ) | 514 | if ( ! quick ) |
511 | mPrefs->mLastSyncedLocalFile = fn; | 515 | mPrefs->mLastSyncedLocalFile = fn; |
512 | } | 516 | } |
513 | return ret; | 517 | return ret; |
514 | } | 518 | } |
515 | 519 | ||
516 | void KSyncManager::quickSyncLocalFile() | 520 | void KSyncManager::quickSyncLocalFile() |
517 | { | 521 | { |
518 | 522 | ||
519 | if ( syncWithFile( mPrefs->mLastSyncedLocalFile, true ) ) { | 523 | if ( syncWithFile( mPrefs->mLastSyncedLocalFile, true ) ) { |
520 | qDebug("KSM::quick syncLocalFile() successful "); | 524 | qDebug("KSM::quick syncLocalFile() successful "); |
521 | 525 | ||
522 | } | 526 | } |
523 | } | 527 | } |
524 | 528 | ||
525 | void KSyncManager::multiSync( bool askforPrefs ) | 529 | void KSyncManager::multiSync( bool askforPrefs ) |
526 | { | 530 | { |
527 | if (blockSave()) | 531 | if (blockSave()) |
528 | return; | 532 | return; |
529 | setBlockSave(true); | 533 | setBlockSave(true); |
534 | mCurrentResourceLocal = ""; | ||
530 | if ( askforPrefs ) { | 535 | if ( askforPrefs ) { |
531 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); | 536 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); |
532 | if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"), | 537 | if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"), |
533 | question, | 538 | question, |
534 | i18n("Yes"), i18n("No"), | 539 | i18n("Yes"), i18n("No"), |
535 | 0, 0 ) != 0 ) { | 540 | 0, 0 ) != 0 ) { |
536 | setBlockSave(false); | 541 | setBlockSave(false); |
537 | mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!")); | 542 | mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!")); |
538 | return; | 543 | return; |
539 | } | 544 | } |
540 | } | 545 | } |
541 | mCurrentSyncDevice = i18n("Multiple profiles") ; | 546 | mCurrentSyncDevice = i18n("Multiple profiles") ; |
542 | mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; | 547 | mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; |
543 | if ( askforPrefs ) { | 548 | if ( askforPrefs ) { |
544 | if ( !edit_sync_options()) { | 549 | if ( !edit_sync_options()) { |
545 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted.") ); | 550 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted.") ); |
546 | return; | 551 | return; |
547 | } | 552 | } |
548 | mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs; | 553 | mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs; |
549 | } | 554 | } |
550 | mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") ); | 555 | mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") ); |
551 | qApp->processEvents(); | 556 | qApp->processEvents(); |
552 | int num = ringSync() ; | 557 | int num = ringSync() ; |
553 | if ( num > 1 ) | 558 | if ( num > 1 ) |
554 | ringSync(); | 559 | ringSync(); |
555 | setBlockSave(false); | 560 | setBlockSave(false); |
556 | if ( num ) | 561 | if ( num ) |
557 | emit save(); | 562 | emit save(); |
558 | if ( num ) | 563 | if ( num ) |
559 | mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) ); | 564 | mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) ); |
560 | else | 565 | else |
561 | mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); | 566 | mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); |
562 | return; | 567 | return; |
563 | } | 568 | } |
564 | 569 | ||
565 | int KSyncManager::ringSync() | 570 | int KSyncManager::ringSync() |
566 | { | 571 | { |
567 | 572 | ||
568 | int syncedProfiles = 0; | 573 | int syncedProfiles = 0; |
569 | unsigned int i; | 574 | unsigned int i; |
570 | QTime timer; | 575 | QTime timer; |
571 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 576 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
572 | QStringList syncProfileNames = mSyncProfileNames; | 577 | QStringList syncProfileNames = mSyncProfileNames; |
573 | KSyncProfile* temp = new KSyncProfile (); | 578 | KSyncProfile* temp = new KSyncProfile (); |
574 | mAskForPreferences = false; | 579 | mAskForPreferences = false; |
580 | mCurrentResourceLocal = ""; | ||
575 | for ( i = 0; i < syncProfileNames.count(); ++i ) { | 581 | for ( i = 0; i < syncProfileNames.count(); ++i ) { |
576 | mCurrentSyncProfile = i; | 582 | mCurrentSyncProfile = i; |
577 | temp->setName(syncProfileNames[mCurrentSyncProfile]); | 583 | temp->setName(syncProfileNames[mCurrentSyncProfile]); |
578 | temp->readConfig(&config); | 584 | temp->readConfig(&config); |
579 | 585 | ||
580 | bool includeInRingSync = false; | 586 | bool includeInRingSync = false; |
581 | switch(mTargetApp) | 587 | switch(mTargetApp) |
582 | { | 588 | { |
583 | case (KAPI): | 589 | case (KAPI): |
584 | includeInRingSync = temp->getIncludeInRingSyncAB(); | 590 | includeInRingSync = temp->getIncludeInRingSyncAB(); |
585 | break; | 591 | break; |
586 | case (KOPI): | 592 | case (KOPI): |
587 | includeInRingSync = temp->getIncludeInRingSync(); | 593 | includeInRingSync = temp->getIncludeInRingSync(); |
588 | break; | 594 | break; |
589 | case (PWMPI): | 595 | case (PWMPI): |
590 | includeInRingSync = temp->getIncludeInRingSyncPWM(); | 596 | includeInRingSync = temp->getIncludeInRingSyncPWM(); |
591 | break; | 597 | break; |
592 | default: | 598 | default: |
593 | qDebug("KSM::ringSync: invalid apptype selected"); | 599 | qDebug("KSM::ringSync: invalid apptype selected"); |
594 | break; | 600 | break; |
595 | 601 | ||
596 | } | 602 | } |
597 | 603 | ||
598 | 604 | ||
599 | if ( includeInRingSync && ( i < 1 || i > 2 )) { | 605 | if ( includeInRingSync && ( i < 1 || i > 2 )) { |
600 | mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); | 606 | mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); |
601 | ++syncedProfiles; | 607 | ++syncedProfiles; |
602 | mSyncWithDesktop = false; | 608 | mSyncWithDesktop = false; |
603 | // mAskForPreferences = temp->getAskForPreferences(); | 609 | // mAskForPreferences = temp->getAskForPreferences(); |
604 | mWriteBackFile = temp->getWriteBackFile(); | 610 | mWriteBackFile = temp->getWriteBackFile(); |
605 | mWriteBackExistingOnly = temp->getWriteBackExisting(); | 611 | mWriteBackExistingOnly = temp->getWriteBackExisting(); |
606 | mIsKapiFile = temp->getIsKapiFile(); | 612 | mIsKapiFile = temp->getIsKapiFile(); |
607 | mWriteBackInFuture = 0; | 613 | mWriteBackInFuture = 0; |
608 | if ( temp->getWriteBackFuture() ) { | 614 | if ( temp->getWriteBackFuture() ) { |
609 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); | 615 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); |
610 | mWriteBackInPast = temp->getWriteBackPastWeeks( ); | 616 | mWriteBackInPast = temp->getWriteBackPastWeeks( ); |
611 | } | 617 | } |
612 | mFilterInCal = temp->getFilterInCal(); | 618 | mFilterInCal = temp->getFilterInCal(); |
613 | mFilterOutCal = temp->getFilterOutCal(); | 619 | mFilterOutCal = temp->getFilterOutCal(); |
614 | mFilterInAB = temp->getFilterInAB(); | 620 | mFilterInAB = temp->getFilterInAB(); |
615 | mFilterOutAB = temp->getFilterOutAB(); | 621 | mFilterOutAB = temp->getFilterOutAB(); |
616 | mShowSyncSummary = false; | 622 | mShowSyncSummary = false; |
617 | mCurrentSyncDevice = syncProfileNames[i] ; | 623 | mCurrentSyncDevice = syncProfileNames[i] ; |
618 | mCurrentSyncName = mLocalMachineName; | 624 | mCurrentSyncName = mLocalMachineName; |
619 | if ( i == 0 ) { | 625 | if ( i == 0 ) { |
620 | mIsKapiFile = false; | 626 | mIsKapiFile = false; |
621 | #ifdef DESKTOP_VERSION | 627 | #ifdef DESKTOP_VERSION |
622 | syncKDE(); | 628 | syncKDE(); |
623 | #else | 629 | #else |
624 | syncSharp(); | 630 | syncSharp(); |
625 | #endif | 631 | #endif |
626 | } else { | 632 | } else { |
627 | if ( temp->getIsLocalFileSync() ) { | 633 | if ( temp->getIsLocalFileSync() ) { |
628 | switch(mTargetApp) | 634 | switch(mTargetApp) |
629 | { | 635 | { |
630 | case (KAPI): | 636 | case (KAPI): |
631 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) | 637 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) |
632 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); | 638 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); |
633 | break; | 639 | break; |
634 | case (KOPI): | 640 | case (KOPI): |
635 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 641 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
636 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); | 642 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); |
637 | break; | 643 | break; |
638 | case (PWMPI): | 644 | case (PWMPI): |
639 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) | 645 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) |
640 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); | 646 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); |
641 | break; | 647 | break; |
642 | default: | 648 | default: |
643 | qDebug("KSM: invalid apptype selected"); | 649 | qDebug("KSM: invalid apptype selected"); |
644 | break; | 650 | break; |
645 | } | 651 | } |
646 | } else { | 652 | } else { |
647 | if ( temp->getIsPhoneSync() ) { | 653 | if ( temp->getIsPhoneSync() ) { |
648 | mPhoneDevice = temp->getPhoneDevice( ) ; | 654 | mPhoneDevice = temp->getPhoneDevice( ) ; |
649 | mPhoneConnection = temp->getPhoneConnection( ); | 655 | mPhoneConnection = temp->getPhoneConnection( ); |
650 | mPhoneModel = temp->getPhoneModel( ); | 656 | mPhoneModel = temp->getPhoneModel( ); |
651 | syncPhone(); | 657 | syncPhone(); |
652 | } else if ( temp->getIsPiSync() ) { | 658 | } else if ( temp->getIsPiSync() || temp->getIsPiSyncSpec()) { |
659 | mSpecificResources.clear(); | ||
653 | if ( mTargetApp == KAPI ) { | 660 | if ( mTargetApp == KAPI ) { |
654 | mPassWordPiSync = temp->getRemotePwAB(); | 661 | mPassWordPiSync = temp->getRemotePwAB(); |
655 | mActiveSyncPort = temp->getRemotePortAB(); | 662 | mActiveSyncPort = temp->getRemotePortAB(); |
656 | mActiveSyncIP = temp->getRemoteIPAB(); | 663 | mActiveSyncIP = temp->getRemoteIPAB(); |
657 | } else if ( mTargetApp == KOPI ) { | 664 | } else if ( mTargetApp == KOPI ) { |
665 | mSpecificResources = QStringList::split( ":", temp->getResSpecKopi() ); | ||
658 | mPassWordPiSync = temp->getRemotePw(); | 666 | mPassWordPiSync = temp->getRemotePw(); |
659 | mActiveSyncPort = temp->getRemotePort(); | 667 | mActiveSyncPort = temp->getRemotePort(); |
660 | mActiveSyncIP = temp->getRemoteIP(); | 668 | mActiveSyncIP = temp->getRemoteIP(); |
661 | } else { | 669 | } else { |
662 | mPassWordPiSync = temp->getRemotePwPWM(); | 670 | mPassWordPiSync = temp->getRemotePwPWM(); |
663 | mActiveSyncPort = temp->getRemotePortPWM(); | 671 | mActiveSyncPort = temp->getRemotePortPWM(); |
664 | mActiveSyncIP = temp->getRemoteIPPWM(); | 672 | mActiveSyncIP = temp->getRemoteIPPWM(); |
665 | } | 673 | } |
666 | syncPi(); | 674 | syncPi(); |
667 | while ( !mPisyncFinished ) { | 675 | while ( !mPisyncFinished ) { |
668 | //qDebug("waiting "); | 676 | //qDebug("waiting "); |
669 | qApp->processEvents(); | 677 | qApp->processEvents(); |
670 | } | 678 | } |
671 | timer.start(); | 679 | timer.start(); |
672 | while ( timer.elapsed () < 2000 ) { | 680 | while ( timer.elapsed () < 2000 ) { |
673 | qApp->processEvents(); | 681 | qApp->processEvents(); |
674 | } | 682 | } |
675 | } else | 683 | } else |
676 | syncRemote( temp, false ); | 684 | syncRemote( temp, false ); |
677 | 685 | ||
678 | } | 686 | } |
679 | } | 687 | } |
680 | timer.start(); | 688 | timer.start(); |
681 | mParent->topLevelWidget()->setCaption(i18n("Multiple sync in progress ... please wait!") ); | 689 | mParent->topLevelWidget()->setCaption(i18n("Multiple sync in progress ... please wait!") ); |
682 | while ( timer.elapsed () < 2000 ) { | 690 | while ( timer.elapsed () < 2000 ) { |
683 | qApp->processEvents(); | 691 | qApp->processEvents(); |
684 | #ifndef _WIN32_ | 692 | #ifndef _WIN32_ |
685 | sleep (1); | 693 | sleep (1); |
686 | #endif | 694 | #endif |
687 | } | 695 | } |
688 | 696 | ||
689 | } | 697 | } |
690 | 698 | ||
691 | } | 699 | } |
692 | delete temp; | 700 | delete temp; |
693 | return syncedProfiles; | 701 | return syncedProfiles; |
694 | } | 702 | } |
695 | 703 | ||
696 | void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) | 704 | void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) |
697 | { | 705 | { |
698 | QString question; | 706 | QString question; |
699 | if ( ask ) { | 707 | if ( ask ) { |
700 | question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; | 708 | question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; |
701 | if ( QMessageBox::information( mParent, i18n("Sync"), | 709 | if ( QMessageBox::information( mParent, i18n("Sync"), |
702 | question, | 710 | question, |
703 | i18n("Yes"), i18n("No"), | 711 | i18n("Yes"), i18n("No"), |
704 | 0, 0 ) != 0 ) | 712 | 0, 0 ) != 0 ) |
705 | return; | 713 | return; |
@@ -1082,161 +1090,181 @@ void KSyncManager::hideProgressBar() | |||
1082 | bool KSyncManager::isProgressBarCanceled() | 1090 | bool KSyncManager::isProgressBarCanceled() |
1083 | { | 1091 | { |
1084 | return !bar->isVisible(); | 1092 | return !bar->isVisible(); |
1085 | } | 1093 | } |
1086 | 1094 | ||
1087 | QString KSyncManager::syncFileName() | 1095 | QString KSyncManager::syncFileName() |
1088 | { | 1096 | { |
1089 | 1097 | ||
1090 | QString fn = "tempfile"; | 1098 | QString fn = "tempfile"; |
1091 | switch(mTargetApp) | 1099 | switch(mTargetApp) |
1092 | { | 1100 | { |
1093 | case (KAPI): | 1101 | case (KAPI): |
1094 | fn = "tempsyncab.vcf"; | 1102 | fn = "tempsyncab.vcf"; |
1095 | break; | 1103 | break; |
1096 | case (KOPI): | 1104 | case (KOPI): |
1097 | fn = "tempsynccal.ics"; | 1105 | fn = "tempsynccal.ics"; |
1098 | break; | 1106 | break; |
1099 | case (PWMPI): | 1107 | case (PWMPI): |
1100 | fn = "tempsyncpw.pwm"; | 1108 | fn = "tempsyncpw.pwm"; |
1101 | break; | 1109 | break; |
1102 | default: | 1110 | default: |
1103 | break; | 1111 | break; |
1104 | } | 1112 | } |
1105 | #ifdef DESKTOP_VERSION | 1113 | #ifdef DESKTOP_VERSION |
1106 | return locateLocal( "tmp", fn ); | 1114 | return locateLocal( "tmp", fn ); |
1107 | #else | 1115 | #else |
1108 | return (QString( "/tmp/" )+ fn ); | 1116 | return (QString( "/tmp/" )+ fn ); |
1109 | #endif | 1117 | #endif |
1110 | } | 1118 | } |
1111 | 1119 | ||
1112 | void KSyncManager::syncPi() | 1120 | void KSyncManager::syncPi() |
1113 | { | 1121 | { |
1114 | mIsKapiFile = true; | 1122 | mIsKapiFile = true; |
1115 | mPisyncFinished = false; | 1123 | mPisyncFinished = false; |
1116 | qApp->processEvents(); | 1124 | qApp->processEvents(); |
1117 | if ( mAskForPreferences ) | 1125 | if ( mAskForPreferences ) |
1118 | if ( !edit_pisync_options()) { | 1126 | if ( !edit_pisync_options()) { |
1119 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); | 1127 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); |
1120 | mPisyncFinished = true; | 1128 | mPisyncFinished = true; |
1121 | return; | 1129 | return; |
1122 | } | 1130 | } |
1123 | bool ok; | 1131 | bool ok; |
1124 | Q_UINT16 port = mActiveSyncPort.toUInt(&ok); | 1132 | Q_UINT16 port = mActiveSyncPort.toUInt(&ok); |
1125 | if ( ! ok ) { | 1133 | if ( ! ok ) { |
1126 | mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); | 1134 | mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); |
1127 | mPisyncFinished = true; | 1135 | mPisyncFinished = true; |
1128 | return; | 1136 | return; |
1129 | } | 1137 | } |
1130 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); | 1138 | mCurrentResourceLocal = ""; |
1131 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); | 1139 | mCurrentResourceRemote = ""; |
1132 | commandSocket->readFile( syncFileName() ); | 1140 | if ( mSpecificResources.count() ) { |
1141 | int startLocal = 0; | ||
1142 | int startRemote = mSpecificResources.count()/2; | ||
1143 | while ( startLocal < mSpecificResources.count()/2 ) { | ||
1144 | mPisyncFinished = false; | ||
1145 | mCurrentResourceLocal = mSpecificResources[ startLocal ]; | ||
1146 | mCurrentResourceRemote = mSpecificResources[ startRemote ]; | ||
1147 | KCommandSocket* commandSocket = new KCommandSocket( mCurrentResourceRemote, mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); | ||
1148 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); | ||
1149 | commandSocket->readFile( syncFileName() ); | ||
1150 | while ( !mPisyncFinished ) { | ||
1151 | //qDebug("waiting "); | ||
1152 | qApp->processEvents(); | ||
1153 | } | ||
1154 | ++startLocal; | ||
1155 | } | ||
1156 | } else { | ||
1157 | KCommandSocket* commandSocket = new KCommandSocket( "", mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); | ||
1158 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); | ||
1159 | commandSocket->readFile( syncFileName() ); | ||
1160 | } | ||
1133 | } | 1161 | } |
1134 | 1162 | ||
1135 | void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) | 1163 | void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) |
1136 | { | 1164 | { |
1137 | //enum { success, errorW, errorR, quiet }; | 1165 | //enum { success, errorW, errorR, quiet }; |
1138 | 1166 | ||
1139 | 1167 | ||
1140 | 1168 | ||
1141 | if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ||state == KCommandSocket::errorPW || | 1169 | if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ||state == KCommandSocket::errorPW || |
1142 | state == KCommandSocket::errorCA ||state == KCommandSocket::errorFI ||state == KCommandSocket::errorUN||state == KCommandSocket::errorED ) { | 1170 | state == KCommandSocket::errorCA ||state == KCommandSocket::errorFI ||state == KCommandSocket::errorUN||state == KCommandSocket::errorED ) { |
1143 | if ( state == KCommandSocket::errorPW ) | 1171 | if ( state == KCommandSocket::errorPW ) |
1144 | mParent->topLevelWidget()->setCaption( i18n("Wrong password: Receiving remote file failed.") ); | 1172 | mParent->topLevelWidget()->setCaption( i18n("Wrong password: Receiving remote file failed.") ); |
1145 | else if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) | 1173 | else if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) |
1146 | mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") ); | 1174 | mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") ); |
1147 | else if ( state == KCommandSocket::errorCA ) | 1175 | else if ( state == KCommandSocket::errorCA ) |
1148 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled from remote.") ); | 1176 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled from remote.") ); |
1149 | else if ( state == KCommandSocket::errorFI ) | 1177 | else if ( state == KCommandSocket::errorFI ) |
1150 | mParent->topLevelWidget()->setCaption( i18n("File error on remote.") ); | 1178 | mParent->topLevelWidget()->setCaption( i18n("File error on remote.") ); |
1151 | else if ( state == KCommandSocket::errorED ) | 1179 | else if ( state == KCommandSocket::errorED ) |
1152 | mParent->topLevelWidget()->setCaption( i18n("Please close error dialog on remote.") ); | 1180 | mParent->topLevelWidget()->setCaption( i18n("Please close error dialog on remote.") ); |
1153 | else if ( state == KCommandSocket::errorUN ) | 1181 | else if ( state == KCommandSocket::errorUN ) |
1154 | mParent->topLevelWidget()->setCaption( i18n("Unknown error on remote.") ); | 1182 | mParent->topLevelWidget()->setCaption( i18n("Unknown error on remote.") ); |
1155 | delete s; | 1183 | delete s; |
1156 | if ( state == KCommandSocket::errorR ) { | 1184 | if ( state == KCommandSocket::errorR ) { |
1157 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget()); | 1185 | KCommandSocket* commandSocket = new KCommandSocket( "",mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget()); |
1158 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 1186 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
1159 | commandSocket->sendStop(); | 1187 | commandSocket->sendStop(); |
1160 | } | 1188 | } |
1161 | mPisyncFinished = true; | 1189 | mPisyncFinished = true; |
1162 | return; | 1190 | return; |
1163 | 1191 | ||
1164 | } else if ( state == KCommandSocket::errorW ) { | 1192 | } else if ( state == KCommandSocket::errorW ) { |
1165 | mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") ); | 1193 | mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") ); |
1166 | mPisyncFinished = true; | 1194 | mPisyncFinished = true; |
1167 | 1195 | ||
1168 | } else if ( state == KCommandSocket::successR ) { | 1196 | } else if ( state == KCommandSocket::successR ) { |
1169 | QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); | 1197 | QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); |
1170 | 1198 | ||
1171 | } else if ( state == KCommandSocket::successW ) { | 1199 | } else if ( state == KCommandSocket::successW ) { |
1172 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync successful!") ); | 1200 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync successful!") ); |
1173 | mPisyncFinished = true; | 1201 | mPisyncFinished = true; |
1174 | } else if ( state == KCommandSocket::quiet ){ | 1202 | } else if ( state == KCommandSocket::quiet ){ |
1175 | qDebug("KSS: quiet "); | 1203 | qDebug("KSS: quiet "); |
1176 | mPisyncFinished = true; | 1204 | mPisyncFinished = true; |
1177 | } else { | 1205 | } else { |
1178 | qDebug("KSS: Error: unknown state: %d ", state); | 1206 | qDebug("KSS: Error: unknown state: %d ", state); |
1179 | mPisyncFinished = true; | 1207 | mPisyncFinished = true; |
1180 | } | 1208 | } |
1181 | 1209 | ||
1182 | delete s; | 1210 | delete s; |
1183 | } | 1211 | } |
1184 | 1212 | ||
1185 | void KSyncManager::readFileFromSocket() | 1213 | void KSyncManager::readFileFromSocket() |
1186 | { | 1214 | { |
1187 | QString fileName = syncFileName(); | 1215 | QString fileName = syncFileName(); |
1188 | bool syncOK = true; | 1216 | bool syncOK = true; |
1189 | mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") ); | 1217 | mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") ); |
1190 | if ( ! syncWithFile( fileName , true ) ) { | 1218 | if ( ! syncWithFile( fileName , true ) ) { |
1191 | mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); | 1219 | mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); |
1192 | syncOK = false; | 1220 | syncOK = false; |
1193 | } | 1221 | } |
1194 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() ); | 1222 | KCommandSocket* commandSocket = new KCommandSocket( "",mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() ); |
1195 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 1223 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
1196 | if ( mWriteBackFile && syncOK ) { | 1224 | if ( mWriteBackFile && syncOK ) { |
1197 | mParent->topLevelWidget()->setCaption( i18n("Sending back file ...") ); | 1225 | mParent->topLevelWidget()->setCaption( i18n("Sending back file ...") ); |
1198 | commandSocket->writeFile( fileName ); | 1226 | commandSocket->writeFile( fileName ); |
1199 | } | 1227 | } |
1200 | else { | 1228 | else { |
1201 | commandSocket->sendStop(); | 1229 | commandSocket->sendStop(); |
1202 | if ( syncOK ) | 1230 | if ( syncOK ) |
1203 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); | 1231 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); |
1204 | mPisyncFinished = true; | 1232 | mPisyncFinished = true; |
1205 | } | 1233 | } |
1206 | } | 1234 | } |
1207 | 1235 | ||
1208 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) | 1236 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) |
1209 | { | 1237 | { |
1210 | mPassWord = pw; | 1238 | mPassWord = pw; |
1211 | mSocket = 0; | 1239 | mSocket = 0; |
1212 | mSyncActionDialog = 0; | 1240 | mSyncActionDialog = 0; |
1213 | blockRC = false; | 1241 | blockRC = false; |
1214 | mErrorMessage = 0; | 1242 | mErrorMessage = 0; |
1215 | } | 1243 | } |
1216 | 1244 | ||
1217 | void KServerSocket::newConnection ( int socket ) | 1245 | void KServerSocket::newConnection ( int socket ) |
1218 | { | 1246 | { |
1219 | // qDebug("KServerSocket:New connection %d ", socket); | 1247 | // qDebug("KServerSocket:New connection %d ", socket); |
1220 | if ( mSocket ) { | 1248 | if ( mSocket ) { |
1221 | qDebug("KSS::newConnection Socket deleted! "); | 1249 | qDebug("KSS::newConnection Socket deleted! "); |
1222 | delete mSocket; | 1250 | delete mSocket; |
1223 | mSocket = 0; | 1251 | mSocket = 0; |
1224 | } | 1252 | } |
1225 | mSocket = new QSocket( this ); | 1253 | mSocket = new QSocket( this ); |
1226 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); | 1254 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); |
1227 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); | 1255 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); |
1228 | mSocket->setSocket( socket ); | 1256 | mSocket->setSocket( socket ); |
1229 | } | 1257 | } |
1230 | 1258 | ||
1231 | void KServerSocket::discardClient() | 1259 | void KServerSocket::discardClient() |
1232 | { | 1260 | { |
1233 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); | 1261 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); |
1234 | } | 1262 | } |
1235 | void KServerSocket::deleteSocket() | 1263 | void KServerSocket::deleteSocket() |
1236 | { | 1264 | { |
1237 | qDebug("KSS::deleteSocket"); | 1265 | qDebug("KSS::deleteSocket"); |
1238 | if ( mSocket ) { | 1266 | if ( mSocket ) { |
1239 | delete mSocket; | 1267 | delete mSocket; |
1240 | mSocket = 0; | 1268 | mSocket = 0; |
1241 | } | 1269 | } |
1242 | if ( mErrorMessage ) | 1270 | if ( mErrorMessage ) |
@@ -1417,125 +1445,128 @@ void KServerSocket::get_file() | |||
1417 | 1445 | ||
1418 | void KServerSocket::readBackFileFromSocket() | 1446 | void KServerSocket::readBackFileFromSocket() |
1419 | { | 1447 | { |
1420 | //qDebug("readBackFileFromSocket() %d ", piTime.elapsed ()); | 1448 | //qDebug("readBackFileFromSocket() %d ", piTime.elapsed ()); |
1421 | while ( mSocket->canReadLine () ) { | 1449 | while ( mSocket->canReadLine () ) { |
1422 | piTime.restart(); | 1450 | piTime.restart(); |
1423 | QString line = mSocket->readLine (); | 1451 | QString line = mSocket->readLine (); |
1424 | piFileString += line; | 1452 | piFileString += line; |
1425 | //qDebug("readline: %s ", line.latin1()); | 1453 | //qDebug("readline: %s ", line.latin1()); |
1426 | mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) ); | 1454 | mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) ); |
1427 | 1455 | ||
1428 | } | 1456 | } |
1429 | if ( piTime.elapsed () < 3000 ) { | 1457 | if ( piTime.elapsed () < 3000 ) { |
1430 | // wait for more | 1458 | // wait for more |
1431 | //qDebug("waitformore "); | 1459 | //qDebug("waitformore "); |
1432 | QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) )); | 1460 | QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) )); |
1433 | return; | 1461 | return; |
1434 | } | 1462 | } |
1435 | QString fileName = mFileName; | 1463 | QString fileName = mFileName; |
1436 | QFile file ( fileName ); | 1464 | QFile file ( fileName ); |
1437 | if (!file.open( IO_WriteOnly ) ) { | 1465 | if (!file.open( IO_WriteOnly ) ) { |
1438 | delete mSyncActionDialog; | 1466 | delete mSyncActionDialog; |
1439 | mSyncActionDialog = 0; | 1467 | mSyncActionDialog = 0; |
1440 | qDebug("KSS:Error open read back file "); | 1468 | qDebug("KSS:Error open read back file "); |
1441 | piFileString = ""; | 1469 | piFileString = ""; |
1442 | emit file_received( false ); | 1470 | emit file_received( false ); |
1443 | blockRC = false; | 1471 | blockRC = false; |
1444 | return ; | 1472 | return ; |
1445 | 1473 | ||
1446 | } | 1474 | } |
1447 | 1475 | ||
1448 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); | 1476 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); |
1449 | QTextStream ts ( &file ); | 1477 | QTextStream ts ( &file ); |
1450 | ts.setEncoding( QTextStream::Latin1 ); | 1478 | ts.setEncoding( QTextStream::Latin1 ); |
1451 | mSyncActionDialog->setCaption( i18n("Writing file to disk...") ); | 1479 | mSyncActionDialog->setCaption( i18n("Writing file to disk...") ); |
1452 | ts << piFileString; | 1480 | ts << piFileString; |
1453 | mSocket->close(); | 1481 | mSocket->close(); |
1454 | if ( mSocket->state() == QSocket::Idle ) | 1482 | if ( mSocket->state() == QSocket::Idle ) |
1455 | QTimer::singleShot( 10, this , SLOT ( discardClient())); | 1483 | QTimer::singleShot( 10, this , SLOT ( discardClient())); |
1456 | file.close(); | 1484 | file.close(); |
1457 | piFileString = ""; | 1485 | piFileString = ""; |
1458 | emit file_received( true ); | 1486 | emit file_received( true ); |
1459 | delete mSyncActionDialog; | 1487 | delete mSyncActionDialog; |
1460 | mSyncActionDialog = 0; | 1488 | mSyncActionDialog = 0; |
1461 | blockRC = false; | 1489 | blockRC = false; |
1462 | 1490 | ||
1463 | } | 1491 | } |
1464 | 1492 | ||
1465 | KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent, QWidget * cap, const char * name ): QObject( parent, name ) | 1493 | KCommandSocket::KCommandSocket ( QString remres, QString password, Q_UINT16 port, QString host, QObject * parent, QWidget * cap, const char * name ): QObject( parent, name ) |
1466 | { | 1494 | { |
1495 | mRemoteResource = remres; | ||
1496 | if ( mRemoteResource.isEmpty() ) | ||
1497 | mRemoteResource = "ALL"; | ||
1467 | mPassWord = password; | 1498 | mPassWord = password; |
1468 | mSocket = 0; | 1499 | mSocket = 0; |
1469 | mFirst = false; | 1500 | mFirst = false; |
1470 | mFirstLine = true; | 1501 | mFirstLine = true; |
1471 | mPort = port; | 1502 | mPort = port; |
1472 | mHost = host; | 1503 | mHost = host; |
1473 | tlw = cap; | 1504 | tlw = cap; |
1474 | mRetVal = quiet; | 1505 | mRetVal = quiet; |
1475 | mTimerSocket = new QTimer ( this ); | 1506 | mTimerSocket = new QTimer ( this ); |
1476 | connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( updateConnectDialog() ) ); | 1507 | connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( updateConnectDialog() ) ); |
1477 | mConnectProgress.setCaption( i18n("Pi-Sync") ); | 1508 | mConnectProgress.setCaption( i18n("Pi-Sync") ); |
1478 | connect( &mConnectProgress, SIGNAL ( cancelled () ), this, SLOT ( deleteSocket() ) ); | 1509 | connect( &mConnectProgress, SIGNAL ( cancelled () ), this, SLOT ( deleteSocket() ) ); |
1479 | mConnectCount = -1; | 1510 | mConnectCount = -1; |
1480 | } | 1511 | } |
1481 | void KCommandSocket::sendFileRequest() | 1512 | void KCommandSocket::sendFileRequest() |
1482 | { | 1513 | { |
1483 | if ( tlw ) | 1514 | if ( tlw ) |
1484 | tlw->setCaption( i18n("Connected! Sending request for remote file ...") ); | 1515 | tlw->setCaption( i18n("Connected! Sending request for remote file ...") ); |
1485 | mConnectProgress.hide(); | 1516 | mConnectProgress.hide(); |
1486 | mConnectCount = 300;mConnectMax = 300; | 1517 | mConnectCount = 300;mConnectMax = 300; |
1487 | mConnectProgress.setCaption( i18n("Pi-Sync: Connected!") ); | 1518 | mConnectProgress.setCaption( i18n("Pi-Sync: Connected!") ); |
1488 | mTimerSocket->start( 100, true ); | 1519 | mTimerSocket->start( 100, true ); |
1489 | QTextStream os( mSocket ); | 1520 | QTextStream os( mSocket ); |
1490 | os.setEncoding( QTextStream::Latin1 ); | 1521 | os.setEncoding( QTextStream::Latin1 ); |
1491 | 1522 | ||
1492 | QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate ); | 1523 | QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate ); |
1493 | os << "GET " << mPassWord << curDt <<"\r\n\r\n"; | 1524 | os << "GET " << mPassWord << curDt << mRemoteResource << "\r\n\r\n"; |
1494 | } | 1525 | } |
1495 | 1526 | ||
1496 | void KCommandSocket::readFile( QString fn ) | 1527 | void KCommandSocket::readFile( QString fn ) |
1497 | { | 1528 | { |
1498 | if ( !mSocket ) { | 1529 | if ( !mSocket ) { |
1499 | mSocket = new QSocket( this ); | 1530 | mSocket = new QSocket( this ); |
1500 | connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) ); | 1531 | connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) ); |
1501 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 1532 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
1502 | connect( mSocket, SIGNAL(connected ()), this, SLOT(sendFileRequest() )); | 1533 | connect( mSocket, SIGNAL(connected ()), this, SLOT(sendFileRequest() )); |
1503 | } | 1534 | } |
1504 | mFileString = ""; | 1535 | mFileString = ""; |
1505 | mFileName = fn; | 1536 | mFileName = fn; |
1506 | mFirst = true; | 1537 | mFirst = true; |
1507 | if ( tlw ) | 1538 | if ( tlw ) |
1508 | tlw->setCaption( i18n("Trying to connect to remote...") ); | 1539 | tlw->setCaption( i18n("Trying to connect to remote...") ); |
1509 | mConnectCount = 30;mConnectMax = 30; | 1540 | mConnectCount = 30;mConnectMax = 30; |
1510 | mTimerSocket->start( 1000, true ); | 1541 | mTimerSocket->start( 1000, true ); |
1511 | mSocket->connectToHost( mHost, mPort ); | 1542 | mSocket->connectToHost( mHost, mPort ); |
1512 | qDebug("KSS: Waiting for connection"); | 1543 | qDebug("KSS: Waiting for connection"); |
1513 | } | 1544 | } |
1514 | void KCommandSocket::updateConnectDialog() | 1545 | void KCommandSocket::updateConnectDialog() |
1515 | { | 1546 | { |
1516 | 1547 | ||
1517 | if ( mConnectCount == mConnectMax ) { | 1548 | if ( mConnectCount == mConnectMax ) { |
1518 | //qDebug("MAXX %d", mConnectMax); | 1549 | //qDebug("MAXX %d", mConnectMax); |
1519 | mConnectProgress.setTotalSteps ( 30 ); | 1550 | mConnectProgress.setTotalSteps ( 30 ); |
1520 | mConnectProgress.show(); | 1551 | mConnectProgress.show(); |
1521 | mConnectProgress.setLabelText( i18n("Trying to connect to remote...") ); | 1552 | mConnectProgress.setLabelText( i18n("Trying to connect to remote...") ); |
1522 | } | 1553 | } |
1523 | //qDebug("updateConnectDialog() %d", mConnectCount); | 1554 | //qDebug("updateConnectDialog() %d", mConnectCount); |
1524 | mConnectProgress.raise(); | 1555 | mConnectProgress.raise(); |
1525 | mConnectProgress.setProgress( (mConnectMax - mConnectCount)%30 ); | 1556 | mConnectProgress.setProgress( (mConnectMax - mConnectCount)%30 ); |
1526 | --mConnectCount; | 1557 | --mConnectCount; |
1527 | if ( mConnectCount > 0 ) | 1558 | if ( mConnectCount > 0 ) |
1528 | mTimerSocket->start( 1000, true ); | 1559 | mTimerSocket->start( 1000, true ); |
1529 | else | 1560 | else |
1530 | deleteSocket(); | 1561 | deleteSocket(); |
1531 | 1562 | ||
1532 | } | 1563 | } |
1533 | void KCommandSocket::writeFile( QString fileName ) | 1564 | void KCommandSocket::writeFile( QString fileName ) |
1534 | { | 1565 | { |
1535 | if ( !mSocket ) { | 1566 | if ( !mSocket ) { |
1536 | mSocket = new QSocket( this ); | 1567 | mSocket = new QSocket( this ); |
1537 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 1568 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
1538 | connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) ); | 1569 | connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) ); |
1539 | } | 1570 | } |
1540 | mFileName = fileName ; | 1571 | mFileName = fileName ; |
1541 | mConnectCount = 30;mConnectMax = 30; | 1572 | mConnectCount = 30;mConnectMax = 30; |
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index d3734da..f4654ce 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h | |||
@@ -36,113 +36,114 @@ class QPopupMenu; | |||
36 | class KSyncProfile; | 36 | class KSyncProfile; |
37 | class KPimPrefs; | 37 | class KPimPrefs; |
38 | class QWidget; | 38 | class QWidget; |
39 | class KSyncManager; | 39 | class KSyncManager; |
40 | class KSyncInterface; | 40 | class KSyncInterface; |
41 | class QProgressBar; | 41 | class QProgressBar; |
42 | 42 | ||
43 | 43 | ||
44 | class KServerSocket : public QServerSocket | 44 | class KServerSocket : public QServerSocket |
45 | { | 45 | { |
46 | Q_OBJECT | 46 | Q_OBJECT |
47 | 47 | ||
48 | public: | 48 | public: |
49 | KServerSocket ( QString password, Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ); | 49 | KServerSocket ( QString password, Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ); |
50 | 50 | ||
51 | void newConnection ( int socket ) ; | 51 | void newConnection ( int socket ) ; |
52 | void setFileName( QString fn ) {mFileName = fn;}; | 52 | void setFileName( QString fn ) {mFileName = fn;}; |
53 | signals: | 53 | signals: |
54 | void file_received( bool ); | 54 | void file_received( bool ); |
55 | void request_file(); | 55 | void request_file(); |
56 | void saveFile(); | 56 | void saveFile(); |
57 | void endConnect(); | 57 | void endConnect(); |
58 | private slots: | 58 | private slots: |
59 | void discardClient(); | 59 | void discardClient(); |
60 | void deleteSocket(); | 60 | void deleteSocket(); |
61 | void readClient(); | 61 | void readClient(); |
62 | void displayErrorMessage(); | 62 | void displayErrorMessage(); |
63 | void readBackFileFromSocket(); | 63 | void readBackFileFromSocket(); |
64 | private : | 64 | private : |
65 | int mErrorMessage; | 65 | int mErrorMessage; |
66 | bool blockRC; | 66 | bool blockRC; |
67 | void send_file(); | 67 | void send_file(); |
68 | void get_file(); | 68 | void get_file(); |
69 | void end_connect(); | 69 | void end_connect(); |
70 | void error_connect( QString ); | 70 | void error_connect( QString ); |
71 | QDialog* mSyncActionDialog; | 71 | QDialog* mSyncActionDialog; |
72 | QSocket* mSocket; | 72 | QSocket* mSocket; |
73 | QString mPassWord; | 73 | QString mPassWord; |
74 | QString mFileName; | 74 | QString mFileName; |
75 | QTime piTime; | 75 | QTime piTime; |
76 | QString piFileString; | 76 | QString piFileString; |
77 | }; | 77 | }; |
78 | 78 | ||
79 | class KCommandSocket : public QObject | 79 | class KCommandSocket : public QObject |
80 | { | 80 | { |
81 | Q_OBJECT | 81 | Q_OBJECT |
82 | public: | 82 | public: |
83 | enum state { successR, errorR, successW, errorW, errorTO, errorPW, errorCA, errorFI, errorUN, errorED,quiet }; | 83 | enum state { successR, errorR, successW, errorW, errorTO, errorPW, errorCA, errorFI, errorUN, errorED,quiet }; |
84 | KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 ); | 84 | KCommandSocket (QString remoteResource, QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 ); |
85 | void readFile( QString ); | 85 | void readFile( QString ); |
86 | void writeFile( QString ); | 86 | void writeFile( QString ); |
87 | void sendStop(); | 87 | void sendStop(); |
88 | 88 | ||
89 | private slots : | 89 | private slots : |
90 | void sendFileRequest(); | 90 | void sendFileRequest(); |
91 | void updateConnectDialog(); | 91 | void updateConnectDialog(); |
92 | 92 | ||
93 | signals: | 93 | signals: |
94 | void commandFinished( KCommandSocket*, int ); | 94 | void commandFinished( KCommandSocket*, int ); |
95 | private slots: | 95 | private slots: |
96 | void startReadFileFromSocket(); | 96 | void startReadFileFromSocket(); |
97 | void readFileFromSocket(); | 97 | void readFileFromSocket(); |
98 | void deleteSocket(); | 98 | void deleteSocket(); |
99 | void writeFileToSocket(); | 99 | void writeFileToSocket(); |
100 | private : | 100 | private : |
101 | QString mRemoteResource; | ||
101 | int mConnectCount; | 102 | int mConnectCount; |
102 | int mConnectMax; | 103 | int mConnectMax; |
103 | KProgressDialog mConnectProgress; | 104 | KProgressDialog mConnectProgress; |
104 | QWidget* tlw; | 105 | QWidget* tlw; |
105 | QSocket* mSocket; | 106 | QSocket* mSocket; |
106 | QString mPassWord; | 107 | QString mPassWord; |
107 | Q_UINT16 mPort; | 108 | Q_UINT16 mPort; |
108 | QString mHost; | 109 | QString mHost; |
109 | QString mFileName; | 110 | QString mFileName; |
110 | QTimer* mTimerSocket; | 111 | QTimer* mTimerSocket; |
111 | int mRetVal; | 112 | int mRetVal; |
112 | QTime mTime; | 113 | QTime mTime; |
113 | QString mFileString; | 114 | QString mFileString; |
114 | bool mFirst; | 115 | bool mFirst; |
115 | bool mFirstLine; | 116 | bool mFirstLine; |
116 | }; | 117 | }; |
117 | 118 | ||
118 | 119 | ||
119 | class KSyncManager : public QObject | 120 | class KSyncManager : public QObject |
120 | { | 121 | { |
121 | Q_OBJECT | 122 | Q_OBJECT |
122 | 123 | ||
123 | public: | 124 | public: |
124 | enum TargetApp { | 125 | enum TargetApp { |
125 | KOPI = 0, | 126 | KOPI = 0, |
126 | KAPI = 1, | 127 | KAPI = 1, |
127 | PWMPI = 2 }; | 128 | PWMPI = 2 }; |
128 | 129 | ||
129 | KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); | 130 | KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); |
130 | ~KSyncManager() ; | 131 | ~KSyncManager() ; |
131 | 132 | ||
132 | void multiSync( bool askforPrefs ); | 133 | void multiSync( bool askforPrefs ); |
133 | bool blockSave() { return mBlockSaveFlag; } | 134 | bool blockSave() { return mBlockSaveFlag; } |
134 | void setBlockSave(bool sa) { mBlockSaveFlag = sa; } | 135 | void setBlockSave(bool sa) { mBlockSaveFlag = sa; } |
135 | void setDefaultFileName( QString s) ; | 136 | void setDefaultFileName( QString s) ; |
136 | QString defaultFileName() { return mDefFileName ;} | 137 | QString defaultFileName() { return mDefFileName ;} |
137 | QString syncFileName(); | 138 | QString syncFileName(); |
138 | void enableQuick( bool ask = true); | 139 | void enableQuick( bool ask = true); |
139 | 140 | ||
140 | bool syncWithDesktop () { return mSyncWithDesktop;} | 141 | bool syncWithDesktop () { return mSyncWithDesktop;} |
141 | QString getCurrentSyncDevice() { return mCurrentSyncDevice; } | 142 | QString getCurrentSyncDevice() { return mCurrentSyncDevice; } |
142 | QString getCurrentSyncName() { return mCurrentSyncName; } | 143 | QString getCurrentSyncName() { return mCurrentSyncName; } |
143 | 144 | ||
144 | void showProgressBar(int percentage, QString caption = QString::null, int total=100); | 145 | void showProgressBar(int percentage, QString caption = QString::null, int total=100); |
145 | void hideProgressBar(); | 146 | void hideProgressBar(); |
146 | bool isProgressBarCanceled(); | 147 | bool isProgressBarCanceled(); |
147 | 148 | ||
148 | // sync stuff | 149 | // sync stuff |
@@ -157,81 +158,84 @@ class KSyncManager : public QObject | |||
157 | bool mWriteBackFile; | 158 | bool mWriteBackFile; |
158 | int mWriteBackInFuture; | 159 | int mWriteBackInFuture; |
159 | int mWriteBackInPast; | 160 | int mWriteBackInPast; |
160 | QString mPhoneDevice; | 161 | QString mPhoneDevice; |
161 | QString mPhoneConnection; | 162 | QString mPhoneConnection; |
162 | QString mPhoneModel; | 163 | QString mPhoneModel; |
163 | QString mPassWordPiSync; | 164 | QString mPassWordPiSync; |
164 | QString mActiveSyncPort; | 165 | QString mActiveSyncPort; |
165 | QString mActiveSyncIP ; | 166 | QString mActiveSyncIP ; |
166 | QString mFilterInCal; | 167 | QString mFilterInCal; |
167 | QString mFilterOutCal; | 168 | QString mFilterOutCal; |
168 | QString mFilterInAB; | 169 | QString mFilterInAB; |
169 | QString mFilterOutAB; | 170 | QString mFilterOutAB; |
170 | static QDateTime mRequestedSyncEvent; | 171 | static QDateTime mRequestedSyncEvent; |
171 | 172 | ||
172 | signals: | 173 | signals: |
173 | void save(); | 174 | void save(); |
174 | void request_file(); | 175 | void request_file(); |
175 | void getFile( bool ); | 176 | void getFile( bool ); |
176 | 177 | ||
177 | public slots: | 178 | public slots: |
178 | void slotSyncMenu( int ); | 179 | void slotSyncMenu( int ); |
179 | void slotClearMenu( int action ); | 180 | void slotClearMenu( int action ); |
180 | void deleteCommandSocket(KCommandSocket*s, int state); | 181 | void deleteCommandSocket(KCommandSocket*s, int state); |
181 | void readFileFromSocket(); | 182 | void readFileFromSocket(); |
182 | void fillSyncMenu(); | 183 | void fillSyncMenu(); |
183 | 184 | ||
184 | private: | 185 | private: |
185 | void syncPi(); | 186 | void syncPi(); |
186 | KServerSocket * mServerSocket; | 187 | KServerSocket * mServerSocket; |
187 | KPimPrefs* mPrefs; | 188 | KPimPrefs* mPrefs; |
188 | QString mDefFileName; | 189 | QString mDefFileName; |
189 | QString mCurrentSyncDevice; | 190 | QString mCurrentSyncDevice; |
190 | QString mCurrentSyncName; | 191 | QString mCurrentSyncName; |
191 | void quickSyncLocalFile(); | 192 | void quickSyncLocalFile(); |
192 | bool syncWithFile( QString fn , bool quick ); | 193 | bool syncWithFile( QString fn , bool quick ); |
193 | void syncLocalFile(); | 194 | void syncLocalFile(); |
194 | void syncPhone(); | 195 | void syncPhone(); |
195 | void syncSharp(); | 196 | void syncSharp(); |
196 | void syncKDE(); | 197 | void syncKDE(); |
197 | bool syncExternalApplication(QString); | 198 | bool syncExternalApplication(QString); |
198 | int mCurrentSyncProfile ; | 199 | int mCurrentSyncProfile ; |
199 | void syncRemote( KSyncProfile* prof, bool ask = true); | 200 | void syncRemote( KSyncProfile* prof, bool ask = true); |
200 | bool edit_sync_options(); | 201 | bool edit_sync_options(); |
201 | bool edit_pisync_options(); | 202 | bool edit_pisync_options(); |
202 | int ringSync(); | 203 | int ringSync(); |
203 | QString getPassword( ); | 204 | QString getPassword( ); |
204 | bool mPisyncFinished; | 205 | bool mPisyncFinished; |
206 | QStringList mSpecificResources; | ||
207 | QString mCurrentResourceLocal; | ||
208 | QString mCurrentResourceRemote; | ||
205 | bool mBlockSaveFlag; | 209 | bool mBlockSaveFlag; |
206 | QWidget* mParent; | 210 | QWidget* mParent; |
207 | KSyncInterface* mImplementation; | 211 | KSyncInterface* mImplementation; |
208 | TargetApp mTargetApp; | 212 | TargetApp mTargetApp; |
209 | QPopupMenu* mSyncMenu; | 213 | QPopupMenu* mSyncMenu; |
210 | QProgressBar* bar; | 214 | QProgressBar* bar; |
211 | bool mSyncWithDesktop; | 215 | bool mSyncWithDesktop; |
212 | 216 | ||
213 | private slots: | 217 | private slots: |
214 | void displayErrorPort(); | 218 | void displayErrorPort(); |
215 | void confSync(); | 219 | void confSync(); |
216 | 220 | ||
217 | 221 | ||
218 | }; | 222 | }; |
219 | 223 | ||
220 | 224 | ||
221 | class KSyncInterface | 225 | class KSyncInterface |
222 | { | 226 | { |
223 | public : | 227 | public : |
224 | virtual void removeSyncInfo( QString syncProfile) = 0; | 228 | virtual void removeSyncInfo( QString syncProfile) = 0; |
225 | virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0; | 229 | virtual bool sync(KSyncManager* manager, QString filename, int mode, QString resource) = 0; |
226 | virtual bool syncExternal(KSyncManager* manager, QString resource) | 230 | virtual bool syncExternal(KSyncManager* manager, QString resource) |
227 | { | 231 | { |
228 | // empty implementation, because some syncable applications do not | 232 | // empty implementation, because some syncable applications do not |
229 | // have an external(sharpdtm) syncmode, like pwmanager. | 233 | // have an external(sharpdtm) syncmode, like pwmanager. |
230 | return false; | 234 | return false; |
231 | } | 235 | } |
232 | 236 | ||
233 | 237 | ||
234 | }; | 238 | }; |
235 | 239 | ||
236 | 240 | ||
237 | #endif | 241 | #endif |
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp index 292cde1..27f7932 100644 --- a/libkdepim/ksyncprefsdialog.cpp +++ b/libkdepim/ksyncprefsdialog.cpp | |||
@@ -547,98 +547,98 @@ void KSyncPrefsDialog::profileChanged( int item ) | |||
547 | mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); | 547 | mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); |
548 | mWriteBackFile->setChecked( prof->getWriteBackFile()); | 548 | mWriteBackFile->setChecked( prof->getWriteBackFile()); |
549 | mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); | 549 | mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); |
550 | mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() ); | 550 | mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() ); |
551 | mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() ); | 551 | mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() ); |
552 | mWriteBackFuture->setChecked( prof->getWriteBackFuture()); | 552 | mWriteBackFuture->setChecked( prof->getWriteBackFuture()); |
553 | mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() ); | 553 | mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() ); |
554 | mWriteBackPastWeeks->setValue( prof->getWriteBackPastWeeks() ); | 554 | mWriteBackPastWeeks->setValue( prof->getWriteBackPastWeeks() ); |
555 | 555 | ||
556 | mFilterInCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterInCal () ) + 1 ); | 556 | mFilterInCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterInCal () ) + 1 ); |
557 | mFilterOutCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterOutCal () ) + 1 ); | 557 | mFilterOutCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterOutCal () ) + 1 ); |
558 | mFilterInAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterInAB () ) + 1 ); | 558 | mFilterInAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterInAB () ) + 1 ); |
559 | mFilterOutAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterOutAB () ) + 1 ); | 559 | mFilterOutAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterOutAB () ) + 1 ); |
560 | 560 | ||
561 | switch ( prof->getSyncPrefs() ) { | 561 | switch ( prof->getSyncPrefs() ) { |
562 | case 0: | 562 | case 0: |
563 | loc->setChecked( true); | 563 | loc->setChecked( true); |
564 | break; | 564 | break; |
565 | case 1: | 565 | case 1: |
566 | rem->setChecked( true ); | 566 | rem->setChecked( true ); |
567 | break; | 567 | break; |
568 | case 2: | 568 | case 2: |
569 | newest->setChecked( true); | 569 | newest->setChecked( true); |
570 | break; | 570 | break; |
571 | case 3: | 571 | case 3: |
572 | ask->setChecked( true); | 572 | ask->setChecked( true); |
573 | break; | 573 | break; |
574 | case 4: | 574 | case 4: |
575 | f_loc->setChecked( true); | 575 | f_loc->setChecked( true); |
576 | break; | 576 | break; |
577 | case 5: | 577 | case 5: |
578 | f_rem->setChecked( true); | 578 | f_rem->setChecked( true); |
579 | break; | 579 | break; |
580 | case 6: | 580 | case 6: |
581 | //both->setChecked( true); | 581 | //both->setChecked( true); |
582 | break; | 582 | break; |
583 | default: | 583 | default: |
584 | break; | 584 | break; |
585 | } | 585 | } |
586 | mIsLocal->setChecked(prof->getIsLocalFileSync()) ; | 586 | mIsLocal->setChecked(prof->getIsLocalFileSync()) ; |
587 | mIsPhone->setChecked(prof->getIsPhoneSync()) ; | 587 | mIsPhone->setChecked(prof->getIsPhoneSync()) ; |
588 | mIsPi->setChecked(prof->getIsPiSync()) ; | 588 | mIsPi->setChecked(prof->getIsPiSync()) ; |
589 | mIsPiSpecific->setChecked(prof->getIsPiSyncSpec()) ; | 589 | mIsPiSpecific->setChecked(prof->getIsPiSyncSpec()) ; |
590 | mIsKapiFileL->setChecked(prof->getIsKapiFile()) ; | 590 | mIsKapiFileL->setChecked(prof->getIsKapiFile()) ; |
591 | mIsKapiFileR->setChecked(prof->getIsKapiFile()) ; | 591 | mIsKapiFileR->setChecked(prof->getIsKapiFile()) ; |
592 | 592 | ||
593 | 593 | ||
594 | QStringList res = QStringList::split( ":",prof->getResSpecKopi()); | 594 | QStringList res = QStringList::split( ":",prof->getResSpecKopi()); |
595 | int i; | 595 | int i= res.count()/2; |
596 | for ( i = 0;i < res.count(); ++i ) { | 596 | for ( ;i < res.count(); ++i ) { |
597 | mResTableKopi->setText( i, 0, res[i] ); | 597 | mResTableKopi->setText( i, 0, res[i] ); |
598 | } | 598 | } |
599 | res = QStringList::split( ":",prof->getResSpecKapi()); | 599 | res = QStringList::split( ":",prof->getResSpecKapi()); |
600 | for ( i = 0;i < res.count(); ++i ) { | 600 | for ( i = 0;i < res.count(); ++i ) { |
601 | mResTableKapi->setText( i, 0, res[i] ); | 601 | mResTableKapi->setText( i, 0, res[i] ); |
602 | } | 602 | } |
603 | mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() &&!prof->getIsPiSync() &&!prof->getIsPiSyncSpec()); | 603 | mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() &&!prof->getIsPiSync() &&!prof->getIsPiSyncSpec()); |
604 | proGr->setEnabled( item > 2 ); | 604 | proGr->setEnabled( item > 2 ); |
605 | if ( item < 3 ) { | 605 | if ( item < 3 ) { |
606 | localFileWidget->hide(); | 606 | localFileWidget->hide(); |
607 | remoteFileWidget->hide(); | 607 | remoteFileWidget->hide(); |
608 | phoneWidget->hide(); | 608 | phoneWidget->hide(); |
609 | piWidget->hide(); | 609 | piWidget->hide(); |
610 | 610 | ||
611 | } else | 611 | } else |
612 | kindChanged( prof->getIsLocalFileSync() ); | 612 | kindChanged( prof->getIsLocalFileSync() ); |
613 | } | 613 | } |
614 | 614 | ||
615 | void KSyncPrefsDialog::fillSSH() | 615 | void KSyncPrefsDialog::fillSSH() |
616 | { | 616 | { |
617 | mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); | 617 | mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); |
618 | mLocalTempFile->setText("/tmp/mycalendar.ics" ); | 618 | mLocalTempFile->setText("/tmp/mycalendar.ics" ); |
619 | mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" ); | 619 | mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" ); |
620 | mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); | 620 | mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); |
621 | mLocalTempFileAB->setText("/tmp/std.vcf" ); | 621 | mLocalTempFileAB->setText("/tmp/std.vcf" ); |
622 | mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" ); | 622 | mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" ); |
623 | mRemotePrecommandPWM->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); | 623 | mRemotePrecommandPWM->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); |
624 | mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); | 624 | mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); |
625 | mRemotePostcommandPWM->setText("scp /tmp/passwords.pwm zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/pwmanager.pwm" ); | 625 | mRemotePostcommandPWM->setText("scp /tmp/passwords.pwm zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/pwmanager.pwm" ); |
626 | } | 626 | } |
627 | void KSyncPrefsDialog::fillFTP() | 627 | void KSyncPrefsDialog::fillFTP() |
628 | { | 628 | { |
629 | mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" ); | 629 | mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" ); |
630 | mLocalTempFile->setText("/tmp/mycalendar.ics" ); | 630 | mLocalTempFile->setText("/tmp/mycalendar.ics" ); |
631 | mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); | 631 | mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); |
632 | mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" ); | 632 | mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" ); |
633 | mLocalTempFileAB->setText("/tmp/std.vcf" ); | 633 | mLocalTempFileAB->setText("/tmp/std.vcf" ); |
634 | mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); | 634 | mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); |
635 | 635 | ||
636 | mRemotePrecommandPWM->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm" ); | 636 | mRemotePrecommandPWM->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm" ); |
637 | mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); | 637 | mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); |
638 | mRemotePostcommandPWM->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); | 638 | mRemotePostcommandPWM->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); |
639 | 639 | ||
640 | } | 640 | } |
641 | void KSyncPrefsDialog::kindChanged( bool b ) | 641 | void KSyncPrefsDialog::kindChanged( bool b ) |
642 | { | 642 | { |
643 | 643 | ||
644 | if ( mIsLocal->isChecked () ) { | 644 | if ( mIsLocal->isChecked () ) { |
@@ -707,97 +707,97 @@ void KSyncPrefsDialog::saveProfile() | |||
707 | prof->setRemotePwAB( mRemotePwAB->text()); | 707 | prof->setRemotePwAB( mRemotePwAB->text()); |
708 | prof->setRemoteIPAB( mRemoteIPAB->text()); | 708 | prof->setRemoteIPAB( mRemoteIPAB->text()); |
709 | prof->setRemotePortAB( mRemotePortAB->text()); | 709 | prof->setRemotePortAB( mRemotePortAB->text()); |
710 | 710 | ||
711 | prof->setRemotePwPWM( mRemotePwPWM->text()); | 711 | prof->setRemotePwPWM( mRemotePwPWM->text()); |
712 | prof->setRemoteIPPWM( mRemoteIPPWM->text()); | 712 | prof->setRemoteIPPWM( mRemoteIPPWM->text()); |
713 | prof->setRemotePortPWM( mRemotePortPWM->text()); | 713 | prof->setRemotePortPWM( mRemotePortPWM->text()); |
714 | 714 | ||
715 | prof->setPreSyncCommand( mRemotePrecommand->text()); | 715 | prof->setPreSyncCommand( mRemotePrecommand->text()); |
716 | prof->setPostSyncCommand( mRemotePostcommand->text() ); | 716 | prof->setPostSyncCommand( mRemotePostcommand->text() ); |
717 | prof->setLocalTempFile( mLocalTempFile->text()); | 717 | prof->setLocalTempFile( mLocalTempFile->text()); |
718 | prof->setRemoteFileName( mRemoteFile->text() ); | 718 | prof->setRemoteFileName( mRemoteFile->text() ); |
719 | prof->setPreSyncCommandAB( mRemotePrecommandAB->text()); | 719 | prof->setPreSyncCommandAB( mRemotePrecommandAB->text()); |
720 | prof->setPostSyncCommandAB( mRemotePostcommandAB->text() ); | 720 | prof->setPostSyncCommandAB( mRemotePostcommandAB->text() ); |
721 | prof->setLocalTempFileAB( mLocalTempFileAB->text()); | 721 | prof->setLocalTempFileAB( mLocalTempFileAB->text()); |
722 | prof->setRemoteFileNameAB( mRemoteFileAB->text() ); | 722 | prof->setRemoteFileNameAB( mRemoteFileAB->text() ); |
723 | prof->setPreSyncCommandPWM( mRemotePrecommandPWM->text()); | 723 | prof->setPreSyncCommandPWM( mRemotePrecommandPWM->text()); |
724 | prof->setPostSyncCommandPWM( mRemotePostcommandPWM->text() ); | 724 | prof->setPostSyncCommandPWM( mRemotePostcommandPWM->text() ); |
725 | prof->setLocalTempFilePWM( mLocalTempFilePWM->text()); | 725 | prof->setLocalTempFilePWM( mLocalTempFilePWM->text()); |
726 | prof->setRemoteFileNamePWM( mRemoteFilePWM->text() ); | 726 | prof->setRemoteFileNamePWM( mRemoteFilePWM->text() ); |
727 | prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() ); | 727 | prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() ); |
728 | prof->setAskForPreferences( mAskForPreferences->isChecked()); | 728 | prof->setAskForPreferences( mAskForPreferences->isChecked()); |
729 | prof->setWriteBackExisting(mWriteBackExisting->isChecked() ); | 729 | prof->setWriteBackExisting(mWriteBackExisting->isChecked() ); |
730 | prof->setWriteBackFile( mWriteBackFile->isChecked()); | 730 | prof->setWriteBackFile( mWriteBackFile->isChecked()); |
731 | prof->setIncludeInRingSync( mIncludeInRing->isChecked() ); | 731 | prof->setIncludeInRingSync( mIncludeInRing->isChecked() ); |
732 | prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() ); | 732 | prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() ); |
733 | prof->setIncludeInRingSyncPWM( mIncludeInRingPWM->isChecked() ); | 733 | prof->setIncludeInRingSyncPWM( mIncludeInRingPWM->isChecked() ); |
734 | int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ; | 734 | int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ; |
735 | prof->setSyncPrefs( syncprefs); | 735 | prof->setSyncPrefs( syncprefs); |
736 | prof->setIsLocalFileSync( mIsLocal->isChecked() ); | 736 | prof->setIsLocalFileSync( mIsLocal->isChecked() ); |
737 | prof->setIsPhoneSync( mIsPhone->isChecked() ); | 737 | prof->setIsPhoneSync( mIsPhone->isChecked() ); |
738 | prof->setIsPiSync( mIsPi->isChecked() ); | 738 | prof->setIsPiSync( mIsPi->isChecked() ); |
739 | prof->setIsPiSyncSpec( mIsPiSpecific->isChecked() ); | 739 | prof->setIsPiSyncSpec( mIsPiSpecific->isChecked() ); |
740 | prof->setIsKapiFile( mIsKapiFileL->isChecked() ); | 740 | prof->setIsKapiFile( mIsKapiFileL->isChecked() ); |
741 | prof->setWriteBackFuture(mWriteBackFuture->isChecked()); | 741 | prof->setWriteBackFuture(mWriteBackFuture->isChecked()); |
742 | prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); | 742 | prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); |
743 | prof->setWriteBackPastWeeks(mWriteBackPastWeeks->value()); | 743 | prof->setWriteBackPastWeeks(mWriteBackPastWeeks->value()); |
744 | if ( mWriteContactToSIM ) | 744 | if ( mWriteContactToSIM ) |
745 | prof->setWriteContactToSIM(mWriteContactToSIM->isChecked()); | 745 | prof->setWriteContactToSIM(mWriteContactToSIM->isChecked()); |
746 | prof->setPhoneDevice( mPhoneDevice->text() ); | 746 | prof->setPhoneDevice( mPhoneDevice->text() ); |
747 | prof->setPhoneConnection( mPhoneConnection->text() ); | 747 | prof->setPhoneConnection( mPhoneConnection->text() ); |
748 | prof->setPhoneModel( mPhoneModel->text() ); | 748 | prof->setPhoneModel( mPhoneModel->text() ); |
749 | prof->setFilterInCal ( mFilterInCal->currentText ()); | 749 | prof->setFilterInCal ( mFilterInCal->currentText ()); |
750 | prof->setFilterOutCal ( mFilterOutCal ->currentText ()); | 750 | prof->setFilterOutCal ( mFilterOutCal ->currentText ()); |
751 | prof->setFilterInAB ( mFilterInAB ->currentText ()); | 751 | prof->setFilterInAB ( mFilterInAB ->currentText ()); |
752 | prof->setFilterOutAB ( mFilterOutAB ->currentText ()); | 752 | prof->setFilterOutAB ( mFilterOutAB ->currentText ()); |
753 | if ( mIsPiSpecific->isChecked() ) { | 753 | if ( mIsPiSpecific->isChecked() ) { |
754 | 754 | ||
755 | QStringList res; | 755 | QStringList res = mResourcesKopi; |
756 | int i; | 756 | int i; |
757 | for ( i = 0;i < mResourcesKopi.count(); ++i ) { | 757 | for ( i = 0;i < mResourcesKopi.count(); ++i ) { |
758 | res.append( mResTableKopi->text( i, 0 )); | 758 | res.append( mResTableKopi->text( i, 0 )); |
759 | } | 759 | } |
760 | prof->setResSpecKopi( res.join(":")); | 760 | prof->setResSpecKopi( res.join(":")); |
761 | } | 761 | } |
762 | } | 762 | } |
763 | } | 763 | } |
764 | 764 | ||
765 | void KSyncPrefsDialog::insertProfiles() | 765 | void KSyncPrefsDialog::insertProfiles() |
766 | { | 766 | { |
767 | int curItem = mProfileBox->currentItem(); | 767 | int curItem = mProfileBox->currentItem(); |
768 | mProfileBox->blockSignals( true ); | 768 | mProfileBox->blockSignals( true ); |
769 | mProfileBox->clear(); | 769 | mProfileBox->clear(); |
770 | mProfileBox->insertStringList (mSyncProfileNames ); | 770 | mProfileBox->insertStringList (mSyncProfileNames ); |
771 | int item = mSyncProfileNames.count() -1; | 771 | int item = mSyncProfileNames.count() -1; |
772 | if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() ) | 772 | if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() ) |
773 | mProfileBox->setCurrentItem( curItem ); | 773 | mProfileBox->setCurrentItem( curItem ); |
774 | else if ( item >= 0 ) { | 774 | else if ( item >= 0 ) { |
775 | mProfileBox->setCurrentItem( item ); | 775 | mProfileBox->setCurrentItem( item ); |
776 | } | 776 | } |
777 | currentSelection = -1; | 777 | currentSelection = -1; |
778 | if ( mSyncProfileNames.count() > 0 ) { | 778 | if ( mSyncProfileNames.count() > 0 ) { |
779 | //qDebug(" profileChanged( mProfileBox->currentItem() "); | 779 | //qDebug(" profileChanged( mProfileBox->currentItem() "); |
780 | profileChanged( mProfileBox->currentItem() ); | 780 | profileChanged( mProfileBox->currentItem() ); |
781 | currentSelection = mProfileBox->currentItem(); | 781 | currentSelection = mProfileBox->currentItem(); |
782 | } | 782 | } |
783 | mProfileBox->blockSignals( false ); | 783 | mProfileBox->blockSignals( false ); |
784 | } | 784 | } |
785 | 785 | ||
786 | void KSyncPrefsDialog::addProfile ( KSyncProfile* temp ) | 786 | void KSyncPrefsDialog::addProfile ( KSyncProfile* temp ) |
787 | { | 787 | { |
788 | saveProfile(); | 788 | saveProfile(); |
789 | mSyncProfiles.append( temp ); | 789 | mSyncProfiles.append( temp ); |
790 | mSyncProfileNames << temp->getName(); | 790 | mSyncProfileNames << temp->getName(); |
791 | insertProfiles(); | 791 | insertProfiles(); |
792 | int last = mProfileBox->count() -1; | 792 | int last = mProfileBox->count() -1; |
793 | mProfileBox->blockSignals( true ); | 793 | mProfileBox->blockSignals( true ); |
794 | mProfileBox->setCurrentItem( last ); | 794 | mProfileBox->setCurrentItem( last ); |
795 | mProfileBox->blockSignals( false ); | 795 | mProfileBox->blockSignals( false ); |
796 | profileChanged(last); | 796 | profileChanged(last); |
797 | } | 797 | } |
798 | void KSyncPrefsDialog::newProfile() | 798 | void KSyncPrefsDialog::newProfile() |
799 | { | 799 | { |
800 | addProfile ( new KSyncProfile () ); | 800 | addProfile ( new KSyncProfile () ); |
801 | } | 801 | } |
802 | 802 | ||
803 | void KSyncPrefsDialog::cloneProfile() | 803 | void KSyncPrefsDialog::cloneProfile() |