-rw-r--r-- | libkcal/icalformatimpl.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp index 3e28714..4794bc9 100644 --- a/libkcal/icalformatimpl.cpp +++ b/libkcal/icalformatimpl.cpp | |||
@@ -834,384 +834,387 @@ Todo *ICalFormatImpl::readTodo(icalcomponent *vtodo) | |||
834 | p = icalcomponent_get_next_property(vtodo,ICAL_ANY_PROPERTY); | 834 | p = icalcomponent_get_next_property(vtodo,ICAL_ANY_PROPERTY); |
835 | } | 835 | } |
836 | 836 | ||
837 | return todo; | 837 | return todo; |
838 | } | 838 | } |
839 | 839 | ||
840 | Event *ICalFormatImpl::readEvent(icalcomponent *vevent) | 840 | Event *ICalFormatImpl::readEvent(icalcomponent *vevent) |
841 | { | 841 | { |
842 | Event *event = new Event; | 842 | Event *event = new Event; |
843 | event->setFloats(false); | 843 | event->setFloats(false); |
844 | 844 | ||
845 | readIncidence(vevent,event); | 845 | readIncidence(vevent,event); |
846 | 846 | ||
847 | icalproperty *p = icalcomponent_get_first_property(vevent,ICAL_ANY_PROPERTY); | 847 | icalproperty *p = icalcomponent_get_first_property(vevent,ICAL_ANY_PROPERTY); |
848 | 848 | ||
849 | // int intvalue; | 849 | // int intvalue; |
850 | icaltimetype icaltime; | 850 | icaltimetype icaltime; |
851 | 851 | ||
852 | QStringList categories; | 852 | QStringList categories; |
853 | QString transparency; | 853 | QString transparency; |
854 | 854 | ||
855 | while (p) { | 855 | while (p) { |
856 | icalproperty_kind kind = icalproperty_isa(p); | 856 | icalproperty_kind kind = icalproperty_isa(p); |
857 | switch (kind) { | 857 | switch (kind) { |
858 | 858 | ||
859 | case ICAL_DTEND_PROPERTY: // start date and time | 859 | case ICAL_DTEND_PROPERTY: // start date and time |
860 | icaltime = icalproperty_get_dtend(p); | 860 | icaltime = icalproperty_get_dtend(p); |
861 | if (icaltime.is_date) { | 861 | if (icaltime.is_date) { |
862 | event->setFloats( true ); | 862 | event->setFloats( true ); |
863 | // End date is non-inclusive | 863 | // End date is non-inclusive |
864 | QDate endDate = readICalDate( icaltime ).addDays( -1 ); | 864 | QDate endDate = readICalDate( icaltime ).addDays( -1 ); |
865 | mCompat->fixFloatingEnd( endDate ); | 865 | mCompat->fixFloatingEnd( endDate ); |
866 | if ( endDate < event->dtStart().date() ) { | 866 | if ( endDate < event->dtStart().date() ) { |
867 | endDate = event->dtStart().date(); | 867 | endDate = event->dtStart().date(); |
868 | } | 868 | } |
869 | event->setDtEnd( QDateTime( endDate, QTime( 0, 0, 0 ) ) ); | 869 | event->setDtEnd( QDateTime( endDate, QTime( 0, 0, 0 ) ) ); |
870 | } else { | 870 | } else { |
871 | event->setDtEnd(readICalDateTime(icaltime)); | 871 | event->setDtEnd(readICalDateTime(icaltime)); |
872 | } | 872 | } |
873 | break; | 873 | break; |
874 | 874 | ||
875 | // TODO: | 875 | // TODO: |
876 | // at this point, there should be at least a start or end time. | 876 | // at this point, there should be at least a start or end time. |
877 | // fix up for events that take up no time but have a time associated | 877 | // fix up for events that take up no time but have a time associated |
878 | #if 0 | 878 | #if 0 |
879 | if (!(vo = isAPropertyOf(vevent, VCDTstartProp))) | 879 | if (!(vo = isAPropertyOf(vevent, VCDTstartProp))) |
880 | anEvent->setDtStart(anEvent->dtEnd()); | 880 | anEvent->setDtStart(anEvent->dtEnd()); |
881 | if (!(vo = isAPropertyOf(vevent, VCDTendProp))) | 881 | if (!(vo = isAPropertyOf(vevent, VCDTendProp))) |
882 | anEvent->setDtEnd(anEvent->dtStart()); | 882 | anEvent->setDtEnd(anEvent->dtStart()); |
883 | #endif | 883 | #endif |
884 | 884 | ||
885 | // TODO: exdates | 885 | // TODO: exdates |
886 | #if 0 | 886 | #if 0 |
887 | // recurrence exceptions | 887 | // recurrence exceptions |
888 | if ((vo = isAPropertyOf(vevent, VCExDateProp)) != 0) { | 888 | if ((vo = isAPropertyOf(vevent, VCExDateProp)) != 0) { |
889 | anEvent->setExDates(s = fakeCString(vObjectUStringZValue(vo))); | 889 | anEvent->setExDates(s = fakeCString(vObjectUStringZValue(vo))); |
890 | deleteStr(s); | 890 | deleteStr(s); |
891 | } | 891 | } |
892 | #endif | 892 | #endif |
893 | 893 | ||
894 | #if 0 | 894 | #if 0 |
895 | // secrecy | 895 | // secrecy |
896 | if ((vo = isAPropertyOf(vevent, VCClassProp)) != 0) { | 896 | if ((vo = isAPropertyOf(vevent, VCClassProp)) != 0) { |
897 | anEvent->setSecrecy(s = fakeCString(vObjectUStringZValue(vo))); | 897 | anEvent->setSecrecy(s = fakeCString(vObjectUStringZValue(vo))); |
898 | deleteStr(s); | 898 | deleteStr(s); |
899 | } | 899 | } |
900 | else | 900 | else |
901 | anEvent->setSecrecy("PUBLIC"); | 901 | anEvent->setSecrecy("PUBLIC"); |
902 | 902 | ||
903 | // attachments | 903 | // attachments |
904 | tmpStrList.clear(); | 904 | tmpStrList.clear(); |
905 | initPropIterator(&voi, vevent); | 905 | initPropIterator(&voi, vevent); |
906 | while (moreIteration(&voi)) { | 906 | while (moreIteration(&voi)) { |
907 | vo = nextVObject(&voi); | 907 | vo = nextVObject(&voi); |
908 | if (strcmp(vObjectName(vo), VCAttachProp) == 0) { | 908 | if (strcmp(vObjectName(vo), VCAttachProp) == 0) { |
909 | tmpStrList.append(s = fakeCString(vObjectUStringZValue(vo))); | 909 | tmpStrList.append(s = fakeCString(vObjectUStringZValue(vo))); |
910 | deleteStr(s); | 910 | deleteStr(s); |
911 | } | 911 | } |
912 | } | 912 | } |
913 | anEvent->setAttachments(tmpStrList); | 913 | anEvent->setAttachments(tmpStrList); |
914 | 914 | ||
915 | // resources | 915 | // resources |
916 | if ((vo = isAPropertyOf(vevent, VCResourcesProp)) != 0) { | 916 | if ((vo = isAPropertyOf(vevent, VCResourcesProp)) != 0) { |
917 | QString resources = (s = fakeCString(vObjectUStringZValue(vo))); | 917 | QString resources = (s = fakeCString(vObjectUStringZValue(vo))); |
918 | deleteStr(s); | 918 | deleteStr(s); |
919 | tmpStrList.clear(); | 919 | tmpStrList.clear(); |
920 | index1 = 0; | 920 | index1 = 0; |
921 | index2 = 0; | 921 | index2 = 0; |
922 | QString resource; | 922 | QString resource; |
923 | while ((index2 = resources.find(';', index1)) != -1) { | 923 | while ((index2 = resources.find(';', index1)) != -1) { |
924 | resource = resources.mid(index1, (index2 - index1)); | 924 | resource = resources.mid(index1, (index2 - index1)); |
925 | tmpStrList.append(resource); | 925 | tmpStrList.append(resource); |
926 | index1 = index2; | 926 | index1 = index2; |
927 | } | 927 | } |
928 | anEvent->setResources(tmpStrList); | 928 | anEvent->setResources(tmpStrList); |
929 | } | 929 | } |
930 | #endif | 930 | #endif |
931 | 931 | ||
932 | case ICAL_RELATEDTO_PROPERTY: // releated event (parent) | 932 | case ICAL_RELATEDTO_PROPERTY: // releated event (parent) |
933 | event->setRelatedToUid(QString::fromUtf8(icalproperty_get_relatedto(p))); | 933 | event->setRelatedToUid(QString::fromUtf8(icalproperty_get_relatedto(p))); |
934 | mEventsRelate.append(event); | 934 | mEventsRelate.append(event); |
935 | break; | 935 | break; |
936 | 936 | ||
937 | case ICAL_TRANSP_PROPERTY: // Transparency | 937 | case ICAL_TRANSP_PROPERTY: // Transparency |
938 | if(icalproperty_get_transp(p) == ICAL_TRANSP_TRANSPARENT ) | 938 | if(icalproperty_get_transp(p) == ICAL_TRANSP_TRANSPARENT ) |
939 | event->setTransparency( Event::Transparent ); | 939 | event->setTransparency( Event::Transparent ); |
940 | else | 940 | else |
941 | event->setTransparency( Event::Opaque ); | 941 | event->setTransparency( Event::Opaque ); |
942 | break; | 942 | break; |
943 | 943 | ||
944 | default: | 944 | default: |
945 | // kdDebug(5800) << "ICALFormat::readEvent(): Unknown property: " << kind | 945 | // kdDebug(5800) << "ICALFormat::readEvent(): Unknown property: " << kind |
946 | // << endl; | 946 | // << endl; |
947 | break; | 947 | break; |
948 | } | 948 | } |
949 | 949 | ||
950 | p = icalcomponent_get_next_property(vevent,ICAL_ANY_PROPERTY); | 950 | p = icalcomponent_get_next_property(vevent,ICAL_ANY_PROPERTY); |
951 | } | 951 | } |
952 | 952 | ||
953 | QString msade = event->nonKDECustomProperty("X-MICROSOFT-CDO-ALLDAYEVENT"); | 953 | QString msade = event->nonKDECustomProperty("X-MICROSOFT-CDO-ALLDAYEVENT"); |
954 | if (!msade.isNull()) { | 954 | if (!msade.isNull()) { |
955 | bool floats = (msade == QString::fromLatin1("TRUE")); | 955 | bool floats = (msade == QString::fromLatin1("TRUE")); |
956 | kdDebug(5800) << "ICALFormat::readEvent(): all day event: " << floats << endl; | 956 | kdDebug(5800) << "ICALFormat::readEvent(): all day event: " << floats << endl; |
957 | event->setFloats(floats); | 957 | event->setFloats(floats); |
958 | if (floats) { | 958 | if (floats) { |
959 | QDateTime endDate = event->dtEnd(); | 959 | QDateTime endDate = event->dtEnd(); |
960 | event->setDtEnd(endDate.addDays(-1)); | 960 | event->setDtEnd(endDate.addDays(-1)); |
961 | } | 961 | } |
962 | } | 962 | } |
963 | 963 | ||
964 | // some stupid vCal exporters ignore the standard and use Description | 964 | // some stupid vCal exporters ignore the standard and use Description |
965 | // instead of Summary for the default field. Correct for this. | 965 | // instead of Summary for the default field. Correct for this. |
966 | if (event->summary().isEmpty() && | 966 | if (event->summary().isEmpty() && |
967 | !(event->description().isEmpty())) { | 967 | !(event->description().isEmpty())) { |
968 | QString tmpStr = event->description().simplifyWhiteSpace(); | 968 | QString tmpStr = event->description().simplifyWhiteSpace(); |
969 | event->setDescription(""); | 969 | event->setDescription(""); |
970 | event->setSummary(tmpStr); | 970 | event->setSummary(tmpStr); |
971 | } | 971 | } |
972 | 972 | ||
973 | return event; | 973 | return event; |
974 | } | 974 | } |
975 | 975 | ||
976 | FreeBusy *ICalFormatImpl::readFreeBusy(icalcomponent *vfreebusy) | 976 | FreeBusy *ICalFormatImpl::readFreeBusy(icalcomponent *vfreebusy) |
977 | { | 977 | { |
978 | FreeBusy *freebusy = new FreeBusy; | 978 | FreeBusy *freebusy = new FreeBusy; |
979 | 979 | ||
980 | readIncidenceBase(vfreebusy,freebusy); | 980 | readIncidenceBase(vfreebusy,freebusy); |
981 | 981 | ||
982 | icalproperty *p = icalcomponent_get_first_property(vfreebusy,ICAL_ANY_PROPERTY); | 982 | icalproperty *p = icalcomponent_get_first_property(vfreebusy,ICAL_ANY_PROPERTY); |
983 | 983 | ||
984 | icaltimetype icaltime; | 984 | icaltimetype icaltime; |
985 | icalperiodtype icalperiod; | 985 | icalperiodtype icalperiod; |
986 | QDateTime period_start, period_end; | 986 | QDateTime period_start, period_end; |
987 | 987 | ||
988 | while (p) { | 988 | while (p) { |
989 | icalproperty_kind kind = icalproperty_isa(p); | 989 | icalproperty_kind kind = icalproperty_isa(p); |
990 | switch (kind) { | 990 | switch (kind) { |
991 | 991 | ||
992 | case ICAL_DTSTART_PROPERTY: // start date and time | 992 | case ICAL_DTSTART_PROPERTY: // start date and time |
993 | icaltime = icalproperty_get_dtstart(p); | 993 | icaltime = icalproperty_get_dtstart(p); |
994 | freebusy->setDtStart(readICalDateTime(icaltime)); | 994 | freebusy->setDtStart(readICalDateTime(icaltime)); |
995 | break; | 995 | break; |
996 | 996 | ||
997 | case ICAL_DTEND_PROPERTY: // start End Date and Time | 997 | case ICAL_DTEND_PROPERTY: // start End Date and Time |
998 | icaltime = icalproperty_get_dtend(p); | 998 | icaltime = icalproperty_get_dtend(p); |
999 | freebusy->setDtEnd(readICalDateTime(icaltime)); | 999 | freebusy->setDtEnd(readICalDateTime(icaltime)); |
1000 | break; | 1000 | break; |
1001 | 1001 | ||
1002 | case ICAL_FREEBUSY_PROPERTY: //Any FreeBusy Times | 1002 | case ICAL_FREEBUSY_PROPERTY: //Any FreeBusy Times |
1003 | icalperiod = icalproperty_get_freebusy(p); | 1003 | icalperiod = icalproperty_get_freebusy(p); |
1004 | period_start = readICalDateTime(icalperiod.start); | 1004 | period_start = readICalDateTime(icalperiod.start); |
1005 | period_end = readICalDateTime(icalperiod.end); | 1005 | period_end = readICalDateTime(icalperiod.end); |
1006 | freebusy->addPeriod(period_start, period_end); | 1006 | freebusy->addPeriod(period_start, period_end); |
1007 | break; | 1007 | break; |
1008 | 1008 | ||
1009 | default: | 1009 | default: |
1010 | kdDebug(5800) << "ICALFormat::readIncidence(): Unknown property: " << kind | 1010 | kdDebug(5800) << "ICALFormat::readIncidence(): Unknown property: " << kind |
1011 | << endl; | 1011 | << endl; |
1012 | break; | 1012 | break; |
1013 | } | 1013 | } |
1014 | p = icalcomponent_get_next_property(vfreebusy,ICAL_ANY_PROPERTY); | 1014 | p = icalcomponent_get_next_property(vfreebusy,ICAL_ANY_PROPERTY); |
1015 | } | 1015 | } |
1016 | 1016 | ||
1017 | return freebusy; | 1017 | return freebusy; |
1018 | } | 1018 | } |
1019 | 1019 | ||
1020 | Journal *ICalFormatImpl::readJournal(icalcomponent *vjournal) | 1020 | Journal *ICalFormatImpl::readJournal(icalcomponent *vjournal) |
1021 | { | 1021 | { |
1022 | Journal *journal = new Journal; | 1022 | Journal *journal = new Journal; |
1023 | 1023 | ||
1024 | readIncidence(vjournal,journal); | 1024 | readIncidence(vjournal,journal); |
1025 | 1025 | ||
1026 | if ( !journal->dtStart().isValid() && journal->created().isValid() ) { | ||
1027 | journal->setDtStart( journal->created() ); | ||
1028 | } | ||
1026 | return journal; | 1029 | return journal; |
1027 | } | 1030 | } |
1028 | 1031 | ||
1029 | Attendee *ICalFormatImpl::readAttendee(icalproperty *attendee) | 1032 | Attendee *ICalFormatImpl::readAttendee(icalproperty *attendee) |
1030 | { | 1033 | { |
1031 | icalparameter *p = 0; | 1034 | icalparameter *p = 0; |
1032 | 1035 | ||
1033 | QString email = QString::fromUtf8(icalproperty_get_attendee(attendee)); | 1036 | QString email = QString::fromUtf8(icalproperty_get_attendee(attendee)); |
1034 | 1037 | ||
1035 | QString name; | 1038 | QString name; |
1036 | QString uid = QString::null; | 1039 | QString uid = QString::null; |
1037 | p = icalproperty_get_first_parameter(attendee,ICAL_CN_PARAMETER); | 1040 | p = icalproperty_get_first_parameter(attendee,ICAL_CN_PARAMETER); |
1038 | if (p) { | 1041 | if (p) { |
1039 | name = QString::fromUtf8(icalparameter_get_cn(p)); | 1042 | name = QString::fromUtf8(icalparameter_get_cn(p)); |
1040 | } else { | 1043 | } else { |
1041 | } | 1044 | } |
1042 | 1045 | ||
1043 | bool rsvp=false; | 1046 | bool rsvp=false; |
1044 | p = icalproperty_get_first_parameter(attendee,ICAL_RSVP_PARAMETER); | 1047 | p = icalproperty_get_first_parameter(attendee,ICAL_RSVP_PARAMETER); |
1045 | if (p) { | 1048 | if (p) { |
1046 | icalparameter_rsvp rsvpParameter = icalparameter_get_rsvp(p); | 1049 | icalparameter_rsvp rsvpParameter = icalparameter_get_rsvp(p); |
1047 | if (rsvpParameter == ICAL_RSVP_TRUE) rsvp = true; | 1050 | if (rsvpParameter == ICAL_RSVP_TRUE) rsvp = true; |
1048 | } | 1051 | } |
1049 | 1052 | ||
1050 | Attendee::PartStat status = Attendee::NeedsAction; | 1053 | Attendee::PartStat status = Attendee::NeedsAction; |
1051 | p = icalproperty_get_first_parameter(attendee,ICAL_PARTSTAT_PARAMETER); | 1054 | p = icalproperty_get_first_parameter(attendee,ICAL_PARTSTAT_PARAMETER); |
1052 | if (p) { | 1055 | if (p) { |
1053 | icalparameter_partstat partStatParameter = icalparameter_get_partstat(p); | 1056 | icalparameter_partstat partStatParameter = icalparameter_get_partstat(p); |
1054 | switch(partStatParameter) { | 1057 | switch(partStatParameter) { |
1055 | default: | 1058 | default: |
1056 | case ICAL_PARTSTAT_NEEDSACTION: | 1059 | case ICAL_PARTSTAT_NEEDSACTION: |
1057 | status = Attendee::NeedsAction; | 1060 | status = Attendee::NeedsAction; |
1058 | break; | 1061 | break; |
1059 | case ICAL_PARTSTAT_ACCEPTED: | 1062 | case ICAL_PARTSTAT_ACCEPTED: |
1060 | status = Attendee::Accepted; | 1063 | status = Attendee::Accepted; |
1061 | break; | 1064 | break; |
1062 | case ICAL_PARTSTAT_DECLINED: | 1065 | case ICAL_PARTSTAT_DECLINED: |
1063 | status = Attendee::Declined; | 1066 | status = Attendee::Declined; |
1064 | break; | 1067 | break; |
1065 | case ICAL_PARTSTAT_TENTATIVE: | 1068 | case ICAL_PARTSTAT_TENTATIVE: |
1066 | status = Attendee::Tentative; | 1069 | status = Attendee::Tentative; |
1067 | break; | 1070 | break; |
1068 | case ICAL_PARTSTAT_DELEGATED: | 1071 | case ICAL_PARTSTAT_DELEGATED: |
1069 | status = Attendee::Delegated; | 1072 | status = Attendee::Delegated; |
1070 | break; | 1073 | break; |
1071 | case ICAL_PARTSTAT_COMPLETED: | 1074 | case ICAL_PARTSTAT_COMPLETED: |
1072 | status = Attendee::Completed; | 1075 | status = Attendee::Completed; |
1073 | break; | 1076 | break; |
1074 | case ICAL_PARTSTAT_INPROCESS: | 1077 | case ICAL_PARTSTAT_INPROCESS: |
1075 | status = Attendee::InProcess; | 1078 | status = Attendee::InProcess; |
1076 | break; | 1079 | break; |
1077 | } | 1080 | } |
1078 | } | 1081 | } |
1079 | 1082 | ||
1080 | Attendee::Role role = Attendee::ReqParticipant; | 1083 | Attendee::Role role = Attendee::ReqParticipant; |
1081 | p = icalproperty_get_first_parameter(attendee,ICAL_ROLE_PARAMETER); | 1084 | p = icalproperty_get_first_parameter(attendee,ICAL_ROLE_PARAMETER); |
1082 | if (p) { | 1085 | if (p) { |
1083 | icalparameter_role roleParameter = icalparameter_get_role(p); | 1086 | icalparameter_role roleParameter = icalparameter_get_role(p); |
1084 | switch(roleParameter) { | 1087 | switch(roleParameter) { |
1085 | case ICAL_ROLE_CHAIR: | 1088 | case ICAL_ROLE_CHAIR: |
1086 | role = Attendee::Chair; | 1089 | role = Attendee::Chair; |
1087 | break; | 1090 | break; |
1088 | default: | 1091 | default: |
1089 | case ICAL_ROLE_REQPARTICIPANT: | 1092 | case ICAL_ROLE_REQPARTICIPANT: |
1090 | role = Attendee::ReqParticipant; | 1093 | role = Attendee::ReqParticipant; |
1091 | break; | 1094 | break; |
1092 | case ICAL_ROLE_OPTPARTICIPANT: | 1095 | case ICAL_ROLE_OPTPARTICIPANT: |
1093 | role = Attendee::OptParticipant; | 1096 | role = Attendee::OptParticipant; |
1094 | break; | 1097 | break; |
1095 | case ICAL_ROLE_NONPARTICIPANT: | 1098 | case ICAL_ROLE_NONPARTICIPANT: |
1096 | role = Attendee::NonParticipant; | 1099 | role = Attendee::NonParticipant; |
1097 | break; | 1100 | break; |
1098 | } | 1101 | } |
1099 | } | 1102 | } |
1100 | 1103 | ||
1101 | p = icalproperty_get_first_parameter(attendee,ICAL_X_PARAMETER); | 1104 | p = icalproperty_get_first_parameter(attendee,ICAL_X_PARAMETER); |
1102 | uid = icalparameter_get_xvalue(p); | 1105 | uid = icalparameter_get_xvalue(p); |
1103 | // This should be added, but there seems to be a libical bug here. | 1106 | // This should be added, but there seems to be a libical bug here. |
1104 | /*while (p) { | 1107 | /*while (p) { |
1105 | // if (icalparameter_get_xname(p) == "X-UID") { | 1108 | // if (icalparameter_get_xname(p) == "X-UID") { |
1106 | uid = icalparameter_get_xvalue(p); | 1109 | uid = icalparameter_get_xvalue(p); |
1107 | p = icalproperty_get_next_parameter(attendee,ICAL_X_PARAMETER); | 1110 | p = icalproperty_get_next_parameter(attendee,ICAL_X_PARAMETER); |
1108 | } */ | 1111 | } */ |
1109 | 1112 | ||
1110 | return new Attendee( name, email, rsvp, status, role, uid ); | 1113 | return new Attendee( name, email, rsvp, status, role, uid ); |
1111 | } | 1114 | } |
1112 | 1115 | ||
1113 | Attachment *ICalFormatImpl::readAttachment(icalproperty *attach) | 1116 | Attachment *ICalFormatImpl::readAttachment(icalproperty *attach) |
1114 | { | 1117 | { |
1115 | icalattach *a = icalproperty_get_attach(attach); | 1118 | icalattach *a = icalproperty_get_attach(attach); |
1116 | icalparameter_value v = ICAL_VALUE_NONE; | 1119 | icalparameter_value v = ICAL_VALUE_NONE; |
1117 | icalparameter_encoding e = ICAL_ENCODING_NONE; | 1120 | icalparameter_encoding e = ICAL_ENCODING_NONE; |
1118 | 1121 | ||
1119 | Attachment *attachment = 0; | 1122 | Attachment *attachment = 0; |
1120 | /* | 1123 | /* |
1121 | icalparameter *vp = icalproperty_get_first_parameter(attach, ICAL_VALUE_PARAMETER); | 1124 | icalparameter *vp = icalproperty_get_first_parameter(attach, ICAL_VALUE_PARAMETER); |
1122 | if (vp) | 1125 | if (vp) |
1123 | v = icalparameter_get_value(vp); | 1126 | v = icalparameter_get_value(vp); |
1124 | 1127 | ||
1125 | icalparameter *ep = icalproperty_get_first_parameter(attach, ICAL_ENCODING_PARAMETER); | 1128 | icalparameter *ep = icalproperty_get_first_parameter(attach, ICAL_ENCODING_PARAMETER); |
1126 | if (ep) | 1129 | if (ep) |
1127 | e = icalparameter_get_encoding(ep); | 1130 | e = icalparameter_get_encoding(ep); |
1128 | */ | 1131 | */ |
1129 | int isurl = icalattach_get_is_url (a); | 1132 | int isurl = icalattach_get_is_url (a); |
1130 | if (isurl == 0) | 1133 | if (isurl == 0) |
1131 | attachment = new Attachment((const char*)icalattach_get_data(a)); | 1134 | attachment = new Attachment((const char*)icalattach_get_data(a)); |
1132 | else { | 1135 | else { |
1133 | attachment = new Attachment(QString(icalattach_get_url(a))); | 1136 | attachment = new Attachment(QString(icalattach_get_url(a))); |
1134 | } | 1137 | } |
1135 | 1138 | ||
1136 | icalparameter *p = icalproperty_get_first_parameter(attach, ICAL_FMTTYPE_PARAMETER); | 1139 | icalparameter *p = icalproperty_get_first_parameter(attach, ICAL_FMTTYPE_PARAMETER); |
1137 | if (p) | 1140 | if (p) |
1138 | attachment->setMimeType(QString(icalparameter_get_fmttype(p))); | 1141 | attachment->setMimeType(QString(icalparameter_get_fmttype(p))); |
1139 | 1142 | ||
1140 | return attachment; | 1143 | return attachment; |
1141 | } | 1144 | } |
1142 | #include <qtextcodec.h> | 1145 | #include <qtextcodec.h> |
1143 | void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence) | 1146 | void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence) |
1144 | { | 1147 | { |
1145 | readIncidenceBase(parent,incidence); | 1148 | readIncidenceBase(parent,incidence); |
1146 | 1149 | ||
1147 | icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY); | 1150 | icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY); |
1148 | bool readrec = false; | 1151 | bool readrec = false; |
1149 | const char *text; | 1152 | const char *text; |
1150 | int intvalue; | 1153 | int intvalue; |
1151 | icaltimetype icaltime; | 1154 | icaltimetype icaltime; |
1152 | icaldurationtype icalduration; | 1155 | icaldurationtype icalduration; |
1153 | struct icalrecurrencetype rectype; | 1156 | struct icalrecurrencetype rectype; |
1154 | QStringList categories; | 1157 | QStringList categories; |
1155 | 1158 | ||
1156 | while (p) { | 1159 | while (p) { |
1157 | icalproperty_kind kind = icalproperty_isa(p); | 1160 | icalproperty_kind kind = icalproperty_isa(p); |
1158 | switch (kind) { | 1161 | switch (kind) { |
1159 | 1162 | ||
1160 | case ICAL_CREATED_PROPERTY: | 1163 | case ICAL_CREATED_PROPERTY: |
1161 | icaltime = icalproperty_get_created(p); | 1164 | icaltime = icalproperty_get_created(p); |
1162 | incidence->setCreated(readICalDateTime(icaltime)); | 1165 | incidence->setCreated(readICalDateTime(icaltime)); |
1163 | break; | 1166 | break; |
1164 | 1167 | ||
1165 | case ICAL_SEQUENCE_PROPERTY: // sequence | 1168 | case ICAL_SEQUENCE_PROPERTY: // sequence |
1166 | intvalue = icalproperty_get_sequence(p); | 1169 | intvalue = icalproperty_get_sequence(p); |
1167 | incidence->setRevision(intvalue); | 1170 | incidence->setRevision(intvalue); |
1168 | break; | 1171 | break; |
1169 | 1172 | ||
1170 | case ICAL_LASTMODIFIED_PROPERTY: // last modification date | 1173 | case ICAL_LASTMODIFIED_PROPERTY: // last modification date |
1171 | icaltime = icalproperty_get_lastmodified(p); | 1174 | icaltime = icalproperty_get_lastmodified(p); |
1172 | incidence->setLastModified(readICalDateTime(icaltime)); | 1175 | incidence->setLastModified(readICalDateTime(icaltime)); |
1173 | break; | 1176 | break; |
1174 | 1177 | ||
1175 | case ICAL_DTSTART_PROPERTY: // start date and time | 1178 | case ICAL_DTSTART_PROPERTY: // start date and time |
1176 | icaltime = icalproperty_get_dtstart(p); | 1179 | icaltime = icalproperty_get_dtstart(p); |
1177 | if (icaltime.is_date) { | 1180 | if (icaltime.is_date) { |
1178 | incidence->setDtStart(QDateTime(readICalDate(icaltime),QTime(0,0,0))); | 1181 | incidence->setDtStart(QDateTime(readICalDate(icaltime),QTime(0,0,0))); |
1179 | incidence->setFloats(true); | 1182 | incidence->setFloats(true); |
1180 | } else { | 1183 | } else { |
1181 | incidence->setDtStart(readICalDateTime(icaltime)); | 1184 | incidence->setDtStart(readICalDateTime(icaltime)); |
1182 | } | 1185 | } |
1183 | break; | 1186 | break; |
1184 | 1187 | ||
1185 | case ICAL_DURATION_PROPERTY: // start date and time | 1188 | case ICAL_DURATION_PROPERTY: // start date and time |
1186 | icalduration = icalproperty_get_duration(p); | 1189 | icalduration = icalproperty_get_duration(p); |
1187 | incidence->setDuration(readICalDuration(icalduration)); | 1190 | incidence->setDuration(readICalDuration(icalduration)); |
1188 | break; | 1191 | break; |
1189 | 1192 | ||
1190 | case ICAL_DESCRIPTION_PROPERTY: // description | 1193 | case ICAL_DESCRIPTION_PROPERTY: // description |
1191 | text = icalproperty_get_description(p); | 1194 | text = icalproperty_get_description(p); |
1192 | incidence->setDescription(QString::fromUtf8(text)); | 1195 | incidence->setDescription(QString::fromUtf8(text)); |
1193 | break; | 1196 | break; |
1194 | 1197 | ||
1195 | case ICAL_SUMMARY_PROPERTY: // summary | 1198 | case ICAL_SUMMARY_PROPERTY: // summary |
1196 | { | 1199 | { |
1197 | text = icalproperty_get_summary(p); | 1200 | text = icalproperty_get_summary(p); |
1198 | incidence->setSummary(QString::fromUtf8(text)); | 1201 | incidence->setSummary(QString::fromUtf8(text)); |
1199 | } | 1202 | } |
1200 | break; | 1203 | break; |
1201 | case ICAL_STATUS_PROPERTY: // summary | 1204 | case ICAL_STATUS_PROPERTY: // summary |
1202 | { | 1205 | { |
1203 | if ( ICAL_STATUS_CANCELLED == icalproperty_get_status(p) ) | 1206 | if ( ICAL_STATUS_CANCELLED == icalproperty_get_status(p) ) |
1204 | incidence->setCancelled( true ); | 1207 | incidence->setCancelled( true ); |
1205 | } | 1208 | } |
1206 | break; | 1209 | break; |
1207 | 1210 | ||
1208 | case ICAL_LOCATION_PROPERTY: // location | 1211 | case ICAL_LOCATION_PROPERTY: // location |
1209 | text = icalproperty_get_location(p); | 1212 | text = icalproperty_get_location(p); |
1210 | incidence->setLocation(QString::fromUtf8(text)); | 1213 | incidence->setLocation(QString::fromUtf8(text)); |
1211 | break; | 1214 | break; |
1212 | 1215 | ||
1213 | case ICAL_RECURRENCEID_PROPERTY: | 1216 | case ICAL_RECURRENCEID_PROPERTY: |
1214 | icaltime = icalproperty_get_recurrenceid(p); | 1217 | icaltime = icalproperty_get_recurrenceid(p); |
1215 | incidence->setRecurrenceID( readICalDateTime(icaltime) ); | 1218 | incidence->setRecurrenceID( readICalDateTime(icaltime) ); |
1216 | //qDebug(" RecurrenceID %s",incidence->recurrenceID().toString().latin1() ); | 1219 | //qDebug(" RecurrenceID %s",incidence->recurrenceID().toString().latin1() ); |
1217 | break; | 1220 | break; |