Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > 98d6b53e11e983e268c3e19f14e091a0 > files > 3801

kdepim-devel-doc-3.5.9-9mdv2008.1.x86_64.rpm

<?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: calendarlocal.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>calendarlocal.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) 1998 Preston Brown &lt;pbrown@kde.org&gt;</span>
<a name="l00005"></a>00005 <span class="comment">    Copyright (c) 2001,2003,2004 Cornelius Schumacher &lt;schumacher@kde.org&gt;</span>
<a name="l00006"></a>00006 <span class="comment">    Copyright (C) 2003-2004 Reinhold Kainhofer &lt;reinhold@kainhofer.com&gt;</span>
<a name="l00007"></a>00007 <span class="comment"></span>
<a name="l00008"></a>00008 <span class="comment">    This library is free software; you can redistribute it and/or</span>
<a name="l00009"></a>00009 <span class="comment">    modify it under the terms of the GNU Library General Public</span>
<a name="l00010"></a>00010 <span class="comment">    License as published by the Free Software Foundation; either</span>
<a name="l00011"></a>00011 <span class="comment">    version 2 of the License, or (at your option) any later version.</span>
<a name="l00012"></a>00012 <span class="comment"></span>
<a name="l00013"></a>00013 <span class="comment">    This library is distributed in the hope that it will be useful,</span>
<a name="l00014"></a>00014 <span class="comment">    but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00015"></a>00015 <span class="comment">    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
<a name="l00016"></a>00016 <span class="comment">    Library General Public License for more details.</span>
<a name="l00017"></a>00017 <span class="comment"></span>
<a name="l00018"></a>00018 <span class="comment">    You should have received a copy of the GNU Library General Public License</span>
<a name="l00019"></a>00019 <span class="comment">    along with this library; see the file COPYING.LIB.  If not, write to</span>
<a name="l00020"></a>00020 <span class="comment">    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,</span>
<a name="l00021"></a>00021 <span class="comment">    Boston, MA 02110-1301, USA.</span>
<a name="l00022"></a>00022 <span class="comment">*/</span>
<a name="l00023"></a>00023 
<a name="l00024"></a>00024 <span class="preprocessor">#include &lt;qdatetime.h&gt;</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;qstring.h&gt;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &lt;qptrlist.h&gt;</span>
<a name="l00027"></a>00027 
<a name="l00028"></a>00028 <span class="preprocessor">#include &lt;kdebug.h&gt;</span>
<a name="l00029"></a>00029 <span class="preprocessor">#include &lt;klocale.h&gt;</span>
<a name="l00030"></a>00030 <span class="preprocessor">#include &lt;kmessagebox.h&gt;</span>
<a name="l00031"></a>00031 
<a name="l00032"></a>00032 <span class="preprocessor">#include "vcaldrag.h"</span>
<a name="l00033"></a>00033 <span class="preprocessor">#include "vcalformat.h"</span>
<a name="l00034"></a>00034 <span class="preprocessor">#include "icalformat.h"</span>
<a name="l00035"></a>00035 <span class="preprocessor">#include "exceptions.h"</span>
<a name="l00036"></a>00036 <span class="preprocessor">#include "incidence.h"</span>
<a name="l00037"></a>00037 <span class="preprocessor">#include "journal.h"</span>
<a name="l00038"></a>00038 <span class="preprocessor">#include "filestorage.h"</span>
<a name="l00039"></a>00039 
<a name="l00040"></a>00040 <span class="preprocessor">#include "calendarlocal.h"</span>
<a name="l00041"></a>00041 
<a name="l00042"></a>00042 <span class="keyword">using namespace </span>KCal;
<a name="l00043"></a>00043 
<a name="l00044"></a><a class="code" href="classKCal_1_1CalendarLocal.html#818faf6a0e37cbf636d8d0d339e92681">00044</a> CalendarLocal::CalendarLocal( <span class="keyword">const</span> QString &amp;timeZoneId )
<a name="l00045"></a>00045   : <a class="code" href="classKCal_1_1Calendar.html" title="This is the main &amp;quot;calendar&amp;quot; object class.">Calendar</a>( timeZoneId ), mEvents( 47 )
<a name="l00046"></a>00046 {
<a name="l00047"></a>00047   init();
<a name="l00048"></a>00048 }
<a name="l00049"></a>00049 
<a name="l00050"></a>00050 <span class="keywordtype">void</span> CalendarLocal::init()
<a name="l00051"></a>00051 {
<a name="l00052"></a>00052   mDeletedIncidences.setAutoDelete( <span class="keyword">true</span> );
<a name="l00053"></a>00053   mFileName = QString::null;
<a name="l00054"></a>00054 }
<a name="l00055"></a>00055 
<a name="l00056"></a>00056 
<a name="l00057"></a>00057 CalendarLocal::~CalendarLocal()
<a name="l00058"></a>00058 {
<a name="l00059"></a>00059   <a class="code" href="classKCal_1_1CalendarLocal.html#9a545de4837453eea733dd61883ca513" title="Clears out the current calendar, freeing all used memory etc.">close</a>();
<a name="l00060"></a>00060 }
<a name="l00061"></a>00061 
<a name="l00062"></a><a class="code" href="classKCal_1_1CalendarLocal.html#54cd4ef78b62f33d28212b1487eaa342">00062</a> <span class="keywordtype">bool</span> <a class="code" href="classKCal_1_1CalendarLocal.html#54cd4ef78b62f33d28212b1487eaa342" title="Loads a calendar on disk in vCalendar or iCalendar format into the current calendar...">CalendarLocal::load</a>( <span class="keyword">const</span> QString &amp;fileName, <a class="code" href="classKCal_1_1CalFormat.html" title="This is the base class for calendar formats.">CalFormat</a> *format )
<a name="l00063"></a>00063 {
<a name="l00064"></a>00064   mFileName = fileName;
<a name="l00065"></a>00065   <a class="code" href="classKCal_1_1FileStorage.html" title="This class provides a calendar storage as a local file.">FileStorage</a> storage( <span class="keyword">this</span>, fileName, format );
<a name="l00066"></a>00066   <span class="keywordflow">return</span> storage.<a class="code" href="classKCal_1_1FileStorage.html#cec1ff977a4fb2885ca0f90336b2c296">load</a>();
<a name="l00067"></a>00067 }
<a name="l00068"></a>00068 
<a name="l00069"></a><a class="code" href="classKCal_1_1CalendarLocal.html#0705e55330b8f3ec85fba32d99c21b86">00069</a> <span class="keywordtype">bool</span> <a class="code" href="classKCal_1_1CalendarLocal.html#0705e55330b8f3ec85fba32d99c21b86" title="Reloads the contents of the storage into memory.">CalendarLocal::reload</a>( <span class="keyword">const</span> QString &amp;tz )
<a name="l00070"></a>00070 {
<a name="l00071"></a>00071   <span class="keyword">const</span> QString filename = mFileName;
<a name="l00072"></a>00072   <a class="code" href="classKCal_1_1CalendarLocal.html#f3e60cb4c0a04a7fbd61eea1e44d549f" title="Sync changes in memory to persistant storage.">save</a>();
<a name="l00073"></a>00073   <a class="code" href="classKCal_1_1CalendarLocal.html#9a545de4837453eea733dd61883ca513" title="Clears out the current calendar, freeing all used memory etc.">close</a>();
<a name="l00074"></a>00074   mFileName = filename;
<a name="l00075"></a>00075   <a class="code" href="classKCal_1_1Calendar.html#0140baff3c473d4404bd5172fc1aad2f" title="Set the Time Zone Id for the Calendar.">setTimeZoneId</a>( tz );
<a name="l00076"></a>00076   <a class="code" href="classKCal_1_1FileStorage.html" title="This class provides a calendar storage as a local file.">FileStorage</a> storage( <span class="keyword">this</span>, mFileName );
<a name="l00077"></a>00077   <span class="keywordflow">return</span> storage.<a class="code" href="classKCal_1_1FileStorage.html#cec1ff977a4fb2885ca0f90336b2c296">load</a>();
<a name="l00078"></a>00078 }
<a name="l00079"></a>00079 
<a name="l00080"></a><a class="code" href="classKCal_1_1CalendarLocal.html#8575cc8395600c460c88355e155b3eb7">00080</a> <span class="keywordtype">bool</span> <a class="code" href="classKCal_1_1CalendarLocal.html#f3e60cb4c0a04a7fbd61eea1e44d549f" title="Sync changes in memory to persistant storage.">CalendarLocal::save</a>( <span class="keyword">const</span> QString &amp;fileName, <a class="code" href="classKCal_1_1CalFormat.html" title="This is the base class for calendar formats.">CalFormat</a> *format )
<a name="l00081"></a>00081 {
<a name="l00082"></a>00082   <span class="comment">// Save only if the calendar is either modified, or saved to a</span>
<a name="l00083"></a>00083   <span class="comment">// different file than it was loaded from</span>
<a name="l00084"></a>00084   <span class="keywordflow">if</span> ( mFileName != fileName || <a class="code" href="classKCal_1_1Calendar.html#da78fe4ce3d2d729f3296db2a9290116" title="Determine the Calendar&amp;#39;s modification status.">isModified</a>() ) {
<a name="l00085"></a>00085     <a class="code" href="classKCal_1_1FileStorage.html" title="This class provides a calendar storage as a local file.">FileStorage</a> storage( <span class="keyword">this</span>, fileName, format );
<a name="l00086"></a>00086     <span class="keywordflow">return</span> storage.<a class="code" href="classKCal_1_1FileStorage.html#bc882239d83ffc2b3ddc86aad18ac83c">save</a>();
<a name="l00087"></a>00087   } <span class="keywordflow">else</span> {
<a name="l00088"></a>00088     <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00089"></a>00089   }
<a name="l00090"></a>00090 }
<a name="l00091"></a>00091 
<a name="l00092"></a><a class="code" href="classKCal_1_1CalendarLocal.html#9a545de4837453eea733dd61883ca513">00092</a> <span class="keywordtype">void</span> <a class="code" href="classKCal_1_1CalendarLocal.html#9a545de4837453eea733dd61883ca513" title="Clears out the current calendar, freeing all used memory etc.">CalendarLocal::close</a>()
<a name="l00093"></a>00093 {
<a name="l00094"></a>00094   <a class="code" href="classKCal_1_1Calendar.html#9cb2ef531883e673731fbf5f4c9e8b2e" title="Let Calendar subclasses notify that they enabled an Observer.">setObserversEnabled</a>( <span class="keyword">false</span> );
<a name="l00095"></a>00095   mFileName = QString::null;
<a name="l00096"></a>00096 
<a name="l00097"></a>00097   <a class="code" href="classKCal_1_1CalendarLocal.html#c7ad6e317baa1299516114fd10ee68ce" title="Deletes all events from this calendar.">deleteAllEvents</a>();
<a name="l00098"></a>00098   <a class="code" href="classKCal_1_1CalendarLocal.html#684155385b19f62ea6f7ce5a9faa65fa" title="Deletes all todos from this calendar.">deleteAllTodos</a>();
<a name="l00099"></a>00099   <a class="code" href="classKCal_1_1CalendarLocal.html#58a2a5a909afb8baede313092a954b29" title="Deletes all journals from this calendar.">deleteAllJournals</a>();
<a name="l00100"></a>00100 
<a name="l00101"></a>00101   mDeletedIncidences.clear();
<a name="l00102"></a>00102   <a class="code" href="classKCal_1_1Calendar.html#6acbb24e958823e79ddf2831c0f50a50" title="Set if the Calendar had been modified.">setModified</a>( <span class="keyword">false</span> );
<a name="l00103"></a>00103 
<a name="l00104"></a>00104   <a class="code" href="classKCal_1_1Calendar.html#9cb2ef531883e673731fbf5f4c9e8b2e" title="Let Calendar subclasses notify that they enabled an Observer.">setObserversEnabled</a>( <span class="keyword">true</span> );
<a name="l00105"></a>00105 }
<a name="l00106"></a>00106 
<a name="l00107"></a>00107 
<a name="l00108"></a><a class="code" href="classKCal_1_1CalendarLocal.html#92badd294078f18a2c2acbfab8ce10ac">00108</a> <span class="keywordtype">bool</span> <a class="code" href="classKCal_1_1CalendarLocal.html#92badd294078f18a2c2acbfab8ce10ac" title="Add Event to calendar.">CalendarLocal::addEvent</a>( <a class="code" href="classKCal_1_1Event.html" title="This class provides an Event in the sense of RFC2445.">Event</a> *<a class="code" href="classKCal_1_1CalendarLocal.html#110d9ec156050c1fd39c5a622d2f8cc1" title="Retrieves an event on the basis of the unique string ID.">event</a> )
<a name="l00109"></a>00109 {
<a name="l00110"></a>00110   <a class="code" href="classKCal_1_1CalendarLocal.html#a7de8318247afbb24317674c891aaa79" title="inserts an event into its &amp;quot;proper place&amp;quot; in the calendar.">insertEvent</a>( event );
<a name="l00111"></a>00111 
<a name="l00112"></a>00112   <span class="keyword">event</span>-&gt;registerObserver( <span class="keyword">this</span> );
<a name="l00113"></a>00113 
<a name="l00114"></a>00114   <a class="code" href="classKCal_1_1Calendar.html#6acbb24e958823e79ddf2831c0f50a50" title="Set if the Calendar had been modified.">setModified</a>( <span class="keyword">true</span> );
<a name="l00115"></a>00115 
<a name="l00116"></a>00116   <a class="code" href="classKCal_1_1Calendar.html#b320f93d0f4b93ae1cedb76d2e27bf7d" title="Let Calendar subclasses notify that they inserted an Incidence.">notifyIncidenceAdded</a>( event );
<a name="l00117"></a>00117 
<a name="l00118"></a>00118   <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00119"></a>00119 }
<a name="l00120"></a>00120 
<a name="l00121"></a><a class="code" href="classKCal_1_1CalendarLocal.html#574629efd65cc7032141b5dc389b3713">00121</a> <span class="keywordtype">bool</span> <a class="code" href="classKCal_1_1CalendarLocal.html#574629efd65cc7032141b5dc389b3713" title="Deletes an event from this calendar.">CalendarLocal::deleteEvent</a>( <a class="code" href="classKCal_1_1Event.html" title="This class provides an Event in the sense of RFC2445.">Event</a> *<a class="code" href="classKCal_1_1CalendarLocal.html#110d9ec156050c1fd39c5a622d2f8cc1" title="Retrieves an event on the basis of the unique string ID.">event</a> )
<a name="l00122"></a>00122 {
<a name="l00123"></a>00123 <span class="comment">//  kdDebug(5800) &lt;&lt; "CalendarLocal::deleteEvent" &lt;&lt; endl;</span>
<a name="l00124"></a>00124 
<a name="l00125"></a>00125   <span class="keywordflow">if</span> ( mEvents.remove( event-&gt;<a class="code" href="classKCal_1_1IncidenceBase.html#75c8bd2df73c5a62bd7cf77c2ac4d3c6" title="Return the unique id for the event.">uid</a>() ) ) {
<a name="l00126"></a>00126     <a class="code" href="classKCal_1_1Calendar.html#6acbb24e958823e79ddf2831c0f50a50" title="Set if the Calendar had been modified.">setModified</a>( <span class="keyword">true</span> );
<a name="l00127"></a>00127     <a class="code" href="classKCal_1_1Calendar.html#41d4be475453592dcebb7c2504f800c6" title="Let Calendar subclasses notify that they removed an Incidence.">notifyIncidenceDeleted</a>( event );
<a name="l00128"></a>00128     mDeletedIncidences.append( event );
<a name="l00129"></a>00129     <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00130"></a>00130   } <span class="keywordflow">else</span> {
<a name="l00131"></a>00131     kdWarning() &lt;&lt; <span class="stringliteral">"CalendarLocal::deleteEvent(): Event not found."</span> &lt;&lt; endl;
<a name="l00132"></a>00132     <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00133"></a>00133   }
<a name="l00134"></a>00134 }
<a name="l00135"></a>00135 
<a name="l00136"></a><a class="code" href="classKCal_1_1CalendarLocal.html#c7ad6e317baa1299516114fd10ee68ce">00136</a> <span class="keywordtype">void</span> <a class="code" href="classKCal_1_1CalendarLocal.html#c7ad6e317baa1299516114fd10ee68ce" title="Deletes all events from this calendar.">CalendarLocal::deleteAllEvents</a>()
<a name="l00137"></a>00137 {
<a name="l00138"></a>00138   <span class="comment">// kdDebug(5800) &lt;&lt; "CalendarLocal::deleteAllEvents" &lt;&lt; endl;</span>
<a name="l00139"></a>00139   QDictIterator&lt;Event&gt; it( mEvents );
<a name="l00140"></a>00140   <span class="keywordflow">while</span>( it.current() ) {
<a name="l00141"></a>00141     <a class="code" href="classKCal_1_1Calendar.html#41d4be475453592dcebb7c2504f800c6" title="Let Calendar subclasses notify that they removed an Incidence.">notifyIncidenceDeleted</a>( it.current() );
<a name="l00142"></a>00142     ++it;
<a name="l00143"></a>00143   }
<a name="l00144"></a>00144 
<a name="l00145"></a>00145   mEvents.setAutoDelete( <span class="keyword">true</span> );
<a name="l00146"></a>00146   mEvents.clear();
<a name="l00147"></a>00147   mEvents.setAutoDelete( <span class="keyword">false</span> );
<a name="l00148"></a>00148 }
<a name="l00149"></a>00149 
<a name="l00150"></a><a class="code" href="classKCal_1_1CalendarLocal.html#110d9ec156050c1fd39c5a622d2f8cc1">00150</a> <a class="code" href="classKCal_1_1Event.html" title="This class provides an Event in the sense of RFC2445.">Event</a> *<a class="code" href="classKCal_1_1CalendarLocal.html#110d9ec156050c1fd39c5a622d2f8cc1" title="Retrieves an event on the basis of the unique string ID.">CalendarLocal::event</a>( <span class="keyword">const</span> QString &amp;uid )
<a name="l00151"></a>00151 {
<a name="l00152"></a>00152 <span class="comment">//  kdDebug(5800) &lt;&lt; "CalendarLocal::event(): " &lt;&lt; uid &lt;&lt; endl;</span>
<a name="l00153"></a>00153   <span class="keywordflow">return</span> mEvents[ uid ];
<a name="l00154"></a>00154 }
<a name="l00155"></a>00155 
<a name="l00156"></a><a class="code" href="classKCal_1_1CalendarLocal.html#253549807b55e8c1b603042957dcbf01">00156</a> <span class="keywordtype">bool</span> <a class="code" href="classKCal_1_1CalendarLocal.html#253549807b55e8c1b603042957dcbf01" title="Add a todo to the todolist.">CalendarLocal::addTodo</a>( <a class="code" href="classKCal_1_1Todo.html" title="This class provides a Todo in the sense of RFC2445.">Todo</a> *<a class="code" href="classKCal_1_1CalendarLocal.html#eb63e714a9239900ee030823e587da67" title="Searches todolist for an event with this unique string identifier, returns a pointer...">todo</a> )
<a name="l00157"></a>00157 {
<a name="l00158"></a>00158   mTodoList.append( todo );
<a name="l00159"></a>00159 
<a name="l00160"></a>00160   todo-&gt;<a class="code" href="classKCal_1_1IncidenceBase.html#490816ccda2c6637b0f12235ba0b5869" title="Register observer.">registerObserver</a>( <span class="keyword">this</span> );
<a name="l00161"></a>00161 
<a name="l00162"></a>00162   <span class="comment">// Set up subtask relations</span>
<a name="l00163"></a>00163   <a class="code" href="classKCal_1_1Calendar.html#3f3de93b1c098488d3fcf8bc0bdcc09b" title="Setup Relations for an Incidence.">setupRelations</a>( todo );
<a name="l00164"></a>00164 
<a name="l00165"></a>00165   <a class="code" href="classKCal_1_1Calendar.html#6acbb24e958823e79ddf2831c0f50a50" title="Set if the Calendar had been modified.">setModified</a>( <span class="keyword">true</span> );
<a name="l00166"></a>00166 
<a name="l00167"></a>00167   <a class="code" href="classKCal_1_1Calendar.html#b320f93d0f4b93ae1cedb76d2e27bf7d" title="Let Calendar subclasses notify that they inserted an Incidence.">notifyIncidenceAdded</a>( todo );
<a name="l00168"></a>00168 
<a name="l00169"></a>00169   <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00170"></a>00170 }
<a name="l00171"></a>00171 
<a name="l00172"></a><a class="code" href="classKCal_1_1CalendarLocal.html#622c6857d55a0105b9b4cf59c5354a56">00172</a> <span class="keywordtype">bool</span> <a class="code" href="classKCal_1_1CalendarLocal.html#622c6857d55a0105b9b4cf59c5354a56" title="Remove a todo from the todolist.">CalendarLocal::deleteTodo</a>( <a class="code" href="classKCal_1_1Todo.html" title="This class provides a Todo in the sense of RFC2445.">Todo</a> *<a class="code" href="classKCal_1_1CalendarLocal.html#eb63e714a9239900ee030823e587da67" title="Searches todolist for an event with this unique string identifier, returns a pointer...">todo</a> )
<a name="l00173"></a>00173 {
<a name="l00174"></a>00174   <span class="comment">// Handle orphaned children</span>
<a name="l00175"></a>00175   <a class="code" href="classKCal_1_1Calendar.html#70a85f266e8a3f23f01850b7106e3d51" title="Remove all Relations from an Incidence.">removeRelations</a>( todo );
<a name="l00176"></a>00176 
<a name="l00177"></a>00177   <span class="keywordflow">if</span> ( mTodoList.removeRef( todo ) ) {
<a name="l00178"></a>00178     <a class="code" href="classKCal_1_1Calendar.html#6acbb24e958823e79ddf2831c0f50a50" title="Set if the Calendar had been modified.">setModified</a>( <span class="keyword">true</span> );
<a name="l00179"></a>00179     <a class="code" href="classKCal_1_1Calendar.html#41d4be475453592dcebb7c2504f800c6" title="Let Calendar subclasses notify that they removed an Incidence.">notifyIncidenceDeleted</a>( todo );
<a name="l00180"></a>00180     mDeletedIncidences.append( todo );
<a name="l00181"></a>00181     <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00182"></a>00182   } <span class="keywordflow">else</span> {
<a name="l00183"></a>00183     kdWarning() &lt;&lt; <span class="stringliteral">"CalendarLocal::deleteTodo(): Todo not found."</span> &lt;&lt; endl;
<a name="l00184"></a>00184     <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00185"></a>00185   }
<a name="l00186"></a>00186 }
<a name="l00187"></a>00187 
<a name="l00188"></a><a class="code" href="classKCal_1_1CalendarLocal.html#684155385b19f62ea6f7ce5a9faa65fa">00188</a> <span class="keywordtype">void</span> <a class="code" href="classKCal_1_1CalendarLocal.html#684155385b19f62ea6f7ce5a9faa65fa" title="Deletes all todos from this calendar.">CalendarLocal::deleteAllTodos</a>()
<a name="l00189"></a>00189 {
<a name="l00190"></a>00190   <span class="comment">// kdDebug(5800) &lt;&lt; "CalendarLocal::deleteAllTodos()\n";</span>
<a name="l00191"></a>00191   Todo::List::ConstIterator it;
<a name="l00192"></a>00192   <span class="keywordflow">for</span>( it = mTodoList.begin(); it != mTodoList.end(); ++it ) {
<a name="l00193"></a>00193     <a class="code" href="classKCal_1_1Calendar.html#41d4be475453592dcebb7c2504f800c6" title="Let Calendar subclasses notify that they removed an Incidence.">notifyIncidenceDeleted</a>( *it );
<a name="l00194"></a>00194   }
<a name="l00195"></a>00195 
<a name="l00196"></a>00196   mTodoList.setAutoDelete( <span class="keyword">true</span> );
<a name="l00197"></a>00197   mTodoList.clear();
<a name="l00198"></a>00198   mTodoList.setAutoDelete( <span class="keyword">false</span> );
<a name="l00199"></a>00199 }
<a name="l00200"></a>00200 
<a name="l00201"></a><a class="code" href="classKCal_1_1CalendarLocal.html#72bf6c036b4c2c084e4e02ec43dfff77">00201</a> Todo::List <a class="code" href="classKCal_1_1CalendarLocal.html#72bf6c036b4c2c084e4e02ec43dfff77" title="Return list of all todos.">CalendarLocal::rawTodos</a>( <a class="code" href="namespaceKCal.html#055336d90bea8a2c86fde0d94a082162" title="How Todos are to be sorted.">TodoSortField</a> sortField,
<a name="l00202"></a>00202                                     <a class="code" href="namespaceKCal.html#b79dc8179fdc021ae82c321b08fb6765" title="Sort direction.">SortDirection</a> sortDirection )
<a name="l00203"></a>00203 {
<a name="l00204"></a>00204   <span class="keywordflow">return</span> <a class="code" href="classKCal_1_1Calendar.html#040242aba6a4b11c00d8a34fb8f7d8d2" title="Sort a list of Todos.">sortTodos</a>( &amp;mTodoList, sortField, sortDirection );
<a name="l00205"></a>00205 }
<a name="l00206"></a>00206 
<a name="l00207"></a><a class="code" href="classKCal_1_1CalendarLocal.html#eb63e714a9239900ee030823e587da67">00207</a> <a class="code" href="classKCal_1_1Todo.html" title="This class provides a Todo in the sense of RFC2445.">Todo</a> *<a class="code" href="classKCal_1_1CalendarLocal.html#eb63e714a9239900ee030823e587da67" title="Searches todolist for an event with this unique string identifier, returns a pointer...">CalendarLocal::todo</a>( <span class="keyword">const</span> QString &amp;uid )
<a name="l00208"></a>00208 {
<a name="l00209"></a>00209   Todo::List::ConstIterator it;
<a name="l00210"></a>00210   <span class="keywordflow">for</span> ( it = mTodoList.begin(); it != mTodoList.end(); ++it ) {
<a name="l00211"></a>00211     <span class="keywordflow">if</span> ( (*it)-&gt;uid() == uid ) <span class="keywordflow">return</span> *it;
<a name="l00212"></a>00212   }
<a name="l00213"></a>00213 
<a name="l00214"></a>00214   <span class="keywordflow">return</span> 0;
<a name="l00215"></a>00215 }
<a name="l00216"></a>00216 
<a name="l00217"></a><a class="code" href="classKCal_1_1CalendarLocal.html#a3759e96f79f90dfb6498a615e07472d">00217</a> Todo::List <a class="code" href="classKCal_1_1CalendarLocal.html#a3759e96f79f90dfb6498a615e07472d" title="Returns list of todos due on the specified date.">CalendarLocal::rawTodosForDate</a>( <span class="keyword">const</span> QDate &amp;date )
<a name="l00218"></a>00218 {
<a name="l00219"></a>00219   Todo::List <a class="code" href="classKCal_1_1Calendar.html#ed7c816d2cede2558b5624e8a34ee745" title="Return a sorted, filtered list of all Todos for this Calendar.">todos</a>;
<a name="l00220"></a>00220 
<a name="l00221"></a>00221   Todo::List::ConstIterator it;
<a name="l00222"></a>00222   <span class="keywordflow">for</span> ( it = mTodoList.begin(); it != mTodoList.end(); ++it ) {
<a name="l00223"></a>00223     <a class="code" href="classKCal_1_1Todo.html" title="This class provides a Todo in the sense of RFC2445.">Todo</a> *<a class="code" href="classKCal_1_1CalendarLocal.html#eb63e714a9239900ee030823e587da67" title="Searches todolist for an event with this unique string identifier, returns a pointer...">todo</a> = *it;
<a name="l00224"></a>00224     <span class="keywordflow">if</span> ( todo-&gt;<a class="code" href="classKCal_1_1Todo.html#a40c65f6e9024015f7546e8749436b12" title="Returns true if the todo has a due date, otherwise return false.">hasDueDate</a>() &amp;&amp; todo-&gt;<a class="code" href="classKCal_1_1Todo.html#09d6933ae42390339b27053faee3afec" title="Returns due date and time.">dtDue</a>().date() == date ) {
<a name="l00225"></a>00225       todos.append( todo );
<a name="l00226"></a>00226     }
<a name="l00227"></a>00227   }
<a name="l00228"></a>00228 
<a name="l00229"></a>00229   <span class="keywordflow">return</span> todos;
<a name="l00230"></a>00230 }
<a name="l00231"></a>00231 
<a name="l00232"></a><a class="code" href="classKCal_1_1CalendarLocal.html#52445c7d693f19b220154a9676ad32ca">00232</a> Alarm::List <a class="code" href="classKCal_1_1CalendarLocal.html#52445c7d693f19b220154a9676ad32ca" title="Return all alarms, which ocur before given date.">CalendarLocal::alarmsTo</a>( <span class="keyword">const</span> QDateTime &amp;to )
<a name="l00233"></a>00233 {
<a name="l00234"></a>00234   <span class="keywordflow">return</span> <a class="code" href="classKCal_1_1CalendarLocal.html#2f96393bd0938e66962b01b6fb23cd9e" title="Return all alarms, which ocur in the given time interval.">alarms</a>( QDateTime( QDate( 1900, 1, 1 ) ), to );
<a name="l00235"></a>00235 }
<a name="l00236"></a>00236 
<a name="l00237"></a><a class="code" href="classKCal_1_1CalendarLocal.html#2f96393bd0938e66962b01b6fb23cd9e">00237</a> Alarm::List <a class="code" href="classKCal_1_1CalendarLocal.html#2f96393bd0938e66962b01b6fb23cd9e" title="Return all alarms, which ocur in the given time interval.">CalendarLocal::alarms</a>( <span class="keyword">const</span> QDateTime &amp;from, <span class="keyword">const</span> QDateTime &amp;to )
<a name="l00238"></a>00238 {
<a name="l00239"></a>00239 <span class="comment">//  kdDebug(5800) &lt;&lt; "CalendarLocal::alarms(" &lt;&lt; from.toString() &lt;&lt; " - "</span>
<a name="l00240"></a>00240 <span class="comment">//                &lt;&lt; to.toString() &lt;&lt; ")" &lt;&lt; endl;</span>
<a name="l00241"></a>00241 
<a name="l00242"></a>00242   Alarm::List <a class="code" href="classKCal_1_1CalendarLocal.html#2f96393bd0938e66962b01b6fb23cd9e" title="Return all alarms, which ocur in the given time interval.">alarms</a>;
<a name="l00243"></a>00243 
<a name="l00244"></a>00244   EventDictIterator it( mEvents );
<a name="l00245"></a>00245   <span class="keywordflow">for</span>( ; it.current(); ++it ) {
<a name="l00246"></a>00246     <a class="code" href="classKCal_1_1Event.html" title="This class provides an Event in the sense of RFC2445.">Event</a> *e = *it;
<a name="l00247"></a>00247     <span class="keywordflow">if</span> ( e-&gt;<a class="code" href="classKCal_1_1Incidence.html#81ad15662138be07f0d55be6b075b043" title="Forward to Recurrence::doesRecur().">doesRecur</a>() ) <a class="code" href="classKCal_1_1CalendarLocal.html#cf32ced98028c9e06f1e3aa5e5eb9df2" title="Append alarms of recurring events in interval to list of alarms.">appendRecurringAlarms</a>( alarms, e, from, to );
<a name="l00248"></a>00248     <span class="keywordflow">else</span> <a class="code" href="classKCal_1_1CalendarLocal.html#ca3de77324b8e3afbb2ddf25d88919ae" title="Append alarms of incidence in interval to list of alarms.">appendAlarms</a>( alarms, e, from, to );
<a name="l00249"></a>00249   }
<a name="l00250"></a>00250 
<a name="l00251"></a>00251   Todo::List::ConstIterator it2;
<a name="l00252"></a>00252   <span class="keywordflow">for</span>( it2 = mTodoList.begin(); it2 != mTodoList.end(); ++it2 ) {
<a name="l00253"></a>00253     <span class="keywordflow">if</span> (! (*it2)-&gt;isCompleted() ) <a class="code" href="classKCal_1_1CalendarLocal.html#ca3de77324b8e3afbb2ddf25d88919ae" title="Append alarms of incidence in interval to list of alarms.">appendAlarms</a>( alarms, *it2, from, to );
<a name="l00254"></a>00254   }
<a name="l00255"></a>00255 
<a name="l00256"></a>00256   <span class="keywordflow">return</span> alarms;
<a name="l00257"></a>00257 }
<a name="l00258"></a>00258 
<a name="l00259"></a><a class="code" href="classKCal_1_1CalendarLocal.html#ca3de77324b8e3afbb2ddf25d88919ae">00259</a> <span class="keywordtype">void</span> <a class="code" href="classKCal_1_1CalendarLocal.html#ca3de77324b8e3afbb2ddf25d88919ae" title="Append alarms of incidence in interval to list of alarms.">CalendarLocal::appendAlarms</a>( Alarm::List &amp;<a class="code" href="classKCal_1_1CalendarLocal.html#2f96393bd0938e66962b01b6fb23cd9e" title="Return all alarms, which ocur in the given time interval.">alarms</a>, <a class="code" href="classKCal_1_1Incidence.html" title="This class provides the base class common to all calendar components.">Incidence</a> *<a class="code" href="classKCal_1_1Calendar.html#d271d711219da854049efa30723188c4" title="Returns the Incidence associated with the given unique identifier.">incidence</a>,
<a name="l00260"></a>00260                                   <span class="keyword">const</span> QDateTime &amp;from, <span class="keyword">const</span> QDateTime &amp;to )
<a name="l00261"></a>00261 {
<a name="l00262"></a>00262   QDateTime preTime = from.addSecs(-1);
<a name="l00263"></a>00263   Alarm::List::ConstIterator it;
<a name="l00264"></a>00264   <span class="keywordflow">for</span>( it = incidence-&gt;<a class="code" href="classKCal_1_1Incidence.html#33727cd753dde462c0995d5a4f1ea40c" title="All alarms that are associated with this incidence.">alarms</a>().begin(); it != incidence-&gt;<a class="code" href="classKCal_1_1Incidence.html#33727cd753dde462c0995d5a4f1ea40c" title="All alarms that are associated with this incidence.">alarms</a>().end();
<a name="l00265"></a>00265        ++it ) {
<a name="l00266"></a>00266     <span class="keywordflow">if</span> ( (*it)-&gt;enabled() ) {
<a name="l00267"></a>00267       QDateTime dt = (*it)-&gt;nextRepetition(preTime);
<a name="l00268"></a>00268       <span class="keywordflow">if</span> ( dt.isValid() &amp;&amp; dt &lt;= to ) {
<a name="l00269"></a>00269         kdDebug(5800) &lt;&lt; <span class="stringliteral">"CalendarLocal::appendAlarms() '"</span>
<a name="l00270"></a>00270                       &lt;&lt; incidence-&gt;<a class="code" href="classKCal_1_1Incidence.html#5f6e41afa4e1b167c4b49e603506b34c" title="Return short summary.">summary</a>() &lt;&lt; <span class="stringliteral">"': "</span>
<a name="l00271"></a>00271                       &lt;&lt; dt.toString() &lt;&lt; endl;
<a name="l00272"></a>00272         alarms.append( *it );
<a name="l00273"></a>00273       }
<a name="l00274"></a>00274     }
<a name="l00275"></a>00275   }
<a name="l00276"></a>00276 }
<a name="l00277"></a>00277 
<a name="l00278"></a><a class="code" href="classKCal_1_1CalendarLocal.html#cf32ced98028c9e06f1e3aa5e5eb9df2">00278</a> <span class="keywordtype">void</span> <a class="code" href="classKCal_1_1CalendarLocal.html#cf32ced98028c9e06f1e3aa5e5eb9df2" title="Append alarms of recurring events in interval to list of alarms.">CalendarLocal::appendRecurringAlarms</a>( Alarm::List &amp;<a class="code" href="classKCal_1_1CalendarLocal.html#2f96393bd0938e66962b01b6fb23cd9e" title="Return all alarms, which ocur in the given time interval.">alarms</a>,
<a name="l00279"></a>00279                                            <a class="code" href="classKCal_1_1Incidence.html" title="This class provides the base class common to all calendar components.">Incidence</a> *<a class="code" href="classKCal_1_1Calendar.html#d271d711219da854049efa30723188c4" title="Returns the Incidence associated with the given unique identifier.">incidence</a>,
<a name="l00280"></a>00280                                            <span class="keyword">const</span> QDateTime &amp;from,
<a name="l00281"></a>00281                                            <span class="keyword">const</span> QDateTime &amp;to )
<a name="l00282"></a>00282 {
<a name="l00283"></a>00283   QDateTime qdt;
<a name="l00284"></a>00284   <span class="keywordtype">int</span>  endOffset = 0;
<a name="l00285"></a>00285   <span class="keywordtype">bool</span> endOffsetValid = <span class="keyword">false</span>;
<a name="l00286"></a>00286   <span class="keywordtype">int</span>  period = from.secsTo(to);
<a name="l00287"></a>00287   Alarm::List::ConstIterator it;
<a name="l00288"></a>00288   <span class="keywordflow">for</span>( it = incidence-&gt;<a class="code" href="classKCal_1_1Incidence.html#33727cd753dde462c0995d5a4f1ea40c" title="All alarms that are associated with this incidence.">alarms</a>().begin(); it != incidence-&gt;<a class="code" href="classKCal_1_1Incidence.html#33727cd753dde462c0995d5a4f1ea40c" title="All alarms that are associated with this incidence.">alarms</a>().end();
<a name="l00289"></a>00289        ++it ) {
<a name="l00290"></a>00290     <a class="code" href="classKCal_1_1Alarm.html" title="This class represents an alarm notification.">Alarm</a> *alarm = *it;
<a name="l00291"></a>00291     <span class="keywordflow">if</span> ( alarm-&gt;<a class="code" href="classKCal_1_1Alarm.html#dcc94edf832e47bcc7825b6520dfe206" title="Get the alarm enabled status.">enabled</a>() ) {
<a name="l00292"></a>00292       <span class="keywordflow">if</span> ( alarm-&gt;<a class="code" href="classKCal_1_1Alarm.html#096ea538fb51db902c86c9ea3ba9d23d" title="Return true, if the alarm has an explicit date/time.">hasTime</a>() ) {
<a name="l00293"></a>00293         <span class="comment">// The alarm time is defined as an absolute date/time</span>
<a name="l00294"></a>00294         qdt = alarm-&gt;<a class="code" href="classKCal_1_1Alarm.html#c27cdde359ab997b2aecfebf46804b64" title="Get the time of the alarm&amp;#39;s initial occurrence or its next repetition, after...">nextRepetition</a>( from.addSecs(-1) );
<a name="l00295"></a>00295         <span class="keywordflow">if</span> ( !qdt.isValid() || qdt &gt; to )
<a name="l00296"></a>00296           <span class="keywordflow">continue</span>;
<a name="l00297"></a>00297       } <span class="keywordflow">else</span> {
<a name="l00298"></a>00298         <span class="comment">// The alarm time is defined by an offset from the event start or end time.</span>
<a name="l00299"></a>00299         <span class="comment">// Find the offset from the event start time, which is also used as the</span>
<a name="l00300"></a>00300         <span class="comment">// offset from the recurrence time.</span>
<a name="l00301"></a>00301         <span class="keywordtype">int</span> offset = 0;
<a name="l00302"></a>00302         <span class="keywordflow">if</span> ( alarm-&gt;<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="l00303"></a>00303           offset = alarm-&gt;<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 class="code" href="classKCal_1_1Duration.html#34b69f5167fc798461a45971619227f6">asSeconds</a>();
<a name="l00304"></a>00304         } <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( alarm-&gt;<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="l00305"></a>00305           <span class="keywordflow">if</span> ( !endOffsetValid ) {
<a name="l00306"></a>00306             endOffset = incidence-&gt;<a class="code" href="classKCal_1_1IncidenceBase.html#5419a946a4e5715a0c34ec2c7e04cd9b" title="returns an event&amp;#39;s starting date/time as a QDateTime.">dtStart</a>().secsTo( incidence-&gt;<a class="code" href="classKCal_1_1Incidence.html#de746f2e79686208c0d1238977d6a797" title="Return the incidence&amp;#39;s ending date/time as a QDateTime.">dtEnd</a>() );
<a name="l00307"></a>00307             endOffsetValid = <span class="keyword">true</span>;
<a name="l00308"></a>00308           }
<a name="l00309"></a>00309           offset = alarm-&gt;<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 class="code" href="classKCal_1_1Duration.html#34b69f5167fc798461a45971619227f6">asSeconds</a>() + endOffset;
<a name="l00310"></a>00310         }
<a name="l00311"></a>00311 
<a name="l00312"></a>00312         <span class="comment">// Adjust the 'from' date/time and find the next recurrence at or after it</span>
<a name="l00313"></a>00313         qdt = incidence-&gt;<a class="code" href="classKCal_1_1Incidence.html#d06004593e064a37d08c96f9ae16735e" title="Return the recurrence rule associated with this incidence.">recurrence</a>()-&gt;<a class="code" href="classKCal_1_1Recurrence.html#158561ac748570b0bf058a6b69007df8" title="Returns the date and time of the next recurrence, after the specified date/time.">getNextDateTime</a>( from.addSecs(-offset - 1) );
<a name="l00314"></a>00314         <span class="keywordflow">if</span> ( !qdt.isValid()
<a name="l00315"></a>00315         ||   (qdt = qdt.addSecs( offset )) &gt; to )    <span class="comment">// remove the adjustment to get the alarm time</span>
<a name="l00316"></a>00316         {
<a name="l00317"></a>00317           <span class="comment">// The next recurrence is too late.</span>
<a name="l00318"></a>00318           <span class="keywordflow">if</span> ( !alarm-&gt;<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="l00319"></a>00319             <span class="keywordflow">continue</span>;
<a name="l00320"></a>00320           <span class="comment">// The alarm has repetitions, so check whether repetitions of previous</span>
<a name="l00321"></a>00321           <span class="comment">// recurrences fall within the time period.</span>
<a name="l00322"></a>00322           <span class="keywordtype">bool</span> found = <span class="keyword">false</span>;
<a name="l00323"></a>00323           qdt = from.addSecs( -offset );
<a name="l00324"></a>00324           <span class="keywordflow">while</span> ( (qdt = incidence-&gt;<a class="code" href="classKCal_1_1Incidence.html#d06004593e064a37d08c96f9ae16735e" title="Return the recurrence rule associated with this incidence.">recurrence</a>()-&gt;<a class="code" href="classKCal_1_1Recurrence.html#05c8ad92491d745d403cb6059da541e0" title="Returns the date and time of the last previous recurrence, before the specified date/time...">getPreviousDateTime</a>( qdt )).isValid() ) {
<a name="l00325"></a>00325             <span class="keywordtype">int</span> toFrom = qdt.secsTo( from ) - offset;
<a name="l00326"></a>00326             <span class="keywordflow">if</span> ( toFrom &gt; alarm-&gt;<a class="code" href="classKCal_1_1Alarm.html#5678a5addab945afeee2c09f4103eb0e" title="Get how long between the alarm&amp;#39;s initial occurrence and its final repetition...">duration</a>() )
<a name="l00327"></a>00327               <span class="keywordflow">break</span>;     <span class="comment">// this recurrence's last repetition is too early, so give up</span>
<a name="l00328"></a>00328             <span class="comment">// The last repetition of this recurrence is at or after 'from' time.</span>
<a name="l00329"></a>00329             <span class="comment">// Check if a repetition occurs between 'from' and 'to'.</span>
<a name="l00330"></a>00330             <span class="keywordtype">int</span> snooze = alarm-&gt;<a class="code" href="classKCal_1_1Alarm.html#716673277cd34a2c8c1a75e28989bf8c" title="Get how long the alarm snooze interval is.">snoozeTime</a>() * 60;   <span class="comment">// in seconds</span>
<a name="l00331"></a>00331             <span class="keywordflow">if</span> ( period &gt;= snooze
<a name="l00332"></a>00332             ||   toFrom % snooze == 0
<a name="l00333"></a>00333             ||   (toFrom / snooze + 1) * snooze &lt;= toFrom + period ) {
<a name="l00334"></a>00334               found = <span class="keyword">true</span>;
<a name="l00335"></a>00335 <span class="preprocessor">#ifndef NDEBUG</span>
<a name="l00336"></a>00336 <span class="preprocessor"></span>              qdt = qdt.addSecs( offset + ((toFrom-1) / snooze + 1) * snooze );   <span class="comment">// for debug output</span>
<a name="l00337"></a>00337 <span class="preprocessor">#endif</span>
<a name="l00338"></a>00338 <span class="preprocessor"></span>              <span class="keywordflow">break</span>;
<a name="l00339"></a>00339             }
<a name="l00340"></a>00340           }
<a name="l00341"></a>00341           <span class="keywordflow">if</span> ( !found )
<a name="l00342"></a>00342             <span class="keywordflow">continue</span>;
<a name="l00343"></a>00343         }
<a name="l00344"></a>00344       }
<a name="l00345"></a>00345       kdDebug(5800) &lt;&lt; <span class="stringliteral">"CalendarLocal::appendAlarms() '"</span> &lt;&lt; incidence-&gt;<a class="code" href="classKCal_1_1Incidence.html#5f6e41afa4e1b167c4b49e603506b34c" title="Return short summary.">summary</a>()
<a name="l00346"></a>00346                     &lt;&lt; <span class="stringliteral">"': "</span> &lt;&lt; qdt.toString() &lt;&lt; endl;
<a name="l00347"></a>00347       alarms.append( alarm );
<a name="l00348"></a>00348     }
<a name="l00349"></a>00349   }
<a name="l00350"></a>00350 }
<a name="l00351"></a>00351 
<a name="l00352"></a>00352 
<a name="l00353"></a><a class="code" href="classKCal_1_1CalendarLocal.html#bec53fa13090e89bbb92e25d6971ff12">00353</a> <span class="keywordtype">void</span> <a class="code" href="classKCal_1_1CalendarLocal.html#bec53fa13090e89bbb92e25d6971ff12" title="Notification function of IncidenceBase::Observer.">CalendarLocal::incidenceUpdated</a>( <a class="code" href="classKCal_1_1IncidenceBase.html" title="This class provides the base class common to all calendar components.">IncidenceBase</a> *<a class="code" href="classKCal_1_1Calendar.html#d271d711219da854049efa30723188c4" title="Returns the Incidence associated with the given unique identifier.">incidence</a> )
<a name="l00354"></a>00354 {
<a name="l00355"></a>00355   incidence-&gt;<a class="code" href="classKCal_1_1IncidenceBase.html#d590212dba5d938eab3b5536f7786034">setSyncStatusSilent</a>( Event::SYNCMOD );
<a name="l00356"></a>00356   incidence-&gt;<a class="code" href="classKCal_1_1IncidenceBase.html#a040b96c3565ddf597b795f69dea28dc" title="Sets the time the incidence was last modified.">setLastModified</a>( QDateTime::currentDateTime() );
<a name="l00357"></a>00357   <span class="comment">// we should probably update the revision number here,</span>
<a name="l00358"></a>00358   <span class="comment">// or internally in the Event itself when certain things change.</span>
<a name="l00359"></a>00359   <span class="comment">// need to verify with ical documentation.</span>
<a name="l00360"></a>00360 
<a name="l00361"></a>00361   <span class="comment">// The static_cast is ok as the CalendarLocal only observes Incidence objects</span>
<a name="l00362"></a>00362   <a class="code" href="classKCal_1_1Calendar.html#5a90d904a5fa1a4bbd29b10183e20def" title="Let Calendar subclasses notify that they modified an Incidence.">notifyIncidenceChanged</a>( static_cast&lt;Incidence *&gt;( incidence ) );
<a name="l00363"></a>00363 
<a name="l00364"></a>00364   <a class="code" href="classKCal_1_1Calendar.html#6acbb24e958823e79ddf2831c0f50a50" title="Set if the Calendar had been modified.">setModified</a>( <span class="keyword">true</span> );
<a name="l00365"></a>00365 }
<a name="l00366"></a>00366 
<a name="l00367"></a><a class="code" href="classKCal_1_1CalendarLocal.html#a7de8318247afbb24317674c891aaa79">00367</a> <span class="keywordtype">void</span> <a class="code" href="classKCal_1_1CalendarLocal.html#a7de8318247afbb24317674c891aaa79" title="inserts an event into its &amp;quot;proper place&amp;quot; in the calendar.">CalendarLocal::insertEvent</a>( <a class="code" href="classKCal_1_1Event.html" title="This class provides an Event in the sense of RFC2445.">Event</a> *<a class="code" href="classKCal_1_1CalendarLocal.html#110d9ec156050c1fd39c5a622d2f8cc1" title="Retrieves an event on the basis of the unique string ID.">event</a> )
<a name="l00368"></a>00368 {
<a name="l00369"></a>00369   QString uid = <span class="keyword">event</span>-&gt;uid();
<a name="l00370"></a>00370   <span class="keywordflow">if</span> ( mEvents[ uid ] == 0 ) {
<a name="l00371"></a>00371     mEvents.insert( uid, event );
<a name="l00372"></a>00372   }
<a name="l00373"></a>00373 <span class="preprocessor">#ifndef NDEBUG</span>
<a name="l00374"></a>00374 <span class="preprocessor"></span>  <span class="keywordflow">else</span> <span class="comment">// if we already have an event with this UID, it has to be the same event,</span>
<a name="l00375"></a>00375       <span class="comment">// otherwise something's really broken</span>
<a name="l00376"></a>00376       Q_ASSERT( mEvents[uid] == event );
<a name="l00377"></a>00377 <span class="preprocessor">#endif</span>
<a name="l00378"></a>00378 <span class="preprocessor"></span>}
<a name="l00379"></a>00379 
<a name="l00380"></a><a class="code" href="classKCal_1_1CalendarLocal.html#faebffeafa64f27ddb34a016213c4473">00380</a> Event::List <a class="code" href="classKCal_1_1CalendarLocal.html#faebffeafa64f27ddb34a016213c4473" title="Builds and then returns a list of all events that match for the date specified.">CalendarLocal::rawEventsForDate</a>( <span class="keyword">const</span> QDate &amp;qd,
<a name="l00381"></a>00381                                              <a class="code" href="namespaceKCal.html#4adb61b1b3687a67349254a53c7a2f21" title="How Events are to be sorted.">EventSortField</a> sortField,
<a name="l00382"></a>00382                                              <a class="code" href="namespaceKCal.html#b79dc8179fdc021ae82c321b08fb6765" title="Sort direction.">SortDirection</a> sortDirection )
<a name="l00383"></a>00383 {
<a name="l00384"></a>00384   Event::List eventList;
<a name="l00385"></a>00385 
<a name="l00386"></a>00386   EventDictIterator it( mEvents );
<a name="l00387"></a>00387   <span class="keywordflow">for</span>( ; it.current(); ++it ) {
<a name="l00388"></a>00388     <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> = *it;
<a name="l00389"></a>00389 
<a name="l00390"></a>00390     <span class="keywordflow">if</span> ( <a class="code" href="classKCal_1_1CalendarLocal.html#110d9ec156050c1fd39c5a622d2f8cc1" title="Retrieves an event on the basis of the unique string ID.">event</a>-&gt;<a class="code" href="classKCal_1_1Incidence.html#81ad15662138be07f0d55be6b075b043" title="Forward to Recurrence::doesRecur().">doesRecur</a>() ) {
<a name="l00391"></a>00391       <span class="keywordflow">if</span> ( <a class="code" href="classKCal_1_1CalendarLocal.html#110d9ec156050c1fd39c5a622d2f8cc1" title="Retrieves an event on the basis of the unique string ID.">event</a>-&gt;<a class="code" href="classKCal_1_1Event.html#579d969ee1963d287f5662554a5aaa4b" title="Return true if the event spans multiple days, otherwise return false.">isMultiDay</a>() ) {
<a name="l00392"></a>00392         <span class="keywordtype">int</span> extraDays = <span class="keyword">event</span>-&gt;dtStart().date().daysTo( <a class="code" href="classKCal_1_1CalendarLocal.html#110d9ec156050c1fd39c5a622d2f8cc1" title="Retrieves an event on the basis of the unique string ID.">event</a>-&gt;<a class="code" href="classKCal_1_1Event.html#0bc3052d40d160c7d58a5483dfcff693" title="Return end date and time.">dtEnd</a>().date() );
<a name="l00393"></a>00393         <span class="keywordtype">int</span> i;
<a name="l00394"></a>00394         <span class="keywordflow">for</span> ( i = 0; i &lt;= extraDays; i++ ) {
<a name="l00395"></a>00395           <span class="keywordflow">if</span> ( <a class="code" href="classKCal_1_1CalendarLocal.html#110d9ec156050c1fd39c5a622d2f8cc1" title="Retrieves an event on the basis of the unique string ID.">event</a>-&gt;<a class="code" href="classKCal_1_1Incidence.html#105f15b8e9d48e2778cce396511e7a68" title="Returns true if the date specified is one on which the incidence will recur.">recursOn</a>( qd.addDays( -i ) ) ) {
<a name="l00396"></a>00396             eventList.append( <a class="code" href="classKCal_1_1CalendarLocal.html#110d9ec156050c1fd39c5a622d2f8cc1" title="Retrieves an event on the basis of the unique string ID.">event</a> );
<a name="l00397"></a>00397             <span class="keywordflow">break</span>;
<a name="l00398"></a>00398           }
<a name="l00399"></a>00399         }
<a name="l00400"></a>00400       } <span class="keywordflow">else</span> {
<a name="l00401"></a>00401         <span class="keywordflow">if</span> ( <a class="code" href="classKCal_1_1CalendarLocal.html#110d9ec156050c1fd39c5a622d2f8cc1" title="Retrieves an event on the basis of the unique string ID.">event</a>-&gt;<a class="code" href="classKCal_1_1Incidence.html#105f15b8e9d48e2778cce396511e7a68" title="Returns true if the date specified is one on which the incidence will recur.">recursOn</a>( qd ) )
<a name="l00402"></a>00402           eventList.append( <a class="code" href="classKCal_1_1CalendarLocal.html#110d9ec156050c1fd39c5a622d2f8cc1" title="Retrieves an event on the basis of the unique string ID.">event</a> );
<a name="l00403"></a>00403       }
<a name="l00404"></a>00404     } <span class="keywordflow">else</span> {
<a name="l00405"></a>00405       <span class="keywordflow">if</span> ( <a class="code" href="classKCal_1_1CalendarLocal.html#110d9ec156050c1fd39c5a622d2f8cc1" title="Retrieves an event on the basis of the unique string ID.">event</a>-&gt;<a class="code" href="classKCal_1_1IncidenceBase.html#5419a946a4e5715a0c34ec2c7e04cd9b" title="returns an event&amp;#39;s starting date/time as a QDateTime.">dtStart</a>().date() &lt;= qd &amp;&amp; <span class="keyword">event</span>-&gt;dateEnd() &gt;= qd ) {
<a name="l00406"></a>00406         eventList.append( <a class="code" href="classKCal_1_1CalendarLocal.html#110d9ec156050c1fd39c5a622d2f8cc1" title="Retrieves an event on the basis of the unique string ID.">event</a> );
<a name="l00407"></a>00407       }
<a name="l00408"></a>00408     }
<a name="l00409"></a>00409   }
<a name="l00410"></a>00410 
<a name="l00411"></a>00411   <span class="keywordflow">return</span> <a class="code" href="classKCal_1_1Calendar.html#4d8122d0bcfc5d887e45d1f87338f2db" title="Sort a list of Events.">sortEvents</a>( &amp;eventList, sortField, sortDirection );
<a name="l00412"></a>00412 }
<a name="l00413"></a>00413 
<a name="l00414"></a><a class="code" href="classKCal_1_1CalendarLocal.html#b6e8785a08da7fedeafd404b1b1cca79">00414</a> Event::List <a class="code" href="classKCal_1_1CalendarLocal.html#405e9a43400c5aca3bac5d00a3638244" title="Return unfiltered list of all events in calendar.">CalendarLocal::rawEvents</a>( <span class="keyword">const</span> QDate &amp;start, <span class="keyword">const</span> QDate &amp;end,
<a name="l00415"></a>00415                                           <span class="keywordtype">bool</span> inclusive )
<a name="l00416"></a>00416 {
<a name="l00417"></a>00417   Event::List eventList;
<a name="l00418"></a>00418   QDate yesterStart = start.addDays(-1);
<a name="l00419"></a>00419 
<a name="l00420"></a>00420   <span class="comment">// Get non-recurring events</span>
<a name="l00421"></a>00421   EventDictIterator it( mEvents );
<a name="l00422"></a>00422   <span class="keywordflow">for</span>( ; it.current(); ++it ) {
<a name="l00423"></a>00423     <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> = *it;
<a name="l00424"></a>00424 
<a name="l00425"></a>00425     QDate rStart = <span class="keyword">event</span>-&gt;dtStart().date();
<a name="l00426"></a>00426     <span class="keywordflow">if</span> (end &lt; rStart) {
<a name="l00427"></a>00427 <span class="comment">//      kdDebug(5800) &lt;&lt; "Skipping event starting after TOI" &lt;&lt; endl;</span>
<a name="l00428"></a>00428       <span class="keywordflow">continue</span>;
<a name="l00429"></a>00429     }
<a name="l00430"></a>00430     <span class="keywordflow">if</span> ( inclusive &amp;&amp; rStart &lt; start) {
<a name="l00431"></a>00431 <span class="comment">//      kdDebug(5800) &lt;&lt; "Skipping event starting before TOI while inclusive" &lt;&lt; endl;</span>
<a name="l00432"></a>00432       <span class="keywordflow">continue</span>;
<a name="l00433"></a>00433     }
<a name="l00434"></a>00434 
<a name="l00435"></a>00435     <span class="keywordflow">if</span> ( ! <a class="code" href="classKCal_1_1CalendarLocal.html#110d9ec156050c1fd39c5a622d2f8cc1" title="Retrieves an event on the basis of the unique string ID.">event</a>-&gt;<a class="code" href="classKCal_1_1Incidence.html#81ad15662138be07f0d55be6b075b043" title="Forward to Recurrence::doesRecur().">doesRecur</a>() ) { <span class="comment">// non-recurring events</span>
<a name="l00436"></a>00436       QDate rEnd = <span class="keyword">event</span>-&gt;dtEnd().date();
<a name="l00437"></a>00437       <span class="keywordflow">if</span> (rEnd &lt; start) {
<a name="l00438"></a>00438 <span class="comment">//        kdDebug(5800) &lt;&lt; "Skipping event ending before TOI" &lt;&lt; endl;</span>
<a name="l00439"></a>00439         <span class="keywordflow">continue</span>;
<a name="l00440"></a>00440       }
<a name="l00441"></a>00441       <span class="keywordflow">if</span> ( inclusive &amp;&amp; end &lt; rEnd ) {
<a name="l00442"></a>00442 <span class="comment">//        kdDebug(5800) &lt;&lt; "Skipping event ending after TOI while inclusive" &lt;&lt; endl;</span>
<a name="l00443"></a>00443         <span class="keywordflow">continue</span>;
<a name="l00444"></a>00444       }
<a name="l00445"></a>00445     } <span class="keywordflow">else</span> { <span class="comment">// recurring events</span>
<a name="l00446"></a>00446       <span class="keywordflow">switch</span> ( <a class="code" href="classKCal_1_1CalendarLocal.html#110d9ec156050c1fd39c5a622d2f8cc1" title="Retrieves an event on the basis of the unique string ID.">event</a>-&gt;<a class="code" href="classKCal_1_1Incidence.html#d06004593e064a37d08c96f9ae16735e" title="Return the recurrence rule associated with this incidence.">recurrence</a>()-&gt;<a class="code" href="classKCal_1_1Recurrence.html#54913d2f0a66bae406a7b11945919a00" title="Returns -1 if the event recurs infinitely, 0 if the end date is set, otherwise the...">duration</a>() ) {
<a name="l00447"></a>00447         <span class="keywordflow">case</span> -1: <span class="comment">// infinite</span>
<a name="l00448"></a>00448           <span class="keywordflow">if</span> ( inclusive ) {
<a name="l00449"></a>00449 <span class="comment">//            kdDebug(5800) &lt;&lt; "Skipping infinite event because inclusive" &lt;&lt; endl;</span>
<a name="l00450"></a>00450             <span class="keywordflow">continue</span>;
<a name="l00451"></a>00451           }
<a name="l00452"></a>00452           <span class="keywordflow">break</span>;
<a name="l00453"></a>00453         <span class="keywordflow">case</span> 0: <span class="comment">// end date given</span>
<a name="l00454"></a>00454         <span class="keywordflow">default</span>: <span class="comment">// count given</span>
<a name="l00455"></a>00455           QDate rEnd = <span class="keyword">event</span>-&gt;recurrence()-&gt;endDate();
<a name="l00456"></a>00456           <span class="keywordflow">if</span> ( ! rEnd.isValid() ) {
<a name="l00457"></a>00457 <span class="comment">//            kdDebug(5800) &lt;&lt; "Skipping recurring event without occurences" &lt;&lt; endl;</span>
<a name="l00458"></a>00458             <span class="keywordflow">continue</span>;
<a name="l00459"></a>00459           }
<a name="l00460"></a>00460           <span class="keywordflow">if</span> ( rEnd &lt; start ) {
<a name="l00461"></a>00461 <span class="comment">//            kdDebug(5800) &lt;&lt; "Skipping recurring event ending before TOI" &lt;&lt; endl;</span>
<a name="l00462"></a>00462             <span class="keywordflow">continue</span>;
<a name="l00463"></a>00463           }
<a name="l00464"></a>00464           <span class="keywordflow">if</span> ( inclusive &amp;&amp; end &lt; rEnd ) {
<a name="l00465"></a>00465 <span class="comment">//            kdDebug(5800) &lt;&lt; "Skipping recurring event ending after TOI while inclusive" &lt;&lt; endl;</span>
<a name="l00466"></a>00466             <span class="keywordflow">continue</span>;
<a name="l00467"></a>00467           }
<a name="l00468"></a>00468           <span class="comment">/* FIXME: too much conversion between QDate and QDateTime makes this useless:</span>
<a name="l00469"></a>00469 <span class="comment">           *   freebusy(end=QDateTime(day, "00:00:00")) -&gt;</span>
<a name="l00470"></a>00470 <span class="comment">           *   rawEvents(end=QDate(day)) -&gt;</span>
<a name="l00471"></a>00471 <span class="comment">           *   durationTo(QDateTime(day, "23:59:59"))</span>
<a name="l00472"></a>00472 <span class="comment">           * so events repeating at the end day match and are included.</span>
<a name="l00473"></a>00473 <span class="comment">           */</span>
<a name="l00474"></a>00474 <span class="preprocessor">#if 0</span>
<a name="l00475"></a>00475 <span class="preprocessor"></span>          <span class="keywordtype">int</span> durationBeforeStart = <span class="keyword">event</span>-&gt;recurrence()-&gt;durationTo(yesterStart);
<a name="l00476"></a>00476           <span class="keywordtype">int</span> durationUntilEnd = <span class="keyword">event</span>-&gt;recurrence()-&gt;durationTo(end);
<a name="l00477"></a>00477           <span class="keywordflow">if</span> (durationBeforeStart == durationUntilEnd) {
<a name="l00478"></a>00478             kdDebug(5800) &lt;&lt; <span class="stringliteral">"Skipping recurring event without occurences in TOI"</span> &lt;&lt; endl;
<a name="l00479"></a>00479             <span class="keywordflow">continue</span>;
<a name="l00480"></a>00480           }
<a name="l00481"></a>00481 <span class="preprocessor">#endif</span>
<a name="l00482"></a>00482 <span class="preprocessor"></span>          <span class="keywordflow">break</span>;
<a name="l00483"></a>00483       } <span class="comment">// switch(duration)</span>
<a name="l00484"></a>00484     } <span class="comment">// if(doesRecur)</span>
<a name="l00485"></a>00485 
<a name="l00486"></a>00486     eventList.append( <a class="code" href="classKCal_1_1CalendarLocal.html#110d9ec156050c1fd39c5a622d2f8cc1" title="Retrieves an event on the basis of the unique string ID.">event</a> );
<a name="l00487"></a>00487   }
<a name="l00488"></a>00488 
<a name="l00489"></a>00489   <span class="keywordflow">return</span> eventList;
<a name="l00490"></a>00490 }
<a name="l00491"></a>00491 
<a name="l00492"></a><a class="code" href="classKCal_1_1CalendarLocal.html#36277171bcba0aee5a21128a6b369100">00492</a> Event::List <a class="code" href="classKCal_1_1CalendarLocal.html#faebffeafa64f27ddb34a016213c4473" title="Builds and then returns a list of all events that match for the date specified.">CalendarLocal::rawEventsForDate</a>( <span class="keyword">const</span> QDateTime &amp;qdt )
<a name="l00493"></a>00493 {
<a name="l00494"></a>00494   <span class="keywordflow">return</span> <a class="code" href="classKCal_1_1CalendarLocal.html#faebffeafa64f27ddb34a016213c4473" title="Builds and then returns a list of all events that match for the date specified.">rawEventsForDate</a>( qdt.date() );
<a name="l00495"></a>00495 }
<a name="l00496"></a>00496 
<a name="l00497"></a><a class="code" href="classKCal_1_1CalendarLocal.html#405e9a43400c5aca3bac5d00a3638244">00497</a> Event::List <a class="code" href="classKCal_1_1CalendarLocal.html#405e9a43400c5aca3bac5d00a3638244" title="Return unfiltered list of all events in calendar.">CalendarLocal::rawEvents</a>( <a class="code" href="namespaceKCal.html#4adb61b1b3687a67349254a53c7a2f21" title="How Events are to be sorted.">EventSortField</a> sortField, <a class="code" href="namespaceKCal.html#b79dc8179fdc021ae82c321b08fb6765" title="Sort direction.">SortDirection</a> sortDirection )
<a name="l00498"></a>00498 {
<a name="l00499"></a>00499   Event::List eventList;
<a name="l00500"></a>00500   EventDictIterator it( mEvents );
<a name="l00501"></a>00501   <span class="keywordflow">for</span>( ; it.current(); ++it )
<a name="l00502"></a>00502     eventList.append( *it );
<a name="l00503"></a>00503   <span class="keywordflow">return</span> <a class="code" href="classKCal_1_1Calendar.html#4d8122d0bcfc5d887e45d1f87338f2db" title="Sort a list of Events.">sortEvents</a>( &amp;eventList, sortField, sortDirection );
<a name="l00504"></a>00504 }
<a name="l00505"></a>00505 
<a name="l00506"></a><a class="code" href="classKCal_1_1CalendarLocal.html#971cf2ff3f084317ad6ed81d85e42aa5">00506</a> <span class="keywordtype">bool</span> <a class="code" href="classKCal_1_1CalendarLocal.html#971cf2ff3f084317ad6ed81d85e42aa5" title="Add a Journal entry to calendar.">CalendarLocal::addJournal</a>(<a class="code" href="classKCal_1_1Journal.html" title="This class provides a Journal in the sense of RFC2445.">Journal</a> *<a class="code" href="classKCal_1_1CalendarLocal.html#cda1ac06064f0ca4aef676cd57671049" title="Return Journal with given UID.">journal</a>)
<a name="l00507"></a>00507 {
<a name="l00508"></a>00508 <span class="comment">//   if (journal-&gt;dtStart().isValid())</span>
<a name="l00509"></a>00509 <span class="comment">//     kdDebug(5800) &lt;&lt; "Adding Journal on " &lt;&lt; journal-&gt;dtStart().toString() &lt;&lt; endl;</span>
<a name="l00510"></a>00510 <span class="comment">//   else</span>
<a name="l00511"></a>00511 <span class="comment">//     kdDebug(5800) &lt;&lt; "Adding Journal without a DTSTART" &lt;&lt; endl;</span>
<a name="l00512"></a>00512 
<a name="l00513"></a>00513   mJournalList.append(journal);
<a name="l00514"></a>00514 
<a name="l00515"></a>00515   journal-&gt;<a class="code" href="classKCal_1_1IncidenceBase.html#490816ccda2c6637b0f12235ba0b5869" title="Register observer.">registerObserver</a>( <span class="keyword">this</span> );
<a name="l00516"></a>00516 
<a name="l00517"></a>00517   <a class="code" href="classKCal_1_1Calendar.html#6acbb24e958823e79ddf2831c0f50a50" title="Set if the Calendar had been modified.">setModified</a>( <span class="keyword">true</span> );
<a name="l00518"></a>00518 
<a name="l00519"></a>00519   <a class="code" href="classKCal_1_1Calendar.html#b320f93d0f4b93ae1cedb76d2e27bf7d" title="Let Calendar subclasses notify that they inserted an Incidence.">notifyIncidenceAdded</a>( journal );
<a name="l00520"></a>00520 
<a name="l00521"></a>00521   <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00522"></a>00522 }
<a name="l00523"></a>00523 
<a name="l00524"></a><a class="code" href="classKCal_1_1CalendarLocal.html#45817dcaf523415af54f91b58a56e4b5">00524</a> <span class="keywordtype">bool</span> <a class="code" href="classKCal_1_1CalendarLocal.html#45817dcaf523415af54f91b58a56e4b5" title="Remove a Journal from the calendar.">CalendarLocal::deleteJournal</a>( <a class="code" href="classKCal_1_1Journal.html" title="This class provides a Journal in the sense of RFC2445.">Journal</a> *<a class="code" href="classKCal_1_1CalendarLocal.html#cda1ac06064f0ca4aef676cd57671049" title="Return Journal with given UID.">journal</a> )
<a name="l00525"></a>00525 {
<a name="l00526"></a>00526   <span class="keywordflow">if</span> ( mJournalList.removeRef( journal ) ) {
<a name="l00527"></a>00527     <a class="code" href="classKCal_1_1Calendar.html#6acbb24e958823e79ddf2831c0f50a50" title="Set if the Calendar had been modified.">setModified</a>( <span class="keyword">true</span> );
<a name="l00528"></a>00528     <a class="code" href="classKCal_1_1Calendar.html#41d4be475453592dcebb7c2504f800c6" title="Let Calendar subclasses notify that they removed an Incidence.">notifyIncidenceDeleted</a>( journal );
<a name="l00529"></a>00529     mDeletedIncidences.append( journal );
<a name="l00530"></a>00530     <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00531"></a>00531   } <span class="keywordflow">else</span> {
<a name="l00532"></a>00532     kdWarning() &lt;&lt; <span class="stringliteral">"CalendarLocal::deleteJournal(): Journal not found."</span> &lt;&lt; endl;
<a name="l00533"></a>00533     <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00534"></a>00534   }
<a name="l00535"></a>00535 }
<a name="l00536"></a>00536 
<a name="l00537"></a><a class="code" href="classKCal_1_1CalendarLocal.html#58a2a5a909afb8baede313092a954b29">00537</a> <span class="keywordtype">void</span> <a class="code" href="classKCal_1_1CalendarLocal.html#58a2a5a909afb8baede313092a954b29" title="Deletes all journals from this calendar.">CalendarLocal::deleteAllJournals</a>()
<a name="l00538"></a>00538 {
<a name="l00539"></a>00539   Journal::List::ConstIterator it;
<a name="l00540"></a>00540   <span class="keywordflow">for</span>( it = mJournalList.begin(); it != mJournalList.end(); ++it ) {
<a name="l00541"></a>00541     <a class="code" href="classKCal_1_1Calendar.html#41d4be475453592dcebb7c2504f800c6" title="Let Calendar subclasses notify that they removed an Incidence.">notifyIncidenceDeleted</a>( *it );
<a name="l00542"></a>00542   }
<a name="l00543"></a>00543 
<a name="l00544"></a>00544   mJournalList.setAutoDelete( <span class="keyword">true</span> );
<a name="l00545"></a>00545   mJournalList.clear();
<a name="l00546"></a>00546   mJournalList.setAutoDelete( <span class="keyword">false</span> );
<a name="l00547"></a>00547 }
<a name="l00548"></a>00548 
<a name="l00549"></a><a class="code" href="classKCal_1_1CalendarLocal.html#cda1ac06064f0ca4aef676cd57671049">00549</a> <a class="code" href="classKCal_1_1Journal.html" title="This class provides a Journal in the sense of RFC2445.">Journal</a> *<a class="code" href="classKCal_1_1CalendarLocal.html#cda1ac06064f0ca4aef676cd57671049" title="Return Journal with given UID.">CalendarLocal::journal</a>( <span class="keyword">const</span> QString &amp;uid )
<a name="l00550"></a>00550 {
<a name="l00551"></a>00551   Journal::List::ConstIterator it;
<a name="l00552"></a>00552   <span class="keywordflow">for</span> ( it = mJournalList.begin(); it != mJournalList.end(); ++it )
<a name="l00553"></a>00553     <span class="keywordflow">if</span> ( (*it)-&gt;uid() == uid )
<a name="l00554"></a>00554       <span class="keywordflow">return</span> *it;
<a name="l00555"></a>00555 
<a name="l00556"></a>00556   <span class="keywordflow">return</span> 0;
<a name="l00557"></a>00557 }
<a name="l00558"></a>00558 
<a name="l00559"></a><a class="code" href="classKCal_1_1CalendarLocal.html#b8e4d015c64f30b7230ad562640b0647">00559</a> Journal::List <a class="code" href="classKCal_1_1CalendarLocal.html#b8e4d015c64f30b7230ad562640b0647" title="Return list of all journals.">CalendarLocal::rawJournals</a>( <a class="code" href="namespaceKCal.html#12e348070fafa27c28e3291db357317f" title="How Journals are to be sorted.">JournalSortField</a> sortField, <a class="code" href="namespaceKCal.html#b79dc8179fdc021ae82c321b08fb6765" title="Sort direction.">SortDirection</a> sortDirection )
<a name="l00560"></a>00560 {
<a name="l00561"></a>00561   <span class="keywordflow">return</span> <a class="code" href="classKCal_1_1Calendar.html#f24bc42d73c155856f99e8cb3a03bc1b" title="Sort a list of Journals.">sortJournals</a>( &amp;mJournalList, sortField, sortDirection );
<a name="l00562"></a>00562 }
<a name="l00563"></a>00563 
<a name="l00564"></a><a class="code" href="classKCal_1_1CalendarLocal.html#1c4dd7db068882d624509c34de49b18e">00564</a> Journal::List <a class="code" href="classKCal_1_1CalendarLocal.html#1c4dd7db068882d624509c34de49b18e" title="Get unfiltered journals for a given date.">CalendarLocal::rawJournalsForDate</a>( <span class="keyword">const</span> QDate &amp;date )
<a name="l00565"></a>00565 {
<a name="l00566"></a>00566   Journal::List <a class="code" href="classKCal_1_1Calendar.html#c6b55e4bc2dcc1557b63ffd9273bd6bc" title="Return a sorted, filtered list of all Journals for this Calendar.">journals</a>;
<a name="l00567"></a>00567 
<a name="l00568"></a>00568   Journal::List::ConstIterator it;
<a name="l00569"></a>00569   <span class="keywordflow">for</span> ( it = mJournalList.begin(); it != mJournalList.end(); ++it ) {
<a name="l00570"></a>00570     <a class="code" href="classKCal_1_1Journal.html" title="This class provides a Journal in the sense of RFC2445.">Journal</a> *<a class="code" href="classKCal_1_1CalendarLocal.html#cda1ac06064f0ca4aef676cd57671049" title="Return Journal with given UID.">journal</a> = *it;
<a name="l00571"></a>00571     <span class="keywordflow">if</span> ( journal-&gt;<a class="code" href="classKCal_1_1IncidenceBase.html#5419a946a4e5715a0c34ec2c7e04cd9b" title="returns an event&amp;#39;s starting date/time as a QDateTime.">dtStart</a>().date() == date ) {
<a name="l00572"></a>00572       journals.append( journal );
<a name="l00573"></a>00573     }
<a name="l00574"></a>00574   }
<a name="l00575"></a>00575 
<a name="l00576"></a>00576   <span class="keywordflow">return</span> journals;
<a name="l00577"></a>00577 }
<a name="l00578"></a>00578 
<a name="l00579"></a><a class="code" href="classKCal_1_1CalendarLocal.html#78e985d19c0e550f7fa2c5ec86457e8a">00579</a> <span class="keywordtype">void</span> <a class="code" href="classKCal_1_1CalendarLocal.html#78e985d19c0e550f7fa2c5ec86457e8a" title="Set the timezone of the calendar to be used for interpreting the events in the calendar...">CalendarLocal::setTimeZoneIdViewOnly</a>( <span class="keyword">const</span> QString&amp; tz )
<a name="l00580"></a>00580 {
<a name="l00581"></a>00581   <span class="keyword">const</span> QString question( i18n(<span class="stringliteral">"The timezone setting was changed. In order to display the calendar "</span>
<a name="l00582"></a>00582       <span class="stringliteral">"you are looking at in the new timezone, it needs to be saved. Do you want to save the pending "</span>
<a name="l00583"></a>00583       <span class="stringliteral">"changes or rather wait and apply the new timezone on the next reload?"</span> ) );
<a name="l00584"></a>00584   <span class="keywordtype">int</span> rc = KMessageBox::Yes;
<a name="l00585"></a>00585   <span class="keywordflow">if</span> ( <a class="code" href="classKCal_1_1Calendar.html#da78fe4ce3d2d729f3296db2a9290116" title="Determine the Calendar&amp;#39;s modification status.">isModified</a>() ) {
<a name="l00586"></a>00586     rc = KMessageBox::questionYesNo( 0, question,
<a name="l00587"></a>00587                                        i18n(<span class="stringliteral">"Save before applying timezones?"</span>),
<a name="l00588"></a>00588                                        KStdGuiItem::save(),
<a name="l00589"></a>00589                                        KGuiItem(i18n(<span class="stringliteral">"Apply Timezone Change on Next Reload"</span>)),
<a name="l00590"></a>00590                                        <span class="stringliteral">"calendarLocalSaveBeforeTimezoneShift"</span>);
<a name="l00591"></a>00591   }
<a name="l00592"></a>00592   <span class="keywordflow">if</span> ( rc == KMessageBox::Yes ) {
<a name="l00593"></a>00593     <a class="code" href="classKCal_1_1CalendarLocal.html#0705e55330b8f3ec85fba32d99c21b86" title="Reloads the contents of the storage into memory.">reload</a>( tz );
<a name="l00594"></a>00594   }
<a name="l00595"></a>00595 }
</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>&nbsp;&nbsp;<a href="../../akregator/src/html/index.html">src</a></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<a href="../../akregator/src/librss/html/index.html">librss</a></li><li><a href="../../certmanager/html/index.html">certmanager</a></li><li>&nbsp;&nbsp;<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>&nbsp;&nbsp;<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>&nbsp;&nbsp;<a href="../../kioslaves/imap4/html/index.html">imap4</a></li><li>&nbsp;&nbsp;<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>&nbsp;&nbsp;<a href="../../kpilot/kpilot/html/index.html">kpilot</a></li><li>&nbsp;&nbsp;<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="&#109;&#97;&#105;&#108;&#116;&#111;&#58;groo&#116;&#64;kde&#46;or&#x67;">Adriaan de Groot</a>
and
<a href="&#109;a&#105;&#108;&#116;&#111;&#58;w&#105;nter&#64;kde&#46;or&#x67">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>