|
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
|
2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> |
|
3 <title>TB10.1 Example Applications: examples/AppEngine/CalInterimApi/CalExample.cpp Source File</title> |
|
4 <link href="doxygen.css" rel="stylesheet" type="text/css"> |
|
5 <link href="tabs.css" rel="stylesheet" type="text/css"> |
|
6 </head><body> |
|
7 <!-- Generated by Doxygen 1.5.3 --> |
|
8 <h1>examples/AppEngine/CalInterimApi/CalExample.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).</span> |
|
9 <a name="l00002"></a>00002 <span class="comment">// All rights reserved.</span> |
|
10 <a name="l00003"></a>00003 <span class="comment">// This component and the accompanying materials are made available</span> |
|
11 <a name="l00004"></a>00004 <span class="comment">// under the terms of "Eclipse Public License v1.0"</span> |
|
12 <a name="l00005"></a>00005 <span class="comment">// which accompanies this distribution, and is available</span> |
|
13 <a name="l00006"></a>00006 <span class="comment">// at the URL "http://www.eclipse.org/legal/epl-v10.html".</span> |
|
14 <a name="l00007"></a>00007 <span class="comment">//</span> |
|
15 <a name="l00008"></a>00008 <span class="comment">// Initial Contributors:</span> |
|
16 <a name="l00009"></a>00009 <span class="comment">// Nokia Corporation - initial contribution.</span> |
|
17 <a name="l00010"></a>00010 <span class="comment">//</span> |
|
18 <a name="l00011"></a>00011 <span class="comment">// Contributors:</span> |
|
19 <a name="l00012"></a>00012 <span class="comment">//</span> |
|
20 <a name="l00013"></a>00013 <span class="comment">// Description:</span> |
|
21 <a name="l00014"></a>00014 <span class="comment">//</span> |
|
22 <a name="l00015"></a>00015 |
|
23 <a name="l00016"></a>00016 <span class="preprocessor">#include "CalExample.h"</span> |
|
24 <a name="l00017"></a>00017 |
|
25 <a name="l00018"></a>00018 <span class="preprocessor">#include <calinstance.h></span> |
|
26 <a name="l00019"></a>00019 |
|
27 <a name="l00020"></a>00020 CCalExample::CCalExample() |
|
28 <a name="l00021"></a>00021 { |
|
29 <a name="l00022"></a>00022 } |
|
30 <a name="l00023"></a>00023 |
|
31 <a name="l00024"></a><a class="code" href="class_c_cal_example.html#9f6aac09024aec8f53080d949937afbe">00024</a> <a class="code" href="class_c_cal_example.html#9f6aac09024aec8f53080d949937afbe">CCalExample::~CCalExample</a>() |
|
32 <a name="l00025"></a>00025 { |
|
33 <a name="l00026"></a>00026 _LIT(KExitMsg,<span class="stringliteral">"\n\nPress any key to exit the application "</span>); |
|
34 <a name="l00027"></a>00027 iConsole->Printf(KExitMsg); |
|
35 <a name="l00028"></a>00028 iConsole->Getch(); |
|
36 <a name="l00029"></a>00029 |
|
37 <a name="l00030"></a>00030 <span class="keyword">delete</span> iCalEntryView; |
|
38 <a name="l00031"></a>00031 <span class="keyword">delete</span> iCalSession; |
|
39 <a name="l00032"></a>00032 <span class="keyword">delete</span> iConsole; |
|
40 <a name="l00033"></a>00033 } |
|
41 <a name="l00034"></a>00034 |
|
42 <a name="l00035"></a><a class="code" href="class_c_cal_example.html#db58fbf73337500d5bc8162ad2229336">00035</a> <a class="code" href="class_c_cal_example.html">CCalExample</a>* <a class="code" href="class_c_cal_example.html#db58fbf73337500d5bc8162ad2229336">CCalExample::NewL</a>() |
|
43 <a name="l00036"></a>00036 { |
|
44 <a name="l00037"></a>00037 <a class="code" href="class_c_cal_example.html">CCalExample</a>* <span class="keyword">self</span>= <span class="keyword">new</span> (ELeave) <a class="code" href="class_c_cal_example.html">CCalExample</a>(); |
|
45 <a name="l00038"></a>00038 CleanupStack::PushL(<span class="keyword">self</span>); |
|
46 <a name="l00039"></a>00039 <span class="keyword">self</span>->ConstructL(); |
|
47 <a name="l00040"></a>00040 CleanupStack::Pop(); |
|
48 <a name="l00041"></a>00041 <span class="keywordflow">return</span> <span class="keyword">self</span>; |
|
49 <a name="l00042"></a>00042 } |
|
50 <a name="l00043"></a>00043 |
|
51 <a name="l00044"></a>00044 <span class="keywordtype">void</span> CCalExample::ConstructL() |
|
52 <a name="l00045"></a>00045 { |
|
53 <a name="l00046"></a>00046 _LIT(KTitle, <span class="stringliteral">"calexample"</span> ); |
|
54 <a name="l00047"></a>00047 iConsole = Console::NewL(KTitle,TSize(KConsFullScreen,KConsFullScreen)); |
|
55 <a name="l00048"></a>00048 |
|
56 <a name="l00049"></a>00049 _LIT(KPressAKeyMsg, <span class="stringliteral">"\n\nPress any key to step through the example"</span>); |
|
57 <a name="l00050"></a>00050 iConsole->Printf ( KPressAKeyMsg ); |
|
58 <a name="l00051"></a>00051 iConsole->Getch (); |
|
59 <a name="l00052"></a>00052 |
|
60 <a name="l00053"></a>00053 iCalSession = CCalSession::NewL(); |
|
61 <a name="l00054"></a>00054 <span class="comment">// Create and open a calendar file</span> |
|
62 <a name="l00055"></a>00055 _LIT(KFileName,<span class="stringliteral">"calendarfile"</span>); |
|
63 <a name="l00056"></a>00056 TRAPD(err, iCalSession->CreateCalFileL(KFileName)); |
|
64 <a name="l00057"></a>00057 <span class="comment">// ignore KErrAlreadyExists leave code</span> |
|
65 <a name="l00058"></a>00058 <span class="keywordflow">if</span> (err != KErrAlreadyExists) |
|
66 <a name="l00059"></a>00059 { |
|
67 <a name="l00060"></a>00060 User::LeaveIfError(err); |
|
68 <a name="l00061"></a>00061 } |
|
69 <a name="l00062"></a>00062 <span class="comment">// Open the calendar file</span> |
|
70 <a name="l00063"></a>00063 iCalSession->OpenL(KFileName); |
|
71 <a name="l00064"></a>00064 |
|
72 <a name="l00065"></a>00065 _LIT(KProgressMsg, <span class="stringliteral">"\nCalendar entry view creation is in progress..."</span>); |
|
73 <a name="l00066"></a>00066 iConsole->Printf(KProgressMsg); |
|
74 <a name="l00067"></a>00067 <span class="comment">// Create a calendar entry view to view the entries</span> |
|
75 <a name="l00068"></a>00068 iCalEntryView = CCalEntryView::NewL(*iCalSession,*<span class="keyword">this</span>); |
|
76 <a name="l00069"></a>00069 CActiveScheduler::Start(); |
|
77 <a name="l00070"></a>00070 } |
|
78 <a name="l00071"></a>00071 |
|
79 <a name="l00072"></a>00072 <span class="comment">// Called during calendar entry view creation</span> |
|
80 <a name="l00073"></a><a class="code" href="class_c_cal_example.html#1ccce3cfbd215268e2210d9f67ff4aef">00073</a> <span class="keywordtype">void</span> <a class="code" href="class_c_cal_example.html#1ccce3cfbd215268e2210d9f67ff4aef">CCalExample::Progress</a>(TInt aProgress) |
|
81 <a name="l00074"></a>00074 { |
|
82 <a name="l00075"></a>00075 _LIT(KProgressVal,<span class="stringliteral">"\n%d%% complete"</span>); |
|
83 <a name="l00076"></a>00076 iConsole->Printf(KProgressVal,aProgress); |
|
84 <a name="l00077"></a>00077 } |
|
85 <a name="l00078"></a>00078 |
|
86 <a name="l00079"></a>00079 <span class="comment">// Called on completion of calendar entry view creation</span> |
|
87 <a name="l00080"></a><a class="code" href="class_c_cal_example.html#f5a6cde3a8ccb269b8662ca73d7b371b">00080</a> <span class="keywordtype">void</span> <a class="code" href="class_c_cal_example.html#f5a6cde3a8ccb269b8662ca73d7b371b">CCalExample::Completed</a>(TInt <span class="comment">/*aError*/</span>) |
|
88 <a name="l00081"></a>00081 { |
|
89 <a name="l00082"></a>00082 CActiveScheduler::Stop(); |
|
90 <a name="l00083"></a>00083 } |
|
91 <a name="l00084"></a>00084 |
|
92 <a name="l00085"></a>00085 <span class="comment">// Returns whether or not progress notification is required</span> |
|
93 <a name="l00086"></a><a class="code" href="class_c_cal_example.html#1fdf9918d6d05fadb6d382ea1c0d0f7b">00086</a> TBool <a class="code" href="class_c_cal_example.html#1fdf9918d6d05fadb6d382ea1c0d0f7b">CCalExample::NotifyProgress</a>() |
|
94 <a name="l00087"></a>00087 { |
|
95 <a name="l00088"></a>00088 <span class="comment">// Progress notification is required</span> |
|
96 <a name="l00089"></a>00089 <span class="keywordflow">return</span> ETrue; |
|
97 <a name="l00090"></a>00090 } |
|
98 <a name="l00091"></a>00091 |
|
99 <a name="l00092"></a>00092 <span class="comment">// Sets some entry details - start and end date/time, description, categories and attendees</span> |
|
100 <a name="l00093"></a>00093 <span class="keywordtype">void</span> CCalExample::SetEntryDetailsL(CCalEntry* aEntry,<span class="keyword">const</span> TDesC& aDescription, TDateTime& aStartTime,TDateTime& aEndTime) |
|
101 <a name="l00094"></a>00094 { |
|
102 <a name="l00095"></a>00095 TCalTime startTime; |
|
103 <a name="l00096"></a>00096 TCalTime endTime; |
|
104 <a name="l00097"></a>00097 |
|
105 <a name="l00098"></a>00098 <span class="comment">// Set the start and end times using time values local to the current system time zone</span> |
|
106 <a name="l00099"></a>00099 startTime.SetTimeLocalL(aStartTime); |
|
107 <a name="l00100"></a>00100 endTime.SetTimeLocalL(aEndTime); |
|
108 <a name="l00101"></a>00101 aEntry->SetStartAndEndTimeL(startTime, endTime); |
|
109 <a name="l00102"></a>00102 |
|
110 <a name="l00103"></a>00103 <span class="comment">// Set the description text</span> |
|
111 <a name="l00104"></a>00104 aEntry->SetDescriptionL(aDescription); |
|
112 <a name="l00105"></a>00105 |
|
113 <a name="l00106"></a>00106 <span class="comment">// Add a category</span> |
|
114 <a name="l00107"></a>00107 <span class="keyword">const</span> RPointerArray<CCalCategory> categoryList = aEntry->CategoryListL(); |
|
115 <a name="l00108"></a>00108 <span class="keywordflow">if</span>(categoryList.Count() == 0) |
|
116 <a name="l00109"></a>00109 { |
|
117 <a name="l00110"></a>00110 TBuf<32> buf; |
|
118 <a name="l00111"></a>00111 _LIT(KCategoryName, <span class="stringliteral">"Dummy Category"</span>); |
|
119 <a name="l00112"></a>00112 buf.Copy(KCategoryName); |
|
120 <a name="l00113"></a>00113 |
|
121 <a name="l00114"></a>00114 CCalCategory* category = CCalCategory::NewL(buf); |
|
122 <a name="l00115"></a>00115 CleanupStack::PushL(category); |
|
123 <a name="l00116"></a>00116 aEntry->AddCategoryL(category); |
|
124 <a name="l00117"></a>00117 CleanupStack::Pop(category); |
|
125 <a name="l00118"></a>00118 } |
|
126 <a name="l00119"></a>00119 |
|
127 <a name="l00120"></a>00120 <span class="comment">// Add some attendees</span> |
|
128 <a name="l00121"></a>00121 <span class="keyword">const</span> RPointerArray<CCalAttendee>attendeeList = aEntry->AttendeesL(); |
|
129 <a name="l00122"></a>00122 <span class="keywordflow">if</span>(attendeeList.Count() == 0) |
|
130 <a name="l00123"></a>00123 { |
|
131 <a name="l00124"></a>00124 _LIT(KAttendeeOne, <span class="stringliteral">"nokiauk@nokia.com"</span>); |
|
132 <a name="l00125"></a>00125 _LIT(KAttendeeTwo, <span class="stringliteral">"nokiaindia@nokia.com"</span>); |
|
133 <a name="l00126"></a>00126 |
|
134 <a name="l00127"></a>00127 CCalAttendee* attendeeOne = CCalAttendee::NewL(KAttendeeOne); |
|
135 <a name="l00128"></a>00128 CleanupStack::PushL(attendeeOne); |
|
136 <a name="l00129"></a>00129 aEntry->AddAttendeeL(attendeeOne); |
|
137 <a name="l00130"></a>00130 CleanupStack::Pop(attendeeOne); |
|
138 <a name="l00131"></a>00131 |
|
139 <a name="l00132"></a>00132 CCalAttendee* attendeeTwo = CCalAttendee::NewL(KAttendeeTwo); |
|
140 <a name="l00133"></a>00133 CleanupStack::PushL(attendeeTwo); |
|
141 <a name="l00134"></a>00134 aEntry->AddAttendeeL(attendeeTwo); |
|
142 <a name="l00135"></a>00135 CleanupStack::Pop(attendeeTwo); |
|
143 <a name="l00136"></a>00136 } |
|
144 <a name="l00137"></a>00137 } |
|
145 <a name="l00138"></a>00138 |
|
146 <a name="l00139"></a>00139 <span class="comment">// Add a non-repeating appointment to the calendar file</span> |
|
147 <a name="l00140"></a><a class="code" href="class_c_cal_example.html#d89edab97029a30027346db3773ec5d0">00140</a> <span class="keywordtype">void</span> <a class="code" href="class_c_cal_example.html#d89edab97029a30027346db3773ec5d0">CCalExample::AddEntryL</a>() |
|
148 <a name="l00141"></a>00141 { |
|
149 <a name="l00142"></a>00142 <span class="keyword">const</span> TDesC8& guidDes = KGuid; |
|
150 <a name="l00143"></a>00143 HBufC8* guid = guidDes.AllocL(); |
|
151 <a name="l00144"></a>00144 |
|
152 <a name="l00145"></a>00145 CCalEntry* entry = CCalEntry::NewL(CCalEntry::EAppt, guid, CCalEntry::EMethodNone, 0); |
|
153 <a name="l00146"></a>00146 CleanupStack::PushL(entry); |
|
154 <a name="l00147"></a>00147 |
|
155 <a name="l00148"></a>00148 <span class="comment">// For an appointment, the time as well as the date is relevant</span> |
|
156 <a name="l00149"></a>00149 TDateTime startTime(2006, EJanuary, 04, 10, 0, 0, 0); |
|
157 <a name="l00150"></a>00150 TDateTime endTime(2006, EJanuary, 05, 16, 0, 0, 0); |
|
158 <a name="l00151"></a>00151 |
|
159 <a name="l00152"></a>00152 _LIT(KAddingMsg, <span class="stringliteral">"\n\nAdding an entry..."</span>); |
|
160 <a name="l00153"></a>00153 iConsole->Printf ( KAddingMsg ); |
|
161 <a name="l00154"></a>00154 |
|
162 <a name="l00155"></a>00155 _LIT(KDescription,<span class="stringliteral">"Meeting is scheduled in 1st week of January"</span>); |
|
163 <a name="l00156"></a>00156 SetEntryDetailsL(entry,KDescription, startTime, endTime); |
|
164 <a name="l00157"></a>00157 |
|
165 <a name="l00158"></a>00158 RPointerArray<CCalEntry> array; |
|
166 <a name="l00159"></a>00159 CleanupClosePushL(array); |
|
167 <a name="l00160"></a>00160 array.AppendL(entry); |
|
168 <a name="l00161"></a>00161 |
|
169 <a name="l00162"></a>00162 TInt success(0); |
|
170 <a name="l00163"></a>00163 <span class="comment">// If StoreL() leaves, 'success' contains the number of entries that were</span> |
|
171 <a name="l00164"></a>00164 <span class="comment">// stored before it failed</span> |
|
172 <a name="l00165"></a>00165 iCalEntryView->StoreL(array, success); |
|
173 <a name="l00166"></a>00166 |
|
174 <a name="l00167"></a>00167 CleanupStack::PopAndDestroy(&array); |
|
175 <a name="l00168"></a>00168 CleanupStack::PopAndDestroy(entry); |
|
176 <a name="l00169"></a>00169 } |
|
177 <a name="l00170"></a>00170 |
|
178 <a name="l00171"></a>00171 <span class="comment">// Destroy the RPointerArray</span> |
|
179 <a name="l00172"></a>00172 <span class="keywordtype">void</span> DestroyRPointerArray(TAny* aPtr) |
|
180 <a name="l00173"></a>00173 { |
|
181 <a name="l00174"></a>00174 RPointerArray<CCalEntry>* <span class="keyword">self</span> = <span class="keyword">static_cast<</span>RPointerArray<CCalEntry>*<span class="keyword">></span> (aPtr); |
|
182 <a name="l00175"></a>00175 <span class="keyword">self</span>->ResetAndDestroy(); |
|
183 <a name="l00176"></a>00176 } |
|
184 <a name="l00177"></a>00177 |
|
185 <a name="l00178"></a>00178 <span class="comment">// Fetch the entry and update some of its details</span> |
|
186 <a name="l00179"></a><a class="code" href="class_c_cal_example.html#4de85d476d3f6f24657e81da3280d80c">00179</a> <span class="keywordtype">void</span> <a class="code" href="class_c_cal_example.html#4de85d476d3f6f24657e81da3280d80c">CCalExample::UpdateEntryL</a>() |
|
187 <a name="l00180"></a>00180 { |
|
188 <a name="l00181"></a>00181 RPointerArray<CCalEntry> array; |
|
189 <a name="l00182"></a>00182 CleanupStack::PushL(TCleanupItem(DestroyRPointerArray, &array)); |
|
190 <a name="l00183"></a>00183 iCalEntryView->FetchL(KGuid, array); |
|
191 <a name="l00184"></a>00184 |
|
192 <a name="l00185"></a>00185 <span class="comment">//Fetch the first entry in the list</span> |
|
193 <a name="l00186"></a>00186 _LIT(KUpdatingMsg,<span class="stringliteral">"\n\nUpdating the entry..."</span>); |
|
194 <a name="l00187"></a>00187 iConsole->Printf(KUpdatingMsg); |
|
195 <a name="l00188"></a>00188 CCalEntry* entry = array[0]; |
|
196 <a name="l00189"></a>00189 |
|
197 <a name="l00190"></a>00190 _LIT(KNewDescription,<span class="stringliteral">"Meeting rescheduled to 2nd week of January"</span>); |
|
198 <a name="l00191"></a>00191 TDateTime startTime(2006, EJanuary, 11, 10, 0, 0, 0); |
|
199 <a name="l00192"></a>00192 TDateTime endTime(2006, EJanuary, 12, 16, 0, 0, 0); |
|
200 <a name="l00193"></a>00193 SetEntryDetailsL(entry,KNewDescription, startTime, endTime); |
|
201 <a name="l00194"></a>00194 |
|
202 <a name="l00195"></a>00195 TInt numberOfEntries(0); |
|
203 <a name="l00196"></a>00196 <span class="comment">// If UpdateL() leaves, 'numberOfEntries' contains the number of entries that were</span> |
|
204 <a name="l00197"></a>00197 <span class="comment">// updated before it failed</span> |
|
205 <a name="l00198"></a>00198 iCalEntryView->UpdateL(array,numberOfEntries); |
|
206 <a name="l00199"></a>00199 CleanupStack::PopAndDestroy(&array); |
|
207 <a name="l00200"></a>00200 } |
|
208 <a name="l00201"></a>00201 |
|
209 <a name="l00202"></a>00202 <span class="comment">// Add a repeating appointment. This is called the originating entry.</span> |
|
210 <a name="l00203"></a><a class="code" href="class_c_cal_example.html#7c1da41338976354f45e8873f4343790">00203</a> <span class="keywordtype">void</span> <a class="code" href="class_c_cal_example.html#7c1da41338976354f45e8873f4343790">CCalExample::AddOriginatingEntryL</a>() |
|
211 <a name="l00204"></a>00204 { |
|
212 <a name="l00205"></a>00205 _LIT(KAddingMsg, <span class="stringliteral">"\n\nAdding a repeating entry..."</span>); |
|
213 <a name="l00206"></a>00206 iConsole->Printf ( KAddingMsg ); |
|
214 <a name="l00207"></a>00207 |
|
215 <a name="l00208"></a>00208 TTime startTime(TDateTime(2006, EJanuary, 0, 14, 0, 0, 0)); <span class="comment">// January 1st 2pm</span> |
|
216 <a name="l00209"></a>00209 TTime endTime(startTime + TTimeIntervalHours(1)); <span class="comment">// January 1st 3pm </span> |
|
217 <a name="l00210"></a>00210 |
|
218 <a name="l00211"></a>00211 <span class="keyword">const</span> TDesC8& guidDes = KGuid; |
|
219 <a name="l00212"></a>00212 HBufC8* guid = guidDes.AllocL(); |
|
220 <a name="l00213"></a>00213 CCalEntry* originatingEntry = CCalEntry::NewL(CCalEntry::EAppt, guid, CCalEntry::EMethodNone, 0); |
|
221 <a name="l00214"></a>00214 CleanupStack::PushL(originatingEntry); |
|
222 <a name="l00215"></a>00215 |
|
223 <a name="l00216"></a>00216 _LIT(KDescription,<span class="stringliteral">"An originating entry"</span>); |
|
224 <a name="l00217"></a>00217 originatingEntry->SetDescriptionL(KDescription); |
|
225 <a name="l00218"></a>00218 |
|
226 <a name="l00219"></a>00219 TCalTime entryStartTime; |
|
227 <a name="l00220"></a>00220 entryStartTime.SetTimeLocalL(startTime); |
|
228 <a name="l00221"></a>00221 TCalTime entryEndTime; |
|
229 <a name="l00222"></a>00222 entryEndTime.SetTimeLocalL(endTime); |
|
230 <a name="l00223"></a>00223 originatingEntry->SetStartAndEndTimeL(entryStartTime, entryEndTime); |
|
231 <a name="l00224"></a>00224 |
|
232 <a name="l00225"></a>00225 <span class="comment">// Set the repeat rule</span> |
|
233 <a name="l00226"></a>00226 <span class="comment">// The entry repeats weekly with 3 instances being created</span> |
|
234 <a name="l00227"></a>00227 TCalRRule weeklyRptRule(TCalRRule::EWeekly); |
|
235 <a name="l00228"></a>00228 weeklyRptRule.SetDtStart(entryStartTime); |
|
236 <a name="l00229"></a>00229 weeklyRptRule.SetCount(3); |
|
237 <a name="l00230"></a>00230 weeklyRptRule.SetInterval(1); |
|
238 <a name="l00231"></a>00231 <span class="comment">// Also need to set the day that the entry repeats on</span> |
|
239 <a name="l00232"></a>00232 RArray<TDay> days; |
|
240 <a name="l00233"></a>00233 CleanupClosePushL(days); |
|
241 <a name="l00234"></a>00234 days.AppendL(ESunday); |
|
242 <a name="l00235"></a>00235 weeklyRptRule.SetByDay(days); |
|
243 <a name="l00236"></a>00236 CleanupStack::PopAndDestroy(&days); |
|
244 <a name="l00237"></a>00237 originatingEntry->SetRRuleL(weeklyRptRule); |
|
245 <a name="l00238"></a>00238 |
|
246 <a name="l00239"></a>00239 <span class="comment">// Now write the entry to the view</span> |
|
247 <a name="l00240"></a>00240 RPointerArray<CCalEntry> array; |
|
248 <a name="l00241"></a>00241 CleanupStack::PushL(TCleanupItem(DestroyRPointerArray, &array)); |
|
249 <a name="l00242"></a>00242 array.AppendL(originatingEntry); |
|
250 <a name="l00243"></a>00243 TInt success(0); |
|
251 <a name="l00244"></a>00244 <span class="comment">// If StoreL() leaves, 'success' contains the number of entries that were</span> |
|
252 <a name="l00245"></a>00245 <span class="comment">// stored before it failed</span> |
|
253 <a name="l00246"></a>00246 iCalEntryView->StoreL(array, success); |
|
254 <a name="l00247"></a>00247 |
|
255 <a name="l00248"></a>00248 <span class="comment">// clean up </span> |
|
256 <a name="l00249"></a>00249 array.Close(); |
|
257 <a name="l00250"></a>00250 CleanupStack::PopAndDestroy(&array); |
|
258 <a name="l00251"></a>00251 CleanupStack::PopAndDestroy(originatingEntry); |
|
259 <a name="l00252"></a>00252 } |
|
260 <a name="l00253"></a>00253 |
|
261 <a name="l00254"></a>00254 <span class="comment">// Adds a modifying, or "child" entry.</span> |
|
262 <a name="l00255"></a>00255 <span class="comment">// A modifying entry modifies one or more instances of the "originating" repeating entry. </span> |
|
263 <a name="l00256"></a>00256 <span class="comment">// It has the same UID, and is deleted when the originating entry is deleted.</span> |
|
264 <a name="l00257"></a><a class="code" href="class_c_cal_example.html#0d965ba3fe5db4687c36b3288b9766d7">00257</a> <span class="keywordtype">void</span> <a class="code" href="class_c_cal_example.html#0d965ba3fe5db4687c36b3288b9766d7">CCalExample::AddmodifyingEntryL</a>() |
|
265 <a name="l00258"></a>00258 { |
|
266 <a name="l00259"></a>00259 RPointerArray<CCalEntry> modifyingArray; |
|
267 <a name="l00260"></a>00260 CleanupStack::PushL(TCleanupItem(DestroyRPointerArray, &modifyingArray)); |
|
268 <a name="l00261"></a>00261 |
|
269 <a name="l00262"></a>00262 _LIT(KAddingMsg, <span class="stringliteral">"\n\nAdding a modifying entry..."</span>); |
|
270 <a name="l00263"></a>00263 iConsole->Printf ( KAddingMsg ); |
|
271 <a name="l00264"></a>00264 <span class="comment">// Create repeating modifying entry</span> |
|
272 <a name="l00265"></a>00265 <span class="comment">// Has the same recurrence Id as the second instance of the originating and</span> |
|
273 <a name="l00266"></a>00266 <span class="comment">// this and all future instances are modified.</span> |
|
274 <a name="l00267"></a>00267 TTime recurrenceId(TDateTime(2006, EJanuary, 7, 14, 0, 0, 0)); <span class="comment">// January 8th 2pm</span> |
|
275 <a name="l00268"></a>00268 TCalTime recurrenceIdCal; |
|
276 <a name="l00269"></a>00269 recurrenceIdCal.SetTimeLocalL(recurrenceId); |
|
277 <a name="l00270"></a>00270 |
|
278 <a name="l00271"></a>00271 <span class="keyword">const</span> TDesC8& guidDes = KGuid; |
|
279 <a name="l00272"></a>00272 HBufC8* guid = guidDes.AllocL(); |
|
280 <a name="l00273"></a>00273 |
|
281 <a name="l00274"></a>00274 <span class="comment">// Entry type is appointment, group scheduling method none and modifying this and all future instances </span> |
|
282 <a name="l00275"></a>00275 CCalEntry* modifyingEntry = CCalEntry::NewL(CCalEntry::EAppt, guid, CCalEntry::EMethodNone, 1, recurrenceIdCal, CalCommon::EThisAndFuture); |
|
283 <a name="l00276"></a>00276 CleanupStack::PushL(modifyingEntry); |
|
284 <a name="l00277"></a>00277 |
|
285 <a name="l00278"></a>00278 <span class="comment">// The modifying entry has a different description to the originating entry</span> |
|
286 <a name="l00279"></a>00279 _LIT(KChildDescription,<span class="stringliteral">"A modifying entry"</span>); |
|
287 <a name="l00280"></a>00280 modifyingEntry->SetDescriptionL(KChildDescription); |
|
288 <a name="l00281"></a>00281 <span class="comment">// The modifying entry modifies the originating entry's date by one day</span> |
|
289 <a name="l00282"></a>00282 TTime childStartTime(TDateTime(2006, EJanuary, 8, 14, 0, 0, 0)); <span class="comment">// January 9th 2pm</span> |
|
290 <a name="l00283"></a>00283 TTime childEndTime(childStartTime + TTimeIntervalHours(1)); <span class="comment">// January 9th 3pm</span> |
|
291 <a name="l00284"></a>00284 |
|
292 <a name="l00285"></a>00285 TCalTime childEntryStartTime; |
|
293 <a name="l00286"></a>00286 childEntryStartTime.SetTimeLocalL(childStartTime); |
|
294 <a name="l00287"></a>00287 TCalTime childEntryEndTime; |
|
295 <a name="l00288"></a>00288 childEntryEndTime.SetTimeLocalL(childEndTime); |
|
296 <a name="l00289"></a>00289 modifyingEntry->SetStartAndEndTimeL(childEntryStartTime, childEntryEndTime); |
|
297 <a name="l00290"></a>00290 <span class="comment">// Target instance for recurrence range in the modifying entry is second instance</span> |
|
298 <a name="l00291"></a>00291 TCalRRule childRptRule(TCalRRule::EWeekly); |
|
299 <a name="l00292"></a>00292 childRptRule.SetDtStart(childEntryStartTime); |
|
300 <a name="l00293"></a>00293 childRptRule.SetCount(2); |
|
301 <a name="l00294"></a>00294 childRptRule.SetInterval(1); |
|
302 <a name="l00295"></a>00295 |
|
303 <a name="l00296"></a>00296 <span class="comment">// The modifying entry modifies the originating entry by occurring on Mondays</span> |
|
304 <a name="l00297"></a>00297 RArray<TDay> days; |
|
305 <a name="l00298"></a>00298 CleanupClosePushL(days); |
|
306 <a name="l00299"></a>00299 days.AppendL(EMonday); |
|
307 <a name="l00300"></a>00300 childRptRule.SetByDay(days); |
|
308 <a name="l00301"></a>00301 CleanupStack::PopAndDestroy(&days); |
|
309 <a name="l00302"></a>00302 modifyingEntry->SetRRuleL(childRptRule); |
|
310 <a name="l00303"></a>00303 |
|
311 <a name="l00304"></a>00304 <span class="comment">// add the modifying entry to the entry view.</span> |
|
312 <a name="l00305"></a>00305 modifyingArray.AppendL(modifyingEntry); |
|
313 <a name="l00306"></a>00306 |
|
314 <a name="l00307"></a>00307 TInt success(0); |
|
315 <a name="l00308"></a>00308 <span class="comment">// If StoreL() leaves, 'success' contains the number of entries that were</span> |
|
316 <a name="l00309"></a>00309 <span class="comment">// stored before it failed</span> |
|
317 <a name="l00310"></a>00310 iCalEntryView->StoreL(modifyingArray, success); |
|
318 <a name="l00311"></a>00311 |
|
319 <a name="l00312"></a>00312 <span class="comment">// clean up </span> |
|
320 <a name="l00313"></a>00313 CleanupStack::PopAndDestroy(modifyingEntry); |
|
321 <a name="l00314"></a>00314 modifyingArray.Reset(); |
|
322 <a name="l00315"></a>00315 CleanupStack::PopAndDestroy(&modifyingArray); |
|
323 <a name="l00316"></a>00316 } |
|
324 <a name="l00317"></a>00317 |
|
325 <a name="l00318"></a>00318 <span class="comment">// Searches for all instances in January, then prints out their details.</span> |
|
326 <a name="l00319"></a>00319 <span class="comment">// Creates an instance view to display the instances. </span> |
|
327 <a name="l00320"></a><a class="code" href="class_c_cal_example.html#b2e18bfdafe7adb1e1d7cd100d5e383e">00320</a> <span class="keywordtype">void</span> <a class="code" href="class_c_cal_example.html#b2e18bfdafe7adb1e1d7cd100d5e383e">CCalExample::FindInstanceL</a>() |
|
328 <a name="l00321"></a>00321 { |
|
329 <a name="l00322"></a>00322 _LIT(KPressAKeyMsg, <span class="stringliteral">"\n\nPress any key to view the instances"</span>); |
|
330 <a name="l00323"></a>00323 iConsole->Printf(KPressAKeyMsg); |
|
331 <a name="l00324"></a>00324 iConsole->Getch (); |
|
332 <a name="l00325"></a>00325 _LIT(KProgressMsg, <span class="stringliteral">"\nCalendar instance view creation is in progress..."</span>); |
|
333 <a name="l00326"></a>00326 iConsole->Printf(KProgressMsg); |
|
334 <a name="l00327"></a>00327 CCalInstanceView* instanceView = CCalInstanceView::NewL(*iCalSession, *<span class="keyword">this</span>); |
|
335 <a name="l00328"></a>00328 CleanupStack::PushL(instanceView); |
|
336 <a name="l00329"></a>00329 CActiveScheduler::Start(); |
|
337 <a name="l00330"></a>00330 |
|
338 <a name="l00331"></a>00331 RPointerArray<CCalInstance> instanceList; |
|
339 <a name="l00332"></a>00332 CleanupStack::PushL(TCleanupItem(DestroyRPointerArray, &instanceList)); |
|
340 <a name="l00333"></a>00333 CalCommon::TCalViewFilter filter = CalCommon::EIncludeAll; |
|
341 <a name="l00334"></a>00334 TCalTime startDateForInstanceSearch; |
|
342 <a name="l00335"></a>00335 TCalTime endDateForInstanceSearch; |
|
343 <a name="l00336"></a>00336 |
|
344 <a name="l00337"></a>00337 <span class="comment">// Set date and time range for searching for instances</span> |
|
345 <a name="l00338"></a>00338 startDateForInstanceSearch.SetTimeLocalL(TDateTime( 2006, EJanuary, 0, 12, 0, 0, 0)); <span class="comment">// 1st January 12 pm</span> |
|
346 <a name="l00339"></a>00339 endDateForInstanceSearch.SetTimeLocalL(TDateTime( 2006, EJanuary, 30, 10, 0, 0, 0)); <span class="comment">// 31st January 10 am</span> |
|
347 <a name="l00340"></a>00340 CalCommon::TCalTimeRange searchTimeRange(startDateForInstanceSearch, endDateForInstanceSearch); |
|
348 <a name="l00341"></a>00341 |
|
349 <a name="l00342"></a>00342 <span class="comment">// Searches for instances within the specified date range</span> |
|
350 <a name="l00343"></a>00343 instanceView->FindInstanceL(instanceList, filter, searchTimeRange); |
|
351 <a name="l00344"></a>00344 |
|
352 <a name="l00345"></a>00345 _LIT(KInstancesFound,<span class="stringliteral">"\n\nFound %d instances:"</span>); |
|
353 <a name="l00346"></a>00346 iConsole->Printf(KInstancesFound,instanceList.Count()); |
|
354 <a name="l00347"></a>00347 |
|
355 <a name="l00348"></a>00348 TDateTime date; |
|
356 <a name="l00349"></a>00349 <span class="keywordflow">for</span>(TInt i = 0; i<instanceList.Count(); i++) |
|
357 <a name="l00350"></a>00350 { |
|
358 <a name="l00351"></a>00351 TPtrC des = instanceList[i]->Entry().DescriptionL(); |
|
359 <a name="l00352"></a>00352 _LIT(KEntryDesc,<span class="stringliteral">"\nDescription: %S"</span>); |
|
360 <a name="l00353"></a>00353 iConsole->Printf(KEntryDesc,&des); |
|
361 <a name="l00354"></a>00354 |
|
362 <a name="l00355"></a>00355 TTime time = instanceList[i]->StartTimeL().TimeLocalL(); |
|
363 <a name="l00356"></a>00356 TBuf<40> datetimeStr; |
|
364 <a name="l00357"></a>00357 _LIT(KFormat,<span class="stringliteral">"%D%M%Y%/0%1%/1%2%/2%3%/3 %:0%H%:1%T%:2%S"</span>); |
|
365 <a name="l00358"></a>00358 time.FormatL(datetimeStr,KFormat); |
|
366 <a name="l00359"></a>00359 |
|
367 <a name="l00360"></a>00360 <span class="comment">// Print out the start date/time</span> |
|
368 <a name="l00361"></a>00361 _LIT(KStartDate,<span class="stringliteral">"\nLocal instance start date/time: %S "</span>); |
|
369 <a name="l00362"></a>00362 iConsole->Printf(KStartDate,&datetimeStr); |
|
370 <a name="l00363"></a>00363 } |
|
371 <a name="l00364"></a>00364 |
|
372 <a name="l00365"></a>00365 CleanupStack::PopAndDestroy(&instanceList); |
|
373 <a name="l00366"></a>00366 CleanupStack::PopAndDestroy(instanceView); |
|
374 <a name="l00367"></a>00367 } |
|
375 <a name="l00368"></a>00368 |
|
376 <a name="l00369"></a>00369 <span class="comment">// Fetch and print the entry details</span> |
|
377 <a name="l00370"></a><a class="code" href="class_c_cal_example.html#3f297c124bb7751e7ca1d15eb12c17b9">00370</a> <span class="keywordtype">void</span> <a class="code" href="class_c_cal_example.html#3f297c124bb7751e7ca1d15eb12c17b9">CCalExample::PrintEntryDetailsL</a>() |
|
378 <a name="l00371"></a>00371 { |
|
379 <a name="l00372"></a>00372 _LIT(KPressAKeyMsg, <span class="stringliteral">"\nPress any key to view entry details"</span>); |
|
380 <a name="l00373"></a>00373 iConsole->Printf ( KPressAKeyMsg ); |
|
381 <a name="l00374"></a>00374 iConsole->Getch (); |
|
382 <a name="l00375"></a>00375 |
|
383 <a name="l00376"></a>00376 RPointerArray<CCalEntry> array; |
|
384 <a name="l00377"></a>00377 CleanupStack::PushL(TCleanupItem(DestroyRPointerArray, &array)); |
|
385 <a name="l00378"></a>00378 iCalEntryView->FetchL(KGuid, array); |
|
386 <a name="l00379"></a>00379 <span class="keywordflow">for</span>(TInt i=0; i<array.Count(); i++) |
|
387 <a name="l00380"></a>00380 { |
|
388 <a name="l00381"></a>00381 CCalEntry* entry = array[i]; |
|
389 <a name="l00382"></a>00382 CleanupStack::PushL(entry); |
|
390 <a name="l00383"></a>00383 |
|
391 <a name="l00384"></a>00384 TPtrC des = entry->DescriptionL(); |
|
392 <a name="l00385"></a>00385 _LIT(KEntryDesc,<span class="stringliteral">" \n\nDescription: %S"</span>); |
|
393 <a name="l00386"></a>00386 iConsole->Printf(KEntryDesc,&des); |
|
394 <a name="l00387"></a>00387 |
|
395 <a name="l00388"></a>00388 TCalTime startTime = entry->StartTimeL(); |
|
396 <a name="l00389"></a>00389 TCalTime endTime = entry->EndTimeL(); |
|
397 <a name="l00390"></a>00390 TTime time = startTime.TimeLocalL(); |
|
398 <a name="l00391"></a>00391 |
|
399 <a name="l00392"></a>00392 TBuf<40> datetimeStr; |
|
400 <a name="l00393"></a>00393 _LIT(KFormat,<span class="stringliteral">"%D%M%Y%/0%1%/1%2%/2%3%/3 %:0%H%:1%T%:2%S"</span>); |
|
401 <a name="l00394"></a>00394 time.FormatL(datetimeStr,KFormat); |
|
402 <a name="l00395"></a>00395 |
|
403 <a name="l00396"></a>00396 <span class="comment">// Print out the start date/time</span> |
|
404 <a name="l00397"></a>00397 _LIT(KStartDate,<span class="stringliteral">"\nStart date/time: %S "</span>); |
|
405 <a name="l00398"></a>00398 iConsole->Printf(KStartDate,&datetimeStr); |
|
406 <a name="l00399"></a>00399 |
|
407 <a name="l00400"></a>00400 <span class="comment">// Now, print out the end date/time</span> |
|
408 <a name="l00401"></a>00401 time = endTime.TimeLocalL(); |
|
409 <a name="l00402"></a>00402 time.FormatL(datetimeStr,KFormat); |
|
410 <a name="l00403"></a>00403 _LIT(KEndDate,<span class="stringliteral">"\nEnd date/time: %S"</span>); |
|
411 <a name="l00404"></a>00404 iConsole->Printf(KEndDate,&datetimeStr); |
|
412 <a name="l00405"></a>00405 CleanupStack::Pop(entry); |
|
413 <a name="l00406"></a>00406 |
|
414 <a name="l00407"></a>00407 <span class="comment">// Fetch category</span> |
|
415 <a name="l00408"></a>00408 RPointerArray<CCalCategory> categoryList = entry->CategoryListL(); |
|
416 <a name="l00409"></a>00409 <span class="keywordflow">for</span>( <span class="keywordtype">int</span> j=0; j<categoryList.Count(); j++) |
|
417 <a name="l00410"></a>00410 { |
|
418 <a name="l00411"></a>00411 <span class="keyword">const</span> TDesC& category = categoryList[j]->ExtendedCategoryName(); |
|
419 <a name="l00412"></a>00412 HBufC* catbuf = category.AllocL(); |
|
420 <a name="l00413"></a>00413 _LIT(KCatType,<span class="stringliteral">"\nCategory type: %S"</span>); |
|
421 <a name="l00414"></a>00414 iConsole->Printf(KCatType,catbuf); |
|
422 <a name="l00415"></a>00415 <span class="keyword">delete</span> catbuf; |
|
423 <a name="l00416"></a>00416 } |
|
424 <a name="l00417"></a>00417 |
|
425 <a name="l00418"></a>00418 <span class="comment">// Fetch attendee</span> |
|
426 <a name="l00419"></a>00419 RPointerArray<CCalAttendee> attendeeList; |
|
427 <a name="l00420"></a>00420 attendeeList = entry->AttendeesL(); |
|
428 <a name="l00421"></a>00421 <span class="keywordflow">for</span>( <span class="keywordtype">int</span> k=0; k<attendeeList.Count(); k++) |
|
429 <a name="l00422"></a>00422 { |
|
430 <a name="l00423"></a>00423 <span class="keyword">const</span> TDesC16& address = attendeeList[k]->Address(); |
|
431 <a name="l00424"></a>00424 HBufC16* addr = address.AllocL(); |
|
432 <a name="l00425"></a>00425 _LIT(KAttendee,<span class="stringliteral">"\nAttendee %d: %S"</span>); |
|
433 <a name="l00426"></a>00426 iConsole->Printf(KAttendee,k+1, addr); |
|
434 <a name="l00427"></a>00427 <span class="keyword">delete</span> addr; |
|
435 <a name="l00428"></a>00428 } |
|
436 <a name="l00429"></a>00429 } |
|
437 <a name="l00430"></a>00430 CleanupStack::PopAndDestroy(&array); |
|
438 <a name="l00431"></a>00431 } |
|
439 <a name="l00432"></a>00432 |
|
440 <a name="l00433"></a>00433 <span class="comment">// Delete the originating entry </span> |
|
441 <a name="l00434"></a><a class="code" href="class_c_cal_example.html#cbc67752acc71548a176ede8c8790c1e">00434</a> <span class="keywordtype">void</span> <a class="code" href="class_c_cal_example.html#cbc67752acc71548a176ede8c8790c1e">CCalExample::DeleteEntryL</a>() |
|
442 <a name="l00435"></a>00435 { |
|
443 <a name="l00436"></a>00436 _LIT(KPressAKeyMsg, <span class="stringliteral">"\n\nPress any key to delete the originating entry, (also deletes the modifying entry)"</span>); |
|
444 <a name="l00437"></a>00437 iConsole->Printf ( KPressAKeyMsg ); |
|
445 <a name="l00438"></a>00438 iConsole->Getch (); |
|
446 <a name="l00439"></a>00439 |
|
447 <a name="l00440"></a>00440 RPointerArray<CCalEntry> entryArray; |
|
448 <a name="l00441"></a>00441 CleanupStack::PushL(TCleanupItem(DestroyRPointerArray, &entryArray)); |
|
449 <a name="l00442"></a>00442 |
|
450 <a name="l00443"></a>00443 <span class="comment">// Fetch the entry to be deleted</span> |
|
451 <a name="l00444"></a>00444 iCalEntryView->FetchL(KGuid, entryArray); |
|
452 <a name="l00445"></a>00445 CCalEntry* entry = entryArray[0]; |
|
453 <a name="l00446"></a>00446 |
|
454 <a name="l00447"></a>00447 <span class="comment">// Delete originating entry, thereby also deleting the modifying entry</span> |
|
455 <a name="l00448"></a>00448 iCalEntryView->DeleteL(*entry); |
|
456 <a name="l00449"></a>00449 CleanupStack::PopAndDestroy(&entryArray); |
|
457 <a name="l00450"></a>00450 } |
|
458 <a name="l00451"></a>00451 |
|
459 <a name="l00452"></a>00452 LOCAL_C <span class="keywordtype">void</span> <a class="code" href="circularbuffer_8cpp.html#5fb473d4ee18739183215b04dcad6e12">MainL</a>() |
|
460 <a name="l00453"></a>00453 { |
|
461 <a name="l00454"></a>00454 <a class="code" href="class_c_cal_example.html">CCalExample</a>* app = <a class="code" href="class_c_cal_example.html#db58fbf73337500d5bc8162ad2229336">CCalExample::NewL</a>(); |
|
462 <a name="l00455"></a>00455 CleanupStack::PushL(app); |
|
463 <a name="l00456"></a>00456 |
|
464 <a name="l00457"></a>00457 <span class="comment">// Add an entry and display the entry details</span> |
|
465 <a name="l00458"></a>00458 app-><a class="code" href="class_c_cal_example.html#d89edab97029a30027346db3773ec5d0">AddEntryL</a>(); |
|
466 <a name="l00459"></a>00459 app-><a class="code" href="class_c_cal_example.html#3f297c124bb7751e7ca1d15eb12c17b9">PrintEntryDetailsL</a>(); |
|
467 <a name="l00460"></a>00460 |
|
468 <a name="l00461"></a>00461 <span class="comment">// Update an entry and display the updated entry details</span> |
|
469 <a name="l00462"></a>00462 app-><a class="code" href="class_c_cal_example.html#4de85d476d3f6f24657e81da3280d80c">UpdateEntryL</a>(); |
|
470 <a name="l00463"></a>00463 app-><a class="code" href="class_c_cal_example.html#3f297c124bb7751e7ca1d15eb12c17b9">PrintEntryDetailsL</a>(); |
|
471 <a name="l00464"></a>00464 |
|
472 <a name="l00465"></a>00465 <span class="comment">// Create a repeating entry and display the entry details</span> |
|
473 <a name="l00466"></a>00466 app-><a class="code" href="class_c_cal_example.html#7c1da41338976354f45e8873f4343790">AddOriginatingEntryL</a>(); |
|
474 <a name="l00467"></a>00467 app-><a class="code" href="class_c_cal_example.html#3f297c124bb7751e7ca1d15eb12c17b9">PrintEntryDetailsL</a>(); |
|
475 <a name="l00468"></a>00468 |
|
476 <a name="l00469"></a>00469 <span class="comment">// Display the repeat instances</span> |
|
477 <a name="l00470"></a>00470 app-><a class="code" href="class_c_cal_example.html#b2e18bfdafe7adb1e1d7cd100d5e383e">FindInstanceL</a>(); |
|
478 <a name="l00471"></a>00471 |
|
479 <a name="l00472"></a>00472 <span class="comment">// Create a modifying entry and display the entry details</span> |
|
480 <a name="l00473"></a>00473 app-><a class="code" href="class_c_cal_example.html#0d965ba3fe5db4687c36b3288b9766d7">AddmodifyingEntryL</a>(); |
|
481 <a name="l00474"></a>00474 app-><a class="code" href="class_c_cal_example.html#3f297c124bb7751e7ca1d15eb12c17b9">PrintEntryDetailsL</a>(); |
|
482 <a name="l00475"></a>00475 |
|
483 <a name="l00476"></a>00476 <span class="comment">// Display the repeat instances</span> |
|
484 <a name="l00477"></a>00477 app-><a class="code" href="class_c_cal_example.html#b2e18bfdafe7adb1e1d7cd100d5e383e">FindInstanceL</a>(); |
|
485 <a name="l00478"></a>00478 |
|
486 <a name="l00479"></a>00479 <span class="comment">// Delete the originating thereby deleting the modifying entry and all repeat instances</span> |
|
487 <a name="l00480"></a>00480 app-><a class="code" href="class_c_cal_example.html#cbc67752acc71548a176ede8c8790c1e">DeleteEntryL</a>(); |
|
488 <a name="l00481"></a>00481 |
|
489 <a name="l00482"></a>00482 CleanupStack::PopAndDestroy(app); |
|
490 <a name="l00483"></a>00483 } |
|
491 <a name="l00484"></a>00484 |
|
492 <a name="l00485"></a><a class="code" href="globals_8h.html#0f358e9c4355138f629b8c4f37310295">00485</a> GLDEF_C TInt <a class="code" href="dbllist_8cpp.html#0f358e9c4355138f629b8c4f37310295">E32Main</a>() |
|
493 <a name="l00486"></a>00486 { |
|
494 <a name="l00487"></a>00487 __UHEAP_MARK; |
|
495 <a name="l00488"></a>00488 <span class="comment">// Active scheduler required as this is a console app</span> |
|
496 <a name="l00489"></a>00489 CActiveScheduler* scheduler=<span class="keyword">new</span> CActiveScheduler; |
|
497 <a name="l00490"></a>00490 |
|
498 <a name="l00491"></a>00491 <span class="comment">// If active scheduler has been created, install it.</span> |
|
499 <a name="l00492"></a>00492 <span class="keywordflow">if</span> (scheduler) |
|
500 <a name="l00493"></a>00493 { |
|
501 <a name="l00494"></a>00494 CActiveScheduler::Install(scheduler); |
|
502 <a name="l00495"></a>00495 |
|
503 <a name="l00496"></a>00496 <span class="comment">// Cleanup stack needed</span> |
|
504 <a name="l00497"></a>00497 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
505 <a name="l00498"></a>00498 <span class="keywordflow">if</span>(cleanup) |
|
506 <a name="l00499"></a>00499 { |
|
507 <a name="l00500"></a>00500 TRAPD(err, <a class="code" href="circularbuffer_8cpp.html#5fb473d4ee18739183215b04dcad6e12">MainL</a>()); |
|
508 <a name="l00501"></a>00501 <span class="keywordflow">if</span>(err != KErrNone) |
|
509 <a name="l00502"></a>00502 { |
|
510 <a name="l00503"></a>00503 _LIT(KUserPanic,<span class="stringliteral">"Failed to complete"</span>); |
|
511 <a name="l00504"></a>00504 User::Panic(KUserPanic, err); |
|
512 <a name="l00505"></a>00505 } |
|
513 <a name="l00506"></a>00506 <span class="keyword">delete</span> cleanup; |
|
514 <a name="l00507"></a>00507 } |
|
515 <a name="l00508"></a>00508 } |
|
516 <a name="l00509"></a>00509 <span class="keyword">delete</span> scheduler; |
|
517 <a name="l00510"></a>00510 |
|
518 <a name="l00511"></a>00511 __UHEAP_MARKEND; |
|
519 <a name="l00512"></a>00512 <span class="keywordflow">return</span> KErrNone; |
|
520 <a name="l00513"></a>00513 } |
|
521 </pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Thu Jan 21 10:32:54 2010 for TB10.1 Example Applications by |
|
522 <a href="http://www.doxygen.org/index.html"> |
|
523 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> |
|
524 </body> |
|
525 </html> |