<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en_US" xml:lang="en_US"> <head> <title>libkcal: icalformatimpl.cpp Source File (libkcal)</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="pics-label" content='(pics-1.1 "http://www.icra.org/ratingsv02.html" comment "ICRAonline DE v2.0" l gen true for "http://www.kde.org" r (nz 1 vz 1 lz 1 oz 1 cb 1) "http://www.rsac.org/ratingsv01.html" l gen true for "http://www.kde.org" r (n 0 s 0 v 0 l 0))' /> <meta name="trademark" content="KDE e.V." /> <meta name="description" content="K Desktop Environment Homepage, KDE.org" /> <meta name="MSSmartTagsPreventParsing" content="true" /> <meta name="robots" content="all" /> <link rel="shortcut icon" href="../../favicon.ico" /> <link rel="stylesheet" media="screen" type="text/css" title="APIDOX" href="doxygen.css" /> <style type="text/css"> <!-- hr { display: none; } #content h2 { margin-left: 0px; } table.mdTable { background-color: #f8f8f8; border: .2em solid #d7d7d7; } td.mdRow { padding: 8px 20px; } td.md { font-weight: bold; } td.mdname1 { font-weight: bold; color: #602020; } td.mdname { font-weight: bold; color: #602020; } --> </style> </head> <body> <div id="nav_header_top" align="right"> <a href="#content" class="doNotDisplay" accesskey="2">Skip to main content ::</a> <a href="../.."><img id="nav_header_logo" alt="Home" align="left" src="../../kde_gear_64.png" border="0" /></a> <span class="doNotDisplay">::</span> <img id="nav_header_logo_right" alt="" align="right" src="../../pimlogo.png" border="0" /> <div id="nav_header_title" align="left">KDE PIM API Reference</div> </div> <div id="nav_header_bottom" align="right"> <span class="doNotDisplay">:: <a href="#navigation" accesskey="5">Skip to Link Menu</a><br/></span> <div id="nav_header_bottom_left" style="text-align: left;"> / <a href="../../">API Reference</a> / <a href=".">libkcal</a> </div> </div> <table id="main" border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td valign="top" class="menuheader" height="0"></td> <td id="contentcolumn" valign="top" rowspan="2" > <div id="content" style="padding-top: 0px;"><div style="width:100%; margin: 0px; padding: 0px;"> <h2><a name="content"></a>libkcal</h2> <!-- Generated by Doxygen 1.5.5 --> <h1>icalformatimpl.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> <a name="l00002"></a>00002 <span class="comment"> This file is part of libkcal.</span> <a name="l00003"></a>00003 <span class="comment"></span> <a name="l00004"></a>00004 <span class="comment"> Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org></span> <a name="l00005"></a>00005 <span class="comment"> Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com></span> <a name="l00006"></a>00006 <span class="comment"></span> <a name="l00007"></a>00007 <span class="comment"> This library is free software; you can redistribute it and/or</span> <a name="l00008"></a>00008 <span class="comment"> modify it under the terms of the GNU Library General Public</span> <a name="l00009"></a>00009 <span class="comment"> License as published by the Free Software Foundation; either</span> <a name="l00010"></a>00010 <span class="comment"> version 2 of the License, or (at your option) any later version.</span> <a name="l00011"></a>00011 <span class="comment"></span> <a name="l00012"></a>00012 <span class="comment"> This library is distributed in the hope that it will be useful,</span> <a name="l00013"></a>00013 <span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00014"></a>00014 <span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span> <a name="l00015"></a>00015 <span class="comment"> Library General Public License for more details.</span> <a name="l00016"></a>00016 <span class="comment"></span> <a name="l00017"></a>00017 <span class="comment"> You should have received a copy of the GNU Library General Public License</span> <a name="l00018"></a>00018 <span class="comment"> along with this library; see the file COPYING.LIB. If not, write to</span> <a name="l00019"></a>00019 <span class="comment"> the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,</span> <a name="l00020"></a>00020 <span class="comment"> Boston, MA 02110-1301, USA.</span> <a name="l00021"></a>00021 <span class="comment">*/</span> <a name="l00022"></a>00022 <a name="l00023"></a>00023 <span class="preprocessor">#include <qdatetime.h></span> <a name="l00024"></a>00024 <span class="preprocessor">#include <qstring.h></span> <a name="l00025"></a>00025 <span class="preprocessor">#include <qptrlist.h></span> <a name="l00026"></a>00026 <span class="preprocessor">#include <qfile.h></span> <a name="l00027"></a>00027 <span class="preprocessor">#include <cstdlib></span> <a name="l00028"></a>00028 <a name="l00029"></a>00029 <span class="preprocessor">#include <kdebug.h></span> <a name="l00030"></a>00030 <span class="preprocessor">#include <klocale.h></span> <a name="l00031"></a>00031 <span class="preprocessor">#include <kmdcodec.h></span> <a name="l00032"></a>00032 <a name="l00033"></a>00033 <span class="keyword">extern</span> <span class="stringliteral">"C"</span> { <a name="l00034"></a>00034 <span class="preprocessor"> #include <ical.h></span> <a name="l00035"></a>00035 <span class="preprocessor"> #include <icalparser.h></span> <a name="l00036"></a>00036 <span class="preprocessor"> #include <icalrestriction.h></span> <a name="l00037"></a>00037 } <a name="l00038"></a>00038 <a name="l00039"></a>00039 <span class="preprocessor">#include "<a class="code" href="calendar_8h.html" title="Provides the main &quot;calendar&quot; object class.">calendar.h</a>"</span> <a name="l00040"></a>00040 <span class="preprocessor">#include "journal.h"</span> <a name="l00041"></a>00041 <span class="preprocessor">#include "icalformat.h"</span> <a name="l00042"></a>00042 <span class="preprocessor">#include "icalformatimpl.h"</span> <a name="l00043"></a>00043 <span class="preprocessor">#include "compat.h"</span> <a name="l00044"></a>00044 <a name="l00045"></a>00045 <span class="preprocessor">#define _ICAL_VERSION "2.0"</span> <a name="l00046"></a>00046 <span class="preprocessor"></span> <a name="l00047"></a>00047 <span class="keyword">using namespace </span>KCal; <a name="l00048"></a>00048 <a name="l00049"></a>00049 <span class="comment">/* Static helpers */</span> <a name="l00050"></a>00050 <span class="keyword">static</span> QDateTime ICalDate2QDate(<span class="keyword">const</span> icaltimetype& t) <a name="l00051"></a>00051 { <a name="l00052"></a>00052 <span class="comment">// Outlook sends dates starting from 1601-01-01, but QDate()</span> <a name="l00053"></a>00053 <span class="comment">// can only handle dates starting 1752-09-14.</span> <a name="l00054"></a>00054 <span class="keyword">const</span> <span class="keywordtype">int</span> year = (t.year>=1754) ? t.year : 1754; <a name="l00055"></a>00055 <span class="keywordflow">return</span> QDateTime(QDate(year,t.month,t.day), QTime(t.hour,t.minute,t.second)); <a name="l00056"></a>00056 } <a name="l00057"></a>00057 <a name="l00058"></a>00058 <span class="keyword">static</span> <span class="keywordtype">void</span> _dumpIcaltime( <span class="keyword">const</span> icaltimetype& t) <a name="l00059"></a>00059 { <a name="l00060"></a>00060 kdDebug(5800) << <span class="stringliteral">"--- Y: "</span> << t.year << <span class="stringliteral">" M: "</span> << t.month << <span class="stringliteral">" D: "</span> << t.day <a name="l00061"></a>00061 << endl; <a name="l00062"></a>00062 kdDebug(5800) << <span class="stringliteral">"--- H: "</span> << t.hour << <span class="stringliteral">" M: "</span> << t.minute << <span class="stringliteral">" S: "</span> << t.second <a name="l00063"></a>00063 << endl; <a name="l00064"></a>00064 kdDebug(5800) << <span class="stringliteral">"--- isUtc: "</span> << icaltime_is_utc( t )<< endl; <a name="l00065"></a>00065 kdDebug(5800) << <span class="stringliteral">"--- zoneId: "</span> << icaltimezone_get_tzid( const_cast<icaltimezone*>( t.zone ) )<< endl; <a name="l00066"></a>00066 } <a name="l00067"></a>00067 <a name="l00068"></a>00068 <span class="keyword">const</span> <span class="keywordtype">int</span> gSecondsPerMinute = 60; <a name="l00069"></a>00069 <span class="keyword">const</span> <span class="keywordtype">int</span> gSecondsPerHour = gSecondsPerMinute * 60; <a name="l00070"></a>00070 <span class="keyword">const</span> <span class="keywordtype">int</span> gSecondsPerDay = gSecondsPerHour * 24; <a name="l00071"></a>00071 <span class="keyword">const</span> <span class="keywordtype">int</span> gSecondsPerWeek = gSecondsPerDay * 7; <a name="l00072"></a>00072 <a name="l00073"></a>00073 ICalFormatImpl::ICalFormatImpl( <a class="code" href="classKCal_1_1ICalFormat.html" title="This class implements the iCalendar format.">ICalFormat</a> *parent ) : <a name="l00074"></a>00074 mParent( parent ), mCompat( new <a class="code" href="classKCal_1_1Compat.html" title="This class provides compatibility to older (broken) versions of KOrganizer.">Compat</a> ) <a name="l00075"></a>00075 { <a name="l00076"></a>00076 } <a name="l00077"></a>00077 <a name="l00078"></a>00078 ICalFormatImpl::~ICalFormatImpl() <a name="l00079"></a>00079 { <a name="l00080"></a>00080 <span class="keyword">delete</span> mCompat; <a name="l00081"></a>00081 } <a name="l00082"></a>00082 <a name="l00083"></a>00083 <span class="keyword">class </span>ICalFormatImpl::ToComponentVisitor : <span class="keyword">public</span> <a class="code" href="classKCal_1_1IncidenceBase.html" title="This class provides the base class common to all calendar components.">IncidenceBase</a>::Visitor <a name="l00084"></a>00084 { <a name="l00085"></a>00085 <span class="keyword">public</span>: <a name="l00086"></a>00086 ToComponentVisitor( ICalFormatImpl *impl, <a class="code" href="classKCal_1_1Scheduler.html#b5bb0cf1cf4c936a606b1968e85601b1" title="iTIP methods.">Scheduler::Method</a> m ) : mImpl( impl ), mComponent( 0 ), mMethod( m ) {} <a name="l00087"></a>00087 <a name="l00088"></a>00088 <span class="keywordtype">bool</span> visit( <a class="code" href="classKCal_1_1Event.html" title="This class provides an Event in the sense of RFC2445.">Event</a> *e ) { mComponent = mImpl->writeEvent( e ); <span class="keywordflow">return</span> <span class="keyword">true</span>; } <a name="l00089"></a>00089 <span class="keywordtype">bool</span> visit( <a class="code" href="classKCal_1_1Todo.html" title="This class provides a Todo in the sense of RFC2445.">Todo</a> *e ) { mComponent = mImpl->writeTodo( e ); <span class="keywordflow">return</span> <span class="keyword">true</span>; } <a name="l00090"></a>00090 <span class="keywordtype">bool</span> visit( <a class="code" href="classKCal_1_1Journal.html" title="This class provides a Journal in the sense of RFC2445.">Journal</a> *e ) { mComponent = mImpl->writeJournal( e ); <span class="keywordflow">return</span> <span class="keyword">true</span>; } <a name="l00091"></a>00091 <span class="keywordtype">bool</span> visit( <a class="code" href="classKCal_1_1FreeBusy.html" title="This class provides information about free/busy time of a calendar user.">FreeBusy</a> *fb ) { mComponent = mImpl->writeFreeBusy( fb, mMethod ); <span class="keywordflow">return</span> <span class="keyword">true</span>; } <a name="l00092"></a>00092 <a name="l00093"></a>00093 icalcomponent *component() { <span class="keywordflow">return</span> mComponent; } <a name="l00094"></a>00094 <a name="l00095"></a>00095 <span class="keyword">private</span>: <a name="l00096"></a>00096 ICalFormatImpl *mImpl; <a name="l00097"></a>00097 icalcomponent *mComponent; <a name="l00098"></a>00098 <a class="code" href="classKCal_1_1Scheduler.html#b5bb0cf1cf4c936a606b1968e85601b1" title="iTIP methods.">Scheduler::Method</a> mMethod; <a name="l00099"></a>00099 }; <a name="l00100"></a>00100 <a name="l00101"></a>00101 icalcomponent *ICalFormatImpl::writeIncidence( <a class="code" href="classKCal_1_1IncidenceBase.html" title="This class provides the base class common to all calendar components.">IncidenceBase</a> *incidence, <a class="code" href="classKCal_1_1Scheduler.html#b5bb0cf1cf4c936a606b1968e85601b1" title="iTIP methods.">Scheduler::Method</a> method ) <a name="l00102"></a>00102 { <a name="l00103"></a>00103 ToComponentVisitor v( <span class="keyword">this</span>, method ); <a name="l00104"></a>00104 <span class="keywordflow">if</span> ( incidence-><a class="code" href="classKCal_1_1IncidenceBase.html#d99ad7b4b99e8de052ffaf8541590ff3" title="Accept IncidenceVisitor.">accept</a>(v) ) <a name="l00105"></a>00105 <span class="keywordflow">return</span> v.component(); <a name="l00106"></a>00106 <span class="keywordflow">else</span> <span class="keywordflow">return</span> 0; <a name="l00107"></a>00107 } <a name="l00108"></a>00108 <a name="l00109"></a>00109 icalcomponent *ICalFormatImpl::writeTodo(<a class="code" href="classKCal_1_1Todo.html" title="This class provides a Todo in the sense of RFC2445.">Todo</a> *todo) <a name="l00110"></a>00110 { <a name="l00111"></a>00111 QString tmpStr; <a name="l00112"></a>00112 QStringList tmpStrList; <a name="l00113"></a>00113 <a name="l00114"></a>00114 icalcomponent *vtodo = icalcomponent_new(ICAL_VTODO_COMPONENT); <a name="l00115"></a>00115 <a name="l00116"></a>00116 writeIncidence(vtodo,todo); <a name="l00117"></a>00117 <a name="l00118"></a>00118 <span class="comment">// due date</span> <a name="l00119"></a>00119 <span class="keywordflow">if</span> (todo-><a class="code" href="classKCal_1_1Todo.html#a40c65f6e9024015f7546e8749436b12" title="Returns true if the todo has a due date, otherwise return false.">hasDueDate</a>()) { <a name="l00120"></a>00120 icaltimetype due; <a name="l00121"></a>00121 <span class="keywordflow">if</span> (todo-><a class="code" href="classKCal_1_1IncidenceBase.html#edfe188f8024f1ec9e25972ddd332724" title="Return true or false depending on whether the incidence &quot;floats,&quot; i.e.">doesFloat</a>()) { <a name="l00122"></a>00122 due = writeICalDate(todo-><a class="code" href="classKCal_1_1Todo.html#09d6933ae42390339b27053faee3afec" title="Returns due date and time.">dtDue</a>(<span class="keyword">true</span>).date()); <a name="l00123"></a>00123 } <span class="keywordflow">else</span> { <a name="l00124"></a>00124 due = writeICalDateTime(todo-><a class="code" href="classKCal_1_1Todo.html#09d6933ae42390339b27053faee3afec" title="Returns due date and time.">dtDue</a>(<span class="keyword">true</span>)); <a name="l00125"></a>00125 } <a name="l00126"></a>00126 icalcomponent_add_property(vtodo,icalproperty_new_due(due)); <a name="l00127"></a>00127 } <a name="l00128"></a>00128 <a name="l00129"></a>00129 <span class="comment">// start time</span> <a name="l00130"></a>00130 <span class="keywordflow">if</span> ( todo-><a class="code" href="classKCal_1_1Todo.html#1fb5a233b65e2c35f9cb03460bb68c30" title="Returns true if the todo has a start date, otherwise return false.">hasStartDate</a>() || todo-><a class="code" href="classKCal_1_1Incidence.html#81ad15662138be07f0d55be6b075b043" title="Forward to Recurrence::doesRecur().">doesRecur</a>() ) { <a name="l00131"></a>00131 icaltimetype start; <a name="l00132"></a>00132 <span class="keywordflow">if</span> (todo-><a class="code" href="classKCal_1_1IncidenceBase.html#edfe188f8024f1ec9e25972ddd332724" title="Return true or false depending on whether the incidence &quot;floats,&quot; i.e.">doesFloat</a>()) { <a name="l00133"></a>00133 <span class="comment">// kdDebug(5800) << " Incidence " << todo->summary() << " floats." << endl;</span> <a name="l00134"></a>00134 start = writeICalDate(todo-><a class="code" href="classKCal_1_1Todo.html#30769e5e8bdc066ed4d92c68fb47c833" title="Returns the startdate of the todo.">dtStart</a>(<span class="keyword">true</span>).date()); <a name="l00135"></a>00135 } <span class="keywordflow">else</span> { <a name="l00136"></a>00136 <span class="comment">// kdDebug(5800) << " incidence " << todo->summary() << " has time." << endl;</span> <a name="l00137"></a>00137 start = writeICalDateTime(todo-><a class="code" href="classKCal_1_1Todo.html#30769e5e8bdc066ed4d92c68fb47c833" title="Returns the startdate of the todo.">dtStart</a>(<span class="keyword">true</span>)); <a name="l00138"></a>00138 } <a name="l00139"></a>00139 icalcomponent_add_property(vtodo,icalproperty_new_dtstart(start)); <a name="l00140"></a>00140 } <a name="l00141"></a>00141 <a name="l00142"></a>00142 <span class="comment">// completion date</span> <a name="l00143"></a>00143 <span class="keywordflow">if</span> (todo-><a class="code" href="classKCal_1_1Todo.html#c935ce3f04f7e9d828d3f954de585af6" title="Returns true if the todo is 100% completed, otherwise return false.">isCompleted</a>()) { <a name="l00144"></a>00144 <span class="keywordflow">if</span> (!todo-><a class="code" href="classKCal_1_1Todo.html#d681e871a6dc5ee92762c99b635cd8e0" title="Returns true, if todo has a date associated with completion, otherwise return false...">hasCompletedDate</a>()) { <a name="l00145"></a>00145 <span class="comment">// If todo was created by KOrganizer <2.2 it has no correct completion</span> <a name="l00146"></a>00146 <span class="comment">// date. Set it to now.</span> <a name="l00147"></a>00147 todo-><a class="code" href="classKCal_1_1Todo.html#64cb08677f9e62426b93d3d4f9cd31d2" title="Set completed state.">setCompleted</a>(QDateTime::currentDateTime()); <a name="l00148"></a>00148 } <a name="l00149"></a>00149 icaltimetype completed = writeICalDateTime(todo-><a class="code" href="classKCal_1_1Todo.html#54dcea7cf3beaab3a4eb2fee4c66998e" title="Returns date and time when todo was completed.">completed</a>()); <a name="l00150"></a>00150 icalcomponent_add_property(vtodo,icalproperty_new_completed(completed)); <a name="l00151"></a>00151 } <a name="l00152"></a>00152 <a name="l00153"></a>00153 icalcomponent_add_property(vtodo, <a name="l00154"></a>00154 icalproperty_new_percentcomplete(todo-><a class="code" href="classKCal_1_1Todo.html#e269def11f2ac042c997b3d95f8521a1" title="Returns how many percent of the task are completed.">percentComplete</a>())); <a name="l00155"></a>00155 <a name="l00156"></a>00156 <span class="keywordflow">if</span>( todo-><a class="code" href="classKCal_1_1Incidence.html#81ad15662138be07f0d55be6b075b043" title="Forward to Recurrence::doesRecur().">doesRecur</a>() ) { <a name="l00157"></a>00157 icalcomponent_add_property(vtodo, <a name="l00158"></a>00158 icalproperty_new_recurrenceid( writeICalDateTime( todo-><a class="code" href="classKCal_1_1Todo.html#09d6933ae42390339b27053faee3afec" title="Returns due date and time.">dtDue</a>()))); <a name="l00159"></a>00159 } <a name="l00160"></a>00160 <a name="l00161"></a>00161 <span class="keywordflow">return</span> vtodo; <a name="l00162"></a>00162 } <a name="l00163"></a>00163 <a name="l00164"></a>00164 icalcomponent *ICalFormatImpl::writeEvent(<a class="code" href="classKCal_1_1Event.html" title="This class provides an Event in the sense of RFC2445.">Event</a> *event) <a name="l00165"></a>00165 { <a name="l00166"></a>00166 <span class="preprocessor">#if 0</span> <a name="l00167"></a>00167 <span class="preprocessor"></span> kdDebug(5800) << <span class="stringliteral">"Write Event '"</span> << <span class="keyword">event</span>->summary() << <span class="stringliteral">"' ("</span> << <span class="keyword">event</span>->uid() <a name="l00168"></a>00168 << <span class="stringliteral">")"</span> << endl; <a name="l00169"></a>00169 <span class="preprocessor">#endif</span> <a name="l00170"></a>00170 <span class="preprocessor"></span> <a name="l00171"></a>00171 QString tmpStr; <a name="l00172"></a>00172 QStringList tmpStrList; <a name="l00173"></a>00173 <a name="l00174"></a>00174 icalcomponent *vevent = icalcomponent_new(ICAL_VEVENT_COMPONENT); <a name="l00175"></a>00175 <a name="l00176"></a>00176 writeIncidence(vevent,event); <a name="l00177"></a>00177 <a name="l00178"></a>00178 <span class="comment">// start time</span> <a name="l00179"></a>00179 icaltimetype start; <a name="l00180"></a>00180 <span class="keywordflow">if</span> (event-><a class="code" href="classKCal_1_1IncidenceBase.html#edfe188f8024f1ec9e25972ddd332724" title="Return true or false depending on whether the incidence &quot;floats,&quot; i.e.">doesFloat</a>()) { <a name="l00181"></a>00181 <span class="comment">// kdDebug(5800) << " Incidence " << event->summary() << " floats." << endl;</span> <a name="l00182"></a>00182 start = writeICalDate(event-><a class="code" href="classKCal_1_1IncidenceBase.html#5419a946a4e5715a0c34ec2c7e04cd9b" title="returns an event&#39;s starting date/time as a QDateTime.">dtStart</a>().date()); <a name="l00183"></a>00183 } <span class="keywordflow">else</span> { <a name="l00184"></a>00184 <span class="comment">// kdDebug(5800) << " incidence " << event->summary() << " has time." << endl;</span> <a name="l00185"></a>00185 start = writeICalDateTime(event-><a class="code" href="classKCal_1_1IncidenceBase.html#5419a946a4e5715a0c34ec2c7e04cd9b" title="returns an event&#39;s starting date/time as a QDateTime.">dtStart</a>()); <a name="l00186"></a>00186 } <a name="l00187"></a>00187 icalcomponent_add_property(vevent,icalproperty_new_dtstart(start)); <a name="l00188"></a>00188 <a name="l00189"></a>00189 <span class="keywordflow">if</span> (event-><a class="code" href="classKCal_1_1Event.html#2f980150df1a3b3883f9605b25fa769f" title="Return whether the event has an end date/time.">hasEndDate</a>()) { <a name="l00190"></a>00190 <span class="comment">// End time.</span> <a name="l00191"></a>00191 <span class="comment">// RFC2445 says that if DTEND is present, it has to be greater than DTSTART.</span> <a name="l00192"></a>00192 icaltimetype end; <a name="l00193"></a>00193 <span class="keywordflow">if</span> (event-><a class="code" href="classKCal_1_1IncidenceBase.html#edfe188f8024f1ec9e25972ddd332724" title="Return true or false depending on whether the incidence &quot;floats,&quot; i.e.">doesFloat</a>()) { <a name="l00194"></a>00194 <span class="comment">// kdDebug(5800) << " Event " << event->summary() << " floats." << endl;</span> <a name="l00195"></a>00195 <span class="comment">// +1 day because end date is non-inclusive.</span> <a name="l00196"></a>00196 end = writeICalDate( event-><a class="code" href="classKCal_1_1Event.html#0bc3052d40d160c7d58a5483dfcff693" title="Return end date and time.">dtEnd</a>().date().addDays( 1 ) ); <a name="l00197"></a>00197 icalcomponent_add_property(vevent,icalproperty_new_dtend(end)); <a name="l00198"></a>00198 } <span class="keywordflow">else</span> { <a name="l00199"></a>00199 <span class="comment">// kdDebug(5800) << " Event " << event->summary() << " has time." << endl;</span> <a name="l00200"></a>00200 <span class="keywordflow">if</span> (event-><a class="code" href="classKCal_1_1Event.html#0bc3052d40d160c7d58a5483dfcff693" title="Return end date and time.">dtEnd</a>() != <span class="keyword">event</span>->dtStart()) { <a name="l00201"></a>00201 end = writeICalDateTime(event-><a class="code" href="classKCal_1_1Event.html#0bc3052d40d160c7d58a5483dfcff693" title="Return end date and time.">dtEnd</a>()); <a name="l00202"></a>00202 icalcomponent_add_property(vevent,icalproperty_new_dtend(end)); <a name="l00203"></a>00203 } <a name="l00204"></a>00204 } <a name="l00205"></a>00205 } <a name="l00206"></a>00206 <a name="l00207"></a>00207 <span class="comment">// TODO: resources</span> <a name="l00208"></a>00208 <span class="preprocessor">#if 0</span> <a name="l00209"></a>00209 <span class="preprocessor"></span> <span class="comment">// resources</span> <a name="l00210"></a>00210 tmpStrList = anEvent->resources(); <a name="l00211"></a>00211 tmpStr = tmpStrList.join(<span class="stringliteral">";"</span>); <a name="l00212"></a>00212 <span class="keywordflow">if</span> (!tmpStr.isEmpty()) <a name="l00213"></a>00213 addPropValue(vevent, VCResourcesProp, tmpStr.utf8()); <a name="l00214"></a>00214 <a name="l00215"></a>00215 <span class="preprocessor">#endif</span> <a name="l00216"></a>00216 <span class="preprocessor"></span> <a name="l00217"></a>00217 <span class="comment">// Transparency</span> <a name="l00218"></a>00218 <span class="keywordflow">switch</span>( event-><a class="code" href="classKCal_1_1Event.html#6f5fcacd6b788df33ef826f31388d396" title="Return the event&#39;s time transparency level.">transparency</a>() ) { <a name="l00219"></a>00219 <span class="keywordflow">case</span> Event::Transparent: <a name="l00220"></a>00220 icalcomponent_add_property( <a name="l00221"></a>00221 vevent, <a name="l00222"></a>00222 icalproperty_new_transp( ICAL_TRANSP_TRANSPARENT ) ); <a name="l00223"></a>00223 <span class="keywordflow">break</span>; <a name="l00224"></a>00224 <span class="keywordflow">case</span> Event::Opaque: <a name="l00225"></a>00225 icalcomponent_add_property( <a name="l00226"></a>00226 vevent, <a name="l00227"></a>00227 icalproperty_new_transp( ICAL_TRANSP_OPAQUE ) ); <a name="l00228"></a>00228 <span class="keywordflow">break</span>; <a name="l00229"></a>00229 } <a name="l00230"></a>00230 <a name="l00231"></a>00231 <span class="keywordflow">return</span> vevent; <a name="l00232"></a>00232 } <a name="l00233"></a>00233 <a name="l00234"></a>00234 icalcomponent *ICalFormatImpl::writeFreeBusy(<a class="code" href="classKCal_1_1FreeBusy.html" title="This class provides information about free/busy time of a calendar user.">FreeBusy</a> *freebusy, <a name="l00235"></a>00235 <a class="code" href="classKCal_1_1Scheduler.html#b5bb0cf1cf4c936a606b1968e85601b1" title="iTIP methods.">Scheduler::Method</a> method) <a name="l00236"></a>00236 { <a name="l00237"></a>00237 <span class="preprocessor">#if QT_VERSION >= 300</span> <a name="l00238"></a>00238 <span class="preprocessor"></span> kdDebug(5800) << <span class="stringliteral">"icalformatimpl: writeFreeBusy: startDate: "</span> <a name="l00239"></a>00239 << freebusy-><a class="code" href="classKCal_1_1IncidenceBase.html#5419a946a4e5715a0c34ec2c7e04cd9b" title="returns an event&#39;s starting date/time as a QDateTime.">dtStart</a>().toString(<span class="stringliteral">"ddd MMMM d yyyy: h:m:s ap"</span>) << <span class="stringliteral">" End Date: "</span> <a name="l00240"></a>00240 << freebusy-><a class="code" href="classKCal_1_1FreeBusy.html#c20a78466c981ba719c43d7257ebf577">dtEnd</a>().toString(<span class="stringliteral">"ddd MMMM d yyyy: h:m:s ap"</span>) << endl; <a name="l00241"></a>00241 <span class="preprocessor">#endif</span> <a name="l00242"></a>00242 <span class="preprocessor"></span> <a name="l00243"></a>00243 icalcomponent *vfreebusy = icalcomponent_new(ICAL_VFREEBUSY_COMPONENT); <a name="l00244"></a>00244 <a name="l00245"></a>00245 writeIncidenceBase(vfreebusy,freebusy); <a name="l00246"></a>00246 <a name="l00247"></a>00247 icalcomponent_add_property(vfreebusy, icalproperty_new_dtstart( <a name="l00248"></a>00248 writeICalDateTime(freebusy-><a class="code" href="classKCal_1_1IncidenceBase.html#5419a946a4e5715a0c34ec2c7e04cd9b" title="returns an event&#39;s starting date/time as a QDateTime.">dtStart</a>()))); <a name="l00249"></a>00249 <a name="l00250"></a>00250 icalcomponent_add_property(vfreebusy, icalproperty_new_dtend( <a name="l00251"></a>00251 writeICalDateTime(freebusy-><a class="code" href="classKCal_1_1FreeBusy.html#c20a78466c981ba719c43d7257ebf577">dtEnd</a>()))); <a name="l00252"></a>00252 <a name="l00253"></a>00253 <span class="keywordflow">if</span> (method == Scheduler::Request) { <a name="l00254"></a>00254 icalcomponent_add_property(vfreebusy,icalproperty_new_uid( <a name="l00255"></a>00255 freebusy-><a class="code" href="classKCal_1_1IncidenceBase.html#75c8bd2df73c5a62bd7cf77c2ac4d3c6" title="Return the unique id for the event.">uid</a>().utf8())); <a name="l00256"></a>00256 } <a name="l00257"></a>00257 <a name="l00258"></a>00258 <span class="comment">//Loops through all the periods in the freebusy object</span> <a name="l00259"></a>00259 QValueList<Period> list = freebusy-><a class="code" href="classKCal_1_1FreeBusy.html#e4e82fcf1b6b37dd6e2742dc0c0cb2a9">busyPeriods</a>(); <a name="l00260"></a>00260 QValueList<Period>::Iterator it; <a name="l00261"></a>00261 icalperiodtype period = icalperiodtype_null_period(); <a name="l00262"></a>00262 <span class="keywordflow">for</span> (it = list.begin(); it!= list.end(); ++it) { <a name="l00263"></a>00263 period.start = writeICalDateTime((*it).start()); <a name="l00264"></a>00264 <span class="keywordflow">if</span> ( (*it).hasDuration() ) { <a name="l00265"></a>00265 period.duration = writeICalDuration( (*it).duration().asSeconds() ); <a name="l00266"></a>00266 } <span class="keywordflow">else</span> { <a name="l00267"></a>00267 period.end = writeICalDateTime((*it).end()); <a name="l00268"></a>00268 } <a name="l00269"></a>00269 icalcomponent_add_property(vfreebusy, icalproperty_new_freebusy(period) ); <a name="l00270"></a>00270 } <a name="l00271"></a>00271 <a name="l00272"></a>00272 <span class="keywordflow">return</span> vfreebusy; <a name="l00273"></a>00273 } <a name="l00274"></a>00274 <a name="l00275"></a>00275 icalcomponent *ICalFormatImpl::writeJournal(<a class="code" href="classKCal_1_1Journal.html" title="This class provides a Journal in the sense of RFC2445.">Journal</a> *journal) <a name="l00276"></a>00276 { <a name="l00277"></a>00277 icalcomponent *vjournal = icalcomponent_new(ICAL_VJOURNAL_COMPONENT); <a name="l00278"></a>00278 <a name="l00279"></a>00279 writeIncidence(vjournal,journal); <a name="l00280"></a>00280 <a name="l00281"></a>00281 <span class="comment">// start time</span> <a name="l00282"></a>00282 <span class="keywordflow">if</span> (journal-><a class="code" href="classKCal_1_1IncidenceBase.html#5419a946a4e5715a0c34ec2c7e04cd9b" title="returns an event&#39;s starting date/time as a QDateTime.">dtStart</a>().isValid()) { <a name="l00283"></a>00283 icaltimetype start; <a name="l00284"></a>00284 <span class="keywordflow">if</span> (journal-><a class="code" href="classKCal_1_1IncidenceBase.html#edfe188f8024f1ec9e25972ddd332724" title="Return true or false depending on whether the incidence &quot;floats,&quot; i.e.">doesFloat</a>()) { <a name="l00285"></a>00285 <span class="comment">// kdDebug(5800) << " Incidence " << event->summary() << " floats." << endl;</span> <a name="l00286"></a>00286 start = writeICalDate(journal-><a class="code" href="classKCal_1_1IncidenceBase.html#5419a946a4e5715a0c34ec2c7e04cd9b" title="returns an event&#39;s starting date/time as a QDateTime.">dtStart</a>().date()); <a name="l00287"></a>00287 } <span class="keywordflow">else</span> { <a name="l00288"></a>00288 <span class="comment">// kdDebug(5800) << " incidence " << event->summary() << " has time." << endl;</span> <a name="l00289"></a>00289 start = writeICalDateTime(journal-><a class="code" href="classKCal_1_1IncidenceBase.html#5419a946a4e5715a0c34ec2c7e04cd9b" title="returns an event&#39;s starting date/time as a QDateTime.">dtStart</a>()); <a name="l00290"></a>00290 } <a name="l00291"></a>00291 icalcomponent_add_property(vjournal,icalproperty_new_dtstart(start)); <a name="l00292"></a>00292 } <a name="l00293"></a>00293 <a name="l00294"></a>00294 <span class="keywordflow">return</span> vjournal; <a name="l00295"></a>00295 } <a name="l00296"></a>00296 <a name="l00297"></a>00297 <span class="keywordtype">void</span> ICalFormatImpl::writeIncidence(icalcomponent *parent,<a class="code" href="classKCal_1_1Incidence.html" title="This class provides the base class common to all calendar components.">Incidence</a> *incidence) <a name="l00298"></a>00298 { <a name="l00299"></a>00299 <span class="comment">// pilot sync stuff</span> <a name="l00300"></a>00300 <span class="comment">// TODO: move this application-specific code to kpilot</span> <a name="l00301"></a>00301 <span class="keywordflow">if</span> (incidence-><a class="code" href="classKCal_1_1IncidenceBase.html#9bc80bebe8e08db39ab018f9ce1c461e" title="Return Pilot Id.">pilotId</a>()) { <a name="l00302"></a>00302 <span class="comment">// NOTE: we can't do setNonKDECustomProperty here because this changes</span> <a name="l00303"></a>00303 <span class="comment">// data and triggers an updated() event...</span> <a name="l00304"></a>00304 <span class="comment">// incidence->setNonKDECustomProperty("X-PILOTSTAT", QString::number(incidence->syncStatus()));</span> <a name="l00305"></a>00305 <span class="comment">// incidence->setNonKDECustomProperty("X-PILOTID", QString::number(incidence->pilotId()));</span> <a name="l00306"></a>00306 <a name="l00307"></a>00307 icalproperty *p = 0; <a name="l00308"></a>00308 p = icalproperty_new_x(QString::number(incidence-><a class="code" href="classKCal_1_1IncidenceBase.html#65e21cc6bb7d2404eae2ae0cdeab14cb" title="Return synchronisation status.">syncStatus</a>()).utf8()); <a name="l00309"></a>00309 icalproperty_set_x_name(p,<span class="stringliteral">"X-PILOTSTAT"</span>); <a name="l00310"></a>00310 icalcomponent_add_property(parent,p); <a name="l00311"></a>00311 <a name="l00312"></a>00312 p = icalproperty_new_x(QString::number(incidence-><a class="code" href="classKCal_1_1IncidenceBase.html#9bc80bebe8e08db39ab018f9ce1c461e" title="Return Pilot Id.">pilotId</a>()).utf8()); <a name="l00313"></a>00313 icalproperty_set_x_name(p,<span class="stringliteral">"X-PILOTID"</span>); <a name="l00314"></a>00314 icalcomponent_add_property(parent,p); <a name="l00315"></a>00315 } <a name="l00316"></a>00316 <a name="l00317"></a>00317 <span class="keywordflow">if</span> ( incidence-><a class="code" href="classKCal_1_1Incidence.html#21fd9072b4c64227aa69b55077ee7352" title="Return the event&#39;s/todo&#39;s scheduling ID.">schedulingID</a>() != incidence-><a class="code" href="classKCal_1_1IncidenceBase.html#75c8bd2df73c5a62bd7cf77c2ac4d3c6" title="Return the unique id for the event.">uid</a>() ) <a name="l00318"></a>00318 <span class="comment">// We need to store the UID in here. The rawSchedulingID will</span> <a name="l00319"></a>00319 <span class="comment">// go into the iCal UID component</span> <a name="l00320"></a>00320 incidence-><a class="code" href="classKCal_1_1CustomProperties.html#afa6f5501560226cf729bd11771d9d2a" title="Create or modify a custom calendar property.">setCustomProperty</a>( <span class="stringliteral">"LIBKCAL"</span>, <span class="stringliteral">"ID"</span>, incidence-><a class="code" href="classKCal_1_1IncidenceBase.html#75c8bd2df73c5a62bd7cf77c2ac4d3c6" title="Return the unique id for the event.">uid</a>() ); <a name="l00321"></a>00321 <span class="keywordflow">else</span> <a name="l00322"></a>00322 incidence-><a class="code" href="classKCal_1_1CustomProperties.html#d47e81fd7641d34b3f41809889e2d154" title="Delete a custom calendar property.">removeCustomProperty</a>( <span class="stringliteral">"LIBKCAL"</span>, <span class="stringliteral">"ID"</span> ); <a name="l00323"></a>00323 <a name="l00324"></a>00324 writeIncidenceBase(parent,incidence); <a name="l00325"></a>00325 <a name="l00326"></a>00326 <span class="comment">// creation date</span> <a name="l00327"></a>00327 icalcomponent_add_property(parent,icalproperty_new_created( <a name="l00328"></a>00328 writeICalDateTime(incidence-><a class="code" href="classKCal_1_1Incidence.html#8df4ebe490fea07df54e9df82c40c579" title="Return time and date of creation.">created</a>()))); <a name="l00329"></a>00329 <a name="l00330"></a>00330 <span class="comment">// unique id</span> <a name="l00331"></a>00331 <span class="comment">// If the scheduling ID is different from the real UID, the real</span> <a name="l00332"></a>00332 <span class="comment">// one is stored on X-REALID above</span> <a name="l00333"></a>00333 <span class="keywordflow">if</span> ( !incidence-><a class="code" href="classKCal_1_1Incidence.html#21fd9072b4c64227aa69b55077ee7352" title="Return the event&#39;s/todo&#39;s scheduling ID.">schedulingID</a>().isEmpty() ) { <a name="l00334"></a>00334 icalcomponent_add_property(parent,icalproperty_new_uid( <a name="l00335"></a>00335 incidence-><a class="code" href="classKCal_1_1Incidence.html#21fd9072b4c64227aa69b55077ee7352" title="Return the event&#39;s/todo&#39;s scheduling ID.">schedulingID</a>().utf8())); <a name="l00336"></a>00336 } <a name="l00337"></a>00337 <a name="l00338"></a>00338 <span class="comment">// revision</span> <a name="l00339"></a>00339 <span class="keywordflow">if</span> ( incidence-><a class="code" href="classKCal_1_1Incidence.html#061b1b33e5105cee5a2a6db2abc04b92" title="Return the number of revisions this event has seen.">revision</a>() > 0 ) { <span class="comment">// 0 is default, so don't write that out</span> <a name="l00340"></a>00340 icalcomponent_add_property(parent,icalproperty_new_sequence( <a name="l00341"></a>00341 incidence-><a class="code" href="classKCal_1_1Incidence.html#061b1b33e5105cee5a2a6db2abc04b92" title="Return the number of revisions this event has seen.">revision</a>())); <a name="l00342"></a>00342 } <a name="l00343"></a>00343 <a name="l00344"></a>00344 <span class="comment">// last modification date</span> <a name="l00345"></a>00345 <span class="keywordflow">if</span> ( incidence-><a class="code" href="classKCal_1_1IncidenceBase.html#60acc765f657461061985b5fa96ef8ce" title="Return the time the incidence was last modified.">lastModified</a>().isValid() ) { <a name="l00346"></a>00346 icalcomponent_add_property(parent,icalproperty_new_lastmodified( <a name="l00347"></a>00347 writeICalDateTime(incidence-><a class="code" href="classKCal_1_1IncidenceBase.html#60acc765f657461061985b5fa96ef8ce" title="Return the time the incidence was last modified.">lastModified</a>()))); <a name="l00348"></a>00348 } <a name="l00349"></a>00349 <a name="l00350"></a>00350 <span class="comment">// description</span> <a name="l00351"></a>00351 <span class="keywordflow">if</span> (!incidence-><a class="code" href="classKCal_1_1Incidence.html#5614d24c09a8909b08c26c5e33918831" title="Return long description.">description</a>().isEmpty()) { <a name="l00352"></a>00352 icalcomponent_add_property(parent,icalproperty_new_description( <a name="l00353"></a>00353 incidence-><a class="code" href="classKCal_1_1Incidence.html#5614d24c09a8909b08c26c5e33918831" title="Return long description.">description</a>().utf8())); <a name="l00354"></a>00354 } <a name="l00355"></a>00355 <a name="l00356"></a>00356 <span class="comment">// summary</span> <a name="l00357"></a>00357 <span class="keywordflow">if</span> (!incidence-><a class="code" href="classKCal_1_1Incidence.html#5f6e41afa4e1b167c4b49e603506b34c" title="Return short summary.">summary</a>().isEmpty()) { <a name="l00358"></a>00358 icalcomponent_add_property(parent,icalproperty_new_summary( <a name="l00359"></a>00359 incidence-><a class="code" href="classKCal_1_1Incidence.html#5f6e41afa4e1b167c4b49e603506b34c" title="Return short summary.">summary</a>().utf8())); <a name="l00360"></a>00360 } <a name="l00361"></a>00361 <a name="l00362"></a>00362 <span class="comment">// location</span> <a name="l00363"></a>00363 <span class="keywordflow">if</span> (!incidence-><a class="code" href="classKCal_1_1Incidence.html#d147473a07f26ad738fbae9501eb1c3d" title="Return the event&#39;s/todo&#39;s location.">location</a>().isEmpty()) { <a name="l00364"></a>00364 icalcomponent_add_property(parent,icalproperty_new_location( <a name="l00365"></a>00365 incidence-><a class="code" href="classKCal_1_1Incidence.html#d147473a07f26ad738fbae9501eb1c3d" title="Return the event&#39;s/todo&#39;s location.">location</a>().utf8())); <a name="l00366"></a>00366 } <a name="l00367"></a>00367 <a name="l00368"></a>00368 <span class="comment">// status</span> <a name="l00369"></a>00369 icalproperty_status status = ICAL_STATUS_NONE; <a name="l00370"></a>00370 <span class="keywordflow">switch</span> (incidence-><a class="code" href="classKCal_1_1Incidence.html#eb9ac2fec0199604a5827e14accb7125" title="Return the event&#39;s status.">status</a>()) { <a name="l00371"></a>00371 <span class="keywordflow">case</span> Incidence::StatusTentative: status = ICAL_STATUS_TENTATIVE; <span class="keywordflow">break</span>; <a name="l00372"></a>00372 <span class="keywordflow">case</span> Incidence::StatusConfirmed: status = ICAL_STATUS_CONFIRMED; <span class="keywordflow">break</span>; <a name="l00373"></a>00373 <span class="keywordflow">case</span> Incidence::StatusCompleted: status = ICAL_STATUS_COMPLETED; <span class="keywordflow">break</span>; <a name="l00374"></a>00374 <span class="keywordflow">case</span> Incidence::StatusNeedsAction: status = ICAL_STATUS_NEEDSACTION; <span class="keywordflow">break</span>; <a name="l00375"></a>00375 <span class="keywordflow">case</span> Incidence::StatusCanceled: status = ICAL_STATUS_CANCELLED; <span class="keywordflow">break</span>; <a name="l00376"></a>00376 <span class="keywordflow">case</span> Incidence::StatusInProcess: status = ICAL_STATUS_INPROCESS; <span class="keywordflow">break</span>; <a name="l00377"></a>00377 <span class="keywordflow">case</span> Incidence::StatusDraft: status = ICAL_STATUS_DRAFT; <span class="keywordflow">break</span>; <a name="l00378"></a>00378 <span class="keywordflow">case</span> Incidence::StatusFinal: status = ICAL_STATUS_FINAL; <span class="keywordflow">break</span>; <a name="l00379"></a>00379 <span class="keywordflow">case</span> Incidence::StatusX: { <a name="l00380"></a>00380 icalproperty* p = icalproperty_new_status(ICAL_STATUS_X); <a name="l00381"></a>00381 icalvalue_set_x(icalproperty_get_value(p), incidence-><a class="code" href="classKCal_1_1Incidence.html#e6a6ecb86a42f3ae56fdd4e23dd367a7" title="Return the event&#39;s status string.">statusStr</a>().utf8()); <a name="l00382"></a>00382 icalcomponent_add_property(parent, p); <a name="l00383"></a>00383 <span class="keywordflow">break</span>; <a name="l00384"></a>00384 } <a name="l00385"></a>00385 <span class="keywordflow">case</span> Incidence::StatusNone: <a name="l00386"></a>00386 <span class="keywordflow">default</span>: <a name="l00387"></a>00387 <span class="keywordflow">break</span>; <a name="l00388"></a>00388 } <a name="l00389"></a>00389 <span class="keywordflow">if</span> (status != ICAL_STATUS_NONE) <a name="l00390"></a>00390 icalcomponent_add_property(parent, icalproperty_new_status(status)); <a name="l00391"></a>00391 <a name="l00392"></a>00392 <span class="comment">// secrecy</span> <a name="l00393"></a>00393 icalproperty_class secClass; <a name="l00394"></a>00394 <span class="keywordflow">switch</span> (incidence-><a class="code" href="classKCal_1_1Incidence.html#570732d76f1e8689d7f6dd69212f5151" title="Return the event&#39;s secrecy.">secrecy</a>()) { <a name="l00395"></a>00395 <span class="keywordflow">case</span> Incidence::SecrecyPublic: <a name="l00396"></a>00396 secClass = ICAL_CLASS_PUBLIC; <a name="l00397"></a>00397 <span class="keywordflow">break</span>; <a name="l00398"></a>00398 <span class="keywordflow">case</span> Incidence::SecrecyConfidential: <a name="l00399"></a>00399 secClass = ICAL_CLASS_CONFIDENTIAL; <a name="l00400"></a>00400 <span class="keywordflow">break</span>; <a name="l00401"></a>00401 <span class="keywordflow">case</span> Incidence::SecrecyPrivate: <a name="l00402"></a>00402 <span class="keywordflow">default</span>: <a name="l00403"></a>00403 secClass = ICAL_CLASS_PRIVATE; <a name="l00404"></a>00404 <span class="keywordflow">break</span>; <a name="l00405"></a>00405 } <a name="l00406"></a>00406 <span class="keywordflow">if</span> ( secClass != ICAL_CLASS_PUBLIC ) { <a name="l00407"></a>00407 icalcomponent_add_property(parent,icalproperty_new_class(secClass)); <a name="l00408"></a>00408 } <a name="l00409"></a>00409 <a name="l00410"></a>00410 <span class="comment">// priority</span> <a name="l00411"></a>00411 <span class="keywordflow">if</span> ( incidence-><a class="code" href="classKCal_1_1Incidence.html#cbd216cda3ea9d86ee12252e98da6d0b" title="Return priority.">priority</a>() > 0 ) { <span class="comment">// 0 is undefined priority</span> <a name="l00412"></a>00412 icalcomponent_add_property(parent,icalproperty_new_priority( <a name="l00413"></a>00413 incidence-><a class="code" href="classKCal_1_1Incidence.html#cbd216cda3ea9d86ee12252e98da6d0b" title="Return priority.">priority</a>())); <a name="l00414"></a>00414 } <a name="l00415"></a>00415 <a name="l00416"></a>00416 <span class="comment">// categories</span> <a name="l00417"></a>00417 QStringList categories = incidence-><a class="code" href="classKCal_1_1Incidence.html#4eae9f79708ab85745dc6fdea51afb76" title="Return categories as a list of strings.">categories</a>(); <a name="l00418"></a>00418 QStringList::Iterator it; <a name="l00419"></a>00419 <span class="keywordflow">for</span>(it = categories.begin(); it != categories.end(); ++it ) { <a name="l00420"></a>00420 icalcomponent_add_property(parent,icalproperty_new_categories((*it).utf8())); <a name="l00421"></a>00421 } <a name="l00422"></a>00422 <a name="l00423"></a>00423 <span class="comment">// related event</span> <a name="l00424"></a>00424 <span class="keywordflow">if</span> ( !incidence-><a class="code" href="classKCal_1_1Incidence.html#26733e87a3cce01b792667febe752f4d" title="What event does this one relate to? This function should only be used when constructing...">relatedToUid</a>().isEmpty() ) { <a name="l00425"></a>00425 icalcomponent_add_property(parent,icalproperty_new_relatedto( <a name="l00426"></a>00426 incidence-><a class="code" href="classKCal_1_1Incidence.html#26733e87a3cce01b792667febe752f4d" title="What event does this one relate to? This function should only be used when constructing...">relatedToUid</a>().utf8())); <a name="l00427"></a>00427 } <a name="l00428"></a>00428 <a name="l00429"></a>00429 <span class="comment">// kdDebug(5800) << "Write recurrence for '" << incidence->summary() << "' (" << incidence->uid()</span> <a name="l00430"></a>00430 <span class="comment">// << ")" << endl;</span> <a name="l00431"></a>00431 <a name="l00432"></a>00432 <a class="code" href="classKCal_1_1ListBase.html" title="This class provides a template for lists of pointers.">RecurrenceRule::List</a> rrules( incidence-><a class="code" href="classKCal_1_1Incidence.html#d06004593e064a37d08c96f9ae16735e" title="Return the recurrence rule associated with this incidence.">recurrence</a>()-><a class="code" href="classKCal_1_1Recurrence.html#29a845d31363526f112ea25df4ee9549">rRules</a>() ); <a name="l00433"></a>00433 RecurrenceRule::List::ConstIterator rit; <a name="l00434"></a>00434 <span class="keywordflow">for</span> ( rit = rrules.begin(); rit != rrules.end(); ++rit ) { <a name="l00435"></a>00435 icalcomponent_add_property( parent, icalproperty_new_rrule( <a name="l00436"></a>00436 writeRecurrenceRule( (*rit) ) ) ); <a name="l00437"></a>00437 } <a name="l00438"></a>00438 <a name="l00439"></a>00439 <a class="code" href="classKCal_1_1ListBase.html" title="This class provides a template for lists of pointers.">RecurrenceRule::List</a> exrules( incidence-><a class="code" href="classKCal_1_1Incidence.html#d06004593e064a37d08c96f9ae16735e" title="Return the recurrence rule associated with this incidence.">recurrence</a>()-><a class="code" href="classKCal_1_1Recurrence.html#6c40d624283459fc11273c72ecaddbb3">exRules</a>() ); <a name="l00440"></a>00440 RecurrenceRule::List::ConstIterator exit; <a name="l00441"></a>00441 <span class="keywordflow">for</span> ( exit = exrules.begin(); exit != exrules.end(); ++exit ) { <a name="l00442"></a>00442 icalcomponent_add_property( parent, icalproperty_new_rrule( <a name="l00443"></a>00443 writeRecurrenceRule( (*exit) ) ) ); <a name="l00444"></a>00444 } <a name="l00445"></a>00445 <a name="l00446"></a>00446 DateList dateList = incidence-><a class="code" href="classKCal_1_1Incidence.html#d06004593e064a37d08c96f9ae16735e" title="Return the recurrence rule associated with this incidence.">recurrence</a>()-><a class="code" href="classKCal_1_1Recurrence.html#28c3518b42b842b6f360f6d397ca949a">exDates</a>(); <a name="l00447"></a>00447 DateList::ConstIterator exIt; <a name="l00448"></a>00448 <span class="keywordflow">for</span>(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) { <a name="l00449"></a>00449 icalcomponent_add_property(parent,icalproperty_new_exdate( <a name="l00450"></a>00450 writeICalDate(*exIt))); <a name="l00451"></a>00451 } <a name="l00452"></a>00452 DateTimeList dateTimeList = incidence-><a class="code" href="classKCal_1_1Incidence.html#d06004593e064a37d08c96f9ae16735e" title="Return the recurrence rule associated with this incidence.">recurrence</a>()-><a class="code" href="classKCal_1_1Recurrence.html#e85fcdf3d0bf4c61e2321075e60b9205">exDateTimes</a>(); <a name="l00453"></a>00453 DateTimeList::ConstIterator extIt; <a name="l00454"></a>00454 <span class="keywordflow">for</span>(extIt = dateTimeList.begin(); extIt != dateTimeList.end(); ++extIt) { <a name="l00455"></a>00455 icalcomponent_add_property(parent,icalproperty_new_exdate( <a name="l00456"></a>00456 writeICalDateTime(*extIt))); <a name="l00457"></a>00457 } <a name="l00458"></a>00458 <a name="l00459"></a>00459 <a name="l00460"></a>00460 dateList = incidence-><a class="code" href="classKCal_1_1Incidence.html#d06004593e064a37d08c96f9ae16735e" title="Return the recurrence rule associated with this incidence.">recurrence</a>()-><a class="code" href="classKCal_1_1Recurrence.html#eff9abfe6700af02ff5b87f447216f27">rDates</a>(); <a name="l00461"></a>00461 DateList::ConstIterator rdIt; <a name="l00462"></a>00462 <span class="keywordflow">for</span>( rdIt = dateList.begin(); rdIt != dateList.end(); ++rdIt) { <a name="l00463"></a>00463 icalcomponent_add_property( parent, icalproperty_new_rdate( <a name="l00464"></a>00464 writeICalDatePeriod(*rdIt) ) ); <a name="l00465"></a>00465 } <a name="l00466"></a>00466 dateTimeList = incidence-><a class="code" href="classKCal_1_1Incidence.html#d06004593e064a37d08c96f9ae16735e" title="Return the recurrence rule associated with this incidence.">recurrence</a>()-><a class="code" href="classKCal_1_1Recurrence.html#f821ee312fe343ec0192d056685f791b">rDateTimes</a>(); <a name="l00467"></a>00467 DateTimeList::ConstIterator rdtIt; <a name="l00468"></a>00468 <span class="keywordflow">for</span>( rdtIt = dateTimeList.begin(); rdtIt != dateTimeList.end(); ++rdtIt) { <a name="l00469"></a>00469 icalcomponent_add_property( parent, icalproperty_new_rdate( <a name="l00470"></a>00470 writeICalDateTimePeriod(*rdtIt) ) ); <a name="l00471"></a>00471 } <a name="l00472"></a>00472 <a name="l00473"></a>00473 <span class="comment">// attachments</span> <a name="l00474"></a>00474 Attachment::List attachments = incidence-><a class="code" href="classKCal_1_1Incidence.html#dfc4bb0127ecf371c0707fed9eb21e3e" title="Return list of all associated attachments.">attachments</a>(); <a name="l00475"></a>00475 Attachment::List::ConstIterator atIt; <a name="l00476"></a>00476 <span class="keywordflow">for</span> ( atIt = attachments.begin(); atIt != attachments.end(); ++atIt ) { <a name="l00477"></a>00477 icalcomponent_add_property( parent, writeAttachment( *atIt ) ); <a name="l00478"></a>00478 } <a name="l00479"></a>00479 <a name="l00480"></a>00480 <span class="comment">// alarms</span> <a name="l00481"></a>00481 Alarm::List::ConstIterator alarmIt; <a name="l00482"></a>00482 <span class="keywordflow">for</span> ( alarmIt = incidence-><a class="code" href="classKCal_1_1Incidence.html#33727cd753dde462c0995d5a4f1ea40c" title="All alarms that are associated with this incidence.">alarms</a>().begin(); <a name="l00483"></a>00483 alarmIt != incidence-><a class="code" href="classKCal_1_1Incidence.html#33727cd753dde462c0995d5a4f1ea40c" title="All alarms that are associated with this incidence.">alarms</a>().end(); ++alarmIt ) { <a name="l00484"></a>00484 <span class="keywordflow">if</span> ( (*alarmIt)->enabled() ) { <a name="l00485"></a>00485 <span class="comment">// kdDebug(5800) << "Write alarm for " << incidence->summary() << endl;</span> <a name="l00486"></a>00486 icalcomponent_add_component( parent, writeAlarm( *alarmIt ) ); <a name="l00487"></a>00487 } <a name="l00488"></a>00488 } <a name="l00489"></a>00489 <a name="l00490"></a>00490 <span class="comment">// duration</span> <a name="l00491"></a>00491 <span class="keywordflow">if</span> (incidence-><a class="code" href="classKCal_1_1IncidenceBase.html#7844622636734bc897ac178b321508c5">hasDuration</a>()) { <a name="l00492"></a>00492 icaldurationtype duration; <a name="l00493"></a>00493 duration = writeICalDuration( incidence-><a class="code" href="classKCal_1_1IncidenceBase.html#04f66508fc691fd7f05dde109eab1254">duration</a>() ); <a name="l00494"></a>00494 icalcomponent_add_property(parent,icalproperty_new_duration(duration)); <a name="l00495"></a>00495 } <a name="l00496"></a>00496 } <a name="l00497"></a>00497 <a name="l00498"></a>00498 <span class="keywordtype">void</span> ICalFormatImpl::writeIncidenceBase( icalcomponent *parent, <a name="l00499"></a>00499 <a class="code" href="classKCal_1_1IncidenceBase.html" title="This class provides the base class common to all calendar components.">IncidenceBase</a> * incidenceBase ) <a name="l00500"></a>00500 { <a name="l00501"></a>00501 icalcomponent_add_property( parent, icalproperty_new_dtstamp( <a name="l00502"></a>00502 writeICalDateTime( QDateTime::currentDateTime() ) ) ); <a name="l00503"></a>00503 <a name="l00504"></a>00504 <span class="comment">// organizer stuff</span> <a name="l00505"></a>00505 <span class="keywordflow">if</span> ( !incidenceBase-><a class="code" href="classKCal_1_1IncidenceBase.html#eb4c2be5ce3f3961dc10204fbc5206a7">organizer</a>().<a class="code" href="classKCal_1_1Person.html#518b8f369213cf81edf1be2f68110556">isEmpty</a>() ) { <a name="l00506"></a>00506 icalcomponent_add_property( parent, writeOrganizer( incidenceBase-><a class="code" href="classKCal_1_1IncidenceBase.html#eb4c2be5ce3f3961dc10204fbc5206a7">organizer</a>() ) ); <a name="l00507"></a>00507 } <a name="l00508"></a>00508 <a name="l00509"></a>00509 <span class="comment">// attendees</span> <a name="l00510"></a>00510 <span class="keywordflow">if</span> ( incidenceBase-><a class="code" href="classKCal_1_1IncidenceBase.html#24b54bf623c725751eef25ce0f45aa73" title="Return number of attendees.">attendeeCount</a>() > 0 ) { <a name="l00511"></a>00511 Attendee::List::ConstIterator it; <a name="l00512"></a>00512 <span class="keywordflow">for</span>( it = incidenceBase-><a class="code" href="classKCal_1_1IncidenceBase.html#df4df93778bfab1d165580946320b0de" title="Return list of attendees.">attendees</a>().begin(); <a name="l00513"></a>00513 it != incidenceBase-><a class="code" href="classKCal_1_1IncidenceBase.html#df4df93778bfab1d165580946320b0de" title="Return list of attendees.">attendees</a>().end(); ++it ) { <a name="l00514"></a>00514 icalcomponent_add_property( parent, writeAttendee( *it ) ); <a name="l00515"></a>00515 } <a name="l00516"></a>00516 } <a name="l00517"></a>00517 <a name="l00518"></a>00518 <span class="comment">// comments</span> <a name="l00519"></a>00519 QStringList comments = incidenceBase-><a class="code" href="classKCal_1_1IncidenceBase.html#416db24cfef787a1965ae90c7855776b" title="Return all comments associated with this incidence.">comments</a>(); <a name="l00520"></a>00520 <span class="keywordflow">for</span> (QStringList::Iterator it=comments.begin(); it!=comments.end(); ++it) { <a name="l00521"></a>00521 icalcomponent_add_property(parent, icalproperty_new_comment((*it).utf8())); <a name="l00522"></a>00522 } <a name="l00523"></a>00523 <a name="l00524"></a>00524 <span class="comment">// custom properties</span> <a name="l00525"></a>00525 writeCustomProperties( parent, incidenceBase ); <a name="l00526"></a>00526 } <a name="l00527"></a>00527 <a name="l00528"></a>00528 <span class="keywordtype">void</span> ICalFormatImpl::writeCustomProperties(icalcomponent *parent,<a class="code" href="classKCal_1_1CustomProperties.html" title="This class represents custom calendar properties.">CustomProperties</a> *properties) <a name="l00529"></a>00529 { <a name="l00530"></a>00530 QMap<QCString, QString> custom = properties-><a class="code" href="classKCal_1_1CustomProperties.html#19ed307800204c4938aa9c4dcff3a0a4" title="Return all custom calendar property key/value pairs.">customProperties</a>(); <a name="l00531"></a>00531 <span class="keywordflow">for</span> (QMap<QCString, QString>::Iterator c = custom.begin(); c != custom.end(); ++c) { <a name="l00532"></a>00532 icalproperty *p = icalproperty_new_x(c.data().utf8()); <a name="l00533"></a>00533 icalproperty_set_x_name(p,c.key()); <a name="l00534"></a>00534 icalcomponent_add_property(parent,p); <a name="l00535"></a>00535 } <a name="l00536"></a>00536 } <a name="l00537"></a>00537 <a name="l00538"></a>00538 icalproperty *ICalFormatImpl::writeOrganizer( <span class="keyword">const</span> <a class="code" href="classKCal_1_1Person.html" title="This class represents a person.">Person</a> &organizer ) <a name="l00539"></a>00539 { <a name="l00540"></a>00540 icalproperty *p = icalproperty_new_organizer(<span class="stringliteral">"MAILTO:"</span> + organizer.<a class="code" href="classKCal_1_1Person.html#b998a684c9d50625dead81ec3f18698c">email</a>().utf8()); <a name="l00541"></a>00541 <a name="l00542"></a>00542 <span class="keywordflow">if</span> (!organizer.<a class="code" href="classKCal_1_1Person.html#728effd37c750fe1196c063ca7c7e2be">name</a>().isEmpty()) { <a name="l00543"></a>00543 icalproperty_add_parameter( p, icalparameter_new_cn(organizer.<a class="code" href="classKCal_1_1Person.html#728effd37c750fe1196c063ca7c7e2be">name</a>().utf8()) ); <a name="l00544"></a>00544 } <a name="l00545"></a>00545 <span class="comment">// TODO: Write dir, sent-by and language</span> <a name="l00546"></a>00546 <a name="l00547"></a>00547 <span class="keywordflow">return</span> p; <a name="l00548"></a>00548 } <a name="l00549"></a>00549 <a name="l00550"></a>00550 <a name="l00551"></a>00551 icalproperty *ICalFormatImpl::writeAttendee(<a class="code" href="classKCal_1_1Attendee.html" title="This class represents information related to an attendee of an event.">Attendee</a> *attendee) <a name="l00552"></a>00552 { <a name="l00553"></a>00553 icalproperty *p = icalproperty_new_attendee(<span class="stringliteral">"mailto:"</span> + attendee-><a class="code" href="classKCal_1_1Person.html#b998a684c9d50625dead81ec3f18698c">email</a>().utf8()); <a name="l00554"></a>00554 <a name="l00555"></a>00555 <span class="keywordflow">if</span> (!attendee-><a class="code" href="classKCal_1_1Person.html#728effd37c750fe1196c063ca7c7e2be">name</a>().isEmpty()) { <a name="l00556"></a>00556 icalproperty_add_parameter(p,icalparameter_new_cn(attendee-><a class="code" href="classKCal_1_1Person.html#728effd37c750fe1196c063ca7c7e2be">name</a>().utf8())); <a name="l00557"></a>00557 } <a name="l00558"></a>00558 <a name="l00559"></a>00559 <a name="l00560"></a>00560 icalproperty_add_parameter(p,icalparameter_new_rsvp( <a name="l00561"></a>00561 attendee-><a class="code" href="classKCal_1_1Attendee.html#119aba1c943a1174278fbb3f97788888" title="Return, if Attendee is asked to reply.">RSVP</a>() ? ICAL_RSVP_TRUE : ICAL_RSVP_FALSE )); <a name="l00562"></a>00562 <a name="l00563"></a>00563 icalparameter_partstat status = ICAL_PARTSTAT_NEEDSACTION; <a name="l00564"></a>00564 <span class="keywordflow">switch</span> (attendee-><a class="code" href="classKCal_1_1Attendee.html#72768a7d915adf124527e51e200286ee" title="Return status.">status</a>()) { <a name="l00565"></a>00565 <span class="keywordflow">default</span>: <a name="l00566"></a>00566 <span class="keywordflow">case</span> Attendee::NeedsAction: <a name="l00567"></a>00567 status = ICAL_PARTSTAT_NEEDSACTION; <a name="l00568"></a>00568 <span class="keywordflow">break</span>; <a name="l00569"></a>00569 <span class="keywordflow">case</span> Attendee::Accepted: <a name="l00570"></a>00570 status = ICAL_PARTSTAT_ACCEPTED; <a name="l00571"></a>00571 <span class="keywordflow">break</span>; <a name="l00572"></a>00572 <span class="keywordflow">case</span> Attendee::Declined: <a name="l00573"></a>00573 status = ICAL_PARTSTAT_DECLINED; <a name="l00574"></a>00574 <span class="keywordflow">break</span>; <a name="l00575"></a>00575 <span class="keywordflow">case</span> Attendee::Tentative: <a name="l00576"></a>00576 status = ICAL_PARTSTAT_TENTATIVE; <a name="l00577"></a>00577 <span class="keywordflow">break</span>; <a name="l00578"></a>00578 <span class="keywordflow">case</span> Attendee::Delegated: <a name="l00579"></a>00579 status = ICAL_PARTSTAT_DELEGATED; <a name="l00580"></a>00580 <span class="keywordflow">break</span>; <a name="l00581"></a>00581 <span class="keywordflow">case</span> Attendee::Completed: <a name="l00582"></a>00582 status = ICAL_PARTSTAT_COMPLETED; <a name="l00583"></a>00583 <span class="keywordflow">break</span>; <a name="l00584"></a>00584 <span class="keywordflow">case</span> Attendee::InProcess: <a name="l00585"></a>00585 status = ICAL_PARTSTAT_INPROCESS; <a name="l00586"></a>00586 <span class="keywordflow">break</span>; <a name="l00587"></a>00587 } <a name="l00588"></a>00588 icalproperty_add_parameter(p,icalparameter_new_partstat(status)); <a name="l00589"></a>00589 <a name="l00590"></a>00590 icalparameter_role role = ICAL_ROLE_REQPARTICIPANT; <a name="l00591"></a>00591 <span class="keywordflow">switch</span> (attendee-><a class="code" href="classKCal_1_1Attendee.html#a600da8ac77943ee97a735f6288834c6" title="Return role of Attendee.">role</a>()) { <a name="l00592"></a>00592 <span class="keywordflow">case</span> Attendee::Chair: <a name="l00593"></a>00593 role = ICAL_ROLE_CHAIR; <a name="l00594"></a>00594 <span class="keywordflow">break</span>; <a name="l00595"></a>00595 <span class="keywordflow">default</span>: <a name="l00596"></a>00596 <span class="keywordflow">case</span> Attendee::ReqParticipant: <a name="l00597"></a>00597 role = ICAL_ROLE_REQPARTICIPANT; <a name="l00598"></a>00598 <span class="keywordflow">break</span>; <a name="l00599"></a>00599 <span class="keywordflow">case</span> Attendee::OptParticipant: <a name="l00600"></a>00600 role = ICAL_ROLE_OPTPARTICIPANT; <a name="l00601"></a>00601 <span class="keywordflow">break</span>; <a name="l00602"></a>00602 <span class="keywordflow">case</span> Attendee::NonParticipant: <a name="l00603"></a>00603 role = ICAL_ROLE_NONPARTICIPANT; <a name="l00604"></a>00604 <span class="keywordflow">break</span>; <a name="l00605"></a>00605 } <a name="l00606"></a>00606 icalproperty_add_parameter(p,icalparameter_new_role(role)); <a name="l00607"></a>00607 <a name="l00608"></a>00608 <span class="keywordflow">if</span> (!attendee-><a class="code" href="classKCal_1_1Attendee.html#bb9d8bb1b67207c717c5e872836c7688" title="Return unique id of the attendee.">uid</a>().isEmpty()) { <a name="l00609"></a>00609 icalparameter* icalparameter_uid = icalparameter_new_x(attendee-><a class="code" href="classKCal_1_1Attendee.html#bb9d8bb1b67207c717c5e872836c7688" title="Return unique id of the attendee.">uid</a>().utf8()); <a name="l00610"></a>00610 icalparameter_set_xname(icalparameter_uid,<span class="stringliteral">"X-UID"</span>); <a name="l00611"></a>00611 icalproperty_add_parameter(p,icalparameter_uid); <a name="l00612"></a>00612 } <a name="l00613"></a>00613 <a name="l00614"></a>00614 <span class="keywordflow">if</span> ( !attendee-><a class="code" href="classKCal_1_1Attendee.html#ef41d5c9a34d29ef7260158a891c5bc1" title="Returns the delegate.">delegate</a>().isEmpty() ) { <a name="l00615"></a>00615 icalparameter* icalparameter_delegate = icalparameter_new_delegatedto( attendee-><a class="code" href="classKCal_1_1Attendee.html#ef41d5c9a34d29ef7260158a891c5bc1" title="Returns the delegate.">delegate</a>().utf8() ); <a name="l00616"></a>00616 icalproperty_add_parameter( p, icalparameter_delegate ); <a name="l00617"></a>00617 } <a name="l00618"></a>00618 <a name="l00619"></a>00619 <span class="keywordflow">if</span> ( !attendee-><a class="code" href="classKCal_1_1Attendee.html#6e353bbfe35df6df4c577c480ff639c9" title="Returns the delegator.">delegator</a>().isEmpty() ) { <a name="l00620"></a>00620 icalparameter* icalparameter_delegator = icalparameter_new_delegatedfrom( attendee-><a class="code" href="classKCal_1_1Attendee.html#6e353bbfe35df6df4c577c480ff639c9" title="Returns the delegator.">delegator</a>().utf8() ); <a name="l00621"></a>00621 icalproperty_add_parameter( p, icalparameter_delegator ); <a name="l00622"></a>00622 } <a name="l00623"></a>00623 <a name="l00624"></a>00624 <span class="keywordflow">return</span> p; <a name="l00625"></a>00625 } <a name="l00626"></a>00626 <a name="l00627"></a>00627 icalproperty *ICalFormatImpl::writeAttachment(<a class="code" href="classKCal_1_1Attachment.html" title="This class represents information related to an attachment.">Attachment</a> *att) <a name="l00628"></a>00628 { <a name="l00629"></a>00629 icalattach *attach; <a name="l00630"></a>00630 <span class="keywordflow">if</span> (att-><a class="code" href="classKCal_1_1Attachment.html#2202bb03d3423b293a01044fea0a30ff">isUri</a>()) <a name="l00631"></a>00631 attach = icalattach_new_from_url( att-><a class="code" href="classKCal_1_1Attachment.html#cd2fcbd1044cfc8079567f42d152f75c">uri</a>().utf8().data()); <a name="l00632"></a>00632 <span class="keywordflow">else</span> <a name="l00633"></a>00633 attach = icalattach_new_from_data ( (<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *)att-><a class="code" href="classKCal_1_1Attachment.html#a48c0b6d115afa9df0ef3afe8bf2746a">data</a>(), 0, 0); <a name="l00634"></a>00634 icalproperty *p = icalproperty_new_attach(attach); <a name="l00635"></a>00635 <a name="l00636"></a>00636 <span class="keywordflow">if</span> ( !att-><a class="code" href="classKCal_1_1Attachment.html#b4995a82a11b6ad6f6707de5d1c5fa46">mimeType</a>().isEmpty() ) { <a name="l00637"></a>00637 icalproperty_add_parameter( p, <a name="l00638"></a>00638 icalparameter_new_fmttype( att-><a class="code" href="classKCal_1_1Attachment.html#b4995a82a11b6ad6f6707de5d1c5fa46">mimeType</a>().utf8().data() ) ); <a name="l00639"></a>00639 } <a name="l00640"></a>00640 <a name="l00641"></a>00641 <span class="keywordflow">if</span> ( att-><a class="code" href="classKCal_1_1Attachment.html#c039f9bd5001abc2b9e7c2f70438da09">isBinary</a>() ) { <a name="l00642"></a>00642 icalproperty_add_parameter( p, <a name="l00643"></a>00643 icalparameter_new_value( ICAL_VALUE_BINARY ) ); <a name="l00644"></a>00644 icalproperty_add_parameter( p, <a name="l00645"></a>00645 icalparameter_new_encoding( ICAL_ENCODING_BASE64 ) ); <a name="l00646"></a>00646 } <a name="l00647"></a>00647 <a name="l00648"></a>00648 <span class="keywordflow">if</span> ( att-><a class="code" href="classKCal_1_1Attachment.html#e93f8f2075e3b81ccde702604c33ece8">showInline</a>() ) { <a name="l00649"></a>00649 icalparameter* icalparameter_inline = icalparameter_new_x( <span class="stringliteral">"inline"</span> ); <a name="l00650"></a>00650 icalparameter_set_xname( icalparameter_inline, <span class="stringliteral">"X-CONTENT-DISPOSITION"</span> ); <a name="l00651"></a>00651 icalproperty_add_parameter( p, icalparameter_inline ); <a name="l00652"></a>00652 } <a name="l00653"></a>00653 <a name="l00654"></a>00654 <span class="keywordflow">if</span> ( !att-><a class="code" href="classKCal_1_1Attachment.html#ddca313b87678218504f91c6cd211699">label</a>().isEmpty() ) { <a name="l00655"></a>00655 icalparameter* icalparameter_label = icalparameter_new_x( att-><a class="code" href="classKCal_1_1Attachment.html#ddca313b87678218504f91c6cd211699">label</a>().utf8() ); <a name="l00656"></a>00656 icalparameter_set_xname( icalparameter_label, <span class="stringliteral">"X-LABEL"</span> ); <a name="l00657"></a>00657 icalproperty_add_parameter( p, icalparameter_label ); <a name="l00658"></a>00658 } <a name="l00659"></a>00659 <a name="l00660"></a>00660 <span class="keywordflow">return</span> p; <a name="l00661"></a>00661 } <a name="l00662"></a>00662 <a name="l00663"></a>00663 icalrecurrencetype ICalFormatImpl::writeRecurrenceRule( <a class="code" href="classKCal_1_1RecurrenceRule.html" title="This class represents a recurrence rule for a calendar incidence.">RecurrenceRule</a> *recur ) <a name="l00664"></a>00664 { <a name="l00665"></a>00665 <span class="comment">// kdDebug(5800) << "ICalFormatImpl::writeRecurrenceRule()" << endl;</span> <a name="l00666"></a>00666 <a name="l00667"></a>00667 icalrecurrencetype r; <a name="l00668"></a>00668 icalrecurrencetype_clear(&r); <a name="l00669"></a>00669 <a name="l00670"></a>00670 <span class="keywordflow">switch</span>( recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#a20a34dfcf4a965f4ac24639bec32ac4">recurrenceType</a>() ) { <a name="l00671"></a>00671 <span class="keywordflow">case</span> RecurrenceRule::rSecondly: <a name="l00672"></a>00672 r.freq = ICAL_SECONDLY_RECURRENCE; <a name="l00673"></a>00673 <span class="keywordflow">break</span>; <a name="l00674"></a>00674 <span class="keywordflow">case</span> RecurrenceRule::rMinutely: <a name="l00675"></a>00675 r.freq = ICAL_MINUTELY_RECURRENCE; <a name="l00676"></a>00676 <span class="keywordflow">break</span>; <a name="l00677"></a>00677 <span class="keywordflow">case</span> RecurrenceRule::rHourly: <a name="l00678"></a>00678 r.freq = ICAL_HOURLY_RECURRENCE; <a name="l00679"></a>00679 <span class="keywordflow">break</span>; <a name="l00680"></a>00680 <span class="keywordflow">case</span> RecurrenceRule::rDaily: <a name="l00681"></a>00681 r.freq = ICAL_DAILY_RECURRENCE; <a name="l00682"></a>00682 <span class="keywordflow">break</span>; <a name="l00683"></a>00683 <span class="keywordflow">case</span> RecurrenceRule::rWeekly: <a name="l00684"></a>00684 r.freq = ICAL_WEEKLY_RECURRENCE; <a name="l00685"></a>00685 <span class="keywordflow">break</span>; <a name="l00686"></a>00686 <span class="keywordflow">case</span> RecurrenceRule::rMonthly: <a name="l00687"></a>00687 r.freq = ICAL_MONTHLY_RECURRENCE; <a name="l00688"></a>00688 <span class="keywordflow">break</span>; <a name="l00689"></a>00689 <span class="keywordflow">case</span> RecurrenceRule::rYearly: <a name="l00690"></a>00690 r.freq = ICAL_YEARLY_RECURRENCE; <a name="l00691"></a>00691 <span class="keywordflow">break</span>; <a name="l00692"></a>00692 <span class="keywordflow">default</span>: <a name="l00693"></a>00693 r.freq = ICAL_NO_RECURRENCE; <a name="l00694"></a>00694 kdDebug(5800) << <span class="stringliteral">"ICalFormatImpl::writeRecurrence(): no recurrence"</span> << endl; <a name="l00695"></a>00695 <span class="keywordflow">break</span>; <a name="l00696"></a>00696 } <a name="l00697"></a>00697 <a name="l00698"></a>00698 <span class="keywordtype">int</span> index = 0; <a name="l00699"></a>00699 QValueList<int> bys; <a name="l00700"></a>00700 QValueList<int>::ConstIterator it; <a name="l00701"></a>00701 <a name="l00702"></a>00702 <span class="comment">// Now write out the BY* parts:</span> <a name="l00703"></a>00703 bys = recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#fd161bc040f80746421c81b154e70219">bySeconds</a>(); <a name="l00704"></a>00704 index = 0; <a name="l00705"></a>00705 <span class="keywordflow">for</span> ( it = bys.begin(); it != bys.end(); ++it ) { <a name="l00706"></a>00706 r.by_second[index++] = *it; <a name="l00707"></a>00707 } <a name="l00708"></a>00708 <a name="l00709"></a>00709 bys = recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#dc1c95b287660de4d39cbcf1e6c62b8b">byMinutes</a>(); <a name="l00710"></a>00710 index = 0; <a name="l00711"></a>00711 <span class="keywordflow">for</span> ( it = bys.begin(); it != bys.end(); ++it ) { <a name="l00712"></a>00712 r.by_minute[index++] = *it; <a name="l00713"></a>00713 } <a name="l00714"></a>00714 <a name="l00715"></a>00715 bys = recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#32d12dc6a6f9ec37a90d2fb80ea803c4">byHours</a>(); <a name="l00716"></a>00716 index = 0; <a name="l00717"></a>00717 <span class="keywordflow">for</span> ( it = bys.begin(); it != bys.end(); ++it ) { <a name="l00718"></a>00718 r.by_hour[index++] = *it; <a name="l00719"></a>00719 } <a name="l00720"></a>00720 <a name="l00721"></a>00721 bys = recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#1a28057039ca6cd7149bb112293a977d">byMonthDays</a>(); <a name="l00722"></a>00722 index = 0; <a name="l00723"></a>00723 <span class="keywordflow">for</span> ( it = bys.begin(); it != bys.end(); ++it ) { <a name="l00724"></a>00724 r.by_month_day[index++] = icalrecurrencetype_day_position( (*it) * 8 ); <a name="l00725"></a>00725 } <a name="l00726"></a>00726 <a name="l00727"></a>00727 bys = recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#28e47d6bc4c92328fe433c9f3a21c309">byYearDays</a>(); <a name="l00728"></a>00728 index = 0; <a name="l00729"></a>00729 <span class="keywordflow">for</span> ( it = bys.begin(); it != bys.end(); ++it ) { <a name="l00730"></a>00730 r.by_year_day[index++] = *it; <a name="l00731"></a>00731 } <a name="l00732"></a>00732 <a name="l00733"></a>00733 bys = recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#b4b1c99d7a452c629c4d65f6c02843f1">byWeekNumbers</a>(); <a name="l00734"></a>00734 index = 0; <a name="l00735"></a>00735 <span class="keywordflow">for</span> ( it = bys.begin(); it != bys.end(); ++it ) { <a name="l00736"></a>00736 r.by_week_no[index++] = *it; <a name="l00737"></a>00737 } <a name="l00738"></a>00738 <a name="l00739"></a>00739 bys = recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#9e8f0ea21caa68650d71a0647a1faa95">byMonths</a>(); <a name="l00740"></a>00740 index = 0; <a name="l00741"></a>00741 <span class="keywordflow">for</span> ( it = bys.begin(); it != bys.end(); ++it ) { <a name="l00742"></a>00742 r.by_month[index++] = *it; <a name="l00743"></a>00743 } <a name="l00744"></a>00744 <a name="l00745"></a>00745 bys = recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#cf0e4b75cc5001d974361a5f2713ccbc">bySetPos</a>(); <a name="l00746"></a>00746 index = 0; <a name="l00747"></a>00747 <span class="keywordflow">for</span> ( it = bys.begin(); it != bys.end(); ++it ) { <a name="l00748"></a>00748 r.by_set_pos[index++] = *it; <a name="l00749"></a>00749 } <a name="l00750"></a>00750 <a name="l00751"></a>00751 <a name="l00752"></a>00752 QValueList<RecurrenceRule::WDayPos> byd = recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#289dd3a660bb185b042bbc548c7a0abe">byDays</a>(); <a name="l00753"></a>00753 <span class="keywordtype">int</span> day; <a name="l00754"></a>00754 index = 0; <a name="l00755"></a>00755 <span class="keywordflow">for</span> ( QValueList<RecurrenceRule::WDayPos>::ConstIterator dit = byd.begin(); <a name="l00756"></a>00756 dit != byd.end(); ++dit ) { <a name="l00757"></a>00757 day = (*dit).day() % 7 + 1; <span class="comment">// convert from Monday=1 to Sunday=1</span> <a name="l00758"></a>00758 <span class="keywordflow">if</span> ( (*dit).pos() < 0 ) { <a name="l00759"></a>00759 day += (-(*dit).pos())*8; <a name="l00760"></a>00760 day = -day; <a name="l00761"></a>00761 } <span class="keywordflow">else</span> { <a name="l00762"></a>00762 day += (*dit).pos()*8; <a name="l00763"></a>00763 } <a name="l00764"></a>00764 r.by_day[index++] = day; <a name="l00765"></a>00765 } <a name="l00766"></a>00766 <a name="l00767"></a>00767 r.week_start = <span class="keyword">static_cast<</span>icalrecurrencetype_weekday<span class="keyword">></span>( <a name="l00768"></a>00768 recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#d754da5da75f11756c42a9abc53f9884">weekStart</a>()%7 + 1); <a name="l00769"></a>00769 <a name="l00770"></a>00770 <span class="keywordflow">if</span> ( recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#fbc5baf7391035f00297190d63f29e0b" title="Returns frequency of recurrence, in terms of the recurrence time period type.">frequency</a>() > 1 ) { <a name="l00771"></a>00771 <span class="comment">// Dont' write out INTERVAL=1, because that's the default anyway</span> <a name="l00772"></a>00772 r.interval = recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#fbc5baf7391035f00297190d63f29e0b" title="Returns frequency of recurrence, in terms of the recurrence time period type.">frequency</a>(); <a name="l00773"></a>00773 } <a name="l00774"></a>00774 <a name="l00775"></a>00775 <span class="keywordflow">if</span> ( recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#6e56f222c2940c4577e73dba47d300d3" title="Returns -1 if the event recurs infinitely, 0 if the end date is set, otherwise the...">duration</a>() > 0 ) { <a name="l00776"></a>00776 r.count = recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#6e56f222c2940c4577e73dba47d300d3" title="Returns -1 if the event recurs infinitely, 0 if the end date is set, otherwise the...">duration</a>(); <a name="l00777"></a>00777 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#6e56f222c2940c4577e73dba47d300d3" title="Returns -1 if the event recurs infinitely, 0 if the end date is set, otherwise the...">duration</a>() == -1 ) { <a name="l00778"></a>00778 r.count = 0; <a name="l00779"></a>00779 } <span class="keywordflow">else</span> { <a name="l00780"></a>00780 <span class="keywordflow">if</span> ( recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#1c1410f7aba825460d38844fc55a8e86" title="Returns whether the start date has no time associated.">doesFloat</a>() ) <a name="l00781"></a>00781 r.until = writeICalDate(recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#6949836f246e298e23e9140dbb406954" title="Returns the date and time of the last recurrence.">endDt</a>().date()); <a name="l00782"></a>00782 <span class="keywordflow">else</span> <a name="l00783"></a>00783 r.until = writeICalDateTime(recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#6949836f246e298e23e9140dbb406954" title="Returns the date and time of the last recurrence.">endDt</a>()); <a name="l00784"></a>00784 } <a name="l00785"></a>00785 <a name="l00786"></a>00786 <span class="comment">// Debug output</span> <a name="l00787"></a>00787 <span class="preprocessor">#if 0</span> <a name="l00788"></a>00788 <span class="preprocessor"></span> <span class="keyword">const</span> <span class="keywordtype">char</span> *str = icalrecurrencetype_as_string(&r); <a name="l00789"></a>00789 <span class="keywordflow">if</span> (str) { <a name="l00790"></a>00790 kdDebug(5800) << <span class="stringliteral">" String: "</span> << str << endl; <a name="l00791"></a>00791 } <span class="keywordflow">else</span> { <a name="l00792"></a>00792 kdDebug(5800) << <span class="stringliteral">" No String"</span> << endl; <a name="l00793"></a>00793 } <a name="l00794"></a>00794 <span class="preprocessor">#endif</span> <a name="l00795"></a>00795 <span class="preprocessor"></span> <a name="l00796"></a>00796 <span class="keywordflow">return</span> r; <a name="l00797"></a>00797 } <a name="l00798"></a>00798 <a name="l00799"></a>00799 <a name="l00800"></a>00800 icalcomponent *ICalFormatImpl::writeAlarm(<a class="code" href="classKCal_1_1Alarm.html" title="This class represents an alarm notification.">Alarm</a> *alarm) <a name="l00801"></a>00801 { <a name="l00802"></a>00802 <span class="comment">// kdDebug(5800) << " ICalFormatImpl::writeAlarm" << endl;</span> <a name="l00803"></a>00803 icalcomponent *a = icalcomponent_new(ICAL_VALARM_COMPONENT); <a name="l00804"></a>00804 <a name="l00805"></a>00805 icalproperty_action action; <a name="l00806"></a>00806 icalattach *attach = 0; <a name="l00807"></a>00807 <a name="l00808"></a>00808 <span class="keywordflow">switch</span> (alarm-><a class="code" href="classKCal_1_1Alarm.html#9cec3c8d0c2047ccb8334a54175ca7c7" title="Return the type of the alarm.">type</a>()) { <a name="l00809"></a>00809 <span class="keywordflow">case</span> Alarm::Procedure: <a name="l00810"></a>00810 action = ICAL_ACTION_PROCEDURE; <a name="l00811"></a>00811 attach = icalattach_new_from_url(QFile::encodeName(alarm-><a class="code" href="classKCal_1_1Alarm.html#3bf09593c90acb290202c9cec3e439bc" title="Return the name of the program file to execute when the alarm is triggered.">programFile</a>()).data()); <a name="l00812"></a>00812 icalcomponent_add_property(a,icalproperty_new_attach(attach)); <a name="l00813"></a>00813 <span class="keywordflow">if</span> (!alarm-><a class="code" href="classKCal_1_1Alarm.html#e7fe383484dbef6c456b71c08e62c783" title="Return the arguments to the program to run when the alarm is triggered.">programArguments</a>().isEmpty()) { <a name="l00814"></a>00814 icalcomponent_add_property(a,icalproperty_new_description(alarm-><a class="code" href="classKCal_1_1Alarm.html#e7fe383484dbef6c456b71c08e62c783" title="Return the arguments to the program to run when the alarm is triggered.">programArguments</a>().utf8())); <a name="l00815"></a>00815 } <a name="l00816"></a>00816 <span class="keywordflow">break</span>; <a name="l00817"></a>00817 <span class="keywordflow">case</span> Alarm::Audio: <a name="l00818"></a>00818 action = ICAL_ACTION_AUDIO; <a name="l00819"></a>00819 <span class="comment">// kdDebug(5800) << " It's an audio action, file: " << alarm->audioFile() << endl;</span> <a name="l00820"></a>00820 <span class="keywordflow">if</span> (!alarm-><a class="code" href="classKCal_1_1Alarm.html#a9a5cefa19499ffc3f6fbfc7a07cfcb9" title="Return the name of the audio file for the alarm.">audioFile</a>().isEmpty()) { <a name="l00821"></a>00821 attach = icalattach_new_from_url(QFile::encodeName( alarm-><a class="code" href="classKCal_1_1Alarm.html#a9a5cefa19499ffc3f6fbfc7a07cfcb9" title="Return the name of the audio file for the alarm.">audioFile</a>() ).data()); <a name="l00822"></a>00822 icalcomponent_add_property(a,icalproperty_new_attach(attach)); <a name="l00823"></a>00823 } <a name="l00824"></a>00824 <span class="keywordflow">break</span>; <a name="l00825"></a>00825 <span class="keywordflow">case</span> Alarm::Email: { <a name="l00826"></a>00826 action = ICAL_ACTION_EMAIL; <a name="l00827"></a>00827 QValueList<Person> addresses = alarm-><a class="code" href="classKCal_1_1Alarm.html#cfe761563112e143ae1b87c31181a69f" title="Return the addresses to send mail to when an alarm goes off.">mailAddresses</a>(); <a name="l00828"></a>00828 <span class="keywordflow">for</span> (QValueList<Person>::Iterator ad = addresses.begin(); ad != addresses.end(); ++ad) { <a name="l00829"></a>00829 icalproperty *p = icalproperty_new_attendee(<span class="stringliteral">"MAILTO:"</span> + (*ad).email().utf8()); <a name="l00830"></a>00830 <span class="keywordflow">if</span> (!(*ad).name().isEmpty()) { <a name="l00831"></a>00831 icalproperty_add_parameter(p,icalparameter_new_cn((*ad).name().utf8())); <a name="l00832"></a>00832 } <a name="l00833"></a>00833 icalcomponent_add_property(a,p); <a name="l00834"></a>00834 } <a name="l00835"></a>00835 icalcomponent_add_property(a,icalproperty_new_summary(alarm-><a class="code" href="classKCal_1_1Alarm.html#79ea9526501296c068667e89fb51a066" title="Return the subject line of the mail.">mailSubject</a>().utf8())); <a name="l00836"></a>00836 icalcomponent_add_property(a,icalproperty_new_description(alarm-><a class="code" href="classKCal_1_1Alarm.html#0ce0f2a11a68c9d8649eeb4bca3aec89" title="Return the email body text.">mailText</a>().utf8())); <a name="l00837"></a>00837 QStringList attachments = alarm-><a class="code" href="classKCal_1_1Alarm.html#06971aa042d50e6f4a0349b8ad566464" title="Return the filenames to attach to the email.">mailAttachments</a>(); <a name="l00838"></a>00838 <span class="keywordflow">if</span> (attachments.count() > 0) { <a name="l00839"></a>00839 <span class="keywordflow">for</span> (QStringList::Iterator at = attachments.begin(); at != attachments.end(); ++at) { <a name="l00840"></a>00840 attach = icalattach_new_from_url(QFile::encodeName( *at ).data()); <a name="l00841"></a>00841 icalcomponent_add_property(a,icalproperty_new_attach(attach)); <a name="l00842"></a>00842 } <a name="l00843"></a>00843 } <a name="l00844"></a>00844 <span class="keywordflow">break</span>; <a name="l00845"></a>00845 } <a name="l00846"></a>00846 <span class="keywordflow">case</span> Alarm::Display: <a name="l00847"></a>00847 action = ICAL_ACTION_DISPLAY; <a name="l00848"></a>00848 icalcomponent_add_property(a,icalproperty_new_description(alarm-><a class="code" href="classKCal_1_1Alarm.html#f8bd9d4bbe262bec35f6a8b6c5edf079" title="Return the text string that displays when the alarm is triggered.">text</a>().utf8())); <a name="l00849"></a>00849 <span class="keywordflow">break</span>; <a name="l00850"></a>00850 <span class="keywordflow">case</span> Alarm::Invalid: <a name="l00851"></a>00851 <span class="keywordflow">default</span>: <a name="l00852"></a>00852 kdDebug(5800) << <span class="stringliteral">"Unknown type of alarm"</span> << endl; <a name="l00853"></a>00853 action = ICAL_ACTION_NONE; <a name="l00854"></a>00854 <span class="keywordflow">break</span>; <a name="l00855"></a>00855 } <a name="l00856"></a>00856 icalcomponent_add_property(a,icalproperty_new_action(action)); <a name="l00857"></a>00857 <a name="l00858"></a>00858 <span class="comment">// Trigger time</span> <a name="l00859"></a>00859 icaltriggertype trigger; <a name="l00860"></a>00860 <span class="keywordflow">if</span> ( alarm-><a class="code" href="classKCal_1_1Alarm.html#096ea538fb51db902c86c9ea3ba9d23d" title="Return true, if the alarm has an explicit date/time.">hasTime</a>() ) { <a name="l00861"></a>00861 trigger.time = writeICalDateTime(alarm-><a class="code" href="classKCal_1_1Alarm.html#48d2224969fdefd53ab180e4db8b38fb" title="Return the date/time when an alarm goes off.">time</a>()); <a name="l00862"></a>00862 trigger.duration = icaldurationtype_null_duration(); <a name="l00863"></a>00863 } <span class="keywordflow">else</span> { <a name="l00864"></a>00864 trigger.time = icaltime_null_time(); <a name="l00865"></a>00865 <a class="code" href="classKCal_1_1Duration.html" title="This class represents a duration.">Duration</a> offset; <a name="l00866"></a>00866 <span class="keywordflow">if</span> ( alarm-><a class="code" href="classKCal_1_1Alarm.html#82ffea42c98bbe563cf9b7c03262cffc" title="Return whether the alarm is defined in terms of an offset relative to the start of...">hasStartOffset</a>() ) <a name="l00867"></a>00867 offset = alarm-><a class="code" href="classKCal_1_1Alarm.html#3fdf5078feefc485a6d86d2f9c3e8d6a" title="Return offset of alarm in time relative to the start of the event.">startOffset</a>(); <a name="l00868"></a>00868 <span class="keywordflow">else</span> <a name="l00869"></a>00869 offset = alarm-><a class="code" href="classKCal_1_1Alarm.html#8e7e0d368d84e9a1cb3479cd4ff29e72" title="Return offset of alarm in time relative to the end of the event.">endOffset</a>(); <a name="l00870"></a>00870 trigger.duration = icaldurationtype_from_int( offset.<a class="code" href="classKCal_1_1Duration.html#34b69f5167fc798461a45971619227f6">asSeconds</a>() ); <a name="l00871"></a>00871 } <a name="l00872"></a>00872 icalproperty *p = icalproperty_new_trigger(trigger); <a name="l00873"></a>00873 <span class="keywordflow">if</span> ( alarm-><a class="code" href="classKCal_1_1Alarm.html#094d1237630cb22fc1d1b5c17cdbd589" title="Return whether the alarm is defined in terms of an offset relative to the end of...">hasEndOffset</a>() ) <a name="l00874"></a>00874 icalproperty_add_parameter(p,icalparameter_new_related(ICAL_RELATED_END)); <a name="l00875"></a>00875 icalcomponent_add_property(a,p); <a name="l00876"></a>00876 <a name="l00877"></a>00877 <span class="comment">// Repeat count and duration</span> <a name="l00878"></a>00878 <span class="keywordflow">if</span> (alarm-><a class="code" href="classKCal_1_1Alarm.html#dec5b6aa7f9e0077f781b57edf7dc7c7" title="Get how many times an alarm repeats, after its initial occurrence.">repeatCount</a>()) { <a name="l00879"></a>00879 icalcomponent_add_property(a,icalproperty_new_repeat(alarm-><a class="code" href="classKCal_1_1Alarm.html#dec5b6aa7f9e0077f781b57edf7dc7c7" title="Get how many times an alarm repeats, after its initial occurrence.">repeatCount</a>())); <a name="l00880"></a>00880 icalcomponent_add_property(a,icalproperty_new_duration( <a name="l00881"></a>00881 icaldurationtype_from_int(alarm-><a class="code" href="classKCal_1_1Alarm.html#716673277cd34a2c8c1a75e28989bf8c" title="Get how long the alarm snooze interval is.">snoozeTime</a>()*60))); <a name="l00882"></a>00882 } <a name="l00883"></a>00883 <a name="l00884"></a>00884 <span class="comment">// Custom properties</span> <a name="l00885"></a>00885 QMap<QCString, QString> custom = alarm-><a class="code" href="classKCal_1_1CustomProperties.html#19ed307800204c4938aa9c4dcff3a0a4" title="Return all custom calendar property key/value pairs.">customProperties</a>(); <a name="l00886"></a>00886 <span class="keywordflow">for</span> (QMap<QCString, QString>::Iterator c = custom.begin(); c != custom.end(); ++c) { <a name="l00887"></a>00887 icalproperty *p = icalproperty_new_x(c.data().utf8()); <a name="l00888"></a>00888 icalproperty_set_x_name(p,c.key()); <a name="l00889"></a>00889 icalcomponent_add_property(a,p); <a name="l00890"></a>00890 } <a name="l00891"></a>00891 <a name="l00892"></a>00892 <span class="keywordflow">return</span> a; <a name="l00893"></a>00893 } <a name="l00894"></a>00894 <a name="l00895"></a>00895 <a class="code" href="classKCal_1_1Todo.html" title="This class provides a Todo in the sense of RFC2445.">Todo</a> *ICalFormatImpl::readTodo(icalcomponent *vtodo) <a name="l00896"></a>00896 { <a name="l00897"></a>00897 <a class="code" href="classKCal_1_1Todo.html" title="This class provides a Todo in the sense of RFC2445.">Todo</a> *todo = <span class="keyword">new</span> <a class="code" href="classKCal_1_1Todo.html" title="This class provides a Todo in the sense of RFC2445.">Todo</a>; <a name="l00898"></a>00898 <a name="l00899"></a>00899 readIncidence(vtodo, 0, todo); <span class="comment">// FIXME timezone</span> <a name="l00900"></a>00900 <a name="l00901"></a>00901 icalproperty *p = icalcomponent_get_first_property(vtodo,ICAL_ANY_PROPERTY); <a name="l00902"></a>00902 <a name="l00903"></a>00903 <span class="comment">// int intvalue;</span> <a name="l00904"></a>00904 icaltimetype icaltime; <a name="l00905"></a>00905 <a name="l00906"></a>00906 QStringList categories; <a name="l00907"></a>00907 <a name="l00908"></a>00908 <span class="keywordflow">while</span> (p) { <a name="l00909"></a>00909 icalproperty_kind kind = icalproperty_isa(p); <a name="l00910"></a>00910 <span class="keywordflow">switch</span> (kind) { <a name="l00911"></a>00911 <a name="l00912"></a>00912 <span class="keywordflow">case</span> ICAL_DUE_PROPERTY: <span class="comment">// due date</span> <a name="l00913"></a>00913 icaltime = icalproperty_get_due(p); <a name="l00914"></a>00914 <span class="keywordflow">if</span> (icaltime.is_date) { <a name="l00915"></a>00915 todo-><a class="code" href="classKCal_1_1Todo.html#68e50e47f65def4d8d58a68423952ddb" title="Sets due date and time.">setDtDue</a>(QDateTime(readICalDate(icaltime),QTime(0,0,0)),<span class="keyword">true</span>); <a name="l00916"></a>00916 } <span class="keywordflow">else</span> { <a name="l00917"></a>00917 todo-><a class="code" href="classKCal_1_1Todo.html#68e50e47f65def4d8d58a68423952ddb" title="Sets due date and time.">setDtDue</a>(readICalDateTime(icaltime),<span class="keyword">true</span>); <a name="l00918"></a>00918 todo-><a class="code" href="classKCal_1_1Incidence.html#8a9b61c884ea9450c9ebea186e73ecc6" title="Set whether the incidence floats, i.e.">setFloats</a>(<span class="keyword">false</span>); <a name="l00919"></a>00919 } <a name="l00920"></a>00920 todo-><a class="code" href="classKCal_1_1Todo.html#e806a381254cd454e80a6a82f114e84d" title="Set if the todo has a due date.">setHasDueDate</a>(<span class="keyword">true</span>); <a name="l00921"></a>00921 <span class="keywordflow">break</span>; <a name="l00922"></a>00922 <a name="l00923"></a>00923 <span class="keywordflow">case</span> ICAL_COMPLETED_PROPERTY: <span class="comment">// completion date</span> <a name="l00924"></a>00924 icaltime = icalproperty_get_completed(p); <a name="l00925"></a>00925 todo-><a class="code" href="classKCal_1_1Todo.html#64cb08677f9e62426b93d3d4f9cd31d2" title="Set completed state.">setCompleted</a>(readICalDateTime(icaltime)); <a name="l00926"></a>00926 <span class="keywordflow">break</span>; <a name="l00927"></a>00927 <a name="l00928"></a>00928 <span class="keywordflow">case</span> ICAL_PERCENTCOMPLETE_PROPERTY: <span class="comment">// Percent completed</span> <a name="l00929"></a>00929 todo-><a class="code" href="classKCal_1_1Todo.html#f51893ca69f782941d7f28f309a1497f" title="Set how many percent of the task are completed.">setPercentComplete</a>(icalproperty_get_percentcomplete(p)); <a name="l00930"></a>00930 <span class="keywordflow">break</span>; <a name="l00931"></a>00931 <a name="l00932"></a>00932 <span class="keywordflow">case</span> ICAL_RELATEDTO_PROPERTY: <span class="comment">// related todo (parent)</span> <a name="l00933"></a>00933 todo-><a class="code" href="classKCal_1_1Incidence.html#61faeed6fc9b849d434d07c6198c5369" title="Point at some other event to which the event relates.">setRelatedToUid</a>(QString::fromUtf8(icalproperty_get_relatedto(p))); <a name="l00934"></a>00934 mTodosRelate.append(todo); <a name="l00935"></a>00935 <span class="keywordflow">break</span>; <a name="l00936"></a>00936 <a name="l00937"></a>00937 <span class="keywordflow">case</span> ICAL_DTSTART_PROPERTY: { <a name="l00938"></a>00938 <span class="comment">// Flag that todo has start date. Value is read in by readIncidence().</span> <a name="l00939"></a>00939 <span class="keywordflow">if</span> ( todo-><a class="code" href="classKCal_1_1IncidenceBase.html#416db24cfef787a1965ae90c7855776b" title="Return all comments associated with this incidence.">comments</a>().grep(<span class="stringliteral">"NoStartDate"</span>).count() ) <a name="l00940"></a>00940 todo-><a class="code" href="classKCal_1_1Todo.html#bd8edba3efd7a23d1273dc0469717d7c" title="Set if the todo has a start date.">setHasStartDate</a>( <span class="keyword">false</span> ); <a name="l00941"></a>00941 <span class="keywordflow">else</span> <a name="l00942"></a>00942 todo-><a class="code" href="classKCal_1_1Todo.html#bd8edba3efd7a23d1273dc0469717d7c" title="Set if the todo has a start date.">setHasStartDate</a>( <span class="keyword">true</span> ); <a name="l00943"></a>00943 <span class="keywordflow">break</span>; <a name="l00944"></a>00944 } <a name="l00945"></a>00945 <a name="l00946"></a>00946 <span class="keywordflow">case</span> ICAL_RECURRENCEID_PROPERTY: <a name="l00947"></a>00947 icaltime = icalproperty_get_recurrenceid(p); <a name="l00948"></a>00948 todo-><a class="code" href="classKCal_1_1Todo.html#87546a24ef140d923e8e6654cfc505a4" title="Sets the due date/time of the current occurrence if recurrent.">setDtRecurrence</a>( readICalDateTime(icaltime) ); <a name="l00949"></a>00949 <span class="keywordflow">break</span>; <a name="l00950"></a>00950 <a name="l00951"></a>00951 <span class="keywordflow">default</span>: <a name="l00952"></a>00952 <span class="comment">// kdDebug(5800) << "ICALFormat::readTodo(): Unknown property: " << kind</span> <a name="l00953"></a>00953 <span class="comment">// << endl;</span> <a name="l00954"></a>00954 <span class="keywordflow">break</span>; <a name="l00955"></a>00955 } <a name="l00956"></a>00956 <a name="l00957"></a>00957 p = icalcomponent_get_next_property(vtodo,ICAL_ANY_PROPERTY); <a name="l00958"></a>00958 } <a name="l00959"></a>00959 <a name="l00960"></a>00960 <span class="keywordflow">if</span> (mCompat) mCompat->fixEmptySummary( todo ); <a name="l00961"></a>00961 <a name="l00962"></a>00962 <span class="keywordflow">return</span> todo; <a name="l00963"></a>00963 } <a name="l00964"></a>00964 <a name="l00965"></a>00965 <a class="code" href="classKCal_1_1Event.html" title="This class provides an Event in the sense of RFC2445.">Event</a> *ICalFormatImpl::readEvent( icalcomponent *vevent, icalcomponent *vtimezone ) <a name="l00966"></a>00966 { <a name="l00967"></a>00967 <a class="code" href="classKCal_1_1Event.html" title="This class provides an Event in the sense of RFC2445.">Event</a> *<span class="keyword">event</span> = <span class="keyword">new</span> <a class="code" href="classKCal_1_1Event.html" title="This class provides an Event in the sense of RFC2445.">Event</a>; <a name="l00968"></a>00968 <a name="l00969"></a>00969 <span class="comment">// FIXME where is this freed?</span> <a name="l00970"></a>00970 icaltimezone *tz = icaltimezone_new(); <a name="l00971"></a>00971 <span class="keywordflow">if</span> ( !icaltimezone_set_component( tz, vtimezone ) ) { <a name="l00972"></a>00972 icaltimezone_free( tz, 1 ); <a name="l00973"></a>00973 tz = 0; <a name="l00974"></a>00974 } <a name="l00975"></a>00975 <a name="l00976"></a>00976 readIncidence( vevent, tz, event); <a name="l00977"></a>00977 <a name="l00978"></a>00978 icalproperty *p = icalcomponent_get_first_property(vevent,ICAL_ANY_PROPERTY); <a name="l00979"></a>00979 <a name="l00980"></a>00980 <span class="comment">// int intvalue;</span> <a name="l00981"></a>00981 icaltimetype icaltime; <a name="l00982"></a>00982 <a name="l00983"></a>00983 QStringList categories; <a name="l00984"></a>00984 icalproperty_transp transparency; <a name="l00985"></a>00985 <a name="l00986"></a>00986 <span class="keywordtype">bool</span> dtEndProcessed = <span class="keyword">false</span>; <a name="l00987"></a>00987 <a name="l00988"></a>00988 <span class="keywordflow">while</span> (p) { <a name="l00989"></a>00989 icalproperty_kind kind = icalproperty_isa(p); <a name="l00990"></a>00990 <span class="keywordflow">switch</span> (kind) { <a name="l00991"></a>00991 <a name="l00992"></a>00992 <span class="keywordflow">case</span> ICAL_DTEND_PROPERTY: <span class="comment">// start date and time</span> <a name="l00993"></a>00993 icaltime = icalproperty_get_dtend(p); <a name="l00994"></a>00994 <span class="keywordflow">if</span> (icaltime.is_date) { <a name="l00995"></a>00995 <span class="comment">// End date is non-inclusive</span> <a name="l00996"></a>00996 QDate endDate = readICalDate( icaltime ).addDays( -1 ); <a name="l00997"></a>00997 <span class="keywordflow">if</span> ( mCompat ) mCompat->fixFloatingEnd( endDate ); <a name="l00998"></a>00998 <span class="keywordflow">if</span> ( endDate < event->dtStart().date() ) { <a name="l00999"></a>00999 endDate = <span class="keyword">event</span>->dtStart().date(); <a name="l01000"></a>01000 } <a name="l01001"></a>01001 <span class="keyword">event</span>->setDtEnd( QDateTime( endDate, QTime( 0, 0, 0 ) ) ); <a name="l01002"></a>01002 } <span class="keywordflow">else</span> { <a name="l01003"></a>01003 <span class="keyword">event</span>->setDtEnd(readICalDateTime(icaltime, tz)); <a name="l01004"></a>01004 <span class="keyword">event</span>->setFloats( <span class="keyword">false</span> ); <a name="l01005"></a>01005 } <a name="l01006"></a>01006 dtEndProcessed = <span class="keyword">true</span>; <a name="l01007"></a>01007 <span class="keywordflow">break</span>; <a name="l01008"></a>01008 <a name="l01009"></a>01009 <span class="keywordflow">case</span> ICAL_RELATEDTO_PROPERTY: <span class="comment">// related event (parent)</span> <a name="l01010"></a>01010 <span class="keyword">event</span>->setRelatedToUid(QString::fromUtf8(icalproperty_get_relatedto(p))); <a name="l01011"></a>01011 mEventsRelate.append(event); <a name="l01012"></a>01012 <span class="keywordflow">break</span>; <a name="l01013"></a>01013 <a name="l01014"></a>01014 <a name="l01015"></a>01015 <span class="keywordflow">case</span> ICAL_TRANSP_PROPERTY: <span class="comment">// Transparency</span> <a name="l01016"></a>01016 transparency = icalproperty_get_transp(p); <a name="l01017"></a>01017 <span class="keywordflow">if</span>( transparency == ICAL_TRANSP_TRANSPARENT ) <a name="l01018"></a>01018 <span class="keyword">event</span>->setTransparency( Event::Transparent ); <a name="l01019"></a>01019 <span class="keywordflow">else</span> <a name="l01020"></a>01020 <span class="keyword">event</span>->setTransparency( Event::Opaque ); <a name="l01021"></a>01021 <span class="keywordflow">break</span>; <a name="l01022"></a>01022 <a name="l01023"></a>01023 <span class="keywordflow">default</span>: <a name="l01024"></a>01024 <span class="comment">// kdDebug(5800) << "ICALFormat::readEvent(): Unknown property: " << kind</span> <a name="l01025"></a>01025 <span class="comment">// << endl;</span> <a name="l01026"></a>01026 <span class="keywordflow">break</span>; <a name="l01027"></a>01027 } <a name="l01028"></a>01028 <a name="l01029"></a>01029 p = icalcomponent_get_next_property(vevent,ICAL_ANY_PROPERTY); <a name="l01030"></a>01030 } <a name="l01031"></a>01031 <a name="l01032"></a>01032 <span class="comment">// according to rfc2445 the dtend shouldn't be written when it equals</span> <a name="l01033"></a>01033 <span class="comment">// start date. so assign one equal to start date.</span> <a name="l01034"></a>01034 <span class="keywordflow">if</span> ( !dtEndProcessed && !event-><a class="code" href="classKCal_1_1IncidenceBase.html#7844622636734bc897ac178b321508c5">hasDuration</a>() ) { <a name="l01035"></a>01035 <span class="keyword">event</span>->setDtEnd( event-><a class="code" href="classKCal_1_1IncidenceBase.html#5419a946a4e5715a0c34ec2c7e04cd9b" title="returns an event&#39;s starting date/time as a QDateTime.">dtStart</a>() ); <a name="l01036"></a>01036 } <a name="l01037"></a>01037 <a name="l01038"></a>01038 QString msade = <span class="keyword">event</span>->nonKDECustomProperty(<span class="stringliteral">"X-MICROSOFT-CDO-ALLDAYEVENT"</span>); <a name="l01039"></a>01039 <span class="keywordflow">if</span> (!msade.isNull()) { <a name="l01040"></a>01040 <span class="keywordtype">bool</span> floats = (msade == QString::fromLatin1(<span class="stringliteral">"TRUE"</span>)); <a name="l01041"></a>01041 <span class="comment">// kdDebug(5800) << "ICALFormat::readEvent(): all day event: " << floats << endl;</span> <a name="l01042"></a>01042 <span class="keyword">event</span>->setFloats(floats); <a name="l01043"></a>01043 <span class="keywordflow">if</span> (floats) { <a name="l01044"></a>01044 QDateTime endDate = <span class="keyword">event</span>->dtEnd(); <a name="l01045"></a>01045 <span class="keyword">event</span>->setDtEnd(endDate.addDays(-1)); <a name="l01046"></a>01046 } <a name="l01047"></a>01047 } <a name="l01048"></a>01048 <a name="l01049"></a>01049 <span class="keywordflow">if</span> ( mCompat ) mCompat->fixEmptySummary( event ); <a name="l01050"></a>01050 <a name="l01051"></a>01051 <span class="keywordflow">return</span> event; <a name="l01052"></a>01052 } <a name="l01053"></a>01053 <a name="l01054"></a>01054 <a class="code" href="classKCal_1_1FreeBusy.html" title="This class provides information about free/busy time of a calendar user.">FreeBusy</a> *ICalFormatImpl::readFreeBusy(icalcomponent *vfreebusy) <a name="l01055"></a>01055 { <a name="l01056"></a>01056 <a class="code" href="classKCal_1_1FreeBusy.html" title="This class provides information about free/busy time of a calendar user.">FreeBusy</a> *freebusy = <span class="keyword">new</span> <a class="code" href="classKCal_1_1FreeBusy.html" title="This class provides information about free/busy time of a calendar user.">FreeBusy</a>; <a name="l01057"></a>01057 <a name="l01058"></a>01058 readIncidenceBase(vfreebusy, freebusy); <a name="l01059"></a>01059 <a name="l01060"></a>01060 icalproperty *p = icalcomponent_get_first_property(vfreebusy,ICAL_ANY_PROPERTY); <a name="l01061"></a>01061 <a name="l01062"></a>01062 icaltimetype icaltime; <a name="l01063"></a>01063 PeriodList periods; <a name="l01064"></a>01064 <a name="l01065"></a>01065 <span class="keywordflow">while</span> (p) { <a name="l01066"></a>01066 icalproperty_kind kind = icalproperty_isa(p); <a name="l01067"></a>01067 <span class="keywordflow">switch</span> (kind) { <a name="l01068"></a>01068 <a name="l01069"></a>01069 <span class="keywordflow">case</span> ICAL_DTSTART_PROPERTY: <span class="comment">// start date and time</span> <a name="l01070"></a>01070 icaltime = icalproperty_get_dtstart(p); <a name="l01071"></a>01071 freebusy-><a class="code" href="classKCal_1_1IncidenceBase.html#1a0e95e316942fdd64b9b0a1a2cf7a85" title="for setting the event&#39;s starting date/time with a QDateTime.">setDtStart</a>(readICalDateTime(icaltime)); <a name="l01072"></a>01072 <span class="keywordflow">break</span>; <a name="l01073"></a>01073 <a name="l01074"></a>01074 <span class="keywordflow">case</span> ICAL_DTEND_PROPERTY: <span class="comment">// end Date and Time</span> <a name="l01075"></a>01075 icaltime = icalproperty_get_dtend(p); <a name="l01076"></a>01076 freebusy-><a class="code" href="classKCal_1_1FreeBusy.html#e6a3c804bbf70c4a75bdde327418a51c">setDtEnd</a>(readICalDateTime(icaltime)); <a name="l01077"></a>01077 <span class="keywordflow">break</span>; <a name="l01078"></a>01078 <a name="l01079"></a>01079 <span class="keywordflow">case</span> ICAL_FREEBUSY_PROPERTY: { <span class="comment">//Any FreeBusy Times</span> <a name="l01080"></a>01080 icalperiodtype icalperiod = icalproperty_get_freebusy(p); <a name="l01081"></a>01081 QDateTime period_start = readICalDateTime(icalperiod.start); <a name="l01082"></a>01082 <a class="code" href="classKCal_1_1Period.html" title="This class represents a period of time.">Period</a> period; <a name="l01083"></a>01083 <span class="keywordflow">if</span> ( !icaltime_is_null_time(icalperiod.end) ) { <a name="l01084"></a>01084 QDateTime period_end = readICalDateTime(icalperiod.end); <a name="l01085"></a>01085 period = <a class="code" href="classKCal_1_1Period.html" title="This class represents a period of time.">Period</a>(period_start, period_end); <a name="l01086"></a>01086 } <span class="keywordflow">else</span> { <a name="l01087"></a>01087 <a class="code" href="classKCal_1_1Duration.html" title="This class represents a duration.">Duration</a> duration = readICalDuration( icalperiod.duration ); <a name="l01088"></a>01088 period = <a class="code" href="classKCal_1_1Period.html" title="This class represents a period of time.">Period</a>(period_start, duration); <a name="l01089"></a>01089 } <a name="l01090"></a>01090 QCString param = icalproperty_get_parameter_as_string( p, <span class="stringliteral">"X-SUMMARY"</span> ); <a name="l01091"></a>01091 period.<a class="code" href="classKCal_1_1Period.html#c766f46b78d6940f9ecbd75835f261cb">setSummary</a>( QString::fromUtf8( KCodecs::base64Decode( param ) ) ); <a name="l01092"></a>01092 param = icalproperty_get_parameter_as_string( p, <span class="stringliteral">"X-LOCATION"</span> ); <a name="l01093"></a>01093 period.<a class="code" href="classKCal_1_1Period.html#b953e280fab93d5b973d73bdbc367024">setLocation</a>( QString::fromUtf8( KCodecs::base64Decode( param ) ) ); <a name="l01094"></a>01094 periods.append( period ); <a name="l01095"></a>01095 <span class="keywordflow">break</span>;} <a name="l01096"></a>01096 <a name="l01097"></a>01097 <span class="keywordflow">default</span>: <a name="l01098"></a>01098 <span class="comment">// kdDebug(5800) << "ICalFormatImpl::readFreeBusy(): Unknown property: "</span> <a name="l01099"></a>01099 <span class="comment">// << kind << endl;</span> <a name="l01100"></a>01100 <span class="keywordflow">break</span>; <a name="l01101"></a>01101 } <a name="l01102"></a>01102 p = icalcomponent_get_next_property(vfreebusy,ICAL_ANY_PROPERTY); <a name="l01103"></a>01103 } <a name="l01104"></a>01104 freebusy-><a class="code" href="classKCal_1_1FreeBusy.html#604bb4f72461a122931d6c0dad68d28c" title="Adds a list of periods to the freebusy object and then sorts that list.">addPeriods</a>( periods ); <a name="l01105"></a>01105 <a name="l01106"></a>01106 <span class="keywordflow">return</span> freebusy; <a name="l01107"></a>01107 } <a name="l01108"></a>01108 <a name="l01109"></a>01109 <a class="code" href="classKCal_1_1Journal.html" title="This class provides a Journal in the sense of RFC2445.">Journal</a> *ICalFormatImpl::readJournal(icalcomponent *vjournal) <a name="l01110"></a>01110 { <a name="l01111"></a>01111 <a class="code" href="classKCal_1_1Journal.html" title="This class provides a Journal in the sense of RFC2445.">Journal</a> *journal = <span class="keyword">new</span> <a class="code" href="classKCal_1_1Journal.html" title="This class provides a Journal in the sense of RFC2445.">Journal</a>; <a name="l01112"></a>01112 <a name="l01113"></a>01113 readIncidence(vjournal, 0, journal); <span class="comment">// FIXME tz?</span> <a name="l01114"></a>01114 <a name="l01115"></a>01115 <span class="keywordflow">return</span> journal; <a name="l01116"></a>01116 } <a name="l01117"></a>01117 <a name="l01118"></a>01118 <a class="code" href="classKCal_1_1Attendee.html" title="This class represents information related to an attendee of an event.">Attendee</a> *ICalFormatImpl::readAttendee(icalproperty *attendee) <a name="l01119"></a>01119 { <a name="l01120"></a>01120 icalparameter *p = 0; <a name="l01121"></a>01121 <a name="l01122"></a>01122 QString email = QString::fromUtf8(icalproperty_get_attendee(attendee)); <a name="l01123"></a>01123 <span class="keywordflow">if</span> ( email.startsWith( <span class="stringliteral">"mailto:"</span>, <span class="keyword">false</span> ) ) { <a name="l01124"></a>01124 email = email.mid( 7 ); <a name="l01125"></a>01125 } <a name="l01126"></a>01126 <a name="l01127"></a>01127 QString name; <a name="l01128"></a>01128 QString uid = QString::null; <a name="l01129"></a>01129 p = icalproperty_get_first_parameter(attendee,ICAL_CN_PARAMETER); <a name="l01130"></a>01130 <span class="keywordflow">if</span> (p) { <a name="l01131"></a>01131 name = QString::fromUtf8(icalparameter_get_cn(p)); <a name="l01132"></a>01132 } <span class="keywordflow">else</span> { <a name="l01133"></a>01133 } <a name="l01134"></a>01134 <a name="l01135"></a>01135 <span class="keywordtype">bool</span> rsvp=<span class="keyword">false</span>; <a name="l01136"></a>01136 p = icalproperty_get_first_parameter(attendee,ICAL_RSVP_PARAMETER); <a name="l01137"></a>01137 <span class="keywordflow">if</span> (p) { <a name="l01138"></a>01138 icalparameter_rsvp rsvpParameter = icalparameter_get_rsvp(p); <a name="l01139"></a>01139 <span class="keywordflow">if</span> (rsvpParameter == ICAL_RSVP_TRUE) rsvp = <span class="keyword">true</span>; <a name="l01140"></a>01140 } <a name="l01141"></a>01141 <a name="l01142"></a>01142 Attendee::PartStat status = Attendee::NeedsAction; <a name="l01143"></a>01143 p = icalproperty_get_first_parameter(attendee,ICAL_PARTSTAT_PARAMETER); <a name="l01144"></a>01144 <span class="keywordflow">if</span> (p) { <a name="l01145"></a>01145 icalparameter_partstat partStatParameter = icalparameter_get_partstat(p); <a name="l01146"></a>01146 <span class="keywordflow">switch</span>(partStatParameter) { <a name="l01147"></a>01147 <span class="keywordflow">default</span>: <a name="l01148"></a>01148 <span class="keywordflow">case</span> ICAL_PARTSTAT_NEEDSACTION: <a name="l01149"></a>01149 status = Attendee::NeedsAction; <a name="l01150"></a>01150 <span class="keywordflow">break</span>; <a name="l01151"></a>01151 <span class="keywordflow">case</span> ICAL_PARTSTAT_ACCEPTED: <a name="l01152"></a>01152 status = Attendee::Accepted; <a name="l01153"></a>01153 <span class="keywordflow">break</span>; <a name="l01154"></a>01154 <span class="keywordflow">case</span> ICAL_PARTSTAT_DECLINED: <a name="l01155"></a>01155 status = Attendee::Declined; <a name="l01156"></a>01156 <span class="keywordflow">break</span>; <a name="l01157"></a>01157 <span class="keywordflow">case</span> ICAL_PARTSTAT_TENTATIVE: <a name="l01158"></a>01158 status = Attendee::Tentative; <a name="l01159"></a>01159 <span class="keywordflow">break</span>; <a name="l01160"></a>01160 <span class="keywordflow">case</span> ICAL_PARTSTAT_DELEGATED: <a name="l01161"></a>01161 status = Attendee::Delegated; <a name="l01162"></a>01162 <span class="keywordflow">break</span>; <a name="l01163"></a>01163 <span class="keywordflow">case</span> ICAL_PARTSTAT_COMPLETED: <a name="l01164"></a>01164 status = Attendee::Completed; <a name="l01165"></a>01165 <span class="keywordflow">break</span>; <a name="l01166"></a>01166 <span class="keywordflow">case</span> ICAL_PARTSTAT_INPROCESS: <a name="l01167"></a>01167 status = Attendee::InProcess; <a name="l01168"></a>01168 <span class="keywordflow">break</span>; <a name="l01169"></a>01169 } <a name="l01170"></a>01170 } <a name="l01171"></a>01171 <a name="l01172"></a>01172 Attendee::Role role = Attendee::ReqParticipant; <a name="l01173"></a>01173 p = icalproperty_get_first_parameter(attendee,ICAL_ROLE_PARAMETER); <a name="l01174"></a>01174 <span class="keywordflow">if</span> (p) { <a name="l01175"></a>01175 icalparameter_role roleParameter = icalparameter_get_role(p); <a name="l01176"></a>01176 <span class="keywordflow">switch</span>(roleParameter) { <a name="l01177"></a>01177 <span class="keywordflow">case</span> ICAL_ROLE_CHAIR: <a name="l01178"></a>01178 role = Attendee::Chair; <a name="l01179"></a>01179 <span class="keywordflow">break</span>; <a name="l01180"></a>01180 <span class="keywordflow">default</span>: <a name="l01181"></a>01181 <span class="keywordflow">case</span> ICAL_ROLE_REQPARTICIPANT: <a name="l01182"></a>01182 role = Attendee::ReqParticipant; <a name="l01183"></a>01183 <span class="keywordflow">break</span>; <a name="l01184"></a>01184 <span class="keywordflow">case</span> ICAL_ROLE_OPTPARTICIPANT: <a name="l01185"></a>01185 role = Attendee::OptParticipant; <a name="l01186"></a>01186 <span class="keywordflow">break</span>; <a name="l01187"></a>01187 <span class="keywordflow">case</span> ICAL_ROLE_NONPARTICIPANT: <a name="l01188"></a>01188 role = Attendee::NonParticipant; <a name="l01189"></a>01189 <span class="keywordflow">break</span>; <a name="l01190"></a>01190 } <a name="l01191"></a>01191 } <a name="l01192"></a>01192 <a name="l01193"></a>01193 p = icalproperty_get_first_parameter(attendee,ICAL_X_PARAMETER); <a name="l01194"></a>01194 uid = icalparameter_get_xvalue(p); <a name="l01195"></a>01195 <span class="comment">// This should be added, but there seems to be a libical bug here.</span> <a name="l01196"></a>01196 <span class="comment">// TODO: does this work now in libical-0.24 or greater?</span> <a name="l01197"></a>01197 <span class="comment">/*while (p) {</span> <a name="l01198"></a>01198 <span class="comment"> // if (icalparameter_get_xname(p) == "X-UID") {</span> <a name="l01199"></a>01199 <span class="comment"> uid = icalparameter_get_xvalue(p);</span> <a name="l01200"></a>01200 <span class="comment"> p = icalproperty_get_next_parameter(attendee,ICAL_X_PARAMETER);</span> <a name="l01201"></a>01201 <span class="comment"> } */</span> <a name="l01202"></a>01202 <a name="l01203"></a>01203 <a class="code" href="classKCal_1_1Attendee.html" title="This class represents information related to an attendee of an event.">Attendee</a> *a = <span class="keyword">new</span> <a class="code" href="classKCal_1_1Attendee.html" title="This class represents information related to an attendee of an event.">Attendee</a>( name, email, rsvp, status, role, uid ); <a name="l01204"></a>01204 <a name="l01205"></a>01205 p = icalproperty_get_first_parameter( attendee, ICAL_DELEGATEDTO_PARAMETER ); <a name="l01206"></a>01206 <span class="keywordflow">if</span> ( p ) <a name="l01207"></a>01207 a-><a class="code" href="classKCal_1_1Attendee.html#f4ffcef10546bc765abd4b7da8224f48" title="Sets the delegate.">setDelegate</a>( icalparameter_get_delegatedto( p ) ); <a name="l01208"></a>01208 <a name="l01209"></a>01209 p = icalproperty_get_first_parameter( attendee, ICAL_DELEGATEDFROM_PARAMETER ); <a name="l01210"></a>01210 <span class="keywordflow">if</span> ( p ) <a name="l01211"></a>01211 a-><a class="code" href="classKCal_1_1Attendee.html#050c883207bbfbc308177414344a5cd1" title="Sets the delegator.">setDelegator</a>( icalparameter_get_delegatedfrom( p ) ); <a name="l01212"></a>01212 <a name="l01213"></a>01213 <span class="keywordflow">return</span> a; <a name="l01214"></a>01214 } <a name="l01215"></a>01215 <a name="l01216"></a>01216 <a class="code" href="classKCal_1_1Person.html" title="This class represents a person.">Person</a> ICalFormatImpl::readOrganizer( icalproperty *organizer ) <a name="l01217"></a>01217 { <a name="l01218"></a>01218 QString email = QString::fromUtf8(icalproperty_get_organizer(organizer)); <a name="l01219"></a>01219 <span class="keywordflow">if</span> ( email.startsWith( <span class="stringliteral">"mailto:"</span>, <span class="keyword">false</span> ) ) { <a name="l01220"></a>01220 email = email.mid( 7 ); <a name="l01221"></a>01221 } <a name="l01222"></a>01222 QString cn; <a name="l01223"></a>01223 <a name="l01224"></a>01224 icalparameter *p = icalproperty_get_first_parameter( <a name="l01225"></a>01225 organizer, ICAL_CN_PARAMETER ); <a name="l01226"></a>01226 <a name="l01227"></a>01227 <span class="keywordflow">if</span> ( p ) { <a name="l01228"></a>01228 cn = QString::fromUtf8( icalparameter_get_cn( p ) ); <a name="l01229"></a>01229 } <a name="l01230"></a>01230 <a class="code" href="classKCal_1_1Person.html" title="This class represents a person.">Person</a> org( cn, email ); <a name="l01231"></a>01231 <span class="comment">// TODO: Treat sent-by, dir and language here, too</span> <a name="l01232"></a>01232 <span class="keywordflow">return</span> org; <a name="l01233"></a>01233 } <a name="l01234"></a>01234 <a name="l01235"></a>01235 <a class="code" href="classKCal_1_1Attachment.html" title="This class represents information related to an attachment.">Attachment</a> *ICalFormatImpl::readAttachment(icalproperty *attach) <a name="l01236"></a>01236 { <a name="l01237"></a>01237 <a class="code" href="classKCal_1_1Attachment.html" title="This class represents information related to an attachment.">Attachment</a> *attachment = 0; <a name="l01238"></a>01238 <a name="l01239"></a>01239 icalvalue_kind value_kind = icalvalue_isa(icalproperty_get_value(attach)); <a name="l01240"></a>01240 <a name="l01241"></a>01241 <span class="keywordflow">if</span> ( value_kind == ICAL_ATTACH_VALUE || value_kind == ICAL_BINARY_VALUE ) { <a name="l01242"></a>01242 icalattach *a = icalproperty_get_attach(attach); <a name="l01243"></a>01243 <a name="l01244"></a>01244 <span class="keywordtype">int</span> isurl = icalattach_get_is_url (a); <a name="l01245"></a>01245 <span class="keywordflow">if</span> (isurl == 0) <a name="l01246"></a>01246 attachment = <span class="keyword">new</span> <a class="code" href="classKCal_1_1Attachment.html" title="This class represents information related to an attachment.">Attachment</a>((<span class="keyword">const</span> <span class="keywordtype">char</span>*)icalattach_get_data(a)); <a name="l01247"></a>01247 <span class="keywordflow">else</span> { <a name="l01248"></a>01248 attachment = <span class="keyword">new</span> <a class="code" href="classKCal_1_1Attachment.html" title="This class represents information related to an attachment.">Attachment</a>(QString::fromUtf8(icalattach_get_url(a))); <a name="l01249"></a>01249 } <a name="l01250"></a>01250 } <a name="l01251"></a>01251 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( value_kind == ICAL_URI_VALUE ) { <a name="l01252"></a>01252 attachment = <span class="keyword">new</span> <a class="code" href="classKCal_1_1Attachment.html" title="This class represents information related to an attachment.">Attachment</a>(QString::fromUtf8(icalvalue_get_uri(icalproperty_get_value(attach)))); <a name="l01253"></a>01253 } <a name="l01254"></a>01254 <a name="l01255"></a>01255 icalparameter *p = icalproperty_get_first_parameter(attach, ICAL_FMTTYPE_PARAMETER); <a name="l01256"></a>01256 <span class="keywordflow">if</span> (p && attachment) <a name="l01257"></a>01257 attachment-><a class="code" href="classKCal_1_1Attachment.html#da25db545139c48a288e258c5ef920c5">setMimeType</a>(QString(icalparameter_get_fmttype(p))); <a name="l01258"></a>01258 <a name="l01259"></a>01259 p = icalproperty_get_first_parameter(attach,ICAL_X_PARAMETER); <a name="l01260"></a>01260 <span class="keywordflow">while</span> (p) { <a name="l01261"></a>01261 <span class="keywordflow">if</span> ( strncmp (icalparameter_get_xname(p), <span class="stringliteral">"X-LABEL"</span>, 7) == 0 ) <a name="l01262"></a>01262 attachment-><a class="code" href="classKCal_1_1Attachment.html#da86a1b177047fb6f33d625ca1bde76f">setLabel</a>( icalparameter_get_xvalue(p) ); <a name="l01263"></a>01263 p = icalproperty_get_next_parameter(attach, ICAL_X_PARAMETER); <a name="l01264"></a>01264 } <a name="l01265"></a>01265 <a name="l01266"></a>01266 <span class="keywordflow">return</span> attachment; <a name="l01267"></a>01267 } <a name="l01268"></a>01268 <a name="l01269"></a>01269 <span class="keywordtype">void</span> ICalFormatImpl::readIncidence(icalcomponent *parent, icaltimezone *tz, <a class="code" href="classKCal_1_1Incidence.html" title="This class provides the base class common to all calendar components.">Incidence</a> *incidence) <a name="l01270"></a>01270 { <a name="l01271"></a>01271 readIncidenceBase(parent,incidence); <a name="l01272"></a>01272 <a name="l01273"></a>01273 icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY); <a name="l01274"></a>01274 <a name="l01275"></a>01275 <span class="keyword">const</span> <span class="keywordtype">char</span> *text; <a name="l01276"></a>01276 <span class="keywordtype">int</span> intvalue, inttext; <a name="l01277"></a>01277 icaltimetype icaltime; <a name="l01278"></a>01278 icaldurationtype icalduration; <a name="l01279"></a>01279 <a name="l01280"></a>01280 QStringList categories; <a name="l01281"></a>01281 <a name="l01282"></a>01282 <span class="keywordflow">while</span> (p) { <a name="l01283"></a>01283 icalproperty_kind kind = icalproperty_isa(p); <a name="l01284"></a>01284 <span class="keywordflow">switch</span> (kind) { <a name="l01285"></a>01285 <a name="l01286"></a>01286 <span class="keywordflow">case</span> ICAL_CREATED_PROPERTY: <a name="l01287"></a>01287 icaltime = icalproperty_get_created(p); <a name="l01288"></a>01288 incidence-><a class="code" href="classKCal_1_1Incidence.html#92caf650b529278607a04c96c1d90ee8" title="Set creation date.">setCreated</a>(readICalDateTime(icaltime, tz)); <a name="l01289"></a>01289 <span class="keywordflow">break</span>; <a name="l01290"></a>01290 <a name="l01291"></a>01291 <span class="keywordflow">case</span> ICAL_SEQUENCE_PROPERTY: <span class="comment">// sequence</span> <a name="l01292"></a>01292 intvalue = icalproperty_get_sequence(p); <a name="l01293"></a>01293 incidence-><a class="code" href="classKCal_1_1Incidence.html#d9cf94ebb636d6ce56b8f2f74d5c51d3" title="Set the number of revisions this event has seen.">setRevision</a>(intvalue); <a name="l01294"></a>01294 <span class="keywordflow">break</span>; <a name="l01295"></a>01295 <a name="l01296"></a>01296 <span class="keywordflow">case</span> ICAL_LASTMODIFIED_PROPERTY: <span class="comment">// last modification date</span> <a name="l01297"></a>01297 icaltime = icalproperty_get_lastmodified(p); <a name="l01298"></a>01298 incidence-><a class="code" href="classKCal_1_1IncidenceBase.html#a040b96c3565ddf597b795f69dea28dc" title="Sets the time the incidence was last modified.">setLastModified</a>(readICalDateTime(icaltime, tz)); <a name="l01299"></a>01299 <span class="keywordflow">break</span>; <a name="l01300"></a>01300 <a name="l01301"></a>01301 <span class="keywordflow">case</span> ICAL_DTSTART_PROPERTY: <span class="comment">// start date and time</span> <a name="l01302"></a>01302 icaltime = icalproperty_get_dtstart(p); <a name="l01303"></a>01303 <span class="keywordflow">if</span> (icaltime.is_date) { <a name="l01304"></a>01304 incidence-><a class="code" href="classKCal_1_1Incidence.html#e3042339856d8295139b32fc40064876" title="Set starting date/time.">setDtStart</a>(QDateTime(readICalDate(icaltime),QTime(0,0,0))); <a name="l01305"></a>01305 incidence-><a class="code" href="classKCal_1_1Incidence.html#8a9b61c884ea9450c9ebea186e73ecc6" title="Set whether the incidence floats, i.e.">setFloats</a>( <span class="keyword">true</span> ); <a name="l01306"></a>01306 } <span class="keywordflow">else</span> { <a name="l01307"></a>01307 incidence-><a class="code" href="classKCal_1_1Incidence.html#e3042339856d8295139b32fc40064876" title="Set starting date/time.">setDtStart</a>(readICalDateTime(icaltime, tz)); <a name="l01308"></a>01308 incidence-><a class="code" href="classKCal_1_1Incidence.html#8a9b61c884ea9450c9ebea186e73ecc6" title="Set whether the incidence floats, i.e.">setFloats</a>( <span class="keyword">false</span> ); <a name="l01309"></a>01309 } <a name="l01310"></a>01310 <span class="keywordflow">break</span>; <a name="l01311"></a>01311 <a name="l01312"></a>01312 <span class="keywordflow">case</span> ICAL_DURATION_PROPERTY: <span class="comment">// start date and time</span> <a name="l01313"></a>01313 icalduration = icalproperty_get_duration(p); <a name="l01314"></a>01314 incidence-><a class="code" href="classKCal_1_1IncidenceBase.html#63b548d6173f738ec13c96b7cc5412d1">setDuration</a>(readICalDuration(icalduration)); <a name="l01315"></a>01315 <span class="keywordflow">break</span>; <a name="l01316"></a>01316 <a name="l01317"></a>01317 <span class="keywordflow">case</span> ICAL_DESCRIPTION_PROPERTY: <span class="comment">// description</span> <a name="l01318"></a>01318 text = icalproperty_get_description(p); <a name="l01319"></a>01319 incidence-><a class="code" href="classKCal_1_1Incidence.html#d0b8ac8e276e7532ffe7320e92ef6680" title="Set the long description.">setDescription</a>(QString::fromUtf8(text)); <a name="l01320"></a>01320 <span class="keywordflow">break</span>; <a name="l01321"></a>01321 <a name="l01322"></a>01322 <span class="keywordflow">case</span> ICAL_SUMMARY_PROPERTY: <span class="comment">// summary</span> <a name="l01323"></a>01323 text = icalproperty_get_summary(p); <a name="l01324"></a>01324 incidence-><a class="code" href="classKCal_1_1Incidence.html#fc2fecb0924ad84c61b9210d5cc5cc9f" title="Set short summary.">setSummary</a>(QString::fromUtf8(text)); <a name="l01325"></a>01325 <span class="keywordflow">break</span>; <a name="l01326"></a>01326 <a name="l01327"></a>01327 <span class="keywordflow">case</span> ICAL_LOCATION_PROPERTY: <span class="comment">// location</span> <a name="l01328"></a>01328 text = icalproperty_get_location(p); <a name="l01329"></a>01329 incidence-><a class="code" href="classKCal_1_1Incidence.html#2598423ba89a6444f9b92450de976e95" title="Set the event&#39;s/todo&#39;s location.">setLocation</a>(QString::fromUtf8(text)); <a name="l01330"></a>01330 <span class="keywordflow">break</span>; <a name="l01331"></a>01331 <a name="l01332"></a>01332 <span class="keywordflow">case</span> ICAL_STATUS_PROPERTY: { <span class="comment">// status</span> <a name="l01333"></a>01333 <a class="code" href="classKCal_1_1Incidence.html#671e161ac7fe2923d4fdab50b233e7a5" title="Enumeration for describing an event&#39;s status.">Incidence::Status</a> stat; <a name="l01334"></a>01334 <span class="keywordflow">switch</span> (icalproperty_get_status(p)) { <a name="l01335"></a>01335 <span class="keywordflow">case</span> ICAL_STATUS_TENTATIVE: stat = Incidence::StatusTentative; <span class="keywordflow">break</span>; <a name="l01336"></a>01336 <span class="keywordflow">case</span> ICAL_STATUS_CONFIRMED: stat = Incidence::StatusConfirmed; <span class="keywordflow">break</span>; <a name="l01337"></a>01337 <span class="keywordflow">case</span> ICAL_STATUS_COMPLETED: stat = Incidence::StatusCompleted; <span class="keywordflow">break</span>; <a name="l01338"></a>01338 <span class="keywordflow">case</span> ICAL_STATUS_NEEDSACTION: stat = Incidence::StatusNeedsAction; <span class="keywordflow">break</span>; <a name="l01339"></a>01339 <span class="keywordflow">case</span> ICAL_STATUS_CANCELLED: stat = Incidence::StatusCanceled; <span class="keywordflow">break</span>; <a name="l01340"></a>01340 <span class="keywordflow">case</span> ICAL_STATUS_INPROCESS: stat = Incidence::StatusInProcess; <span class="keywordflow">break</span>; <a name="l01341"></a>01341 <span class="keywordflow">case</span> ICAL_STATUS_DRAFT: stat = Incidence::StatusDraft; <span class="keywordflow">break</span>; <a name="l01342"></a>01342 <span class="keywordflow">case</span> ICAL_STATUS_FINAL: stat = Incidence::StatusFinal; <span class="keywordflow">break</span>; <a name="l01343"></a>01343 <span class="keywordflow">case</span> ICAL_STATUS_X: <a name="l01344"></a>01344 incidence-><a class="code" href="classKCal_1_1Incidence.html#2a8bb37db6b597048ce0db73298eab5e" title="Sets the incidence status to a non-standard status value.">setCustomStatus</a>(QString::fromUtf8(icalvalue_get_x(icalproperty_get_value(p)))); <a name="l01345"></a>01345 stat = Incidence::StatusX; <a name="l01346"></a>01346 <span class="keywordflow">break</span>; <a name="l01347"></a>01347 <span class="keywordflow">case</span> ICAL_STATUS_NONE: <a name="l01348"></a>01348 <span class="keywordflow">default</span>: stat = Incidence::StatusNone; <span class="keywordflow">break</span>; <a name="l01349"></a>01349 } <a name="l01350"></a>01350 <span class="keywordflow">if</span> (stat != Incidence::StatusX) <a name="l01351"></a>01351 incidence-><a class="code" href="classKCal_1_1Incidence.html#74c36e044364aa3c0321d87a0232bf62" title="Sets the incidence status to a standard status value.">setStatus</a>(stat); <a name="l01352"></a>01352 <span class="keywordflow">break</span>; <a name="l01353"></a>01353 } <a name="l01354"></a>01354 <a name="l01355"></a>01355 <span class="keywordflow">case</span> ICAL_PRIORITY_PROPERTY: <span class="comment">// priority</span> <a name="l01356"></a>01356 intvalue = icalproperty_get_priority( p ); <a name="l01357"></a>01357 <span class="keywordflow">if</span> ( mCompat ) <a name="l01358"></a>01358 intvalue = mCompat->fixPriority( intvalue ); <a name="l01359"></a>01359 incidence-><a class="code" href="classKCal_1_1Incidence.html#48dd6c2c478e1c26068b6389b1a2fc96" title="Set the incidences priority.">setPriority</a>( intvalue ); <a name="l01360"></a>01360 <span class="keywordflow">break</span>; <a name="l01361"></a>01361 <a name="l01362"></a>01362 <span class="keywordflow">case</span> ICAL_CATEGORIES_PROPERTY: <span class="comment">// categories</span> <a name="l01363"></a>01363 text = icalproperty_get_categories(p); <a name="l01364"></a>01364 categories.append(QString::fromUtf8(text)); <a name="l01365"></a>01365 <span class="keywordflow">break</span>; <a name="l01366"></a>01366 <a name="l01367"></a>01367 <span class="keywordflow">case</span> ICAL_RRULE_PROPERTY: <a name="l01368"></a>01368 readRecurrenceRule( p, incidence ); <a name="l01369"></a>01369 <span class="keywordflow">break</span>; <a name="l01370"></a>01370 <a name="l01371"></a>01371 <span class="keywordflow">case</span> ICAL_RDATE_PROPERTY: { <a name="l01372"></a>01372 icaldatetimeperiodtype rd = icalproperty_get_rdate( p ); <a name="l01373"></a>01373 <span class="keywordflow">if</span> ( icaltime_is_valid_time( rd.time ) ) { <a name="l01374"></a>01374 <span class="keywordflow">if</span> ( icaltime_is_date( rd.time ) ) { <a name="l01375"></a>01375 incidence-><a class="code" href="classKCal_1_1Incidence.html#d06004593e064a37d08c96f9ae16735e" title="Return the recurrence rule associated with this incidence.">recurrence</a>()-><a class="code" href="classKCal_1_1Recurrence.html#975ae157426890e4832beb2998d32ea4">addRDate</a>( readICalDate( rd.time ) ); <a name="l01376"></a>01376 } <span class="keywordflow">else</span> { <a name="l01377"></a>01377 incidence-><a class="code" href="classKCal_1_1Incidence.html#d06004593e064a37d08c96f9ae16735e" title="Return the recurrence rule associated with this incidence.">recurrence</a>()-><a class="code" href="classKCal_1_1Recurrence.html#df9700b43822aa3f4df9b98f28dffc74">addRDateTime</a>( readICalDateTime( rd.time, tz ) ); <a name="l01378"></a>01378 } <a name="l01379"></a>01379 } <span class="keywordflow">else</span> { <a name="l01380"></a>01380 <span class="comment">// TODO: RDates as period are not yet implemented!</span> <a name="l01381"></a>01381 } <a name="l01382"></a>01382 <span class="keywordflow">break</span>; } <a name="l01383"></a>01383 <a name="l01384"></a>01384 <span class="keywordflow">case</span> ICAL_EXRULE_PROPERTY: <a name="l01385"></a>01385 readExceptionRule( p, incidence ); <a name="l01386"></a>01386 <span class="keywordflow">break</span>; <a name="l01387"></a>01387 <a name="l01388"></a>01388 <span class="keywordflow">case</span> ICAL_EXDATE_PROPERTY: <a name="l01389"></a>01389 icaltime = icalproperty_get_exdate(p); <a name="l01390"></a>01390 <span class="keywordflow">if</span> ( icaltime_is_date(icaltime) ) { <a name="l01391"></a>01391 incidence-><a class="code" href="classKCal_1_1Incidence.html#d06004593e064a37d08c96f9ae16735e" title="Return the recurrence rule associated with this incidence.">recurrence</a>()-><a class="code" href="classKCal_1_1Recurrence.html#12d7d0347442011c30b8152cfb429580">addExDate</a>( readICalDate(icaltime) ); <a name="l01392"></a>01392 } <span class="keywordflow">else</span> { <a name="l01393"></a>01393 incidence-><a class="code" href="classKCal_1_1Incidence.html#d06004593e064a37d08c96f9ae16735e" title="Return the recurrence rule associated with this incidence.">recurrence</a>()-><a class="code" href="classKCal_1_1Recurrence.html#7ac324cf3ad1f47f539979f54520c35d">addExDateTime</a>( readICalDateTime(icaltime, tz) ); <a name="l01394"></a>01394 } <a name="l01395"></a>01395 <span class="keywordflow">break</span>; <a name="l01396"></a>01396 <a name="l01397"></a>01397 <span class="keywordflow">case</span> ICAL_CLASS_PROPERTY: <a name="l01398"></a>01398 inttext = icalproperty_get_class(p); <a name="l01399"></a>01399 <span class="keywordflow">if</span> (inttext == ICAL_CLASS_PUBLIC ) { <a name="l01400"></a>01400 incidence-><a class="code" href="classKCal_1_1Incidence.html#4cfe9fc43f2f10c1c4f10d792fe2ac3f" title="Sets secrecy status.">setSecrecy</a>(Incidence::SecrecyPublic); <a name="l01401"></a>01401 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (inttext == ICAL_CLASS_CONFIDENTIAL ) { <a name="l01402"></a>01402 incidence-><a class="code" href="classKCal_1_1Incidence.html#4cfe9fc43f2f10c1c4f10d792fe2ac3f" title="Sets secrecy status.">setSecrecy</a>(Incidence::SecrecyConfidential); <a name="l01403"></a>01403 } <span class="keywordflow">else</span> { <a name="l01404"></a>01404 incidence-><a class="code" href="classKCal_1_1Incidence.html#4cfe9fc43f2f10c1c4f10d792fe2ac3f" title="Sets secrecy status.">setSecrecy</a>(Incidence::SecrecyPrivate); <a name="l01405"></a>01405 } <a name="l01406"></a>01406 <span class="keywordflow">break</span>; <a name="l01407"></a>01407 <a name="l01408"></a>01408 <span class="keywordflow">case</span> ICAL_ATTACH_PROPERTY: <span class="comment">// attachments</span> <a name="l01409"></a>01409 incidence-><a class="code" href="classKCal_1_1Incidence.html#0e2d04b08c67e77f9278d5ed72621032" title="Add attachment.">addAttachment</a>(readAttachment(p)); <a name="l01410"></a>01410 <span class="keywordflow">break</span>; <a name="l01411"></a>01411 <a name="l01412"></a>01412 <span class="keywordflow">default</span>: <a name="l01413"></a>01413 <span class="comment">// kdDebug(5800) << "ICALFormat::readIncidence(): Unknown property: " << kind</span> <a name="l01414"></a>01414 <span class="comment">// << endl;</span> <a name="l01415"></a>01415 <span class="keywordflow">break</span>; <a name="l01416"></a>01416 } <a name="l01417"></a>01417 <a name="l01418"></a>01418 p = icalcomponent_get_next_property(parent,ICAL_ANY_PROPERTY); <a name="l01419"></a>01419 } <a name="l01420"></a>01420 <a name="l01421"></a>01421 <span class="comment">// Set the scheduling ID</span> <a name="l01422"></a>01422 <span class="keyword">const</span> QString uid = incidence-><a class="code" href="classKCal_1_1CustomProperties.html#4809ed307d0a7e8bae90485a34e342fb" title="Return the value of a custom calendar property.">customProperty</a>( <span class="stringliteral">"LIBKCAL"</span>, <span class="stringliteral">"ID"</span> ); <a name="l01423"></a>01423 <span class="keywordflow">if</span> ( !uid.isNull() ) { <a name="l01424"></a>01424 <span class="comment">// The UID stored in incidencebase is actually the scheduling ID</span> <a name="l01425"></a>01425 <span class="comment">// It has to be stored in the iCal UID component for compatibility</span> <a name="l01426"></a>01426 <span class="comment">// with other iCal applications</span> <a name="l01427"></a>01427 incidence-><a class="code" href="classKCal_1_1Incidence.html#1a6793b0ed0d7704f9e2b16e64a3f842" title="Set the event&#39;s/todo&#39;s scheduling ID.">setSchedulingID</a>( incidence-><a class="code" href="classKCal_1_1IncidenceBase.html#75c8bd2df73c5a62bd7cf77c2ac4d3c6" title="Return the unique id for the event.">uid</a>() ); <a name="l01428"></a>01428 incidence-><a class="code" href="classKCal_1_1IncidenceBase.html#cc1c34f32a0b3057be593a1ad492b48f" title="Set the unique id for the event.">setUid</a>( uid ); <a name="l01429"></a>01429 } <a name="l01430"></a>01430 <a name="l01431"></a>01431 <span class="comment">// Now that recurrence and exception stuff is completely set up,</span> <a name="l01432"></a>01432 <span class="comment">// do any backwards compatibility adjustments.</span> <a name="l01433"></a>01433 <span class="keywordflow">if</span> ( incidence-><a class="code" href="classKCal_1_1Incidence.html#81ad15662138be07f0d55be6b075b043" title="Forward to Recurrence::doesRecur().">doesRecur</a>() && mCompat ) <a name="l01434"></a>01434 mCompat->fixRecurrence( incidence ); <a name="l01435"></a>01435 <a name="l01436"></a>01436 <span class="comment">// add categories</span> <a name="l01437"></a>01437 incidence-><a class="code" href="classKCal_1_1Incidence.html#e1c00b65d6803d1140ce5e79c5935ab6" title="Set categories.">setCategories</a>(categories); <a name="l01438"></a>01438 <a name="l01439"></a>01439 <span class="comment">// iterate through all alarms</span> <a name="l01440"></a>01440 <span class="keywordflow">for</span> (icalcomponent *alarm = icalcomponent_get_first_component(parent,ICAL_VALARM_COMPONENT); <a name="l01441"></a>01441 alarm; <a name="l01442"></a>01442 alarm = icalcomponent_get_next_component(parent,ICAL_VALARM_COMPONENT)) { <a name="l01443"></a>01443 readAlarm(alarm,incidence); <a name="l01444"></a>01444 } <a name="l01445"></a>01445 <span class="comment">// Fix incorrect alarm settings by other applications (like outloook 9)</span> <a name="l01446"></a>01446 <span class="keywordflow">if</span> ( mCompat ) mCompat->fixAlarms( incidence ); <a name="l01447"></a>01447 <a name="l01448"></a>01448 } <a name="l01449"></a>01449 <a name="l01450"></a>01450 <span class="keywordtype">void</span> ICalFormatImpl::readIncidenceBase(icalcomponent *parent,<a class="code" href="classKCal_1_1IncidenceBase.html" title="This class provides the base class common to all calendar components.">IncidenceBase</a> *incidenceBase) <a name="l01451"></a>01451 { <a name="l01452"></a>01452 icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY); <a name="l01453"></a>01453 <a name="l01454"></a>01454 <span class="keywordflow">while</span> (p) { <a name="l01455"></a>01455 icalproperty_kind kind = icalproperty_isa(p); <a name="l01456"></a>01456 <span class="keywordflow">switch</span> (kind) { <a name="l01457"></a>01457 <a name="l01458"></a>01458 <span class="keywordflow">case</span> ICAL_UID_PROPERTY: <span class="comment">// unique id</span> <a name="l01459"></a>01459 incidenceBase-><a class="code" href="classKCal_1_1IncidenceBase.html#cc1c34f32a0b3057be593a1ad492b48f" title="Set the unique id for the event.">setUid</a>(QString::fromUtf8(icalproperty_get_uid(p))); <a name="l01460"></a>01460 <span class="keywordflow">break</span>; <a name="l01461"></a>01461 <a name="l01462"></a>01462 <span class="keywordflow">case</span> ICAL_ORGANIZER_PROPERTY: <span class="comment">// organizer</span> <a name="l01463"></a>01463 incidenceBase-><a class="code" href="classKCal_1_1IncidenceBase.html#117a09a965803c17635d9a3631a66772" title="sets the organizer for the event">setOrganizer</a>( readOrganizer(p)); <a name="l01464"></a>01464 <span class="keywordflow">break</span>; <a name="l01465"></a>01465 <a name="l01466"></a>01466 <span class="keywordflow">case</span> ICAL_ATTENDEE_PROPERTY: <span class="comment">// attendee</span> <a name="l01467"></a>01467 incidenceBase-><a class="code" href="classKCal_1_1IncidenceBase.html#fda055fdc8e625448a3d1d6482a413b8" title="Add Attendee to this incidence.">addAttendee</a>(readAttendee(p)); <a name="l01468"></a>01468 <span class="keywordflow">break</span>; <a name="l01469"></a>01469 <a name="l01470"></a>01470 <span class="keywordflow">case</span> ICAL_COMMENT_PROPERTY: <a name="l01471"></a>01471 incidenceBase-><a class="code" href="classKCal_1_1IncidenceBase.html#4ebbfe21416f817ba7e9dad1d3e84656" title="Add a comment to this incidence.">addComment</a>( <a name="l01472"></a>01472 QString::fromUtf8(icalproperty_get_comment(p))); <a name="l01473"></a>01473 <span class="keywordflow">break</span>; <a name="l01474"></a>01474 <a name="l01475"></a>01475 <span class="keywordflow">default</span>: <a name="l01476"></a>01476 <span class="keywordflow">break</span>; <a name="l01477"></a>01477 } <a name="l01478"></a>01478 <a name="l01479"></a>01479 p = icalcomponent_get_next_property(parent,ICAL_ANY_PROPERTY); <a name="l01480"></a>01480 } <a name="l01481"></a>01481 <a name="l01482"></a>01482 <span class="comment">// kpilot stuff</span> <a name="l01483"></a>01483 <span class="comment">// TODO: move this application-specific code to kpilot</span> <a name="l01484"></a>01484 <span class="comment">// need to get X-PILOT* attributes out, set correct properties, and get</span> <a name="l01485"></a>01485 <span class="comment">// rid of them...</span> <a name="l01486"></a>01486 <span class="comment">// Pointer fun, as per libical documentation</span> <a name="l01487"></a>01487 <span class="comment">// (documented in UsingLibical.txt)</span> <a name="l01488"></a>01488 icalproperty *next =0; <a name="l01489"></a>01489 <a name="l01490"></a>01490 <span class="keywordflow">for</span> ( p = icalcomponent_get_first_property(parent,ICAL_X_PROPERTY); <a name="l01491"></a>01491 p != 0; <a name="l01492"></a>01492 p = next ) <a name="l01493"></a>01493 { <a name="l01494"></a>01494 <a name="l01495"></a>01495 next = icalcomponent_get_next_property(parent,ICAL_X_PROPERTY); <a name="l01496"></a>01496 <a name="l01497"></a>01497 QString value = QString::fromUtf8(icalproperty_get_x(p)); <a name="l01498"></a>01498 QString name = icalproperty_get_x_name(p); <a name="l01499"></a>01499 <a name="l01500"></a>01500 <span class="keywordflow">if</span> (name == <span class="stringliteral">"X-PILOTID"</span> && !value.isEmpty()) { <a name="l01501"></a>01501 incidenceBase-><a class="code" href="classKCal_1_1IncidenceBase.html#236c3df4516abcfbb6ab6ec6c6ee8927" title="Set Pilot Id.">setPilotId</a>(value.toInt()); <a name="l01502"></a>01502 icalcomponent_remove_property(parent,p); <a name="l01503"></a>01503 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">"X-PILOTSTAT"</span> && !value.isEmpty()) { <a name="l01504"></a>01504 incidenceBase-><a class="code" href="classKCal_1_1IncidenceBase.html#e8f68e1bc6501741e690418d6c731490" title="Set synchronisation satus.">setSyncStatus</a>(value.toInt()); <a name="l01505"></a>01505 icalcomponent_remove_property(parent,p); <a name="l01506"></a>01506 } <a name="l01507"></a>01507 } <a name="l01508"></a>01508 <a name="l01509"></a>01509 <span class="comment">// custom properties</span> <a name="l01510"></a>01510 readCustomProperties(parent, incidenceBase); <a name="l01511"></a>01511 } <a name="l01512"></a>01512 <a name="l01513"></a>01513 <span class="keywordtype">void</span> ICalFormatImpl::readCustomProperties(icalcomponent *parent,<a class="code" href="classKCal_1_1CustomProperties.html" title="This class represents custom calendar properties.">CustomProperties</a> *properties) <a name="l01514"></a>01514 { <a name="l01515"></a>01515 QMap<QCString, QString> customProperties; <a name="l01516"></a>01516 QString lastProperty; <a name="l01517"></a>01517 <a name="l01518"></a>01518 icalproperty *p = icalcomponent_get_first_property(parent,ICAL_X_PROPERTY); <a name="l01519"></a>01519 <a name="l01520"></a>01520 <span class="keywordflow">while</span> (p) { <a name="l01521"></a>01521 <a name="l01522"></a>01522 QString value = QString::fromUtf8(icalproperty_get_x(p)); <a name="l01523"></a>01523 <span class="keyword">const</span> <span class="keywordtype">char</span> *name = icalproperty_get_x_name(p); <a name="l01524"></a>01524 <span class="keywordflow">if</span> ( lastProperty != name ) { <a name="l01525"></a>01525 customProperties[name] = value; <a name="l01526"></a>01526 } <span class="keywordflow">else</span> { <a name="l01527"></a>01527 customProperties[name] = customProperties[name].append( <span class="stringliteral">","</span> ).append( value ); <a name="l01528"></a>01528 } <a name="l01529"></a>01529 <span class="comment">// kdDebug(5800) << "Set custom property [" << name << '=' << value << ']' << endl;</span> <a name="l01530"></a>01530 p = icalcomponent_get_next_property(parent,ICAL_X_PROPERTY); <a name="l01531"></a>01531 lastProperty = name; <a name="l01532"></a>01532 } <a name="l01533"></a>01533 <a name="l01534"></a>01534 properties-><a class="code" href="classKCal_1_1CustomProperties.html#9d8eef7f3b3873bbe3471e3dda8ebc50" title="Initialise the alarm&#39;s custom calendar properties to the specified key/value...">setCustomProperties</a>(customProperties); <a name="l01535"></a>01535 } <a name="l01536"></a>01536 <a name="l01537"></a>01537 <a name="l01538"></a>01538 <a name="l01539"></a>01539 <span class="keywordtype">void</span> ICalFormatImpl::readRecurrenceRule(icalproperty *rrule,<a class="code" href="classKCal_1_1Incidence.html" title="This class provides the base class common to all calendar components.">Incidence</a> *incidence ) <a name="l01540"></a>01540 { <a name="l01541"></a>01541 <span class="comment">// kdDebug(5800) << "Read recurrence for " << incidence->summary() << endl;</span> <a name="l01542"></a>01542 <a name="l01543"></a>01543 <a class="code" href="classKCal_1_1Recurrence.html" title="This class represents a recurrence rule for a calendar incidence.">Recurrence</a> *recur = incidence-><a class="code" href="classKCal_1_1Incidence.html#d06004593e064a37d08c96f9ae16735e" title="Return the recurrence rule associated with this incidence.">recurrence</a>(); <a name="l01544"></a>01544 <a name="l01545"></a>01545 <span class="keyword">struct </span>icalrecurrencetype r = icalproperty_get_rrule(rrule); <a name="l01546"></a>01546 <span class="comment">// dumpIcalRecurrence(r);</span> <a name="l01547"></a>01547 <a name="l01548"></a>01548 <a class="code" href="classKCal_1_1RecurrenceRule.html" title="This class represents a recurrence rule for a calendar incidence.">RecurrenceRule</a> *recurrule = <span class="keyword">new</span> <a class="code" href="classKCal_1_1RecurrenceRule.html" title="This class represents a recurrence rule for a calendar incidence.">RecurrenceRule</a>( <span class="comment">/*incidence*/</span> ); <a name="l01549"></a>01549 recurrule-><a class="code" href="classKCal_1_1RecurrenceRule.html#ac94a23ae67e5dc6fa4c65e7a3178a0a" title="Set start of recurrence, as a date and time.">setStartDt</a>( incidence-><a class="code" href="classKCal_1_1IncidenceBase.html#5419a946a4e5715a0c34ec2c7e04cd9b" title="returns an event&#39;s starting date/time as a QDateTime.">dtStart</a>() ); <a name="l01550"></a>01550 readRecurrence( r, recurrule ); <a name="l01551"></a>01551 recur-><a class="code" href="classKCal_1_1Recurrence.html#a3a835056b03fa8c6d230ef134d4204e">addRRule</a>( recurrule ); <a name="l01552"></a>01552 } <a name="l01553"></a>01553 <a name="l01554"></a>01554 <span class="keywordtype">void</span> ICalFormatImpl::readExceptionRule( icalproperty *rrule, <a class="code" href="classKCal_1_1Incidence.html" title="This class provides the base class common to all calendar components.">Incidence</a> *incidence ) <a name="l01555"></a>01555 { <a name="l01556"></a>01556 <span class="comment">// kdDebug(5800) << "Read recurrence for " << incidence->summary() << endl;</span> <a name="l01557"></a>01557 <a name="l01558"></a>01558 <span class="keyword">struct </span>icalrecurrencetype r = icalproperty_get_exrule(rrule); <a name="l01559"></a>01559 <span class="comment">// dumpIcalRecurrence(r);</span> <a name="l01560"></a>01560 <a name="l01561"></a>01561 <a class="code" href="classKCal_1_1RecurrenceRule.html" title="This class represents a recurrence rule for a calendar incidence.">RecurrenceRule</a> *recurrule = <span class="keyword">new</span> <a class="code" href="classKCal_1_1RecurrenceRule.html" title="This class represents a recurrence rule for a calendar incidence.">RecurrenceRule</a>( <span class="comment">/*incidence*/</span> ); <a name="l01562"></a>01562 recurrule-><a class="code" href="classKCal_1_1RecurrenceRule.html#ac94a23ae67e5dc6fa4c65e7a3178a0a" title="Set start of recurrence, as a date and time.">setStartDt</a>( incidence-><a class="code" href="classKCal_1_1IncidenceBase.html#5419a946a4e5715a0c34ec2c7e04cd9b" title="returns an event&#39;s starting date/time as a QDateTime.">dtStart</a>() ); <a name="l01563"></a>01563 readRecurrence( r, recurrule ); <a name="l01564"></a>01564 <a name="l01565"></a>01565 <a class="code" href="classKCal_1_1Recurrence.html" title="This class represents a recurrence rule for a calendar incidence.">Recurrence</a> *recur = incidence-><a class="code" href="classKCal_1_1Incidence.html#d06004593e064a37d08c96f9ae16735e" title="Return the recurrence rule associated with this incidence.">recurrence</a>(); <a name="l01566"></a>01566 recur-><a class="code" href="classKCal_1_1Recurrence.html#b0197e985e87c5f7af5aa633494a497b">addExRule</a>( recurrule ); <a name="l01567"></a>01567 } <a name="l01568"></a>01568 <a name="l01569"></a>01569 <span class="keywordtype">void</span> ICalFormatImpl::readRecurrence( <span class="keyword">const</span> <span class="keyword">struct</span> icalrecurrencetype &r, <a class="code" href="classKCal_1_1RecurrenceRule.html" title="This class represents a recurrence rule for a calendar incidence.">RecurrenceRule</a>* recur ) <a name="l01570"></a>01570 { <a name="l01571"></a>01571 <span class="comment">// Generate the RRULE string</span> <a name="l01572"></a>01572 recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#39931af2502c39e92b8afb0ca7bc4e93">mRRule</a> = QString( icalrecurrencetype_as_string( const_cast<struct icalrecurrencetype*>(&r) ) ); <a name="l01573"></a>01573 <span class="comment">// Period</span> <a name="l01574"></a>01574 <span class="keywordflow">switch</span> ( r.freq ) { <a name="l01575"></a>01575 <span class="keywordflow">case</span> ICAL_SECONDLY_RECURRENCE: recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#08ec078a941ad4661e427262041c2564">setRecurrenceType</a>( RecurrenceRule::rSecondly ); <span class="keywordflow">break</span>; <a name="l01576"></a>01576 <span class="keywordflow">case</span> ICAL_MINUTELY_RECURRENCE: recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#08ec078a941ad4661e427262041c2564">setRecurrenceType</a>( RecurrenceRule::rMinutely ); <span class="keywordflow">break</span>; <a name="l01577"></a>01577 <span class="keywordflow">case</span> ICAL_HOURLY_RECURRENCE: recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#08ec078a941ad4661e427262041c2564">setRecurrenceType</a>( RecurrenceRule::rHourly ); <span class="keywordflow">break</span>; <a name="l01578"></a>01578 <span class="keywordflow">case</span> ICAL_DAILY_RECURRENCE: recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#08ec078a941ad4661e427262041c2564">setRecurrenceType</a>( RecurrenceRule::rDaily ); <span class="keywordflow">break</span>; <a name="l01579"></a>01579 <span class="keywordflow">case</span> ICAL_WEEKLY_RECURRENCE: recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#08ec078a941ad4661e427262041c2564">setRecurrenceType</a>( RecurrenceRule::rWeekly ); <span class="keywordflow">break</span>; <a name="l01580"></a>01580 <span class="keywordflow">case</span> ICAL_MONTHLY_RECURRENCE: recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#08ec078a941ad4661e427262041c2564">setRecurrenceType</a>( RecurrenceRule::rMonthly ); <span class="keywordflow">break</span>; <a name="l01581"></a>01581 <span class="keywordflow">case</span> ICAL_YEARLY_RECURRENCE: recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#08ec078a941ad4661e427262041c2564">setRecurrenceType</a>( RecurrenceRule::rYearly ); <span class="keywordflow">break</span>; <a name="l01582"></a>01582 <span class="keywordflow">case</span> ICAL_NO_RECURRENCE: <a name="l01583"></a>01583 <span class="keywordflow">default</span>: <a name="l01584"></a>01584 recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#08ec078a941ad4661e427262041c2564">setRecurrenceType</a>( RecurrenceRule::rNone ); <a name="l01585"></a>01585 } <a name="l01586"></a>01586 <span class="comment">// Frequency</span> <a name="l01587"></a>01587 recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#5594fded1c7023d124674d21897a94d4" title="Sets the frequency of recurrence, in terms of the recurrence time period type.">setFrequency</a>( r.interval ); <a name="l01588"></a>01588 <a name="l01589"></a>01589 <span class="comment">// Duration & End Date</span> <a name="l01590"></a>01590 <span class="keywordflow">if</span> ( !icaltime_is_null_time( r.until ) ) { <a name="l01591"></a>01591 icaltimetype t; <a name="l01592"></a>01592 t = r.until; <a name="l01593"></a>01593 <span class="comment">// Convert to the correct time zone! it's in UTC by specification.</span> <a name="l01594"></a>01594 QDateTime endDate( readICalDateTime(t) ); <a name="l01595"></a>01595 recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#58f6bda7ee1d675168972a4a0bcb7633" title="Sets the date and time of the last recurrence.">setEndDt</a>( endDate ); <a name="l01596"></a>01596 } <span class="keywordflow">else</span> { <a name="l01597"></a>01597 <span class="keywordflow">if</span> (r.count == 0) <a name="l01598"></a>01598 recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#2c16ccbb4c87ebe799b3fe4c9125bb39" title="Sets the total number of times the event is to occur, including both the first and...">setDuration</a>( -1 ); <a name="l01599"></a>01599 <span class="keywordflow">else</span> <a name="l01600"></a>01600 recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#2c16ccbb4c87ebe799b3fe4c9125bb39" title="Sets the total number of times the event is to occur, including both the first and...">setDuration</a>( r.count ); <a name="l01601"></a>01601 } <a name="l01602"></a>01602 <a name="l01603"></a>01603 <span class="comment">// Week start setting</span> <a name="l01604"></a>01604 <span class="keywordtype">int</span> wkst = (r.week_start + 5)%7 + 1; <a name="l01605"></a>01605 recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#9e8df6e836b4a7f7c5f68cad4d0bff8d">setWeekStart</a>( wkst ); <a name="l01606"></a>01606 <a name="l01607"></a>01607 <span class="comment">// And now all BY*</span> <a name="l01608"></a>01608 QValueList<int> lst; <a name="l01609"></a>01609 <span class="keywordtype">int</span> i; <a name="l01610"></a>01610 <span class="keywordtype">int</span> index = 0; <a name="l01611"></a>01611 <a name="l01612"></a>01612 <span class="preprocessor">#define readSetByList(rrulecomp,setfunc) \</span> <a name="l01613"></a>01613 <span class="preprocessor"> index = 0; \</span> <a name="l01614"></a>01614 <span class="preprocessor"> lst.clear(); \</span> <a name="l01615"></a>01615 <span class="preprocessor"> while ( (i = r.rrulecomp[index++] ) != ICAL_RECURRENCE_ARRAY_MAX ) \</span> <a name="l01616"></a>01616 <span class="preprocessor"> lst.append( i ); \</span> <a name="l01617"></a>01617 <span class="preprocessor"> if ( !lst.isEmpty() ) recur->setfunc( lst );</span> <a name="l01618"></a>01618 <span class="preprocessor"></span> <a name="l01619"></a>01619 <span class="comment">// BYSECOND, MINUTE and HOUR, MONTHDAY, YEARDAY, WEEKNUMBER, MONTH</span> <a name="l01620"></a>01620 <span class="comment">// and SETPOS are standard int lists, so we can treat them with the</span> <a name="l01621"></a>01621 <span class="comment">// same macro</span> <a name="l01622"></a>01622 readSetByList( by_second, setBySeconds ); <a name="l01623"></a>01623 readSetByList( by_minute, setByMinutes ); <a name="l01624"></a>01624 readSetByList( by_hour, setByHours ); <a name="l01625"></a>01625 readSetByList( by_month_day, setByMonthDays ); <a name="l01626"></a>01626 readSetByList( by_year_day, setByYearDays ); <a name="l01627"></a>01627 readSetByList( by_week_no, setByWeekNumbers ); <a name="l01628"></a>01628 readSetByList( by_month, setByMonths ); <a name="l01629"></a>01629 readSetByList( by_set_pos, setBySetPos ); <a name="l01630"></a>01630 <span class="preprocessor">#undef readSetByList</span> <a name="l01631"></a>01631 <span class="preprocessor"></span> <a name="l01632"></a>01632 <span class="comment">// BYDAY is a special case, since it's not an int list</span> <a name="l01633"></a>01633 QValueList<RecurrenceRule::WDayPos> wdlst; <a name="l01634"></a>01634 <span class="keywordtype">short</span> day; <a name="l01635"></a>01635 index=0; <a name="l01636"></a>01636 <span class="keywordflow">while</span>((day = r.by_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { <a name="l01637"></a>01637 <a class="code" href="classKCal_1_1RecurrenceRule_1_1WDayPos.html" title="structure for describing the n-th weekday of the month/year.">RecurrenceRule::WDayPos</a> pos; <a name="l01638"></a>01638 pos.<a class="code" href="classKCal_1_1RecurrenceRule_1_1WDayPos.html#4d47e431dff4c9bdb48f2604e34960ef">setDay</a>( ( icalrecurrencetype_day_day_of_week( day ) + 5 )%7 + 1 ); <a name="l01639"></a>01639 pos.<a class="code" href="classKCal_1_1RecurrenceRule_1_1WDayPos.html#0d895d52bf05744513e4265c766f9bc2">setPos</a>( icalrecurrencetype_day_position( day ) ); <a name="l01640"></a>01640 <span class="comment">// kdDebug(5800)<< " o) By day, index="<<index-1<<", pos="<<pos.Pos<<", day="<<pos.Day<<endl;</span> <a name="l01641"></a>01641 wdlst.append( pos ); <a name="l01642"></a>01642 } <a name="l01643"></a>01643 <span class="keywordflow">if</span> ( !wdlst.isEmpty() ) recur-><a class="code" href="classKCal_1_1RecurrenceRule.html#af5dffb70271c618c2c546276c69881d">setByDays</a>( wdlst ); <a name="l01644"></a>01644 <a name="l01645"></a>01645 <a name="l01646"></a>01646 <span class="comment">// TODO Store all X- fields of the RRULE inside the recurrence (so they are</span> <a name="l01647"></a>01647 <span class="comment">// preserved</span> <a name="l01648"></a>01648 } <a name="l01649"></a>01649 <a name="l01650"></a>01650 <a name="l01651"></a>01651 <span class="keywordtype">void</span> ICalFormatImpl::readAlarm(icalcomponent *alarm,<a class="code" href="classKCal_1_1Incidence.html" title="This class provides the base class common to all calendar components.">Incidence</a> *incidence) <a name="l01652"></a>01652 { <a name="l01653"></a>01653 <span class="comment">// kdDebug(5800) << "Read alarm for " << incidence->summary() << endl;</span> <a name="l01654"></a>01654 <a name="l01655"></a>01655 <a class="code" href="classKCal_1_1Alarm.html" title="This class represents an alarm notification.">Alarm</a>* ialarm = incidence-><a class="code" href="classKCal_1_1Incidence.html#3c7e11ab7af4f867584d2ea502f097f5" title="Create a new alarm which is associated with this incidence.">newAlarm</a>(); <a name="l01656"></a>01656 ialarm-><a class="code" href="classKCal_1_1Alarm.html#25af13606c653d0009e5559bdad78ff3" title="Set how many times an alarm is to repeat itself after its initial occurrence (w/snoozes)...">setRepeatCount</a>(0); <a name="l01657"></a>01657 ialarm-><a class="code" href="classKCal_1_1Alarm.html#2d8acc8bc95f7946afd32872eee96d83" title="Set the alarm enabled status.">setEnabled</a>(<span class="keyword">true</span>); <a name="l01658"></a>01658 <a name="l01659"></a>01659 <span class="comment">// Determine the alarm's action type</span> <a name="l01660"></a>01660 icalproperty *p = icalcomponent_get_first_property(alarm,ICAL_ACTION_PROPERTY); <a name="l01661"></a>01661 Alarm::Type type = Alarm::Display; <a name="l01662"></a>01662 icalproperty_action action = ICAL_ACTION_DISPLAY; <a name="l01663"></a>01663 <span class="keywordflow">if</span> ( !p ) { <a name="l01664"></a>01664 kdDebug(5800) << <span class="stringliteral">"Unknown type of alarm, using default"</span> << endl; <a name="l01665"></a>01665 <span class="comment">// return;</span> <a name="l01666"></a>01666 } <span class="keywordflow">else</span> { <a name="l01667"></a>01667 <a name="l01668"></a>01668 action = icalproperty_get_action(p); <a name="l01669"></a>01669 <span class="keywordflow">switch</span> ( action ) { <a name="l01670"></a>01670 <span class="keywordflow">case</span> ICAL_ACTION_DISPLAY: type = Alarm::Display; <span class="keywordflow">break</span>; <a name="l01671"></a>01671 <span class="keywordflow">case</span> ICAL_ACTION_AUDIO: type = Alarm::Audio; <span class="keywordflow">break</span>; <a name="l01672"></a>01672 <span class="keywordflow">case</span> ICAL_ACTION_PROCEDURE: type = Alarm::Procedure; <span class="keywordflow">break</span>; <a name="l01673"></a>01673 <span class="keywordflow">case</span> ICAL_ACTION_EMAIL: type = Alarm::Email; <span class="keywordflow">break</span>; <a name="l01674"></a>01674 <span class="keywordflow">default</span>: <a name="l01675"></a>01675 kdDebug(5800) << <span class="stringliteral">"Unknown type of alarm: "</span> << action << endl; <a name="l01676"></a>01676 <span class="comment">// type = Alarm::Invalid;</span> <a name="l01677"></a>01677 } <a name="l01678"></a>01678 } <a name="l01679"></a>01679 ialarm-><a class="code" href="classKCal_1_1Alarm.html#d0c36260969d2f6b87d5dd726a6aad70" title="Set the type of the alarm.">setType</a>(type); <a name="l01680"></a>01680 <span class="comment">// kdDebug(5800) << " alarm type =" << type << endl;</span> <a name="l01681"></a>01681 <a name="l01682"></a>01682 p = icalcomponent_get_first_property(alarm,ICAL_ANY_PROPERTY); <a name="l01683"></a>01683 <span class="keywordflow">while</span> (p) { <a name="l01684"></a>01684 icalproperty_kind kind = icalproperty_isa(p); <a name="l01685"></a>01685 <a name="l01686"></a>01686 <span class="keywordflow">switch</span> (kind) { <a name="l01687"></a>01687 <a name="l01688"></a>01688 <span class="keywordflow">case</span> ICAL_TRIGGER_PROPERTY: { <a name="l01689"></a>01689 icaltriggertype trigger = icalproperty_get_trigger(p); <a name="l01690"></a>01690 <span class="keywordflow">if</span> (icaltime_is_null_time(trigger.time)) { <a name="l01691"></a>01691 <span class="keywordflow">if</span> (icaldurationtype_is_null_duration(trigger.duration)) { <a name="l01692"></a>01692 kdDebug(5800) << <span class="stringliteral">"ICalFormatImpl::readAlarm(): Trigger has no time and no duration."</span> << endl; <a name="l01693"></a>01693 } <span class="keywordflow">else</span> { <a name="l01694"></a>01694 <a class="code" href="classKCal_1_1Duration.html" title="This class represents a duration.">Duration</a> duration = icaldurationtype_as_int( trigger.duration ); <a name="l01695"></a>01695 icalparameter *param = icalproperty_get_first_parameter(p,ICAL_RELATED_PARAMETER); <a name="l01696"></a>01696 <span class="keywordflow">if</span> (param && icalparameter_get_related(param) == ICAL_RELATED_END) <a name="l01697"></a>01697 ialarm-><a class="code" href="classKCal_1_1Alarm.html#64954a958753560ea154d47cb1a9f439" title="Set offset of alarm in time relative to the end of the event.">setEndOffset</a>(duration); <a name="l01698"></a>01698 <span class="keywordflow">else</span> <a name="l01699"></a>01699 ialarm-><a class="code" href="classKCal_1_1Alarm.html#a8a1584d8039829258846a3c7dfb9e17" title="Set offset of alarm in time relative to the start of the event.">setStartOffset</a>(duration); <a name="l01700"></a>01700 } <a name="l01701"></a>01701 } <span class="keywordflow">else</span> { <a name="l01702"></a>01702 ialarm-><a class="code" href="classKCal_1_1Alarm.html#148abaa601477be008ce0ac348336084" title="Set the time to trigger an alarm.">setTime</a>(readICalDateTime(trigger.time)); <a name="l01703"></a>01703 } <a name="l01704"></a>01704 <span class="keywordflow">break</span>; <a name="l01705"></a>01705 } <a name="l01706"></a>01706 <span class="keywordflow">case</span> ICAL_DURATION_PROPERTY: { <a name="l01707"></a>01707 icaldurationtype duration = icalproperty_get_duration(p); <a name="l01708"></a>01708 ialarm-><a class="code" href="classKCal_1_1Alarm.html#5b32099b4b802027e4b75767f48f73df" title="Set the interval between snoozes for the alarm.">setSnoozeTime</a>(icaldurationtype_as_int(duration)/60); <a name="l01709"></a>01709 <span class="keywordflow">break</span>; <a name="l01710"></a>01710 } <a name="l01711"></a>01711 <span class="keywordflow">case</span> ICAL_REPEAT_PROPERTY: <a name="l01712"></a>01712 ialarm-><a class="code" href="classKCal_1_1Alarm.html#25af13606c653d0009e5559bdad78ff3" title="Set how many times an alarm is to repeat itself after its initial occurrence (w/snoozes)...">setRepeatCount</a>(icalproperty_get_repeat(p)); <a name="l01713"></a>01713 <span class="keywordflow">break</span>; <a name="l01714"></a>01714 <a name="l01715"></a>01715 <span class="comment">// Only in DISPLAY and EMAIL and PROCEDURE alarms</span> <a name="l01716"></a>01716 <span class="keywordflow">case</span> ICAL_DESCRIPTION_PROPERTY: { <a name="l01717"></a>01717 QString description = QString::fromUtf8(icalproperty_get_description(p)); <a name="l01718"></a>01718 <span class="keywordflow">switch</span> ( action ) { <a name="l01719"></a>01719 <span class="keywordflow">case</span> ICAL_ACTION_DISPLAY: <a name="l01720"></a>01720 ialarm-><a class="code" href="classKCal_1_1Alarm.html#56d43a82b12b6f8839c9f190ab9b096d" title="Set the text to be displayed when the alarm is triggered.">setText</a>( description ); <a name="l01721"></a>01721 <span class="keywordflow">break</span>; <a name="l01722"></a>01722 <span class="keywordflow">case</span> ICAL_ACTION_PROCEDURE: <a name="l01723"></a>01723 ialarm-><a class="code" href="classKCal_1_1Alarm.html#8a3cbb2e45e00c5ba4a8cda32a4d645b" title="Set the arguments to the program to execute when the alarm is triggered.">setProgramArguments</a>( description ); <a name="l01724"></a>01724 <span class="keywordflow">break</span>; <a name="l01725"></a>01725 <span class="keywordflow">case</span> ICAL_ACTION_EMAIL: <a name="l01726"></a>01726 ialarm-><a class="code" href="classKCal_1_1Alarm.html#fa55f36170722669c8a324dec20350bf" title="Set the email body text.">setMailText</a>( description ); <a name="l01727"></a>01727 <span class="keywordflow">break</span>; <a name="l01728"></a>01728 <span class="keywordflow">default</span>: <a name="l01729"></a>01729 <span class="keywordflow">break</span>; <a name="l01730"></a>01730 } <a name="l01731"></a>01731 <span class="keywordflow">break</span>; <a name="l01732"></a>01732 } <a name="l01733"></a>01733 <span class="comment">// Only in EMAIL alarm</span> <a name="l01734"></a>01734 <span class="keywordflow">case</span> ICAL_SUMMARY_PROPERTY: <a name="l01735"></a>01735 ialarm-><a class="code" href="classKCal_1_1Alarm.html#70870e440f6fba53d8edd2f280b3111d" title="Set the subject line of the mail.">setMailSubject</a>(QString::fromUtf8(icalproperty_get_summary(p))); <a name="l01736"></a>01736 <span class="keywordflow">break</span>; <a name="l01737"></a>01737 <a name="l01738"></a>01738 <span class="comment">// Only in EMAIL alarm</span> <a name="l01739"></a>01739 <span class="keywordflow">case</span> ICAL_ATTENDEE_PROPERTY: { <a name="l01740"></a>01740 QString email = QString::fromUtf8(icalproperty_get_attendee(p)); <a name="l01741"></a>01741 <span class="keywordflow">if</span> ( email.startsWith(<span class="stringliteral">"mailto:"</span>, <span class="keyword">false</span> ) ) { <a name="l01742"></a>01742 email = email.mid( 7 ); <a name="l01743"></a>01743 } <a name="l01744"></a>01744 QString name; <a name="l01745"></a>01745 icalparameter *param = icalproperty_get_first_parameter(p,ICAL_CN_PARAMETER); <a name="l01746"></a>01746 <span class="keywordflow">if</span> (param) { <a name="l01747"></a>01747 name = QString::fromUtf8(icalparameter_get_cn(param)); <a name="l01748"></a>01748 } <a name="l01749"></a>01749 ialarm-><a class="code" href="classKCal_1_1Alarm.html#3dcb22df069befff3b09d81eced0cda8" title="Add this address to the list of addresses to send mail to when the alarm is triggered...">addMailAddress</a>(<a class="code" href="classKCal_1_1Person.html" title="This class represents a person.">Person</a>(name, email)); <a name="l01750"></a>01750 <span class="keywordflow">break</span>; <a name="l01751"></a>01751 } <a name="l01752"></a>01752 <span class="comment">// Only in AUDIO and EMAIL and PROCEDURE alarms</span> <a name="l01753"></a>01753 <span class="keywordflow">case</span> ICAL_ATTACH_PROPERTY: { <a name="l01754"></a>01754 <a class="code" href="classKCal_1_1Attachment.html" title="This class represents information related to an attachment.">Attachment</a> *attach = readAttachment( p ); <a name="l01755"></a>01755 <span class="keywordflow">if</span> ( attach && attach-><a class="code" href="classKCal_1_1Attachment.html#2202bb03d3423b293a01044fea0a30ff">isUri</a>() ) { <a name="l01756"></a>01756 <span class="keywordflow">switch</span> ( action ) { <a name="l01757"></a>01757 <span class="keywordflow">case</span> ICAL_ACTION_AUDIO: <a name="l01758"></a>01758 ialarm-><a class="code" href="classKCal_1_1Alarm.html#71416b5d4a5596a5d10e40ea0c3db21e" title="Set the file to play when the audio alarm is triggered.">setAudioFile</a>( attach-><a class="code" href="classKCal_1_1Attachment.html#cd2fcbd1044cfc8079567f42d152f75c">uri</a>() ); <a name="l01759"></a>01759 <span class="keywordflow">break</span>; <a name="l01760"></a>01760 <span class="keywordflow">case</span> ICAL_ACTION_PROCEDURE: <a name="l01761"></a>01761 ialarm-><a class="code" href="classKCal_1_1Alarm.html#5d62f1442ed562f9d35563211b150b92" title="Set the program file to execute when the alarm is triggered.">setProgramFile</a>( attach-><a class="code" href="classKCal_1_1Attachment.html#cd2fcbd1044cfc8079567f42d152f75c">uri</a>() ); <a name="l01762"></a>01762 <span class="keywordflow">break</span>; <a name="l01763"></a>01763 <span class="keywordflow">case</span> ICAL_ACTION_EMAIL: <a name="l01764"></a>01764 ialarm-><a class="code" href="classKCal_1_1Alarm.html#a7d6006ce3c56dc6969e3a7c043c1d63" title="Add this filename to the list of files to attach to the email.">addMailAttachment</a>( attach-><a class="code" href="classKCal_1_1Attachment.html#cd2fcbd1044cfc8079567f42d152f75c">uri</a>() ); <a name="l01765"></a>01765 <span class="keywordflow">break</span>; <a name="l01766"></a>01766 <span class="keywordflow">default</span>: <a name="l01767"></a>01767 <span class="keywordflow">break</span>; <a name="l01768"></a>01768 } <a name="l01769"></a>01769 } <span class="keywordflow">else</span> { <a name="l01770"></a>01770 kdDebug() << <span class="stringliteral">"Alarm attachments currently only support URIs, but "</span> <a name="l01771"></a>01771 <span class="stringliteral">"no binary data"</span> << endl; <a name="l01772"></a>01772 } <a name="l01773"></a>01773 <span class="keyword">delete</span> attach; <a name="l01774"></a>01774 <span class="keywordflow">break</span>; <a name="l01775"></a>01775 } <a name="l01776"></a>01776 <span class="keywordflow">default</span>: <a name="l01777"></a>01777 <span class="keywordflow">break</span>; <a name="l01778"></a>01778 } <a name="l01779"></a>01779 <a name="l01780"></a>01780 p = icalcomponent_get_next_property(alarm,ICAL_ANY_PROPERTY); <a name="l01781"></a>01781 } <a name="l01782"></a>01782 <a name="l01783"></a>01783 <span class="comment">// custom properties</span> <a name="l01784"></a>01784 readCustomProperties(alarm, ialarm); <a name="l01785"></a>01785 <a name="l01786"></a>01786 <span class="comment">// TODO: check for consistency of alarm properties</span> <a name="l01787"></a>01787 } <a name="l01788"></a>01788 <a name="l01789"></a>01789 icaldatetimeperiodtype ICalFormatImpl::writeICalDatePeriod( <span class="keyword">const</span> QDate &date ) <a name="l01790"></a>01790 { <a name="l01791"></a>01791 icaldatetimeperiodtype t; <a name="l01792"></a>01792 t.time = writeICalDate( date ); <a name="l01793"></a>01793 t.period = icalperiodtype_null_period(); <a name="l01794"></a>01794 <span class="keywordflow">return</span> t; <a name="l01795"></a>01795 } <a name="l01796"></a>01796 <a name="l01797"></a>01797 icaldatetimeperiodtype ICalFormatImpl::writeICalDateTimePeriod( <span class="keyword">const</span> QDateTime &date ) <a name="l01798"></a>01798 { <a name="l01799"></a>01799 icaldatetimeperiodtype t; <a name="l01800"></a>01800 t.time = writeICalDateTime( date ); <a name="l01801"></a>01801 t.period = icalperiodtype_null_period(); <a name="l01802"></a>01802 <span class="keywordflow">return</span> t; <a name="l01803"></a>01803 } <a name="l01804"></a>01804 <a name="l01805"></a>01805 icaltimetype ICalFormatImpl::writeICalDate(<span class="keyword">const</span> QDate &date) <a name="l01806"></a>01806 { <a name="l01807"></a>01807 icaltimetype t = icaltime_null_time(); <a name="l01808"></a>01808 <a name="l01809"></a>01809 t.year = date.year(); <a name="l01810"></a>01810 t.month = date.month(); <a name="l01811"></a>01811 t.day = date.day(); <a name="l01812"></a>01812 <a name="l01813"></a>01813 t.hour = 0; <a name="l01814"></a>01814 t.minute = 0; <a name="l01815"></a>01815 t.second = 0; <a name="l01816"></a>01816 <a name="l01817"></a>01817 t.is_date = 1; <a name="l01818"></a>01818 <a name="l01819"></a>01819 t.is_utc = 0; <a name="l01820"></a>01820 <a name="l01821"></a>01821 t.zone = 0; <a name="l01822"></a>01822 <a name="l01823"></a>01823 <span class="keywordflow">return</span> t; <a name="l01824"></a>01824 } <a name="l01825"></a>01825 <a name="l01826"></a>01826 icaltimetype ICalFormatImpl::writeICalDateTime(<span class="keyword">const</span> QDateTime &datetime) <a name="l01827"></a>01827 { <a name="l01828"></a>01828 icaltimetype t = icaltime_null_time(); <a name="l01829"></a>01829 <a name="l01830"></a>01830 t.year = datetime.date().year(); <a name="l01831"></a>01831 t.month = datetime.date().month(); <a name="l01832"></a>01832 t.day = datetime.date().day(); <a name="l01833"></a>01833 <a name="l01834"></a>01834 t.hour = datetime.time().hour(); <a name="l01835"></a>01835 t.minute = datetime.time().minute(); <a name="l01836"></a>01836 t.second = datetime.time().second(); <a name="l01837"></a>01837 <a name="l01838"></a>01838 t.is_date = 0; <a name="l01839"></a>01839 t.zone = icaltimezone_get_builtin_timezone ( mParent->timeZoneId().latin1() ); <a name="l01840"></a>01840 t.is_utc = 0; <a name="l01841"></a>01841 <a name="l01842"></a>01842 <span class="comment">// _dumpIcaltime( t );</span> <a name="l01843"></a>01843 <span class="comment">/* The QDateTime we get passed in is to be considered in the timezone of</span> <a name="l01844"></a>01844 <span class="comment"> * the current calendar (mParent's), or, if there is none, to be floating.</span> <a name="l01845"></a>01845 <span class="comment"> * In the later case store a floating time, in the former normalize to utc. */</span> <a name="l01846"></a>01846 <span class="keywordflow">if</span> (mParent->timeZoneId().isEmpty()) <a name="l01847"></a>01847 t = icaltime_convert_to_zone( t, 0 ); <span class="comment">//make floating timezone</span> <a name="l01848"></a>01848 <span class="keywordflow">else</span> { <a name="l01849"></a>01849 icaltimezone* tz = icaltimezone_get_builtin_timezone ( mParent->timeZoneId().latin1() ); <a name="l01850"></a>01850 icaltimezone* <a class="code" href="classKCal_1_1ICalFormat.html#f420f6d86fc3dd5edae2bb403e73356a" title="Return true if timezone used is UTC, otherwise return false.">utc</a> = icaltimezone_get_utc_timezone(); <a name="l01851"></a>01851 <span class="keywordflow">if</span> ( tz != utc ) { <a name="l01852"></a>01852 t.zone = tz; <a name="l01853"></a>01853 t = icaltime_convert_to_zone( t, utc ); <a name="l01854"></a>01854 } <span class="keywordflow">else</span> { <a name="l01855"></a>01855 t.is_utc = 1; <a name="l01856"></a>01856 t.zone = utc; <a name="l01857"></a>01857 } <a name="l01858"></a>01858 } <a name="l01859"></a>01859 <span class="comment">// _dumpIcaltime( t );</span> <a name="l01860"></a>01860 <a name="l01861"></a>01861 <span class="keywordflow">return</span> t; <a name="l01862"></a>01862 } <a name="l01863"></a>01863 <a name="l01864"></a>01864 QDateTime ICalFormatImpl::readICalDateTime( icaltimetype& t, icaltimezone* tz ) <a name="l01865"></a>01865 { <a name="l01866"></a>01866 <span class="comment">// kdDebug(5800) << "ICalFormatImpl::readICalDateTime()" << endl;</span> <a name="l01867"></a>01867 icaltimezone *zone = tz; <a name="l01868"></a>01868 <span class="keywordflow">if</span> ( tz && t.is_utc == 0 ) { <span class="comment">// Only use the TZ if time is not UTC.</span> <a name="l01869"></a>01869 <span class="comment">// FIXME: We'll need to make sure to apply the appropriate TZ, not just</span> <a name="l01870"></a>01870 <span class="comment">// the first one found.</span> <a name="l01871"></a>01871 t.zone = tz; <a name="l01872"></a>01872 t.is_utc = (tz == icaltimezone_get_utc_timezone())?1:0; <a name="l01873"></a>01873 } <span class="keywordflow">else</span> { <a name="l01874"></a>01874 zone = icaltimezone_get_utc_timezone(); <a name="l01875"></a>01875 } <a name="l01876"></a>01876 <span class="comment">//_dumpIcaltime( t );</span> <a name="l01877"></a>01877 <a name="l01878"></a>01878 <span class="comment">// Convert to view time</span> <a name="l01879"></a>01879 <span class="keywordflow">if</span> ( !mParent->timeZoneId().isEmpty() && t.zone ) { <a name="l01880"></a>01880 <span class="comment">// kdDebug(5800) << "--- Converting time from: " << icaltimezone_get_tzid( const_cast<icaltimezone*>( t.zone ) ) << " (" << ICalDate2QDate(t) << ")." << endl;</span> <a name="l01881"></a>01881 icaltimezone* viewTimeZone = icaltimezone_get_builtin_timezone ( mParent->timeZoneId().latin1() ); <a name="l01882"></a>01882 icaltimezone_convert_time( &t, zone, viewTimeZone ); <a name="l01883"></a>01883 <span class="comment">// kdDebug(5800) << "--- Converted to zone " << mParent->timeZoneId() << " (" << ICalDate2QDate(t) << ")." << endl;</span> <a name="l01884"></a>01884 } <a name="l01885"></a>01885 <a name="l01886"></a>01886 <span class="keywordflow">return</span> ICalDate2QDate(t); <a name="l01887"></a>01887 } <a name="l01888"></a>01888 <a name="l01889"></a>01889 QDate ICalFormatImpl::readICalDate(icaltimetype t) <a name="l01890"></a>01890 { <a name="l01891"></a>01891 <span class="keywordflow">return</span> ICalDate2QDate(t).date(); <a name="l01892"></a>01892 } <a name="l01893"></a>01893 <a name="l01894"></a>01894 icaldurationtype ICalFormatImpl::writeICalDuration(<span class="keywordtype">int</span> seconds) <a name="l01895"></a>01895 { <a name="l01896"></a>01896 icaldurationtype d; <a name="l01897"></a>01897 <a name="l01898"></a>01898 d.is_neg = (seconds<0)?1:0; <a name="l01899"></a>01899 <span class="keywordflow">if</span> (seconds<0) seconds = -seconds; <a name="l01900"></a>01900 <a name="l01901"></a>01901 d.weeks = seconds / gSecondsPerWeek; <a name="l01902"></a>01902 seconds %= gSecondsPerWeek; <a name="l01903"></a>01903 d.days = seconds / gSecondsPerDay; <a name="l01904"></a>01904 seconds %= gSecondsPerDay; <a name="l01905"></a>01905 d.hours = seconds / gSecondsPerHour; <a name="l01906"></a>01906 seconds %= gSecondsPerHour; <a name="l01907"></a>01907 d.minutes = seconds / gSecondsPerMinute; <a name="l01908"></a>01908 seconds %= gSecondsPerMinute; <a name="l01909"></a>01909 d.seconds = seconds; <a name="l01910"></a>01910 <a name="l01911"></a>01911 <span class="keywordflow">return</span> d; <a name="l01912"></a>01912 } <a name="l01913"></a>01913 <a name="l01914"></a>01914 <span class="keywordtype">int</span> ICalFormatImpl::readICalDuration(icaldurationtype d) <a name="l01915"></a>01915 { <a name="l01916"></a>01916 <span class="keywordtype">int</span> result = 0; <a name="l01917"></a>01917 <a name="l01918"></a>01918 result += d.weeks * gSecondsPerWeek; <a name="l01919"></a>01919 result += d.days * gSecondsPerDay; <a name="l01920"></a>01920 result += d.hours * gSecondsPerHour; <a name="l01921"></a>01921 result += d.minutes * gSecondsPerMinute; <a name="l01922"></a>01922 result += d.seconds; <a name="l01923"></a>01923 <a name="l01924"></a>01924 <span class="keywordflow">if</span> (d.is_neg) result *= -1; <a name="l01925"></a>01925 <a name="l01926"></a>01926 <span class="keywordflow">return</span> result; <a name="l01927"></a>01927 } <a name="l01928"></a>01928 <a name="l01929"></a>01929 icalcomponent *ICalFormatImpl::createCalendarComponent(<a class="code" href="classKCal_1_1Calendar.html" title="This is the main &quot;calendar&quot; object class.">Calendar</a> *cal) <a name="l01930"></a>01930 { <a name="l01931"></a>01931 icalcomponent *calendar; <a name="l01932"></a>01932 <a name="l01933"></a>01933 <span class="comment">// Root component</span> <a name="l01934"></a>01934 calendar = icalcomponent_new(ICAL_VCALENDAR_COMPONENT); <a name="l01935"></a>01935 <a name="l01936"></a>01936 icalproperty *p; <a name="l01937"></a>01937 <a name="l01938"></a>01938 <span class="comment">// Product Identifier</span> <a name="l01939"></a>01939 p = icalproperty_new_prodid(<a class="code" href="classKCal_1_1CalFormat.html#2104c2e85b5377bf851d650f67e4fa29" title="Return the PRODID string to write into calendar files.">CalFormat::productId</a>().utf8()); <a name="l01940"></a>01940 icalcomponent_add_property(calendar,p); <a name="l01941"></a>01941 <a name="l01942"></a>01942 <span class="comment">// TODO: Add time zone</span> <a name="l01943"></a>01943 <a name="l01944"></a>01944 <span class="comment">// iCalendar version (2.0)</span> <a name="l01945"></a>01945 p = icalproperty_new_version(const_cast<char *>(_ICAL_VERSION)); <a name="l01946"></a>01946 icalcomponent_add_property(calendar,p); <a name="l01947"></a>01947 <a name="l01948"></a>01948 <span class="comment">// Custom properties</span> <a name="l01949"></a>01949 <span class="keywordflow">if</span>( cal != 0 ) <a name="l01950"></a>01950 writeCustomProperties(calendar, cal); <a name="l01951"></a>01951 <a name="l01952"></a>01952 <span class="keywordflow">return</span> calendar; <a name="l01953"></a>01953 } <a name="l01954"></a>01954 <a name="l01955"></a>01955 <a name="l01956"></a>01956 <a name="l01957"></a>01957 <span class="comment">// take a raw vcalendar (i.e. from a file on disk, clipboard, etc. etc.</span> <a name="l01958"></a>01958 <span class="comment">// and break it down from its tree-like format into the dictionary format</span> <a name="l01959"></a>01959 <span class="comment">// that is used internally in the ICalFormatImpl.</span> <a name="l01960"></a>01960 <span class="keywordtype">bool</span> ICalFormatImpl::populate( <a class="code" href="classKCal_1_1Calendar.html" title="This is the main &quot;calendar&quot; object class.">Calendar</a> *cal, icalcomponent *calendar) <a name="l01961"></a>01961 { <a name="l01962"></a>01962 <span class="comment">// this function will populate the caldict dictionary and other event</span> <a name="l01963"></a>01963 <span class="comment">// lists. It turns vevents into Events and then inserts them.</span> <a name="l01964"></a>01964 <a name="l01965"></a>01965 <span class="keywordflow">if</span> (!calendar) <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01966"></a>01966 <a name="l01967"></a>01967 <span class="comment">// TODO: check for METHOD</span> <a name="l01968"></a>01968 <a name="l01969"></a>01969 icalproperty *p; <a name="l01970"></a>01970 <a name="l01971"></a>01971 p = icalcomponent_get_first_property(calendar,ICAL_PRODID_PROPERTY); <a name="l01972"></a>01972 <span class="keywordflow">if</span> (!p) { <a name="l01973"></a>01973 kdDebug(5800) << <span class="stringliteral">"No PRODID property found"</span> << endl; <a name="l01974"></a>01974 mLoadedProductId = <span class="stringliteral">""</span>; <a name="l01975"></a>01975 } <span class="keywordflow">else</span> { <a name="l01976"></a>01976 mLoadedProductId = QString::fromUtf8(icalproperty_get_prodid(p)); <a name="l01977"></a>01977 <span class="comment">// kdDebug(5800) << "VCALENDAR prodid: '" << mLoadedProductId << "'" << endl;</span> <a name="l01978"></a>01978 <a name="l01979"></a>01979 <span class="keyword">delete</span> mCompat; <a name="l01980"></a>01980 mCompat = CompatFactory::createCompat( mLoadedProductId ); <a name="l01981"></a>01981 } <a name="l01982"></a>01982 <a name="l01983"></a>01983 p = icalcomponent_get_first_property(calendar,ICAL_VERSION_PROPERTY); <a name="l01984"></a>01984 <span class="keywordflow">if</span> (!p) { <a name="l01985"></a>01985 kdDebug(5800) << <span class="stringliteral">"No VERSION property found"</span> << endl; <a name="l01986"></a>01986 mParent->setException(<span class="keyword">new</span> <a class="code" href="classKCal_1_1ErrorFormat.html" title="Calendar format related error class.">ErrorFormat</a>(ErrorFormat::CalVersionUnknown)); <a name="l01987"></a>01987 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01988"></a>01988 } <span class="keywordflow">else</span> { <a name="l01989"></a>01989 <span class="keyword">const</span> <span class="keywordtype">char</span> *version = icalproperty_get_version(p); <a name="l01990"></a>01990 <span class="comment">// kdDebug(5800) << "VCALENDAR version: '" << version << "'" << endl;</span> <a name="l01991"></a>01991 <a name="l01992"></a>01992 <span class="keywordflow">if</span> (strcmp(version,<span class="stringliteral">"1.0"</span>) == 0) { <a name="l01993"></a>01993 kdDebug(5800) << <span class="stringliteral">"Expected iCalendar, got vCalendar"</span> << endl; <a name="l01994"></a>01994 mParent->setException(<span class="keyword">new</span> <a class="code" href="classKCal_1_1ErrorFormat.html" title="Calendar format related error class.">ErrorFormat</a>(ErrorFormat::CalVersion1, <a name="l01995"></a>01995 i18n(<span class="stringliteral">"Expected iCalendar format"</span>))); <a name="l01996"></a>01996 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01997"></a>01997 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strcmp(version,<span class="stringliteral">"2.0"</span>) != 0) { <a name="l01998"></a>01998 kdDebug(5800) << <span class="stringliteral">"Expected iCalendar, got unknown format"</span> << endl; <a name="l01999"></a>01999 mParent->setException(<span class="keyword">new</span> <a class="code" href="classKCal_1_1ErrorFormat.html" title="Calendar format related error class.">ErrorFormat</a>(ErrorFormat::CalVersionUnknown)); <a name="l02000"></a>02000 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l02001"></a>02001 } <a name="l02002"></a>02002 } <a name="l02003"></a>02003 <a name="l02004"></a>02004 <span class="comment">// custom properties</span> <a name="l02005"></a>02005 readCustomProperties(calendar, cal); <a name="l02006"></a>02006 <a name="l02007"></a>02007 <span class="comment">// TODO: set time zone</span> <a name="l02008"></a>02008 <a name="l02009"></a>02009 <span class="comment">// read a VTIMEZONE if there is one</span> <a name="l02010"></a>02010 icalcomponent *ctz = <a name="l02011"></a>02011 icalcomponent_get_first_component( calendar, ICAL_VTIMEZONE_COMPONENT ); <a name="l02012"></a>02012 <a name="l02013"></a>02013 <span class="comment">// Store all events with a relatedTo property in a list for post-processing</span> <a name="l02014"></a>02014 mEventsRelate.clear(); <a name="l02015"></a>02015 mTodosRelate.clear(); <a name="l02016"></a>02016 <span class="comment">// TODO: make sure that only actually added events go to this lists.</span> <a name="l02017"></a>02017 <a name="l02018"></a>02018 icalcomponent *c; <a name="l02019"></a>02019 <a name="l02020"></a>02020 <span class="comment">// Iterate through all todos</span> <a name="l02021"></a>02021 c = icalcomponent_get_first_component(calendar,ICAL_VTODO_COMPONENT); <a name="l02022"></a>02022 <span class="keywordflow">while</span> (c) { <a name="l02023"></a>02023 <span class="comment">// kdDebug(5800) << "----Todo found" << endl;</span> <a name="l02024"></a>02024 <a class="code" href="classKCal_1_1Todo.html" title="This class provides a Todo in the sense of RFC2445.">Todo</a> *todo = readTodo(c); <a name="l02025"></a>02025 <span class="keywordflow">if</span> (todo) { <a name="l02026"></a>02026 <span class="keywordflow">if</span> (!cal-><a class="code" href="classKCal_1_1Calendar.html#7130bd9ec592f5d1538b4d0b3f1b1332" title="Returns the Todo associated with the given unique identifier.">todo</a>(todo-><a class="code" href="classKCal_1_1IncidenceBase.html#75c8bd2df73c5a62bd7cf77c2ac4d3c6" title="Return the unique id for the event.">uid</a>())) { <a name="l02027"></a>02027 cal-><a class="code" href="classKCal_1_1Calendar.html#63b7d29fa1d80998a11a1518fc82c0d0" title="Insert a Todo into the Calendar.">addTodo</a>(todo); <a name="l02028"></a>02028 } <span class="keywordflow">else</span> { <a name="l02029"></a>02029 <span class="keyword">delete</span> todo; <a name="l02030"></a>02030 mTodosRelate.remove( todo ); <a name="l02031"></a>02031 } <a name="l02032"></a>02032 } <a name="l02033"></a>02033 c = icalcomponent_get_next_component(calendar,ICAL_VTODO_COMPONENT); <a name="l02034"></a>02034 } <a name="l02035"></a>02035 <a name="l02036"></a>02036 <span class="comment">// Iterate through all events</span> <a name="l02037"></a>02037 c = icalcomponent_get_first_component(calendar,ICAL_VEVENT_COMPONENT); <a name="l02038"></a>02038 <span class="keywordflow">while</span> (c) { <a name="l02039"></a>02039 <span class="comment">// kdDebug(5800) << "----Event found" << endl;</span> <a name="l02040"></a>02040 <a class="code" href="classKCal_1_1Event.html" title="This class provides an Event in the sense of RFC2445.">Event</a> *<span class="keyword">event</span> = readEvent(c, ctz); <a name="l02041"></a>02041 <span class="keywordflow">if</span> (event) { <a name="l02042"></a>02042 <span class="keywordflow">if</span> (!cal-><a class="code" href="classKCal_1_1Calendar.html#79496465b9954a2e032805dcee3348a9" title="Returns the Event associated with the given unique identifier.">event</a>(event-><a class="code" href="classKCal_1_1IncidenceBase.html#75c8bd2df73c5a62bd7cf77c2ac4d3c6" title="Return the unique id for the event.">uid</a>())) { <a name="l02043"></a>02043 cal-><a class="code" href="classKCal_1_1Calendar.html#4da4abd5a47d63fd1c2933faff7fdf3f" title="Insert an Event into the Calendar.">addEvent</a>(event); <a name="l02044"></a>02044 } <span class="keywordflow">else</span> { <a name="l02045"></a>02045 <span class="keyword">delete</span> event; <a name="l02046"></a>02046 mEventsRelate.remove( event ); <a name="l02047"></a>02047 } <a name="l02048"></a>02048 } <a name="l02049"></a>02049 c = icalcomponent_get_next_component(calendar,ICAL_VEVENT_COMPONENT); <a name="l02050"></a>02050 } <a name="l02051"></a>02051 <a name="l02052"></a>02052 <span class="comment">// Iterate through all journals</span> <a name="l02053"></a>02053 c = icalcomponent_get_first_component(calendar,ICAL_VJOURNAL_COMPONENT); <a name="l02054"></a>02054 <span class="keywordflow">while</span> (c) { <a name="l02055"></a>02055 <span class="comment">// kdDebug(5800) << "----Journal found" << endl;</span> <a name="l02056"></a>02056 <a class="code" href="classKCal_1_1Journal.html" title="This class provides a Journal in the sense of RFC2445.">Journal</a> *journal = readJournal(c); <a name="l02057"></a>02057 <span class="keywordflow">if</span> (journal) { <a name="l02058"></a>02058 <span class="keywordflow">if</span> (!cal-><a class="code" href="classKCal_1_1Calendar.html#9fa973297b596cd4dc32c184b8bb9d4d" title="Returns the Journal associated with the given unique identifier.">journal</a>(journal-><a class="code" href="classKCal_1_1IncidenceBase.html#75c8bd2df73c5a62bd7cf77c2ac4d3c6" title="Return the unique id for the event.">uid</a>())) { <a name="l02059"></a>02059 cal-><a class="code" href="classKCal_1_1Calendar.html#1d58b2f34f52d5163e3b734c789b32e5" title="Insert a Journal into the Calendar.">addJournal</a>(journal); <a name="l02060"></a>02060 } <span class="keywordflow">else</span> { <a name="l02061"></a>02061 <span class="keyword">delete</span> journal; <a name="l02062"></a>02062 } <a name="l02063"></a>02063 } <a name="l02064"></a>02064 c = icalcomponent_get_next_component(calendar,ICAL_VJOURNAL_COMPONENT); <a name="l02065"></a>02065 } <a name="l02066"></a>02066 <a name="l02067"></a>02067 <span class="comment">// Post-Process list of events with relations, put Event objects in relation</span> <a name="l02068"></a>02068 Event::List::ConstIterator eIt; <a name="l02069"></a>02069 <span class="keywordflow">for</span> ( eIt = mEventsRelate.begin(); eIt != mEventsRelate.end(); ++eIt ) { <a name="l02070"></a>02070 (*eIt)->setRelatedTo( cal-><a class="code" href="classKCal_1_1Calendar.html#d271d711219da854049efa30723188c4" title="Returns the Incidence associated with the given unique identifier.">incidence</a>( (*eIt)->relatedToUid() ) ); <a name="l02071"></a>02071 } <a name="l02072"></a>02072 Todo::List::ConstIterator tIt; <a name="l02073"></a>02073 <span class="keywordflow">for</span> ( tIt = mTodosRelate.begin(); tIt != mTodosRelate.end(); ++tIt ) { <a name="l02074"></a>02074 (*tIt)->setRelatedTo( cal-><a class="code" href="classKCal_1_1Calendar.html#d271d711219da854049efa30723188c4" title="Returns the Incidence associated with the given unique identifier.">incidence</a>( (*tIt)->relatedToUid() ) ); <a name="l02075"></a>02075 } <a name="l02076"></a>02076 <a name="l02077"></a>02077 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l02078"></a>02078 } <a name="l02079"></a>02079 <a name="l02080"></a>02080 QString ICalFormatImpl::extractErrorProperty(icalcomponent *c) <a name="l02081"></a>02081 { <a name="l02082"></a>02082 <span class="comment">// kdDebug(5800) << "ICalFormatImpl:extractErrorProperty: "</span> <a name="l02083"></a>02083 <span class="comment">// << icalcomponent_as_ical_string(c) << endl;</span> <a name="l02084"></a>02084 <a name="l02085"></a>02085 QString errorMessage; <a name="l02086"></a>02086 <a name="l02087"></a>02087 icalproperty *error; <a name="l02088"></a>02088 error = icalcomponent_get_first_property(c,ICAL_XLICERROR_PROPERTY); <a name="l02089"></a>02089 <span class="keywordflow">while</span>(error) { <a name="l02090"></a>02090 errorMessage += icalproperty_get_xlicerror(error); <a name="l02091"></a>02091 errorMessage += <span class="stringliteral">"\n"</span>; <a name="l02092"></a>02092 error = icalcomponent_get_next_property(c,ICAL_XLICERROR_PROPERTY); <a name="l02093"></a>02093 } <a name="l02094"></a>02094 <a name="l02095"></a>02095 <span class="comment">// kdDebug(5800) << "ICalFormatImpl:extractErrorProperty: " << errorMessage << endl;</span> <a name="l02096"></a>02096 <a name="l02097"></a>02097 <span class="keywordflow">return</span> errorMessage; <a name="l02098"></a>02098 } <a name="l02099"></a>02099 <a name="l02100"></a>02100 <span class="keywordtype">void</span> ICalFormatImpl::dumpIcalRecurrence(icalrecurrencetype r) <a name="l02101"></a>02101 { <a name="l02102"></a>02102 <span class="keywordtype">int</span> i; <a name="l02103"></a>02103 <a name="l02104"></a>02104 kdDebug(5800) << <span class="stringliteral">" Freq: "</span> << r.freq << endl; <a name="l02105"></a>02105 kdDebug(5800) << <span class="stringliteral">" Until: "</span> << icaltime_as_ical_string(r.until) << endl; <a name="l02106"></a>02106 kdDebug(5800) << <span class="stringliteral">" Count: "</span> << r.count << endl; <a name="l02107"></a>02107 <span class="keywordflow">if</span> (r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { <a name="l02108"></a>02108 <span class="keywordtype">int</span> index = 0; <a name="l02109"></a>02109 QString out = <span class="stringliteral">" By Day: "</span>; <a name="l02110"></a>02110 <span class="keywordflow">while</span>((i = r.by_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { <a name="l02111"></a>02111 out.append(QString::number(i) + <span class="stringliteral">" "</span>); <a name="l02112"></a>02112 } <a name="l02113"></a>02113 kdDebug(5800) << out << endl; <a name="l02114"></a>02114 } <a name="l02115"></a>02115 <span class="keywordflow">if</span> (r.by_month_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { <a name="l02116"></a>02116 <span class="keywordtype">int</span> index = 0; <a name="l02117"></a>02117 QString out = <span class="stringliteral">" By Month Day: "</span>; <a name="l02118"></a>02118 <span class="keywordflow">while</span>((i = r.by_month_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { <a name="l02119"></a>02119 out.append(QString::number(i) + <span class="stringliteral">" "</span>); <a name="l02120"></a>02120 } <a name="l02121"></a>02121 kdDebug(5800) << out << endl; <a name="l02122"></a>02122 } <a name="l02123"></a>02123 <span class="keywordflow">if</span> (r.by_year_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { <a name="l02124"></a>02124 <span class="keywordtype">int</span> index = 0; <a name="l02125"></a>02125 QString out = <span class="stringliteral">" By Year Day: "</span>; <a name="l02126"></a>02126 <span class="keywordflow">while</span>((i = r.by_year_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { <a name="l02127"></a>02127 out.append(QString::number(i) + <span class="stringliteral">" "</span>); <a name="l02128"></a>02128 } <a name="l02129"></a>02129 kdDebug(5800) << out << endl; <a name="l02130"></a>02130 } <a name="l02131"></a>02131 <span class="keywordflow">if</span> (r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX) { <a name="l02132"></a>02132 <span class="keywordtype">int</span> index = 0; <a name="l02133"></a>02133 QString out = <span class="stringliteral">" By Month: "</span>; <a name="l02134"></a>02134 <span class="keywordflow">while</span>((i = r.by_month[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { <a name="l02135"></a>02135 out.append(QString::number(i) + <span class="stringliteral">" "</span>); <a name="l02136"></a>02136 } <a name="l02137"></a>02137 kdDebug(5800) << out << endl; <a name="l02138"></a>02138 } <a name="l02139"></a>02139 <span class="keywordflow">if</span> (r.by_set_pos[0] != ICAL_RECURRENCE_ARRAY_MAX) { <a name="l02140"></a>02140 <span class="keywordtype">int</span> index = 0; <a name="l02141"></a>02141 QString out = <span class="stringliteral">" By Set Pos: "</span>; <a name="l02142"></a>02142 <span class="keywordflow">while</span>((i = r.by_set_pos[index++]) != ICAL_RECURRENCE_ARRAY_MAX) { <a name="l02143"></a>02143 kdDebug(5800) << <span class="stringliteral">"========= "</span> << i << endl; <a name="l02144"></a>02144 out.append(QString::number(i) + <span class="stringliteral">" "</span>); <a name="l02145"></a>02145 } <a name="l02146"></a>02146 kdDebug(5800) << out << endl; <a name="l02147"></a>02147 } <a name="l02148"></a>02148 } <a name="l02149"></a>02149 <a name="l02150"></a>02150 icalcomponent *ICalFormatImpl::createScheduleComponent(<a class="code" href="classKCal_1_1IncidenceBase.html" title="This class provides the base class common to all calendar components.">IncidenceBase</a> *incidence, <a name="l02151"></a>02151 <a class="code" href="classKCal_1_1Scheduler.html#b5bb0cf1cf4c936a606b1968e85601b1" title="iTIP methods.">Scheduler::Method</a> method) <a name="l02152"></a>02152 { <a name="l02153"></a>02153 icalcomponent *message = createCalendarComponent(); <a name="l02154"></a>02154 <a name="l02155"></a>02155 icalproperty_method icalmethod = ICAL_METHOD_NONE; <a name="l02156"></a>02156 <a name="l02157"></a>02157 <span class="keywordflow">switch</span> (method) { <a name="l02158"></a>02158 <span class="keywordflow">case</span> Scheduler::Publish: <a name="l02159"></a>02159 icalmethod = ICAL_METHOD_PUBLISH; <a name="l02160"></a>02160 <span class="keywordflow">break</span>; <a name="l02161"></a>02161 <span class="keywordflow">case</span> Scheduler::Request: <a name="l02162"></a>02162 icalmethod = ICAL_METHOD_REQUEST; <a name="l02163"></a>02163 <span class="keywordflow">break</span>; <a name="l02164"></a>02164 <span class="keywordflow">case</span> Scheduler::Refresh: <a name="l02165"></a>02165 icalmethod = ICAL_METHOD_REFRESH; <a name="l02166"></a>02166 <span class="keywordflow">break</span>; <a name="l02167"></a>02167 <span class="keywordflow">case</span> Scheduler::Cancel: <a name="l02168"></a>02168 icalmethod = ICAL_METHOD_CANCEL; <a name="l02169"></a>02169 <span class="keywordflow">break</span>; <a name="l02170"></a>02170 <span class="keywordflow">case</span> Scheduler::Add: <a name="l02171"></a>02171 icalmethod = ICAL_METHOD_ADD; <a name="l02172"></a>02172 <span class="keywordflow">break</span>; <a name="l02173"></a>02173 <span class="keywordflow">case</span> Scheduler::Reply: <a name="l02174"></a>02174 icalmethod = ICAL_METHOD_REPLY; <a name="l02175"></a>02175 <span class="keywordflow">break</span>; <a name="l02176"></a>02176 <span class="keywordflow">case</span> Scheduler::Counter: <a name="l02177"></a>02177 icalmethod = ICAL_METHOD_COUNTER; <a name="l02178"></a>02178 <span class="keywordflow">break</span>; <a name="l02179"></a>02179 <span class="keywordflow">case</span> Scheduler::Declinecounter: <a name="l02180"></a>02180 icalmethod = ICAL_METHOD_DECLINECOUNTER; <a name="l02181"></a>02181 <span class="keywordflow">break</span>; <a name="l02182"></a>02182 <span class="keywordflow">default</span>: <a name="l02183"></a>02183 kdDebug(5800) << <span class="stringliteral">"ICalFormat::createScheduleMessage(): Unknow method"</span> << endl; <a name="l02184"></a>02184 <span class="keywordflow">return</span> message; <a name="l02185"></a>02185 } <a name="l02186"></a>02186 <a name="l02187"></a>02187 icalcomponent_add_property(message,icalproperty_new_method(icalmethod)); <a name="l02188"></a>02188 <a name="l02189"></a>02189 icalcomponent *inc = writeIncidence( incidence, method ); <a name="l02190"></a>02190 <span class="comment">/*</span> <a name="l02191"></a>02191 <span class="comment"> * RFC 2446 states in section 3.4.3 ( REPLY to a VTODO ), that</span> <a name="l02192"></a>02192 <span class="comment"> * a REQUEST-STATUS property has to be present. For the other two, event and</span> <a name="l02193"></a>02193 <span class="comment"> * free busy, it can be there, but is optional. Until we do more</span> <a name="l02194"></a>02194 <span class="comment"> * fine grained handling, assume all is well. Note that this is the</span> <a name="l02195"></a>02195 <span class="comment"> * status of the _request_, not the attendee. Just to avoid confusion.</span> <a name="l02196"></a>02196 <span class="comment"> * - till</span> <a name="l02197"></a>02197 <span class="comment"> */</span> <a name="l02198"></a>02198 <span class="keywordflow">if</span> ( icalmethod == ICAL_METHOD_REPLY ) { <a name="l02199"></a>02199 <span class="keyword">struct </span>icalreqstattype rst; <a name="l02200"></a>02200 rst.code = ICAL_2_0_SUCCESS_STATUS; <a name="l02201"></a>02201 rst.desc = 0; <a name="l02202"></a>02202 rst.debug = 0; <a name="l02203"></a>02203 icalcomponent_add_property( inc, icalproperty_new_requeststatus( rst ) ); <a name="l02204"></a>02204 } <a name="l02205"></a>02205 icalcomponent_add_component( message, inc ); <a name="l02206"></a>02206 <a name="l02207"></a>02207 <span class="keywordflow">return</span> message; <a name="l02208"></a>02208 } </pre></div></div> </div></div> </td> </tr> <tr> <td valign="top" id="leftmenu" width="25%"> <a name="navigation"></a> <div class="menu_box"><h2>libkcal</h2> <div class="nav_list"> <ul><li><a href="index.html">Main Page</a></li><li><a href="namespaces.html">Namespace List</a></li><li><a href="hierarchy.html">Class Hierarchy</a></li><li><a href="classes.html">Alphabetical List</a></li><li><a href="annotated.html">Class List</a></li><li><a href="files.html">File List</a></li><li><a href="namespacemembers.html">Namespace Members</a></li><li><a href="functions.html">Class Members</a></li></ul> <!-- <h2>Class Picker</h2> <div style="text-align: center;"> <form name="guideform"> <select name="guidelinks" style="width:100%;" onChange="window.location=document.guideform.guidelinks.options[document.guideform.guidelinks.selectedIndex].value"> <option value="annotated.html">-- Choose --</option> <option value="classKCal_1_1Alarm.html">kcal::alarm</option>, <option value="classKCal_1_1Attachment.html">kcal::attachment</option>, <option value="classKCal_1_1Attendee.html">kcal::attendee</option>, <option value="classKCal_1_1Calendar.html">kcal::calendar</option>, <option value="classKCal_1_1Calendar_1_1Observer.html">kcal::calendar::observer</option>, <option value="classKCal_1_1CalendarLocal.html">kcal::calendarlocal</option>, <option value="classKCal_1_1CalendarNull.html">kcal::calendarnull</option>, <option value="classKCal_1_1CalendarResources.html">kcal::calendarresources</option>, <option value="classKCal_1_1CalFilter.html">kcal::calfilter</option>, <option value="classKCal_1_1CalFormat.html">kcal::calformat</option>, <option value="classKCal_1_1CalStorage.html">kcal::calstorage</option>, <option value="classKCal_1_1Compat.html">kcal::compat</option>, <option value="classKCal_1_1CompatFactory.html">kcal::compatfactory</option>, <option value="classKCal_1_1CustomProperties.html">kcal::customproperties</option>, <option value="classKCal_1_1DndFactory.html">kcal::dndfactory</option>, <option value="classKCal_1_1Duration.html">kcal::duration</option>, <option value="classKCal_1_1ErrorFormat.html">kcal::errorformat</option>, <option value="classKCal_1_1Event.html">kcal::event</option>, <option value="classKCal_1_1Exception.html">kcal::exception</option>, <option value="classKCal_1_1FileStorage.html">kcal::filestorage</option>, <option value="classKCal_1_1FreeBusy.html">kcal::freebusy</option>, <option value="classKCal_1_1HtmlExport.html">kcal::htmlexport</option>, <option value="classKCal_1_1ICalDrag.html">kcal::icaldrag</option>, <option value="classKCal_1_1ICalFormat.html">kcal::icalformat</option>, <option value="classKCal_1_1Incidence.html">kcal::incidence</option>, <option value="classKCal_1_1Incidence_1_1AddVisitor.html">kcal::incidence::addvisitor</option>, <option value="classKCal_1_1Incidence_1_1DeleteVisitor.html">kcal::incidence::deletevisitor</option>, <option value="classKCal_1_1IncidenceBase.html">kcal::incidencebase</option>, <option value="classKCal_1_1IncidenceBase_1_1Visitor.html">kcal::incidencebase::visitor</option>, <option value="classKCal_1_1IncidenceFormatter.html">kcal::incidenceformatter</option>, <option value="classKCal_1_1Journal.html">kcal::journal</option>, <option value="classKCal_1_1ListBase.html">kcal::listbase</option>, <option value="classKCal_1_1Period.html">kcal::period</option>, <option value="classKCal_1_1Person.html">kcal::person</option>, <option value="classKCal_1_1QtopiaFormat.html">kcal::qtopiaformat</option>, <option value="classKCal_1_1Recurrence.html">kcal::recurrence</option>, <option value="classKCal_1_1RecurrenceRule.html">kcal::recurrencerule</option>, <option value="classKCal_1_1RecurrenceRule_1_1WDayPos.html">kcal::recurrencerule::wdaypos</option>, <option value="classKCal_1_1ResourceCached.html">kcal::resourcecached</option>, <option value="classKCal_1_1ResourceCachedReloadConfig.html">kcal::resourcecachedreloadconfig</option>, <option value="classKCal_1_1ResourceCachedSaveConfig.html">kcal::resourcecachedsaveconfig</option>, <option value="classKCal_1_1ResourceCalendar.html">kcal::resourcecalendar</option>, <option value="classKCal_1_1ResourceLocal.html">kcal::resourcelocal</option>, <option value="classKCal_1_1ResourceLocalConfig.html">kcal::resourcelocalconfig</option>, <option value="classKCal_1_1ScheduleMessage.html">kcal::schedulemessage</option>, <option value="classKCal_1_1Scheduler.html">kcal::scheduler</option>, <option value="classKCal_1_1Todo.html">kcal::todo</option>, <option value="classKCal_1_1VCalDrag.html">kcal::vcaldrag</option>, <option value="classKCal_1_1VCalFormat.html">kcal::vcalformat</option>, </select> </form> </div> --> </div></div> <div class="menu_box"><h2>API Dox</h2> <div class="nav_list"> <ul> <li><a href="../../akregator/html/index.html">akregator</a></li><li> <a href="../../akregator/src/html/index.html">src</a></li><li> <a href="../../akregator/src/librss/html/index.html">librss</a></li><li><a href="../../certmanager/html/index.html">certmanager</a></li><li> <a href="../../certmanager/lib/html/index.html">lib</a></li><li><a href="../../kaddressbook/html/index.html">kaddressbook</a></li><li><a href="../../kalarm/html/index.html">kalarm</a></li><li> <a href="../../kalarm/lib/html/index.html">lib</a></li><li><a href="../../kandy/html/index.html">kandy</a></li><li><a href="../../karm/html/index.html">karm</a></li><li><a href="../../kdgantt/html/index.html">kdgantt</a></li><li><a href="../../kgantt/html/index.html">kgantt</a></li><li><a href="../../kioslaves/html/index.html">kioslaves</a></li><li> <a href="../../kioslaves/imap4/html/index.html">imap4</a></li><li> <a href="../../kioslaves/mbox/html/index.html">mbox</a></li><li><a href="../../kitchensync/html/index.html">kitchensync</a></li><li><a href="../../kmail/html/index.html">kmail</a></li><li><a href="../../knotes/html/index.html">knotes</a></li><li><a href="../../konsolekalendar/html/index.html">konsolekalendar</a></li><li><a href="../../kontact/html/index.html">kontact</a></li><li><a href="../../korganizer/html/index.html">korganizer</a></li><li><a href="../../kpilot/html/index.html">kpilot</a></li><li> <a href="../../kpilot/kpilot/html/index.html">kpilot</a></li><li> <a href="../../kpilot/lib/html/index.html">lib</a></li><li><a href="../../libemailfunctions/html/index.html">libemailfunctions</a></li><li><a href="../../libkcal/html/index.html">libkcal</a></li><li><a href="../../libkdepim/html/index.html">libkdepim</a></li><li><a href="../../libkholidays/html/index.html">libkholidays</a></li><li><a href="../../libkmime/html/index.html">libkmime</a></li><li><a href="../../libkpgp/html/index.html">libkpgp</a></li><li><a href="../../libkpimidentities/html/index.html">libkpimidentities</a></li> </ul></div></div> </td> </tr> </table> <span class="doNotDisplay"> <a href="http://www.kde.org/" accesskey="8">KDE Home</a> | <a href="http://accessibility.kde.org/" accesskey="9">KDE Accessibility Home</a> | <a href="http://www.kde.org/media/accesskeys.php" accesskey="0">Description of Access Keys</a> </span> <div style="height: 8px"></div> <div id="footer"> <div id="footer_left"> Maintained by <a href="mailto:groot@kde.org">Adriaan de Groot</a> and <a href="mailto:winter@kde.org">Allen Winter</a>. <br/> KDE and K Desktop Environment are trademarks of <a href="http://www.kde.org/areas/kde-ev/" title="Homepage of the KDE non-profit Organization">KDE e.V.</a> | <a href="http://www.kde.org/contact/impressum.php">Legal</a> </div> <div id="footer_right"><img src="/media/images/footer_right.png" style="margin: 0px" alt="" /></div> </div> <!-- WARNING: DO NOT SEND MAIL TO THE FOLLOWING EMAIL ADDRESS! YOU WILL BE BLOCKED INSTANTLY AND PERMANENTLY! <a href="mailto:aaaatrap-425acc3b5374943f@kde.org">Block me</a> WARNING END --> </body> </html>