metadatebook.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <libkcal/event.h>
00023 #include <libkcal/recurrence.h>
00024
00025 #include "metadatebook.h"
00026
00027 using namespace OpieHelper;
00028
00029 MetaDatebook::MetaDatebook()
00030 : MD5Template<KSync::CalendarSyncee, KSync::CalendarSyncEntry>()
00031 {
00032 }
00033 MetaDatebook::~MetaDatebook() {
00034 }
00035 QString MetaDatebook::string( KSync::CalendarSyncEntry* ev) {
00036 QString string;
00037 KCal::Event* event = dynamic_cast<KCal::Event*>( ev->incidence() );
00038 if ( !event )
00039 return "";
00040
00041 string = event->categories().join(";");
00042 string += event->summary();
00043 string += event->description();
00044 string += event->location();
00045 string += event->dtStart().toString("dd.MM.yyyy hh:mm:ss");
00046 string += event->dtEnd().toString("dd.MM.yyyy hh:mm:ss");
00047 string += QString::number( event->doesFloat() );
00048
00049
00050 KCal::Recurrence* rec = event->recurrence();
00051 if ( rec->doesRecur() ) {
00052 switch( rec->doesRecur() ) {
00053 case KCal::Recurrence::rDaily:
00054 string += "Daily";
00055 break;
00056 case KCal::Recurrence::rWeekly:{
00057 string += "Weekly";
00058 string += days( rec->days() );
00059 break;
00060 }
00061 case KCal::Recurrence::rMonthlyPos:
00062 string += "MonthlyDay";
00063 break;
00064 case KCal::Recurrence::rMonthlyDay:
00065 string += "MonthlyDate";
00066 break;
00067 case KCal::Recurrence::rYearlyDay:
00068 case KCal::Recurrence::rYearlyMonth:
00069 case KCal::Recurrence::rYearlyPos:
00070 string += "Yearly";
00071 break;
00072 case KCal::Recurrence::rNone:
00073 default:
00074 break;
00075 }
00076 string += QString::number( rec->frequency() );
00077
00078
00079 string += QString::number( rec->duration() );
00080 if ( rec->duration() == 0 ) {
00081 string += rec->endDate().toString("dd.MM.yyyy");
00082 }
00083 string += rec->recurStart().date().toString("dd.MM.yyyy hh:mm:ss");
00084 }
00085
00086
00087
00088
00089
00090
00091
00092
00093 return string;
00094 }
00095 QString MetaDatebook::days( const QBitArray& ar ) {
00096 QString str;
00097 if ( ar.testBit(0 ) ) str += "Mo";
00098 if ( ar.testBit(1 ) ) str += "Di";
00099 if ( ar.testBit(2 ) ) str += "Mi";
00100 if ( ar.testBit(3 ) ) str += "Do";
00101 if ( ar.testBit(4 ) ) str += "Fr";
00102 if ( ar.testBit(5 ) ) str += "Sa";
00103 if ( ar.testBit(6 ) ) str += "So";
00104
00105 return str;
00106 }
This file is part of the documentation for kitchensync Library Version 3.3.2.