summaryrefslogtreecommitdiff
authorchristophe <christophe>2004-07-30 09:50:15 (UTC)
committer christophe <christophe>2004-07-30 09:50:15 (UTC)
commitb099a3dd18571fcbd5b1211f18ac111ec39f9ce8 (patch) (unidiff)
tree2b63e0043a5d535690fa3017f0489ba41bc797af
parent52b1ae9281920cf5a40fe543112d8b00e7699ef6 (diff)
downloadopie-b099a3dd18571fcbd5b1211f18ac111ec39f9ce8.zip
opie-b099a3dd18571fcbd5b1211f18ac111ec39f9ce8.tar.gz
opie-b099a3dd18571fcbd5b1211f18ac111ec39f9ce8.tar.bz2
ev is not required.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/core/opimevent.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/libopie2/opiepim/core/opimevent.cpp b/libopie2/opiepim/core/opimevent.cpp
index 739cb6f..c656c3d 100644
--- a/libopie2/opiepim/core/opimevent.cpp
+++ b/libopie2/opiepim/core/opimevent.cpp
@@ -454,388 +454,388 @@ QString OPimEvent::toRichText() const
454} 454}
455 455
456 456
457QString OPimEvent::toShortText() const 457QString OPimEvent::toShortText() const
458{ 458{
459 QString text; 459 QString text;
460 text += QString::number( startDateTime().date().day() ); 460 text += QString::number( startDateTime().date().day() );
461 text += "."; 461 text += ".";
462 text += QString::number( startDateTime().date().month() ); 462 text += QString::number( startDateTime().date().month() );
463 text += "."; 463 text += ".";
464 text += QString::number( startDateTime().date().year() ); 464 text += QString::number( startDateTime().date().year() );
465 text += " "; 465 text += " ";
466 text += QString::number( startDateTime().time().hour() ); 466 text += QString::number( startDateTime().time().hour() );
467 text += ":"; 467 text += ":";
468 text += QString::number( startDateTime().time().minute() ); 468 text += QString::number( startDateTime().time().minute() );
469 text += " - "; 469 text += " - ";
470 text += description(); 470 text += description();
471 return text; 471 return text;
472} 472}
473 473
474 474
475QString OPimEvent::type() const 475QString OPimEvent::type() const
476{ 476{
477 return QString::fromLatin1( "OPimEvent" ); 477 return QString::fromLatin1( "OPimEvent" );
478} 478}
479 479
480 480
481QString OPimEvent::recordField( int /*id */ ) const 481QString OPimEvent::recordField( int /*id */ ) const
482{ 482{
483 return QString::null; 483 return QString::null;
484} 484}
485 485
486 486
487int OPimEvent::rtti() const 487int OPimEvent::rtti() const
488{ 488{
489 return OPimResolver::DateBook; 489 return OPimResolver::DateBook;
490} 490}
491 491
492 492
493bool OPimEvent::loadFromStream( QDataStream& ) 493bool OPimEvent::loadFromStream( QDataStream& )
494{ 494{
495 return true; 495 return true;
496} 496}
497 497
498 498
499bool OPimEvent::saveToStream( QDataStream& ) const 499bool OPimEvent::saveToStream( QDataStream& ) const
500{ 500{
501 return true; 501 return true;
502} 502}
503 503
504 504
505void OPimEvent::changeOrModify() 505void OPimEvent::changeOrModify()
506{ 506{
507 if ( data->count != 1 ) 507 if ( data->count != 1 )
508 { 508 {
509 data->deref(); 509 data->deref();
510 Data* d2 = new Data; 510 Data* d2 = new Data;
511 d2->description = data->description; 511 d2->description = data->description;
512 d2->location = data->location; 512 d2->location = data->location;
513 513
514 if ( data->manager ) 514 if ( data->manager )
515 d2->manager = new OPimNotifyManager( *data->manager ); 515 d2->manager = new OPimNotifyManager( *data->manager );
516 516
517 if ( data->recur ) 517 if ( data->recur )
518 d2->recur = new OPimRecurrence( *data->recur ); 518 d2->recur = new OPimRecurrence( *data->recur );
519 519
520 d2->note = data->note; 520 d2->note = data->note;
521 d2->created = data->created; 521 d2->created = data->created;
522 d2->start = data->start; 522 d2->start = data->start;
523 d2->end = data->end; 523 d2->end = data->end;
524 d2->isAllDay = data->isAllDay; 524 d2->isAllDay = data->isAllDay;
525 d2->timezone = data->timezone; 525 d2->timezone = data->timezone;
526 d2->parent = data->parent; 526 d2->parent = data->parent;
527 527
528 if ( data->child ) 528 if ( data->child )
529 { 529 {
530 d2->child = new QArray<int>( *data->child ); 530 d2->child = new QArray<int>( *data->child );
531 d2->child->detach(); 531 d2->child->detach();
532 } 532 }
533 533
534 data = d2; 534 data = d2;
535 } 535 }
536} 536}
537 537
538 538
539void OPimEvent::deref() 539void OPimEvent::deref()
540{ 540{
541 if ( data->deref() ) 541 if ( data->deref() )
542 { 542 {
543 delete data; 543 delete data;
544 data = 0; 544 data = 0;
545 } 545 }
546} 546}
547// Exporting Event data to map. Using the same 547// Exporting Event data to map. Using the same
548// encoding as ODateBookAccessBackend_xml does.. 548// encoding as ODateBookAccessBackend_xml does..
549// Thus, we could remove the stuff there and use this 549// Thus, we could remove the stuff there and use this
550// for it and for all other places.. 550// for it and for all other places..
551// Encoding should happen at one place, only ! (eilers) 551// Encoding should happen at one place, only ! (eilers)
552QMap<int, QString> OPimEvent::toMap() const 552QMap<int, QString> OPimEvent::toMap() const
553{ 553{
554 QMap<int, QString> retMap; 554 QMap<int, QString> retMap;
555 555
556 retMap.insert( OPimEvent::FUid, QString::number( uid() ) ); 556 retMap.insert( OPimEvent::FUid, QString::number( uid() ) );
557 retMap.insert( OPimEvent::FCategories, Qtopia::escapeString( Qtopia::Record::idsToString( categories() ) ) ); 557 retMap.insert( OPimEvent::FCategories, Qtopia::escapeString( Qtopia::Record::idsToString( categories() ) ) );
558 retMap.insert( OPimEvent::FDescription, Qtopia::escapeString( description() ) ); 558 retMap.insert( OPimEvent::FDescription, Qtopia::escapeString( description() ) );
559 retMap.insert( OPimEvent::FLocation, Qtopia::escapeString( location() ) ); 559 retMap.insert( OPimEvent::FLocation, Qtopia::escapeString( location() ) );
560 retMap.insert( OPimEvent::FType, isAllDay() ? "AllDay" : "" ); 560 retMap.insert( OPimEvent::FType, isAllDay() ? "AllDay" : "" );
561 if ( notifiers().alarms().count() ){ 561 if ( notifiers().alarms().count() ){
562 // Currently we just support one alarm.. (eilers) 562 // Currently we just support one alarm.. (eilers)
563 OPimAlarm alarm = notifiers().alarms() [ 0 ]; 563 OPimAlarm alarm = notifiers().alarms() [ 0 ];
564 retMap.insert( OPimEvent::FAlarm, QString::number( alarm.dateTime().secsTo( startDateTime() ) / 60 ) ); 564 retMap.insert( OPimEvent::FAlarm, QString::number( alarm.dateTime().secsTo( startDateTime() ) / 60 ) );
565 retMap.insert( OPimEvent::FSound, ( alarm.sound() == OPimAlarm::Loud ) ? "loud" : "silent" ); 565 retMap.insert( OPimEvent::FSound, ( alarm.sound() == OPimAlarm::Loud ) ? "loud" : "silent" );
566 } 566 }
567 567
568 /* either use UTC timeZone or current() if there is was a timezone set */ 568 /* either use UTC timeZone or current() if there is was a timezone set */
569 OPimTimeZone zone( (timeZone().isEmpty()||isAllDay()) ? OPimTimeZone::utc() : OPimTimeZone::current() ); 569 OPimTimeZone zone( (timeZone().isEmpty()||isAllDay()) ? OPimTimeZone::utc() : OPimTimeZone::current() );
570 retMap.insert( OPimEvent::FStart, QString::number( zone.fromDateTime( startDateTime()))); 570 retMap.insert( OPimEvent::FStart, QString::number( zone.fromDateTime( startDateTime())));
571 retMap.insert( OPimEvent::FEnd, QString::number( zone.fromDateTime( endDateTime() ))); 571 retMap.insert( OPimEvent::FEnd, QString::number( zone.fromDateTime( endDateTime() )));
572 retMap.insert( OPimEvent::FNote, Qtopia::escapeString( note() ) ); 572 retMap.insert( OPimEvent::FNote, Qtopia::escapeString( note() ) );
573 retMap.insert( OPimEvent::FTimeZone, timeZone().isEmpty() ? QString( "None" ) : timeZone() ); 573 retMap.insert( OPimEvent::FTimeZone, timeZone().isEmpty() ? QString( "None" ) : timeZone() );
574 if ( parent() ) 574 if ( parent() )
575 retMap.insert( OPimEvent::FRecParent, QString::number( parent() ) ); 575 retMap.insert( OPimEvent::FRecParent, QString::number( parent() ) );
576 if ( children().count() ) 576 if ( children().count() )
577 { 577 {
578 QArray<int> childr = children(); 578 QArray<int> childr = children();
579 QString buf; 579 QString buf;
580 for ( uint i = 0; i < childr.count(); i++ ) 580 for ( uint i = 0; i < childr.count(); i++ )
581 { 581 {
582 if ( i != 0 ) buf += " "; 582 if ( i != 0 ) buf += " ";
583 buf += QString::number( childr[ i ] ); 583 buf += QString::number( childr[ i ] );
584 } 584 }
585 retMap.insert( OPimEvent::FRecChildren, buf ); 585 retMap.insert( OPimEvent::FRecChildren, buf );
586 } 586 }
587 587
588 // Add recurrence stuff 588 // Add recurrence stuff
589 if ( hasRecurrence() ) 589 if ( hasRecurrence() )
590 { 590 {
591 OPimRecurrence recur = recurrence(); 591 OPimRecurrence recur = recurrence();
592 QMap<int, QString> recFields = recur.toMap(); 592 QMap<int, QString> recFields = recur.toMap();
593 retMap.insert( OPimEvent::FRType, recFields[ OPimRecurrence::RType ] ); 593 retMap.insert( OPimEvent::FRType, recFields[ OPimRecurrence::RType ] );
594 retMap.insert( OPimEvent::FRWeekdays, recFields[ OPimRecurrence::RWeekdays ] ); 594 retMap.insert( OPimEvent::FRWeekdays, recFields[ OPimRecurrence::RWeekdays ] );
595 retMap.insert( OPimEvent::FRPosition, recFields[ OPimRecurrence::RPosition ] ); 595 retMap.insert( OPimEvent::FRPosition, recFields[ OPimRecurrence::RPosition ] );
596 retMap.insert( OPimEvent::FRFreq, recFields[ OPimRecurrence::RFreq ] ); 596 retMap.insert( OPimEvent::FRFreq, recFields[ OPimRecurrence::RFreq ] );
597 retMap.insert( OPimEvent::FRHasEndDate, recFields[ OPimRecurrence::RHasEndDate ] ); 597 retMap.insert( OPimEvent::FRHasEndDate, recFields[ OPimRecurrence::RHasEndDate ] );
598 retMap.insert( OPimEvent::FREndDate, recFields[ OPimRecurrence::EndDate ] ); 598 retMap.insert( OPimEvent::FREndDate, recFields[ OPimRecurrence::EndDate ] );
599 retMap.insert( OPimEvent::FRCreated, recFields[ OPimRecurrence::Created ] ); 599 retMap.insert( OPimEvent::FRCreated, recFields[ OPimRecurrence::Created ] );
600 retMap.insert( OPimEvent::FRExceptions, recFields[ OPimRecurrence::Exceptions ] ); 600 retMap.insert( OPimEvent::FRExceptions, recFields[ OPimRecurrence::Exceptions ] );
601 } 601 }
602 else 602 else
603 { 603 {
604 OPimRecurrence recur = recurrence(); 604 OPimRecurrence recur = recurrence();
605 QMap<int, QString> recFields = recur.toMap(); 605 QMap<int, QString> recFields = recur.toMap();
606 retMap.insert( OPimEvent::FRType, recFields[ OPimRecurrence::RType ] ); 606 retMap.insert( OPimEvent::FRType, recFields[ OPimRecurrence::RType ] );
607 } 607 }
608 608
609 return retMap; 609 return retMap;
610} 610}
611 611
612 612
613void OPimEvent::fromMap( const QMap<int, QString>& map ) 613void OPimEvent::fromMap( const QMap<int, QString>& map )
614{ 614{
615 615
616 // We just want to set the UID if it is really stored. 616 // We just want to set the UID if it is really stored.
617 if ( !map[ OPimEvent::FUid ].isEmpty() ) 617 if ( !map[ OPimEvent::FUid ].isEmpty() )
618 setUid( map[ OPimEvent::FUid ].toInt() ); 618 setUid( map[ OPimEvent::FUid ].toInt() );
619 619
620 setCategories( idsFromString( map[ OPimEvent::FCategories ] ) ); 620 setCategories( idsFromString( map[ OPimEvent::FCategories ] ) );
621 setDescription( map[ OPimEvent::FDescription ] ); 621 setDescription( map[ OPimEvent::FDescription ] );
622 setLocation( map[ OPimEvent::FLocation ] ); 622 setLocation( map[ OPimEvent::FLocation ] );
623 623
624 if ( map[ OPimEvent::FType ] == "AllDay" ) 624 if ( map[ OPimEvent::FType ] == "AllDay" )
625 setAllDay( true ); 625 setAllDay( true );
626 else 626 else
627 setAllDay( false ); 627 setAllDay( false );
628 628
629 if ( !map[ OPimEvent::FTimeZone ].isEmpty() && ( map[ OPimEvent::FTimeZone ] != "None" ) ) 629 if ( !map[ OPimEvent::FTimeZone ].isEmpty() && ( map[ OPimEvent::FTimeZone ] != "None" ) )
630 { 630 {
631 setTimeZone( map[ OPimEvent::FTimeZone ] ); 631 setTimeZone( map[ OPimEvent::FTimeZone ] );
632 } 632 }
633 633
634 time_t start = ( time_t ) map[ OPimEvent::FStart ].toLong(); 634 time_t start = ( time_t ) map[ OPimEvent::FStart ].toLong();
635 time_t end = ( time_t ) map[ OPimEvent::FEnd ].toLong(); 635 time_t end = ( time_t ) map[ OPimEvent::FEnd ].toLong();
636 636
637 /* AllDay is always in UTC */ 637 /* AllDay is always in UTC */
638 if ( isAllDay() ) 638 if ( isAllDay() )
639 { 639 {
640 OPimTimeZone utc = OPimTimeZone::utc(); 640 OPimTimeZone utc = OPimTimeZone::utc();
641 setStartDateTime(utc.toDateTime( start ) ); 641 setStartDateTime(utc.toDateTime( start ) );
642 setEndDateTime ( utc.toDateTime( end ) ); 642 setEndDateTime ( utc.toDateTime( end ) );
643 } 643 }
644 else { 644 else {
645 /* to current date time */ 645 /* to current date time */
646 OPimTimeZone to_zone( ev.timeZone().isEmpty() ? OPimTimeZone::utc() : OPimTimeZone::current() ); 646 OPimTimeZone to_zone( timeZone().isEmpty() ? OPimTimeZone::utc() : OPimTimeZone::current() );
647 647
648 ev.setStartDateTime(to_zone.toDateTime( start)); 648 setStartDateTime(to_zone.toDateTime( start));
649 ev.setEndDateTime (to_zone.toDateTime( end)); 649 setEndDateTime (to_zone.toDateTime( end));
650 } 650 }
651 651
652 int alarmTime = -1; 652 int alarmTime = -1;
653 if ( !map[ OPimEvent::FAlarm ].isEmpty() ) 653 if ( !map[ OPimEvent::FAlarm ].isEmpty() )
654 alarmTime = map[ OPimEvent::FAlarm ].toInt(); 654 alarmTime = map[ OPimEvent::FAlarm ].toInt();
655 655
656 int sound = ( ( map[ OPimEvent::FSound ] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent ); 656 int sound = ( ( map[ OPimEvent::FSound ] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent );
657 if ( ( alarmTime != -1 ) ) 657 if ( ( alarmTime != -1 ) )
658 { 658 {
659 QDateTime dt = startDateTime().addSecs( -1 * alarmTime * 60 ); 659 QDateTime dt = startDateTime().addSecs( -1 * alarmTime * 60 );
660 OPimAlarm al( sound , dt ); 660 OPimAlarm al( sound , dt );
661 notifiers().add( al ); 661 notifiers().add( al );
662 } 662 }
663 663
664 664
665 if ( !map[ OPimEvent::FNote ].isEmpty() ) 665 if ( !map[ OPimEvent::FNote ].isEmpty() )
666 setNote( map[ OPimEvent::FNote ] ); 666 setNote( map[ OPimEvent::FNote ] );
667 667
668 if ( !map[ OPimEvent::FRecParent ].isEmpty() ) 668 if ( !map[ OPimEvent::FRecParent ].isEmpty() )
669 setParent( map[ OPimEvent::FRecParent ].toInt() ); 669 setParent( map[ OPimEvent::FRecParent ].toInt() );
670 670
671 if ( !map[ OPimEvent::FRecChildren ].isEmpty() ) 671 if ( !map[ OPimEvent::FRecChildren ].isEmpty() )
672 { 672 {
673 QStringList list = QStringList::split( ' ', map[ OPimEvent::FRecChildren ] ); 673 QStringList list = QStringList::split( ' ', map[ OPimEvent::FRecChildren ] );
674 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) 674 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it )
675 { 675 {
676 addChild( ( *it ).toInt() ); 676 addChild( ( *it ).toInt() );
677 } 677 }
678 } 678 }
679 679
680 // Fill recurrence stuff and put it directly into the OPimRecurrence-Object using fromMap.. 680 // Fill recurrence stuff and put it directly into the OPimRecurrence-Object using fromMap..
681 if ( !map[ OPimEvent::FRType ].isEmpty() ) 681 if ( !map[ OPimEvent::FRType ].isEmpty() )
682 { 682 {
683 QMap<int, QString> recFields; 683 QMap<int, QString> recFields;
684 recFields.insert( OPimRecurrence::RType, map[ OPimEvent::FRType ] ); 684 recFields.insert( OPimRecurrence::RType, map[ OPimEvent::FRType ] );
685 recFields.insert( OPimRecurrence::RWeekdays, map[ OPimEvent::FRWeekdays ] ); 685 recFields.insert( OPimRecurrence::RWeekdays, map[ OPimEvent::FRWeekdays ] );
686 recFields.insert( OPimRecurrence::RPosition, map[ OPimEvent::FRPosition ] ); 686 recFields.insert( OPimRecurrence::RPosition, map[ OPimEvent::FRPosition ] );
687 recFields.insert( OPimRecurrence::RFreq, map[ OPimEvent::FRFreq ] ); 687 recFields.insert( OPimRecurrence::RFreq, map[ OPimEvent::FRFreq ] );
688 recFields.insert( OPimRecurrence::RHasEndDate, map[ OPimEvent::FRHasEndDate ] ); 688 recFields.insert( OPimRecurrence::RHasEndDate, map[ OPimEvent::FRHasEndDate ] );
689 recFields.insert( OPimRecurrence::EndDate, map[ OPimEvent::FREndDate ] ); 689 recFields.insert( OPimRecurrence::EndDate, map[ OPimEvent::FREndDate ] );
690 recFields.insert( OPimRecurrence::Created, map[ OPimEvent::FRCreated ] ); 690 recFields.insert( OPimRecurrence::Created, map[ OPimEvent::FRCreated ] );
691 recFields.insert( OPimRecurrence::Exceptions, map[ OPimEvent::FRExceptions ] ); 691 recFields.insert( OPimRecurrence::Exceptions, map[ OPimEvent::FRExceptions ] );
692 OPimRecurrence recur( recFields ); 692 OPimRecurrence recur( recFields );
693 setRecurrence( recur ); 693 setRecurrence( recur );
694 } 694 }
695 695
696} 696}
697 697
698 698
699int OPimEvent::parent() const 699int OPimEvent::parent() const
700{ 700{
701 return data->parent; 701 return data->parent;
702} 702}
703 703
704 704
705void OPimEvent::setParent( int uid ) 705void OPimEvent::setParent( int uid )
706{ 706{
707 changeOrModify(); 707 changeOrModify();
708 data->parent = uid; 708 data->parent = uid;
709} 709}
710 710
711 711
712QArray<int> OPimEvent::children() const 712QArray<int> OPimEvent::children() const
713{ 713{
714 if ( !data->child ) return QArray<int>(); 714 if ( !data->child ) return QArray<int>();
715 else 715 else
716 return data->child->copy(); 716 return data->child->copy();
717} 717}
718 718
719 719
720void OPimEvent::setChildren( const QArray<int>& arr ) 720void OPimEvent::setChildren( const QArray<int>& arr )
721{ 721{
722 changeOrModify(); 722 changeOrModify();
723 if ( data->child ) delete data->child; 723 if ( data->child ) delete data->child;
724 724
725 data->child = new QArray<int>( arr ); 725 data->child = new QArray<int>( arr );
726 data->child->detach(); 726 data->child->detach();
727} 727}
728 728
729 729
730void OPimEvent::addChild( int uid ) 730void OPimEvent::addChild( int uid )
731{ 731{
732 changeOrModify(); 732 changeOrModify();
733 if ( !data->child ) 733 if ( !data->child )
734 { 734 {
735 data->child = new QArray<int>( 1 ); 735 data->child = new QArray<int>( 1 );
736 ( *data->child ) [ 0 ] = uid; 736 ( *data->child ) [ 0 ] = uid;
737 } 737 }
738 else 738 else
739 { 739 {
740 int count = data->child->count(); 740 int count = data->child->count();
741 data->child->resize( count + 1 ); 741 data->child->resize( count + 1 );
742 ( *data->child ) [ count ] = uid; 742 ( *data->child ) [ count ] = uid;
743 } 743 }
744} 744}
745 745
746 746
747void OPimEvent::removeChild( int uid ) 747void OPimEvent::removeChild( int uid )
748{ 748{
749 if ( !data->child || !data->child->contains( uid ) ) return ; 749 if ( !data->child || !data->child->contains( uid ) ) return ;
750 changeOrModify(); 750 changeOrModify();
751 QArray<int> newAr( data->child->count() - 1 ); 751 QArray<int> newAr( data->child->count() - 1 );
752 int j = 0; 752 int j = 0;
753 uint count = data->child->count(); 753 uint count = data->child->count();
754 for ( uint i = 0; i < count; i++ ) 754 for ( uint i = 0; i < count; i++ )
755 { 755 {
756 if ( ( *data->child ) [ i ] != uid ) 756 if ( ( *data->child ) [ i ] != uid )
757 { 757 {
758 newAr[ j ] = ( *data->child ) [ i ]; 758 newAr[ j ] = ( *data->child ) [ i ];
759 j++; 759 j++;
760 } 760 }
761 } 761 }
762 ( *data->child ) = newAr; 762 ( *data->child ) = newAr;
763} 763}
764 764
765 765
766struct OEffectiveEvent::Data : public QShared 766struct OEffectiveEvent::Data : public QShared
767{ 767{
768 Data() : QShared() 768 Data() : QShared()
769 {} 769 {}
770 OPimEvent event; 770 OPimEvent event;
771 QDate date; 771 QDate date;
772 QTime start, end; 772 QTime start, end;
773 QDate startDate, endDate; 773 QDate startDate, endDate;
774bool dates : 1; 774bool dates : 1;
775}; 775};
776 776
777 777
778OEffectiveEvent::OEffectiveEvent() 778OEffectiveEvent::OEffectiveEvent()
779{ 779{
780 data = new Data; 780 data = new Data;
781 data->date = QDate::currentDate(); 781 data->date = QDate::currentDate();
782 data->start = data->end = QTime::currentTime(); 782 data->start = data->end = QTime::currentTime();
783 data->dates = false; 783 data->dates = false;
784} 784}
785 785
786 786
787OEffectiveEvent::OEffectiveEvent( const OPimEvent& ev, const QDate& startDate, 787OEffectiveEvent::OEffectiveEvent( const OPimEvent& ev, const QDate& startDate,
788 Position pos ) 788 Position pos )
789{ 789{
790 data = new Data; 790 data = new Data;
791 data->event = ev; 791 data->event = ev;
792 data->date = startDate; 792 data->date = startDate;
793 if ( pos & Start ) 793 if ( pos & Start )
794 data->start = ev.startDateTime().time(); 794 data->start = ev.startDateTime().time();
795 else 795 else
796 data->start = QTime( 0, 0, 0 ); 796 data->start = QTime( 0, 0, 0 );
797 797
798 if ( pos & End ) 798 if ( pos & End )
799 data->end = ev.endDateTime().time(); 799 data->end = ev.endDateTime().time();
800 else 800 else
801 data->end = QTime( 23, 59, 59 ); 801 data->end = QTime( 23, 59, 59 );
802 802
803 data->dates = false; 803 data->dates = false;
804} 804}
805 805
806 806
807OEffectiveEvent::OEffectiveEvent( const OEffectiveEvent& ev ) 807OEffectiveEvent::OEffectiveEvent( const OEffectiveEvent& ev )
808{ 808{
809 data = ev.data; 809 data = ev.data;
810 data->ref(); 810 data->ref();
811} 811}
812 812
813 813
814OEffectiveEvent::~OEffectiveEvent() 814OEffectiveEvent::~OEffectiveEvent()
815{ 815{
816 if ( data->deref() ) 816 if ( data->deref() )
817 { 817 {
818 delete data; 818 delete data;
819 data = 0; 819 data = 0;
820 } 820 }
821} 821}
822 822
823 823
824OEffectiveEvent& OEffectiveEvent::operator=( const OEffectiveEvent& ev ) 824OEffectiveEvent& OEffectiveEvent::operator=( const OEffectiveEvent& ev )
825{ 825{
826 if ( *this == ev ) return * this; 826 if ( *this == ev ) return * this;
827 827
828 ev.data->ref(); 828 ev.data->ref();
829 deref(); 829 deref();
830 data = ev.data; 830 data = ev.data;
831 831
832 return *this; 832 return *this;
833} 833}
834 834
835 835
836void OEffectiveEvent::setStartTime( const QTime& ti ) 836void OEffectiveEvent::setStartTime( const QTime& ti )
837{ 837{
838 changeOrModify(); 838 changeOrModify();
839 data->start = ti; 839 data->start = ti;
840} 840}
841 841