summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp73
-rw-r--r--korganizer/calendarview.h4
-rw-r--r--korganizer/mainwindow.cpp14
-rw-r--r--korganizer/mainwindow.h4
-rw-r--r--libkcal/calendar.h1
-rw-r--r--libkcal/calendarlocal.cpp16
-rw-r--r--libkcal/calendarlocal.h1
-rw-r--r--libkdepim/ksyncmanager.cpp24
-rw-r--r--libkdepim/ksyncmanager.h6
9 files changed, 118 insertions, 25 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 8965d3b..307027a 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -337,64 +337,65 @@ private:
337 QRadioButton* addCatBut; 337 QRadioButton* addCatBut;
338}; 338};
339 339
340 340
341 341
342CalendarView::CalendarView( CalendarResources *calendar, 342CalendarView::CalendarView( CalendarResources *calendar,
343 QWidget *parent, const char *name ) 343 QWidget *parent, const char *name )
344 : CalendarViewBase( parent, name ), 344 : CalendarViewBase( parent, name ),
345 mCalendar( calendar ), 345 mCalendar( calendar ),
346 mResourceManager( calendar->resourceManager() ) 346 mResourceManager( calendar->resourceManager() )
347{ 347{
348 348
349 mEventEditor = 0; 349 mEventEditor = 0;
350 mTodoEditor = 0; 350 mTodoEditor = 0;
351 351
352 init(); 352 init();
353} 353}
354 354
355CalendarView::CalendarView( Calendar *calendar, 355CalendarView::CalendarView( Calendar *calendar,
356 QWidget *parent, const char *name ) 356 QWidget *parent, const char *name )
357 : CalendarViewBase( parent, name ), 357 : CalendarViewBase( parent, name ),
358 mCalendar( calendar ), 358 mCalendar( calendar ),
359 mResourceManager( 0 ) 359 mResourceManager( 0 )
360{ 360{
361 361
362 mEventEditor = 0; 362 mEventEditor = 0;
363 mTodoEditor = 0; 363 mTodoEditor = 0;
364 init(); 364 init();
365} 365}
366 366
367void CalendarView::init() 367void CalendarView::init()
368{ 368{
369 mMultiResourceSync = false;
369 flag_blockConflict = false; 370 flag_blockConflict = false;
370 flag_blockScrollBar = false; 371 flag_blockScrollBar = false;
371 flag_checkFileFirsttime = true; 372 flag_checkFileFirsttime = true;
372 flag_clearallviewsEventDisplay = false; 373 flag_clearallviewsEventDisplay = false;
373 flag_clearallviewsupdateView = false; 374 flag_clearallviewsupdateView = false;
374 mNextAlarmDateTime = QDateTime::currentDateTime(); 375 mNextAlarmDateTime = QDateTime::currentDateTime();
375 setFocusPolicy (NoFocus ); 376 setFocusPolicy (NoFocus );
376 mViewerCallerIsSearchDialog = false; 377 mViewerCallerIsSearchDialog = false;
377 mBlockShowDates = false; 378 mBlockShowDates = false;
378 mConflictingEvent = 0; 379 mConflictingEvent = 0;
379 mDatePickerMode = 0; 380 mDatePickerMode = 0;
380 mCurrentSyncDevice = ""; 381 mCurrentSyncDevice = "";
381 mViewManager = new KOViewManager( this ); 382 mViewManager = new KOViewManager( this );
382 mDialogManager = new KODialogManager( this ); 383 mDialogManager = new KODialogManager( this );
383 mEventViewerDialog = 0; 384 mEventViewerDialog = 0;
384 mModified = false; 385 mModified = false;
385 mReadOnly = false; 386 mReadOnly = false;
386 mSelectedIncidence = 0; 387 mSelectedIncidence = 0;
387 mCalPrinter = 0; 388 mCalPrinter = 0;
388 mFilters.setAutoDelete(true); 389 mFilters.setAutoDelete(true);
389 390
390 mCalendar->registerObserver( this ); 391 mCalendar->registerObserver( this );
391 // TODO: Make sure that view is updated, when calendar is changed. 392 // TODO: Make sure that view is updated, when calendar is changed.
392 393
393 mStorage = new FileStorage( mCalendar ); 394 mStorage = new FileStorage( mCalendar );
394 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 395 mNavigator = new DateNavigator( this, "datevav", mViewManager );
395 396
396 QBoxLayout *topLayout = (QBoxLayout*)layout(); 397 QBoxLayout *topLayout = (QBoxLayout*)layout();
397#ifndef KORG_NOSPLITTER 398#ifndef KORG_NOSPLITTER
398 // create the main layout frames. 399 // create the main layout frames.
399 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 400 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
400 topLayout->addWidget(mPanner); 401 topLayout->addWidget(mPanner);
@@ -1523,64 +1524,65 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
1523 return result; 1524 return result;
1524 1525
1525 break; 1526 break;
1526 case SYNC_PREF_FORCE_LOCAL: 1527 case SYNC_PREF_FORCE_LOCAL:
1527 return 1; 1528 return 1;
1528 break; 1529 break;
1529 case SYNC_PREF_FORCE_REMOTE: 1530 case SYNC_PREF_FORCE_REMOTE:
1530 return 2; 1531 return 2;
1531 break; 1532 break;
1532 1533
1533 default: 1534 default:
1534 // SYNC_PREF_TAKE_BOTH not implemented 1535 // SYNC_PREF_TAKE_BOTH not implemented
1535 break; 1536 break;
1536 } 1537 }
1537 return 0; 1538 return 0;
1538} 1539}
1539Event* CalendarView::getLastSyncEvent() 1540Event* CalendarView::getLastSyncEvent()
1540{ 1541{
1541 Event* lse; 1542 Event* lse;
1542 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 1543 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
1543 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); 1544 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice );
1544 if (!lse) { 1545 if (!lse) {
1545 lse = new Event(); 1546 lse = new Event();
1546 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); 1547 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice );
1547 QString sum = ""; 1548 QString sum = "";
1548 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) 1549 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
1549 sum = "E: "; 1550 sum = "E: ";
1550 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); 1551 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event"));
1551 lse->setDtStart( mLastCalendarSync ); 1552 lse->setDtStart( mLastCalendarSync );
1552 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 1553 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
1553 lse->setCategories( i18n("SyncEvent") ); 1554 lse->setCategories( i18n("SyncEvent") );
1554 lse->setReadOnly( true ); 1555 lse->setReadOnly( true );
1556 lse->setCalID( 1 );
1555 mCalendar->addEvent( lse ); 1557 mCalendar->addEvent( lse );
1556 } 1558 }
1557 1559
1558 return lse; 1560 return lse;
1559 1561
1560} 1562}
1561 1563
1562// we check, if the to delete event has a id for a profile 1564// we check, if the to delete event has a id for a profile
1563// if yes, we set this id in the profile to delete 1565// if yes, we set this id in the profile to delete
1564void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) 1566void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete )
1565{ 1567{
1566 if ( lastSync.count() == 0 ) { 1568 if ( lastSync.count() == 0 ) {
1567 //qDebug(" lastSync.count() == 0"); 1569 //qDebug(" lastSync.count() == 0");
1568 return; 1570 return;
1569 } 1571 }
1570 if ( toDelete->typeID() == journalID ) 1572 if ( toDelete->typeID() == journalID )
1571 return; 1573 return;
1572 1574
1573 Event* eve = lastSync.first(); 1575 Event* eve = lastSync.first();
1574 1576
1575 while ( eve ) { 1577 while ( eve ) {
1576 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name 1578 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name
1577 if ( !id.isEmpty() ) { 1579 if ( !id.isEmpty() ) {
1578 QString des = eve->description(); 1580 QString des = eve->description();
1579 QString pref = "e"; 1581 QString pref = "e";
1580 if ( toDelete->typeID() == todoID ) 1582 if ( toDelete->typeID() == todoID )
1581 pref = "t"; 1583 pref = "t";
1582 des += pref+ id + ","; 1584 des += pref+ id + ",";
1583 eve->setReadOnly( false ); 1585 eve->setReadOnly( false );
1584 eve->setDescription( des ); 1586 eve->setDescription( des );
1585 //qDebug("setdes %s ", des.latin1()); 1587 //qDebug("setdes %s ", des.latin1());
1586 eve->setReadOnly( true ); 1588 eve->setReadOnly( true );
@@ -1873,74 +1875,79 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1873 if ( mSyncManager->mWriteBackInFuture ) { 1875 if ( mSyncManager->mWriteBackInFuture ) {
1874 er = remote->rawIncidences(); 1876 er = remote->rawIncidences();
1875 remRem = er.count(); 1877 remRem = er.count();
1876 inR = er.first(); 1878 inR = er.first();
1877 QDateTime dt; 1879 QDateTime dt;
1878 QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) ); 1880 QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) );
1879 QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 ); 1881 QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 );
1880 while ( inR ) { 1882 while ( inR ) {
1881 if ( inR->typeID() == todoID ) { 1883 if ( inR->typeID() == todoID ) {
1882 Todo * t = (Todo*)inR; 1884 Todo * t = (Todo*)inR;
1883 if ( t->hasDueDate() ) 1885 if ( t->hasDueDate() )
1884 dt = t->dtDue(); 1886 dt = t->dtDue();
1885 else 1887 else
1886 dt = cur.addSecs( 62 ); 1888 dt = cur.addSecs( 62 );
1887 } 1889 }
1888 else if (inR->typeID() == eventID ) { 1890 else if (inR->typeID() == eventID ) {
1889 bool ok; 1891 bool ok;
1890 dt = inR->getNextOccurence( cur, &ok ); 1892 dt = inR->getNextOccurence( cur, &ok );
1891 if ( !ok ) 1893 if ( !ok )
1892 dt = cur.addSecs( -62 ); 1894 dt = cur.addSecs( -62 );
1893 } 1895 }
1894 else 1896 else
1895 dt = inR->dtStart(); 1897 dt = inR->dtStart();
1896 if ( dt < cur || dt > end ) { 1898 if ( dt < cur || dt > end ) {
1897 remote->deleteIncidence( inR ); 1899 remote->deleteIncidence( inR );
1898 ++delFut; 1900 ++delFut;
1899 } 1901 }
1900 inR = er.next(); 1902 inR = er.next();
1901 } 1903 }
1902 } 1904 }
1903 bar.hide(); 1905 bar.hide();
1904 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1906 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1905 eventLSync->setReadOnly( false ); 1907 if ( mMultiResourceSync ) {
1906 eventLSync->setDtStart( mLastCalendarSync ); 1908 remote->removeSyncInfo( "" ); //all
1907 eventRSync->setDtStart( mLastCalendarSync ); 1909
1908 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1910 } else {
1909 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1911 eventLSync->setReadOnly( false );
1910 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1912 eventLSync->setDtStart( mLastCalendarSync );
1911 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1913 eventRSync->setDtStart( mLastCalendarSync );
1912 eventLSync->setReadOnly( true ); 1914 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1915 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1916 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1917 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1918 eventLSync->setReadOnly( true );
1919 }
1913 qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL ); 1920 qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL );
1914 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... 1921 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop() && !mMultiResourceSync ) // kde is abnormal...
1915 remote->addEvent( eventRSync ); 1922 remote->addEvent( eventRSync );
1916 else 1923 else
1917 delete eventRSync; 1924 delete eventRSync;
1918 qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() ); 1925 qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() );
1919 QString mes; 1926 QString mes;
1920 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\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT ); 1927 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\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT );
1921 QString delmess; 1928 QString delmess;
1922 if ( delFut ) { 1929 if ( delFut ) {
1923 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut); 1930 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut);
1924 mes += delmess; 1931 mes += delmess;
1925 } 1932 }
1926 mes = i18n("Local calendar changed!\n") +mes; 1933 mes = i18n("Local calendar changed!\n") +mes;
1927 mCalendar->checkAlarmForIncidence( 0, true ); 1934 mCalendar->checkAlarmForIncidence( 0, true );
1928 qDebug( mes ); 1935 qDebug( mes );
1929 if ( mSyncManager->mShowSyncSummary ) { 1936 if ( mSyncManager->mShowSyncSummary ) {
1930 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, 1937 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
1931 i18n("KO/Pi Synchronization"),i18n("Write back"))) { 1938 i18n("KO/Pi Synchronization"),i18n("Write back"))) {
1932 qDebug("KO: WB cancelled "); 1939 qDebug("KO: WB cancelled ");
1933 mSyncManager->mWriteBackFile = false; 1940 mSyncManager->mWriteBackFile = false;
1934 return syncOK; 1941 return syncOK;
1935 } 1942 }
1936 } 1943 }
1937 return syncOK; 1944 return syncOK;
1938} 1945}
1939 1946
1940void CalendarView::setSyncDevice( QString s ) 1947void CalendarView::setSyncDevice( QString s )
1941{ 1948{
1942 mCurrentSyncDevice= s; 1949 mCurrentSyncDevice= s;
1943} 1950}
1944void CalendarView::setSyncName( QString s ) 1951void CalendarView::setSyncName( QString s )
1945{ 1952{
1946 mCurrentSyncName= s; 1953 mCurrentSyncName= s;
@@ -2406,64 +2413,90 @@ bool CalendarView::openCalendar(QString filename, bool merge)
2406 } 2413 }
2407 return true; 2414 return true;
2408 } else { 2415 } else {
2409 // while failing to load, the calendar object could 2416 // while failing to load, the calendar object could
2410 // have become partially populated. Clear it out. 2417 // have become partially populated. Clear it out.
2411 if ( !merge ) { 2418 if ( !merge ) {
2412 mCalendar->close(); 2419 mCalendar->close();
2413 mViewManager->setDocumentId( filename ); 2420 mViewManager->setDocumentId( filename );
2414 mDialogManager->setDocumentId( filename ); 2421 mDialogManager->setDocumentId( filename );
2415 mTodoList->setDocumentId( filename ); 2422 mTodoList->setDocumentId( filename );
2416 } 2423 }
2417 2424
2418 //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); 2425 //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename));
2419 2426
2420 QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); 2427 QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) );
2421 globalFlagBlockAgenda = 2; 2428 globalFlagBlockAgenda = 2;
2422 mCalendar->reInitAlarmSettings(); 2429 mCalendar->reInitAlarmSettings();
2423 setSyncEventsReadOnly(); 2430 setSyncEventsReadOnly();
2424 updateUnmanagedViews(); 2431 updateUnmanagedViews();
2425 updateView(); 2432 updateView();
2426 } 2433 }
2427 return false; 2434 return false;
2428} 2435}
2429void CalendarView::mergeFile( QString fn ) 2436void CalendarView::mergeFile( QString fn )
2430{ 2437{
2431 clearAllViews(); 2438 clearAllViews();
2432 mCalendar->mergeCalendarFile( fn ); 2439 mCalendar->mergeCalendarFile( fn );
2433 mCalendar->reInitAlarmSettings(); 2440 mCalendar->reInitAlarmSettings();
2434 setSyncEventsReadOnly(); 2441 setSyncEventsReadOnly();
2435 updateUnmanagedViews(); 2442 updateUnmanagedViews();
2436 updateView(); 2443 updateView();
2437} 2444}
2445void CalendarView::mergeFileResource( QString fn ,QString resource )
2446{
2447
2448 if ( resource == "ALL" ) {
2449 mergeFile( fn );
2450 return;
2451 }
2452
2453 int exclusiveResource = KOPrefs::instance()->getFuzzyCalendarID( resource );
2454 if ( !exclusiveResource ) {
2455 qDebug("KO: CalendarView::mergeFileResource: resource not found %s", resource.latin1() );
2456 return;
2457 }
2458 clearAllViews();
2459 mCalendar->setCalendarRemove( exclusiveResource );
2460 int def = mCalendar->defaultCalendar();
2461 mCalendar->setDefaultCalendar(exclusiveResource);
2462 if ( !mCalendar->addCalendarFile( fn, exclusiveResource )) {
2463 qDebug("KO: CalendarView::mergeFileResource: error adding file %s", fn.latin1() );
2464 }
2465 mCalendar->setDefaultCalendar( def );
2466 mCalendar->reInitAlarmSettings();
2467 setSyncEventsReadOnly();
2468 updateUnmanagedViews();
2469 updateView();
2470}
2438void CalendarView::showOpenError() 2471void CalendarView::showOpenError()
2439{ 2472{
2440 KMessageBox::error(this,i18n("Couldn't load calendar\n.")); 2473 KMessageBox::error(this,i18n("Couldn't load calendar\n."));
2441} 2474}
2442void CalendarView::setLoadedFileVersion(QDateTime dt) 2475void CalendarView::setLoadedFileVersion(QDateTime dt)
2443{ 2476{
2444 loadedFileVersion = dt; 2477 loadedFileVersion = dt;
2445} 2478}
2446bool CalendarView::checkFileChanged(QString fn) 2479bool CalendarView::checkFileChanged(QString fn)
2447{ 2480{
2448 QFileInfo finf ( fn ); 2481 QFileInfo finf ( fn );
2449 if ( !finf.exists() ) 2482 if ( !finf.exists() )
2450 return true; 2483 return true;
2451 QDateTime dt = finf.lastModified (); 2484 QDateTime dt = finf.lastModified ();
2452 if ( dt <= loadedFileVersion ) 2485 if ( dt <= loadedFileVersion )
2453 return false; 2486 return false;
2454 return true; 2487 return true;
2455 2488
2456} 2489}
2457void CalendarView::watchSavedFile() 2490void CalendarView::watchSavedFile()
2458{ 2491{
2459 QFileInfo finf ( MainWindow::defaultFileName()); 2492 QFileInfo finf ( MainWindow::defaultFileName());
2460 if ( !finf.exists() ) 2493 if ( !finf.exists() )
2461 return; 2494 return;
2462 QDateTime dt = finf.lastModified (); 2495 QDateTime dt = finf.lastModified ();
2463 if ( dt < loadedFileVersion ) { 2496 if ( dt < loadedFileVersion ) {
2464 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); 2497 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1());
2465 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); 2498 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) );
2466 return; 2499 return;
2467 } 2500 }
2468 loadedFileVersion = dt; 2501 loadedFileVersion = dt;
2469} 2502}
@@ -2493,100 +2526,118 @@ bool CalendarView::checkAllFileVersions()
2493 } 2526 }
2494 } 2527 }
2495 cal = calendars.next(); 2528 cal = calendars.next();
2496 } 2529 }
2497 loadedFileVersion = storeTemp; 2530 loadedFileVersion = storeTemp;
2498 return true; 2531 return true;
2499} 2532}
2500bool CalendarView::checkFileVersion(QString fn) 2533bool CalendarView::checkFileVersion(QString fn)
2501{ 2534{
2502 QFileInfo finf ( fn ); 2535 QFileInfo finf ( fn );
2503 if ( !finf.exists() ) 2536 if ( !finf.exists() )
2504 return true; 2537 return true;
2505 QDateTime dt = finf.lastModified (); 2538 QDateTime dt = finf.lastModified ();
2506 //qDebug("loaded file version %s %s", fn.latin1(), loadedFileVersion.toString().latin1()); 2539 //qDebug("loaded file version %s %s", fn.latin1(), loadedFileVersion.toString().latin1());
2507 //qDebug("file on disk version %s %s", fn.latin1(),dt.toString().latin1()); 2540 //qDebug("file on disk version %s %s", fn.latin1(),dt.toString().latin1());
2508 if ( dt <= loadedFileVersion ) 2541 if ( dt <= loadedFileVersion )
2509 return true; 2542 return true;
2510 int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file\n%1\non disk has changed!\nFile size: %2 bytes.\nLast modified: %3\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg(KGlobal::formatMessage(fn,0)).arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , 2543 int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file\n%1\non disk has changed!\nFile size: %2 bytes.\nLast modified: %3\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg(KGlobal::formatMessage(fn,0)).arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) ,
2511 i18n("KO/Pi Warning"),i18n("Overwrite"), 2544 i18n("KO/Pi Warning"),i18n("Overwrite"),
2512 i18n("Sync+save")); 2545 i18n("Sync+save"));
2513 2546
2514 if ( km == KMessageBox::Cancel ) 2547 if ( km == KMessageBox::Cancel )
2515 return false; 2548 return false;
2516 if ( km == KMessageBox::Yes ) 2549 if ( km == KMessageBox::Yes )
2517 return true; 2550 return true;
2518 2551
2519 setSyncDevice("deleteaftersync" ); 2552 setSyncDevice("deleteaftersync" );
2520 mSyncManager->mAskForPreferences = true; 2553 mSyncManager->mAskForPreferences = true;
2521 mSyncManager->mSyncAlgoPrefs = 3; 2554 mSyncManager->mSyncAlgoPrefs = 3;
2522 mSyncManager->mWriteBackFile = false; 2555 mSyncManager->mWriteBackFile = false;
2523 mSyncManager->mWriteBackExistingOnly = false; 2556 mSyncManager->mWriteBackExistingOnly = false;
2524 mSyncManager->mShowSyncSummary = false; 2557 mSyncManager->mShowSyncSummary = false;
2558 mMultiResourceSync = false;
2525 syncCalendar( fn, 3 ); 2559 syncCalendar( fn, 3 );
2526 Event * e = getLastSyncEvent(); 2560 Event * e = getLastSyncEvent();
2527 if ( e ) 2561 if ( e )
2528 mCalendar->deleteEvent( e ); 2562 mCalendar->deleteEvent( e );
2529 return true; 2563 return true;
2530} 2564}
2531bool CalendarView::saveCalendars() 2565bool CalendarView::saveCalendars()
2532{ 2566{
2533 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 2567 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
2534 KopiCalendarFile * cal = calendars.first(); 2568 KopiCalendarFile * cal = calendars.first();
2535 mCalendar->setDefaultCalendar( 1 ); 2569 mCalendar->setDefaultCalendar( 1 );
2536 mCalendar->setDefaultCalendarEnabledOnly(); 2570 mCalendar->setDefaultCalendarEnabledOnly();
2537 QString saveError; 2571 QString saveError;
2538 if ( !saveCalendar( MainWindow::defaultFileName() ) ) 2572 if ( !saveCalendar( MainWindow::defaultFileName() ) )
2539 saveError = cal->mName +"\n"; 2573 saveError = cal->mName +"\n";
2540 cal = calendars.next(); 2574 cal = calendars.next();
2541 while ( cal ) { 2575 while ( cal ) {
2542 if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { 2576 if ( !cal->isReadOnly && !cal->mErrorOnLoad ) {
2543 mCalendar->setDefaultCalendar( cal->mCalNumber ); 2577 mCalendar->setDefaultCalendar( cal->mCalNumber );
2544 mCalendar->setDefaultCalendarEnabledOnly(); 2578 mCalendar->setDefaultCalendarEnabledOnly();
2545 if ( saveCalendar( cal->mFileName ) ) 2579 if ( saveCalendar( cal->mFileName ) )
2546 cal->mLoadDt = QDateTime::currentDateTime(); 2580 cal->mLoadDt = QDateTime::currentDateTime();
2547 else 2581 else
2548 saveError += cal->mName + "\n"; 2582 saveError += cal->mName + "\n";
2549 } 2583 }
2550 cal = calendars.next(); 2584 cal = calendars.next();
2551 } 2585 }
2552 restoreCalendarSettings(); 2586 restoreCalendarSettings();
2553 //saveError = "test error"; 2587 //saveError = "test error";
2554 if ( !saveError.isEmpty() ) { 2588 if ( !saveError.isEmpty() ) {
2555 saveError = KGlobal::formatMessage( i18n("Calendar(s) not saved:"),0 )+"\n" + saveError; 2589 saveError = KGlobal::formatMessage( i18n("Calendar(s) not saved:"),0 )+"\n" + saveError;
2556 KMessageBox::error(this, saveError, i18n("Error saving data")); 2590 KMessageBox::error(this, saveError, i18n("Error saving data"));
2557 return false; 2591 return false;
2558 } 2592 }
2559 return true; 2593 return true;
2560} 2594}
2595bool CalendarView::saveCalendarResource(QString filename, QString resource)
2596{
2597 if ( resource == "ALL" )
2598 return saveCalendar( filename );
2599 int exclusiveResource = KOPrefs::instance()->getFuzzyCalendarID( resource );
2600 if ( !exclusiveResource ) {
2601 qDebug("KO: CalendarView::saveCalendarResource: resource not found %s", resource.latin1() );
2602 return false;
2603 }
2604 mCalendar->setDefaultCalendar( exclusiveResource );
2605 mCalendar->setDefaultCalendarEnabledOnly();
2606 mCalendar->setSyncEventsEnabled();
2607 bool res = saveCalendar( filename );
2608 restoreCalendarSettings();
2609 return res;
2610
2611}
2561bool CalendarView::saveCalendar( QString filename ) 2612bool CalendarView::saveCalendar( QString filename )
2562{ 2613{
2563 2614
2564 // Store back all unsaved data into calendar object 2615 // Store back all unsaved data into calendar object
2565 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); 2616 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() );
2566 if ( mViewManager->currentView() ) 2617 if ( mViewManager->currentView() )
2567 mViewManager->currentView()->flushView(); 2618 mViewManager->currentView()->flushView();
2568 2619
2569 2620
2570 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); 2621 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2);
2571 mStorage->setSaveFormat( new ICalFormat() ); 2622 mStorage->setSaveFormat( new ICalFormat() );
2572 mStorage->setFileName( filename ); 2623 mStorage->setFileName( filename );
2573 bool success; 2624 bool success;
2574 success = mStorage->save(); 2625 success = mStorage->save();
2575 if ( !success ) { 2626 if ( !success ) {
2576 return false; 2627 return false;
2577 } 2628 }
2578 if ( filename == MainWindow::defaultFileName() ) { 2629 if ( filename == MainWindow::defaultFileName() ) {
2579 setLoadedFileVersion( lfv ); 2630 setLoadedFileVersion( lfv );
2580 watchSavedFile(); 2631 watchSavedFile();
2581 } 2632 }
2582 return true; 2633 return true;
2583} 2634}
2584 2635
2585void CalendarView::closeCalendar() 2636void CalendarView::closeCalendar()
2586{ 2637{
2587 2638
2588 // child windows no longer valid 2639 // child windows no longer valid
2589 clearAllViews(); 2640 clearAllViews();
2590 emit closingDown(); 2641 emit closingDown();
2591 2642
2592 mCalendar->close(); 2643 mCalendar->close();
@@ -5003,65 +5054,69 @@ void CalendarView::purgeCompleted()
5003 i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); 5054 i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge"));
5004 5055
5005 if (result == KMessageBox::Continue) { 5056 if (result == KMessageBox::Continue) {
5006 5057
5007 QPtrList<Todo> todoCal; 5058 QPtrList<Todo> todoCal;
5008 QPtrList<Todo> rootTodos; 5059 QPtrList<Todo> rootTodos;
5009 //QPtrList<Incidence> rel; 5060 //QPtrList<Incidence> rel;
5010 Todo *aTodo; 5061 Todo *aTodo;
5011 todoCal = calendar()->todos(); 5062 todoCal = calendar()->todos();
5012 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { 5063 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
5013 if ( !aTodo->relatedTo() ) 5064 if ( !aTodo->relatedTo() )
5014 rootTodos.append( aTodo ); 5065 rootTodos.append( aTodo );
5015 } 5066 }
5016 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 5067 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
5017 removeCompletedSubTodos( aTodo ); 5068 removeCompletedSubTodos( aTodo );
5018 } 5069 }
5019 5070
5020 updateView(); 5071 updateView();
5021 } 5072 }
5022} 5073}
5023 5074
5024void CalendarView::slotCalendarChanged() 5075void CalendarView::slotCalendarChanged()
5025{ 5076{
5026 ; 5077 ;
5027} 5078}
5028 5079
5029void CalendarView::keyPressEvent ( QKeyEvent *e) 5080void CalendarView::keyPressEvent ( QKeyEvent *e)
5030{ 5081{
5031 //qDebug("CalendarView::keyPressEvent "); 5082 //qDebug("CalendarView::keyPressEvent ");
5032 e->ignore(); 5083 e->ignore();
5033} 5084}
5034 5085
5086void CalendarView::multiResourceSyncStart( bool start )
5087{
5088 mMultiResourceSync = start;
5035 5089
5090}
5036bool CalendarView::sync(KSyncManager* manager, QString filename, int mode,QString resource) 5091bool CalendarView::sync(KSyncManager* manager, QString filename, int mode,QString resource)
5037{ 5092{
5038 5093
5039 if ( manager != mSyncManager) 5094 if ( manager != mSyncManager)
5040 qDebug("KO: Internal error-1. SyncManager mismatch "); 5095 qDebug("KO: Internal error-1. SyncManager mismatch ");
5041 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { 5096 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
5042 qDebug("KO: SyncKDE request detected!"); 5097 qDebug("KO: SyncKDE request detected!");
5043 } 5098 }
5044 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 5099 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
5045 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 5100 mCurrentSyncName = mSyncManager->getCurrentSyncName();
5046 if ( !resource.isEmpty() ) { 5101 if ( !resource.isEmpty() ) {
5047 int exclusiveSyncResource = KOPrefs::instance()->getFuzzyCalendarID( resource ); 5102 int exclusiveSyncResource = KOPrefs::instance()->getFuzzyCalendarID( resource );
5048 qDebug( "KO: Sync request for resource: %s", resource.latin1() ); 5103 qDebug( "KO: Sync request for resource: %s", resource.latin1() );
5049 5104
5050 if ( !exclusiveSyncResource ) { 5105 if ( !exclusiveSyncResource ) {
5051 qDebug( "KO: Requested sync resource not found: %s", resource.latin1() ); 5106 qDebug( "KO: Requested sync resource not found: %s", resource.latin1() );
5052 return false; 5107 return false;
5053 } 5108 }
5054 mCalendar->setDefaultCalendar( exclusiveSyncResource ); 5109 mCalendar->setDefaultCalendar( exclusiveSyncResource );
5055 mCalendar->setDefaultCalendarEnabledOnly(); 5110 mCalendar->setDefaultCalendarEnabledOnly();
5056 } 5111 }
5057 bool result = syncCalendar( filename, mode ); 5112 bool result = syncCalendar( filename, mode );
5058 if ( !resource.isEmpty() ) 5113 if ( !resource.isEmpty() )
5059 restoreCalendarSettings(); 5114 restoreCalendarSettings();
5060 return result; 5115 return result;
5061} 5116}
5062bool CalendarView::syncExternal(KSyncManager* manager, QString resource) 5117bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
5063{ 5118{
5064 //mSyncManager = manager; 5119 //mSyncManager = manager;
5065 if ( manager != mSyncManager) 5120 if ( manager != mSyncManager)
5066 qDebug("KO: Internal error-2. SyncManager mismatch "); 5121 qDebug("KO: Internal error-2. SyncManager mismatch ");
5067 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 5122 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index f85b6a3..60b1276 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -110,171 +110,174 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
110 Constructs a new calendar view widget. 110 Constructs a new calendar view widget.
111 111
112 @param calendar calendar document 112 @param calendar calendar document
113 @param parent parent window 113 @param parent parent window
114 @param name Qt internal widget object name 114 @param name Qt internal widget object name
115 */ 115 */
116 CalendarView( CalendarResources *calendar, QWidget *parent = 0, 116 CalendarView( CalendarResources *calendar, QWidget *parent = 0,
117 const char *name = 0 ); 117 const char *name = 0 );
118 CalendarView( Calendar *calendar, QWidget *parent = 0, 118 CalendarView( Calendar *calendar, QWidget *parent = 0,
119 const char *name = 0 ); 119 const char *name = 0 );
120 virtual ~CalendarView(); 120 virtual ~CalendarView();
121 121
122 Calendar *calendar() { return mCalendar; } 122 Calendar *calendar() { return mCalendar; }
123 123
124 KOViewManager *viewManager(); 124 KOViewManager *viewManager();
125 KODialogManager *dialogManager(); 125 KODialogManager *dialogManager();
126 126
127 QDate startDate(); 127 QDate startDate();
128 QDate endDate(); 128 QDate endDate();
129 129
130 QWidgetStack *viewStack(); 130 QWidgetStack *viewStack();
131 QWidget *leftFrame(); 131 QWidget *leftFrame();
132 132
133 DateNavigator *dateNavigator(); 133 DateNavigator *dateNavigator();
134 KDateNavigator *dateNavigatorWidget(); 134 KDateNavigator *dateNavigatorWidget();
135 135
136 void addView(KOrg::BaseView *); 136 void addView(KOrg::BaseView *);
137 void showView(KOrg::BaseView *); 137 void showView(KOrg::BaseView *);
138 KOEventViewerDialog* getEventViewerDialog(); 138 KOEventViewerDialog* getEventViewerDialog();
139 Incidence *currentSelection(); 139 Incidence *currentSelection();
140 void checkSuspendAlarm(); 140 void checkSuspendAlarm();
141 void mergeFile( QString fn ); 141 void mergeFile( QString fn );
142 void mergeFileResource( QString fn ,QString res);
142 143
143 signals: 144 signals:
144 void save (); 145 void save ();
145 void saveStopTimer (); 146 void saveStopTimer ();
146 void tempDisableBR(bool); 147 void tempDisableBR(bool);
147 /** This todo has been modified */ 148 /** This todo has been modified */
148 void todoModified(Todo *, int); 149 void todoModified(Todo *, int);
149 150
150 /** when change is made to options dialog, the topwidget will catch this 151 /** when change is made to options dialog, the topwidget will catch this
151 * and emit this signal which notifies all widgets which have registered 152 * and emit this signal which notifies all widgets which have registered
152 * for notification to update their settings. */ 153 * for notification to update their settings. */
153 void configChanged(); 154 void configChanged();
154 /** emitted when the topwidget is closing down, so that any attached 155 /** emitted when the topwidget is closing down, so that any attached
155 child windows can also close. */ 156 child windows can also close. */
156 void closingDown(); 157 void closingDown();
157 /** emitted right before we die */ 158 /** emitted right before we die */
158 void closed(QWidget *); 159 void closed(QWidget *);
159 160
160 /** Emitted when state of modified flag changes */ 161 /** Emitted when state of modified flag changes */
161 void modifiedChanged(bool); 162 void modifiedChanged(bool);
162 void signalmodified(); 163 void signalmodified();
163 164
164 /** Emitted when state of read-only flag changes */ 165 /** Emitted when state of read-only flag changes */
165 void readOnlyChanged(bool); 166 void readOnlyChanged(bool);
166 167
167 /** Emitted when the unit of navigation changes */ 168 /** Emitted when the unit of navigation changes */
168 void changeNavStringPrev(const QString &); 169 void changeNavStringPrev(const QString &);
169 void changeNavStringNext(const QString &); 170 void changeNavStringNext(const QString &);
170 171
171 /** Emitted when state of events selection has changed and user is organizer*/ 172 /** Emitted when state of events selection has changed and user is organizer*/
172 void organizerEventsSelected(bool); 173 void organizerEventsSelected(bool);
173 /** Emitted when state of events selection has changed and user is attendee*/ 174 /** Emitted when state of events selection has changed and user is attendee*/
174 void groupEventsSelected(bool); 175 void groupEventsSelected(bool);
175 /** 176 /**
176 Emitted when an incidence gets selected. If the selection is cleared the 177 Emitted when an incidence gets selected. If the selection is cleared the
177 signal is emitted with 0 as argument. 178 signal is emitted with 0 as argument.
178 */ 179 */
179 void incidenceSelected( Incidence * ); 180 void incidenceSelected( Incidence * );
180 /** Emitted, when a todoitem is selected or deselected. */ 181 /** Emitted, when a todoitem is selected or deselected. */
181 void todoSelected( bool ); 182 void todoSelected( bool );
182 183
183 /** 184 /**
184 Emitted, when clipboard content changes. Parameter indicates if paste 185 Emitted, when clipboard content changes. Parameter indicates if paste
185 is possible or not. 186 is possible or not.
186 */ 187 */
187 void pasteEnabled(bool); 188 void pasteEnabled(bool);
188 189
189 /** Emitted, when the number of incoming messages has changed. */ 190 /** Emitted, when the number of incoming messages has changed. */
190 void numIncomingChanged(int); 191 void numIncomingChanged(int);
191 192
192 /** Emitted, when the number of outgoing messages has changed. */ 193 /** Emitted, when the number of outgoing messages has changed. */
193 void numOutgoingChanged(int); 194 void numOutgoingChanged(int);
194 195
195 /** Send status message, which can e.g. be displayed in the status bar. */ 196 /** Send status message, which can e.g. be displayed in the status bar. */
196 void statusMessage(const QString &); 197 void statusMessage(const QString &);
197 198
198 void calendarViewExpanded( bool ); 199 void calendarViewExpanded( bool );
199 void updateSearchDialog(); 200 void updateSearchDialog();
200 void filtersUpdated(); 201 void filtersUpdated();
201 202
202 203
203 public slots: 204 public slots:
205 void multiResourceSyncStart( bool );
204 void displayCalendarInfo( int id ); 206 void displayCalendarInfo( int id );
205 void nextConflict( bool all, bool allday ); 207 void nextConflict( bool all, bool allday );
206 void conflictAll(); 208 void conflictAll();
207 void conflictAllday(); 209 void conflictAllday();
208 void conflictNotAll(); 210 void conflictNotAll();
209 void setCalReadOnly( int id, bool readO ); 211 void setCalReadOnly( int id, bool readO );
210 void checkAlarms(); 212 void checkAlarms();
211 void checkFiles(); 213 void checkFiles();
212 void slotprintSelInc(); 214 void slotprintSelInc();
213 void showNextAlarms(); 215 void showNextAlarms();
214 void showOpenError(); 216 void showOpenError();
215 void watchSavedFile(); 217 void watchSavedFile();
216 void recheckTimerAlarm(); 218 void recheckTimerAlarm();
217 void checkNextTimerAlarm(); 219 void checkNextTimerAlarm();
218 void addAlarm(const QDateTime &qdt, const QString &noti ); 220 void addAlarm(const QDateTime &qdt, const QString &noti );
219 void addSuspendAlarm(const QDateTime &qdt, const QString &noti ); 221 void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
220 void removeAlarm(const QDateTime &qdt, const QString &noti ); 222 void removeAlarm(const QDateTime &qdt, const QString &noti );
221 223
222 /** options dialog made a changed to the configuration. we catch this 224 /** options dialog made a changed to the configuration. we catch this
223 * and notify all widgets which need to update their configuration. */ 225 * and notify all widgets which need to update their configuration. */
224 void updateConfig(); 226 void updateConfig();
225 227
226 void insertBirthdays(const QString& uid, const QStringList& birthdayList, 228 void insertBirthdays(const QString& uid, const QStringList& birthdayList,
227 const QStringList& anniversaryList, const QStringList& realNameList, 229 const QStringList& anniversaryList, const QStringList& realNameList,
228 const QStringList& emailList, const QStringList& assembledNameList, 230 const QStringList& emailList, const QStringList& assembledNameList,
229 const QStringList& uidList); 231 const QStringList& uidList);
230 232
231 /** 233 /**
232 Load calendar from file \a filename. If \a merge is true, load 234 Load calendar from file \a filename. If \a merge is true, load
233 calendar into existing one, if it is false, clear calendar, before 235 calendar into existing one, if it is false, clear calendar, before
234 loading. Return true, if calendar could be successfully loaded. 236 loading. Return true, if calendar could be successfully loaded.
235 */ 237 */
236 bool openCalendar(QString filename, bool merge=false); 238 bool openCalendar(QString filename, bool merge=false);
237 bool loadCalendars(); 239 bool loadCalendars();
238 bool saveCalendars(); 240 bool saveCalendars();
239 bool restoreCalendarSettings(); 241 bool restoreCalendarSettings();
240 bool addCalendar( KopiCalendarFile * ); 242 bool addCalendar( KopiCalendarFile * );
241 void addCalendarId( int id ); 243 void addCalendarId( int id );
242 bool syncCalendar(QString filename,int mode = 0 ); 244 bool syncCalendar(QString filename,int mode = 0 );
243 245
244 /** 246 /**
245 Save calendar data to file. Return true if calendar could be 247 Save calendar data to file. Return true if calendar could be
246 successfully saved. 248 successfully saved.
247 */ 249 */
248 bool saveCalendar(QString filename); 250 bool saveCalendar(QString filename);
251 bool saveCalendarResource(QString filename, QString resource);
249 252
250 /** 253 /**
251 Close calendar. Clear calendar data and reset views to display an empty 254 Close calendar. Clear calendar data and reset views to display an empty
252 calendar. 255 calendar.
253 */ 256 */
254 void closeCalendar(); 257 void closeCalendar();
255 258
256 /** Archive old events of calendar */ 259 /** Archive old events of calendar */
257 void archiveCalendar(); 260 void archiveCalendar();
258 261
259 void showIncidence(); 262 void showIncidence();
260 void editIncidence(); 263 void editIncidence();
261 void editIncidenceDescription(); 264 void editIncidenceDescription();
262 void deleteIncidence(); 265 void deleteIncidence();
263 void cloneIncidence(); 266 void cloneIncidence();
264 void moveIncidence(); 267 void moveIncidence();
265 void beamIncidence(); 268 void beamIncidence();
266 void toggleCancelIncidence(); 269 void toggleCancelIncidence();
267 270
268 /** create an editeventwin with supplied date/time, and if bool is true, 271 /** create an editeventwin with supplied date/time, and if bool is true,
269 * make the event take all day. */ 272 * make the event take all day. */
270 void newEvent(QDateTime, QDateTime, bool allDay ); 273 void newEvent(QDateTime, QDateTime, bool allDay );
271 void newEvent(QDateTime, QDateTime); 274 void newEvent(QDateTime, QDateTime);
272 void newEvent(QDateTime fh); 275 void newEvent(QDateTime fh);
273 void newEvent(QDate dt); 276 void newEvent(QDate dt);
274 /** create new event without having a date hint. Takes current date as 277 /** create new event without having a date hint. Takes current date as
275 default hint. */ 278 default hint. */
276 void newEvent(); 279 void newEvent();
277 void newFloatingEvent(); 280 void newFloatingEvent();
278 281
279 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ 282 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/
280 void showIncidence(Incidence *); 283 void showIncidence(Incidence *);
@@ -510,64 +513,65 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
510 void beamDone( Ir *ir ); 513 void beamDone( Ir *ir );
511 /** Select a view or adapt the current view to display the specified dates. */ 514 /** Select a view or adapt the current view to display the specified dates. */
512 void showDates( const KCal::DateList & ); 515 void showDates( const KCal::DateList & );
513 void selectWeekNum ( int ); 516 void selectWeekNum ( int );
514 void checkConflictForEvent(); 517 void checkConflictForEvent();
515 518
516 public: 519 public:
517 void createRunningDate4Todo( Todo * runT, QDateTime start , QDateTime end, int secLenRunning, int secLenPausing,int dayInterval ); 520 void createRunningDate4Todo( Todo * runT, QDateTime start , QDateTime end, int secLenRunning, int secLenPausing,int dayInterval );
518 // show a standard warning 521 // show a standard warning
519 // returns KMsgBox::yesNoCancel() 522 // returns KMsgBox::yesNoCancel()
520 int msgCalModified(); 523 int msgCalModified();
521 virtual bool sync(KSyncManager* manager, QString filename, int mode, QString resource); 524 virtual bool sync(KSyncManager* manager, QString filename, int mode, QString resource);
522 525
523 virtual bool syncExternal(KSyncManager* manager, QString resource); 526 virtual bool syncExternal(KSyncManager* manager, QString resource);
524 virtual void removeSyncInfo( QString syncProfile); 527 virtual void removeSyncInfo( QString syncProfile);
525 void setSyncManager(KSyncManager* manager); 528 void setSyncManager(KSyncManager* manager);
526 void setLoadedFileVersion(QDateTime); 529 void setLoadedFileVersion(QDateTime);
527 bool checkFileVersion(QString fn); 530 bool checkFileVersion(QString fn);
528 bool checkAllFileVersions(); 531 bool checkAllFileVersions();
529 bool checkFileChanged(QString fn); 532 bool checkFileChanged(QString fn);
530 Event* getLastSyncEvent(); 533 Event* getLastSyncEvent();
531 /** Adapt navigation units correpsonding to step size of navigation of the 534 /** Adapt navigation units correpsonding to step size of navigation of the
532 * current view. 535 * current view.
533 */ 536 */
534 void adaptNavigationUnits(); 537 void adaptNavigationUnits();
535 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); 538 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode );
536 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); 539 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false );
537 //Attendee* getYourAttendee(Event *event); 540 //Attendee* getYourAttendee(Event *event);
538 void setBlockShowDates( bool b ) { mBlockShowDates = b ;} 541 void setBlockShowDates( bool b ) { mBlockShowDates = b ;}
539 void setScrollBarStep(int val ); 542 void setScrollBarStep(int val );
540 543
541 protected: 544 protected:
545 bool mMultiResourceSync;
542 Event *mConflictingEvent; 546 Event *mConflictingEvent;
543 void schedule(Scheduler::Method, Incidence *incidence = 0); 547 void schedule(Scheduler::Method, Incidence *incidence = 0);
544 548
545 // returns KMsgBox::OKCandel() 549 // returns KMsgBox::OKCandel()
546 int msgItemDelete(const QString name); 550 int msgItemDelete(const QString name);
547 void showEventEditor(); 551 void showEventEditor();
548 void showTodoEditor(); 552 void showTodoEditor();
549 Todo *selectedTodo(); 553 Todo *selectedTodo();
550 private: 554 private:
551#ifdef DESKTOP_VERSION 555#ifdef DESKTOP_VERSION
552 QScrollBar * mDateScrollBar; 556 QScrollBar * mDateScrollBar;
553#endif 557#endif
554 bool flag_blockConflict; 558 bool flag_blockConflict;
555 bool flag_blockScrollBar; 559 bool flag_blockScrollBar;
556 bool flag_checkFileFirsttime; 560 bool flag_checkFileFirsttime;
557 bool flag_clearallviewsEventDisplay; 561 bool flag_clearallviewsEventDisplay;
558 bool flag_clearallviewsupdateView; 562 bool flag_clearallviewsupdateView;
559 QDateTime mNextAlarmDateTime; 563 QDateTime mNextAlarmDateTime;
560 bool mViewerCallerIsSearchDialog; 564 bool mViewerCallerIsSearchDialog;
561 bool mBlockShowDates; 565 bool mBlockShowDates;
562 KSyncManager* mSyncManager; 566 KSyncManager* mSyncManager;
563 AlarmDialog * mAlarmDialog; 567 AlarmDialog * mAlarmDialog;
564 QString mAlarmNotification; 568 QString mAlarmNotification;
565 QString mSuspendAlarmNotification; 569 QString mSuspendAlarmNotification;
566 QTimer* mSuspendTimer; 570 QTimer* mSuspendTimer;
567 QTimer* mAlarmTimer; 571 QTimer* mAlarmTimer;
568 QTimer* mRecheckAlarmTimer; 572 QTimer* mRecheckAlarmTimer;
569 void computeAlarm( QString ); 573 void computeAlarm( QString );
570 void startAlarm( QString, QString ); 574 void startAlarm( QString, QString );
571 void setSyncEventsReadOnly(); 575 void setSyncEventsReadOnly();
572 576
573 QDateTime loadedFileVersion; 577 QDateTime loadedFileVersion;
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 66bb19b..69ccde1 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -345,66 +345,68 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) :
345 } 345 }
346 } 346 }
347 mView->saveCalendar( defaultFileName() ); 347 mView->saveCalendar( defaultFileName() );
348 newFile = true; 348 newFile = true;
349 } 349 }
350 350
351 //QTime neededSaveTime = QDateTime::currentDateTime().time(); 351 //QTime neededSaveTime = QDateTime::currentDateTime().time();
352 //mView->loadCalendars(); 352 //mView->loadCalendars();
353 //int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 353 //int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
354 //qDebug("KO: Calendar loading time: %d ms",msNeeded ); 354 //qDebug("KO: Calendar loading time: %d ms",msNeeded );
355 355
356 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 356 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
357 KOPrefs::instance()->setAllDefaults(); 357 KOPrefs::instance()->setAllDefaults();
358 } 358 }
359 359
360 360
361 connect( mView, SIGNAL( tempDisableBR(bool) ), 361 connect( mView, SIGNAL( tempDisableBR(bool) ),
362 SLOT( disableBR(bool) ) ); 362 SLOT( disableBR(bool) ) );
363 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 363 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
364 setCentralWidget( mView ); 364 setCentralWidget( mView );
365 globalFlagBlockStartup = 0; 365 globalFlagBlockStartup = 0;
366 //mView->show(); 366 //mView->show();
367 //delete splash; 367 //delete splash;
368 if ( newFile ) 368 if ( newFile )
369 mView->updateConfig(); 369 mView->updateConfig();
370 // qApp->processEvents(); 370 // qApp->processEvents();
371 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 371 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
372 //fillSyncMenu(); 372 //fillSyncMenu();
373 373
374 374
375 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 375 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
376 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 376 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
377 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 377 connect(mSyncManager , SIGNAL( request_file(const QString &) ), this, SLOT( syncFileRequest(const QString &) ) );
378 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 378 connect(mSyncManager , SIGNAL( getFile( bool, const QString &)), this, SLOT(getFile( bool,const QString & ) ) );
379 connect(mSyncManager , SIGNAL( multiResourceSyncStart( bool )), mView, SLOT( multiResourceSyncStart( bool ) ) );
380
379 mSyncManager->setDefaultFileName( sentSyncFile()); 381 mSyncManager->setDefaultFileName( sentSyncFile());
380 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 382 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
381 mSyncManager->fillSyncMenu(); 383 mSyncManager->fillSyncMenu();
382 384
383 385
384 386
385 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 387 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
386 if ( showWarning ) { 388 if ( showWarning ) {
387 KMessageBox::information( this, 389 KMessageBox::information( this,
388 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); 390 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
389 //qApp->processEvents(); 391 //qApp->processEvents();
390 mView->dialogManager()->showSyncOptions(); 392 mView->dialogManager()->showSyncOptions();
391 } 393 }
392 394
393 //US listen for result adressed from Ka/Pi 395 //US listen for result adressed from Ka/Pi
394 396
395#ifndef DESKTOP_VERSION 397#ifndef DESKTOP_VERSION
396 infrared = 0; 398 infrared = 0;
397#endif 399#endif
398 updateFilterToolbar(); 400 updateFilterToolbar();
399 updateWeek( mView->startDate() ); 401 updateWeek( mView->startDate() );
400 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 402 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
401 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 403 SLOT( updateWeekNum( const KCal::DateList & ) ) );
402 mBRdisabled = false; 404 mBRdisabled = false;
403 //toggleBeamReceive(); 405 //toggleBeamReceive();
404 406
405 setCaption(i18n("Loading calendar files ... please wait" )); 407 setCaption(i18n("Loading calendar files ... please wait" ));
406 mSaveDelay = 0; 408 mSaveDelay = 0;
407 QTimer::singleShot( 10, this, SLOT ( loadDataAfterStart() )); 409 QTimer::singleShot( 10, this, SLOT ( loadDataAfterStart() ));
408} 410}
409MainWindow::~MainWindow() 411MainWindow::~MainWindow()
410{ 412{
@@ -2675,88 +2677,88 @@ void MainWindow::exportCalendar( bool iCalFormat )
2675 bool success = false; 2677 bool success = false;
2676 if ( iCalFormat ) 2678 if ( iCalFormat )
2677 success = mView->exportICalendar( fn ); 2679 success = mView->exportICalendar( fn );
2678 else 2680 else
2679 success = mView->exportVCalendar( fn ); 2681 success = mView->exportVCalendar( fn );
2680 if ( success ) { 2682 if ( success ) {
2681 if ( fn.length() > 20 ) 2683 if ( fn.length() > 20 )
2682 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 2684 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
2683 else 2685 else
2684 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 2686 mes = i18n("KO/Pi:Exported to %1").arg(fn );
2685 setCaption(mes); 2687 setCaption(mes);
2686 } 2688 }
2687 } 2689 }
2688 2690
2689} 2691}
2690void MainWindow::exportICalendar() 2692void MainWindow::exportICalendar()
2691{ 2693{
2692 exportCalendar( true ); 2694 exportCalendar( true );
2693} 2695}
2694void MainWindow::exportVCalendar() 2696void MainWindow::exportVCalendar()
2695{ 2697{
2696 exportCalendar( false ); 2698 exportCalendar( false );
2697} 2699}
2698QString MainWindow::sentSyncFile() 2700QString MainWindow::sentSyncFile()
2699{ 2701{
2700#ifdef DESKTOP_VERSION 2702#ifdef DESKTOP_VERSION
2701 return QDir::convertSeparators( locateLocal( "tmp", "copysynccal.ics" ) ); 2703 return QDir::convertSeparators( locateLocal( "tmp", "copysynccal.ics" ) );
2702#else 2704#else
2703 return QString( "/tmp/copysynccal.ics" ); 2705 return QString( "/tmp/copysynccal.ics" );
2704#endif 2706#endif
2705} 2707}
2706 2708
2707void MainWindow::syncFileRequest() 2709void MainWindow::syncFileRequest(const QString& resource)
2708{ 2710{
2709 while ( mSyncManager->blockSave() ) { 2711 while ( mSyncManager->blockSave() ) {
2710 qApp->processEvents(); 2712 qApp->processEvents();
2711 } 2713 }
2712 mSyncManager->setBlockSave(true); 2714 mSyncManager->setBlockSave(true);
2713 2715
2714 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2716 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2715 mSyncManager->slotSyncMenu( 999 ); 2717 mSyncManager->slotSyncMenu( 999 );
2716 } 2718 }
2717 2719
2718 setCaption(i18n("Saving Data to temp file ..." )); 2720 setCaption(i18n("Saving Data to temp file ..." ));
2719 mView->saveCalendar( sentSyncFile() ); 2721 mView->saveCalendarResource( sentSyncFile(), resource );
2720 setCaption(i18n("Data saved to temp file!" )); 2722 setCaption(i18n("Data saved to temp file!" ));
2721 mSyncManager->setBlockSave( false ); 2723 mSyncManager->setBlockSave( false );
2722 2724
2723} 2725}
2724void MainWindow::getFile( bool success ) 2726void MainWindow::getFile( bool success ,const QString& resource)
2725{ 2727{
2726 if ( ! success ) { 2728 if ( ! success ) {
2727 setCaption( i18n("Error receiving file. Nothing changed!") ); 2729 setCaption( i18n("Error receiving file. Nothing changed!") );
2728 return; 2730 return;
2729 } 2731 }
2730 mView->mergeFile( sentSyncFile() ); 2732 mView->mergeFileResource( sentSyncFile(), resource);
2731 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2733 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2732 mSyncManager->slotSyncMenu( 999 ); 2734 mSyncManager->slotSyncMenu( 999 );
2733 } 2735 }
2734 setCaption( i18n("Pi-Sync successful!") ); 2736 setCaption( i18n("Pi-Sync successful!") );
2735} 2737}
2736void MainWindow::printListView() 2738void MainWindow::printListView()
2737{ 2739{
2738 2740
2739 QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items."); 2741 QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items.");
2740 2742
2741 KMessageBox::information( this, message); 2743 KMessageBox::information( this, message);
2742} 2744}
2743void MainWindow::printSel( ) 2745void MainWindow::printSel( )
2744{ 2746{
2745 mView->viewManager()->agendaView()->agenda()->printSelection(); 2747 mView->viewManager()->agendaView()->agenda()->printSelection();
2746} 2748}
2747 2749
2748void MainWindow::printCal() 2750void MainWindow::printCal()
2749{ 2751{
2750 mView->print();//mCp->showDialog(); 2752 mView->print();//mCp->showDialog();
2751} 2753}
2752 2754
2753 2755
2754#include "libkdepim/kdatepicker.h" 2756#include "libkdepim/kdatepicker.h"
2755#include <kdatetbl.h> 2757#include <kdatetbl.h>
2756 2758
2757void MainWindow::weekAction() 2759void MainWindow::weekAction()
2758{ 2760{
2759 int month; 2761 int month;
2760 KPopupFrame* popup = new KPopupFrame(this); 2762 KPopupFrame* popup = new KPopupFrame(this);
2761 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); 2763 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup);
2762 // ----- 2764 // -----
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index d8018b6..a533d8b 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -81,66 +81,66 @@ class MainWindow : public QMainWindow
81 void importIcal(); 81 void importIcal();
82 void importFile( QString, bool ); 82 void importFile( QString, bool );
83 void quickImportIcal(); 83 void quickImportIcal();
84 84
85 void slotModifiedChanged( bool ); 85 void slotModifiedChanged( bool );
86 86
87 void save(); 87 void save();
88 void backupAllFiles(); 88 void backupAllFiles();
89 void saveStopTimer(); 89 void saveStopTimer();
90 void configureToolBar( int ); 90 void configureToolBar( int );
91 void printSel(); 91 void printSel();
92 void printCal(); 92 void printCal();
93 void printListView(); 93 void printListView();
94 void saveCalendar(); 94 void saveCalendar();
95 void loadCalendar(); 95 void loadCalendar();
96 void exportVCalendar(); 96 void exportVCalendar();
97 void exportICalendar(); 97 void exportICalendar();
98 void exportCalendar( bool ); 98 void exportCalendar( bool );
99 void fillFilterMenu(); 99 void fillFilterMenu();
100 void fillFilterMenuTB(); 100 void fillFilterMenuTB();
101 void selectFilter( int ); 101 void selectFilter( int );
102 void fillFilterMenuPopup(); 102 void fillFilterMenuPopup();
103 void selectFilterPopup( int ); 103 void selectFilterPopup( int );
104 void exportToPhone( int ); 104 void exportToPhone( int );
105 void toggleBeamReceive(); 105 void toggleBeamReceive();
106 void disableBR(bool); 106 void disableBR(bool);
107 signals: 107 signals:
108 void selectWeek ( int ); 108 void selectWeek ( int );
109 private slots: 109 private slots:
110 void slotResetFocus(); 110 void slotResetFocus();
111 void slotResetFocusLoop(); 111 void slotResetFocusLoop();
112 void showConfigureAgenda(); 112 void showConfigureAgenda();
113 void getFile( bool ); 113 void getFile( bool ,const QString &);
114 void syncFileRequest(); 114 void syncFileRequest(const QString &);
115 115
116 protected: 116 protected:
117 int mFocusLoop; 117 int mFocusLoop;
118 void hideEvent ( QHideEvent * ); 118 void hideEvent ( QHideEvent * );
119 QString sentSyncFile(); 119 QString sentSyncFile();
120 void displayText( QString, QString); 120 void displayText( QString, QString);
121 void enableIncidenceActions( bool ); 121 void enableIncidenceActions( bool );
122 bool askForQuitOnSaveError(); 122 bool askForQuitOnSaveError();
123 123
124 private: 124 private:
125 bool mAutoSaveDisabled; 125 bool mAutoSaveDisabled;
126 bool checkAutosave(); 126 bool checkAutosave();
127 QCString mCStringMess; 127 QCString mCStringMess;
128 QByteArray mByteData; 128 QByteArray mByteData;
129 129
130 //void setMenuBar( QMenuBar * ); 130 //void setMenuBar( QMenuBar * );
131 bool mBRdisabled; 131 bool mBRdisabled;
132#ifndef DESKTOP_VERSION 132#ifndef DESKTOP_VERSION
133 QCopChannel* infrared; 133 QCopChannel* infrared;
134#endif 134#endif
135 QAction* brAction; 135 QAction* brAction;
136 KSyncManager* mSyncManager; 136 KSyncManager* mSyncManager;
137 bool mClosed; 137 bool mClosed;
138 void saveOnClose(); 138 void saveOnClose();
139 bool mFlagKeyPressed; 139 bool mFlagKeyPressed;
140 bool mBlockAtStartup; 140 bool mBlockAtStartup;
141 KMenuBar *menuBar1; 141 KMenuBar *menuBar1;
142 QPEToolBar *iconToolBar; 142 QPEToolBar *iconToolBar;
143 QPEToolBar *viewToolBar; 143 QPEToolBar *viewToolBar;
144 QPEToolBar *navigatorToolBar; 144 QPEToolBar *navigatorToolBar;
145 QPEToolBar *filterToolBar; 145 QPEToolBar *filterToolBar;
146 KMenuBar *filterMenubar; 146 KMenuBar *filterMenubar;
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index 4b8b3ff..0a94914 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -50,64 +50,65 @@ namespace KCal {
50 methods to store and access the data. 50 methods to store and access the data.
51 51
52 Ownership of events etc. is handled by the following policy: As soon as an 52 Ownership of events etc. is handled by the following policy: As soon as an
53 event (or any other subclass of IncidenceBase) object is added to the 53 event (or any other subclass of IncidenceBase) object is added to the
54 Calendar by addEvent() it is owned by the Calendar object. The Calendar takes 54 Calendar by addEvent() it is owned by the Calendar object. The Calendar takes
55 care of deleting it. All Events returned by the query functions are returned 55 care of deleting it. All Events returned by the query functions are returned
56 as pointers, that means all changes to the returned events are immediately 56 as pointers, that means all changes to the returned events are immediately
57 visible in the Calendar. You shouldn't delete any Event object you get from 57 visible in the Calendar. You shouldn't delete any Event object you get from
58 Calendar. 58 Calendar.
59*/ 59*/
60class Calendar : public QObject, public CustomProperties, 60class Calendar : public QObject, public CustomProperties,
61 public IncidenceBase::Observer 61 public IncidenceBase::Observer
62{ 62{
63 Q_OBJECT 63 Q_OBJECT
64public: 64public:
65 Calendar(); 65 Calendar();
66 Calendar(const QString &timeZoneId); 66 Calendar(const QString &timeZoneId);
67 virtual ~Calendar(); 67 virtual ~Calendar();
68 Incidence * undoIncidence() { return mUndoIncidence; }; 68 Incidence * undoIncidence() { return mUndoIncidence; };
69 bool undoDeleteIncidence(); 69 bool undoDeleteIncidence();
70 void deleteIncidence(Incidence *in); 70 void deleteIncidence(Incidence *in);
71 void resetTempSyncStat(); 71 void resetTempSyncStat();
72 void resetPilotStat(int id); 72 void resetPilotStat(int id);
73 /** 73 /**
74 Clears out the current calendar, freeing all used memory etc. 74 Clears out the current calendar, freeing all used memory etc.
75 */ 75 */
76 virtual void close() = 0; 76 virtual void close() = 0;
77 virtual void addCalendar( Calendar* ) = 0; 77 virtual void addCalendar( Calendar* ) = 0;
78 virtual bool addCalendarFile( QString name, int id ) = 0; 78 virtual bool addCalendarFile( QString name, int id ) = 0;
79 virtual bool mergeCalendarFile( QString name ) = 0; 79 virtual bool mergeCalendarFile( QString name ) = 0;
80 virtual Incidence* incidenceForUid( const QString& uid, bool doNotCheckDuplicates ) = 0; 80 virtual Incidence* incidenceForUid( const QString& uid, bool doNotCheckDuplicates ) = 0;
81 virtual void setSyncEventsReadOnly() = 0; 81 virtual void setSyncEventsReadOnly() = 0;
82 virtual void setSyncEventsEnabled() = 0;
82 virtual void stopAllTodos() = 0; 83 virtual void stopAllTodos() = 0;
83 virtual void clearUndo( Incidence * newUndo ); 84 virtual void clearUndo( Incidence * newUndo );
84 85
85 /** 86 /**
86 Sync changes in memory to persistant storage. 87 Sync changes in memory to persistant storage.
87 */ 88 */
88 virtual void save() = 0; 89 virtual void save() = 0;
89 virtual QPtrList<Event> getExternLastSyncEvents() = 0; 90 virtual QPtrList<Event> getExternLastSyncEvents() = 0;
90 virtual void removeSyncInfo( QString syncProfile) = 0; 91 virtual void removeSyncInfo( QString syncProfile) = 0;
91 virtual bool isSaving() { return false; } 92 virtual bool isSaving() { return false; }
92 93
93 /** 94 /**
94 Return the owner of the calendar's full name. 95 Return the owner of the calendar's full name.
95 */ 96 */
96 const QString &getOwner() const; 97 const QString &getOwner() const;
97 /** 98 /**
98 Set the owner of the calendar. Should be owner's full name. 99 Set the owner of the calendar. Should be owner's full name.
99 */ 100 */
100 void setOwner( const QString &os ); 101 void setOwner( const QString &os );
101 /** 102 /**
102 Return the email address of the calendar owner. 103 Return the email address of the calendar owner.
103 */ 104 */
104 const QString &getEmail(); 105 const QString &getEmail();
105 /** 106 /**
106 Set the email address of the calendar owner. 107 Set the email address of the calendar owner.
107 */ 108 */
108 void setEmail( const QString & ); 109 void setEmail( const QString & );
109 110
110 /** 111 /**
111 Set time zone from a timezone string (e.g. -2:00) 112 Set time zone from a timezone string (e.g. -2:00)
112 */ 113 */
113 void setTimeZone( const QString &tz ); 114 void setTimeZone( const QString &tz );
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 0ddfeca..45e3128 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -144,71 +144,83 @@ bool CalendarLocal::mergeCalendar( Calendar* remote )
144 Incidence* inR = er.first(); 144 Incidence* inR = er.first();
145 while ( inR ) { 145 while ( inR ) {
146 inL = incidenceForUid( inR->uid(),false ); 146 inL = incidenceForUid( inR->uid(),false );
147 if ( inL ) { 147 if ( inL ) {
148 if ( ! inL->isReadOnly () || inL->uid().left(15) == QString("last-syncEvent-") ) { 148 if ( ! inL->isReadOnly () || inL->uid().left(15) == QString("last-syncEvent-") ) {
149 int calID = inL->calID(); 149 int calID = inL->calID();
150 deleteIncidence( inL ); 150 deleteIncidence( inL );
151 inL = inR->clone(); 151 inL = inR->clone();
152 inL->setCalID( calID ); 152 inL->setCalID( calID );
153 addIncidence( inL ); 153 addIncidence( inL );
154 } 154 }
155 } else { 155 } else {
156 inL = inR->clone(); 156 inL = inR->clone();
157 inL->setCalID( 0 );// add to default cal 157 inL->setCalID( 0 );// add to default cal
158 addIncidence( inL ); 158 addIncidence( inL );
159 } 159 }
160 inR = er.next(); 160 inR = er.next();
161 } 161 }
162 return true; 162 return true;
163} 163}
164 164
165 165
166bool CalendarLocal::addCalendarFile( QString name, int id ) 166bool CalendarLocal::addCalendarFile( QString name, int id )
167{ 167{
168 CalendarLocal calendar( timeZoneId() ); 168 CalendarLocal calendar( timeZoneId() );
169 calendar.setDefaultCalendar( id ); 169 calendar.setDefaultCalendar( id );
170 if ( calendar.load( name ) ) { 170 if ( calendar.load( name ) ) {
171 addCalendar( &calendar ); 171 addCalendar( &calendar );
172 return true; 172 return true;
173 } 173 }
174 return false; 174 return false;
175} 175}
176void CalendarLocal::setSyncEventsReadOnly() 176void CalendarLocal::setSyncEventsEnabled()
177{ 177{
178 Event * ev; 178 Event * ev;
179 ev = mEventList.first(); 179 ev = mEventList.first();
180 while ( ev ) { 180 while ( ev ) {
181 if ( ev->uid().left(15) == QString("last-syncEvent-") ) 181 if ( ev->uid().left(15) == QString("last-syncEvent-") )
182 ev->setReadOnly( true ); 182 ev->setCalEnabled( true );
183 ev = mEventList.next();
184 }
185}
186void CalendarLocal::setSyncEventsReadOnly()
187{
188 Event * ev;
189 ev = mEventList.first();
190 while ( ev ) {
191 if ( ev->uid().left(15) == QString("last-syncEvent-") ) {
192 ev->setReadOnly( true );
193 ev->setCalID( 1 );
194 }
183 ev = mEventList.next(); 195 ev = mEventList.next();
184 } 196 }
185} 197}
186void CalendarLocal::addCalendar( Calendar* cal ) 198void CalendarLocal::addCalendar( Calendar* cal )
187{ 199{
188 cal->setDontDeleteIncidencesOnClose(); 200 cal->setDontDeleteIncidencesOnClose();
189 { 201 {
190 QPtrList<Event> EventList = cal->rawEvents(); 202 QPtrList<Event> EventList = cal->rawEvents();
191 Event * ev = EventList.first(); 203 Event * ev = EventList.first();
192 while ( ev ) { 204 while ( ev ) {
193 ev->unRegisterObserver( cal ); 205 ev->unRegisterObserver( cal );
194 ev->registerObserver( this ); 206 ev->registerObserver( this );
195 mEventList.append( ev ); 207 mEventList.append( ev );
196 ev = EventList.next(); 208 ev = EventList.next();
197 } 209 }
198 } 210 }
199 { 211 {
200 212
201 QPtrList<Todo> TodoList = cal->rawTodos(); 213 QPtrList<Todo> TodoList = cal->rawTodos();
202 Todo * ev = TodoList.first(); 214 Todo * ev = TodoList.first();
203 while ( ev ) { 215 while ( ev ) {
204 QString rel = ev->relatedToUid(); 216 QString rel = ev->relatedToUid();
205 if ( !rel.isEmpty() ){ 217 if ( !rel.isEmpty() ){
206 ev->setRelatedTo ( 0 ); 218 ev->setRelatedTo ( 0 );
207 ev->setRelatedToUid( rel ); 219 ev->setRelatedToUid( rel );
208 } 220 }
209 ev = TodoList.next(); 221 ev = TodoList.next();
210 } 222 }
211 //TodoList = cal->rawTodos(); 223 //TodoList = cal->rawTodos();
212 ev = TodoList.first(); 224 ev = TodoList.first();
213 while ( ev ) { 225 while ( ev ) {
214 ev->unRegisterObserver( cal ); 226 ev->unRegisterObserver( cal );
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index ca0bd98..eb7bf34 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -20,64 +20,65 @@
20 Boston, MA 02111-1307, USA. 20 Boston, MA 02111-1307, USA.
21*/ 21*/
22#ifndef KCAL_CALENDARLOCAL_H 22#ifndef KCAL_CALENDARLOCAL_H
23#define KCAL_CALENDARLOCAL_H 23#define KCAL_CALENDARLOCAL_H
24 24
25#include "calendar.h" 25#include "calendar.h"
26 26
27namespace KCal { 27namespace KCal {
28 28
29class CalFormat; 29class CalFormat;
30 30
31/** 31/**
32 This class provides a calendar stored as a local file. 32 This class provides a calendar stored as a local file.
33*/ 33*/
34class CalendarLocal : public Calendar 34class CalendarLocal : public Calendar
35{ 35{
36 public: 36 public:
37 /** 37 /**
38 Constructs a new calendar, with variables initialized to sane values. 38 Constructs a new calendar, with variables initialized to sane values.
39 */ 39 */
40 CalendarLocal(); 40 CalendarLocal();
41 /** 41 /**
42 Constructs a new calendar, with variables initialized to sane values. 42 Constructs a new calendar, with variables initialized to sane values.
43 */ 43 */
44 CalendarLocal( const QString &timeZoneId ); 44 CalendarLocal( const QString &timeZoneId );
45 ~CalendarLocal(); 45 ~CalendarLocal();
46 void addCalendar( Calendar* ); 46 void addCalendar( Calendar* );
47 bool addCalendarFile( QString name, int id ); 47 bool addCalendarFile( QString name, int id );
48 bool mergeCalendarFile( QString name ); 48 bool mergeCalendarFile( QString name );
49 bool mergeCalendar( Calendar* cal ); 49 bool mergeCalendar( Calendar* cal );
50 Incidence* incidenceForUid( const QString& uid, bool doNotCheckDuplicates ); 50 Incidence* incidenceForUid( const QString& uid, bool doNotCheckDuplicates );
51 void setSyncEventsReadOnly(); 51 void setSyncEventsReadOnly();
52 void setSyncEventsEnabled();
52 void stopAllTodos(); 53 void stopAllTodos();
53 /** 54 /**
54 Loads a calendar on disk in vCalendar or iCalendar format into the current 55 Loads a calendar on disk in vCalendar or iCalendar format into the current
55 calendar. Any information already present is lost. 56 calendar. Any information already present is lost.
56 @return true, if successfull, false on error. 57 @return true, if successfull, false on error.
57 @param fileName the name of the calendar on disk. 58 @param fileName the name of the calendar on disk.
58 */ 59 */
59 bool load( const QString &fileName ); 60 bool load( const QString &fileName );
60 /** 61 /**
61 Writes out the calendar to disk in the specified \a format. 62 Writes out the calendar to disk in the specified \a format.
62 CalendarLocal takes ownership of the CalFormat object. 63 CalendarLocal takes ownership of the CalFormat object.
63 @return true, if successfull, false on error. 64 @return true, if successfull, false on error.
64 @param fileName the name of the file 65 @param fileName the name of the file
65 */ 66 */
66 bool save( const QString &fileName, CalFormat *format = 0 ); 67 bool save( const QString &fileName, CalFormat *format = 0 );
67 68
68 /** 69 /**
69 Clears out the current calendar, freeing all used memory etc. etc. 70 Clears out the current calendar, freeing all used memory etc. etc.
70 */ 71 */
71 void close(); 72 void close();
72 73
73 void save() {} 74 void save() {}
74 75
75 /** 76 /**
76 Add Event to calendar. 77 Add Event to calendar.
77 */ 78 */
78 void removeSyncInfo( QString syncProfile); 79 void removeSyncInfo( QString syncProfile);
79 bool addAnniversaryNoDup( Event *event ); 80 bool addAnniversaryNoDup( Event *event );
80 bool addEventNoDup( Event *event ); 81 bool addEventNoDup( Event *event );
81 bool addEvent( Event *event ); 82 bool addEvent( Event *event );
82 /** 83 /**
83 Deletes an event from this calendar. 84 Deletes an event from this calendar.
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index a64eb34..719d80b 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -167,65 +167,66 @@ void KSyncManager::fillSyncMenu()
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}
174void KSyncManager::slotClearMenu( int action ) 174void 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}
196void KSyncManager::slotSyncMenu( int action ) 196void KSyncManager::slotSyncMenu( int action )
197{ 197{
198 qDebug("KSM::syncaction %d ", action); 198 qDebug("KSM::syncaction %d ", action);
199 mCurrentResourceLocal = ""; 199 mCurrentResourceLocal = "";
200 emit multiResourceSyncStart( false );
200 if ( action == 5000 ) 201 if ( action == 5000 )
201 return; 202 return;
202 mSyncWithDesktop = false; 203 mSyncWithDesktop = false;
203 if ( action == 0 ) { 204 if ( action == 0 ) {
204 205
205 // seems to be a Qt2 event handling bug 206 // seems to be a Qt2 event handling bug
206 // syncmenu.clear causes a segfault at first time 207 // syncmenu.clear causes a segfault at first time
207 // when we call it after the main event loop, it is ok 208 // when we call it after the main event loop, it is ok
208 // same behaviour when calling OM/Pi via QCOP for the first time 209 // same behaviour when calling OM/Pi via QCOP for the first time
209 QTimer::singleShot ( 1, this, SLOT ( confSync() ) ); 210 QTimer::singleShot ( 1, this, SLOT ( confSync() ) );
210 //confSync(); 211 //confSync();
211 212
212 return; 213 return;
213 } 214 }
214 if ( action == 1 ) { 215 if ( action == 1 ) {
215 multiSync( true ); 216 multiSync( true );
216 return; 217 return;
217 } 218 }
218 if ( action == 2 ) { 219 if ( action == 2 ) {
219 enableQuick(); 220 enableQuick();
220 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); 221 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
221 return; 222 return;
222 } 223 }
223 if ( action == 3 ) { 224 if ( action == 3 ) {
224 delete mServerSocket; 225 delete mServerSocket;
225 mServerSocket = 0; 226 mServerSocket = 0;
226 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); 227 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
227 return; 228 return;
228 } 229 }
229 230
230 if (blockSave()) 231 if (blockSave())
231 return; 232 return;
@@ -412,64 +413,66 @@ void KSyncManager::enableQuick( bool ask )
412 changed = true; 413 changed = true;
413 mPrefs->mPassiveSyncWithDesktop = syncdesktop.isChecked(); 414 mPrefs->mPassiveSyncWithDesktop = syncdesktop.isChecked();
414 } 415 }
415 } 416 }
416 else 417 else
417 autoStart = mPrefs->mPassiveSyncAutoStart; 418 autoStart = mPrefs->mPassiveSyncAutoStart;
418 if ( autoStart != mPrefs->mPassiveSyncAutoStart ) 419 if ( autoStart != mPrefs->mPassiveSyncAutoStart )
419 changed = true; 420 changed = true;
420 bool ok; 421 bool ok;
421 mPrefs->mPassiveSyncAutoStart = false; 422 mPrefs->mPassiveSyncAutoStart = false;
422 Q_UINT32 port_t = mPrefs->mPassiveSyncPort.toUInt(&ok); 423 Q_UINT32 port_t = mPrefs->mPassiveSyncPort.toUInt(&ok);
423 qDebug("%d ", port_t); 424 qDebug("%d ", port_t);
424 if ( ! ok || port_t > 65535 ) { 425 if ( ! ok || port_t > 65535 ) {
425 KMessageBox::information( 0, i18n("No valid port number:\n%1").arg ( mPrefs->mPassiveSyncPort ), i18n("Pi-Sync Port Error")); 426 KMessageBox::information( 0, i18n("No valid port number:\n%1").arg ( mPrefs->mPassiveSyncPort ), i18n("Pi-Sync Port Error"));
426 return; 427 return;
427 } 428 }
428 Q_UINT16 port = port_t; 429 Q_UINT16 port = port_t;
429 //qDebug("port %d ", port); 430 //qDebug("port %d ", port);
430 mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); 431 mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 );
431 mServerSocket->setFileName( defaultFileName() );//bbb 432 mServerSocket->setFileName( defaultFileName() );//bbb
432 if ( !mServerSocket->ok() ) { 433 if ( !mServerSocket->ok() ) {
433 QTimer::singleShot( 2000, this, SLOT ( displayErrorPort() ) ); 434 QTimer::singleShot( 2000, this, SLOT ( displayErrorPort() ) );
434 delete mServerSocket; 435 delete mServerSocket;
435 mServerSocket = 0; 436 mServerSocket = 0;
436 return; 437 return;
437 } 438 }
438 mPrefs->mPassiveSyncAutoStart = autoStart; 439 mPrefs->mPassiveSyncAutoStart = autoStart;
439 if ( changed ) { 440 if ( changed ) {
440 mPrefs->writeConfig(); 441 mPrefs->writeConfig();
441 } 442 }
442 connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); 443 connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) );
443 connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); 444 connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) );
445 connect( mServerSocket, SIGNAL ( request_file(const QString &) ),this, SIGNAL ( request_file(const QString &) ) );
446 connect( mServerSocket, SIGNAL ( file_received( bool ,const QString &) ), this, SIGNAL ( getFile( bool,const QString & ) ) );
444} 447}
445void KSyncManager::displayErrorPort() 448void KSyncManager::displayErrorPort()
446{ 449{
447 KMessageBox::information( 0, i18n("<b>Enabling Pi-Sync failed!</b> Failed to bind or listen to the port %1! Is another instance already listening to that port?").arg( mPrefs->mPassiveSyncPort) , i18n("Pi-Sync Port Error")); 450 KMessageBox::information( 0, i18n("<b>Enabling Pi-Sync failed!</b> Failed to bind or listen to the port %1! Is another instance already listening to that port?").arg( mPrefs->mPassiveSyncPort) , i18n("Pi-Sync Port Error"));
448} 451}
449void KSyncManager::syncLocalFile() 452void KSyncManager::syncLocalFile()
450{ 453{
451 454
452 QString fn =mPrefs->mLastSyncedLocalFile; 455 QString fn =mPrefs->mLastSyncedLocalFile;
453 QString ext; 456 QString ext;
454 457
455 switch(mTargetApp) 458 switch(mTargetApp)
456 { 459 {
457 case (KAPI): 460 case (KAPI):
458 ext = "(*.vcf)"; 461 ext = "(*.vcf)";
459 break; 462 break;
460 case (KOPI): 463 case (KOPI):
461 ext = "(*.ics/*.vcs)"; 464 ext = "(*.ics/*.vcs)";
462 break; 465 break;
463 case (PWMPI): 466 case (PWMPI):
464 ext = "(*.pwm)"; 467 ext = "(*.pwm)";
465 break; 468 break;
466 default: 469 default:
467 qDebug("KSM::syncLocalFile: invalid apptype selected"); 470 qDebug("KSM::syncLocalFile: invalid apptype selected");
468 break; 471 break;
469 472
470 } 473 }
471 474
472 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent ); 475 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent );
473 if ( fn == "" ) 476 if ( fn == "" )
474 return; 477 return;
475 if ( syncWithFile( fn, false ) ) { 478 if ( syncWithFile( fn, false ) ) {
@@ -540,65 +543,65 @@ void KSyncManager::multiSync( bool askforPrefs )
540 0, 0 ) != 0 ) { 543 0, 0 ) != 0 ) {
541 setBlockSave(false); 544 setBlockSave(false);
542 mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!")); 545 mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!"));
543 return; 546 return;
544 } 547 }
545 } 548 }
546 mCurrentSyncDevice = i18n("Multiple profiles") ; 549 mCurrentSyncDevice = i18n("Multiple profiles") ;
547 mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; 550 mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs;
548 if ( askforPrefs ) { 551 if ( askforPrefs ) {
549 if ( !edit_sync_options()) { 552 if ( !edit_sync_options()) {
550 mParent->topLevelWidget()->setCaption( i18n("Syncing aborted.") ); 553 mParent->topLevelWidget()->setCaption( i18n("Syncing aborted.") );
551 return; 554 return;
552 } 555 }
553 mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs; 556 mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs;
554 } 557 }
555 mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") ); 558 mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") );
556 qApp->processEvents(); 559 qApp->processEvents();
557 int num = ringSync() ; 560 int num = ringSync() ;
558 if ( num > 1 ) 561 if ( num > 1 )
559 ringSync(); 562 ringSync();
560 setBlockSave(false); 563 setBlockSave(false);
561 if ( num ) 564 if ( num )
562 emit save(); 565 emit save();
563 if ( num ) 566 if ( num )
564 mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) ); 567 mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) );
565 else 568 else
566 mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); 569 mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
567 return; 570 return;
568} 571}
569 572
570int KSyncManager::ringSync() 573int KSyncManager::ringSync()
571{ 574{
572 575 emit multiResourceSyncStart( false );
573 int syncedProfiles = 0; 576 int syncedProfiles = 0;
574 unsigned int i; 577 unsigned int i;
575 QTime timer; 578 QTime timer;
576 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 579 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
577 QStringList syncProfileNames = mSyncProfileNames; 580 QStringList syncProfileNames = mSyncProfileNames;
578 KSyncProfile* temp = new KSyncProfile (); 581 KSyncProfile* temp = new KSyncProfile ();
579 mAskForPreferences = false; 582 mAskForPreferences = false;
580 mCurrentResourceLocal = ""; 583 mCurrentResourceLocal = "";
581 for ( i = 0; i < syncProfileNames.count(); ++i ) { 584 for ( i = 0; i < syncProfileNames.count(); ++i ) {
582 mCurrentSyncProfile = i; 585 mCurrentSyncProfile = i;
583 temp->setName(syncProfileNames[mCurrentSyncProfile]); 586 temp->setName(syncProfileNames[mCurrentSyncProfile]);
584 temp->readConfig(&config); 587 temp->readConfig(&config);
585 588
586 bool includeInRingSync = false; 589 bool includeInRingSync = false;
587 switch(mTargetApp) 590 switch(mTargetApp)
588 { 591 {
589 case (KAPI): 592 case (KAPI):
590 includeInRingSync = temp->getIncludeInRingSyncAB(); 593 includeInRingSync = temp->getIncludeInRingSyncAB();
591 break; 594 break;
592 case (KOPI): 595 case (KOPI):
593 includeInRingSync = temp->getIncludeInRingSync(); 596 includeInRingSync = temp->getIncludeInRingSync();
594 break; 597 break;
595 case (PWMPI): 598 case (PWMPI):
596 includeInRingSync = temp->getIncludeInRingSyncPWM(); 599 includeInRingSync = temp->getIncludeInRingSyncPWM();
597 break; 600 break;
598 default: 601 default:
599 qDebug("KSM::ringSync: invalid apptype selected"); 602 qDebug("KSM::ringSync: invalid apptype selected");
600 break; 603 break;
601 604
602 } 605 }
603 606
604 607
@@ -1111,65 +1114,68 @@ QString KSyncManager::syncFileName()
1111 break; 1114 break;
1112 } 1115 }
1113#ifdef DESKTOP_VERSION 1116#ifdef DESKTOP_VERSION
1114 return locateLocal( "tmp", fn ); 1117 return locateLocal( "tmp", fn );
1115#else 1118#else
1116 return (QString( "/tmp/" )+ fn ); 1119 return (QString( "/tmp/" )+ fn );
1117#endif 1120#endif
1118} 1121}
1119 1122
1120void KSyncManager::syncPi() 1123void KSyncManager::syncPi()
1121{ 1124{
1122 mIsKapiFile = true; 1125 mIsKapiFile = true;
1123 mPisyncFinished = false; 1126 mPisyncFinished = false;
1124 qApp->processEvents(); 1127 qApp->processEvents();
1125 if ( mAskForPreferences ) 1128 if ( mAskForPreferences )
1126 if ( !edit_pisync_options()) { 1129 if ( !edit_pisync_options()) {
1127 mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); 1130 mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") );
1128 mPisyncFinished = true; 1131 mPisyncFinished = true;
1129 return; 1132 return;
1130 } 1133 }
1131 bool ok; 1134 bool ok;
1132 Q_UINT16 port = mActiveSyncPort.toUInt(&ok); 1135 Q_UINT16 port = mActiveSyncPort.toUInt(&ok);
1133 if ( ! ok ) { 1136 if ( ! ok ) {
1134 mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); 1137 mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") );
1135 mPisyncFinished = true; 1138 mPisyncFinished = true;
1136 return; 1139 return;
1137 } 1140 }
1138 mCurrentResourceLocal = ""; 1141 mCurrentResourceLocal = "";
1139 mCurrentResourceRemote = ""; 1142 mCurrentResourceRemote = "";
1140 if ( mSpecificResources.count() ) { 1143 if ( mSpecificResources.count() ) {
1141 int startLocal = 0; 1144 int startLocal = 0;
1142 int startRemote = mSpecificResources.count()/2; 1145 int startRemote = mSpecificResources.count()/2;
1146 emit multiResourceSyncStart( true );
1143 while ( startLocal < mSpecificResources.count()/2 ) { 1147 while ( startLocal < mSpecificResources.count()/2 ) {
1148 if ( startLocal+1 >= mSpecificResources.count()/2 )
1149 emit multiResourceSyncStart( false );
1144 mPisyncFinished = false; 1150 mPisyncFinished = false;
1145 mCurrentResourceLocal = mSpecificResources[ startLocal ]; 1151 mCurrentResourceLocal = mSpecificResources[ startLocal ];
1146 mCurrentResourceRemote = mSpecificResources[ startRemote ]; 1152 mCurrentResourceRemote = mSpecificResources[ startRemote ];
1147 KCommandSocket* commandSocket = new KCommandSocket( mCurrentResourceRemote, mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); 1153 KCommandSocket* commandSocket = new KCommandSocket( mCurrentResourceRemote, mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() );
1148 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); 1154 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) );
1149 commandSocket->readFile( syncFileName() ); 1155 commandSocket->readFile( syncFileName() );
1150 while ( !mPisyncFinished ) { 1156 while ( !mPisyncFinished ) {
1151 //qDebug("waiting "); 1157 //qDebug("waiting ");
1152 qApp->processEvents(); 1158 qApp->processEvents();
1153 } 1159 }
1154 ++startLocal; 1160 ++startLocal;
1155 } 1161 }
1156 } else { 1162 } else {
1157 KCommandSocket* commandSocket = new KCommandSocket( "", mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); 1163 KCommandSocket* commandSocket = new KCommandSocket( "", mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() );
1158 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); 1164 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) );
1159 commandSocket->readFile( syncFileName() ); 1165 commandSocket->readFile( syncFileName() );
1160 } 1166 }
1161} 1167}
1162 1168
1163void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) 1169void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state)
1164{ 1170{
1165 //enum { success, errorW, errorR, quiet }; 1171 //enum { success, errorW, errorR, quiet };
1166 1172
1167 1173
1168 1174
1169 if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ||state == KCommandSocket::errorPW || 1175 if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ||state == KCommandSocket::errorPW ||
1170 state == KCommandSocket::errorCA ||state == KCommandSocket::errorFI ||state == KCommandSocket::errorUN||state == KCommandSocket::errorED ) { 1176 state == KCommandSocket::errorCA ||state == KCommandSocket::errorFI ||state == KCommandSocket::errorUN||state == KCommandSocket::errorED ) {
1171 if ( state == KCommandSocket::errorPW ) 1177 if ( state == KCommandSocket::errorPW )
1172 mParent->topLevelWidget()->setCaption( i18n("Wrong password: Receiving remote file failed.") ); 1178 mParent->topLevelWidget()->setCaption( i18n("Wrong password: Receiving remote file failed.") );
1173 else if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) 1179 else if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO )
1174 mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") ); 1180 mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") );
1175 else if ( state == KCommandSocket::errorCA ) 1181 else if ( state == KCommandSocket::errorCA )
@@ -1190,155 +1196,158 @@ void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state)
1190 return; 1196 return;
1191 1197
1192 } else if ( state == KCommandSocket::errorW ) { 1198 } else if ( state == KCommandSocket::errorW ) {
1193 mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") ); 1199 mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") );
1194 mPisyncFinished = true; 1200 mPisyncFinished = true;
1195 1201
1196 } else if ( state == KCommandSocket::successR ) { 1202 } else if ( state == KCommandSocket::successR ) {
1197 QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); 1203 QTimer::singleShot( 1, this , SLOT ( readFileFromSocket()));
1198 1204
1199 } else if ( state == KCommandSocket::successW ) { 1205 } else if ( state == KCommandSocket::successW ) {
1200 mParent->topLevelWidget()->setCaption( i18n("Pi-Sync successful!") ); 1206 mParent->topLevelWidget()->setCaption( i18n("Pi-Sync successful!") );
1201 mPisyncFinished = true; 1207 mPisyncFinished = true;
1202 } else if ( state == KCommandSocket::quiet ){ 1208 } else if ( state == KCommandSocket::quiet ){
1203 qDebug("KSS: quiet "); 1209 qDebug("KSS: quiet ");
1204 mPisyncFinished = true; 1210 mPisyncFinished = true;
1205 } else { 1211 } else {
1206 qDebug("KSS: Error: unknown state: %d ", state); 1212 qDebug("KSS: Error: unknown state: %d ", state);
1207 mPisyncFinished = true; 1213 mPisyncFinished = true;
1208 } 1214 }
1209 1215
1210 delete s; 1216 delete s;
1211} 1217}
1212 1218
1213void KSyncManager::readFileFromSocket() 1219void KSyncManager::readFileFromSocket()
1214{ 1220{
1215 QString fileName = syncFileName(); 1221 QString fileName = syncFileName();
1216 bool syncOK = true; 1222 bool syncOK = true;
1217 mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") ); 1223 mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") );
1218 if ( ! syncWithFile( fileName , true ) ) { 1224 if ( ! syncWithFile( fileName , true ) ) {
1219 mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); 1225 mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") );
1220 syncOK = false; 1226 syncOK = false;
1221 } 1227 }
1222 KCommandSocket* commandSocket = new KCommandSocket( "",mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() ); 1228 KCommandSocket* commandSocket = new KCommandSocket( mCurrentResourceRemote,mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() );
1223 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); 1229 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) );
1224 if ( mWriteBackFile && syncOK ) { 1230 if ( mWriteBackFile && syncOK ) {
1225 mParent->topLevelWidget()->setCaption( i18n("Sending back file ...") ); 1231 mParent->topLevelWidget()->setCaption( i18n("Sending back file ...") );
1226 commandSocket->writeFile( fileName ); 1232 commandSocket->writeFile( fileName );
1227 } 1233 }
1228 else { 1234 else {
1229 commandSocket->sendStop(); 1235 commandSocket->sendStop();
1230 if ( syncOK ) 1236 if ( syncOK )
1231 mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); 1237 mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") );
1232 mPisyncFinished = true; 1238 mPisyncFinished = true;
1233 } 1239 }
1234} 1240}
1235 1241
1236KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) 1242KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name )
1237{ 1243{
1238 mPassWord = pw; 1244 mPassWord = pw;
1239 mSocket = 0; 1245 mSocket = 0;
1240 mSyncActionDialog = 0; 1246 mSyncActionDialog = 0;
1241 blockRC = false; 1247 blockRC = false;
1242 mErrorMessage = 0; 1248 mErrorMessage = 0;
1243} 1249}
1244 1250
1245void KServerSocket::newConnection ( int socket ) 1251void KServerSocket::newConnection ( int socket )
1246{ 1252{
1247 // qDebug("KServerSocket:New connection %d ", socket); 1253 // qDebug("KServerSocket:New connection %d ", socket);
1248 if ( mSocket ) { 1254 if ( mSocket ) {
1249 qDebug("KSS::newConnection Socket deleted! "); 1255 qDebug("KSS::newConnection Socket deleted! ");
1250 delete mSocket; 1256 delete mSocket;
1251 mSocket = 0; 1257 mSocket = 0;
1252 } 1258 }
1253 mSocket = new QSocket( this ); 1259 mSocket = new QSocket( this );
1254 connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); 1260 connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) );
1255 connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); 1261 connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) );
1256 mSocket->setSocket( socket ); 1262 mSocket->setSocket( socket );
1257} 1263}
1258 1264
1259void KServerSocket::discardClient() 1265void KServerSocket::discardClient()
1260{ 1266{
1261 QTimer::singleShot( 10, this , SLOT ( deleteSocket())); 1267 QTimer::singleShot( 10, this , SLOT ( deleteSocket()));
1262} 1268}
1263void KServerSocket::deleteSocket() 1269void KServerSocket::deleteSocket()
1264{ 1270{
1265 qDebug("KSS::deleteSocket"); 1271 qDebug("KSS::deleteSocket");
1266 if ( mSocket ) { 1272 if ( mSocket ) {
1267 delete mSocket; 1273 delete mSocket;
1268 mSocket = 0; 1274 mSocket = 0;
1269 } 1275 }
1270 if ( mErrorMessage ) 1276 if ( mErrorMessage )
1271 QTimer::singleShot( 10, this , SLOT ( displayErrorMessage())); 1277 QTimer::singleShot( 10, this , SLOT ( displayErrorMessage()));
1272} 1278}
1273void KServerSocket::readClient() 1279void KServerSocket::readClient()
1274{ 1280{
1275 if ( blockRC ) 1281 if ( blockRC )
1276 return; 1282 return;
1277 if ( mSocket == 0 ) { 1283 if ( mSocket == 0 ) {
1278 qDebug("ERROR::KSS::readClient(): mSocket == 0 "); 1284 qDebug("ERROR::KSS::readClient(): mSocket == 0 ");
1279 return; 1285 return;
1280 } 1286 }
1281 if ( mErrorMessage ) { 1287 if ( mErrorMessage ) {
1282 mErrorMessage = 999; 1288 mErrorMessage = 999;
1283 error_connect("ERROR_ED\r\n\r\n"); 1289 error_connect("ERROR_ED\r\n\r\n");
1284 return; 1290 return;
1285 } 1291 }
1292 mResource = "";
1286 mErrorMessage = 0; 1293 mErrorMessage = 0;
1287 //qDebug("KServerSocket::readClient()"); 1294 //qDebug("KServerSocket::readClient()");
1288 if ( mSocket->canReadLine() ) { 1295 if ( mSocket->canReadLine() ) {
1289 QString line = mSocket->readLine(); 1296 QString line = mSocket->readLine();
1290 //qDebug("KServerSocket readline: %s ", line.latin1()); 1297 //qDebug("KServerSocket readline: %s ", line.latin1());
1291 QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line ); 1298 QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line );
1292 if ( tokens[0] == "GET" ) { 1299 if ( tokens[0] == "GET" ) {
1293 if ( tokens[1] == mPassWord ) { 1300 if ( tokens[1] == mPassWord ) {
1294 //emit sendFile( mSocket ); 1301 //emit sendFile( mSocket );
1295 bool ok = false; 1302 bool ok = false;
1296 QDateTime dt = KGlobal::locale()->readDateTime( tokens[2], KLocale::ISODate, &ok); 1303 QDateTime dt = KGlobal::locale()->readDateTime( tokens[2], KLocale::ISODate, &ok);
1297 if ( ok ) { 1304 if ( ok ) {
1298 KSyncManager::mRequestedSyncEvent = dt; 1305 KSyncManager::mRequestedSyncEvent = dt;
1299 } 1306 }
1300 else 1307 else
1301 KSyncManager::mRequestedSyncEvent = QDateTime(); 1308 KSyncManager::mRequestedSyncEvent = QDateTime();
1309 mResource =tokens[3];
1302 send_file(); 1310 send_file();
1303 } 1311 }
1304 else { 1312 else {
1305 mErrorMessage = 1; 1313 mErrorMessage = 1;
1306 error_connect("ERROR_PW\r\n\r\n"); 1314 error_connect("ERROR_PW\r\n\r\n");
1307 } 1315 }
1308 } 1316 }
1309 if ( tokens[0] == "PUT" ) { 1317 if ( tokens[0] == "PUT" ) {
1310 if ( tokens[1] == mPassWord ) { 1318 if ( tokens[1] == mPassWord ) {
1311 //emit getFile( mSocket ); 1319 //emit getFile( mSocket );
1312 blockRC = true; 1320 blockRC = true;
1321 mResource =tokens[2];
1313 get_file(); 1322 get_file();
1314 } 1323 }
1315 else { 1324 else {
1316 mErrorMessage = 2; 1325 mErrorMessage = 2;
1317 error_connect("ERROR_PW\r\n\r\n"); 1326 error_connect("ERROR_PW\r\n\r\n");
1318 end_connect(); 1327 end_connect();
1319 } 1328 }
1320 } 1329 }
1321 if ( tokens[0] == "STOP" ) { 1330 if ( tokens[0] == "STOP" ) {
1322 //emit endConnect(); 1331 //emit endConnect();
1323 end_connect(); 1332 end_connect();
1324 } 1333 }
1325 } 1334 }
1326} 1335}
1327void KServerSocket::displayErrorMessage() 1336void KServerSocket::displayErrorMessage()
1328{ 1337{
1329 if ( mErrorMessage == 1 ) { 1338 if ( mErrorMessage == 1 ) {
1330 KMessageBox::error( 0, i18n("Got send file request\nwith invalid password"), i18n("Pi-Sync Error")); 1339 KMessageBox::error( 0, i18n("Got send file request\nwith invalid password"), i18n("Pi-Sync Error"));
1331 mErrorMessage = 0; 1340 mErrorMessage = 0;
1332 } 1341 }
1333 else if ( mErrorMessage == 2 ) { 1342 else if ( mErrorMessage == 2 ) {
1334 KMessageBox::error( 0, i18n("Got receive file request\nwith invalid password"), i18n("Pi-Sync Error")); 1343 KMessageBox::error( 0, i18n("Got receive file request\nwith invalid password"), i18n("Pi-Sync Error"));
1335 mErrorMessage = 0; 1344 mErrorMessage = 0;
1336 } 1345 }
1337} 1346}
1338void KServerSocket::error_connect( QString errmess ) 1347void KServerSocket::error_connect( QString errmess )
1339{ 1348{
1340 QTextStream os( mSocket ); 1349 QTextStream os( mSocket );
1341 os.setEncoding( QTextStream::Latin1 ); 1350 os.setEncoding( QTextStream::Latin1 );
1342 os << errmess ; 1351 os << errmess ;
1343 mSocket->close(); 1352 mSocket->close();
1344 if ( mSocket->state() == QSocket::Idle ) { 1353 if ( mSocket->state() == QSocket::Idle ) {
@@ -1377,142 +1386,145 @@ void KServerSocket::send_file()
1377 lay->addWidget( label); 1386 lay->addWidget( label);
1378 if ( secs > 180 ) 1387 if ( secs > 180 )
1379 { 1388 {
1380 if ( secs > 300 ) { 1389 if ( secs > 300 ) {
1381 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(0, i18n("The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!"), i18n("High clock skew!"),i18n("Synchronize!"))) { 1390 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(0, i18n("The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!"), i18n("High clock skew!"),i18n("Synchronize!"))) {
1382 qDebug("KSS::Sync cancelled ,cs"); 1391 qDebug("KSS::Sync cancelled ,cs");
1383 mErrorMessage = 0; 1392 mErrorMessage = 0;
1384 end_connect(); 1393 end_connect();
1385 error_connect("ERROR_CA\r\n\r\n"); 1394 error_connect("ERROR_CA\r\n\r\n");
1386 return ; 1395 return ;
1387 } 1396 }
1388 } 1397 }
1389 QFont f = label->font(); 1398 QFont f = label->font();
1390 f.setPointSize ( f.pointSize() *2 ); 1399 f.setPointSize ( f.pointSize() *2 );
1391 f. setBold (true ); 1400 f. setBold (true );
1392 QLabel* label = new QLabel( warning, mSyncActionDialog ); 1401 QLabel* label = new QLabel( warning, mSyncActionDialog );
1393 label->setFont( f ); 1402 label->setFont( f );
1394 warning = i18n("ADJUST\nYOUR\nCLOCKS!"); 1403 warning = i18n("ADJUST\nYOUR\nCLOCKS!");
1395 label->setText( warning ); 1404 label->setText( warning );
1396 label->setAlignment ( Qt::AlignHCenter ); 1405 label->setAlignment ( Qt::AlignHCenter );
1397 lay->addWidget( label); 1406 lay->addWidget( label);
1398 mSyncActionDialog->setFixedSize( 230, 300); 1407 mSyncActionDialog->setFixedSize( 230, 300);
1399 } else { 1408 } else {
1400 mSyncActionDialog->setFixedSize( 230, 200); 1409 mSyncActionDialog->setFixedSize( 230, 200);
1401 } 1410 }
1402 } else { 1411 } else {
1403 mSyncActionDialog->setFixedSize( 230, 120); 1412 mSyncActionDialog->setFixedSize( 230, 120);
1404 } 1413 }
1405 } else 1414 } else
1406 mSyncActionDialog->setFixedSize( 230, 120); 1415 mSyncActionDialog->setFixedSize( 230, 120);
1407 mSyncActionDialog->show(); 1416 mSyncActionDialog->show();
1408 mSyncActionDialog->raise(); 1417 mSyncActionDialog->raise();
1418 emit request_file(mResource);
1409 emit request_file(); 1419 emit request_file();
1410 qApp->processEvents(); 1420 qApp->processEvents();
1411 QString fileName = mFileName; 1421 QString fileName = mFileName;
1412 QFile file( fileName ); 1422 QFile file( fileName );
1413 if (!file.open( IO_ReadOnly ) ) { 1423 if (!file.open( IO_ReadOnly ) ) {
1414 mErrorMessage = 0; 1424 mErrorMessage = 0;
1415 end_connect(); 1425 end_connect();
1416 error_connect("ERROR_FI\r\n\r\n"); 1426 error_connect("ERROR_FI\r\n\r\n");
1417 return ; 1427 return ;
1418 } 1428 }
1419 mSyncActionDialog->setCaption( i18n("Sending file...") ); 1429 mSyncActionDialog->setCaption( i18n("Sending file...") );
1420 QTextStream ts( &file ); 1430 QTextStream ts( &file );
1421 ts.setEncoding( QTextStream::Latin1 ); 1431 ts.setEncoding( QTextStream::Latin1 );
1422 1432
1423 QTextStream os( mSocket ); 1433 QTextStream os( mSocket );
1424 os.setEncoding( QTextStream::Latin1 ); 1434 os.setEncoding( QTextStream::Latin1 );
1425 while ( ! ts.atEnd() ) { 1435 while ( ! ts.atEnd() ) {
1426 os << ts.readLine() << "\r\n"; 1436 os << ts.readLine() << "\r\n";
1427 } 1437 }
1428 os << "\r\n"; 1438 os << "\r\n";
1429 //os << ts.read(); 1439 //os << ts.read();
1430 file.close(); 1440 file.close();
1431 mSyncActionDialog->setCaption( i18n("Waiting for synced file...") ); 1441 mSyncActionDialog->setCaption( i18n("Waiting for synced file...") );
1432 mSocket->close(); 1442 mSocket->close();
1433 if ( mSocket->state() == QSocket::Idle ) 1443 if ( mSocket->state() == QSocket::Idle )
1434 QTimer::singleShot( 10, this , SLOT ( discardClient())); 1444 QTimer::singleShot( 10, this , SLOT ( discardClient()));
1435} 1445}
1436void KServerSocket::get_file() 1446void KServerSocket::get_file()
1437{ 1447{
1438 mSyncActionDialog->setCaption( i18n("Receiving synced file...") ); 1448 mSyncActionDialog->setCaption( i18n("Receiving synced file...") );
1439 1449
1440 piTime.start(); 1450 piTime.start();
1441 piFileString = ""; 1451 piFileString = "";
1442 QTimer::singleShot( 1, this , SLOT (readBackFileFromSocket( ) )); 1452 QTimer::singleShot( 1, this , SLOT (readBackFileFromSocket( ) ));
1443} 1453}
1444 1454
1445 1455
1446void KServerSocket::readBackFileFromSocket() 1456void KServerSocket::readBackFileFromSocket()
1447{ 1457{
1448 //qDebug("readBackFileFromSocket() %d ", piTime.elapsed ()); 1458 //qDebug("readBackFileFromSocket() %d ", piTime.elapsed ());
1449 while ( mSocket->canReadLine () ) { 1459 while ( mSocket->canReadLine () ) {
1450 piTime.restart(); 1460 piTime.restart();
1451 QString line = mSocket->readLine (); 1461 QString line = mSocket->readLine ();
1452 piFileString += line; 1462 piFileString += line;
1453 //qDebug("readline: %s ", line.latin1()); 1463 //qDebug("readline: %s ", line.latin1());
1454 mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) ); 1464 mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) );
1455 1465
1456 } 1466 }
1457 if ( piTime.elapsed () < 3000 ) { 1467 if ( piTime.elapsed () < 3000 ) {
1458 // wait for more 1468 // wait for more
1459 //qDebug("waitformore "); 1469 //qDebug("waitformore ");
1460 QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) )); 1470 QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) ));
1461 return; 1471 return;
1462 } 1472 }
1463 QString fileName = mFileName; 1473 QString fileName = mFileName;
1464 QFile file ( fileName ); 1474 QFile file ( fileName );
1465 if (!file.open( IO_WriteOnly ) ) { 1475 if (!file.open( IO_WriteOnly ) ) {
1466 delete mSyncActionDialog; 1476 delete mSyncActionDialog;
1467 mSyncActionDialog = 0; 1477 mSyncActionDialog = 0;
1468 qDebug("KSS:Error open read back file "); 1478 qDebug("KSS:Error open read back file ");
1469 piFileString = ""; 1479 piFileString = "";
1470 emit file_received( false ); 1480 emit file_received( false, mResource);
1481 emit file_received( false);
1471 blockRC = false; 1482 blockRC = false;
1472 return ; 1483 return ;
1473 1484
1474 } 1485 }
1475 1486
1476 // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); 1487 // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1));
1477 QTextStream ts ( &file ); 1488 QTextStream ts ( &file );
1478 ts.setEncoding( QTextStream::Latin1 ); 1489 ts.setEncoding( QTextStream::Latin1 );
1479 mSyncActionDialog->setCaption( i18n("Writing file to disk...") ); 1490 mSyncActionDialog->setCaption( i18n("Writing file to disk...") );
1480 ts << piFileString; 1491 ts << piFileString;
1481 mSocket->close(); 1492 mSocket->close();
1482 if ( mSocket->state() == QSocket::Idle ) 1493 if ( mSocket->state() == QSocket::Idle )
1483 QTimer::singleShot( 10, this , SLOT ( discardClient())); 1494 QTimer::singleShot( 10, this , SLOT ( discardClient()));
1484 file.close(); 1495 file.close();
1485 piFileString = ""; 1496 piFileString = "";
1486 emit file_received( true ); 1497 emit file_received( true, mResource );
1498 emit file_received( true);
1487 delete mSyncActionDialog; 1499 delete mSyncActionDialog;
1488 mSyncActionDialog = 0; 1500 mSyncActionDialog = 0;
1489 blockRC = false; 1501 blockRC = false;
1490 1502
1491} 1503}
1492 1504
1493KCommandSocket::KCommandSocket ( QString remres, QString password, Q_UINT16 port, QString host, QObject * parent, QWidget * cap, const char * name ): QObject( parent, name ) 1505KCommandSocket::KCommandSocket ( QString remres, QString password, Q_UINT16 port, QString host, QObject * parent, QWidget * cap, const char * name ): QObject( parent, name )
1494{ 1506{
1495 mRemoteResource = remres; 1507 mRemoteResource = remres;
1496 if ( mRemoteResource.isEmpty() ) 1508 if ( mRemoteResource.isEmpty() )
1497 mRemoteResource = "ALL"; 1509 mRemoteResource = "ALL";
1498 mPassWord = password; 1510 mPassWord = password;
1499 mSocket = 0; 1511 mSocket = 0;
1500 mFirst = false; 1512 mFirst = false;
1501 mFirstLine = true; 1513 mFirstLine = true;
1502 mPort = port; 1514 mPort = port;
1503 mHost = host; 1515 mHost = host;
1504 tlw = cap; 1516 tlw = cap;
1505 mRetVal = quiet; 1517 mRetVal = quiet;
1506 mTimerSocket = new QTimer ( this ); 1518 mTimerSocket = new QTimer ( this );
1507 connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( updateConnectDialog() ) ); 1519 connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( updateConnectDialog() ) );
1508 mConnectProgress.setCaption( i18n("Pi-Sync") ); 1520 mConnectProgress.setCaption( i18n("Pi-Sync") );
1509 connect( &mConnectProgress, SIGNAL ( cancelled () ), this, SLOT ( deleteSocket() ) ); 1521 connect( &mConnectProgress, SIGNAL ( cancelled () ), this, SLOT ( deleteSocket() ) );
1510 mConnectCount = -1; 1522 mConnectCount = -1;
1511} 1523}
1512void KCommandSocket::sendFileRequest() 1524void KCommandSocket::sendFileRequest()
1513{ 1525{
1514 if ( tlw ) 1526 if ( tlw )
1515 tlw->setCaption( i18n("Connected! Sending request for remote file ...") ); 1527 tlw->setCaption( i18n("Connected! Sending request for remote file ...") );
1516 mConnectProgress.hide(); 1528 mConnectProgress.hide();
1517 mConnectCount = 300;mConnectMax = 300; 1529 mConnectCount = 300;mConnectMax = 300;
1518 mConnectProgress.setCaption( i18n("Pi-Sync: Connected!") ); 1530 mConnectProgress.setCaption( i18n("Pi-Sync: Connected!") );
@@ -1567,65 +1579,65 @@ void KCommandSocket::writeFile( QString fileName )
1567 mSocket = new QSocket( this ); 1579 mSocket = new QSocket( this );
1568 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); 1580 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
1569 connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) ); 1581 connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) );
1570 } 1582 }
1571 mFileName = fileName ; 1583 mFileName = fileName ;
1572 mConnectCount = 30;mConnectMax = 30; 1584 mConnectCount = 30;mConnectMax = 30;
1573 mTimerSocket->start( 1000, true ); 1585 mTimerSocket->start( 1000, true );
1574 mSocket->connectToHost( mHost, mPort ); 1586 mSocket->connectToHost( mHost, mPort );
1575} 1587}
1576void KCommandSocket::writeFileToSocket() 1588void KCommandSocket::writeFileToSocket()
1577{ 1589{
1578 mTimerSocket->stop(); 1590 mTimerSocket->stop();
1579 QFile file2( mFileName ); 1591 QFile file2( mFileName );
1580 if (!file2.open( IO_ReadOnly ) ) { 1592 if (!file2.open( IO_ReadOnly ) ) {
1581 mConnectProgress.hide(); 1593 mConnectProgress.hide();
1582 mConnectCount = -1; 1594 mConnectCount = -1;
1583 mRetVal= errorW; 1595 mRetVal= errorW;
1584 mSocket->close(); 1596 mSocket->close();
1585 if ( mSocket->state() == QSocket::Idle ) 1597 if ( mSocket->state() == QSocket::Idle )
1586 QTimer::singleShot( 10, this , SLOT ( deleteSocket())); 1598 QTimer::singleShot( 10, this , SLOT ( deleteSocket()));
1587 return ; 1599 return ;
1588 } 1600 }
1589 mConnectProgress.setTotalSteps ( file2.size() ); 1601 mConnectProgress.setTotalSteps ( file2.size() );
1590 mConnectProgress.show(); 1602 mConnectProgress.show();
1591 int count = 0; 1603 int count = 0;
1592 mConnectProgress.setLabelText( i18n("Sending back synced file...") ); 1604 mConnectProgress.setLabelText( i18n("Sending back synced file...") );
1593 mConnectProgress.setProgress( count ); 1605 mConnectProgress.setProgress( count );
1594 mConnectProgress.blockSignals( true ); 1606 mConnectProgress.blockSignals( true );
1595 QTextStream ts2( &file2 ); 1607 QTextStream ts2( &file2 );
1596 ts2.setEncoding( QTextStream::Latin1 ); 1608 ts2.setEncoding( QTextStream::Latin1 );
1597 QTextStream os2( mSocket ); 1609 QTextStream os2( mSocket );
1598 os2.setEncoding( QTextStream::Latin1 ); 1610 os2.setEncoding( QTextStream::Latin1 );
1599 os2 << "PUT " << mPassWord << "\r\n\r\n";; 1611 os2 << "PUT " << mPassWord << mRemoteResource << "\r\n\r\n";;
1600 int byteCount = 0; 1612 int byteCount = 0;
1601 int byteMax = file2.size()/53; 1613 int byteMax = file2.size()/53;
1602 while ( ! ts2.atEnd() ) { 1614 while ( ! ts2.atEnd() ) {
1603 qApp->processEvents(); 1615 qApp->processEvents();
1604 if ( byteCount > byteMax ) { 1616 if ( byteCount > byteMax ) {
1605 byteCount = 0; 1617 byteCount = 0;
1606 mConnectProgress.setProgress( count ); 1618 mConnectProgress.setProgress( count );
1607 } 1619 }
1608 QString temp = ts2.readLine(); 1620 QString temp = ts2.readLine();
1609 count += temp.length(); 1621 count += temp.length();
1610 byteCount += temp.length(); 1622 byteCount += temp.length();
1611 os2 << temp << "\r\n"; 1623 os2 << temp << "\r\n";
1612 } 1624 }
1613 file2.close(); 1625 file2.close();
1614 mConnectProgress.hide(); 1626 mConnectProgress.hide();
1615 mConnectCount = -1; 1627 mConnectCount = -1;
1616 os2 << "\r\n"; 1628 os2 << "\r\n";
1617 mRetVal= successW; 1629 mRetVal= successW;
1618 mSocket->close(); 1630 mSocket->close();
1619 if ( mSocket->state() == QSocket::Idle ) 1631 if ( mSocket->state() == QSocket::Idle )
1620 QTimer::singleShot( 10, this , SLOT ( deleteSocket())); 1632 QTimer::singleShot( 10, this , SLOT ( deleteSocket()));
1621 mConnectProgress.blockSignals( false ); 1633 mConnectProgress.blockSignals( false );
1622} 1634}
1623void KCommandSocket::sendStop() 1635void KCommandSocket::sendStop()
1624{ 1636{
1625 if ( !mSocket ) { 1637 if ( !mSocket ) {
1626 mSocket = new QSocket( this ); 1638 mSocket = new QSocket( this );
1627 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); 1639 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
1628 } 1640 }
1629 mSocket->connectToHost( mHost, mPort ); 1641 mSocket->connectToHost( mHost, mPort );
1630 QTextStream os2( mSocket ); 1642 QTextStream os2( mSocket );
1631 os2.setEncoding( QTextStream::Latin1 ); 1643 os2.setEncoding( QTextStream::Latin1 );
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index f4654ce..53c611d 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -24,73 +24,76 @@
24 24
25#include <qobject.h> 25#include <qobject.h>
26#include <qstring.h> 26#include <qstring.h>
27#include <qsocket.h> 27#include <qsocket.h>
28#include <qdatetime.h> 28#include <qdatetime.h>
29#include <qserversocket.h> 29#include <qserversocket.h>
30#include <qtextstream.h> 30#include <qtextstream.h>
31#include <qregexp.h> 31#include <qregexp.h>
32#include <qprogressdialog.h> 32#include <qprogressdialog.h>
33#include <kdialog.h> 33#include <kdialog.h>
34 34
35class QPopupMenu; 35class QPopupMenu;
36class KSyncProfile; 36class KSyncProfile;
37class KPimPrefs; 37class KPimPrefs;
38class QWidget; 38class QWidget;
39class KSyncManager; 39class KSyncManager;
40class KSyncInterface; 40class KSyncInterface;
41class QProgressBar; 41class QProgressBar;
42 42
43 43
44class KServerSocket : public QServerSocket 44class 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 file_received( bool, const QString &);
57 void request_file(const QString &);
56 void saveFile(); 58 void saveFile();
57 void endConnect(); 59 void endConnect();
58 private slots: 60 private slots:
59 void discardClient(); 61 void discardClient();
60 void deleteSocket(); 62 void deleteSocket();
61 void readClient(); 63 void readClient();
62 void displayErrorMessage(); 64 void displayErrorMessage();
63 void readBackFileFromSocket(); 65 void readBackFileFromSocket();
64 private : 66 private :
67 QString mResource;
65 int mErrorMessage; 68 int mErrorMessage;
66 bool blockRC; 69 bool blockRC;
67 void send_file(); 70 void send_file();
68 void get_file(); 71 void get_file();
69 void end_connect(); 72 void end_connect();
70 void error_connect( QString ); 73 void error_connect( QString );
71 QDialog* mSyncActionDialog; 74 QDialog* mSyncActionDialog;
72 QSocket* mSocket; 75 QSocket* mSocket;
73 QString mPassWord; 76 QString mPassWord;
74 QString mFileName; 77 QString mFileName;
75 QTime piTime; 78 QTime piTime;
76 QString piFileString; 79 QString piFileString;
77}; 80};
78 81
79class KCommandSocket : public QObject 82class KCommandSocket : public QObject
80{ 83{
81 Q_OBJECT 84 Q_OBJECT
82 public: 85 public:
83 enum state { successR, errorR, successW, errorW, errorTO, errorPW, errorCA, errorFI, errorUN, errorED,quiet }; 86 enum state { successR, errorR, successW, errorW, errorTO, errorPW, errorCA, errorFI, errorUN, errorED,quiet };
84 KCommandSocket (QString remoteResource, QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 ); 87 KCommandSocket (QString remoteResource, QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 );
85 void readFile( QString ); 88 void readFile( QString );
86 void writeFile( QString ); 89 void writeFile( QString );
87 void sendStop(); 90 void sendStop();
88 91
89 private slots : 92 private slots :
90 void sendFileRequest(); 93 void sendFileRequest();
91 void updateConnectDialog(); 94 void updateConnectDialog();
92 95
93 signals: 96 signals:
94 void commandFinished( KCommandSocket*, int ); 97 void commandFinished( KCommandSocket*, int );
95 private slots: 98 private slots:
96 void startReadFileFromSocket(); 99 void startReadFileFromSocket();
@@ -145,64 +148,67 @@ class KSyncManager : public QObject
145 void showProgressBar(int percentage, QString caption = QString::null, int total=100); 148 void showProgressBar(int percentage, QString caption = QString::null, int total=100);
146 void hideProgressBar(); 149 void hideProgressBar();
147 bool isProgressBarCanceled(); 150 bool isProgressBarCanceled();
148 151
149 // sync stuff 152 // sync stuff
150 QString mLocalMachineName; 153 QString mLocalMachineName;
151 QStringList mExternSyncProfiles; 154 QStringList mExternSyncProfiles;
152 QStringList mSyncProfileNames; 155 QStringList mSyncProfileNames;
153 bool mAskForPreferences; 156 bool mAskForPreferences;
154 bool mShowSyncSummary; 157 bool mShowSyncSummary;
155 bool mIsKapiFile; 158 bool mIsKapiFile;
156 bool mWriteBackExistingOnly; 159 bool mWriteBackExistingOnly;
157 int mSyncAlgoPrefs; 160 int mSyncAlgoPrefs;
158 bool mWriteBackFile; 161 bool mWriteBackFile;
159 int mWriteBackInFuture; 162 int mWriteBackInFuture;
160 int mWriteBackInPast; 163 int mWriteBackInPast;
161 QString mPhoneDevice; 164 QString mPhoneDevice;
162 QString mPhoneConnection; 165 QString mPhoneConnection;
163 QString mPhoneModel; 166 QString mPhoneModel;
164 QString mPassWordPiSync; 167 QString mPassWordPiSync;
165 QString mActiveSyncPort; 168 QString mActiveSyncPort;
166 QString mActiveSyncIP ; 169 QString mActiveSyncIP ;
167 QString mFilterInCal; 170 QString mFilterInCal;
168 QString mFilterOutCal; 171 QString mFilterOutCal;
169 QString mFilterInAB; 172 QString mFilterInAB;
170 QString mFilterOutAB; 173 QString mFilterOutAB;
171 static QDateTime mRequestedSyncEvent; 174 static QDateTime mRequestedSyncEvent;
172 175
173 signals: 176 signals:
174 void save(); 177 void save();
175 void request_file(); 178 void request_file();
176 void getFile( bool ); 179 void getFile( bool );
180 void getFile( bool, const QString &);
181 void request_file(const QString &);
182 void multiResourceSyncStart( bool );
177 183
178 public slots: 184 public slots:
179 void slotSyncMenu( int ); 185 void slotSyncMenu( int );
180 void slotClearMenu( int action ); 186 void slotClearMenu( int action );
181 void deleteCommandSocket(KCommandSocket*s, int state); 187 void deleteCommandSocket(KCommandSocket*s, int state);
182 void readFileFromSocket(); 188 void readFileFromSocket();
183 void fillSyncMenu(); 189 void fillSyncMenu();
184 190
185 private: 191 private:
186 void syncPi(); 192 void syncPi();
187 KServerSocket * mServerSocket; 193 KServerSocket * mServerSocket;
188 KPimPrefs* mPrefs; 194 KPimPrefs* mPrefs;
189 QString mDefFileName; 195 QString mDefFileName;
190 QString mCurrentSyncDevice; 196 QString mCurrentSyncDevice;
191 QString mCurrentSyncName; 197 QString mCurrentSyncName;
192 void quickSyncLocalFile(); 198 void quickSyncLocalFile();
193 bool syncWithFile( QString fn , bool quick ); 199 bool syncWithFile( QString fn , bool quick );
194 void syncLocalFile(); 200 void syncLocalFile();
195 void syncPhone(); 201 void syncPhone();
196 void syncSharp(); 202 void syncSharp();
197 void syncKDE(); 203 void syncKDE();
198 bool syncExternalApplication(QString); 204 bool syncExternalApplication(QString);
199 int mCurrentSyncProfile ; 205 int mCurrentSyncProfile ;
200 void syncRemote( KSyncProfile* prof, bool ask = true); 206 void syncRemote( KSyncProfile* prof, bool ask = true);
201 bool edit_sync_options(); 207 bool edit_sync_options();
202 bool edit_pisync_options(); 208 bool edit_pisync_options();
203 int ringSync(); 209 int ringSync();
204 QString getPassword( ); 210 QString getPassword( );
205 bool mPisyncFinished; 211 bool mPisyncFinished;
206 QStringList mSpecificResources; 212 QStringList mSpecificResources;
207 QString mCurrentResourceLocal; 213 QString mCurrentResourceLocal;
208 QString mCurrentResourceRemote; 214 QString mCurrentResourceRemote;