summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp2
-rw-r--r--korganizer/korganizerE.pro7
2 files changed, 8 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index a7f7010..b307649 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -423,1537 +423,1537 @@ void CalendarView::init()
423 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 423 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
424 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 424 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
425 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 425 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
426 426
427 427
428 428
429 429
430 430
431 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 431 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
432 SLOT(checkClipboard())); 432 SLOT(checkClipboard()));
433 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 433 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
434 SLOT( processTodoListSelection( Incidence * ) ) ); 434 SLOT( processTodoListSelection( Incidence * ) ) );
435 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 435 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
436 436
437 // kdDebug() << "CalendarView::CalendarView() done" << endl; 437 // kdDebug() << "CalendarView::CalendarView() done" << endl;
438 438
439 mDateFrame = new QVBox(0,0,WType_Popup); 439 mDateFrame = new QVBox(0,0,WType_Popup);
440 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 440 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
441 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 441 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
442 mDateFrame->setLineWidth(3); 442 mDateFrame->setLineWidth(3);
443 mDateFrame->hide(); 443 mDateFrame->hide();
444 mDateFrame->setCaption( i18n( "Pick a date to display")); 444 mDateFrame->setCaption( i18n( "Pick a date to display"));
445 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 445 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
446 446
447 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 447 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
448 448
449 mEventEditor = mDialogManager->getEventEditor(); 449 mEventEditor = mDialogManager->getEventEditor();
450 mTodoEditor = mDialogManager->getTodoEditor(); 450 mTodoEditor = mDialogManager->getTodoEditor();
451 451
452 mFlagEditDescription = false; 452 mFlagEditDescription = false;
453 453
454 mSuspendTimer = new QTimer( this ); 454 mSuspendTimer = new QTimer( this );
455 mAlarmTimer = new QTimer( this ); 455 mAlarmTimer = new QTimer( this );
456 mRecheckAlarmTimer = new QTimer( this ); 456 mRecheckAlarmTimer = new QTimer( this );
457 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 457 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
458 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 458 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
459 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 459 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
460 mAlarmDialog = new AlarmDialog( this ); 460 mAlarmDialog = new AlarmDialog( this );
461 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 461 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
462 mAlarmDialog->setServerNotification( false ); 462 mAlarmDialog->setServerNotification( false );
463 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 463 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
464} 464}
465 465
466 466
467CalendarView::~CalendarView() 467CalendarView::~CalendarView()
468{ 468{
469 // kdDebug() << "~CalendarView()" << endl; 469 // kdDebug() << "~CalendarView()" << endl;
470 //qDebug("CalendarView::~CalendarView() "); 470 //qDebug("CalendarView::~CalendarView() ");
471 delete mDialogManager; 471 delete mDialogManager;
472 delete mViewManager; 472 delete mViewManager;
473 delete mStorage; 473 delete mStorage;
474 delete mDateFrame ; 474 delete mDateFrame ;
475 delete beamDialog; 475 delete beamDialog;
476 //kdDebug() << "~CalendarView() done" << endl; 476 //kdDebug() << "~CalendarView() done" << endl;
477} 477}
478void CalendarView::timerAlarm() 478void CalendarView::timerAlarm()
479{ 479{
480 //qDebug("CalendarView::timerAlarm() "); 480 //qDebug("CalendarView::timerAlarm() ");
481 computeAlarm(mAlarmNotification ); 481 computeAlarm(mAlarmNotification );
482} 482}
483 483
484void CalendarView::suspendAlarm() 484void CalendarView::suspendAlarm()
485{ 485{
486 //qDebug(" CalendarView::suspendAlarm() "); 486 //qDebug(" CalendarView::suspendAlarm() ");
487 computeAlarm(mSuspendAlarmNotification ); 487 computeAlarm(mSuspendAlarmNotification );
488 488
489} 489}
490 490
491void CalendarView::startAlarm( QString mess , QString filename) 491void CalendarView::startAlarm( QString mess , QString filename)
492{ 492{
493 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 493 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
494 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); 494 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) );
495 495
496} 496}
497 497
498void CalendarView::checkNextTimerAlarm() 498void CalendarView::checkNextTimerAlarm()
499{ 499{
500 mCalendar->checkAlarmForIncidence( 0, true ); 500 mCalendar->checkAlarmForIncidence( 0, true );
501} 501}
502 502
503void CalendarView::computeAlarm( QString msg ) 503void CalendarView::computeAlarm( QString msg )
504{ 504{
505 505
506 QString mess = msg; 506 QString mess = msg;
507 QString mAlarmMessage = mess.mid( 9 ); 507 QString mAlarmMessage = mess.mid( 9 );
508 QString filename = MainWindow::resourcePath(); 508 QString filename = MainWindow::resourcePath();
509 filename += "koalarm.wav"; 509 filename += "koalarm.wav";
510 QString tempfilename; 510 QString tempfilename;
511 if ( mess.left( 13 ) == "suspend_alarm") { 511 if ( mess.left( 13 ) == "suspend_alarm") {
512 bool error = false; 512 bool error = false;
513 int len = mess.mid( 13 ).find("+++"); 513 int len = mess.mid( 13 ).find("+++");
514 if ( len < 2 ) 514 if ( len < 2 )
515 error = true; 515 error = true;
516 else { 516 else {
517 tempfilename = mess.mid( 13, len ); 517 tempfilename = mess.mid( 13, len );
518 if ( !QFile::exists( tempfilename ) ) 518 if ( !QFile::exists( tempfilename ) )
519 error = true; 519 error = true;
520 } 520 }
521 if ( ! error ) { 521 if ( ! error ) {
522 filename = tempfilename; 522 filename = tempfilename;
523 } 523 }
524 mAlarmMessage = mess.mid( 13+len+3 ); 524 mAlarmMessage = mess.mid( 13+len+3 );
525 //qDebug("suspend file %s ",tempfilename.latin1() ); 525 //qDebug("suspend file %s ",tempfilename.latin1() );
526 startAlarm( mAlarmMessage, filename); 526 startAlarm( mAlarmMessage, filename);
527 return; 527 return;
528 } 528 }
529 if ( mess.left( 11 ) == "timer_alarm") { 529 if ( mess.left( 11 ) == "timer_alarm") {
530 //mTimerTime = 0; 530 //mTimerTime = 0;
531 startAlarm( mess.mid( 11 ), filename ); 531 startAlarm( mess.mid( 11 ), filename );
532 return; 532 return;
533 } 533 }
534 if ( mess.left( 10 ) == "proc_alarm") { 534 if ( mess.left( 10 ) == "proc_alarm") {
535 bool error = false; 535 bool error = false;
536 int len = mess.mid( 10 ).find("+++"); 536 int len = mess.mid( 10 ).find("+++");
537 if ( len < 2 ) 537 if ( len < 2 )
538 error = true; 538 error = true;
539 else { 539 else {
540 tempfilename = mess.mid( 10, len ); 540 tempfilename = mess.mid( 10, len );
541 if ( !QFile::exists( tempfilename ) ) 541 if ( !QFile::exists( tempfilename ) )
542 error = true; 542 error = true;
543 } 543 }
544 if ( error ) { 544 if ( error ) {
545 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 545 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
546 mAlarmMessage += mess.mid( 10+len+3+9 ); 546 mAlarmMessage += mess.mid( 10+len+3+9 );
547 } else { 547 } else {
548 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 548 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
549 //qDebug("-----system command %s ",tempfilename.latin1() ); 549 //qDebug("-----system command %s ",tempfilename.latin1() );
550#ifndef _WIN32_ 550#ifndef _WIN32_
551 if ( vfork () == 0 ) { 551 if ( vfork () == 0 ) {
552 execl ( tempfilename.latin1(), 0 ); 552 execl ( tempfilename.latin1(), 0 );
553 return; 553 return;
554 } 554 }
555#else 555#else
556 QProcess* p = new QProcess(); 556 QProcess* p = new QProcess();
557 p->addArgument( tempfilename.latin1() ); 557 p->addArgument( tempfilename.latin1() );
558 p->start(); 558 p->start();
559 return; 559 return;
560#endif 560#endif
561 561
562 return; 562 return;
563 } 563 }
564 564
565 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 565 //qDebug("+++++++system command %s ",tempfilename.latin1() );
566 } 566 }
567 if ( mess.left( 11 ) == "audio_alarm") { 567 if ( mess.left( 11 ) == "audio_alarm") {
568 bool error = false; 568 bool error = false;
569 int len = mess.mid( 11 ).find("+++"); 569 int len = mess.mid( 11 ).find("+++");
570 if ( len < 2 ) 570 if ( len < 2 )
571 error = true; 571 error = true;
572 else { 572 else {
573 tempfilename = mess.mid( 11, len ); 573 tempfilename = mess.mid( 11, len );
574 if ( !QFile::exists( tempfilename ) ) 574 if ( !QFile::exists( tempfilename ) )
575 error = true; 575 error = true;
576 } 576 }
577 if ( ! error ) { 577 if ( ! error ) {
578 filename = tempfilename; 578 filename = tempfilename;
579 } 579 }
580 mAlarmMessage = mess.mid( 11+len+3+9 ); 580 mAlarmMessage = mess.mid( 11+len+3+9 );
581 //qDebug("audio file command %s ",tempfilename.latin1() ); 581 //qDebug("audio file command %s ",tempfilename.latin1() );
582 } 582 }
583 if ( mess.left( 9 ) == "cal_alarm") { 583 if ( mess.left( 9 ) == "cal_alarm") {
584 mAlarmMessage = mess.mid( 9 ) ; 584 mAlarmMessage = mess.mid( 9 ) ;
585 } 585 }
586 586
587 startAlarm( mAlarmMessage, filename ); 587 startAlarm( mAlarmMessage, filename );
588 588
589 589
590} 590}
591 591
592void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti ) 592void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
593{ 593{
594 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 594 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
595 595
596 mSuspendAlarmNotification = noti; 596 mSuspendAlarmNotification = noti;
597 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; 597 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
598 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); 598 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
599 mSuspendTimer->start( ms , true ); 599 mSuspendTimer->start( ms , true );
600 600
601} 601}
602 602
603void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti ) 603void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
604{ 604{
605 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 605 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
606 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 606 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
607#ifndef DESKTOP_VERSION 607#ifndef DESKTOP_VERSION
608 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); 608 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() );
609#endif 609#endif
610 return; 610 return;
611 } 611 }
612 int maxSec; 612 int maxSec;
613 //maxSec = 5; //testing only 613 //maxSec = 5; //testing only
614 maxSec = 86400+3600; // one day+1hour 614 maxSec = 86400+3600; // one day+1hour
615 mAlarmNotification = noti; 615 mAlarmNotification = noti;
616 int sec = QDateTime::currentDateTime().secsTo( qdt ); 616 int sec = QDateTime::currentDateTime().secsTo( qdt );
617 if ( sec > maxSec ) { 617 if ( sec > maxSec ) {
618 mRecheckAlarmTimer->start( maxSec * 1000 ); 618 mRecheckAlarmTimer->start( maxSec * 1000 );
619 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); 619 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
620 return; 620 return;
621 } else { 621 } else {
622 mRecheckAlarmTimer->stop(); 622 mRecheckAlarmTimer->stop();
623 } 623 }
624 //qDebug("Alarm timer started with secs: %d ", sec); 624 //qDebug("Alarm timer started with secs: %d ", sec);
625 mAlarmTimer->start( sec *1000 , true ); 625 mAlarmTimer->start( sec *1000 , true );
626 626
627} 627}
628// called by mRecheckAlarmTimer to get next alarm 628// called by mRecheckAlarmTimer to get next alarm
629// we need this, because a QTimer has only a max range of 25 days 629// we need this, because a QTimer has only a max range of 25 days
630void CalendarView::recheckTimerAlarm() 630void CalendarView::recheckTimerAlarm()
631{ 631{
632 mAlarmTimer->stop(); 632 mAlarmTimer->stop();
633 mRecheckAlarmTimer->stop(); 633 mRecheckAlarmTimer->stop();
634 mCalendar->checkAlarmForIncidence( 0, true ); 634 mCalendar->checkAlarmForIncidence( 0, true );
635} 635}
636void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti ) 636void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti )
637{ 637{
638 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 638 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
639 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 639 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
640#ifndef DESKTOP_VERSION 640#ifndef DESKTOP_VERSION
641 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); 641 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() );
642#endif 642#endif
643 return; 643 return;
644 } 644 }
645 mAlarmTimer->stop(); 645 mAlarmTimer->stop();
646} 646}
647void CalendarView::selectWeekNum ( int num ) 647void CalendarView::selectWeekNum ( int num )
648{ 648{
649 dateNavigator()->selectWeek( num ); 649 dateNavigator()->selectWeek( num );
650 mViewManager->showWeekView(); 650 mViewManager->showWeekView();
651} 651}
652KOViewManager *CalendarView::viewManager() 652KOViewManager *CalendarView::viewManager()
653{ 653{
654 return mViewManager; 654 return mViewManager;
655} 655}
656 656
657KODialogManager *CalendarView::dialogManager() 657KODialogManager *CalendarView::dialogManager()
658{ 658{
659 return mDialogManager; 659 return mDialogManager;
660} 660}
661 661
662QDate CalendarView::startDate() 662QDate CalendarView::startDate()
663{ 663{
664 DateList dates = mNavigator->selectedDates(); 664 DateList dates = mNavigator->selectedDates();
665 665
666 return dates.first(); 666 return dates.first();
667} 667}
668 668
669QDate CalendarView::endDate() 669QDate CalendarView::endDate()
670{ 670{
671 DateList dates = mNavigator->selectedDates(); 671 DateList dates = mNavigator->selectedDates();
672 672
673 return dates.last(); 673 return dates.last();
674} 674}
675 675
676 676
677void CalendarView::createPrinter() 677void CalendarView::createPrinter()
678{ 678{
679#ifndef KORG_NOPRINTER 679#ifndef KORG_NOPRINTER
680 if (!mCalPrinter) { 680 if (!mCalPrinter) {
681 mCalPrinter = new CalPrinter(this, mCalendar); 681 mCalPrinter = new CalPrinter(this, mCalendar);
682 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); 682 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig()));
683 } 683 }
684#endif 684#endif
685} 685}
686 686
687void CalendarView::confSync() 687void CalendarView::confSync()
688{ 688{
689 static KSyncPrefsDialog* sp = 0; 689 static KSyncPrefsDialog* sp = 0;
690 if ( ! sp ) { 690 if ( ! sp ) {
691 sp = new KSyncPrefsDialog( this, "syncprefs", true ); 691 sp = new KSyncPrefsDialog( this, "syncprefs", true );
692 } 692 }
693 sp->usrReadConfig(); 693 sp->usrReadConfig();
694#ifndef DESKTOP_VERSION 694#ifndef DESKTOP_VERSION
695 sp->showMaximized(); 695 sp->showMaximized();
696#else 696#else
697 sp->show(); 697 sp->show();
698#endif 698#endif
699 sp->exec(); 699 sp->exec();
700 KOPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames(); 700 KOPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames();
701 KOPrefs::instance()->mLocalMachineName = sp->getLocalMachineName (); 701 KOPrefs::instance()->mLocalMachineName = sp->getLocalMachineName ();
702} 702}
703 703
704 704
705//KOPrefs::instance()->mWriteBackFile 705//KOPrefs::instance()->mWriteBackFile
706//KOPrefs::instance()->mWriteBackExistingOnly 706//KOPrefs::instance()->mWriteBackExistingOnly
707 707
708// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 708// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
709// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 709// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
710// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 710// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
711// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 711// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
712// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 712// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
713// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 713// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
714 714
715int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) 715int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full )
716{ 716{
717 717
718 //void setZaurusId(int id); 718 //void setZaurusId(int id);
719 // int zaurusId() const; 719 // int zaurusId() const;
720 // void setZaurusUid(int id); 720 // void setZaurusUid(int id);
721 // int zaurusUid() const; 721 // int zaurusUid() const;
722 // void setZaurusStat(int id); 722 // void setZaurusStat(int id);
723 // int zaurusStat() const; 723 // int zaurusStat() const;
724 // 0 equal 724 // 0 equal
725 // 1 take local 725 // 1 take local
726 // 2 take remote 726 // 2 take remote
727 // 3 cancel 727 // 3 cancel
728 QDateTime lastSync = mLastCalendarSync; 728 QDateTime lastSync = mLastCalendarSync;
729 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 729 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
730 bool remCh, locCh; 730 bool remCh, locCh;
731 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 731 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
732 locCh = ( local->lastModified() > mLastCalendarSync ); 732 locCh = ( local->lastModified() > mLastCalendarSync );
733 //qDebug("locCh %d remCh %d locuid %d remuid %d", locCh, remCh,local->zaurusUid(), remote->zaurusUid() ); 733 //qDebug("locCh %d remCh %d locuid %d remuid %d", locCh, remCh,local->zaurusUid(), remote->zaurusUid() );
734 if ( !remCh && ! locCh ) { 734 if ( !remCh && ! locCh ) {
735 //qDebug("both not changed "); 735 //qDebug("both not changed ");
736 lastSync = local->lastModified().addDays(1); 736 lastSync = local->lastModified().addDays(1);
737 } else { 737 } else {
738 if ( locCh ) { 738 if ( locCh ) {
739 //qDebug("loc changed %d %d", local->zaurusStat(), local->revision() ); 739 //qDebug("loc changed %d %d", local->zaurusStat(), local->revision() );
740 lastSync = local->lastModified().addDays( -1 ); 740 lastSync = local->lastModified().addDays( -1 );
741 if ( !remCh ) 741 if ( !remCh )
742 remote->setLastModified( lastSync.addDays( -1 ) ); 742 remote->setLastModified( lastSync.addDays( -1 ) );
743 } else { 743 } else {
744 //qDebug(" not loc changed "); 744 //qDebug(" not loc changed ");
745 lastSync = local->lastModified().addDays( 1 ); 745 lastSync = local->lastModified().addDays( 1 );
746 if ( remCh ) 746 if ( remCh )
747 remote->setLastModified( lastSync.addDays( 1 ) ); 747 remote->setLastModified( lastSync.addDays( 1 ) );
748 748
749 } 749 }
750 } 750 }
751 full = true; 751 full = true;
752 if ( mode < SYNC_PREF_ASK ) 752 if ( mode < SYNC_PREF_ASK )
753 mode = SYNC_PREF_ASK; 753 mode = SYNC_PREF_ASK;
754 } else { 754 } else {
755 if ( local->lastModified() == remote->lastModified() ) 755 if ( local->lastModified() == remote->lastModified() )
756 if ( local->revision() == remote->revision() ) 756 if ( local->revision() == remote->revision() )
757 return 0; 757 return 0;
758 758
759 } 759 }
760 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 760 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
761 761
762 //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , local->revision(), remote->lastModified().toString().latin1(), remote->revision()); 762 //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , local->revision(), remote->lastModified().toString().latin1(), remote->revision());
763 //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); 763 //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() );
764 //full = true; //debug only 764 //full = true; //debug only
765 if ( full ) { 765 if ( full ) {
766 bool equ = false; 766 bool equ = false;
767 if ( local->type() == "Event" ) { 767 if ( local->type() == "Event" ) {
768 equ = (*((Event*) local) == *((Event*) remote)); 768 equ = (*((Event*) local) == *((Event*) remote));
769 } 769 }
770 else if ( local->type() =="Todo" ) 770 else if ( local->type() =="Todo" )
771 equ = (*((Todo*) local) == (*(Todo*) remote)); 771 equ = (*((Todo*) local) == (*(Todo*) remote));
772 else if ( local->type() =="Journal" ) 772 else if ( local->type() =="Journal" )
773 equ = (*((Journal*) local) == *((Journal*) remote)); 773 equ = (*((Journal*) local) == *((Journal*) remote));
774 if ( equ ) { 774 if ( equ ) {
775 //qDebug("equal "); 775 //qDebug("equal ");
776 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 776 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
777 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 777 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
778 } 778 }
779 if ( mode < SYNC_PREF_FORCE_LOCAL ) 779 if ( mode < SYNC_PREF_FORCE_LOCAL )
780 return 0; 780 return 0;
781 781
782 }//else //debug only 782 }//else //debug only
783 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 783 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
784 } 784 }
785 int result; 785 int result;
786 bool localIsNew; 786 bool localIsNew;
787 if ( full && mode < SYNC_PREF_NEWEST ) 787 if ( full && mode < SYNC_PREF_NEWEST )
788 mode = SYNC_PREF_ASK; 788 mode = SYNC_PREF_ASK;
789 789
790 switch( mode ) { 790 switch( mode ) {
791 case SYNC_PREF_LOCAL: 791 case SYNC_PREF_LOCAL:
792 if ( lastSync > remote->lastModified() ) 792 if ( lastSync > remote->lastModified() )
793 return 1; 793 return 1;
794 if ( lastSync > local->lastModified() ) 794 if ( lastSync > local->lastModified() )
795 return 2; 795 return 2;
796 return 1; 796 return 1;
797 break; 797 break;
798 case SYNC_PREF_REMOTE: 798 case SYNC_PREF_REMOTE:
799 if ( lastSync > remote->lastModified() ) 799 if ( lastSync > remote->lastModified() )
800 return 1; 800 return 1;
801 if ( lastSync > local->lastModified() ) 801 if ( lastSync > local->lastModified() )
802 return 2; 802 return 2;
803 return 2; 803 return 2;
804 break; 804 break;
805 case SYNC_PREF_NEWEST: 805 case SYNC_PREF_NEWEST:
806 if ( local->lastModified() > remote->lastModified() ) 806 if ( local->lastModified() > remote->lastModified() )
807 return 1; 807 return 1;
808 else 808 else
809 return 2; 809 return 2;
810 break; 810 break;
811 case SYNC_PREF_ASK: 811 case SYNC_PREF_ASK:
812 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); 812 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() );
813 if ( lastSync > remote->lastModified() ) 813 if ( lastSync > remote->lastModified() )
814 return 1; 814 return 1;
815 if ( lastSync > local->lastModified() ) 815 if ( lastSync > local->lastModified() )
816 return 2; 816 return 2;
817 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); 817 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() );
818 localIsNew = local->lastModified() > remote->lastModified(); 818 localIsNew = local->lastModified() > remote->lastModified();
819 if ( localIsNew ) 819 if ( localIsNew )
820 getEventViewerDialog()->setColorMode( 1 ); 820 getEventViewerDialog()->setColorMode( 1 );
821 else 821 else
822 getEventViewerDialog()->setColorMode( 2 ); 822 getEventViewerDialog()->setColorMode( 2 );
823 getEventViewerDialog()->setIncidence(local); 823 getEventViewerDialog()->setIncidence(local);
824 if ( localIsNew ) 824 if ( localIsNew )
825 getEventViewerDialog()->setColorMode( 2 ); 825 getEventViewerDialog()->setColorMode( 2 );
826 else 826 else
827 getEventViewerDialog()->setColorMode( 1 ); 827 getEventViewerDialog()->setColorMode( 1 );
828 getEventViewerDialog()->addIncidence(remote); 828 getEventViewerDialog()->addIncidence(remote);
829 getEventViewerDialog()->setColorMode( 0 ); 829 getEventViewerDialog()->setColorMode( 0 );
830 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); 830 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() );
831 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); 831 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!"));
832 getEventViewerDialog()->showMe(); 832 getEventViewerDialog()->showMe();
833 result = getEventViewerDialog()->executeS( localIsNew ); 833 result = getEventViewerDialog()->executeS( localIsNew );
834 return result; 834 return result;
835 835
836 break; 836 break;
837 case SYNC_PREF_FORCE_LOCAL: 837 case SYNC_PREF_FORCE_LOCAL:
838 return 1; 838 return 1;
839 break; 839 break;
840 case SYNC_PREF_FORCE_REMOTE: 840 case SYNC_PREF_FORCE_REMOTE:
841 return 2; 841 return 2;
842 break; 842 break;
843 843
844 default: 844 default:
845 // SYNC_PREF_TAKE_BOTH not implemented 845 // SYNC_PREF_TAKE_BOTH not implemented
846 break; 846 break;
847 } 847 }
848 return 0; 848 return 0;
849} 849}
850Event* CalendarView::getLastSyncEvent() 850Event* CalendarView::getLastSyncEvent()
851{ 851{
852 Event* lse; 852 Event* lse;
853 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 853 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
854 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); 854 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice );
855 if (!lse) { 855 if (!lse) {
856 lse = new Event(); 856 lse = new Event();
857 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); 857 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice );
858 QString sum = ""; 858 QString sum = "";
859 if ( KOPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) 859 if ( KOPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
860 sum = "E: "; 860 sum = "E: ";
861 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); 861 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event"));
862 lse->setDtStart( mLastCalendarSync ); 862 lse->setDtStart( mLastCalendarSync );
863 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 863 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
864 lse->setCategories( i18n("SyncEvent") ); 864 lse->setCategories( i18n("SyncEvent") );
865 lse->setReadOnly( true ); 865 lse->setReadOnly( true );
866 mCalendar->addEvent( lse ); 866 mCalendar->addEvent( lse );
867 } 867 }
868 868
869 return lse; 869 return lse;
870 870
871} 871}
872// probaly useless 872// probaly useless
873void CalendarView::setupExternSyncProfiles() 873void CalendarView::setupExternSyncProfiles()
874{ 874{
875 Event* lse; 875 Event* lse;
876 mExternLastSyncEvent.clear(); 876 mExternLastSyncEvent.clear();
877 int i; 877 int i;
878 for ( i = 0; i < KOPrefs::instance()->mExternSyncProfiles.count(); ++i ) { 878 for ( i = 0; i < KOPrefs::instance()->mExternSyncProfiles.count(); ++i ) {
879 lse = mCalendar->event( "last-syncEvent-"+ KOPrefs::instance()->mExternSyncProfiles[i] ); 879 lse = mCalendar->event( "last-syncEvent-"+ KOPrefs::instance()->mExternSyncProfiles[i] );
880 if ( lse ) 880 if ( lse )
881 mExternLastSyncEvent.append( lse ); 881 mExternLastSyncEvent.append( lse );
882 else 882 else
883 qDebug("Last Sync event not found for %s ", KOPrefs::instance()->mExternSyncProfiles[i].latin1()); 883 qDebug("Last Sync event not found for %s ", KOPrefs::instance()->mExternSyncProfiles[i].latin1());
884 } 884 }
885 885
886} 886}
887// we check, if the to delete event has a id for a profile 887// we check, if the to delete event has a id for a profile
888// if yes, we set this id in the profile to delete 888// if yes, we set this id in the profile to delete
889void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) 889void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete )
890{ 890{
891 if ( lastSync.count() == 0 ) { 891 if ( lastSync.count() == 0 ) {
892 //qDebug(" lastSync.count() == 0"); 892 //qDebug(" lastSync.count() == 0");
893 return; 893 return;
894 } 894 }
895 if ( toDelete->type() == "Journal" ) 895 if ( toDelete->type() == "Journal" )
896 return; 896 return;
897 897
898 Event* eve = lastSync.first(); 898 Event* eve = lastSync.first();
899 899
900 while ( eve ) { 900 while ( eve ) {
901 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name 901 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name
902 if ( !id.isEmpty() ) { 902 if ( !id.isEmpty() ) {
903 QString des = eve->description(); 903 QString des = eve->description();
904 QString pref = "e"; 904 QString pref = "e";
905 if ( toDelete->type() == "Todo" ) 905 if ( toDelete->type() == "Todo" )
906 pref = "t"; 906 pref = "t";
907 des += pref+ id + ","; 907 des += pref+ id + ",";
908 eve->setReadOnly( false ); 908 eve->setReadOnly( false );
909 eve->setDescription( des ); 909 eve->setDescription( des );
910 //qDebug("setdes %s ", des.latin1()); 910 //qDebug("setdes %s ", des.latin1());
911 eve->setReadOnly( true ); 911 eve->setReadOnly( true );
912 } 912 }
913 eve = lastSync.next(); 913 eve = lastSync.next();
914 } 914 }
915 915
916} 916}
917void CalendarView::checkExternalId( Incidence * inc ) 917void CalendarView::checkExternalId( Incidence * inc )
918{ 918{
919 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; 919 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ;
920 checkExternSyncEvent( lastSync, inc ); 920 checkExternSyncEvent( lastSync, inc );
921 921
922} 922}
923bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) 923bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode )
924{ 924{
925 bool syncOK = true; 925 bool syncOK = true;
926 int addedEvent = 0; 926 int addedEvent = 0;
927 int addedEventR = 0; 927 int addedEventR = 0;
928 int deletedEventR = 0; 928 int deletedEventR = 0;
929 int deletedEventL = 0; 929 int deletedEventL = 0;
930 int changedLocal = 0; 930 int changedLocal = 0;
931 int changedRemote = 0; 931 int changedRemote = 0;
932 //QPtrList<Event> el = local->rawEvents(); 932 //QPtrList<Event> el = local->rawEvents();
933 Event* eventR; 933 Event* eventR;
934 QString uid; 934 QString uid;
935 int take; 935 int take;
936 Event* eventL; 936 Event* eventL;
937 Event* eventRSync; 937 Event* eventRSync;
938 Event* eventLSync; 938 Event* eventLSync;
939 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); 939 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents();
940 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); 940 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents();
941 bool fullDateRange = false; 941 bool fullDateRange = false;
942 mLastCalendarSync = QDateTime::currentDateTime(); 942 mLastCalendarSync = QDateTime::currentDateTime();
943 QDateTime modifiedCalendar = mLastCalendarSync;; 943 QDateTime modifiedCalendar = mLastCalendarSync;;
944 eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); 944 eventR = remote->event("last-syncEvent-"+mCurrentSyncName );
945 if ( eventR ) { 945 if ( eventR ) {
946 eventRSync = (Event*) eventR->clone(); 946 eventRSync = (Event*) eventR->clone();
947 remote->deleteEvent(eventR ); 947 remote->deleteEvent(eventR );
948 948
949 } else { 949 } else {
950 fullDateRange = true; 950 fullDateRange = true;
951 eventRSync = new Event(); 951 eventRSync = new Event();
952 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); 952 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event"));
953 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); 953 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName );
954 eventRSync->setDtStart( mLastCalendarSync ); 954 eventRSync->setDtStart( mLastCalendarSync );
955 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 955 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
956 eventRSync->setCategories( i18n("SyncEvent") ); 956 eventRSync->setCategories( i18n("SyncEvent") );
957 } 957 }
958 eventLSync = getLastSyncEvent(); 958 eventLSync = getLastSyncEvent();
959 if ( eventLSync->dtStart() == mLastCalendarSync ) 959 if ( eventLSync->dtStart() == mLastCalendarSync )
960 fullDateRange = true; 960 fullDateRange = true;
961 961
962 if ( ! fullDateRange ) { 962 if ( ! fullDateRange ) {
963 if ( eventLSync->dtStart() != eventRSync->dtStart() ) { 963 if ( eventLSync->dtStart() != eventRSync->dtStart() ) {
964 964
965 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); 965 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() );
966 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); 966 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec());
967 fullDateRange = true; 967 fullDateRange = true;
968 } 968 }
969 } 969 }
970 if ( fullDateRange ) 970 if ( fullDateRange )
971 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); 971 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
972 else 972 else
973 mLastCalendarSync = eventLSync->dtStart(); 973 mLastCalendarSync = eventLSync->dtStart();
974 // for resyncing if own file has changed 974 // for resyncing if own file has changed
975 if ( mCurrentSyncDevice == "deleteaftersync" ) { 975 if ( mCurrentSyncDevice == "deleteaftersync" ) {
976 mLastCalendarSync = loadedFileVersion; 976 mLastCalendarSync = loadedFileVersion;
977 qDebug("setting mLastCalendarSync "); 977 qDebug("setting mLastCalendarSync ");
978 } 978 }
979 //qDebug("*************************** "); 979 //qDebug("*************************** ");
980 qDebug("mLastCalendarSync %s ",mLastCalendarSync.toString().latin1() ); 980 qDebug("mLastCalendarSync %s ",mLastCalendarSync.toString().latin1() );
981 QPtrList<Incidence> er = remote->rawIncidences(); 981 QPtrList<Incidence> er = remote->rawIncidences();
982 Incidence* inR = er.first(); 982 Incidence* inR = er.first();
983 Incidence* inL; 983 Incidence* inL;
984 QProgressBar bar( er.count(),0 ); 984 QProgressBar bar( er.count(),0 );
985 bar.setCaption (i18n("Syncing - close to abort!") ); 985 bar.setCaption (i18n("Syncing - close to abort!") );
986 986
987 int w = 300; 987 int w = 300;
988 if ( QApplication::desktop()->width() < 320 ) 988 if ( QApplication::desktop()->width() < 320 )
989 w = 220; 989 w = 220;
990 int h = bar.sizeHint().height() ; 990 int h = bar.sizeHint().height() ;
991 int dw = QApplication::desktop()->width(); 991 int dw = QApplication::desktop()->width();
992 int dh = QApplication::desktop()->height(); 992 int dh = QApplication::desktop()->height();
993 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 993 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
994 bar.show(); 994 bar.show();
995 int modulo = (er.count()/10)+1; 995 int modulo = (er.count()/10)+1;
996 int incCounter = 0; 996 int incCounter = 0;
997 while ( inR ) { 997 while ( inR ) {
998 if ( ! bar.isVisible() ) 998 if ( ! bar.isVisible() )
999 return false; 999 return false;
1000 if ( incCounter % modulo == 0 ) 1000 if ( incCounter % modulo == 0 )
1001 bar.setProgress( incCounter ); 1001 bar.setProgress( incCounter );
1002 ++incCounter; 1002 ++incCounter;
1003 uid = inR->uid(); 1003 uid = inR->uid();
1004 bool skipIncidence = false; 1004 bool skipIncidence = false;
1005 if ( uid.left(15) == QString("last-syncEvent-") ) 1005 if ( uid.left(15) == QString("last-syncEvent-") )
1006 skipIncidence = true; 1006 skipIncidence = true;
1007 1007
1008 qApp->processEvents(); 1008 qApp->processEvents();
1009 if ( !skipIncidence ) { 1009 if ( !skipIncidence ) {
1010 inL = local->incidence( uid ); 1010 inL = local->incidence( uid );
1011 if ( inL ) { // maybe conflict - same uid in both calendars 1011 if ( inL ) { // maybe conflict - same uid in both calendars
1012 int maxrev = inL->revision(); 1012 int maxrev = inL->revision();
1013 if ( maxrev < inR->revision() ) 1013 if ( maxrev < inR->revision() )
1014 maxrev = inR->revision(); 1014 maxrev = inR->revision();
1015 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { 1015 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) {
1016 //qDebug("take %d %s ", take, inL->summary().latin1()); 1016 //qDebug("take %d %s ", take, inL->summary().latin1());
1017 if ( take == 3 ) 1017 if ( take == 3 )
1018 return false; 1018 return false;
1019 if ( take == 1 ) {// take local 1019 if ( take == 1 ) {// take local
1020 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1020 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1021 remote->deleteIncidence( inR ); 1021 remote->deleteIncidence( inR );
1022 if ( inL->revision() < maxrev ) 1022 if ( inL->revision() < maxrev )
1023 inL->setRevision( maxrev ); 1023 inL->setRevision( maxrev );
1024 remote->addIncidence( inL->clone() ); 1024 remote->addIncidence( inL->clone() );
1025 ++changedRemote; 1025 ++changedRemote;
1026 } else { 1026 } else {
1027 if ( inR->revision() < maxrev ) 1027 if ( inR->revision() < maxrev )
1028 inR->setRevision( maxrev ); 1028 inR->setRevision( maxrev );
1029 local->deleteIncidence( inL ); 1029 local->deleteIncidence( inL );
1030 local->addIncidence( inR->clone() ); 1030 local->addIncidence( inR->clone() );
1031 ++changedLocal; 1031 ++changedLocal;
1032 } 1032 }
1033 } 1033 }
1034 } else { // no conflict 1034 } else { // no conflict
1035 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1035 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1036 QString des = eventLSync->description(); 1036 QString des = eventLSync->description();
1037 QString pref = "e"; 1037 QString pref = "e";
1038 if ( inR->type() == "Todo" ) 1038 if ( inR->type() == "Todo" )
1039 pref = "t"; 1039 pref = "t";
1040 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 1040 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
1041 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 1041 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE );
1042 //remote->deleteIncidence( inR ); 1042 //remote->deleteIncidence( inR );
1043 ++deletedEventR; 1043 ++deletedEventR;
1044 } else { 1044 } else {
1045 inR->setLastModified( modifiedCalendar ); 1045 inR->setLastModified( modifiedCalendar );
1046 local->addIncidence( inR->clone() ); 1046 local->addIncidence( inR->clone() );
1047 ++addedEvent; 1047 ++addedEvent;
1048 } 1048 }
1049 } else { 1049 } else {
1050 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { 1050 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) {
1051 inR->setLastModified( modifiedCalendar ); 1051 inR->setLastModified( modifiedCalendar );
1052 local->addIncidence( inR->clone() ); 1052 local->addIncidence( inR->clone() );
1053 ++addedEvent; 1053 ++addedEvent;
1054 } else { 1054 } else {
1055 checkExternSyncEvent(eventRSyncSharp, inR); 1055 checkExternSyncEvent(eventRSyncSharp, inR);
1056 remote->deleteIncidence( inR ); 1056 remote->deleteIncidence( inR );
1057 ++deletedEventR; 1057 ++deletedEventR;
1058 } 1058 }
1059 } 1059 }
1060 } 1060 }
1061 } 1061 }
1062 inR = er.next(); 1062 inR = er.next();
1063 } 1063 }
1064 QPtrList<Incidence> el = local->rawIncidences(); 1064 QPtrList<Incidence> el = local->rawIncidences();
1065 inL = el.first(); 1065 inL = el.first();
1066 modulo = (el.count()/10)+1; 1066 modulo = (el.count()/10)+1;
1067 bar.setCaption (i18n("Add / remove events") ); 1067 bar.setCaption (i18n("Add / remove events") );
1068 bar.setTotalSteps ( el.count() ) ; 1068 bar.setTotalSteps ( el.count() ) ;
1069 bar.show(); 1069 bar.show();
1070 incCounter = 0; 1070 incCounter = 0;
1071 1071
1072 while ( inL ) { 1072 while ( inL ) {
1073 1073
1074 qApp->processEvents(); 1074 qApp->processEvents();
1075 if ( ! bar.isVisible() ) 1075 if ( ! bar.isVisible() )
1076 return false; 1076 return false;
1077 if ( incCounter % modulo == 0 ) 1077 if ( incCounter % modulo == 0 )
1078 bar.setProgress( incCounter ); 1078 bar.setProgress( incCounter );
1079 ++incCounter; 1079 ++incCounter;
1080 uid = inL->uid(); 1080 uid = inL->uid();
1081 bool skipIncidence = false; 1081 bool skipIncidence = false;
1082 if ( uid.left(15) == QString("last-syncEvent-") ) 1082 if ( uid.left(15) == QString("last-syncEvent-") )
1083 skipIncidence = true; 1083 skipIncidence = true;
1084 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) 1084 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" )
1085 skipIncidence = true; 1085 skipIncidence = true;
1086 if ( !skipIncidence ) { 1086 if ( !skipIncidence ) {
1087 inR = remote->incidence( uid ); 1087 inR = remote->incidence( uid );
1088 if ( ! inR ) { 1088 if ( ! inR ) {
1089 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1089 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1090 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 1090 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
1091 local->deleteIncidence( inL ); 1091 local->deleteIncidence( inL );
1092 ++deletedEventL; 1092 ++deletedEventL;
1093 } else { 1093 } else {
1094 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { 1094 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) {
1095 inL->removeID(mCurrentSyncDevice ); 1095 inL->removeID(mCurrentSyncDevice );
1096 ++addedEventR; 1096 ++addedEventR;
1097 inL->setLastModified( modifiedCalendar ); 1097 inL->setLastModified( modifiedCalendar );
1098 remote->addIncidence( inL->clone() ); 1098 remote->addIncidence( inL->clone() );
1099 } 1099 }
1100 } 1100 }
1101 } else { 1101 } else {
1102 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { 1102 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
1103 checkExternSyncEvent(eventLSyncSharp, inL); 1103 checkExternSyncEvent(eventLSyncSharp, inL);
1104 local->deleteIncidence( inL ); 1104 local->deleteIncidence( inL );
1105 ++deletedEventL; 1105 ++deletedEventL;
1106 } else { 1106 } else {
1107 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { 1107 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) {
1108 ++addedEventR; 1108 ++addedEventR;
1109 inL->setLastModified( modifiedCalendar ); 1109 inL->setLastModified( modifiedCalendar );
1110 remote->addIncidence( inL->clone() ); 1110 remote->addIncidence( inL->clone() );
1111 } 1111 }
1112 } 1112 }
1113 } 1113 }
1114 } 1114 }
1115 } 1115 }
1116 inL = el.next(); 1116 inL = el.next();
1117 } 1117 }
1118 1118
1119 bar.hide(); 1119 bar.hide();
1120 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1120 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1121 eventLSync->setReadOnly( false ); 1121 eventLSync->setReadOnly( false );
1122 eventLSync->setDtStart( mLastCalendarSync ); 1122 eventLSync->setDtStart( mLastCalendarSync );
1123 eventRSync->setDtStart( mLastCalendarSync ); 1123 eventRSync->setDtStart( mLastCalendarSync );
1124 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1124 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1125 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1125 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1126 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1126 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1127 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1127 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1128 eventLSync->setReadOnly( true ); 1128 eventLSync->setReadOnly( true );
1129 if ( mGlobalSyncMode == SYNC_MODE_NORMAL) 1129 if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
1130 remote->addEvent( eventRSync ); 1130 remote->addEvent( eventRSync );
1131 QString mes; 1131 QString mes;
1132 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); 1132 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR );
1133 if ( KOPrefs::instance()->mShowSyncSummary ) { 1133 if ( KOPrefs::instance()->mShowSyncSummary ) {
1134 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); 1134 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") );
1135 } 1135 }
1136 qDebug( mes ); 1136 qDebug( mes );
1137 mCalendar->checkAlarmForIncidence( 0, true ); 1137 mCalendar->checkAlarmForIncidence( 0, true );
1138 return syncOK; 1138 return syncOK;
1139} 1139}
1140 1140
1141void CalendarView::setSyncDevice( QString s ) 1141void CalendarView::setSyncDevice( QString s )
1142{ 1142{
1143 mCurrentSyncDevice= s; 1143 mCurrentSyncDevice= s;
1144} 1144}
1145void CalendarView::setSyncName( QString s ) 1145void CalendarView::setSyncName( QString s )
1146{ 1146{
1147 mCurrentSyncName= s; 1147 mCurrentSyncName= s;
1148} 1148}
1149bool CalendarView::syncCalendar(QString filename, int mode) 1149bool CalendarView::syncCalendar(QString filename, int mode)
1150{ 1150{
1151 mGlobalSyncMode = SYNC_MODE_NORMAL; 1151 mGlobalSyncMode = SYNC_MODE_NORMAL;
1152 CalendarLocal* calendar = new CalendarLocal(); 1152 CalendarLocal* calendar = new CalendarLocal();
1153 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1153 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1154 FileStorage* storage = new FileStorage( calendar ); 1154 FileStorage* storage = new FileStorage( calendar );
1155 bool syncOK = false; 1155 bool syncOK = false;
1156 storage->setFileName( filename ); 1156 storage->setFileName( filename );
1157 // qDebug("loading ... "); 1157 // qDebug("loading ... ");
1158 if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { 1158 if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) {
1159 getEventViewerDialog()->setSyncMode( true ); 1159 getEventViewerDialog()->setSyncMode( true );
1160 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 1160 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
1161 getEventViewerDialog()->setSyncMode( false ); 1161 getEventViewerDialog()->setSyncMode( false );
1162 if ( syncOK ) { 1162 if ( syncOK ) {
1163 if ( KOPrefs::instance()->mWriteBackFile ) 1163 if ( KOPrefs::instance()->mWriteBackFile )
1164 { 1164 {
1165 storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); 1165 storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) );
1166 storage->save(); 1166 storage->save();
1167 } 1167 }
1168 } 1168 }
1169 setModified( true ); 1169 setModified( true );
1170 } 1170 }
1171 delete storage; 1171 delete storage;
1172 delete calendar; 1172 delete calendar;
1173 if ( syncOK ) 1173 if ( syncOK )
1174 updateView(); 1174 updateView();
1175 return syncOK; 1175 return syncOK;
1176} 1176}
1177void CalendarView::syncPhone() 1177void CalendarView::syncPhone()
1178{ 1178{
1179 syncExternal( 1 ); 1179 syncExternal( 1 );
1180} 1180}
1181void CalendarView::syncExternal( int mode ) 1181void CalendarView::syncExternal( int mode )
1182{ 1182{
1183 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 1183 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1184 //mCurrentSyncDevice = "sharp-DTM"; 1184 //mCurrentSyncDevice = "sharp-DTM";
1185 if ( KOPrefs::instance()->mAskForPreferences ) 1185 if ( KOPrefs::instance()->mAskForPreferences )
1186 edit_sync_options(); 1186 edit_sync_options();
1187 qApp->processEvents(); 1187 qApp->processEvents();
1188 CalendarLocal* calendar = new CalendarLocal(); 1188 CalendarLocal* calendar = new CalendarLocal();
1189 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1189 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1190 bool syncOK = false; 1190 bool syncOK = false;
1191 boo loadSuccess = false; 1191 bool loadSuccess = false;
1192 PhoneFormat* phoneFormat = 0; 1192 PhoneFormat* phoneFormat = 0;
1193#ifndef DESKTOP_VERSION 1193#ifndef DESKTOP_VERSION
1194 SharpFormat* sharpFormat = 0; 1194 SharpFormat* sharpFormat = 0;
1195 if ( mode == 0 ) { // sharp 1195 if ( mode == 0 ) { // sharp
1196 sharpFormat = new SharpFormat () ; 1196 sharpFormat = new SharpFormat () ;
1197 loadSuccess = sharpFormat->load( calendar, mCalendar ); 1197 loadSuccess = sharpFormat->load( calendar, mCalendar );
1198 1198
1199 } else 1199 } else
1200#endif 1200#endif
1201 if ( mode == 1 ) { // phone 1201 if ( mode == 1 ) { // phone
1202 phoneFormat = new PhoneFormat (); 1202 phoneFormat = new PhoneFormat ();
1203 loadSuccess = phoneFormat->load( calendar, mCalendar ); 1203 loadSuccess = phoneFormat->load( calendar, mCalendar );
1204 1204
1205 } else 1205 } else
1206 return; 1206 return;
1207 if ( loadSuccess ) { 1207 if ( loadSuccess ) {
1208 getEventViewerDialog()->setSyncMode( true ); 1208 getEventViewerDialog()->setSyncMode( true );
1209 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); 1209 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs );
1210 getEventViewerDialog()->setSyncMode( false ); 1210 getEventViewerDialog()->setSyncMode( false );
1211 qApp->processEvents(); 1211 qApp->processEvents();
1212 if ( syncOK ) { 1212 if ( syncOK ) {
1213 if ( KOPrefs::instance()->mWriteBackFile ) 1213 if ( KOPrefs::instance()->mWriteBackFile )
1214 { 1214 {
1215 QPtrList<Incidence> iL = mCalendar->rawIncidences(); 1215 QPtrList<Incidence> iL = mCalendar->rawIncidences();
1216 Incidence* inc = iL.first(); 1216 Incidence* inc = iL.first();
1217 /* obsolete 1217 /* obsolete
1218 while ( inc ) { 1218 while ( inc ) {
1219 inc->setZaurusStat( inc->revision () ); 1219 inc->setZaurusStat( inc->revision () );
1220 inc = iL.next(); 1220 inc = iL.next();
1221 } 1221 }
1222 */ 1222 */
1223#ifndef DESKTOP_VERSION 1223#ifndef DESKTOP_VERSION
1224 if ( sharpFormat ) 1224 if ( sharpFormat )
1225 sharpFormat->save(calendar); 1225 sharpFormat->save(calendar);
1226#endif 1226#endif
1227 if ( phoneFormat ) 1227 if ( phoneFormat )
1228 phoneFormat->save(calendar); 1228 phoneFormat->save(calendar);
1229 iL = calendar->rawIncidences(); 1229 iL = calendar->rawIncidences();
1230 inc = iL.first(); 1230 inc = iL.first();
1231 Incidence* loc; 1231 Incidence* loc;
1232 while ( inc ) { 1232 while ( inc ) {
1233 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { 1233 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
1234 loc = mCalendar->incidence(inc->uid() ); 1234 loc = mCalendar->incidence(inc->uid() );
1235 if ( loc ) { 1235 if ( loc ) {
1236 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); 1236 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
1237 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); 1237 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) );
1238 } 1238 }
1239 } 1239 }
1240 inc = iL.next(); 1240 inc = iL.next();
1241 } 1241 }
1242 Incidence* lse = getLastSyncEvent(); 1242 Incidence* lse = getLastSyncEvent();
1243 if ( lse ) { 1243 if ( lse ) {
1244 lse->setReadOnly( false ); 1244 lse->setReadOnly( false );
1245 lse->setDescription( "" ); 1245 lse->setDescription( "" );
1246 lse->setReadOnly( true ); 1246 lse->setReadOnly( true );
1247 } 1247 }
1248 } 1248 }
1249 } 1249 }
1250 setModified( true ); 1250 setModified( true );
1251 } else { 1251 } else {
1252 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; 1252 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ;
1253 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), 1253 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"),
1254 question, i18n("Ok")) ; 1254 question, i18n("Ok")) ;
1255 1255
1256 } 1256 }
1257 delete calendar; 1257 delete calendar;
1258 updateView(); 1258 updateView();
1259 return ;//syncOK; 1259 return ;//syncOK;
1260 1260
1261} 1261}
1262void CalendarView::syncSharp() 1262void CalendarView::syncSharp()
1263{ 1263{
1264 syncExternal( 0 ); 1264 syncExternal( 0 );
1265 1265
1266} 1266}
1267 1267
1268 1268
1269#include <kabc/stdaddressbook.h> 1269#include <kabc/stdaddressbook.h>
1270bool CalendarView::importBday() 1270bool CalendarView::importBday()
1271{ 1271{
1272 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 1272 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
1273 KABC::AddressBook::Iterator it; 1273 KABC::AddressBook::Iterator it;
1274 int count = 0; 1274 int count = 0;
1275 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1275 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1276 ++count; 1276 ++count;
1277 } 1277 }
1278 QProgressBar bar(count,0 ); 1278 QProgressBar bar(count,0 );
1279 int w = 300; 1279 int w = 300;
1280 if ( QApplication::desktop()->width() < 320 ) 1280 if ( QApplication::desktop()->width() < 320 )
1281 w = 220; 1281 w = 220;
1282 int h = bar.sizeHint().height() ; 1282 int h = bar.sizeHint().height() ;
1283 int dw = QApplication::desktop()->width(); 1283 int dw = QApplication::desktop()->width();
1284 int dh = QApplication::desktop()->height(); 1284 int dh = QApplication::desktop()->height();
1285 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1285 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1286 bar.show(); 1286 bar.show();
1287 bar.setCaption (i18n("Reading addressbook - close to abort!") ); 1287 bar.setCaption (i18n("Reading addressbook - close to abort!") );
1288 qApp->processEvents(); 1288 qApp->processEvents();
1289 count = 0; 1289 count = 0;
1290 int addCount = 0; 1290 int addCount = 0;
1291 KCal::Attendee* a = 0; 1291 KCal::Attendee* a = 0;
1292 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1292 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1293 if ( ! bar.isVisible() ) 1293 if ( ! bar.isVisible() )
1294 return false; 1294 return false;
1295 bar.setProgress( count++ ); 1295 bar.setProgress( count++ );
1296 qApp->processEvents(); 1296 qApp->processEvents();
1297 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); 1297 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() );
1298 if ( (*it).birthday().date().isValid() ){ 1298 if ( (*it).birthday().date().isValid() ){
1299 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1299 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1300 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) 1300 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) )
1301 ++addCount; 1301 ++addCount;
1302 } 1302 }
1303 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); 1303 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d");
1304 if ( anni.isValid() ){ 1304 if ( anni.isValid() ){
1305 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1305 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1306 if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) 1306 if ( addAnniversary( anni, (*it).assembledName(), a, false ) )
1307 ++addCount; 1307 ++addCount;
1308 } 1308 }
1309 } 1309 }
1310 updateView(); 1310 updateView();
1311 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1311 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1312 return true; 1312 return true;
1313} 1313}
1314 1314
1315bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) 1315bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday)
1316{ 1316{
1317 //qDebug("addAnni "); 1317 //qDebug("addAnni ");
1318 Event * ev = new Event(); 1318 Event * ev = new Event();
1319 if ( a ) { 1319 if ( a ) {
1320 ev->addAttendee( a ); 1320 ev->addAttendee( a );
1321 } 1321 }
1322 QString kind; 1322 QString kind;
1323 if ( birthday ) 1323 if ( birthday )
1324 kind = i18n( "Birthday" ); 1324 kind = i18n( "Birthday" );
1325 else 1325 else
1326 kind = i18n( "Anniversary" ); 1326 kind = i18n( "Anniversary" );
1327 ev->setSummary( name + " - " + kind ); 1327 ev->setSummary( name + " - " + kind );
1328 ev->setOrganizer( "nobody@nowhere" ); 1328 ev->setOrganizer( "nobody@nowhere" );
1329 ev->setCategories( kind ); 1329 ev->setCategories( kind );
1330 ev->setDtStart( QDateTime(date) ); 1330 ev->setDtStart( QDateTime(date) );
1331 ev->setDtEnd( QDateTime(date) ); 1331 ev->setDtEnd( QDateTime(date) );
1332 ev->setFloats( true ); 1332 ev->setFloats( true );
1333 Recurrence * rec = ev->recurrence(); 1333 Recurrence * rec = ev->recurrence();
1334 rec->setYearly(Recurrence::rYearlyMonth,1,-1); 1334 rec->setYearly(Recurrence::rYearlyMonth,1,-1);
1335 rec->addYearlyNum( date.month() ); 1335 rec->addYearlyNum( date.month() );
1336 if ( !mCalendar->addAnniversaryNoDup( ev ) ) { 1336 if ( !mCalendar->addAnniversaryNoDup( ev ) ) {
1337 delete ev; 1337 delete ev;
1338 return false; 1338 return false;
1339 } 1339 }
1340 return true; 1340 return true;
1341 1341
1342} 1342}
1343bool CalendarView::importQtopia( const QString &categories, 1343bool CalendarView::importQtopia( const QString &categories,
1344 const QString &datebook, 1344 const QString &datebook,
1345 const QString &todolist ) 1345 const QString &todolist )
1346{ 1346{
1347 1347
1348 QtopiaFormat qtopiaFormat; 1348 QtopiaFormat qtopiaFormat;
1349 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1349 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1350 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); 1350 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories );
1351 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); 1351 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook );
1352 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); 1352 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist );
1353 1353
1354 updateView(); 1354 updateView();
1355 return true; 1355 return true;
1356 1356
1357#if 0 1357#if 0
1358 mGlobalSyncMode = SYNC_MODE_QTOPIA; 1358 mGlobalSyncMode = SYNC_MODE_QTOPIA;
1359 mCurrentSyncDevice = "qtopia-XML"; 1359 mCurrentSyncDevice = "qtopia-XML";
1360 if ( KOPrefs::instance()->mAskForPreferences ) 1360 if ( KOPrefs::instance()->mAskForPreferences )
1361 edit_sync_options(); 1361 edit_sync_options();
1362 qApp->processEvents(); 1362 qApp->processEvents();
1363 CalendarLocal* calendar = new CalendarLocal(); 1363 CalendarLocal* calendar = new CalendarLocal();
1364 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1364 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1365 bool syncOK = false; 1365 bool syncOK = false;
1366 QtopiaFormat qtopiaFormat; 1366 QtopiaFormat qtopiaFormat;
1367 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1367 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1368 bool loadOk = true; 1368 bool loadOk = true;
1369 if ( !categories.isEmpty() ) 1369 if ( !categories.isEmpty() )
1370 loadOk = qtopiaFormat.load( calendar, categories ); 1370 loadOk = qtopiaFormat.load( calendar, categories );
1371 if ( loadOk && !datebook.isEmpty() ) 1371 if ( loadOk && !datebook.isEmpty() )
1372 loadOk = qtopiaFormat.load( calendar, datebook ); 1372 loadOk = qtopiaFormat.load( calendar, datebook );
1373 if ( loadOk && !todolist.isEmpty() ) 1373 if ( loadOk && !todolist.isEmpty() )
1374 loadOk = qtopiaFormat.load( calendar, todolist ); 1374 loadOk = qtopiaFormat.load( calendar, todolist );
1375 1375
1376 if ( loadOk ) { 1376 if ( loadOk ) {
1377 getEventViewerDialog()->setSyncMode( true ); 1377 getEventViewerDialog()->setSyncMode( true );
1378 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); 1378 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs );
1379 getEventViewerDialog()->setSyncMode( false ); 1379 getEventViewerDialog()->setSyncMode( false );
1380 qApp->processEvents(); 1380 qApp->processEvents();
1381 if ( syncOK ) { 1381 if ( syncOK ) {
1382 if ( KOPrefs::instance()->mWriteBackFile ) 1382 if ( KOPrefs::instance()->mWriteBackFile )
1383 { 1383 {
1384 // write back XML file 1384 // write back XML file
1385 1385
1386 } 1386 }
1387 setModified( true ); 1387 setModified( true );
1388 } 1388 }
1389 } else { 1389 } else {
1390 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; 1390 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ;
1391 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), 1391 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"),
1392 question, i18n("Ok")) ; 1392 question, i18n("Ok")) ;
1393 } 1393 }
1394 delete calendar; 1394 delete calendar;
1395 updateView(); 1395 updateView();
1396 return syncOK; 1396 return syncOK;
1397 1397
1398 1398
1399#endif 1399#endif
1400 1400
1401} 1401}
1402 1402
1403void CalendarView::setSyncEventsReadOnly() 1403void CalendarView::setSyncEventsReadOnly()
1404{ 1404{
1405 Event * ev; 1405 Event * ev;
1406 QPtrList<Event> eL = mCalendar->rawEvents(); 1406 QPtrList<Event> eL = mCalendar->rawEvents();
1407 ev = eL.first(); 1407 ev = eL.first();
1408 while ( ev ) { 1408 while ( ev ) {
1409 if ( ev->uid().left(15) == QString("last-syncEvent-") ) 1409 if ( ev->uid().left(15) == QString("last-syncEvent-") )
1410 ev->setReadOnly( true ); 1410 ev->setReadOnly( true );
1411 ev = eL.next(); 1411 ev = eL.next();
1412 } 1412 }
1413} 1413}
1414bool CalendarView::openCalendar(QString filename, bool merge) 1414bool CalendarView::openCalendar(QString filename, bool merge)
1415{ 1415{
1416 1416
1417 if (filename.isEmpty()) { 1417 if (filename.isEmpty()) {
1418 return false; 1418 return false;
1419 } 1419 }
1420 1420
1421 if (!QFile::exists(filename)) { 1421 if (!QFile::exists(filename)) {
1422 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); 1422 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename));
1423 return false; 1423 return false;
1424 } 1424 }
1425 1425
1426 globalFlagBlockAgenda = 1; 1426 globalFlagBlockAgenda = 1;
1427 if (!merge) mCalendar->close(); 1427 if (!merge) mCalendar->close();
1428 1428
1429 mStorage->setFileName( filename ); 1429 mStorage->setFileName( filename );
1430 1430
1431 if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) { 1431 if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) {
1432 if ( merge ) ;//setModified( true ); 1432 if ( merge ) ;//setModified( true );
1433 else { 1433 else {
1434 //setModified( true ); 1434 //setModified( true );
1435 mViewManager->setDocumentId( filename ); 1435 mViewManager->setDocumentId( filename );
1436 mDialogManager->setDocumentId( filename ); 1436 mDialogManager->setDocumentId( filename );
1437 mTodoList->setDocumentId( filename ); 1437 mTodoList->setDocumentId( filename );
1438 } 1438 }
1439 globalFlagBlockAgenda = 2; 1439 globalFlagBlockAgenda = 2;
1440 // if ( getLastSyncEvent() ) 1440 // if ( getLastSyncEvent() )
1441 // getLastSyncEvent()->setReadOnly( true ); 1441 // getLastSyncEvent()->setReadOnly( true );
1442 mCalendar->reInitAlarmSettings(); 1442 mCalendar->reInitAlarmSettings();
1443 setSyncEventsReadOnly(); 1443 setSyncEventsReadOnly();
1444 updateUnmanagedViews(); 1444 updateUnmanagedViews();
1445 updateView(); 1445 updateView();
1446 if ( filename != MainWindow::defaultFileName() ) 1446 if ( filename != MainWindow::defaultFileName() )
1447 saveCalendar( MainWindow::defaultFileName() ); 1447 saveCalendar( MainWindow::defaultFileName() );
1448 loadedFileVersion = QDateTime::currentDateTime(); 1448 loadedFileVersion = QDateTime::currentDateTime();
1449 return true; 1449 return true;
1450 } else { 1450 } else {
1451 // while failing to load, the calendar object could 1451 // while failing to load, the calendar object could
1452 // have become partially populated. Clear it out. 1452 // have become partially populated. Clear it out.
1453 if ( !merge ) mCalendar->close(); 1453 if ( !merge ) mCalendar->close();
1454 1454
1455 KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); 1455 KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename));
1456 1456
1457 globalFlagBlockAgenda = 2; 1457 globalFlagBlockAgenda = 2;
1458 updateView(); 1458 updateView();
1459 } 1459 }
1460 return false; 1460 return false;
1461} 1461}
1462void CalendarView::setLoadedFileVersion(QDateTime dt) 1462void CalendarView::setLoadedFileVersion(QDateTime dt)
1463{ 1463{
1464 loadedFileVersion = dt; 1464 loadedFileVersion = dt;
1465} 1465}
1466bool CalendarView::checkFileChanged(QString fn) 1466bool CalendarView::checkFileChanged(QString fn)
1467{ 1467{
1468 QFileInfo finf ( fn ); 1468 QFileInfo finf ( fn );
1469 if ( !finf.exists() ) 1469 if ( !finf.exists() )
1470 return true; 1470 return true;
1471 QDateTime dt = finf.lastModified (); 1471 QDateTime dt = finf.lastModified ();
1472 if ( dt <= loadedFileVersion ) 1472 if ( dt <= loadedFileVersion )
1473 return false; 1473 return false;
1474 return true; 1474 return true;
1475 1475
1476} 1476}
1477bool CalendarView::checkFileVersion(QString fn) 1477bool CalendarView::checkFileVersion(QString fn)
1478{ 1478{
1479 QFileInfo finf ( fn ); 1479 QFileInfo finf ( fn );
1480 if ( !finf.exists() ) 1480 if ( !finf.exists() )
1481 return true; 1481 return true;
1482 QDateTime dt = finf.lastModified (); 1482 QDateTime dt = finf.lastModified ();
1483 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); 1483 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1());
1484 //qDebug("file on disk version %s",dt.toString().latin1()); 1484 //qDebug("file on disk version %s",dt.toString().latin1());
1485 if ( dt <= loadedFileVersion ) 1485 if ( dt <= loadedFileVersion )
1486 return true; 1486 return true;
1487 int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, false)) , 1487 int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, false)) ,
1488 i18n("KO/Pi Warning"),i18n("Overwrite"), 1488 i18n("KO/Pi Warning"),i18n("Overwrite"),
1489 i18n("Sync+save")); 1489 i18n("Sync+save"));
1490 1490
1491 if ( km == KMessageBox::Cancel ) 1491 if ( km == KMessageBox::Cancel )
1492 return false; 1492 return false;
1493 if ( km == KMessageBox::Yes ) 1493 if ( km == KMessageBox::Yes )
1494 return true; 1494 return true;
1495 1495
1496 setSyncDevice("deleteaftersync" ); 1496 setSyncDevice("deleteaftersync" );
1497 KOPrefs::instance()->mAskForPreferences = true; 1497 KOPrefs::instance()->mAskForPreferences = true;
1498 KOPrefs::instance()->mSyncAlgoPrefs = 3; 1498 KOPrefs::instance()->mSyncAlgoPrefs = 3;
1499 KOPrefs::instance()->mWriteBackFile = false; 1499 KOPrefs::instance()->mWriteBackFile = false;
1500 KOPrefs::instance()->mWriteBackExistingOnly = false; 1500 KOPrefs::instance()->mWriteBackExistingOnly = false;
1501 KOPrefs::instance()->mShowSyncSummary = false; 1501 KOPrefs::instance()->mShowSyncSummary = false;
1502 syncCalendar( fn, 3 ); 1502 syncCalendar( fn, 3 );
1503 Event * e = getLastSyncEvent(); 1503 Event * e = getLastSyncEvent();
1504 mCalendar->deleteEvent ( e ); 1504 mCalendar->deleteEvent ( e );
1505 updateView(); 1505 updateView();
1506 return true; 1506 return true;
1507} 1507}
1508 1508
1509bool CalendarView::saveCalendar( QString filename ) 1509bool CalendarView::saveCalendar( QString filename )
1510{ 1510{
1511 1511
1512 // Store back all unsaved data into calendar object 1512 // Store back all unsaved data into calendar object
1513 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); 1513 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() );
1514 if ( mViewManager->currentView() ) 1514 if ( mViewManager->currentView() )
1515 mViewManager->currentView()->flushView(); 1515 mViewManager->currentView()->flushView();
1516 1516
1517 //mStorage->setFileName( filename ); 1517 //mStorage->setFileName( filename );
1518 1518
1519 mStorage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); 1519 mStorage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) );
1520 mStorage->setFileName( filename ); 1520 mStorage->setFileName( filename );
1521 bool success; 1521 bool success;
1522 success = mStorage->save(); 1522 success = mStorage->save();
1523 if ( !success ) { 1523 if ( !success ) {
1524 return false; 1524 return false;
1525 } 1525 }
1526 1526
1527 return true; 1527 return true;
1528} 1528}
1529 1529
1530void CalendarView::closeCalendar() 1530void CalendarView::closeCalendar()
1531{ 1531{
1532 1532
1533 // child windows no longer valid 1533 // child windows no longer valid
1534 emit closingDown(); 1534 emit closingDown();
1535 1535
1536 mCalendar->close(); 1536 mCalendar->close();
1537 setModified(false); 1537 setModified(false);
1538 updateView(); 1538 updateView();
1539} 1539}
1540 1540
1541void CalendarView::archiveCalendar() 1541void CalendarView::archiveCalendar()
1542{ 1542{
1543 mDialogManager->showArchiveDialog(); 1543 mDialogManager->showArchiveDialog();
1544} 1544}
1545 1545
1546 1546
1547void CalendarView::readSettings() 1547void CalendarView::readSettings()
1548{ 1548{
1549 1549
1550 1550
1551 // mViewManager->showAgendaView(); 1551 // mViewManager->showAgendaView();
1552 QString str; 1552 QString str;
1553 //qDebug("CalendarView::readSettings() "); 1553 //qDebug("CalendarView::readSettings() ");
1554 // read settings from the KConfig, supplying reasonable 1554 // read settings from the KConfig, supplying reasonable
1555 // defaults where none are to be found 1555 // defaults where none are to be found
1556 KConfig *config = KOGlobals::config(); 1556 KConfig *config = KOGlobals::config();
1557#ifndef KORG_NOSPLITTER 1557#ifndef KORG_NOSPLITTER
1558 config->setGroup("KOrganizer Geometry"); 1558 config->setGroup("KOrganizer Geometry");
1559 1559
1560 QValueList<int> sizes = config->readIntListEntry("Separator1"); 1560 QValueList<int> sizes = config->readIntListEntry("Separator1");
1561 if (sizes.count() != 2) { 1561 if (sizes.count() != 2) {
1562 sizes << mDateNavigator->minimumSizeHint().width(); 1562 sizes << mDateNavigator->minimumSizeHint().width();
1563 sizes << 300; 1563 sizes << 300;
1564 } 1564 }
1565 mPanner->setSizes(sizes); 1565 mPanner->setSizes(sizes);
1566 1566
1567 sizes = config->readIntListEntry("Separator2"); 1567 sizes = config->readIntListEntry("Separator2");
1568 if ( ( mResourceView && sizes.count() == 4 ) || 1568 if ( ( mResourceView && sizes.count() == 4 ) ||
1569 ( !mResourceView && sizes.count() == 3 ) ) { 1569 ( !mResourceView && sizes.count() == 3 ) ) {
1570 mLeftSplitter->setSizes(sizes); 1570 mLeftSplitter->setSizes(sizes);
1571 } 1571 }
1572#endif 1572#endif
1573 globalFlagBlockAgenda = 1; 1573 globalFlagBlockAgenda = 1;
1574 mViewManager->showAgendaView(); 1574 mViewManager->showAgendaView();
1575 //mViewManager->readSettings( config ); 1575 //mViewManager->readSettings( config );
1576 mTodoList->restoreLayout(config,QString("Todo Layout")); 1576 mTodoList->restoreLayout(config,QString("Todo Layout"));
1577 readFilterSettings(config); 1577 readFilterSettings(config);
1578 config->setGroup( "Views" ); 1578 config->setGroup( "Views" );
1579 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 1579 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
1580 if ( dateCount == 5 ) mNavigator->selectWorkWeek(); 1580 if ( dateCount == 5 ) mNavigator->selectWorkWeek();
1581 else if ( dateCount == 7 ) mNavigator->selectWeek(); 1581 else if ( dateCount == 7 ) mNavigator->selectWeek();
1582 else mNavigator->selectDates( dateCount ); 1582 else mNavigator->selectDates( dateCount );
1583 // mViewManager->readSettings( config ); 1583 // mViewManager->readSettings( config );
1584 updateConfig(); 1584 updateConfig();
1585 globalFlagBlockAgenda = 2; 1585 globalFlagBlockAgenda = 2;
1586 mViewManager->readSettings( config ); 1586 mViewManager->readSettings( config );
1587#ifdef DESKTOP_VERSION 1587#ifdef DESKTOP_VERSION
1588 config->setGroup("WidgetLayout"); 1588 config->setGroup("WidgetLayout");
1589 QStringList list; 1589 QStringList list;
1590 list = config->readListEntry("MainLayout"); 1590 list = config->readListEntry("MainLayout");
1591 int x,y,w,h; 1591 int x,y,w,h;
1592 if ( ! list.isEmpty() ) { 1592 if ( ! list.isEmpty() ) {
1593 x = list[0].toInt(); 1593 x = list[0].toInt();
1594 y = list[1].toInt(); 1594 y = list[1].toInt();
1595 w = list[2].toInt(); 1595 w = list[2].toInt();
1596 h = list[3].toInt(); 1596 h = list[3].toInt();
1597 topLevelWidget()->setGeometry(x,y,w,h); 1597 topLevelWidget()->setGeometry(x,y,w,h);
1598 1598
1599 } else { 1599 } else {
1600 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 1600 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
1601 } 1601 }
1602 list = config->readListEntry("EditEventLayout"); 1602 list = config->readListEntry("EditEventLayout");
1603 if ( ! list.isEmpty() ) { 1603 if ( ! list.isEmpty() ) {
1604 x = list[0].toInt(); 1604 x = list[0].toInt();
1605 y = list[1].toInt(); 1605 y = list[1].toInt();
1606 w = list[2].toInt(); 1606 w = list[2].toInt();
1607 h = list[3].toInt(); 1607 h = list[3].toInt();
1608 mEventEditor->setGeometry(x,y,w,h); 1608 mEventEditor->setGeometry(x,y,w,h);
1609 1609
1610 } 1610 }
1611 list = config->readListEntry("EditTodoLayout"); 1611 list = config->readListEntry("EditTodoLayout");
1612 if ( ! list.isEmpty() ) { 1612 if ( ! list.isEmpty() ) {
1613 x = list[0].toInt(); 1613 x = list[0].toInt();
1614 y = list[1].toInt(); 1614 y = list[1].toInt();
1615 w = list[2].toInt(); 1615 w = list[2].toInt();
1616 h = list[3].toInt(); 1616 h = list[3].toInt();
1617 mTodoEditor->setGeometry(x,y,w,h); 1617 mTodoEditor->setGeometry(x,y,w,h);
1618 1618
1619 } 1619 }
1620 list = config->readListEntry("ViewerLayout"); 1620 list = config->readListEntry("ViewerLayout");
1621 if ( ! list.isEmpty() ) { 1621 if ( ! list.isEmpty() ) {
1622 x = list[0].toInt(); 1622 x = list[0].toInt();
1623 y = list[1].toInt(); 1623 y = list[1].toInt();
1624 w = list[2].toInt(); 1624 w = list[2].toInt();
1625 h = list[3].toInt(); 1625 h = list[3].toInt();
1626 getEventViewerDialog()->setGeometry(x,y,w,h); 1626 getEventViewerDialog()->setGeometry(x,y,w,h);
1627 } 1627 }
1628#endif 1628#endif
1629 1629
1630} 1630}
1631 1631
1632 1632
1633void CalendarView::writeSettings() 1633void CalendarView::writeSettings()
1634{ 1634{
1635 // kdDebug() << "CalendarView::writeSettings" << endl; 1635 // kdDebug() << "CalendarView::writeSettings" << endl;
1636 1636
1637 KConfig *config = KOGlobals::config(); 1637 KConfig *config = KOGlobals::config();
1638 1638
1639#ifndef KORG_NOSPLITTER 1639#ifndef KORG_NOSPLITTER
1640 config->setGroup("KOrganizer Geometry"); 1640 config->setGroup("KOrganizer Geometry");
1641 1641
1642 QValueList<int> list = mPanner->sizes(); 1642 QValueList<int> list = mPanner->sizes();
1643 config->writeEntry("Separator1",list); 1643 config->writeEntry("Separator1",list);
1644 1644
1645 list = mLeftSplitter->sizes(); 1645 list = mLeftSplitter->sizes();
1646 config->writeEntry("Separator2",list); 1646 config->writeEntry("Separator2",list);
1647#endif 1647#endif
1648 1648
1649 mViewManager->writeSettings( config ); 1649 mViewManager->writeSettings( config );
1650 mTodoList->saveLayout(config,QString("Todo Layout")); 1650 mTodoList->saveLayout(config,QString("Todo Layout"));
1651 mDialogManager->writeSettings( config ); 1651 mDialogManager->writeSettings( config );
1652 //KOPrefs::instance()->usrWriteConfig(); 1652 //KOPrefs::instance()->usrWriteConfig();
1653 KOPrefs::instance()->writeConfig(); 1653 KOPrefs::instance()->writeConfig();
1654 1654
1655 writeFilterSettings(config); 1655 writeFilterSettings(config);
1656 1656
1657 config->setGroup( "Views" ); 1657 config->setGroup( "Views" );
1658 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); 1658 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() );
1659 1659
1660#ifdef DESKTOP_VERSION 1660#ifdef DESKTOP_VERSION
1661 config->setGroup("WidgetLayout"); 1661 config->setGroup("WidgetLayout");
1662 QStringList list ;//= config->readListEntry("MainLayout"); 1662 QStringList list ;//= config->readListEntry("MainLayout");
1663 int x,y,w,h; 1663 int x,y,w,h;
1664 QWidget* wid; 1664 QWidget* wid;
1665 wid = topLevelWidget(); 1665 wid = topLevelWidget();
1666 x = wid->geometry().x(); 1666 x = wid->geometry().x();
1667 y = wid->geometry().y(); 1667 y = wid->geometry().y();
1668 w = wid->width(); 1668 w = wid->width();
1669 h = wid->height(); 1669 h = wid->height();
1670 list.clear(); 1670 list.clear();
1671 list << QString::number( x ); 1671 list << QString::number( x );
1672 list << QString::number( y ); 1672 list << QString::number( y );
1673 list << QString::number( w ); 1673 list << QString::number( w );
1674 list << QString::number( h ); 1674 list << QString::number( h );
1675 config->writeEntry("MainLayout",list ); 1675 config->writeEntry("MainLayout",list );
1676 1676
1677 wid = mEventEditor; 1677 wid = mEventEditor;
1678 x = wid->geometry().x(); 1678 x = wid->geometry().x();
1679 y = wid->geometry().y(); 1679 y = wid->geometry().y();
1680 w = wid->width(); 1680 w = wid->width();
1681 h = wid->height(); 1681 h = wid->height();
1682 list.clear(); 1682 list.clear();
1683 list << QString::number( x ); 1683 list << QString::number( x );
1684 list << QString::number( y ); 1684 list << QString::number( y );
1685 list << QString::number( w ); 1685 list << QString::number( w );
1686 list << QString::number( h ); 1686 list << QString::number( h );
1687 config->writeEntry("EditEventLayout",list ); 1687 config->writeEntry("EditEventLayout",list );
1688 1688
1689 wid = mTodoEditor; 1689 wid = mTodoEditor;
1690 x = wid->geometry().x(); 1690 x = wid->geometry().x();
1691 y = wid->geometry().y(); 1691 y = wid->geometry().y();
1692 w = wid->width(); 1692 w = wid->width();
1693 h = wid->height(); 1693 h = wid->height();
1694 list.clear(); 1694 list.clear();
1695 list << QString::number( x ); 1695 list << QString::number( x );
1696 list << QString::number( y ); 1696 list << QString::number( y );
1697 list << QString::number( w ); 1697 list << QString::number( w );
1698 list << QString::number( h ); 1698 list << QString::number( h );
1699 config->writeEntry("EditTodoLayout",list ); 1699 config->writeEntry("EditTodoLayout",list );
1700 wid = getEventViewerDialog(); 1700 wid = getEventViewerDialog();
1701 x = wid->geometry().x(); 1701 x = wid->geometry().x();
1702 y = wid->geometry().y(); 1702 y = wid->geometry().y();
1703 w = wid->width(); 1703 w = wid->width();
1704 h = wid->height(); 1704 h = wid->height();
1705 list.clear(); 1705 list.clear();
1706 list << QString::number( x ); 1706 list << QString::number( x );
1707 list << QString::number( y ); 1707 list << QString::number( y );
1708 list << QString::number( w ); 1708 list << QString::number( w );
1709 list << QString::number( h ); 1709 list << QString::number( h );
1710 config->writeEntry("ViewerLayout",list ); 1710 config->writeEntry("ViewerLayout",list );
1711 wid = mDialogManager->getSearchDialog(); 1711 wid = mDialogManager->getSearchDialog();
1712 if ( wid ) { 1712 if ( wid ) {
1713 x = wid->geometry().x(); 1713 x = wid->geometry().x();
1714 y = wid->geometry().y(); 1714 y = wid->geometry().y();
1715 w = wid->width(); 1715 w = wid->width();
1716 h = wid->height(); 1716 h = wid->height();
1717 list.clear(); 1717 list.clear();
1718 list << QString::number( x ); 1718 list << QString::number( x );
1719 list << QString::number( y ); 1719 list << QString::number( y );
1720 list << QString::number( w ); 1720 list << QString::number( w );
1721 list << QString::number( h ); 1721 list << QString::number( h );
1722 config->writeEntry("SearchLayout",list ); 1722 config->writeEntry("SearchLayout",list );
1723 } 1723 }
1724#endif 1724#endif
1725 1725
1726 1726
1727 config->sync(); 1727 config->sync();
1728} 1728}
1729 1729
1730void CalendarView::readFilterSettings(KConfig *config) 1730void CalendarView::readFilterSettings(KConfig *config)
1731{ 1731{
1732 // kdDebug() << "CalendarView::readFilterSettings()" << endl; 1732 // kdDebug() << "CalendarView::readFilterSettings()" << endl;
1733 1733
1734 mFilters.clear(); 1734 mFilters.clear();
1735 1735
1736 config->setGroup("General"); 1736 config->setGroup("General");
1737 QStringList filterList = config->readListEntry("CalendarFilters"); 1737 QStringList filterList = config->readListEntry("CalendarFilters");
1738 1738
1739 QStringList::ConstIterator it = filterList.begin(); 1739 QStringList::ConstIterator it = filterList.begin();
1740 QStringList::ConstIterator end = filterList.end(); 1740 QStringList::ConstIterator end = filterList.end();
1741 while(it != end) { 1741 while(it != end) {
1742 // kdDebug() << " filter: " << (*it) << endl; 1742 // kdDebug() << " filter: " << (*it) << endl;
1743 1743
1744 CalFilter *filter; 1744 CalFilter *filter;
1745 filter = new CalFilter(*it); 1745 filter = new CalFilter(*it);
1746 config->setGroup("Filter_" + (*it)); 1746 config->setGroup("Filter_" + (*it));
1747 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); 1747 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) );
1748 filter->setCriteria(config->readNumEntry("Criteria",0)); 1748 filter->setCriteria(config->readNumEntry("Criteria",0));
1749 filter->setCategoryList(config->readListEntry("CategoryList")); 1749 filter->setCategoryList(config->readListEntry("CategoryList"));
1750 mFilters.append(filter); 1750 mFilters.append(filter);
1751 1751
1752 ++it; 1752 ++it;
1753 } 1753 }
1754 1754
1755 if (mFilters.count() == 0) { 1755 if (mFilters.count() == 0) {
1756 CalFilter *filter = new CalFilter(i18n("Default")); 1756 CalFilter *filter = new CalFilter(i18n("Default"));
1757 mFilters.append(filter); 1757 mFilters.append(filter);
1758 } 1758 }
1759 mFilterView->updateFilters(); 1759 mFilterView->updateFilters();
1760 config->setGroup("FilterView"); 1760 config->setGroup("FilterView");
1761 1761
1762 mFilterView->blockSignals(true); 1762 mFilterView->blockSignals(true);
1763 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); 1763 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled"));
1764 mFilterView->setSelectedFilter(config->readEntry("Current Filter")); 1764 mFilterView->setSelectedFilter(config->readEntry("Current Filter"));
1765 mFilterView->blockSignals(false); 1765 mFilterView->blockSignals(false);
1766 // We do it manually to avoid it being done twice by the above calls 1766 // We do it manually to avoid it being done twice by the above calls
1767 updateFilter(); 1767 updateFilter();
1768} 1768}
1769 1769
1770void CalendarView::writeFilterSettings(KConfig *config) 1770void CalendarView::writeFilterSettings(KConfig *config)
1771{ 1771{
1772 // kdDebug() << "CalendarView::writeFilterSettings()" << endl; 1772 // kdDebug() << "CalendarView::writeFilterSettings()" << endl;
1773 1773
1774 QStringList filterList; 1774 QStringList filterList;
1775 1775
1776 CalFilter *filter = mFilters.first(); 1776 CalFilter *filter = mFilters.first();
1777 while(filter) { 1777 while(filter) {
1778 // kdDebug() << " fn: " << filter->name() << endl; 1778 // kdDebug() << " fn: " << filter->name() << endl;
1779 filterList << filter->name(); 1779 filterList << filter->name();
1780 config->setGroup("Filter_" + filter->name()); 1780 config->setGroup("Filter_" + filter->name());
1781 config->writeEntry("Criteria",filter->criteria()); 1781 config->writeEntry("Criteria",filter->criteria());
1782 config->writeEntry("CategoryList",filter->categoryList()); 1782 config->writeEntry("CategoryList",filter->categoryList());
1783 filter = mFilters.next(); 1783 filter = mFilters.next();
1784 } 1784 }
1785 config->setGroup("General"); 1785 config->setGroup("General");
1786 config->writeEntry("CalendarFilters",filterList); 1786 config->writeEntry("CalendarFilters",filterList);
1787 1787
1788 config->setGroup("FilterView"); 1788 config->setGroup("FilterView");
1789 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 1789 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
1790 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 1790 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
1791} 1791}
1792 1792
1793 1793
1794void CalendarView::goToday() 1794void CalendarView::goToday()
1795{ 1795{
1796 mNavigator->selectToday(); 1796 mNavigator->selectToday();
1797} 1797}
1798 1798
1799void CalendarView::goNext() 1799void CalendarView::goNext()
1800{ 1800{
1801 mNavigator->selectNext(); 1801 mNavigator->selectNext();
1802} 1802}
1803 1803
1804void CalendarView::goPrevious() 1804void CalendarView::goPrevious()
1805{ 1805{
1806 mNavigator->selectPrevious(); 1806 mNavigator->selectPrevious();
1807} 1807}
1808void CalendarView::goNextMonth() 1808void CalendarView::goNextMonth()
1809{ 1809{
1810 mNavigator->selectNextMonth(); 1810 mNavigator->selectNextMonth();
1811} 1811}
1812 1812
1813void CalendarView::goPreviousMonth() 1813void CalendarView::goPreviousMonth()
1814{ 1814{
1815 mNavigator->selectPreviousMonth(); 1815 mNavigator->selectPreviousMonth();
1816} 1816}
1817void CalendarView::writeLocale() 1817void CalendarView::writeLocale()
1818{ 1818{
1819 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); 1819 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
1820 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); 1820 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
1821 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); 1821 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
1822 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); 1822 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
1823 QString dummy = KOPrefs::instance()->mUserDateFormatLong; 1823 QString dummy = KOPrefs::instance()->mUserDateFormatLong;
1824 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 1824 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
1825 dummy = KOPrefs::instance()->mUserDateFormatShort; 1825 dummy = KOPrefs::instance()->mUserDateFormatShort;
1826 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 1826 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
1827 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, 1827 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
1828 KOPrefs::instance()->mDaylightsavingStart, 1828 KOPrefs::instance()->mDaylightsavingStart,
1829 KOPrefs::instance()->mDaylightsavingEnd ); 1829 KOPrefs::instance()->mDaylightsavingEnd );
1830 KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId ); 1830 KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId );
1831} 1831}
1832void CalendarView::updateConfig() 1832void CalendarView::updateConfig()
1833{ 1833{
1834 writeLocale(); 1834 writeLocale();
1835 if ( KOPrefs::instance()->mUseAppColors ) 1835 if ( KOPrefs::instance()->mUseAppColors )
1836 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 1836 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
1837 emit configChanged(); 1837 emit configChanged();
1838 mTodoList->updateConfig(); 1838 mTodoList->updateConfig();
1839 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 1839 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
1840 mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1840 mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1841 // To make the "fill window" configurations work 1841 // To make the "fill window" configurations work
1842 //mViewManager->raiseCurrentView(); 1842 //mViewManager->raiseCurrentView();
1843} 1843}
1844 1844
1845 1845
1846void CalendarView::eventChanged(Event *event) 1846void CalendarView::eventChanged(Event *event)
1847{ 1847{
1848 changeEventDisplay(event,KOGlobals::EVENTEDITED); 1848 changeEventDisplay(event,KOGlobals::EVENTEDITED);
1849 //updateUnmanagedViews(); 1849 //updateUnmanagedViews();
1850} 1850}
1851 1851
1852void CalendarView::eventAdded(Event *event) 1852void CalendarView::eventAdded(Event *event)
1853{ 1853{
1854 changeEventDisplay(event,KOGlobals::EVENTADDED); 1854 changeEventDisplay(event,KOGlobals::EVENTADDED);
1855} 1855}
1856 1856
1857void CalendarView::eventToBeDeleted(Event *) 1857void CalendarView::eventToBeDeleted(Event *)
1858{ 1858{
1859 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 1859 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
1860} 1860}
1861 1861
1862void CalendarView::eventDeleted() 1862void CalendarView::eventDeleted()
1863{ 1863{
1864 changeEventDisplay(0,KOGlobals::EVENTDELETED); 1864 changeEventDisplay(0,KOGlobals::EVENTDELETED);
1865} 1865}
1866void CalendarView::changeTodoDisplay(Todo *which, int action) 1866void CalendarView::changeTodoDisplay(Todo *which, int action)
1867{ 1867{
1868 changeIncidenceDisplay((Incidence *)which, action); 1868 changeIncidenceDisplay((Incidence *)which, action);
1869} 1869}
1870 1870
1871void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 1871void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
1872{ 1872{
1873 updateUnmanagedViews(); 1873 updateUnmanagedViews();
1874 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 1874 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
1875 if ( action == KOGlobals::EVENTDELETED ) { //delete 1875 if ( action == KOGlobals::EVENTDELETED ) { //delete
1876 mCalendar->checkAlarmForIncidence( 0, true ); 1876 mCalendar->checkAlarmForIncidence( 0, true );
1877 if ( mEventViewerDialog ) 1877 if ( mEventViewerDialog )
1878 mEventViewerDialog->hide(); 1878 mEventViewerDialog->hide();
1879 } 1879 }
1880 else 1880 else
1881 mCalendar->checkAlarmForIncidence( which , false ); 1881 mCalendar->checkAlarmForIncidence( which , false );
1882} 1882}
1883 1883
1884// most of the changeEventDisplays() right now just call the view's 1884// most of the changeEventDisplays() right now just call the view's
1885// total update mode, but they SHOULD be recoded to be more refresh-efficient. 1885// total update mode, but they SHOULD be recoded to be more refresh-efficient.
1886void CalendarView::changeEventDisplay(Event *which, int action) 1886void CalendarView::changeEventDisplay(Event *which, int action)
1887{ 1887{
1888 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 1888 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
1889 changeIncidenceDisplay((Incidence *)which, action); 1889 changeIncidenceDisplay((Incidence *)which, action);
1890 mDateNavigator->updateView(); 1890 mDateNavigator->updateView();
1891 //mDialogManager->updateSearchDialog(); 1891 //mDialogManager->updateSearchDialog();
1892 1892
1893 if (which) { 1893 if (which) {
1894 // If there is an event view visible update the display 1894 // If there is an event view visible update the display
1895 mViewManager->currentView()->changeEventDisplay(which,action); 1895 mViewManager->currentView()->changeEventDisplay(which,action);
1896 // TODO: check, if update needed 1896 // TODO: check, if update needed
1897 // if (which->getTodoStatus()) { 1897 // if (which->getTodoStatus()) {
1898 mTodoList->updateView(); 1898 mTodoList->updateView();
1899 // } 1899 // }
1900 } else { 1900 } else {
1901 mViewManager->currentView()->updateView(); 1901 mViewManager->currentView()->updateView();
1902 } 1902 }
1903} 1903}
1904 1904
1905 1905
1906void CalendarView::updateTodoViews() 1906void CalendarView::updateTodoViews()
1907{ 1907{
1908 1908
1909 mTodoList->updateView(); 1909 mTodoList->updateView();
1910 mViewManager->currentView()->updateView(); 1910 mViewManager->currentView()->updateView();
1911 1911
1912} 1912}
1913 1913
1914 1914
1915void CalendarView::updateView(const QDate &start, const QDate &end) 1915void CalendarView::updateView(const QDate &start, const QDate &end)
1916{ 1916{
1917 mTodoList->updateView(); 1917 mTodoList->updateView();
1918 mViewManager->updateView(start, end); 1918 mViewManager->updateView(start, end);
1919 //mDateNavigator->updateView(); 1919 //mDateNavigator->updateView();
1920} 1920}
1921 1921
1922void CalendarView::updateView() 1922void CalendarView::updateView()
1923{ 1923{
1924 DateList tmpList = mNavigator->selectedDates(); 1924 DateList tmpList = mNavigator->selectedDates();
1925 1925
1926 // We assume that the navigator only selects consecutive days. 1926 // We assume that the navigator only selects consecutive days.
1927 updateView( tmpList.first(), tmpList.last() ); 1927 updateView( tmpList.first(), tmpList.last() );
1928} 1928}
1929 1929
1930void CalendarView::updateUnmanagedViews() 1930void CalendarView::updateUnmanagedViews()
1931{ 1931{
1932 mDateNavigator->updateDayMatrix(); 1932 mDateNavigator->updateDayMatrix();
1933} 1933}
1934 1934
1935int CalendarView::msgItemDelete() 1935int CalendarView::msgItemDelete()
1936{ 1936{
1937 return KMessageBox::warningContinueCancel(this, 1937 return KMessageBox::warningContinueCancel(this,
1938 i18n("This item will be\npermanently deleted."), 1938 i18n("This item will be\npermanently deleted."),
1939 i18n("KO/Pi Confirmation"),i18n("Delete")); 1939 i18n("KO/Pi Confirmation"),i18n("Delete"));
1940} 1940}
1941 1941
1942 1942
1943void CalendarView::edit_cut() 1943void CalendarView::edit_cut()
1944{ 1944{
1945 Event *anEvent=0; 1945 Event *anEvent=0;
1946 1946
1947 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 1947 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
1948 1948
1949 if (mViewManager->currentView()->isEventView()) { 1949 if (mViewManager->currentView()->isEventView()) {
1950 if ( incidence && incidence->type() == "Event" ) { 1950 if ( incidence && incidence->type() == "Event" ) {
1951 anEvent = static_cast<Event *>(incidence); 1951 anEvent = static_cast<Event *>(incidence);
1952 } 1952 }
1953 } 1953 }
1954 1954
1955 if (!anEvent) { 1955 if (!anEvent) {
1956 KNotifyClient::beep(); 1956 KNotifyClient::beep();
1957 return; 1957 return;
1958 } 1958 }
1959 DndFactory factory( mCalendar ); 1959 DndFactory factory( mCalendar );
diff --git a/korganizer/korganizerE.pro b/korganizer/korganizerE.pro
index 727764a..b39de35 100644
--- a/korganizer/korganizerE.pro
+++ b/korganizer/korganizerE.pro
@@ -1,149 +1,156 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG += qt warn_on 2 CONFIG += qt warn_on
3 TARGET = kopi 3 TARGET = kopi
4OBJECTS_DIR = obj/$(PLATFORM) 4OBJECTS_DIR = obj/$(PLATFORM)
5MOC_DIR = moc/$(PLATFORM) 5MOC_DIR = moc/$(PLATFORM)
6DESTDIR=$(QPEDIR)/bin 6DESTDIR=$(QPEDIR)/bin
7 7
8INCLUDEPATH += ../microkde ../microkde/kdecore ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../qtcompat ../ interfaces ../kabc $(QPEDIR)/include 8INCLUDEPATH += ../microkde ../microkde/kdecore ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../qtcompat ../ interfaces ../kabc $(QPEDIR)/include
9#../libkabcwrap 9#../libkabcwrap
10DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL 10DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL
11DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER 11DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER
12DEFINES += KORG_NOLVALTERNATION 12DEFINES += KORG_NOLVALTERNATION
13#KORG_NOKABC 13#KORG_NOKABC
14LIBS += -lmicrokdepim 14LIBS += -lmicrokdepim
15LIBS += -lmicrokcal 15LIBS += -lmicrokcal
16LIBS += -lmicrokde 16LIBS += -lmicrokde
17LIBS += -lmicroqtcompat 17LIBS += -lmicroqtcompat
18LIBS += -lmicrokabc 18LIBS += -lmicrokabc
19#LIBS += -lmicrokabcwrap 19#LIBS += -lmicrokabcwrap
20
21#LIBS += $(QPEDIR)/lib/gammu
22LIBS += -lmicrogammu
23LIBS += -lbluetooth
24LIBS += -lsdp
25
26
20LIBS += -lqpe 27LIBS += -lqpe
21LIBS += -ljpeg 28LIBS += -ljpeg
22LIBS += $(QTOPIALIB) 29LIBS += $(QTOPIALIB)
23LIBS += -L$(QPEDIR)/lib 30LIBS += -L$(QPEDIR)/lib
24 31
25INTERFACES = kofilterview_base.ui 32INTERFACES = kofilterview_base.ui
26#filteredit_base.ui 33#filteredit_base.ui
27 34
28HEADERS = \ 35HEADERS = \
29 wordsgerman.h \ 36 wordsgerman.h \
30 filteredit_base.h \ 37 filteredit_base.h \
31 alarmclient.h \ 38 alarmclient.h \
32 calendarview.h \ 39 calendarview.h \
33 customlistviewitem.h \ 40 customlistviewitem.h \
34 datenavigator.h \ 41 datenavigator.h \
35 docprefs.h \ 42 docprefs.h \
36 filtereditdialog.h \ 43 filtereditdialog.h \
37 incomingdialog.h \ 44 incomingdialog.h \
38 incomingdialog_base.h \ 45 incomingdialog_base.h \
39 interfaces/korganizer/baseview.h \ 46 interfaces/korganizer/baseview.h \
40 interfaces/korganizer/calendarviewbase.h \ 47 interfaces/korganizer/calendarviewbase.h \
41 journalentry.h \ 48 journalentry.h \
42 kdateedit.h \ 49 kdateedit.h \
43 kdatenavigator.h \ 50 kdatenavigator.h \
44 koagenda.h \ 51 koagenda.h \
45 koagendaitem.h \ 52 koagendaitem.h \
46 koagendaview.h \ 53 koagendaview.h \
47 kocounterdialog.h \ 54 kocounterdialog.h \
48 kodaymatrix.h \ 55 kodaymatrix.h \
49 kodialogmanager.h \ 56 kodialogmanager.h \
50 koeditordetails.h \ 57 koeditordetails.h \
51 koeditorgeneral.h \ 58 koeditorgeneral.h \
52 koeditorgeneralevent.h \ 59 koeditorgeneralevent.h \
53 koeditorgeneraltodo.h \ 60 koeditorgeneraltodo.h \
54 koeditorrecurrence.h \ 61 koeditorrecurrence.h \
55 koeventeditor.h \ 62 koeventeditor.h \
56 koeventpopupmenu.h \ 63 koeventpopupmenu.h \
57 koeventview.h \ 64 koeventview.h \
58 koeventviewer.h \ 65 koeventviewer.h \
59 koeventviewerdialog.h \ 66 koeventviewerdialog.h \
60 kofilterview.h \ 67 kofilterview.h \
61 koglobals.h \ 68 koglobals.h \
62 koincidenceeditor.h \ 69 koincidenceeditor.h \
63 kojournalview.h \ 70 kojournalview.h \
64 kolistview.h \ 71 kolistview.h \
65 kolocationbox.h \ 72 kolocationbox.h \
66 komonthview.h \ 73 komonthview.h \
67 koprefs.h \ 74 koprefs.h \
68 koprefsdialog.h \ 75 koprefsdialog.h \
69 kotimespanview.h \ 76 kotimespanview.h \
70 kotodoeditor.h \ 77 kotodoeditor.h \
71 kotodoview.h \ 78 kotodoview.h \
72 kotodoviewitem.h \ 79 kotodoviewitem.h \
73 koviewmanager.h \ 80 koviewmanager.h \
74 kowhatsnextview.h \ 81 kowhatsnextview.h \
75 ktimeedit.h \ 82 ktimeedit.h \
76 lineview.h \ 83 lineview.h \
77 mainwindow.h \ 84 mainwindow.h \
78 navigatorbar.h \ 85 navigatorbar.h \
79 outgoingdialog.h \ 86 outgoingdialog.h \
80 outgoingdialog_base.h \ 87 outgoingdialog_base.h \
81 publishdialog.h \ 88 publishdialog.h \
82 publishdialog_base.h \ 89 publishdialog_base.h \
83 savetemplatedialog.h \ 90 savetemplatedialog.h \
84 searchdialog.h \ 91 searchdialog.h \
85 simplealarmclient.h \ 92 simplealarmclient.h \
86 statusdialog.h \ 93 statusdialog.h \
87 timeline.h \ 94 timeline.h \
88 timespanview.h \ 95 timespanview.h \
89 version.h \ 96 version.h \
90 ../kalarmd/alarmdialog.h 97 ../kalarmd/alarmdialog.h
91 98
92SOURCES = \ 99SOURCES = \
93 filteredit_base.cpp \ 100 filteredit_base.cpp \
94 calendarview.cpp \ 101 calendarview.cpp \
95 datenavigator.cpp \ 102 datenavigator.cpp \
96 docprefs.cpp \ 103 docprefs.cpp \
97 filtereditdialog.cpp \ 104 filtereditdialog.cpp \
98 incomingdialog.cpp \ 105 incomingdialog.cpp \
99 incomingdialog_base.cpp \ 106 incomingdialog_base.cpp \
100 journalentry.cpp \ 107 journalentry.cpp \
101 kdatenavigator.cpp \ 108 kdatenavigator.cpp \
102 koagenda.cpp \ 109 koagenda.cpp \
103 koagendaitem.cpp \ 110 koagendaitem.cpp \
104 koagendaview.cpp \ 111 koagendaview.cpp \
105 kocounterdialog.cpp \ 112 kocounterdialog.cpp \
106 kodaymatrix.cpp \ 113 kodaymatrix.cpp \
107 kodialogmanager.cpp \ 114 kodialogmanager.cpp \
108 koeditordetails.cpp \ 115 koeditordetails.cpp \
109 koeditorgeneral.cpp \ 116 koeditorgeneral.cpp \
110 koeditorgeneralevent.cpp \ 117 koeditorgeneralevent.cpp \
111 koeditorgeneraltodo.cpp \ 118 koeditorgeneraltodo.cpp \
112 koeditorrecurrence.cpp \ 119 koeditorrecurrence.cpp \
113 koeventeditor.cpp \ 120 koeventeditor.cpp \
114 koeventpopupmenu.cpp \ 121 koeventpopupmenu.cpp \
115 koeventview.cpp \ 122 koeventview.cpp \
116 koeventviewer.cpp \ 123 koeventviewer.cpp \
117 koeventviewerdialog.cpp \ 124 koeventviewerdialog.cpp \
118 kofilterview.cpp \ 125 kofilterview.cpp \
119 koglobals.cpp \ 126 koglobals.cpp \
120 koincidenceeditor.cpp \ 127 koincidenceeditor.cpp \
121 kojournalview.cpp \ 128 kojournalview.cpp \
122 kolistview.cpp \ 129 kolistview.cpp \
123 kolocationbox.cpp \ 130 kolocationbox.cpp \
124 komonthview.cpp \ 131 komonthview.cpp \
125 koprefs.cpp \ 132 koprefs.cpp \
126 koprefsdialog.cpp \ 133 koprefsdialog.cpp \
127 kotimespanview.cpp \ 134 kotimespanview.cpp \
128 kotodoeditor.cpp \ 135 kotodoeditor.cpp \
129 kotodoview.cpp \ 136 kotodoview.cpp \
130 kotodoviewitem.cpp \ 137 kotodoviewitem.cpp \
131 koviewmanager.cpp \ 138 koviewmanager.cpp \
132 kowhatsnextview.cpp \ 139 kowhatsnextview.cpp \
133 ktimeedit.cpp \ 140 ktimeedit.cpp \
134 lineview.cpp \ 141 lineview.cpp \
135 main.cpp \ 142 main.cpp \
136 mainwindow.cpp \ 143 mainwindow.cpp \
137 navigatorbar.cpp \ 144 navigatorbar.cpp \
138 outgoingdialog.cpp \ 145 outgoingdialog.cpp \
139 outgoingdialog_base.cpp \ 146 outgoingdialog_base.cpp \
140 publishdialog.cpp \ 147 publishdialog.cpp \
141 publishdialog_base.cpp \ 148 publishdialog_base.cpp \
142 savetemplatedialog.cpp \ 149 savetemplatedialog.cpp \
143 searchdialog.cpp \ 150 searchdialog.cpp \
144 simplealarmclient.cpp \ 151 simplealarmclient.cpp \
145 statusdialog.cpp \ 152 statusdialog.cpp \
146 timeline.cpp \ 153 timeline.cpp \
147 timespanview.cpp \ 154 timespanview.cpp \
148 ../kalarmd/alarmdialog.cpp 155 ../kalarmd/alarmdialog.cpp
149 156