author | ar <ar> | 2004-06-01 21:38:07 (UTC) |
---|---|---|
committer | ar <ar> | 2004-06-01 21:38:07 (UTC) |
commit | baed1d5ab8589aef14440009bc4e7380bcc5a741 (patch) (unidiff) | |
tree | c636e892c5eec0df2b36d16cb601a7da41a2ef0f /libopie2/opiepim/core/opimevent.cpp | |
parent | 4438393d8eef624565e840b798429071829adea8 (diff) | |
download | opie-baed1d5ab8589aef14440009bc4e7380bcc5a741.zip opie-baed1d5ab8589aef14440009bc4e7380bcc5a741.tar.gz opie-baed1d5ab8589aef14440009bc4e7380bcc5a741.tar.bz2 |
- convert to odebug framework
Diffstat (limited to 'libopie2/opiepim/core/opimevent.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/core/opimevent.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/libopie2/opiepim/core/opimevent.cpp b/libopie2/opiepim/core/opimevent.cpp index 9d46651..8752fce 100644 --- a/libopie2/opiepim/core/opimevent.cpp +++ b/libopie2/opiepim/core/opimevent.cpp | |||
@@ -1,83 +1,85 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) Stefan Eilers <Eilers.Stefan@epost.de> | 3 | Copyright (C) Stefan Eilers <Eilers.Stefan@epost.de> |
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | 4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "opimevent.h" | 30 | #include "opimevent.h" |
31 | 31 | ||
32 | /* OPIE */ | 32 | /* OPIE */ |
33 | #include <opie2/opimrecurrence.h> | 33 | #include <opie2/opimrecurrence.h> |
34 | #include <opie2/opimresolver.h> | 34 | #include <opie2/opimresolver.h> |
35 | #include <opie2/opimnotifymanager.h> | 35 | #include <opie2/opimnotifymanager.h> |
36 | #include <opie2/odebug.h> | ||
37 | |||
36 | #include <qpe/categories.h> | 38 | #include <qpe/categories.h> |
37 | #include <qpe/stringutil.h> | 39 | #include <qpe/stringutil.h> |
38 | 40 | ||
39 | /* QT */ | 41 | /* QT */ |
40 | 42 | ||
41 | namespace Opie | 43 | namespace Opie |
42 | { | 44 | { |
43 | 45 | ||
44 | int OCalendarHelper::week( const QDate& date ) | 46 | int OCalendarHelper::week( const QDate& date ) |
45 | { | 47 | { |
46 | // Calculates the week this date is in within that | 48 | // Calculates the week this date is in within that |
47 | // month. Equals the "row" is is in in the month view | 49 | // month. Equals the "row" is is in in the month view |
48 | int week = 1; | 50 | int week = 1; |
49 | QDate tmp( date.year(), date.month(), 1 ); | 51 | QDate tmp( date.year(), date.month(), 1 ); |
50 | if ( date.dayOfWeek() < tmp.dayOfWeek() ) | 52 | if ( date.dayOfWeek() < tmp.dayOfWeek() ) |
51 | ++week; | 53 | ++week; |
52 | 54 | ||
53 | week += ( date.day() - 1 ) / 7; | 55 | week += ( date.day() - 1 ) / 7; |
54 | 56 | ||
55 | return week; | 57 | return week; |
56 | } | 58 | } |
57 | 59 | ||
58 | 60 | ||
59 | int OCalendarHelper::ocurrence( const QDate& date ) | 61 | int OCalendarHelper::ocurrence( const QDate& date ) |
60 | { | 62 | { |
61 | // calculates the number of occurrances of this day of the | 63 | // calculates the number of occurrances of this day of the |
62 | // week till the given date (e.g 3rd Wednesday of the month) | 64 | // week till the given date (e.g 3rd Wednesday of the month) |
63 | return ( date.day() - 1 ) / 7 + 1; | 65 | return ( date.day() - 1 ) / 7 + 1; |
64 | } | 66 | } |
65 | 67 | ||
66 | 68 | ||
67 | int OCalendarHelper::dayOfWeek( char day ) | 69 | int OCalendarHelper::dayOfWeek( char day ) |
68 | { | 70 | { |
69 | int dayOfWeek = 1; | 71 | int dayOfWeek = 1; |
70 | char i = OPimRecurrence::MON; | 72 | char i = OPimRecurrence::MON; |
71 | while ( !( i & day ) && i <= OPimRecurrence::SUN ) | 73 | while ( !( i & day ) && i <= OPimRecurrence::SUN ) |
72 | { | 74 | { |
73 | i <<= 1; | 75 | i <<= 1; |
74 | ++dayOfWeek; | 76 | ++dayOfWeek; |
75 | } | 77 | } |
76 | return dayOfWeek; | 78 | return dayOfWeek; |
77 | } | 79 | } |
78 | 80 | ||
79 | 81 | ||
80 | int OCalendarHelper::monthDiff( const QDate& first, const QDate& second ) | 82 | int OCalendarHelper::monthDiff( const QDate& first, const QDate& second ) |
81 | { | 83 | { |
82 | return ( second.year() - first.year() ) * 12 + | 84 | return ( second.year() - first.year() ) * 12 + |
83 | second.month() - first.month(); | 85 | second.month() - first.month(); |
@@ -510,207 +512,207 @@ void OPimEvent::changeOrModify() | |||
510 | 512 | ||
511 | if ( data->manager ) | 513 | if ( data->manager ) |
512 | d2->manager = new OPimNotifyManager( *data->manager ); | 514 | d2->manager = new OPimNotifyManager( *data->manager ); |
513 | 515 | ||
514 | if ( data->recur ) | 516 | if ( data->recur ) |
515 | d2->recur = new OPimRecurrence( *data->recur ); | 517 | d2->recur = new OPimRecurrence( *data->recur ); |
516 | 518 | ||
517 | d2->note = data->note; | 519 | d2->note = data->note; |
518 | d2->created = data->created; | 520 | d2->created = data->created; |
519 | d2->start = data->start; | 521 | d2->start = data->start; |
520 | d2->end = data->end; | 522 | d2->end = data->end; |
521 | d2->isAllDay = data->isAllDay; | 523 | d2->isAllDay = data->isAllDay; |
522 | d2->timezone = data->timezone; | 524 | d2->timezone = data->timezone; |
523 | d2->parent = data->parent; | 525 | d2->parent = data->parent; |
524 | 526 | ||
525 | if ( data->child ) | 527 | if ( data->child ) |
526 | { | 528 | { |
527 | d2->child = new QArray<int>( *data->child ); | 529 | d2->child = new QArray<int>( *data->child ); |
528 | d2->child->detach(); | 530 | d2->child->detach(); |
529 | } | 531 | } |
530 | 532 | ||
531 | data = d2; | 533 | data = d2; |
532 | } | 534 | } |
533 | } | 535 | } |
534 | 536 | ||
535 | 537 | ||
536 | void OPimEvent::deref() | 538 | void OPimEvent::deref() |
537 | { | 539 | { |
538 | if ( data->deref() ) | 540 | if ( data->deref() ) |
539 | { | 541 | { |
540 | delete data; | 542 | delete data; |
541 | data = 0; | 543 | data = 0; |
542 | } | 544 | } |
543 | } | 545 | } |
544 | // Exporting Event data to map. Using the same | 546 | // Exporting Event data to map. Using the same |
545 | // encoding as ODateBookAccessBackend_xml does.. | 547 | // encoding as ODateBookAccessBackend_xml does.. |
546 | // Thus, we could remove the stuff there and use this | 548 | // Thus, we could remove the stuff there and use this |
547 | // for it and for all other places.. | 549 | // for it and for all other places.. |
548 | // Encoding should happen at one place, only ! (eilers) | 550 | // Encoding should happen at one place, only ! (eilers) |
549 | QMap<int, QString> OPimEvent::toMap() const | 551 | QMap<int, QString> OPimEvent::toMap() const |
550 | { | 552 | { |
551 | QMap<int, QString> retMap; | 553 | QMap<int, QString> retMap; |
552 | 554 | ||
553 | retMap.insert( OPimEvent::FUid, QString::number( uid() ) ); | 555 | retMap.insert( OPimEvent::FUid, QString::number( uid() ) ); |
554 | retMap.insert( OPimEvent::FCategories, Qtopia::escapeString( Qtopia::Record::idsToString( categories() ) ) ); | 556 | retMap.insert( OPimEvent::FCategories, Qtopia::escapeString( Qtopia::Record::idsToString( categories() ) ) ); |
555 | retMap.insert( OPimEvent::FDescription, Qtopia::escapeString( description() ) ); | 557 | retMap.insert( OPimEvent::FDescription, Qtopia::escapeString( description() ) ); |
556 | retMap.insert( OPimEvent::FLocation, Qtopia::escapeString( location() ) ); | 558 | retMap.insert( OPimEvent::FLocation, Qtopia::escapeString( location() ) ); |
557 | retMap.insert( OPimEvent::FType, isAllDay() ? "AllDay" : "" ); | 559 | retMap.insert( OPimEvent::FType, isAllDay() ? "AllDay" : "" ); |
558 | if ( notifiers().alarms().count() ){ | 560 | if ( notifiers().alarms().count() ){ |
559 | // Currently we just support one alarm.. (eilers) | 561 | // Currently we just support one alarm.. (eilers) |
560 | OPimAlarm alarm = notifiers().alarms() [ 0 ]; | 562 | OPimAlarm alarm = notifiers().alarms() [ 0 ]; |
561 | retMap.insert( OPimEvent::FAlarm, QString::number( alarm.dateTime().secsTo( startDateTime() ) / 60 ) ); | 563 | retMap.insert( OPimEvent::FAlarm, QString::number( alarm.dateTime().secsTo( startDateTime() ) / 60 ) ); |
562 | retMap.insert( OPimEvent::FSound, ( alarm.sound() == OPimAlarm::Loud ) ? "loud" : "silent" ); | 564 | retMap.insert( OPimEvent::FSound, ( alarm.sound() == OPimAlarm::Loud ) ? "loud" : "silent" ); |
563 | } | 565 | } |
564 | 566 | ||
565 | OPimTimeZone zone( timeZone().isEmpty() ? OPimTimeZone::current() : timeZone() ); | 567 | OPimTimeZone zone( timeZone().isEmpty() ? OPimTimeZone::current() : timeZone() ); |
566 | retMap.insert( OPimEvent::FStart, QString::number( zone.fromUTCDateTime( zone.toDateTime( startDateTime(), OPimTimeZone::utc() ) ) ) ); | 568 | retMap.insert( OPimEvent::FStart, QString::number( zone.fromUTCDateTime( zone.toDateTime( startDateTime(), OPimTimeZone::utc() ) ) ) ); |
567 | retMap.insert( OPimEvent::FEnd, QString::number( zone.fromUTCDateTime( zone.toDateTime( endDateTime(), OPimTimeZone::utc() ) ) ) ); | 569 | retMap.insert( OPimEvent::FEnd, QString::number( zone.fromUTCDateTime( zone.toDateTime( endDateTime(), OPimTimeZone::utc() ) ) ) ); |
568 | retMap.insert( OPimEvent::FNote, Qtopia::escapeString( note() ) ); | 570 | retMap.insert( OPimEvent::FNote, Qtopia::escapeString( note() ) ); |
569 | retMap.insert( OPimEvent::FTimeZone, timeZone().isEmpty() ? QString( "None" ) : timeZone() ); | 571 | retMap.insert( OPimEvent::FTimeZone, timeZone().isEmpty() ? QString( "None" ) : timeZone() ); |
570 | if ( parent() ) | 572 | if ( parent() ) |
571 | retMap.insert( OPimEvent::FRecParent, QString::number( parent() ) ); | 573 | retMap.insert( OPimEvent::FRecParent, QString::number( parent() ) ); |
572 | if ( children().count() ) | 574 | if ( children().count() ) |
573 | { | 575 | { |
574 | QArray<int> childr = children(); | 576 | QArray<int> childr = children(); |
575 | QString buf; | 577 | QString buf; |
576 | for ( uint i = 0; i < childr.count(); i++ ) | 578 | for ( uint i = 0; i < childr.count(); i++ ) |
577 | { | 579 | { |
578 | if ( i != 0 ) buf += " "; | 580 | if ( i != 0 ) buf += " "; |
579 | buf += QString::number( childr[ i ] ); | 581 | buf += QString::number( childr[ i ] ); |
580 | } | 582 | } |
581 | retMap.insert( OPimEvent::FRecChildren, buf ); | 583 | retMap.insert( OPimEvent::FRecChildren, buf ); |
582 | } | 584 | } |
583 | 585 | ||
584 | // Add recurrence stuff | 586 | // Add recurrence stuff |
585 | if ( hasRecurrence() ) | 587 | if ( hasRecurrence() ) |
586 | { | 588 | { |
587 | OPimRecurrence recur = recurrence(); | 589 | OPimRecurrence recur = recurrence(); |
588 | QMap<int, QString> recFields = recur.toMap(); | 590 | QMap<int, QString> recFields = recur.toMap(); |
589 | retMap.insert( OPimEvent::FRType, recFields[ OPimRecurrence::RType ] ); | 591 | retMap.insert( OPimEvent::FRType, recFields[ OPimRecurrence::RType ] ); |
590 | retMap.insert( OPimEvent::FRWeekdays, recFields[ OPimRecurrence::RWeekdays ] ); | 592 | retMap.insert( OPimEvent::FRWeekdays, recFields[ OPimRecurrence::RWeekdays ] ); |
591 | retMap.insert( OPimEvent::FRPosition, recFields[ OPimRecurrence::RPosition ] ); | 593 | retMap.insert( OPimEvent::FRPosition, recFields[ OPimRecurrence::RPosition ] ); |
592 | retMap.insert( OPimEvent::FRFreq, recFields[ OPimRecurrence::RFreq ] ); | 594 | retMap.insert( OPimEvent::FRFreq, recFields[ OPimRecurrence::RFreq ] ); |
593 | retMap.insert( OPimEvent::FRHasEndDate, recFields[ OPimRecurrence::RHasEndDate ] ); | 595 | retMap.insert( OPimEvent::FRHasEndDate, recFields[ OPimRecurrence::RHasEndDate ] ); |
594 | retMap.insert( OPimEvent::FREndDate, recFields[ OPimRecurrence::EndDate ] ); | 596 | retMap.insert( OPimEvent::FREndDate, recFields[ OPimRecurrence::EndDate ] ); |
595 | retMap.insert( OPimEvent::FRCreated, recFields[ OPimRecurrence::Created ] ); | 597 | retMap.insert( OPimEvent::FRCreated, recFields[ OPimRecurrence::Created ] ); |
596 | retMap.insert( OPimEvent::FRExceptions, recFields[ OPimRecurrence::Exceptions ] ); | 598 | retMap.insert( OPimEvent::FRExceptions, recFields[ OPimRecurrence::Exceptions ] ); |
597 | } | 599 | } |
598 | else | 600 | else |
599 | { | 601 | { |
600 | OPimRecurrence recur = recurrence(); | 602 | OPimRecurrence recur = recurrence(); |
601 | QMap<int, QString> recFields = recur.toMap(); | 603 | QMap<int, QString> recFields = recur.toMap(); |
602 | retMap.insert( OPimEvent::FRType, recFields[ OPimRecurrence::RType ] ); | 604 | retMap.insert( OPimEvent::FRType, recFields[ OPimRecurrence::RType ] ); |
603 | } | 605 | } |
604 | 606 | ||
605 | return retMap; | 607 | return retMap; |
606 | } | 608 | } |
607 | 609 | ||
608 | 610 | ||
609 | void OPimEvent::fromMap( const QMap<int, QString>& map ) | 611 | void OPimEvent::fromMap( const QMap<int, QString>& map ) |
610 | { | 612 | { |
611 | 613 | ||
612 | // We just want to set the UID if it is really stored. | 614 | // We just want to set the UID if it is really stored. |
613 | if ( !map[ OPimEvent::FUid ].isEmpty() ) | 615 | if ( !map[ OPimEvent::FUid ].isEmpty() ) |
614 | setUid( map[ OPimEvent::FUid ].toInt() ); | 616 | setUid( map[ OPimEvent::FUid ].toInt() ); |
615 | 617 | ||
616 | setCategories( idsFromString( map[ OPimEvent::FCategories ] ) ); | 618 | setCategories( idsFromString( map[ OPimEvent::FCategories ] ) ); |
617 | setDescription( map[ OPimEvent::FDescription ] ); | 619 | setDescription( map[ OPimEvent::FDescription ] ); |
618 | setLocation( map[ OPimEvent::FLocation ] ); | 620 | setLocation( map[ OPimEvent::FLocation ] ); |
619 | 621 | ||
620 | if ( map[ OPimEvent::FType ] == "AllDay" ) | 622 | if ( map[ OPimEvent::FType ] == "AllDay" ) |
621 | setAllDay( true ); | 623 | setAllDay( true ); |
622 | else | 624 | else |
623 | setAllDay( false ); | 625 | setAllDay( false ); |
624 | 626 | ||
625 | if ( !map[ OPimEvent::FTimeZone ].isEmpty() && ( map[ OPimEvent::FTimeZone ] != "None" ) ) | 627 | if ( !map[ OPimEvent::FTimeZone ].isEmpty() && ( map[ OPimEvent::FTimeZone ] != "None" ) ) |
626 | { | 628 | { |
627 | setTimeZone( map[ OPimEvent::FTimeZone ] ); | 629 | setTimeZone( map[ OPimEvent::FTimeZone ] ); |
628 | } | 630 | } |
629 | 631 | ||
630 | time_t start = ( time_t ) map[ OPimEvent::FStart ].toLong(); | 632 | time_t start = ( time_t ) map[ OPimEvent::FStart ].toLong(); |
631 | time_t end = ( time_t ) map[ OPimEvent::FEnd ].toLong(); | 633 | time_t end = ( time_t ) map[ OPimEvent::FEnd ].toLong(); |
632 | 634 | ||
633 | /* AllDay is always in UTC */ | 635 | /* AllDay is always in UTC */ |
634 | if ( isAllDay() ) | 636 | if ( isAllDay() ) |
635 | { | 637 | { |
636 | OPimTimeZone utc = OPimTimeZone::utc(); | 638 | OPimTimeZone utc = OPimTimeZone::utc(); |
637 | setStartDateTime( utc.fromUTCDateTime( start ) ); | 639 | setStartDateTime( utc.fromUTCDateTime( start ) ); |
638 | setEndDateTime ( utc.fromUTCDateTime( end ) ); | 640 | setEndDateTime ( utc.fromUTCDateTime( end ) ); |
639 | setTimeZone( "UTC" ); // make sure it is really utc | 641 | setTimeZone( "UTC" ); // make sure it is really utc |
640 | } | 642 | } |
641 | else | 643 | else |
642 | { | 644 | { |
643 | /* to current date time */ | 645 | /* to current date time */ |
644 | // qWarning(" Start is %d", start ); | 646 | // owarn << " Start is " << start << "" << oendl; |
645 | OPimTimeZone zone( timeZone().isEmpty() ? OPimTimeZone::current() : timeZone() ); | 647 | OPimTimeZone zone( timeZone().isEmpty() ? OPimTimeZone::current() : timeZone() ); |
646 | QDateTime date = zone.toDateTime( start ); | 648 | QDateTime date = zone.toDateTime( start ); |
647 | qWarning( " Start is %s", date.toString().latin1() ); | 649 | owarn << " Start is " << date.toString() << "" << oendl; |
648 | setStartDateTime( zone.toDateTime( date, OPimTimeZone::current() ) ); | 650 | setStartDateTime( zone.toDateTime( date, OPimTimeZone::current() ) ); |
649 | 651 | ||
650 | date = zone.toDateTime( end ); | 652 | date = zone.toDateTime( end ); |
651 | setEndDateTime ( zone.toDateTime( date, OPimTimeZone::current() ) ); | 653 | setEndDateTime ( zone.toDateTime( date, OPimTimeZone::current() ) ); |
652 | } | 654 | } |
653 | 655 | ||
654 | int alarmTime = -1; | 656 | int alarmTime = -1; |
655 | if ( !map[ OPimEvent::FAlarm ].isEmpty() ) | 657 | if ( !map[ OPimEvent::FAlarm ].isEmpty() ) |
656 | alarmTime = map[ OPimEvent::FAlarm ].toInt(); | 658 | alarmTime = map[ OPimEvent::FAlarm ].toInt(); |
657 | 659 | ||
658 | int sound = ( ( map[ OPimEvent::FSound ] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent ); | 660 | int sound = ( ( map[ OPimEvent::FSound ] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent ); |
659 | if ( ( alarmTime != -1 ) ) | 661 | if ( ( alarmTime != -1 ) ) |
660 | { | 662 | { |
661 | QDateTime dt = startDateTime().addSecs( -1 * alarmTime * 60 ); | 663 | QDateTime dt = startDateTime().addSecs( -1 * alarmTime * 60 ); |
662 | OPimAlarm al( sound , dt ); | 664 | OPimAlarm al( sound , dt ); |
663 | notifiers().add( al ); | 665 | notifiers().add( al ); |
664 | } | 666 | } |
665 | 667 | ||
666 | 668 | ||
667 | if ( !map[ OPimEvent::FNote ].isEmpty() ) | 669 | if ( !map[ OPimEvent::FNote ].isEmpty() ) |
668 | setNote( map[ OPimEvent::FNote ] ); | 670 | setNote( map[ OPimEvent::FNote ] ); |
669 | 671 | ||
670 | if ( !map[ OPimEvent::FRecParent ].isEmpty() ) | 672 | if ( !map[ OPimEvent::FRecParent ].isEmpty() ) |
671 | setParent( map[ OPimEvent::FRecParent ].toInt() ); | 673 | setParent( map[ OPimEvent::FRecParent ].toInt() ); |
672 | 674 | ||
673 | if ( !map[ OPimEvent::FRecChildren ].isEmpty() ) | 675 | if ( !map[ OPimEvent::FRecChildren ].isEmpty() ) |
674 | { | 676 | { |
675 | QStringList list = QStringList::split( ' ', map[ OPimEvent::FRecChildren ] ); | 677 | QStringList list = QStringList::split( ' ', map[ OPimEvent::FRecChildren ] ); |
676 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) | 678 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
677 | { | 679 | { |
678 | addChild( ( *it ).toInt() ); | 680 | addChild( ( *it ).toInt() ); |
679 | } | 681 | } |
680 | } | 682 | } |
681 | 683 | ||
682 | // Fill recurrence stuff and put it directly into the OPimRecurrence-Object using fromMap.. | 684 | // Fill recurrence stuff and put it directly into the OPimRecurrence-Object using fromMap.. |
683 | if ( !map[ OPimEvent::FRType ].isEmpty() ) | 685 | if ( !map[ OPimEvent::FRType ].isEmpty() ) |
684 | { | 686 | { |
685 | QMap<int, QString> recFields; | 687 | QMap<int, QString> recFields; |
686 | recFields.insert( OPimRecurrence::RType, map[ OPimEvent::FRType ] ); | 688 | recFields.insert( OPimRecurrence::RType, map[ OPimEvent::FRType ] ); |
687 | recFields.insert( OPimRecurrence::RWeekdays, map[ OPimEvent::FRWeekdays ] ); | 689 | recFields.insert( OPimRecurrence::RWeekdays, map[ OPimEvent::FRWeekdays ] ); |
688 | recFields.insert( OPimRecurrence::RPosition, map[ OPimEvent::FRPosition ] ); | 690 | recFields.insert( OPimRecurrence::RPosition, map[ OPimEvent::FRPosition ] ); |
689 | recFields.insert( OPimRecurrence::RFreq, map[ OPimEvent::FRFreq ] ); | 691 | recFields.insert( OPimRecurrence::RFreq, map[ OPimEvent::FRFreq ] ); |
690 | recFields.insert( OPimRecurrence::RHasEndDate, map[ OPimEvent::FRHasEndDate ] ); | 692 | recFields.insert( OPimRecurrence::RHasEndDate, map[ OPimEvent::FRHasEndDate ] ); |
691 | recFields.insert( OPimRecurrence::EndDate, map[ OPimEvent::FREndDate ] ); | 693 | recFields.insert( OPimRecurrence::EndDate, map[ OPimEvent::FREndDate ] ); |
692 | recFields.insert( OPimRecurrence::Created, map[ OPimEvent::FRCreated ] ); | 694 | recFields.insert( OPimRecurrence::Created, map[ OPimEvent::FRCreated ] ); |
693 | recFields.insert( OPimRecurrence::Exceptions, map[ OPimEvent::FRExceptions ] ); | 695 | recFields.insert( OPimRecurrence::Exceptions, map[ OPimEvent::FRExceptions ] ); |
694 | OPimRecurrence recur( recFields ); | 696 | OPimRecurrence recur( recFields ); |
695 | setRecurrence( recur ); | 697 | setRecurrence( recur ); |
696 | } | 698 | } |
697 | 699 | ||
698 | } | 700 | } |
699 | 701 | ||
700 | 702 | ||
701 | int OPimEvent::parent() const | 703 | int OPimEvent::parent() const |
702 | { | 704 | { |
703 | return data->parent; | 705 | return data->parent; |
704 | } | 706 | } |
705 | 707 | ||
706 | 708 | ||
707 | void OPimEvent::setParent( int uid ) | 709 | void OPimEvent::setParent( int uid ) |
708 | { | 710 | { |
709 | changeOrModify(); | 711 | changeOrModify(); |
710 | data->parent = uid; | 712 | data->parent = uid; |
711 | } | 713 | } |
712 | 714 | ||
713 | 715 | ||
714 | QArray<int> OPimEvent::children() const | 716 | QArray<int> OPimEvent::children() const |
715 | { | 717 | { |
716 | if ( !data->child ) return QArray<int>(); | 718 | if ( !data->child ) return QArray<int>(); |