author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 21:17:03 +0300 | |
branch | RCL_3 |
changeset 74 | 97232defd20e |
parent 66 | bd7edf625bdd |
child 86 | ed599363c2d7 |
permissions | -rw-r--r-- |
66 | 1 |
/* |
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: event view's container implementation |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
// system includes |
|
19 |
#include <AknLayoutFont.h> |
|
20 |
#include <aknnavide.h> // CAknNavigationDecorator |
|
21 |
#include <AknsBasicBackgroundControlContext.h> |
|
22 |
#include <AknBidiTextUtils.h> |
|
23 |
#include <AknsDrawUtils.h> |
|
24 |
#include <calrrule.h> |
|
25 |
#include <calalarm.h> |
|
26 |
#include <calentry.h> |
|
27 |
#include <calinstance.h> |
|
28 |
#include <NpdApi.h> |
|
29 |
#include <eikappui.h> |
|
30 |
#include <eikdef.h> |
|
31 |
#include <eikedwin.h> |
|
32 |
#include <eikenv.h> |
|
33 |
#include <eikmenup.h> // CEikMenuPane |
|
34 |
#include <eikmfne.h> |
|
35 |
#include <featmgr.h> // FeatureManager |
|
36 |
#include <eikrted.h> // CEikRichTextEditor |
|
37 |
#include <finditemdialog.h> |
|
38 |
#include <StringLoader.h> |
|
39 |
#include <txtrich.h> // CRichText |
|
40 |
#include <gdi.h> |
|
41 |
#include <ItemFinder.h> //Autofinder |
|
42 |
#include <finditemmenu.h> |
|
43 |
#include <finditem.hrh> |
|
44 |
#include <centralrepository.h> |
|
45 |
#include <cenrepnotifyhandler.h> |
|
46 |
#include <CommonUiInternalCRKeys.h> |
|
47 |
#include <calsession.h> |
|
48 |
#include <calencommonui.rsg> |
|
49 |
#include <AknUtils.h> |
|
50 |
#include <avkon.hrh> // EAknCmdHelp |
|
51 |
#include <avkon.mbg> |
|
52 |
#include <avkon.rsg> |
|
53 |
#include <aknlayoutscalable_apps.cdl.h> |
|
54 |
#include <aknnotewrappers.h> |
|
55 |
#include <csxhelp/cale.hlp.hrh> |
|
56 |
#include <calendateutils.h> |
|
57 |
#include <calenagendautils.h> |
|
58 |
#include <CalenInterimUtils2.h> |
|
59 |
#include <calentryview.h> |
|
60 |
#include <calattachment.h> |
|
61 |
#include <calcommon.h> |
|
62 |
#include <calendar.mbg> |
|
63 |
#include <Calendar.rsg> |
|
64 |
#include <centralrepository.h> |
|
65 |
#include <calencommands.hrh> // Calendar commands |
|
66 |
#include <calencontext.h> |
|
67 |
#include <caleninstanceid.h> // TCalenInstanceId |
|
68 |
#include <calenservices.h> |
|
69 |
#include <calentoolbar.h> |
|
70 |
#include <calcalendarinfo.h> |
|
71 |
#include <DocumentHandler.h> |
|
72 |
||
74
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
73 |
#include <bldvariant.hrh> // for feature definitions |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
74 |
|
66 | 75 |
// user includes |
76 |
#include "caleneventviewcontainer.h" |
|
77 |
#include "caleneventview.h" |
|
78 |
#include "calennativeview.h" |
|
79 |
#include "calendarui_debug.h" |
|
80 |
#include "calenicondrawer.h" |
|
81 |
#include "calennotedatautil.h" |
|
82 |
#include "calendar.hrh" |
|
83 |
#include "calenentryutil.h" |
|
84 |
#include "CalenUid.h" // KUidCalendar |
|
85 |
#include <calenlocationutil.h> |
|
86 |
#include "CalendarPrivateCRKeys.h" |
|
87 |
#include "calenattachmentutils.h" |
|
88 |
#include "calenglobaldata.h" |
|
89 |
#include "CleanupResetAndDestroy.h" |
|
90 |
||
91 |
// LOCAL CONSTANTS AND MACROS |
|
92 |
_LIT( KWesternSummaryMarker, "\x200E" ); |
|
93 |
_LIT( KArabicSummaryMarker , "\x200F" ); |
|
94 |
_LIT(KSpace, " "); |
|
95 |
_LIT(KYearFormatString,"%F%Y"); |
|
96 |
_LIT(KAttachmentSeparator,"; "); |
|
97 |
_LIT8( KNotePadTextDataType, "text/plain" ); |
|
98 |
||
99 |
const TInt KDefaultRightMargin=0; |
|
100 |
const TInt KScrollViewerUp = 1; |
|
101 |
const TInt KScrollViewerDown = -1; |
|
102 |
const TInt KMaxDateLength = 32; |
|
103 |
||
104 |
//PANIC CODE |
|
105 |
enum TPanicCode |
|
106 |
{ |
|
107 |
EPanicArrayOfSizeZero=2, |
|
108 |
}; |
|
109 |
||
110 |
// ================= MEMBER FUNCTIONS ========================================= |
|
111 |
||
112 |
// ---------------------------------------------------------------------------- |
|
113 |
// CCalenEventViewContainer::CCalenEventViewContainer |
|
114 |
// C++ constructor. |
|
115 |
// ---------------------------------------------------------------------------- |
|
116 |
// |
|
117 |
CCalenEventViewContainer::CCalenEventViewContainer(CCalenNativeView* aView, |
|
118 |
MCalenServices& aServices ) |
|
119 |
: CCalenContainer( aView, aServices ), |
|
120 |
iEntry(NULL), |
|
121 |
iEmbeddedFileOpened(EFalse) |
|
122 |
{ |
|
123 |
TRACE_ENTRY_POINT; |
|
124 |
iLocaleChanged = EFalse; |
|
125 |
TRACE_EXIT_POINT; |
|
126 |
} |
|
127 |
||
128 |
// ---------------------------------------------------------------------------- |
|
129 |
// CCalenEventViewContainer::~CCalenEventViewContainer |
|
130 |
// Destructor |
|
131 |
// ---------------------------------------------------------------------------- |
|
132 |
// |
|
133 |
CCalenEventViewContainer::~CCalenEventViewContainer() |
|
134 |
{ |
|
135 |
TRACE_ENTRY_POINT; |
|
136 |
||
137 |
if(iEntry) |
|
138 |
{ |
|
139 |
delete iEntry; |
|
140 |
} |
|
141 |
||
142 |
iFetchedEntries.ResetAndDestroy(); |
|
143 |
||
144 |
delete iParaFormat; |
|
145 |
delete iSearchBuf; |
|
146 |
delete iEventViewData; |
|
147 |
delete iTextEditor; |
|
148 |
delete iBgContext; |
|
149 |
delete iTimeFormat; |
|
150 |
delete iDateFormat; |
|
151 |
delete iDocHandler; |
|
152 |
delete iFindMenu; |
|
153 |
||
154 |
if( iNotifier ) |
|
155 |
{ |
|
156 |
iNotifier->StopListening(); |
|
157 |
delete iNotifier; |
|
158 |
}; |
|
159 |
||
160 |
delete iCenRepSession; |
|
161 |
||
162 |
//Reset the attachment posiitons array |
|
163 |
iAttachmentPosInfoArray.Reset(); |
|
164 |
||
74
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
165 |
// Do not call UnInitializeLib() if InitalizeLib() leaves. |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
166 |
if ( iFeatMgrInitialized ) |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
167 |
{ |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
168 |
// Frees the TLS. Must be done after FeatureManager is used. |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
169 |
FeatureManager::UnInitializeLib(); |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
170 |
} |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
171 |
|
66 | 172 |
TRACE_EXIT_POINT; |
173 |
} |
|
174 |
||
175 |
// ---------------------------------------------------------------------------- |
|
176 |
// CCalenEventViewContainer::ConstructImplL |
|
177 |
// Third phase constructor. |
|
178 |
// This function was called CCalenNativeView::ConstructL(). |
|
179 |
// (other items were commented in a header). |
|
180 |
// ---------------------------------------------------------------------------- |
|
181 |
// |
|
182 |
void CCalenEventViewContainer::ConstructImplL() |
|
183 |
{ |
|
184 |
TRACE_ENTRY_POINT; |
|
185 |
||
186 |
iTimeFormat = StringLoader::LoadL( R_QTN_TIME_USUAL_WITH_ZERO, CEikonEnv::Static() ); |
|
187 |
iDateFormat = StringLoader::LoadL( R_QTN_DATE_USUAL_WITH_ZERO, CEikonEnv::Static() ); |
|
188 |
||
189 |
iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, |
|
190 |
Rect(), |
|
191 |
ETrue ); |
|
192 |
||
193 |
iDocHandler = CDocumentHandler::NewL( iEikonEnv->Process() ); |
|
194 |
||
195 |
iFindMenu = CFindItemMenu::NewL( EFindItemMenuPlaceHolder ); |
|
196 |
iFindMenu->AttachItemFinderMenuL(0); |
|
197 |
||
198 |
||
199 |
iParaFormat = CParaFormat::NewL(); |
|
200 |
||
201 |
||
202 |
iTextEditor = new (ELeave) CEikRichTextEditor; |
|
203 |
iTextEditor->ConstructL(this, 0, 0, CEikEdwin::EReadOnly | CEikEdwin::EAvkonDisableCursor | |
|
204 |
CEikEdwin::ENoAutoSelection|CEikEdwin::EAvkonEditor); |
|
205 |
iTextEditor->SetMopParent(this); |
|
206 |
iTextEditor->SetRect( Rect() ); |
|
207 |
||
208 |
||
209 |
iDocHandler->SetExitObserver( this ); |
|
210 |
iTextEditor->EnableKineticScrollingL(ETrue); |
|
74
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
211 |
|
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
212 |
// Sets up TLS, must be done before FeatureManager is used. |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
213 |
FeatureManager::InitializeLibL(); |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
214 |
// Used in destructor. |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
215 |
iFeatMgrInitialized = ETrue; |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
216 |
|
66 | 217 |
TRACE_EXIT_POINT; |
218 |
} |
|
219 |
||
220 |
// ---------------------------------------------------------------------------- |
|
221 |
// CCalenEventViewContainer::UpdateSize |
|
222 |
// Do layout changes after calendar settings are |
|
223 |
// changed. No necessary actions for this view. |
|
224 |
// ---------------------------------------------------------------------------- |
|
225 |
// |
|
226 |
void CCalenEventViewContainer::UpdateSize() |
|
227 |
{ |
|
228 |
TRACE_ENTRY_POINT; |
|
229 |
||
230 |
TRACE_EXIT_POINT; |
|
231 |
} |
|
232 |
||
233 |
// ---------------------------------------------------------------------------- |
|
234 |
// CCalenEventViewContainer::CreateIconIndicesL |
|
235 |
// Second and final stage of population. |
|
236 |
// (other items were commented in a header). |
|
237 |
// ---------------------------------------------------------------------------- |
|
238 |
// |
|
239 |
void CCalenEventViewContainer::CreateIconIndicesL( RArray<MCalenServices::TCalenIcons>& /*aIndexArray*/ ) |
|
240 |
{ |
|
241 |
TRACE_ENTRY_POINT; |
|
242 |
||
243 |
TRACE_EXIT_POINT; |
|
244 |
} |
|
245 |
||
246 |
// ---------------------------------------------------------------------------- |
|
247 |
// CCalenEventViewContainer::CompletePopulationL |
|
248 |
// Complete population |
|
249 |
// (other items were commented in a header). |
|
250 |
// ---------------------------------------------------------------------------- |
|
251 |
// |
|
252 |
void CCalenEventViewContainer::CompletePopulationL() |
|
253 |
{ |
|
254 |
TRACE_ENTRY_POINT; |
|
255 |
||
256 |
iTextEditor->SetFocus(ETrue); |
|
257 |
ActivateL(); |
|
258 |
AddToStackAndMakeVisibleL(); |
|
259 |
DrawDeferred(); |
|
260 |
if(iSelectedText.iCursorPos > 0 || iSelectedText.iAnchorPos > 0) |
|
261 |
{ |
|
262 |
//Set the text selection existed before layout change |
|
263 |
iTextEditor->SetCursorPosL(iSelectedText.iCursorPos, EFalse); |
|
264 |
iTextEditor->SetSelectionL(iSelectedText.iCursorPos,iSelectedText.iAnchorPos); |
|
265 |
} |
|
266 |
TRACE_EXIT_POINT; |
|
267 |
} |
|
268 |
||
269 |
// ---------------------------------------------------------------------------- |
|
270 |
// CCalenEventViewContainer::HandleNaviDecoratorEventL |
|
271 |
// ?implementation_description |
|
272 |
// (other items were commented in a header). |
|
273 |
// ---------------------------------------------------------------------------- |
|
274 |
// |
|
275 |
void CCalenEventViewContainer::HandleNaviDecoratorEventL( TInt /*aEventID*/ ) |
|
276 |
{ |
|
277 |
TRACE_ENTRY_POINT; |
|
278 |
||
279 |
TRACE_EXIT_POINT; |
|
280 |
} |
|
281 |
||
282 |
// ---------------------------------------------------------------------------- |
|
283 |
// CCalenEventViewContainer::HandleLongTapEventL |
|
284 |
// processing of a long tap event |
|
285 |
// (other items were commented in a header). |
|
286 |
// ---------------------------------------------------------------------------- |
|
287 |
// |
|
288 |
void CCalenEventViewContainer::HandleLongTapEventL( const TPoint& /*aPenEventLocation*/, |
|
289 |
const TPoint& /*aPenEventScreenLocation*/ ) |
|
290 |
{ |
|
291 |
TRACE_ENTRY_POINT; |
|
292 |
||
293 |
TRACE_EXIT_POINT; |
|
294 |
} |
|
295 |
||
296 |
// ---------------------------------------------------------------------------- |
|
297 |
// CCalenEventViewContainer::Draw |
|
298 |
// (other items were commented in a header). |
|
299 |
// ---------------------------------------------------------------------------- |
|
300 |
// |
|
301 |
void CCalenEventViewContainer::Draw(const TRect& /*aRect*/) const |
|
302 |
{ |
|
303 |
TRACE_ENTRY_POINT; |
|
304 |
||
305 |
CWindowGc& gc = SystemGc(); |
|
306 |
||
307 |
TRect mainPane; |
|
308 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPane ); |
|
309 |
TRect bgContextRect( TPoint(0, 0), mainPane.Size() ); |
|
310 |
iBgContext->SetRect( bgContextRect); |
|
311 |
iBgContext->SetParentPos(mainPane.iTl); |
|
312 |
AknsDrawUtils::Background( AknsUtils::SkinInstance(), iBgContext, this, gc, Rect()); |
|
313 |
||
314 |
||
315 |
TRACE_EXIT_POINT; |
|
316 |
} |
|
317 |
||
318 |
// ---------------------------------------------------------------------------- |
|
319 |
// CCalenEventViewContainer::Sizechanged |
|
320 |
// Child control was resized. |
|
321 |
// (other items were commented in a header) |
|
322 |
// ---------------------------------------------------------------------------- |
|
323 |
// |
|
324 |
void CCalenEventViewContainer::SizeChanged() |
|
325 |
{ |
|
326 |
TRACE_ENTRY_POINT; |
|
327 |
||
328 |
SetLayoutFromLookAndFeelL(); |
|
329 |
||
330 |
if (iTextEditor) |
|
331 |
{ |
|
332 |
TRAPD(error,iTextEditor->HandleTextChangedL() ); |
|
333 |
if(error!=KErrNone) |
|
334 |
{ |
|
335 |
// Do nothing to avoid warning |
|
336 |
} |
|
337 |
} |
|
338 |
||
339 |
TRACE_EXIT_POINT; |
|
340 |
} |
|
341 |
||
342 |
// ---------------------------------------------------------------------------- |
|
343 |
// CCalenEventViewContainer::CountComponentControls |
|
344 |
// Return child control count. |
|
345 |
// (other items were commented in a header). |
|
346 |
// ---------------------------------------------------------------------------- |
|
347 |
// |
|
348 |
TInt CCalenEventViewContainer::CountComponentControls() const |
|
349 |
{ |
|
350 |
TRACE_ENTRY_POINT; |
|
351 |
TRACE_EXIT_POINT; |
|
352 |
return 1; |
|
353 |
} |
|
354 |
||
355 |
// ---------------------------------------------------------------------------- |
|
356 |
// CCalenEventViewContainer::ComponentControl |
|
357 |
// Return child control pointer. |
|
358 |
// (other items were commented in a header). |
|
359 |
// ---------------------------------------------------------------------------- |
|
360 |
// |
|
361 |
CCoeControl* CCalenEventViewContainer::ComponentControl(TInt aIndex) const // Child control index |
|
362 |
{ |
|
363 |
TRACE_ENTRY_POINT; |
|
364 |
CCoeControl* control ( NULL ); |
|
365 |
switch(aIndex) |
|
366 |
{ |
|
367 |
case 0: |
|
368 |
control = iTextEditor; |
|
369 |
break; |
|
370 |
||
371 |
default: |
|
372 |
__ASSERT_DEBUG( 0, User::Invariant() ); |
|
373 |
break; |
|
374 |
} |
|
375 |
TRACE_EXIT_POINT; |
|
376 |
||
377 |
return control; |
|
378 |
} |
|
379 |
||
380 |
// ---------------------------------------------------------------------------- |
|
381 |
// CCalenEventViewContainer::OfferKeyEventL |
|
382 |
// Process key event. |
|
383 |
// (other items were commented in a header). |
|
384 |
// ---------------------------------------------------------------------------- |
|
385 |
// |
|
386 |
TKeyResponse CCalenEventViewContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) |
|
387 |
{ |
|
388 |
TRACE_ENTRY_POINT; |
|
389 |
||
390 |
TKeyResponse keyResponse(EKeyWasNotConsumed); |
|
391 |
||
392 |
if (aType == EEventKey) |
|
393 |
{ |
|
394 |
switch (aKeyEvent.iCode) |
|
395 |
{ |
|
396 |
case EKeyUpArrow: |
|
397 |
{ |
|
398 |
// Scroll the text view up by one line |
|
399 |
iTextEditor->MakeVisible(EFalse); |
|
400 |
TInt scrollLines = KScrollViewerUp; |
|
401 |
iTextEditor->TextView()->ScrollDisplayLinesL(scrollLines); |
|
402 |
iTextEditor->UpdateScrollBarsL(); |
|
403 |
iTextEditor->MakeVisible(ETrue); |
|
404 |
//Set focus immediately for highlight of auto find text |
|
405 |
iTextEditor->SetFocus(ETrue); |
|
406 |
keyResponse = EKeyWasConsumed; |
|
407 |
} |
|
408 |
break; |
|
409 |
||
410 |
case EKeyDownArrow: |
|
411 |
{ |
|
412 |
// Scroll the text view down by one line |
|
413 |
iTextEditor->MakeVisible(EFalse); |
|
414 |
TInt scrollLines = KScrollViewerDown; |
|
415 |
//text should not be scrolled out of the border |
|
416 |
//introduced based on suggestion from texteditor team |
|
417 |
//to avoid scrolling to invalid lines |
|
418 |
iTextEditor->TextLayout()->RestrictScrollToTopsOfLines(ETrue); |
|
419 |
iTextEditor->TextView()->ScrollDisplayLinesL(scrollLines); |
|
420 |
iTextEditor->TextLayout()->RestrictScrollToTopsOfLines(EFalse); |
|
421 |
iTextEditor->UpdateScrollBarsL(); |
|
422 |
iTextEditor->MakeVisible(ETrue); |
|
423 |
//Set focus immediately for highlight of auto find text |
|
424 |
iTextEditor->SetFocus(ETrue); |
|
425 |
keyResponse = EKeyWasConsumed; |
|
426 |
} |
|
427 |
break; |
|
428 |
||
429 |
case EKeyOK: |
|
430 |
{ |
|
431 |
iView->HandleCommandL(ECalenCmdPromptThenEdit); |
|
432 |
keyResponse = EKeyWasConsumed; |
|
433 |
} |
|
434 |
break; |
|
435 |
case EKeyEscape: |
|
436 |
{ |
|
437 |
// Calendar relaunched from cmd line - close viewer |
|
438 |
iView->HandleCommandL(EAknSoftkeyBack); |
|
439 |
keyResponse = EKeyWasConsumed; |
|
440 |
} |
|
441 |
break; |
|
442 |
case EKeyBackspace: /* fall through... */ |
|
443 |
case EKeyDelete: |
|
444 |
{ |
|
445 |
CCalenEventView* eventView = static_cast<CCalenEventView*>( iView ); |
|
446 |
if( !( eventView->IsAlarmActiveInViewer() ) ) |
|
447 |
{ |
|
448 |
iView->HandleCommandL( ECalenDeleteCurrentEntry ); |
|
449 |
} |
|
450 |
} |
|
451 |
break; |
|
452 |
default: |
|
453 |
break; |
|
454 |
} |
|
455 |
} |
|
456 |
// For handling geokeys on corolla hardware |
|
457 |
// For Add location hard key |
|
458 |
if( aKeyEvent.iScanCode == EStdKeyApplication1C && aType == EEventKeyUp ) |
|
459 |
{ |
|
460 |
if(CCalenLocationUtil::IsMapProviderAvailableL()) |
|
461 |
{ |
|
462 |
CCalEntry::TType entryType = iEntry->EntryTypeL(); |
|
463 |
if(entryType == CCalEntry::EAppt) |
|
464 |
{ |
|
465 |
iServices.IssueCommandL(ECalenGetLocationAndSave); |
|
466 |
} |
|
467 |
keyResponse = EKeyWasConsumed; |
|
468 |
} |
|
469 |
} |
|
470 |
// For Show location hard key |
|
471 |
else if( aKeyEvent.iScanCode == EStdKeyApplication1B && aType == EEventKeyUp ) |
|
472 |
{ |
|
473 |
if(CCalenLocationUtil::IsMapProviderAvailableL()) |
|
474 |
{ |
|
475 |
CCalEntry::TType entryType = iEntry->EntryTypeL(); |
|
476 |
if(entryType == CCalEntry::EAppt) |
|
477 |
{ |
|
478 |
TPtrC location = iEntry->LocationL(); |
|
479 |
if(iEntry->GeoValueL()) |
|
480 |
{ |
|
481 |
iServices.IssueCommandL(ECalenShowLocation); |
|
482 |
keyResponse = EKeyWasConsumed; |
|
483 |
} |
|
484 |
else if(location.Length()) |
|
485 |
{ |
|
486 |
iServices.IssueCommandL(ECalenGetLocationAndReplace); |
|
487 |
} |
|
488 |
else |
|
489 |
{ |
|
490 |
iServices.IssueCommandL(ECalenShowLocationQuery); |
|
491 |
} |
|
492 |
keyResponse = EKeyWasConsumed; |
|
493 |
} |
|
494 |
} |
|
495 |
} |
|
496 |
// Swallow all other keyevents to prevent the active container processing them. |
|
497 |
keyResponse = EKeyWasConsumed; |
|
498 |
||
499 |
TRACE_EXIT_POINT; |
|
500 |
return keyResponse; |
|
501 |
||
502 |
||
503 |
} |
|
504 |
||
505 |
||
506 |
// ---------------------------------------------------------------------------- |
|
507 |
// CCalenEventViewContainer::HandlePointerEventL |
|
508 |
// Process pointer event. |
|
509 |
// (other items were commented in a header). |
|
510 |
// ---------------------------------------------------------------------------- |
|
511 |
// |
|
512 |
void CCalenEventViewContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
513 |
{ |
|
514 |
TRACE_ENTRY_POINT; |
|
515 |
||
516 |
if(!AknLayoutUtils::PenEnabled()) |
|
517 |
{ |
|
518 |
return; |
|
519 |
} |
|
520 |
CCalenContainer::HandlePointerEventL( aPointerEvent ); |
|
521 |
||
522 |
if(iTextEditor->Rect().Contains(aPointerEvent.iPosition)) |
|
523 |
{ |
|
524 |
switch(aPointerEvent.iType) |
|
525 |
{ |
|
526 |
case TPointerEvent::EButton1Down: |
|
527 |
{ |
|
528 |
iTextEditor->SetFocus(ETrue); |
|
529 |
CCalenEventView* eventView = static_cast<CCalenEventView*>( iView ); |
|
530 |
if(!( eventView->IsAlarmActiveInViewer() ) ) |
|
531 |
{ |
|
532 |
// TODO: Uncomment this when enabling attachment support |
|
533 |
if(iEventViewData && !iEmbeddedFileOpened) |
|
534 |
{ |
|
535 |
if(iEventViewData->AttachmentCount()) |
|
536 |
{ |
|
537 |
CTextView *textView = iTextEditor->TextView(); |
|
538 |
||
539 |
TTmPosInfo2 *posInfo = new(ELeave) TTmPosInfo2; |
|
540 |
textView->FindXyPosL(aPointerEvent.iPosition,*posInfo); |
|
541 |
||
542 |
// Check if it is tapped on any attachment name, if yes then open that attachment |
|
543 |
CheckAndOpenTappedAttachmentL(posInfo); |
|
544 |
delete posInfo; |
|
545 |
} |
|
546 |
} |
|
547 |
} |
|
548 |
break; |
|
549 |
} |
|
550 |
case TPointerEvent::EDrag: |
|
551 |
{ |
|
552 |
iTextEditor->SetFocus(ETrue); |
|
553 |
break; |
|
554 |
} |
|
555 |
case TPointerEvent::EButton1Up: |
|
556 |
{ |
|
557 |
iTextEditor->SetFocus(ETrue); |
|
558 |
TInt curPos = iTextEditor->CursorPos(); |
|
559 |
TRect rect = iTextEditor->Rect(); |
|
560 |
||
561 |
break; |
|
562 |
} |
|
563 |
default: |
|
564 |
{ |
|
565 |
break; |
|
566 |
} |
|
567 |
} |
|
568 |
} |
|
569 |
||
570 |
TRACE_EXIT_POINT; |
|
571 |
} |
|
572 |
||
573 |
// ---------------------------------------------------------------------------- |
|
574 |
// CCalenEventViewContainer::GetHelpContext |
|
575 |
// Get help context. |
|
576 |
// (other items were commented in a header). |
|
577 |
// ---------------------------------------------------------------------------- |
|
578 |
// |
|
579 |
void CCalenEventViewContainer::GetHelpContext(TCoeHelpContext& aContext) const |
|
580 |
{ |
|
581 |
TRACE_ENTRY_POINT; |
|
582 |
||
583 |
aContext.iMajor = KUidCalendar; |
|
584 |
aContext.iContext = KCALE_HLP_NOTE_VIEWER; // need to change |
|
585 |
||
586 |
TRACE_EXIT_POINT; |
|
587 |
} |
|
588 |
||
589 |
// ---------------------------------------------------------------------------- |
|
590 |
// CCalenEventViewContainer::HandleResourceChange |
|
591 |
// Handles a resource relative event. |
|
592 |
// (other items were commented in a header). |
|
593 |
// ---------------------------------------------------------------------------- |
|
594 |
// |
|
595 |
void CCalenEventViewContainer::HandleResourceChange(TInt aType) |
|
596 |
{ |
|
597 |
TRACE_ENTRY_POINT; |
|
598 |
||
599 |
CCalenContainer::HandleResourceChange( aType ); |
|
600 |
||
601 |
if( ( aType == KUidValueCoeColorSchemeChangeEvent ) || |
|
602 |
( aType == KUidValueCoeZoomChangeEvent ) || |
|
603 |
( aType == KUidValueCoeFontChangeEvent ) ) |
|
604 |
{ |
|
605 |
// CEikAppUi* appUi = static_cast<CEikAppUi*>( ControlEnv()->AppUi() ); |
|
606 |
// SetRect( appUi->ClientRect() ); |
|
607 |
TRect mainPane; |
|
608 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPane ); |
|
609 |
SetRect( mainPane ); |
|
610 |
} |
|
611 |
||
612 |
if( KAknsMessageSkinChange == aType || |
|
613 |
KEikDynamicLayoutVariantSwitch == aType ) |
|
614 |
{ |
|
615 |
SizeChanged(); |
|
616 |
SetupFontL(); |
|
617 |
if(iTextEditor->ScrollBarFrame()) |
|
618 |
{ |
|
619 |
// make the scrollbars invisible |
|
620 |
iTextEditor->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, |
|
621 |
CEikScrollBarFrame::EOff); |
|
622 |
} |
|
623 |
||
624 |
// refresh |
|
625 |
TRAPD( error, iView->BeginRepopulationL() ); |
|
626 |
if( KErrNone != error ) |
|
627 |
{ |
|
628 |
// To avoid warning. |
|
629 |
} |
|
630 |
} |
|
631 |
||
632 |
// Allow the coecontrol to handle the changes if any. |
|
633 |
CCoeControl::HandleResourceChange( aType ); |
|
634 |
||
635 |
TRACE_EXIT_POINT; |
|
636 |
} |
|
637 |
||
638 |
// ---------------------------------------------------------------------------- |
|
639 |
// CCalenEventViewContainer::BuildTextEditorL |
|
640 |
// Build text editor |
|
641 |
// (other items were commented in a header). |
|
642 |
// ---------------------------------------------------------------------------- |
|
643 |
// |
|
644 |
void CCalenEventViewContainer::BuildTextEditorL() |
|
645 |
{ |
|
646 |
TRACE_ENTRY_POINT; |
|
647 |
||
648 |
iTextEditor->SetFocus(EFalse); |
|
649 |
iTextEditor->SetRect( Rect() ); |
|
650 |
iTextEditor->SetCursorPosL(0,EFalse); |
|
651 |
iTextEditor->RichText()->Reset(); |
|
652 |
||
653 |
// Create the scroll bars. |
|
654 |
iTextEditor->CreateScrollBarFrameL(); |
|
655 |
iTextEditor->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); |
|
656 |
iTextEditor->SetAknEditorFlags(EAknEditorFlagEnableScrollBars); |
|
657 |
iTextEditor->ScrollBarFrame()->VerticalScrollBar()->SetMopParent(this); |
|
658 |
||
659 |
iTextEditor->ScrollBarFrame()->SetScrollBarFrameObserver(this); |
|
660 |
||
661 |
TEikScrollBarModel h,v; |
|
662 |
TEikScrollBarFrameLayout lay; |
|
663 |
CEikAppUi* appUi = static_cast<CEikAppUi*>( ControlEnv()->AppUi() ); |
|
664 |
TRect rec = appUi->ClientRect(); |
|
665 |
// ASSERT( iTextEditor->ScrollBarFrame()->TileL( &h, &v, rec, rec, lay) ); |
|
666 |
||
667 |
SetLayoutFromLookAndFeelL(); |
|
668 |
||
669 |
SetupFontL(); |
|
670 |
||
671 |
TRACE_EXIT_POINT; |
|
672 |
} |
|
673 |
||
674 |
// ---------------------------------------------------------------------------- |
|
675 |
// CCalenEventViewContainer::SetIconsL |
|
676 |
// Set the icons |
|
677 |
// (other items were commented in a header). |
|
678 |
// ---------------------------------------------------------------------------- |
|
679 |
// |
|
680 |
void CCalenEventViewContainer::SetIconsL(CCalenIconDrawer* aIconDrawer) |
|
681 |
{ |
|
682 |
// Create a TPictureHeader to insert our icons into the viewer |
|
683 |
TPictureHeader header; |
|
684 |
header.iPicture = TSwizzle<CPicture>(aIconDrawer); |
|
685 |
||
686 |
// Insert the icon drawer into the Rich Text Editor. This takes |
|
687 |
// ownership of the icon drawer. |
|
688 |
// Insert at index 0 in the document to cause the icons to be drawn when |
|
689 |
// the first line is visible. The icons will not be drawn at position 0, |
|
690 |
// but this position must be on the screen for the icons to be drawn. |
|
691 |
iTextEditor->RichText()->InsertL( 0, header ); |
|
692 |
||
693 |
// Tell the text editor that it has been updated. This will cause |
|
694 |
// a redraw. |
|
695 |
iTextEditor->HandleTextChangedL(); |
|
696 |
} |
|
697 |
||
698 |
// ---------------------------------------------------------------------------- |
|
699 |
// CCalenEventViewContainer::CreateAndInitializeIconsDrawerL |
|
700 |
// Cretaes the CCalenIconDrawer object for the container and returns it |
|
701 |
// (other items were commented in a header). |
|
702 |
// ---------------------------------------------------------------------------- |
|
703 |
// |
|
704 |
CCalenIconDrawer* CCalenEventViewContainer::CreateAndInitializeIconsDrawerL() |
|
705 |
{ |
|
706 |
// Create and populate the icon drawer. We need to do this first to prevent a long |
|
707 |
// summary text being drawn over the icons |
|
708 |
// Ownership of icon drawer transferred to rich text editor |
|
709 |
CCalenIconDrawer* iconDrawer = CCalenIconDrawer::NewL( iServices ); |
|
710 |
PopulateIconDrawerL(*iconDrawer); |
|
711 |
return iconDrawer; |
|
712 |
} |
|
713 |
// ---------------------------------------------------------------------------- |
|
714 |
// CCalenEventViewContainer::RequestInstanceViewL |
|
715 |
// Request for instance view |
|
716 |
// (other items were commented in a header). |
|
717 |
// ---------------------------------------------------------------------------- |
|
718 |
// |
|
719 |
TInt CCalenEventViewContainer::RequestInstanceViewL() |
|
720 |
{ |
|
721 |
TRACE_ENTRY_POINT; |
|
722 |
||
723 |
MCalenContext& context = iServices.Context(); |
|
724 |
TCalenInstanceId instanceId = context.InstanceId(); |
|
725 |
TCalLocalUid entryLocalUid = instanceId.iEntryLocalUid; |
|
726 |
TTime instanceStartTime = context.InstanceId().iInstanceTime; |
|
727 |
||
728 |
if(iEntry) |
|
729 |
{ |
|
730 |
delete iEntry; |
|
731 |
iEntry = NULL; |
|
732 |
} |
|
733 |
//If the timezone is changed after opening the viewer |
|
734 |
//We need to use the new instance time and need to update the context later |
|
735 |
// Get the active collection ids. |
|
736 |
RArray<TInt> colIdArray; |
|
737 |
CCalenNativeView::GetActiveCollectionidsL( iServices, colIdArray ); |
|
738 |
||
739 |
CCalInstanceView* instanceView = NULL; |
|
740 |
if(iLocaleChanged) |
|
741 |
{ |
|
742 |
instanceView = iServices.InstanceViewL(colIdArray); |
|
743 |
CCalInstance* instance = FindPossibleInstanceL( instanceId,*instanceView ); |
|
744 |
if(instance) |
|
745 |
{ |
|
746 |
instanceStartTime = instance->StartTimeL().TimeLocalL(); |
|
747 |
} |
|
748 |
} |
|
749 |
colIdArray.Reset(); |
|
750 |
||
751 |
iEntry = iServices.EntryViewL(context.InstanceId().iColId)->FetchL(entryLocalUid); |
|
752 |
||
753 |
TCalTime instanceDateTime; |
|
754 |
instanceDateTime.SetTimeLocalL( context.InstanceId().iInstanceTime ); |
|
755 |
||
756 |
if(!iEntry) |
|
757 |
{ |
|
758 |
// If the entry is not let's not further proceed. |
|
759 |
// The entry has been removed by some other app eg. Synch. |
|
760 |
return KErrNotFound; |
|
761 |
} |
|
762 |
||
763 |
if(iEventViewData) |
|
764 |
{ |
|
765 |
delete iEventViewData; |
|
766 |
iEventViewData = NULL; |
|
767 |
} |
|
768 |
iEventViewData = CCalenEntryUtil::NewL( *iEntry, instanceDateTime ); |
|
769 |
||
770 |
//If timezone is changed after opening the entry in the viewer |
|
771 |
//we need to update the instance id to the context |
|
772 |
if(iLocaleChanged) |
|
773 |
{ |
|
774 |
iLocaleChanged = EFalse; |
|
775 |
instanceId.iInstanceTime = instanceStartTime; |
|
776 |
context.SetFocusDateAndTimeAndInstanceL( instanceDateTime,instanceId,TVwsViewId( KUidCalendar, KUidCalenEventView ) ); |
|
777 |
} |
|
778 |
TRACE_EXIT_POINT; |
|
779 |
return KErrNone; |
|
780 |
} |
|
781 |
||
782 |
// ---------------------------------------------------------------------------- |
|
783 |
// CCalenEventViewContainer::AddFieldsL |
|
784 |
// Add the data fields |
|
785 |
// (other items were commented in a header). |
|
786 |
// ---------------------------------------------------------------------------- |
|
787 |
// |
|
788 |
void CCalenEventViewContainer::AddFieldsL() |
|
789 |
{ |
|
790 |
TRACE_ENTRY_POINT; |
|
791 |
// Initialize icon drawer |
|
792 |
CCalenIconDrawer* iconDrawer = CreateAndInitializeIconsDrawerL(); |
|
793 |
||
794 |
// add subject field |
|
795 |
AddSubjectFieldL(); |
|
796 |
||
797 |
switch ( iEntry->EntryTypeL() ) |
|
798 |
{ |
|
799 |
case CCalEntry::EReminder: |
|
800 |
case CCalEntry::EAppt: |
|
801 |
{ |
|
802 |
// start time |
|
803 |
AddTimeFieldL(); |
|
804 |
||
805 |
// location |
|
806 |
AddLocationFieldL(); |
|
807 |
||
808 |
// Adds empty line |
|
809 |
AddEmptyLineL(); |
|
810 |
||
811 |
// alarm |
|
812 |
AddAlarmDateTimeFieldL(); |
|
813 |
||
814 |
// We want to show the repeat fields for repeating parent entries or |
|
815 |
// child entries. If the entry is a child then the repeat information from the |
|
816 |
// parent will be shown |
|
817 |
//if ((iEventViewData->IsRepeating()) || (Handler().Edited()->Entry().RecurrenceIdL().TimeUtcL() != Time::NullTTime())) |
|
818 |
if ((iEventViewData->IsRepeating()) || (iEntry->RecurrenceIdL().TimeUtcL() != Time::NullTTime())) |
|
819 |
{ |
|
820 |
AddRepeatFieldL(); |
|
821 |
} |
|
822 |
||
823 |
iTitleTextId = R_CALEN_EVENT_VIEW_MEETING_TITLE; |
|
824 |
} |
|
825 |
break; |
|
826 |
||
827 |
case CCalEntry::EAnniv: |
|
828 |
{ |
|
829 |
// date field |
|
74
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
830 |
if ( FeatureManager::FeatureSupported( KFeatureIdKorean ) ) |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
831 |
{ |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
832 |
AddDateFieldL( iServices.Infobar() ); |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
833 |
} |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
834 |
else |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
835 |
{ |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
836 |
AddDateFieldL( iEventViewData->StartDateTime() ); |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
837 |
} |
66 | 838 |
|
839 |
// against the location field in the viewer |
|
840 |
iTimeFieldLines = 1; |
|
841 |
// location |
|
842 |
AddLocationFieldL(); |
|
843 |
||
844 |
// Adds empty line |
|
845 |
AddEmptyLineL(); |
|
846 |
||
847 |
// alarm |
|
848 |
AddAlarmDateTimeFieldL(); |
|
849 |
||
850 |
// Add the 'since' field. |
|
851 |
AddSinceFieldL(); |
|
852 |
||
853 |
iTitleTextId = R_CALEN_EVENT_VIEW_ANNIV_TITLE; |
|
854 |
} |
|
855 |
break; |
|
856 |
||
857 |
case CCalEntry::EEvent: |
|
858 |
{ |
|
859 |
// If the start time is on the same day as the end time, just show the date. |
|
860 |
// Otherwise, show "start date - end date". |
|
861 |
TTime startTime = iEventViewData->StartDateTime(); |
|
862 |
TTime endTime = iEventViewData->EndDateTime(); |
|
863 |
||
864 |
// For allday (1 day) event Eg. "Start:- 12:00am, 15-08-2010 & End:-12:00am, 16-08-2010" |
|
865 |
// In viewer it should be displayed as "StartDate: 15-08-2010 & EndDate:15-08-2010" |
|
866 |
// No time filed is displayed. |
|
867 |
endTime -= TTimeIntervalDays( 1 ); |
|
868 |
||
869 |
// Set title to 'ALL DAY' |
|
870 |
iTitleTextId = R_CALEN_EVENT_VIEW_ALLDAY_TITLE; |
|
871 |
||
872 |
if( CalenDateUtils::OnSameDay(startTime, endTime) ) |
|
873 |
{ |
|
874 |
AddDateFieldL( startTime ); |
|
875 |
} |
|
876 |
else |
|
877 |
{ |
|
878 |
AddDateDateFieldL( startTime, endTime ); |
|
879 |
} |
|
880 |
||
881 |
// Increment the time filed count to 1 so that maps icon is placed |
|
882 |
// against the location field in the viewer |
|
883 |
iTimeFieldLines = 1; |
|
884 |
||
885 |
// location |
|
886 |
AddLocationFieldL(); |
|
887 |
||
888 |
// extra empty line between primary and secondary information |
|
889 |
AddEmptyLineL(); |
|
890 |
||
891 |
// alarm |
|
892 |
AddAlarmDateTimeFieldL(); |
|
893 |
||
894 |
// Currently it's not possible to create a repeating day note in the UI. |
|
895 |
// However, it is possible to import one from an iCalendar file or create |
|
896 |
// one in code. Therefore the repeat properties of day notes are shown |
|
897 |
// if they exist. If the entry is modified (in the editor), the repeat |
|
898 |
// properties will be lost. |
|
899 |
if(iEventViewData->IsRepeating()) |
|
900 |
{ |
|
901 |
AddRepeatFieldL(); |
|
902 |
} |
|
903 |
||
904 |
} |
|
905 |
break; |
|
906 |
||
907 |
case CCalEntry::ETodo: |
|
908 |
{ |
|
909 |
// extra empty line between primary and secondary information |
|
910 |
AddEmptyLineL(); |
|
911 |
||
912 |
// Due date |
|
913 |
TTime dueDate = iEventViewData->EventDateTime(); |
|
914 |
AddDateFieldL(R_QTN_CALE_EVENT_VIEW_DUE_DATE, dueDate); |
|
915 |
// Adds empty line |
|
916 |
AddEmptyLineL(); |
|
917 |
||
918 |
//Adds calendar info field to the viewer |
|
919 |
//AddCalendarInfoFieldL(); |
|
920 |
||
921 |
// Adds empty line |
|
922 |
//AddEmptyLineL(); |
|
923 |
||
924 |
// Alarm is only shown if the todo is not complete. |
|
925 |
//if (Handler().Entry().StatusL() != CCalEntry::ETodoCompleted) |
|
926 |
if (iEntry->StatusL() != CCalEntry::ETodoCompleted) |
|
927 |
{ |
|
928 |
AddAlarmDateTimeFieldL(); |
|
929 |
} |
|
930 |
||
931 |
// Show completion date if complete |
|
932 |
else |
|
933 |
{ |
|
934 |
AddDateFieldL(R_QTN_CALE_EVENT_VIEW_COMPLETED, iEntry->CompletedTimeL().TimeLocalL()); |
|
935 |
} |
|
936 |
||
937 |
// Priority |
|
938 |
AddPriorityFieldL(); |
|
939 |
||
940 |
// Repeat rules. Supporting repeating todos sounds like asking for trouble to me. |
|
941 |
if (iEventViewData->IsRepeating()) |
|
942 |
{ |
|
943 |
AddRepeatFieldL(); |
|
944 |
} |
|
945 |
||
946 |
iTitleTextId = R_CALEN_EVENT_VIEW_TODO_TITLE; |
|
947 |
} |
|
948 |
break; |
|
949 |
||
950 |
default: |
|
951 |
__ASSERT_DEBUG(EFalse, User::Invariant()); |
|
952 |
break; |
|
953 |
} |
|
954 |
if(IsEventHasMapLocationL()) |
|
955 |
{ |
|
956 |
// Update iNumOfLinesBeforeLocField |
|
957 |
||
958 |
// Add map icon to the icon drawer |
|
959 |
iconDrawer->AddIconL( MCalenServices::ECalenMapIcon ); |
|
960 |
||
961 |
// Set the icon sizes |
|
962 |
iconDrawer->SetIconSizesFromLayout(); |
|
963 |
} |
|
964 |
SetIconsL(iconDrawer); |
|
965 |
||
966 |
// Add Description |
|
967 |
AddDescriptionFieldL(); |
|
968 |
||
969 |
// Add attachment field |
|
970 |
// TODO: Uncomment this when enabling attachment support |
|
971 |
||
972 |
if(iEventViewData->AttachmentCount()) |
|
973 |
{ |
|
974 |
AddAttachmentFieldL(); |
|
975 |
} |
|
976 |
||
977 |
TRACE_EXIT_POINT; |
|
978 |
} |
|
979 |
||
980 |
// ---------------------------------------------------------------------------- |
|
981 |
// CCalenEventViewContainer::SetLayoutFromLookAndFeelL |
|
982 |
// Set the layout data |
|
983 |
// (other items were commented in a header). |
|
984 |
// ---------------------------------------------------------------------------- |
|
985 |
// |
|
986 |
void CCalenEventViewContainer::SetLayoutFromLookAndFeelL() |
|
987 |
{ |
|
988 |
TRACE_ENTRY_POINT; |
|
989 |
||
990 |
iParaFormat->Reset(); |
|
991 |
iParaFormatMask.ClearAll(); |
|
992 |
iCharFormatMask.ClearAll(); |
|
993 |
||
994 |
iParaFormatMask.SetAttrib(EAttLeftMargin); |
|
995 |
iParaFormatMask.SetAttrib(EAttRightMargin); |
|
996 |
||
997 |
// Get the main pane |
|
998 |
TSize main_pane_size; |
|
999 |
AknLayoutUtils::LayoutMetricsSize (AknLayoutUtils::EMainPane, main_pane_size); |
|
1000 |
TRect main_pane(main_pane_size); |
|
1001 |
||
1002 |
// Get main_cale_event_viewer_pane with main_pane as parent |
|
1003 |
TAknLayoutRect main_cale_event_viewer_pane; |
|
1004 |
main_cale_event_viewer_pane.LayoutRect(main_pane, AknLayoutScalable_Apps::main_cale_event_viewer_pane().LayoutLine() ); |
|
1005 |
||
1006 |
// Get listscroll_cale_event_viewer_pane with main_cale_event_viewer_pane as parent |
|
1007 |
TAknLayoutRect listscroll_cale_event_viewer_pane; |
|
1008 |
listscroll_cale_event_viewer_pane.LayoutRect(main_cale_event_viewer_pane.Rect(), AknLayoutScalable_Apps::listscroll_cale_event_viewer_pane().LayoutLine() ); |
|
1009 |
||
1010 |
// Get list_cale_ev2_pane with listscroll_cale_event_viewer_pane as parent |
|
1011 |
TAknLayoutRect list_cale_ev2_pane; |
|
1012 |
list_cale_ev2_pane.LayoutRect(listscroll_cale_event_viewer_pane.Rect(), AknLayoutScalable_Apps::list_cale_ev2_pane().LayoutLine() ); |
|
1013 |
||
1014 |
// Get the main pane |
|
1015 |
TAknLayoutRect main_cale_day_pane; |
|
1016 |
main_cale_day_pane.LayoutRect( Rect(), |
|
1017 |
AknLayoutScalable_Apps::main_cale_day_pane().LayoutLine() ); |
|
1018 |
||
1019 |
TAknLayoutRect listscroll_cale_day_pane; |
|
1020 |
listscroll_cale_day_pane.LayoutRect( main_cale_day_pane.Rect(), |
|
1021 |
AknLayoutScalable_Apps::listscroll_cale_day_pane( 0 ).LayoutLine() ); |
|
1022 |
||
1023 |
||
1024 |
// Listbox layout |
|
1025 |
TAknLayoutRect list_cale_pane; |
|
1026 |
list_cale_pane.LayoutRect( main_cale_day_pane.Rect(), AknLayoutScalable_Apps::list_cale_pane( 3 ).LayoutLine() ); |
|
1027 |
||
1028 |
// Adjust the rect to show the map icon if necessary |
|
1029 |
TRect temp_list_cale_ev2_pane = list_cale_pane.Rect(); |
|
1030 |
||
1031 |
||
1032 |
iTextEditor->SetRect(temp_list_cale_ev2_pane); |
|
1033 |
||
1034 |
// Scrollbar layout |
|
1035 |
AknLayoutUtils::LayoutVerticalScrollBar( iTextEditor->ScrollBarFrame(), |
|
1036 |
listscroll_cale_day_pane.Rect(), |
|
1037 |
AknLayoutScalable_Apps::scroll_pane_cp09( 3 ).LayoutLine() ); |
|
1038 |
||
1039 |
// Get field_cale_ev2_pane with list_cale_ev2_pane as parent |
|
1040 |
TAknLayoutRect field_cale_ev2_pane; |
|
1041 |
field_cale_ev2_pane.LayoutRect(list_cale_ev2_pane.Rect(), AknLayoutScalable_Apps::field_cale_ev2_pane(0).LayoutLine() ); |
|
1042 |
||
1043 |
// Get field_cale_ev2_pane_t1 |
|
1044 |
TAknTextLineLayout field_cale_ev2_pane_t1 = AknLayoutScalable_Apps::field_cale_ev2_pane_t1(0).LayoutLine(); |
|
1045 |
||
1046 |
// Get heading layout properties from field_cale_ev2_pane_t1 with list_cale_ev2_pane as parent |
|
1047 |
TAknLayoutText headingTextLayout; |
|
1048 |
headingTextLayout.LayoutText(list_cale_ev2_pane.Rect(), field_cale_ev2_pane_t1); |
|
1049 |
||
1050 |
// Set heading indenting and font |
|
1051 |
if (!AknLayoutUtils::LayoutMirrored()) |
|
1052 |
{ |
|
1053 |
// Normal L-R layout. |
|
1054 |
// Heading indent is heading text layout rect left x pos - |
|
1055 |
// text editor rect left xpos. The heading text layout rect gives us an absolute |
|
1056 |
// screen position, but the value that we need should be relative to |
|
1057 |
// the text editor itself |
|
1058 |
TInt headingIndentPixels = headingTextLayout.TextRect().iTl.iX - |
|
1059 |
list_cale_ev2_pane.Rect().iTl.iX; |
|
1060 |
iHeadingIndent = PixelsToTwips(headingIndentPixels); |
|
1061 |
} |
|
1062 |
else |
|
1063 |
{ |
|
1064 |
// Mirrored, R-L layout. |
|
1065 |
// Heading indent is the text editor rect right x pos - |
|
1066 |
// the heading text layout rect right x pos |
|
1067 |
TInt headingIndentPixels = list_cale_ev2_pane.Rect().iBr.iX - |
|
1068 |
headingTextLayout.TextRect().iBr.iX; |
|
1069 |
iHeadingIndent = PixelsToTwips(headingIndentPixels); |
|
1070 |
} |
|
1071 |
||
1072 |
iHeadingFontSpec = headingTextLayout.Font()->FontSpecInTwips(); |
|
1073 |
iHeadingFontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightBold); |
|
1074 |
iEmptyLineHeight = PixelsToTwips(headingTextLayout.TextRect().Height() / 2); |
|
1075 |
iHeadingFont = headingTextLayout.Font(); |
|
1076 |
||
1077 |
// Get field_cale_ev2_pane_t2 |
|
1078 |
TAknTextLineLayout field_cale_ev2_pane_t2 = AknLayoutScalable_Apps::field_cale_ev2_pane_t2(1).LayoutLine(); |
|
1079 |
||
1080 |
// Get body layout properties from field_cale_ev2_pane_t2 // with field_ev_content_pane as parent |
|
1081 |
TAknLayoutText bodyTextLayout; |
|
1082 |
bodyTextLayout.LayoutText(list_cale_ev2_pane.Rect(), field_cale_ev2_pane_t2); |
|
1083 |
iMaxWidth = bodyTextLayout.TextRect().Width(); |
|
1084 |
||
1085 |
// Set body indenting and font |
|
1086 |
if (!AknLayoutUtils::LayoutMirrored()) |
|
1087 |
{ |
|
1088 |
// Normal L-R layout. |
|
1089 |
// Body text indent is body text layout rect left x pos - |
|
1090 |
// text editor rect left xpos. The heading text layout rect gives us an absolute |
|
1091 |
// screen position, but the value that we need should be relative to |
|
1092 |
// the text editor itself |
|
1093 |
TInt bodyIndentPixels = bodyTextLayout.TextRect().iTl.iX - |
|
1094 |
list_cale_ev2_pane.Rect().iTl.iX; |
|
1095 |
iBodyIndent = PixelsToTwips(bodyIndentPixels); |
|
1096 |
} |
|
1097 |
else |
|
1098 |
{ |
|
1099 |
// Mirrored, R-L layout. |
|
1100 |
// Body indent is the text editor rect right x pos - |
|
1101 |
// the body text layout rect right x pos |
|
1102 |
TInt bodyIndentPixels = list_cale_ev2_pane.Rect().iBr.iX - |
|
1103 |
bodyTextLayout.TextRect().iBr.iX; |
|
1104 |
iBodyIndent = PixelsToTwips(bodyIndentPixels); |
|
1105 |
} |
|
1106 |
||
1107 |
iBodyFontSpec = bodyTextLayout.Font()->FontSpecInTwips(); |
|
1108 |
iBodyFont = bodyTextLayout.Font(); // Used for TryToFitL |
|
1109 |
||
1110 |
TRACE_EXIT_POINT; |
|
1111 |
} |
|
1112 |
||
1113 |
// ---------------------------------------------------------------------------- |
|
1114 |
// CCalenEventViewContainer::SetupFontL |
|
1115 |
// Set the font colour, and set default para/char format layers to the |
|
1116 |
// rich text editor. |
|
1117 |
// (other items were commented in a header). |
|
1118 |
// ---------------------------------------------------------------------------- |
|
1119 |
// |
|
1120 |
void CCalenEventViewContainer::SetupFontL() |
|
1121 |
{ |
|
1122 |
TRACE_ENTRY_POINT; |
|
1123 |
||
1124 |
// Set desired character formatting attributes. Gets sensible text colour based on theme. |
|
1125 |
TRgb textColourFromSkin(255,0,0); // If you see bright red text, the skins api is broken! |
|
1126 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance(); // Does not transfer ownership. |
|
1127 |
AknsUtils::GetCachedColor(skin, textColourFromSkin, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6); |
|
1128 |
||
1129 |
TCharFormat charFormat; |
|
1130 |
TCharFormatMask charFormatMask; |
|
1131 |
// Set the text colour we found. |
|
1132 |
charFormat.iFontPresentation.iTextColor = TLogicalRgb(textColourFromSkin); |
|
1133 |
charFormatMask.SetAttrib(EAttColor); |
|
1134 |
||
1135 |
// Set up our paragraph formatting attributes. |
|
1136 |
CParaFormat* paraFormat = CParaFormat::NewLC(); |
|
1137 |
TParaFormatMask paraFormatMask; |
|
1138 |
||
1139 |
// Set up the default font so it's the same as the body text used. |
|
1140 |
// This means we can do without setting the para/char format layers |
|
1141 |
// when adding body text. |
|
1142 |
paraFormat->iLeftMarginInTwips = iBodyIndent; |
|
1143 |
paraFormatMask.SetAttrib(EAttLeftMargin); |
|
1144 |
paraFormatMask.SetAttrib(EAttRightMargin); |
|
1145 |
||
1146 |
charFormat.iFontSpec = iBodyFontSpec; |
|
1147 |
charFormatMask.SetAttrib(EAttFontHeight); |
|
1148 |
charFormatMask.SetAttrib(EAttFontTypeface); |
|
1149 |
charFormatMask.SetAttrib(EAttFontStrokeWeight); |
|
1150 |
||
1151 |
// Create some format layers based on the attributes we specified above. |
|
1152 |
// The underlying Edwin will take ownership of the format objects created below, so don't need to delete. |
|
1153 |
CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL(paraFormat, paraFormatMask); |
|
1154 |
CleanupStack::PushL(paraFormatLayer); |
|
1155 |
CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL(charFormat, charFormatMask); |
|
1156 |
CleanupStack::Pop(paraFormatLayer); |
|
1157 |
||
1158 |
// Set the format layers. |
|
1159 |
iTextEditor->SetParaFormatLayer(paraFormatLayer); |
|
1160 |
iTextEditor->SetCharFormatLayer(charFormatLayer); |
|
1161 |
||
1162 |
// And get rid of paraFormat. All other allocations are owned by the CEikRichTextEditor. |
|
1163 |
CleanupStack::PopAndDestroy(paraFormat); |
|
1164 |
||
1165 |
TRACE_EXIT_POINT; |
|
1166 |
} |
|
1167 |
||
1168 |
// ----------------------------------------------------------------------------- |
|
1169 |
// CCalenViewerBase::PopulateIconDrawerL |
|
1170 |
// Ask IconDrawer to prepare icons that are going to be drawn |
|
1171 |
// (other items were commented in a header). |
|
1172 |
// ----------------------------------------------------------------------------- |
|
1173 |
// |
|
1174 |
void CCalenEventViewContainer::PopulateIconDrawerL(CCalenIconDrawer& aIconDrawer) |
|
1175 |
{ |
|
1176 |
TRACE_ENTRY_POINT; |
|
1177 |
||
1178 |
// Alarm icon? |
|
1179 |
if( iEventViewData->IsAlarmActivated() ) |
|
1180 |
{ |
|
1181 |
// For todos, only add the alarm icon if it's not completed. |
|
1182 |
if ( iEventViewData->EntryType() == CCalEntry::ETodo ) |
|
1183 |
{ |
|
1184 |
// if(iEditedCalEntry.StatusL() != CCalEntry::ETodoCompleted) |
|
1185 |
if(iEntry->StatusL() != CCalEntry::ETodoCompleted) |
|
1186 |
{ |
|
1187 |
aIconDrawer.AddIconL( MCalenServices::ECalenAlarmIcon ); |
|
1188 |
} |
|
1189 |
} |
|
1190 |
else |
|
1191 |
{ |
|
1192 |
aIconDrawer.AddIconL( MCalenServices::ECalenAlarmIcon ); |
|
1193 |
} |
|
1194 |
} |
|
1195 |
||
1196 |
// Repeat / exception icon? |
|
1197 |
if (iEventViewData->IsRepeating()) |
|
1198 |
{ |
|
1199 |
aIconDrawer.AddIconL( MCalenServices::ECalenRepeatIcon ); |
|
1200 |
} |
|
1201 |
else |
|
1202 |
{ |
|
1203 |
if (iEntry->RecurrenceIdL().TimeUtcL() != Time::NullTTime()) |
|
1204 |
{ |
|
1205 |
aIconDrawer.AddIconL( MCalenServices::ECalenRepeatExceptionIcon ); |
|
1206 |
} |
|
1207 |
} |
|
1208 |
||
1209 |
// Todo priority icon? |
|
1210 |
if (iEventViewData->EntryType() == CCalEntry::ETodo) |
|
1211 |
{ |
|
1212 |
CCalenEntryUtil::TTodoPriority priority = iEventViewData->Priority(); |
|
1213 |
if (priority == CCalenEntryUtil::ETodoPriorityHigh) |
|
1214 |
{ |
|
1215 |
aIconDrawer.AddIconL( MCalenServices::ECalenNotePriorityHigh ); |
|
1216 |
} |
|
1217 |
else if (priority == CCalenEntryUtil::ETodoPriorityLow) |
|
1218 |
{ |
|
1219 |
aIconDrawer.AddIconL( MCalenServices::ECalenNotePriorityLow ); |
|
1220 |
} |
|
1221 |
else |
|
1222 |
{ |
|
1223 |
// nothing |
|
1224 |
} |
|
1225 |
} |
|
1226 |
// Set the icon sizes |
|
1227 |
aIconDrawer.SetIconSizesFromLayout(); |
|
1228 |
||
1229 |
// Get the icon drawer width |
|
1230 |
iIconDrawerWidthInPixels = aIconDrawer.WidthInPixels(); |
|
1231 |
||
1232 |
TRACE_EXIT_POINT; |
|
1233 |
} |
|
1234 |
||
1235 |
// ----------------------------------------------------------------------------- |
|
1236 |
// CCalenEventViewContainer::SetFormatAndAddHeadingL |
|
1237 |
// |
|
1238 |
// ----------------------------------------------------------------------------- |
|
1239 |
// |
|
1240 |
void CCalenEventViewContainer::SetFormatAndAddHeadingL(const TDesC& aHeading) |
|
1241 |
{ |
|
1242 |
TRACE_ENTRY_POINT; |
|
1243 |
||
1244 |
iCharFormatMask.ClearAll(); |
|
1245 |
iParaFormat->iLeftMarginInTwips = iHeadingIndent; |
|
1246 |
iCharFormat.iFontSpec = iHeadingFontSpec; |
|
1247 |
iCharFormatMask.SetAttrib( EAttFontHeight ); |
|
1248 |
iCharFormatMask.SetAttrib( EAttFontTypeface ); |
|
1249 |
iCharFormatMask.SetAttrib( EAttFontStrokeWeight ); |
|
1250 |
AddFormattedTextL( aHeading ); |
|
1251 |
||
1252 |
TRACE_EXIT_POINT; |
|
1253 |
} |
|
1254 |
||
1255 |
// ----------------------------------------------------------------------------- |
|
1256 |
// CCalenEventViewContainer::SetFormatAndAddBodyL |
|
1257 |
// |
|
1258 |
// ----------------------------------------------------------------------------- |
|
1259 |
// |
|
1260 |
void CCalenEventViewContainer::SetFormatAndAddBodyL(const TDesC& aBody) |
|
1261 |
{ |
|
1262 |
TRACE_ENTRY_POINT; |
|
1263 |
||
1264 |
iCharFormatMask.ClearAll(); |
|
1265 |
iParaFormat->iLeftMarginInTwips = iBodyIndent; |
|
1266 |
iCharFormat.iFontSpec = iBodyFontSpec; |
|
1267 |
iCharFormatMask.SetAttrib( EAttFontHeight ); |
|
1268 |
iCharFormatMask.SetAttrib( EAttFontTypeface ); |
|
1269 |
iCharFormatMask.SetAttrib( EAttFontStrokeWeight ); |
|
1270 |
AddFormattedTextL( aBody ); |
|
1271 |
||
1272 |
TRACE_EXIT_POINT; |
|
1273 |
} |
|
1274 |
||
1275 |
// ----------------------------------------------------------------------------- |
|
1276 |
// CCalenEventViewContainer::AddEmptyLineL |
|
1277 |
// |
|
1278 |
// ----------------------------------------------------------------------------- |
|
1279 |
// |
|
1280 |
void CCalenEventViewContainer::AddEmptyLineL() |
|
1281 |
{ |
|
1282 |
TRACE_ENTRY_POINT; |
|
1283 |
||
1284 |
CParaFormat* paraFormat = CParaFormat::NewLC(); |
|
1285 |
TParaFormatMask paraFormatMask; |
|
1286 |
paraFormat->iLineSpacingControl = CParaFormat::ELineSpacingExactlyInTwips; |
|
1287 |
paraFormatMask.SetAttrib(EAttLineSpacingControl); |
|
1288 |
paraFormat->iLineSpacingInTwips = iEmptyLineHeight; |
|
1289 |
paraFormatMask.SetAttrib(EAttLineSpacing); |
|
1290 |
paraFormatMask.SetAttrib(EAttFontHighlightColor); |
|
1291 |
||
1292 |
CRichText* richText = iTextEditor->RichText(); |
|
1293 |
TInt startPos = richText->DocumentLength(); |
|
1294 |
richText->InsertL(richText->DocumentLength(), CEditableText::EParagraphDelimiter); |
|
1295 |
TInt endPos = richText->DocumentLength(); |
|
1296 |
||
1297 |
richText->ApplyParaFormatL(paraFormat, paraFormatMask, startPos, endPos - startPos); |
|
1298 |
||
1299 |
CleanupStack::PopAndDestroy(paraFormat); |
|
1300 |
||
1301 |
TRACE_EXIT_POINT; |
|
1302 |
} |
|
1303 |
||
1304 |
// ----------------------------------------------------------------------------- |
|
1305 |
// CCalenEventViewContainer::AddFormattedTextL |
|
1306 |
// Add a string to the view. |
|
1307 |
// (other items were commented in a header). |
|
1308 |
// ----------------------------------------------------------------------------- |
|
1309 |
// |
|
1310 |
void CCalenEventViewContainer::AddFormattedTextL(const TDesC& aText) |
|
1311 |
{ |
|
1312 |
TRACE_ENTRY_POINT; |
|
1313 |
||
1314 |
CRichText* richText = iTextEditor->RichText(); |
|
1315 |
TInt startPos = richText->DocumentLength(); |
|
1316 |
HBufC* text = HBufC::NewLC( aText.Length() + 10); |
|
1317 |
TPtr target = text->Des(); |
|
1318 |
if(AknLayoutUtils::LayoutMirrored()) |
|
1319 |
{ |
|
1320 |
target.Append(KArabicSummaryMarker); |
|
1321 |
} |
|
1322 |
else |
|
1323 |
{ |
|
1324 |
target.Append(KWesternSummaryMarker); |
|
1325 |
} |
|
1326 |
target.Append(aText); |
|
1327 |
||
1328 |
richText->InsertL(startPos, target); |
|
1329 |
richText->InsertL(richText->DocumentLength(), CEditableText::EParagraphDelimiter); |
|
1330 |
TInt endPos = richText->DocumentLength(); |
|
1331 |
||
1332 |
richText->ApplyCharFormatL(iCharFormat, iCharFormatMask, startPos, endPos - startPos); |
|
1333 |
++startPos; // Without this the previous paragraph is formatted as well, ie no indent |
|
1334 |
richText->ApplyParaFormatL(iParaFormat, iParaFormatMask, startPos, endPos - startPos); |
|
1335 |
CleanupStack::PopAndDestroy(text); |
|
1336 |
||
1337 |
TRACE_EXIT_POINT; |
|
1338 |
} |
|
1339 |
||
1340 |
// ----------------------------------------------------------------------------- |
|
1341 |
// CCalenEventViewContainer::AddDescriptionFieldL |
|
1342 |
// Add a description field to the view. |
|
1343 |
// (other items were commented in a header). |
|
1344 |
// ----------------------------------------------------------------------------- |
|
1345 |
// |
|
1346 |
void CCalenEventViewContainer::AddDescriptionFieldL() |
|
1347 |
{ |
|
1348 |
TRACE_ENTRY_POINT; |
|
1349 |
//Add description |
|
1350 |
if (iEventViewData->Description() != KNullDesC) |
|
1351 |
{ |
|
1352 |
AddTextFieldL(R_QTN_CALE_EVENT_VIEW_DESC, iEventViewData->Description()); |
|
1353 |
// Add in a paragraph delimeter character |
|
1354 |
// Without this, long descriptions get cut off half way down the last line. |
|
1355 |
CRichText* richText = iTextEditor->RichText(); |
|
1356 |
richText->InsertL(richText->DocumentLength(), CEditableText::EParagraphDelimiter); |
|
1357 |
} |
|
1358 |
TRACE_EXIT_POINT; |
|
1359 |
} |
|
1360 |
||
1361 |
// ----------------------------------------------------------------------------- |
|
1362 |
// CCalenEventViewContainer::AddSinceFieldL |
|
1363 |
// Add a since field to the view. |
|
1364 |
// (other items were commented in a header). |
|
1365 |
// ----------------------------------------------------------------------------- |
|
1366 |
// |
|
1367 |
void CCalenEventViewContainer::AddSinceFieldL() |
|
1368 |
{ |
|
1369 |
TRACE_ENTRY_POINT; |
|
1370 |
||
1371 |
// Add since field, if the since year is different from the year of the instance opened. |
|
1372 |
// TInt instanceYear = Handler().Original().StartDateTime().DateTime().Year(); |
|
1373 |
TInt instanceYear = iEventViewData->StartDateTime().DateTime().Year(); |
|
1374 |
TTime seriesTime = ParentEntryL().StartTimeL().TimeLocalL(); |
|
1375 |
TInt seriesYear = seriesTime.DateTime().Year(); |
|
1376 |
||
1377 |
if( seriesYear != instanceYear ) |
|
1378 |
{ |
|
1379 |
TBuf<32> formattedYear; |
|
1380 |
seriesTime.FormatL(formattedYear, KYearFormatString); |
|
1381 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedYear); |
|
1382 |
AddTextFieldL(R_QTN_CALE_EVENT_VIEW_SINCE, formattedYear); |
|
1383 |
} |
|
1384 |
TRACE_EXIT_POINT; |
|
1385 |
} |
|
1386 |
||
1387 |
// ----------------------------------------------------------------------------- |
|
1388 |
// CCalenEventViewContainer::AddTextFieldL |
|
1389 |
// Add a text field to the view. |
|
1390 |
// (other items were commented in a header). |
|
1391 |
// ----------------------------------------------------------------------------- |
|
1392 |
// |
|
1393 |
void CCalenEventViewContainer::AddTextFieldL(TInt aHeadingResource, TInt aBodyResource) |
|
1394 |
{ |
|
1395 |
TRACE_ENTRY_POINT; |
|
1396 |
HBufC* textHeading = StringLoader::LoadLC(aHeadingResource); |
|
1397 |
SetFormatAndAddHeadingL(*textHeading); |
|
1398 |
CleanupStack::PopAndDestroy(textHeading); |
|
1399 |
||
1400 |
HBufC* textBody = StringLoader::LoadLC(aBodyResource); |
|
1401 |
SetFormatAndAddBodyL(*textBody); |
|
1402 |
CleanupStack::PopAndDestroy(textBody); |
|
1403 |
TRACE_EXIT_POINT; |
|
1404 |
} |
|
1405 |
||
1406 |
// ----------------------------------------------------------------------------- |
|
1407 |
// CCalenEventViewContainer::AddTextFieldL |
|
1408 |
// Add a text field to the view. |
|
1409 |
// (other items were commented in a header). |
|
1410 |
// ----------------------------------------------------------------------------- |
|
1411 |
// |
|
1412 |
void CCalenEventViewContainer::AddTextFieldL(TInt aHeadingResource, const TDesC& aBody) |
|
1413 |
{ |
|
1414 |
TRACE_ENTRY_POINT; |
|
1415 |
||
1416 |
HBufC* textHeading = StringLoader::LoadLC(aHeadingResource); |
|
1417 |
SetFormatAndAddHeadingL(*textHeading); |
|
1418 |
CleanupStack::PopAndDestroy(textHeading); |
|
1419 |
||
1420 |
// If the value is empty, put a space in the output so we don't compress the empty line. |
|
1421 |
if( CalenAgendaUtils::IsEmptyText(aBody) ) |
|
1422 |
{ |
|
1423 |
SetFormatAndAddBodyL(KSpace); |
|
1424 |
} |
|
1425 |
else |
|
1426 |
{ |
|
1427 |
SetFormatAndAddBodyL(aBody); |
|
1428 |
} |
|
1429 |
TRACE_EXIT_POINT; |
|
1430 |
} |
|
1431 |
||
1432 |
// ----------------------------------------------------------------------------- |
|
1433 |
// CCalenEventViewContainer::AddSubjectFieldL |
|
1434 |
// Adds the entry's subject to the view. |
|
1435 |
// (other items were commented in a header). |
|
1436 |
// ----------------------------------------------------------------------------- |
|
1437 |
// |
|
1438 |
void CCalenEventViewContainer::AddSubjectFieldL() |
|
1439 |
{ |
|
1440 |
TRACE_ENTRY_POINT; |
|
1441 |
||
1442 |
iParaFormat->iRightMarginInTwips = PixelsToTwips(iIconDrawerWidthInPixels); |
|
1443 |
if (iEventViewData->Summary() != KNullDesC) |
|
1444 |
{ |
|
1445 |
SetFormatAndAddHeadingL(iEventViewData->Summary()); |
|
1446 |
} |
|
1447 |
else |
|
1448 |
{ |
|
1449 |
HBufC* untitled = StringLoader::LoadLC(R_QTN_CALE_EVENT_VIEW_EMPTY_SUBJECT); |
|
1450 |
SetFormatAndAddHeadingL(*untitled); |
|
1451 |
CleanupStack::PopAndDestroy(untitled); |
|
1452 |
} |
|
1453 |
iParaFormat->iRightMarginInTwips = KDefaultRightMargin; |
|
1454 |
||
1455 |
TRACE_EXIT_POINT; |
|
1456 |
} |
|
1457 |
||
1458 |
// ----------------------------------------------------------------------------- |
|
1459 |
// CCalenEventViewContainer::AddLocationFieldL |
|
1460 |
// Adds the entry's location to the view. |
|
1461 |
// (other items were commented in a header). |
|
1462 |
// ----------------------------------------------------------------------------- |
|
1463 |
// |
|
1464 |
void CCalenEventViewContainer::AddLocationFieldL() |
|
1465 |
{ |
|
1466 |
TRACE_ENTRY_POINT; |
|
1467 |
||
1468 |
||
1469 |
||
1470 |
iParaFormat->iRightMarginInTwips = PixelsToTwips(20); |
|
1471 |
if (iEventViewData->Location() != KNullDesC ) |
|
1472 |
{ |
|
1473 |
SetFormatAndAddBodyL(iEventViewData->Location()); |
|
1474 |
} |
|
1475 |
iParaFormat->iRightMarginInTwips = KDefaultRightMargin; |
|
1476 |
TRACE_EXIT_POINT; |
|
1477 |
} |
|
1478 |
||
1479 |
// ----------------------------------------------------------------------------- |
|
1480 |
// CCalenEventViewContainer::AddPriorityFieldL |
|
1481 |
// Reads the priority from the entry and adds a field to the form accordingly. |
|
1482 |
// (other items were commented in a header). |
|
1483 |
// ----------------------------------------------------------------------------- |
|
1484 |
// |
|
1485 |
void CCalenEventViewContainer::AddPriorityFieldL() |
|
1486 |
{ |
|
1487 |
TRACE_ENTRY_POINT; |
|
1488 |
||
1489 |
CCalenEntryUtil::TTodoPriority priority = iEventViewData->Priority(); |
|
1490 |
||
1491 |
// Don't add the priority field if it's normal priority. |
|
1492 |
if( priority != CCalenEntryUtil::ETodoPriorityNormal ) |
|
1493 |
{ |
|
1494 |
CDesCArrayFlat* priorities = ControlEnv()->ReadDesCArrayResourceL(R_CALE_EVENT_VIEW_TODO_PRIORITY); |
|
1495 |
CleanupStack::PushL(priorities); |
|
1496 |
const TDesC& priorityText = (*priorities)[CalendarPriorityToFormPriority(priority)]; |
|
1497 |
AddTextFieldL(R_QTN_CALE_EVENT_VIEW_PRIO, priorityText); |
|
1498 |
CleanupStack::PopAndDestroy(); // priorities |
|
1499 |
} |
|
1500 |
TRACE_EXIT_POINT; |
|
1501 |
} |
|
1502 |
||
1503 |
||
1504 |
// ----------------------------------------------------------------------------- |
|
1505 |
// CCalenEventViewContainer::AddTimeFieldL |
|
1506 |
// Add a time field to the form. |
|
1507 |
// (other items were commented in a header). |
|
1508 |
// ----------------------------------------------------------------------------- |
|
1509 |
// |
|
1510 |
void CCalenEventViewContainer::AddTimeFieldL(TInt aLabelResource, const TTime& aTime) |
|
1511 |
{ |
|
1512 |
TRACE_ENTRY_POINT; |
|
1513 |
||
1514 |
TBuf<32> formattedTime; |
|
1515 |
aTime.FormatL(formattedTime, *iTimeFormat); |
|
1516 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedTime); |
|
1517 |
AddTextFieldL(aLabelResource, formattedTime); |
|
1518 |
||
1519 |
TRACE_EXIT_POINT; |
|
1520 |
} |
|
1521 |
||
1522 |
// ----------------------------------------------------------------------------- |
|
1523 |
// CCalenEventViewContainer::AddDateFieldL |
|
1524 |
// Add a date field to the form. |
|
1525 |
// (other items were commented in a header). |
|
1526 |
// ----------------------------------------------------------------------------- |
|
1527 |
// |
|
1528 |
void CCalenEventViewContainer::AddDateFieldL(const TTime& aDate) |
|
1529 |
{ |
|
1530 |
TRACE_ENTRY_POINT; |
|
1531 |
||
1532 |
TBuf<32> formattedDate; |
|
1533 |
aDate.FormatL(formattedDate, *iDateFormat); |
|
1534 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedDate); |
|
1535 |
SetFormatAndAddBodyL(formattedDate); |
|
1536 |
||
1537 |
TRACE_EXIT_POINT; |
|
1538 |
} |
|
1539 |
||
1540 |
// ----------------------------------------------------------------------------- |
|
1541 |
// CCalenEventViewContainer::AddDateFieldL |
|
1542 |
// Add a date field to the form. |
|
1543 |
// (other items were commented in a header). |
|
1544 |
// ----------------------------------------------------------------------------- |
|
1545 |
// |
|
1546 |
void CCalenEventViewContainer::AddDateFieldL(TInt aHeadingResource, const TTime& aDate) |
|
1547 |
{ |
|
1548 |
TRACE_ENTRY_POINT; |
|
1549 |
||
1550 |
HBufC* textHeading = StringLoader::LoadLC(aHeadingResource); |
|
1551 |
SetFormatAndAddHeadingL(*textHeading); |
|
1552 |
CleanupStack::PopAndDestroy(textHeading); |
|
1553 |
AddDateFieldL(aDate); |
|
1554 |
||
1555 |
TRACE_EXIT_POINT; |
|
1556 |
} |
|
74
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
1557 |
|
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
1558 |
// ----------------------------------------------------------------------------- |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
1559 |
// CCalenEventViewContainer::AddDateFieldL |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
1560 |
// Add a date field to the form. |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
1561 |
// (other items were commented in a header). |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
1562 |
// ----------------------------------------------------------------------------- |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
1563 |
// |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
1564 |
void CCalenEventViewContainer::AddDateFieldL( const TDesC& aDate ) |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
1565 |
{ |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
1566 |
TRACE_ENTRY_POINT; |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
1567 |
if (FeatureManager::FeatureSupported( KFeatureIdKorean )) |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
1568 |
{ |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
1569 |
TBuf<KMaxDateLength> formattedDate; |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
1570 |
if ( aDate.Length() < KMaxDateLength && aDate.Length() > 0 ) |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
1571 |
{ |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
1572 |
formattedDate.Copy( aDate ); |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
1573 |
} |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
1574 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion( formattedDate ); |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
1575 |
SetFormatAndAddBodyL( formattedDate ); |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
1576 |
} |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
1577 |
TRACE_EXIT_POINT; |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
1578 |
} |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
1579 |
|
66 | 1580 |
// ----------------------------------------------------------------------------- |
1581 |
// CCalenEventViewContainer::AddDateFieldL |
|
1582 |
// Add a field to the form in the format "DATE - DATE". |
|
1583 |
// (other items were commented in a header). |
|
1584 |
// ----------------------------------------------------------------------------- |
|
1585 |
// |
|
1586 |
void CCalenEventViewContainer::AddDateDateFieldL(const TTime& aStartDate, const TTime& aEndDate) |
|
1587 |
{ |
|
1588 |
TRACE_ENTRY_POINT; |
|
1589 |
||
1590 |
CDesCArrayFlat* strings = new CDesCArrayFlat( 2 ); |
|
1591 |
CleanupStack::PushL( strings ); |
|
1592 |
||
1593 |
TBuf<KMaxDateLength> firstDate; |
|
1594 |
aStartDate.FormatL( firstDate, *iDateFormat ); |
|
1595 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(firstDate); |
|
1596 |
strings->AppendL( firstDate ); |
|
1597 |
||
1598 |
TBuf<KMaxDateLength> secondDate; |
|
1599 |
aEndDate.FormatL( secondDate, *iDateFormat ); |
|
1600 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(secondDate); |
|
1601 |
strings->AppendL( secondDate ); |
|
1602 |
||
1603 |
HBufC* stringholder = StringLoader::LoadL( R_QTN_CALE_EVENT_VIEW_VALID_LIMITED, *strings ); |
|
1604 |
CleanupStack::PopAndDestroy( strings ); |
|
1605 |
CleanupStack::PushL( stringholder ); |
|
1606 |
||
1607 |
SetFormatAndAddBodyL(*stringholder); |
|
1608 |
CleanupStack::PopAndDestroy(stringholder); |
|
1609 |
||
1610 |
TRACE_EXIT_POINT; |
|
1611 |
} |
|
1612 |
||
1613 |
// ----------------------------------------------------------------------------- |
|
1614 |
// CCalenEventViewContainer::AddAlarmDateAndTimeFieldL |
|
1615 |
// Add a date and time field to the form, in the ordering according to |
|
1616 |
// localisation (date followed by the time). |
|
1617 |
// (other items were commented in a header). |
|
1618 |
// ----------------------------------------------------------------------------- |
|
1619 |
// |
|
1620 |
void CCalenEventViewContainer::AddAlarmDateAndTimeFieldL( const TTime& aTime ) |
|
1621 |
{ |
|
1622 |
TRACE_ENTRY_POINT; |
|
1623 |
||
1624 |
CDesCArrayFlat* strings = new CDesCArrayFlat( 2 ); |
|
1625 |
CleanupStack::PushL( strings ); |
|
1626 |
||
1627 |
TBuf<KMaxDateLength> formattedTime; |
|
1628 |
aTime.FormatL( formattedTime, *iTimeFormat ); |
|
1629 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedTime); |
|
1630 |
strings->AppendL( formattedTime ); |
|
1631 |
||
1632 |
TBuf<KMaxDateLength> formattedDate; |
|
1633 |
aTime.FormatL( formattedDate, *iDateFormat ); |
|
1634 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedDate); |
|
1635 |
strings->AppendL( formattedDate ); |
|
1636 |
||
1637 |
HBufC* stringholder = StringLoader::LoadL( R_QTN_CALE_EVENT_VIEW_ALARM_TIME, *strings ); |
|
1638 |
CleanupStack::PopAndDestroy( strings ); |
|
1639 |
CleanupStack::PushL( stringholder ); |
|
1640 |
||
1641 |
AddTextFieldL( R_QTN_CALE_EVENT_VIEW_ALARM, *stringholder ); |
|
1642 |
CleanupStack::PopAndDestroy( stringholder ); |
|
1643 |
||
1644 |
TRACE_EXIT_POINT; |
|
1645 |
} |
|
1646 |
||
1647 |
// ----------------------------------------------------------------------------- |
|
1648 |
// CCalenEventViewContainer::AddAlarmDateTimeFieldL |
|
1649 |
// Reads the alarm from the entry and add a field containing its date-time. |
|
1650 |
// If the alarm is on the same day as the entry, only the time is shown. |
|
1651 |
// If no alarm is present, the field is not shown |
|
1652 |
// (other items were commented in a header). |
|
1653 |
// ----------------------------------------------------------------------------- |
|
1654 |
// |
|
1655 |
void CCalenEventViewContainer::AddAlarmDateTimeFieldL() |
|
1656 |
{ |
|
1657 |
TRACE_ENTRY_POINT; |
|
1658 |
if( iEventViewData->IsAlarmActivated() ) |
|
1659 |
{ |
|
1660 |
TTime alarmTime = iEventViewData->AlarmDateTime(); |
|
1661 |
alarmTime = CalenDateUtils::LimitToValidTime( alarmTime ); |
|
1662 |
||
1663 |
// If alarm is on the same day as the entry, AND the meeting only lasts one day, |
|
1664 |
// just show the alarm time and not the date. |
|
1665 |
if( CalenDateUtils::OnSameDay( alarmTime, iEventViewData->StartDateTime() ) && |
|
1666 |
CalenDateUtils::OnSameDay( iEventViewData->StartDateTime(), iEventViewData->EndDateTime() ) ) |
|
1667 |
{ |
|
1668 |
// On same day, only show time. |
|
1669 |
AddTimeFieldL( R_QTN_CALE_EVENT_VIEW_ALARM, alarmTime ); |
|
1670 |
} |
|
1671 |
else |
|
1672 |
{ |
|
1673 |
// Different days, show both date and time. |
|
1674 |
AddAlarmDateAndTimeFieldL( alarmTime ); |
|
1675 |
} |
|
1676 |
} |
|
1677 |
TRACE_EXIT_POINT; |
|
1678 |
} |
|
1679 |
||
1680 |
// ----------------------------------------------------------------------------- |
|
1681 |
// CCalenEventViewContainer::GetMinAndMaxTimesL |
|
1682 |
// Find the maximum and minimum times from the given array. |
|
1683 |
// (other items were commented in a header). |
|
1684 |
// ----------------------------------------------------------------------------- |
|
1685 |
// |
|
1686 |
void CCalenEventViewContainer::GetMinAndMaxTimesL( RArray<TCalTime>& aTimes, |
|
1687 |
TCalTime& aMinTime, |
|
1688 |
TCalTime& aMaxTime ) |
|
1689 |
{ |
|
1690 |
TRACE_ENTRY_POINT; |
|
1691 |
||
1692 |
TInt minIndex=0; |
|
1693 |
TInt maxIndex=0; |
|
1694 |
||
1695 |
for( TInt i=1; i<aTimes.Count(); ++i ) |
|
1696 |
{ |
|
1697 |
if( aTimes[i].TimeUtcL() > aTimes[maxIndex].TimeUtcL() ) |
|
1698 |
{ |
|
1699 |
maxIndex = i; |
|
1700 |
} |
|
1701 |
else |
|
1702 |
{ |
|
1703 |
if( aTimes[i].TimeUtcL() < aTimes[minIndex].TimeUtcL() ) |
|
1704 |
{ |
|
1705 |
minIndex = i; |
|
1706 |
} |
|
1707 |
} |
|
1708 |
} |
|
1709 |
||
1710 |
aMinTime = aTimes[minIndex]; |
|
1711 |
aMaxTime = aTimes[maxIndex]; |
|
1712 |
||
1713 |
TRACE_EXIT_POINT; |
|
1714 |
} |
|
1715 |
// ----------------------------------------------------------------------------- |
|
1716 |
// CCalenEventViewContainer::RemoveDuplicateTimesL |
|
1717 |
// If there is more than one time at the same time, leave only one in the array. |
|
1718 |
// (other items were commented in a header). |
|
1719 |
// ----------------------------------------------------------------------------- |
|
1720 |
// |
|
1721 |
void CCalenEventViewContainer::RemoveDuplicateTimesL( RArray<TCalTime>& aTimes ) |
|
1722 |
{ |
|
1723 |
TRACE_ENTRY_POINT; |
|
1724 |
||
1725 |
for( TInt i=0; i<aTimes.Count(); ++i ) |
|
1726 |
{ |
|
1727 |
for( TInt j=aTimes.Count()-1; j>i; --j ) |
|
1728 |
{ |
|
1729 |
if( aTimes[i].TimeUtcL() == aTimes[j].TimeUtcL() ) |
|
1730 |
{ |
|
1731 |
aTimes.Remove( j ); |
|
1732 |
} |
|
1733 |
} |
|
1734 |
} |
|
1735 |
||
1736 |
TRACE_EXIT_POINT; |
|
1737 |
} |
|
1738 |
||
1739 |
// ----------------------------------------------------------------------------- |
|
1740 |
// CCalenEventViewContainer::RemoveExcludedTimesL |
|
1741 |
// From the given array of start dates, remove any which match up with an |
|
1742 |
// exception date and also have no child associated with them. |
|
1743 |
// (other items were commented in a header). |
|
1744 |
// ----------------------------------------------------------------------------- |
|
1745 |
// |
|
1746 |
void CCalenEventViewContainer::RemoveExcludedTimesL( RArray<TCalTime>& aStartDates, |
|
1747 |
RArray<TCalTime>& aExDates, |
|
1748 |
RPointerArray<CCalEntry>& aChildEntries ) |
|
1749 |
{ |
|
1750 |
TRACE_ENTRY_POINT; |
|
1751 |
||
1752 |
for( TInt i=0; i<aExDates.Count(); ++i ) |
|
1753 |
{ |
|
1754 |
for( TInt j=aStartDates.Count()-1; j>=0; --j ) |
|
1755 |
{ |
|
1756 |
if( aStartDates[j].TimeUtcL() == aExDates[i].TimeUtcL() ) |
|
1757 |
{ |
|
1758 |
TBool hasChild = EFalse; |
|
1759 |
for( TInt k=0; k<aChildEntries.Count(); ++k ) |
|
1760 |
{ |
|
1761 |
if( aChildEntries[k]->RecurrenceIdL().TimeUtcL() == aStartDates[j].TimeUtcL() ) |
|
1762 |
{ |
|
1763 |
hasChild = ETrue; |
|
1764 |
break; |
|
1765 |
} |
|
1766 |
} |
|
1767 |
||
1768 |
if( !hasChild ) |
|
1769 |
{ |
|
1770 |
aStartDates.Remove( j ); |
|
1771 |
break; |
|
1772 |
} |
|
1773 |
} |
|
1774 |
} |
|
1775 |
} |
|
1776 |
||
1777 |
TRACE_EXIT_POINT; |
|
1778 |
} |
|
1779 |
||
1780 |
// ---------------------------------------------------- |
|
1781 |
// CCalenEventViewContainer::CalendaryPriorityToFormPriority |
|
1782 |
// Convert replication to confidentiality |
|
1783 |
// (other items were commented in a header). |
|
1784 |
// ---------------------------------------------------- |
|
1785 |
// |
|
1786 |
TInt CCalenEventViewContainer::CalendarPriorityToFormPriority(CCalenEntryUtil::TTodoPriority aCalPriority) |
|
1787 |
{ |
|
1788 |
TRACE_ENTRY_POINT; |
|
1789 |
// Calendar priority is in same order as resource, starting from one number lower. |
|
1790 |
TRACE_EXIT_POINT; |
|
1791 |
return aCalPriority-1; |
|
1792 |
} |
|
1793 |
||
1794 |
// ----------------------------------------------------------------------------- |
|
1795 |
// CCalenEventViewContainer::TryToFitL |
|
1796 |
// Returns ETrue if the given string fits into aMaxWidth, |
|
1797 |
// using the font aFont - EFalse otherwise |
|
1798 |
// (other items were commented in a header). |
|
1799 |
// ----------------------------------------------------------------------------- |
|
1800 |
// |
|
1801 |
TBool CCalenEventViewContainer::TryToFitL( const TDesC& aStr, TInt aMaxWidth, const CFont& aFont ) |
|
1802 |
{ |
|
1803 |
TRACE_ENTRY_POINT; |
|
1804 |
||
1805 |
TInt width = aFont.TextWidthInPixels(aStr); |
|
1806 |
// We add one because it seems the edwin wrapping doesn't quite agree with CFont's width. |
|
1807 |
++width; |
|
1808 |
||
1809 |
TRACE_EXIT_POINT; |
|
1810 |
return width < aMaxWidth; |
|
1811 |
} |
|
1812 |
||
1813 |
// ----------------------------------------------------------------------------- |
|
1814 |
// CCalenEventViewContainer::PixelsToTwips |
|
1815 |
// Convert pixels to twips |
|
1816 |
// (other items were commented in a header). |
|
1817 |
// ----------------------------------------------------------------------------- |
|
1818 |
// |
|
1819 |
TInt CCalenEventViewContainer::PixelsToTwips(TInt aPixels) |
|
1820 |
{ |
|
1821 |
TRACE_ENTRY_POINT; |
|
1822 |
||
1823 |
CWindowGc& windowGc = ControlEnv()->SystemGc(); |
|
1824 |
TInt twips = windowGc.Device()->HorizontalPixelsToTwips(aPixels); |
|
1825 |
||
1826 |
TRACE_EXIT_POINT; |
|
1827 |
return twips; |
|
1828 |
} |
|
1829 |
||
1830 |
// ----------------------------------------------------------------------------- |
|
1831 |
// CCalenEventViewContainer::GetSeriesRepeatInformationL |
|
1832 |
// Attempts to calculate the start and end dates of the series by looking at the |
|
1833 |
// given entry's RDates and RRule. If these dates have successfully been |
|
1834 |
// calculated, the function returns ETrue, or EFalse otherwise. |
|
1835 |
// (other items were commented in a header). |
|
1836 |
// ----------------------------------------------------------------------------- |
|
1837 |
// |
|
1838 |
TBool CCalenEventViewContainer::GetSeriesRepeatInformationL( CCalEntry& aEntry, |
|
1839 |
TCalenRepeatIndex& aRepeatIndex, |
|
1840 |
TTime& aSeriesStart, |
|
1841 |
TTime& aSeriesEnd ) |
|
1842 |
{ |
|
1843 |
TRACE_ENTRY_POINT; |
|
1844 |
||
1845 |
TBool success; |
|
1846 |
||
1847 |
RArray<TCalTime> rdates; |
|
1848 |
CleanupClosePushL( rdates ); |
|
1849 |
||
1850 |
aEntry.GetRDatesL(rdates); |
|
1851 |
||
1852 |
if( rdates.Count() ) |
|
1853 |
{ |
|
1854 |
// Calculate the start and end dates from the RDates. |
|
1855 |
||
1856 |
// We need to expand the RDates. This involves getting all the instance start dates, |
|
1857 |
// then removing any start date with an exdate but no modifying child for that instance. |
|
1858 |
// Include the entry start date in this, as that counts as part of the series. |
|
1859 |
rdates.AppendL( aEntry.StartTimeL() ); |
|
1860 |
||
1861 |
RemoveDuplicateTimesL( rdates ); |
|
1862 |
||
1863 |
RArray<TCalTime> exdates; |
|
1864 |
CleanupClosePushL( exdates ); |
|
1865 |
aEntry.GetExceptionDatesL( exdates ); |
|
1866 |
if( exdates.Count() ) |
|
1867 |
{ |
|
1868 |
RemoveExcludedTimesL( rdates, exdates, AllInstancesL() ); |
|
1869 |
} |
|
1870 |
CleanupStack::PopAndDestroy( &exdates ); |
|
1871 |
||
1872 |
TCalRRule rrule; |
|
1873 |
if( iEntry->GetRRuleL(rrule) ) |
|
1874 |
{ |
|
1875 |
// Hopefully no UI would create an entry with an RRule as well as RDates. |
|
1876 |
// Although the spec says it's possible, Calendar certainly can't. |
|
1877 |
// We have a vague go at including the RRule in the min/max date but |
|
1878 |
// don't bother removing exdates from it as we would then need to expand |
|
1879 |
// every instance of the RRule. |
|
1880 |
rdates.AppendL( rrule.DtStart() ); |
|
1881 |
rdates.AppendL( rrule.Until() ); |
|
1882 |
RemoveDuplicateTimesL( rdates ); |
|
1883 |
} |
|
1884 |
||
1885 |
// The true instance dates should be in the 'rdates' array. Now we just need |
|
1886 |
// the minimum and maximum times from here. |
|
1887 |
TCalTime min, max; |
|
1888 |
GetMinAndMaxTimesL( rdates, min, max ); |
|
1889 |
aSeriesStart = min.TimeLocalL(); |
|
1890 |
aSeriesEnd = max.TimeLocalL(); |
|
1891 |
||
1892 |
// Set the repeat type to "Other" for rdates. |
|
1893 |
aRepeatIndex = ERepeatOther; |
|
1894 |
success = ETrue; |
|
1895 |
} |
|
1896 |
else |
|
1897 |
{ |
|
1898 |
TCalRRule rrule; |
|
1899 |
if( aEntry.GetRRuleL( rrule ) ) |
|
1900 |
{ |
|
1901 |
// This 'switch' differs slightly from CalenNoteDataUtil::RepeatIndex in |
|
1902 |
// that we are a bit more generous in awarding repeat types instead of |
|
1903 |
// falling back to 'other' repeat type. |
|
1904 |
aRepeatIndex = ERepeatOther; |
|
1905 |
switch( rrule.Type() ) |
|
1906 |
{ |
|
1907 |
case TCalRRule::EDaily: |
|
1908 |
{ |
|
1909 |
if( rrule.Interval() == 1 ) |
|
1910 |
{ |
|
1911 |
aRepeatIndex = ERepeatDaily; |
|
1912 |
} |
|
1913 |
else if( rrule.Interval() == 7 ) |
|
1914 |
{ |
|
1915 |
aRepeatIndex = ERepeatWeekly; |
|
1916 |
} |
|
1917 |
else if( rrule.Interval() == 14 ) |
|
1918 |
{ |
|
1919 |
aRepeatIndex = ERepeatBiWeekly; |
|
1920 |
} |
|
1921 |
else |
|
1922 |
{ |
|
1923 |
// nothing |
|
1924 |
} |
|
1925 |
} |
|
1926 |
break; |
|
1927 |
||
1928 |
case TCalRRule::EWeekly: |
|
1929 |
{ |
|
1930 |
TInt repeatInterval( rrule.Interval() ); |
|
1931 |
TBool status; |
|
1932 |
status = CalenNoteDataUtil::IsWorkdaysRepeatingL( rrule ); |
|
1933 |
if(status) |
|
1934 |
{ |
|
1935 |
aRepeatIndex = ERepeatWorkdays ; |
|
1936 |
} |
|
1937 |
else |
|
1938 |
{ |
|
1939 |
switch( repeatInterval ) |
|
1940 |
{ |
|
1941 |
case 1: aRepeatIndex = ERepeatWeekly; |
|
1942 |
break; |
|
1943 |
case 2: aRepeatIndex = ERepeatBiWeekly; |
|
1944 |
break; |
|
1945 |
default:break; |
|
1946 |
} |
|
1947 |
} |
|
1948 |
} |
|
1949 |
break; |
|
1950 |
||
1951 |
case TCalRRule::EMonthly: |
|
1952 |
{ |
|
1953 |
if( rrule.Interval() == 1 ) |
|
1954 |
{ |
|
1955 |
aRepeatIndex = ERepeatMonthly; |
|
1956 |
} |
|
1957 |
} |
|
1958 |
break; |
|
1959 |
||
1960 |
case TCalRRule::EYearly: |
|
1961 |
{ |
|
1962 |
if( rrule.Interval() == 1 ) |
|
1963 |
{ |
|
1964 |
aRepeatIndex = ERepeatYearly; |
|
1965 |
} |
|
1966 |
} |
|
1967 |
break; |
|
1968 |
default: |
|
1969 |
break; |
|
1970 |
} |
|
1971 |
||
1972 |
aSeriesStart = rrule.DtStart().TimeLocalL(); |
|
1973 |
aSeriesEnd = rrule.Until().TimeLocalL(); |
|
1974 |
success = ETrue; |
|
1975 |
} |
|
1976 |
else |
|
1977 |
{ |
|
1978 |
// No repeat information. |
|
1979 |
success = EFalse; |
|
1980 |
} |
|
1981 |
} |
|
1982 |
||
1983 |
CleanupStack::PopAndDestroy( &rdates ); |
|
1984 |
||
1985 |
return success; |
|
1986 |
||
1987 |
TRACE_EXIT_POINT; |
|
1988 |
} |
|
1989 |
||
1990 |
// ----------------------------------------------------------------------------- |
|
1991 |
// CCalenEventViewContainer::AddRepeatFieldL |
|
1992 |
// Add repeat text field to the |
|
1993 |
// (other items were commented in a header). |
|
1994 |
// ----------------------------------------------------------------------------- |
|
1995 |
// |
|
1996 |
void CCalenEventViewContainer::AddRepeatFieldL() |
|
1997 |
{ |
|
1998 |
TRACE_ENTRY_POINT; |
|
1999 |
// Get the repeat rule from the entry. If this is a child entry, |
|
2000 |
// find the parent and get the repeat rule from that. |
|
2001 |
TCalRRule rrule; |
|
2002 |
TCalenRepeatIndex repeatIndex; |
|
2003 |
// 'start' is the start time of the series, not the start time of the instance we are viewing |
|
2004 |
TTime start; |
|
2005 |
TTime until; |
|
2006 |
||
2007 |
if( !GetSeriesRepeatInformationL( *iEntry, repeatIndex, start, until ) ) |
|
2008 |
{ |
|
2009 |
// An entry with no RDates or RRule but a non-null recurrence id. |
|
2010 |
// This entry is a child. We have to get the parent to see the repeat information. |
|
2011 |
// We assert here - a parent really should have some form of repeat information. |
|
2012 |
__ASSERT_ALWAYS( GetSeriesRepeatInformationL( ParentEntryL(), repeatIndex, start, until ), |
|
2013 |
User::Invariant() ); |
|
2014 |
} |
|
2015 |
||
2016 |
// Set repIndex to be the resource used for the heading. |
|
2017 |
// This will be "Repeats daily", "Repeats weekly" etc. |
|
2018 |
TInt repIndex = -1; |
|
2019 |
||
2020 |
switch(repeatIndex) |
|
2021 |
{ |
|
2022 |
case ERepeatDaily: |
|
2023 |
repIndex = R_QTN_CALE_EVENT_VIEW_REPEAT_DAILY; |
|
2024 |
break; |
|
2025 |
case ERepeatWeekly: |
|
2026 |
repIndex = R_QTN_CALE_EVENT_VIEW_REPEAT_WEEKLY; |
|
2027 |
break; |
|
2028 |
case ERepeatBiWeekly: |
|
2029 |
repIndex = R_QTN_CALE_EVENT_VIEW_REPEAT_FORTNIGHTLY; |
|
2030 |
break; |
|
2031 |
case ERepeatMonthly: |
|
2032 |
repIndex = R_QTN_CALE_EVENT_VIEW_REPEAT_MONTHLY; |
|
2033 |
break; |
|
2034 |
case ERepeatYearly: |
|
2035 |
repIndex = R_QTN_CALE_EVENT_VIEW_REPEAT_YEARLY; |
|
2036 |
break; |
|
2037 |
case ERepeatWorkdays: |
|
2038 |
repIndex = R_QTN_CALE_EVENT_VIEW_REPEAT_WORKDAYS; |
|
2039 |
break; |
|
2040 |
case ERepeatOther: |
|
2041 |
repIndex = R_QTN_CALE_EVENT_VIEW_REPEAT_OTHER; |
|
2042 |
break; |
|
2043 |
default: |
|
2044 |
ASSERT(EFalse); |
|
2045 |
break; |
|
2046 |
} |
|
2047 |
||
2048 |
TBuf<64> dateString; |
|
2049 |
||
2050 |
// Infinite repeat if repeat until is on or after the max time, or if repeat until is null. |
|
2051 |
TBool finiteRepeat = until < CalenDateUtils::BeginningOfDay( CalenDateUtils::MaxTime() ) |
|
2052 |
&& until != Time::NullTTime(); |
|
2053 |
||
2054 |
if( finiteRepeat ) |
|
2055 |
{ |
|
2056 |
// Finite repeat, string (e.g.) "17/01/2006 - 27/01/2006" |
|
2057 |
CDesCArrayFlat* strings = new CDesCArrayFlat( 2 ); |
|
2058 |
CleanupStack::PushL( strings ); |
|
2059 |
||
2060 |
TBuf<KMaxDateLength> formattedTime; |
|
2061 |
start.FormatL( formattedTime, *iDateFormat ); |
|
2062 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedTime); |
|
2063 |
strings->AppendL( formattedTime ); |
|
2064 |
||
2065 |
TBuf<KMaxDateLength> formattedDate; |
|
2066 |
until.FormatL( formattedDate, *iDateFormat ); |
|
2067 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedDate); |
|
2068 |
strings->AppendL( formattedDate ); |
|
2069 |
||
2070 |
HBufC* stringholder = StringLoader::LoadL( R_QTN_CALE_EVENT_VIEW_VALID_LIMITED, *strings ); |
|
2071 |
CleanupStack::PopAndDestroy( strings ); |
|
2072 |
CleanupStack::PushL( stringholder ); |
|
2073 |
||
2074 |
AddTextFieldL( repIndex, *stringholder ); |
|
2075 |
CleanupStack::PopAndDestroy( stringholder ); |
|
2076 |
} |
|
2077 |
else |
|
2078 |
{ |
|
2079 |
// Repeats forever, string (e.g.) "From 17/01/2006" |
|
2080 |
CDesCArrayFlat* strings = new CDesCArrayFlat( 1 ); |
|
2081 |
CleanupStack::PushL( strings ); |
|
2082 |
||
2083 |
TBuf<KMaxDateLength> formattedTime; |
|
2084 |
start.FormatL( formattedTime, *iDateFormat ); |
|
2085 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedTime); |
|
2086 |
strings->AppendL( formattedTime ); |
|
2087 |
||
2088 |
HBufC* stringholder = StringLoader::LoadL( R_QTN_CALE_EVENT_VIEW_VALID_FOREVER, *strings ); |
|
2089 |
CleanupStack::PopAndDestroy( strings ); |
|
2090 |
CleanupStack::PushL( stringholder ); |
|
2091 |
||
2092 |
AddTextFieldL( repIndex, *stringholder ); |
|
2093 |
CleanupStack::PopAndDestroy( stringholder ); |
|
2094 |
} |
|
2095 |
||
2096 |
TRACE_EXIT_POINT; |
|
2097 |
} |
|
2098 |
||
2099 |
// ----------------------------------------------------------------------------- |
|
2100 |
// CCalenEventViewContainer::AddTimeFieldL |
|
2101 |
// Add entry time field text to the |
|
2102 |
// (other items were commented in a header). |
|
2103 |
// ----------------------------------------------------------------------------- |
|
2104 |
// |
|
2105 |
void CCalenEventViewContainer::AddTimeFieldL() |
|
2106 |
{ |
|
2107 |
TRACE_ENTRY_POINT; |
|
2108 |
||
2109 |
// If the start time is on the same day as the end time, just show the date. |
|
2110 |
// Otherwise, show "start date - end date". |
|
2111 |
TTime startTime = iEventViewData->StartDateTime(); |
|
2112 |
TTime endTime = iEventViewData->EndDateTime(); |
|
2113 |
iTimeFieldLines = 1; // Increment the value to be considered while drawing the map icon |
|
2114 |
TBuf<64> concatString; |
|
2115 |
||
2116 |
if( CalenDateUtils::OnSameDay(startTime, endTime) ) |
|
2117 |
{ |
|
2118 |
// String looks like (e.g.) "14:00 - 16:00 17/01/2006" |
|
2119 |
CDesCArrayFlat* strings = new CDesCArrayFlat( 3 ); |
|
2120 |
CleanupStack::PushL( strings ); |
|
2121 |
||
2122 |
TBuf<KMaxDateLength> formattedStartTime; |
|
2123 |
startTime.FormatL( formattedStartTime, *iTimeFormat ); |
|
2124 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedStartTime); |
|
2125 |
strings->AppendL( formattedStartTime ); |
|
2126 |
||
2127 |
TBuf<KMaxDateLength> formattedEndTime; |
|
2128 |
endTime.FormatL( formattedEndTime, *iTimeFormat ); |
|
2129 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedEndTime); |
|
2130 |
strings->AppendL( formattedEndTime ); |
|
2131 |
||
2132 |
TBuf<KMaxDateLength> formattedStartDate; |
|
2133 |
startTime.FormatL( formattedStartDate, *iDateFormat ); |
|
2134 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedStartDate); |
|
2135 |
strings->AppendL( formattedStartDate ); |
|
2136 |
||
2137 |
HBufC* stringholder = StringLoader::LoadLC( R_QTN_CALE_EVENT_VIEW_TIME_DAY, *strings ); |
|
2138 |
||
2139 |
TBool fits = TryToFitL(*stringholder, iMaxWidth, *iBodyFont); |
|
2140 |
if (fits) |
|
2141 |
{ |
|
2142 |
SetFormatAndAddBodyL(*stringholder); |
|
2143 |
} |
|
2144 |
else |
|
2145 |
{ |
|
2146 |
iTimeFieldLines++; // Increment the value to be considered while drawing the map icon |
|
2147 |
HBufC* wrappedStringholder = StringLoader::LoadLC( R_QTN_CALE_EVENT_VIEW_TIME_DAY_WRAPPED, *strings ); |
|
2148 |
SetFormatAndAddBodyL(*wrappedStringholder); |
|
2149 |
CleanupStack::PopAndDestroy(wrappedStringholder); |
|
2150 |
} |
|
2151 |
||
2152 |
CleanupStack::PopAndDestroy( stringholder ); |
|
2153 |
CleanupStack::PopAndDestroy( strings ); |
|
2154 |
} |
|
2155 |
else |
|
2156 |
{ |
|
2157 |
// String looks like (e.g.) "14:00 16/01/2006 - 16:00 19/01/2006" |
|
2158 |
CDesCArrayFlat* strings = new CDesCArrayFlat( 3 ); |
|
2159 |
CleanupStack::PushL( strings ); |
|
2160 |
||
2161 |
TBuf<KMaxDateLength> formattedStartTime; |
|
2162 |
startTime.FormatL( formattedStartTime, *iTimeFormat ); |
|
2163 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedStartTime); |
|
2164 |
strings->AppendL( formattedStartTime ); |
|
2165 |
||
2166 |
TBuf<KMaxDateLength> formattedStartDate; |
|
2167 |
startTime.FormatL( formattedStartDate, *iDateFormat ); |
|
2168 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedStartDate); |
|
2169 |
strings->AppendL( formattedStartDate ); |
|
2170 |
||
2171 |
TBuf<KMaxDateLength> formattedEndTime; |
|
2172 |
endTime.FormatL( formattedEndTime, *iTimeFormat ); |
|
2173 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedEndTime); |
|
2174 |
strings->AppendL( formattedEndTime ); |
|
2175 |
||
2176 |
TBuf<KMaxDateLength> formattedEndDate; |
|
2177 |
endTime.FormatL( formattedEndDate, *iDateFormat ); |
|
2178 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(formattedEndDate); |
|
2179 |
strings->AppendL( formattedEndDate ); |
|
2180 |
||
2181 |
HBufC* stringholder = StringLoader::LoadLC( R_QTN_CALE_EVENT_VIEW_TIME_DAYS, *strings ); |
|
2182 |
||
2183 |
TBool fits = TryToFitL(*stringholder, iMaxWidth, *iBodyFont); |
|
2184 |
if (fits) |
|
2185 |
{ |
|
2186 |
SetFormatAndAddBodyL(*stringholder); |
|
2187 |
} |
|
2188 |
else |
|
2189 |
{ |
|
2190 |
iTimeFieldLines++; |
|
2191 |
HBufC* wrappedStringholder = StringLoader::LoadLC( R_QTN_CALE_EVENT_VIEW_TIME_DAYS_WRAPPED, *strings ); |
|
2192 |
SetFormatAndAddBodyL(*wrappedStringholder); |
|
2193 |
CleanupStack::PopAndDestroy(wrappedStringholder); |
|
2194 |
} |
|
2195 |
||
2196 |
CleanupStack::PopAndDestroy( stringholder ); |
|
2197 |
CleanupStack::PopAndDestroy( strings ); |
|
2198 |
} |
|
2199 |
||
2200 |
TRACE_EXIT_POINT; |
|
2201 |
} |
|
2202 |
||
2203 |
// ----------------------------------------------------------------------------- |
|
2204 |
// CCalenEventViewContainer::MopSupplyObject |
|
2205 |
// Pass the skin information |
|
2206 |
// (other items were commented in a header). |
|
2207 |
// ----------------------------------------------------------------------------- |
|
2208 |
// |
|
2209 |
TTypeUid::Ptr CCalenEventViewContainer::MopSupplyObject( TTypeUid aId ) |
|
2210 |
{ |
|
2211 |
return MAknsControlContext::SupplyMopObject( aId, iBgContext ); |
|
2212 |
} |
|
2213 |
||
2214 |
||
2215 |
// ----------------------------------------------------------------------------- |
|
2216 |
// CCalenEventViewContainer::BuildSearchBufferL |
|
2217 |
// Generate the text string to use for text searches |
|
2218 |
// (other items were commented in a header). |
|
2219 |
// ----------------------------------------------------------------------------- |
|
2220 |
// |
|
2221 |
void CCalenEventViewContainer::BuildSearchBufferL() |
|
2222 |
{ |
|
2223 |
TRACE_ENTRY_POINT; |
|
2224 |
||
2225 |
// Get the full text from the form to use for search API. |
|
2226 |
TInt textLength = iTextEditor->RichText()->DocumentLength(); |
|
2227 |
||
2228 |
// Delete any existing search buffer |
|
2229 |
if (iSearchBuf) |
|
2230 |
{ |
|
2231 |
delete iSearchBuf; |
|
2232 |
iSearchBuf = NULL; |
|
2233 |
} |
|
2234 |
||
2235 |
// Text searched is currently summary , location and description |
|
2236 |
iSearchBuf = HBufC::NewL(textLength); |
|
2237 |
TPtr searchPtr = iSearchBuf->Des(); |
|
2238 |
GetTextFieldsFromFormL(searchPtr); |
|
2239 |
||
2240 |
TRACE_EXIT_POINT; |
|
2241 |
} |
|
2242 |
||
2243 |
// ----------------------------------------------------------------------------- |
|
2244 |
// CCalenEventViewContainer::GetTextFieldsFromFormL |
|
2245 |
// Gets the text fields from the form into a descriptor for |
|
2246 |
// the find api to use. |
|
2247 |
// Currently uses subject, location and description only |
|
2248 |
// (other items were commented in a header). |
|
2249 |
// ----------------------------------------------------------------------------- |
|
2250 |
// |
|
2251 |
void CCalenEventViewContainer::GetTextFieldsFromFormL(TDes& aDesc) |
|
2252 |
{ |
|
2253 |
TRACE_ENTRY_POINT; |
|
2254 |
||
2255 |
aDesc.Append(iEventViewData->Summary()); |
|
2256 |
aDesc.Append(_L(" \r\n")); |
|
2257 |
aDesc.Append(iEventViewData->Location()); |
|
2258 |
aDesc.Append(_L(" \r\n")); |
|
2259 |
aDesc.Append(iEventViewData->Description()); |
|
2260 |
aDesc.Append(_L(" \r\n")); |
|
2261 |
||
2262 |
TRACE_EXIT_POINT; |
|
2263 |
} |
|
2264 |
||
2265 |
// ----------------------------------------------------------------------------- |
|
2266 |
// CCalenEventViewContainer::GetTitleTextId |
|
2267 |
// Gets the title text resource |
|
2268 |
// ----------------------------------------------------------------------------- |
|
2269 |
// |
|
2270 |
TInt CCalenEventViewContainer::GetTitleTextId() |
|
2271 |
{ |
|
2272 |
TRACE_ENTRY_POINT; |
|
2273 |
TRACE_EXIT_POINT; |
|
2274 |
return iTitleTextId; |
|
2275 |
} |
|
2276 |
||
2277 |
// ----------------------------------------------------------------------------- |
|
2278 |
// CCalenEventViewContainer::ParentEntryL |
|
2279 |
// Returns the parent entry of the entry being edited. |
|
2280 |
// (other items were commented in a header). |
|
2281 |
// ----------------------------------------------------------------------------- |
|
2282 |
// |
|
2283 |
CCalEntry& CCalenEventViewContainer::ParentEntryL() |
|
2284 |
{ |
|
2285 |
TRACE_ENTRY_POINT; |
|
2286 |
MCalenContext& context = iServices.Context(); |
|
2287 |
||
2288 |
if(iFetchedEntries.Count() == 0) |
|
2289 |
{ |
|
2290 |
iServices.EntryViewL(context.InstanceId().iColId)->FetchL( iEntry->UidL(), iFetchedEntries ); |
|
2291 |
} |
|
2292 |
__ASSERT_ALWAYS( iFetchedEntries.Count() > 0, User::Panic(_L("CCalenEventViewContainer::ParentEntryL"),EPanicArrayOfSizeZero)); |
|
2293 |
||
2294 |
TRACE_EXIT_POINT; |
|
2295 |
return *iFetchedEntries[0]; |
|
2296 |
} |
|
2297 |
||
2298 |
// ----------------------------------------------------------------------------- |
|
2299 |
// CCalenEventViewContainer::AllInstancesL |
|
2300 |
// Returns all the instances associated with the entry being edited. |
|
2301 |
// (other items were commented in a header). |
|
2302 |
// ----------------------------------------------------------------------------- |
|
2303 |
// |
|
2304 |
RPointerArray<CCalEntry>& CCalenEventViewContainer::AllInstancesL() |
|
2305 |
{ |
|
2306 |
TRACE_ENTRY_POINT; |
|
2307 |
MCalenContext& context = iServices.Context(); |
|
2308 |
||
2309 |
if(iFetchedEntries.Count() == 0) |
|
2310 |
{ |
|
2311 |
iServices.EntryViewL(context.InstanceId().iColId)->FetchL( iEntry->UidL(), iFetchedEntries ); |
|
2312 |
} |
|
2313 |
||
2314 |
TRACE_EXIT_POINT; |
|
2315 |
return iFetchedEntries; |
|
2316 |
} |
|
2317 |
||
2318 |
// ----------------------------------------------------------------------------- |
|
2319 |
// CCalenEventViewContainer::GetEventViewData |
|
2320 |
// Gets the Event View Data |
|
2321 |
// ----------------------------------------------------------------------------- |
|
2322 |
// |
|
2323 |
CCalenEntryUtil* CCalenEventViewContainer::GetEventViewData() |
|
2324 |
{ |
|
2325 |
TRACE_ENTRY_POINT; |
|
2326 |
TRACE_EXIT_POINT; |
|
2327 |
return iEventViewData; |
|
2328 |
} |
|
2329 |
||
2330 |
||
2331 |
// ----------------------------------------------------------------------------- |
|
2332 |
// CCalenEventViewContainer::HandleNotifyError |
|
2333 |
// From MCenRepNotifyHandlerCallback |
|
2334 |
// ----------------------------------------------------------------------------- |
|
2335 |
// |
|
2336 |
void CCalenEventViewContainer::HandleNotifyError( TUint32 /*aId*/,TInt /*aError*/, |
|
2337 |
CCenRepNotifyHandler* /*aHandler*/ ) |
|
2338 |
{ |
|
2339 |
TRACE_ENTRY_POINT; |
|
2340 |
||
2341 |
if( iNotifier ) |
|
2342 |
{ |
|
2343 |
iNotifier->StopListening(); |
|
2344 |
delete iNotifier; |
|
2345 |
iNotifier = NULL; |
|
2346 |
} |
|
2347 |
||
2348 |
delete iCenRepSession; |
|
2349 |
iCenRepSession = NULL; |
|
2350 |
||
2351 |
TRACE_EXIT_POINT; |
|
2352 |
} |
|
2353 |
||
2354 |
||
2355 |
||
2356 |
||
2357 |
// ----------------------------------------------------------------------------- |
|
2358 |
// CCalenEventViewContainer::GetFindItemMenu |
|
2359 |
// ----------------------------------------------------------------------------- |
|
2360 |
// |
|
2361 |
CFindItemMenu* CCalenEventViewContainer::GetFindItemMenu() |
|
2362 |
{ |
|
2363 |
TRACE_ENTRY_POINT; |
|
2364 |
TRACE_EXIT_POINT; |
|
2365 |
||
2366 |
return iFindMenu; |
|
2367 |
} |
|
2368 |
||
2369 |
// ----------------------------------------------------------------------------- |
|
2370 |
// CCalenEventViewContainer::HandleScrollEventL |
|
2371 |
// Handles scroll events |
|
2372 |
// ----------------------------------------------------------------------------- |
|
2373 |
// |
|
2374 |
void CCalenEventViewContainer::HandleScrollEventL(CEikScrollBar* aScrollBar, |
|
2375 |
TEikScrollEvent aEventType) |
|
2376 |
{ |
|
2377 |
TRACE_ENTRY_POINT; |
|
2378 |
||
2379 |
iTextEditor->HandleScrollEventL(aScrollBar,aEventType); |
|
2380 |
||
2381 |
TRACE_EXIT_POINT; |
|
2382 |
} |
|
2383 |
||
2384 |
// ----------------------------------------------------------------------------- |
|
2385 |
// CCalenEventViewContainer::HandleStopCommandL |
|
2386 |
// Handles scroll events |
|
2387 |
// ----------------------------------------------------------------------------- |
|
2388 |
// |
|
2389 |
void CCalenEventViewContainer::HandleStopCommandL() |
|
2390 |
{ |
|
2391 |
TRACE_ENTRY_POINT; |
|
2392 |
||
2393 |
CCalenEventView* eventView = static_cast<CCalenEventView*>( iView ); |
|
2394 |
||
2395 |
eventView->HandleCommandL( ECalenStopAlarm ); |
|
2396 |
||
2397 |
TRACE_EXIT_POINT; |
|
2398 |
} |
|
2399 |
||
2400 |
// ---------------------------------------------------------------------------- |
|
2401 |
// CCalenEventViewContainer::IsEventHasMapLocationOrNoLocationTextL |
|
2402 |
// Stores the necessary information in the context |
|
2403 |
// and returns ETrue if event has geo coordinates else EFalse |
|
2404 |
// ---------------------------------------------------------------------------- |
|
2405 |
TBool CCalenEventViewContainer::IsEventHasMapLocationL() |
|
2406 |
{ |
|
2407 |
if(iEntry) |
|
2408 |
{ |
|
2409 |
CCalGeoValue* geoValue = iEntry->GeoValueL(); |
|
2410 |
if(geoValue) |
|
2411 |
{ |
|
2412 |
delete geoValue; |
|
2413 |
return ETrue; |
|
2414 |
} |
|
2415 |
else |
|
2416 |
{ |
|
2417 |
return EFalse; |
|
2418 |
} |
|
2419 |
} |
|
2420 |
else |
|
2421 |
{ |
|
2422 |
return EFalse; |
|
2423 |
} |
|
2424 |
} |
|
2425 |
||
2426 |
// ---------------------------------------------------------------------------- |
|
2427 |
// CCalenEventViewContainer::IsEventHasNoLocationTextL |
|
2428 |
// Returns ETrue if event has location text else EFalse |
|
2429 |
// ---------------------------------------------------------------------------- |
|
2430 |
TBool CCalenEventViewContainer::IsEventHasNoLocationTextL() |
|
2431 |
{ |
|
2432 |
if(iEntry) |
|
2433 |
{ |
|
2434 |
TPtrC location = iEntry->LocationL(); |
|
2435 |
if(!location.Length()) |
|
2436 |
{ |
|
2437 |
return ETrue; |
|
2438 |
} |
|
2439 |
else |
|
2440 |
{ |
|
2441 |
return EFalse; |
|
2442 |
} |
|
2443 |
} |
|
2444 |
else |
|
2445 |
{ |
|
2446 |
return EFalse; |
|
2447 |
} |
|
2448 |
} |
|
2449 |
||
2450 |
// ---------------------------------------------------------------------------- |
|
2451 |
// CCalenEventView::OnLocaleChangedL |
|
2452 |
// (other items were commented in a header). |
|
2453 |
// ---------------------------------------------------------------------------- |
|
2454 |
// |
|
2455 |
void CCalenEventViewContainer::HandleLocaleChangedL(/* TInt aReason */) |
|
2456 |
{ |
|
2457 |
TRACE_ENTRY_POINT; |
|
2458 |
||
2459 |
iLocaleChanged = ETrue; |
|
2460 |
||
2461 |
TRACE_EXIT_POINT; |
|
2462 |
} |
|
2463 |
||
2464 |
// ----------------------------------------------------------------------------- |
|
2465 |
// CCalenEventViewContainer::AddCalendarInfoFieldL |
|
2466 |
// Adds calendar info field to the viewer |
|
2467 |
// ----------------------------------------------------------------------------- |
|
2468 |
// |
|
2469 |
void CCalenEventViewContainer::AddCalendarInfoFieldL() |
|
2470 |
{ |
|
2471 |
TRACE_ENTRY_POINT; |
|
2472 |
TCalCollectionId colId = iServices.Context().InstanceId().iColId; |
|
2473 |
||
2474 |
RPointerArray<CCalCalendarInfo> calendarInfoList; |
|
2475 |
iServices.GetAllCalendarInfoL(calendarInfoList); |
|
2476 |
CleanupClosePushL(calendarInfoList); |
|
2477 |
||
2478 |
HBufC* calendarFileName = iServices.GetCalFileNameForCollectionId(colId).AllocLC(); |
|
2479 |
TInt index = calendarInfoList.Find( *calendarFileName, |
|
2480 |
CCalenEventViewContainer::CalendarInfoIdentifierL); |
|
2481 |
CleanupStack::PopAndDestroy(calendarFileName); |
|
2482 |
if(index != KErrNotFound) |
|
2483 |
{ |
|
2484 |
// add the calendar info's text field |
|
2485 |
AddTextFieldL( |
|
2486 |
R_CALE_VIEWER_CALENDAR_INFO, calendarInfoList[index]->NameL()); |
|
2487 |
} |
|
2488 |
CleanupStack::PopAndDestroy(&calendarInfoList); |
|
2489 |
TRACE_EXIT_POINT; |
|
2490 |
} |
|
2491 |
||
2492 |
// ----------------------------------------------------------------------------- |
|
2493 |
// CCalenEventViewContainer::CalendarInfoIdentifierL |
|
2494 |
// Searches for the index in calendar info list based on calendar file name |
|
2495 |
// ----------------------------------------------------------------------------- |
|
2496 |
// |
|
2497 |
TBool CCalenEventViewContainer::CalendarInfoIdentifierL( const HBufC* aName, |
|
2498 |
const CCalCalendarInfo& aCalendarInfo) |
|
2499 |
{ |
|
2500 |
TRACE_ENTRY_POINT; |
|
2501 |
TBool retVal = EFalse; |
|
2502 |
HBufC* calendarFileName = aCalendarInfo.FileNameL().AllocLC(); |
|
2503 |
retVal = calendarFileName->CompareF(*aName); |
|
2504 |
CleanupStack::PopAndDestroy(calendarFileName); |
|
2505 |
TRACE_EXIT_POINT; |
|
2506 |
return (!retVal); |
|
2507 |
} |
|
2508 |
||
2509 |
// ---------------------------------------------------------------------------- |
|
2510 |
// ---------------------------------------------------------------------------- |
|
2511 |
// CCalenEventViewContainer::AddAttachmentFieldL |
|
2512 |
// Adds attachment field |
|
2513 |
// ---------------------------------------------------------------------------- |
|
2514 |
// |
|
2515 |
void CCalenEventViewContainer::AddAttachmentFieldL() |
|
2516 |
{ |
|
2517 |
TRACE_ENTRY_POINT; |
|
2518 |
||
2519 |
// format and add heading "Attachment:" |
|
2520 |
HBufC* textHeading = StringLoader::LoadLC(R_CALE_EVENT_VIEW_ATTACHMENT_INFO); |
|
2521 |
SetFormatAndAddHeadingL(*textHeading); |
|
2522 |
CleanupStack::PopAndDestroy(textHeading); |
|
2523 |
||
2524 |
||
2525 |
||
2526 |
RPointerArray<HBufC> attachmentNames; |
|
2527 |
||
2528 |
iEventViewData->AttachmentNamesL(attachmentNames); |
|
2529 |
TInt attachmentsCount = attachmentNames.Count(); |
|
2530 |
||
2531 |
//Reset the attachment posiitons array before addign them |
|
2532 |
iAttachmentPosInfoArray.Reset(); |
|
2533 |
||
2534 |
for(TInt i = 0; i < attachmentsCount; i++) |
|
2535 |
{ |
|
2536 |
AddAttachmentNameL(*attachmentNames[i]); |
|
2537 |
} |
|
2538 |
// Add in a paragraph delimeter character |
|
2539 |
// Without this, long descriptions get cut off half way down the last line. |
|
2540 |
CRichText* richText = iTextEditor->RichText(); |
|
2541 |
richText->InsertL(richText->DocumentLength(), CEditableText::EParagraphDelimiter); |
|
2542 |
attachmentNames.ResetAndDestroy(); |
|
2543 |
||
2544 |
TRACE_EXIT_POINT; |
|
2545 |
} |
|
2546 |
||
2547 |
// ----------------------------------------------------------------------------- |
|
2548 |
// CCalenEventViewContainer::AddFormattedTextL |
|
2549 |
// Add a string to the view. |
|
2550 |
// (other items were commented in a header). |
|
2551 |
// ----------------------------------------------------------------------------- |
|
2552 |
// |
|
2553 |
void CCalenEventViewContainer::AddAttachmentNameL(const TDesC& aText) |
|
2554 |
{ |
|
2555 |
TRACE_ENTRY_POINT; |
|
2556 |
||
2557 |
// Set the charatcer formats and paragraph formats |
|
2558 |
iCharFormatMask.ClearAll(); |
|
2559 |
iParaFormat->iLeftMarginInTwips = iBodyIndent; |
|
2560 |
iCharFormat.iFontSpec = iBodyFontSpec; |
|
2561 |
iCharFormat.iFontPresentation.iUnderline = EUnderlineOn; |
|
2562 |
iCharFormatMask.SetAttrib(EAttFontUnderline); |
|
2563 |
iCharFormatMask.SetAttrib(EAttFontHeight); |
|
2564 |
iCharFormatMask.SetAttrib(EAttFontTypeface) ; |
|
2565 |
iCharFormatMask.SetAttrib(EAttFontStrokeWeight); |
|
2566 |
||
2567 |
// Add the text into the richtext document |
|
2568 |
CRichText* richText = iTextEditor->RichText(); |
|
2569 |
TInt startPos = richText->DocumentLength(); |
|
2570 |
HBufC* text = HBufC::NewLC( aText.Length() + 10); |
|
2571 |
TPtr target = text->Des(); |
|
2572 |
if(AknLayoutUtils::LayoutMirrored()) |
|
2573 |
{ |
|
2574 |
target.Append(KArabicSummaryMarker); |
|
2575 |
} |
|
2576 |
else |
|
2577 |
{ |
|
2578 |
target.Append(KWesternSummaryMarker); |
|
2579 |
} |
|
2580 |
target.Append(aText); |
|
2581 |
target.Append(KAttachmentSeparator); // Append the attachment seperator |
|
2582 |
TTextPos posInfo; |
|
2583 |
posInfo.iDocStart = richText->DocumentLength(); |
|
2584 |
richText->InsertL(startPos, target); |
|
2585 |
posInfo.iDocEnd = richText->DocumentLength(); |
|
2586 |
iAttachmentPosInfoArray.Append(posInfo); |
|
2587 |
TInt endPos = richText->DocumentLength(); |
|
2588 |
richText->ApplyCharFormatL(iCharFormat, iCharFormatMask, startPos, (endPos - startPos - 1)); |
|
2589 |
++startPos; // Without this the previous paragraph is formatted as well, ie no indent |
|
2590 |
richText->ApplyParaFormatL(iParaFormat, iParaFormatMask, startPos, (endPos - startPos - 1)); |
|
2591 |
CleanupStack::PopAndDestroy(text); |
|
2592 |
||
2593 |
TRACE_EXIT_POINT; |
|
2594 |
} |
|
2595 |
||
2596 |
// ---------------------------------------------------------------------------- |
|
2597 |
// CCalenEventViewContainer::OpenViewerL() |
|
2598 |
// Opens the attachment in the Viewer |
|
2599 |
// ---------------------------------------------------------------------------- |
|
2600 |
// |
|
2601 |
void CCalenEventViewContainer::OpenViewerL(TInt attachmentToBeOpened) |
|
2602 |
{ |
|
2603 |
// Update the Attahcment model with the attahcments of the current entry |
|
2604 |
iServices.GetAttachmentData()->CheckForExistingAttachmentsL(iEntry); |
|
2605 |
||
2606 |
// Get the file handler |
|
2607 |
RFile file = iServices.GetAttachmentData()->GetAttachmentFileL( attachmentToBeOpened ); |
|
2608 |
CleanupClosePushL(file); |
|
2609 |
// Hide the toolbar before opening the attachment |
|
2610 |
MCalenToolbar* toolbar = iServices.ToolbarOrNull(); |
|
2611 |
if(toolbar && toolbar->IsVisible()) |
|
2612 |
{ |
|
2613 |
toolbar->SetToolbarVisibilityL(EFalse); |
|
2614 |
} |
|
2615 |
||
2616 |
CCalenEventView* eventView = static_cast<CCalenEventView*>( iView ); |
|
2617 |
eventView->HideNaviPane(); |
|
2618 |
//open the attachment |
|
2619 |
OpenAttachmentViewerL(file, *this); |
|
2620 |
if(!iEmbeddedFileOpened) |
|
2621 |
{ |
|
2622 |
eventView->RedrawStatusPaneL(); |
|
2623 |
} |
|
2624 |
CleanupStack::PopAndDestroy(&file); |
|
2625 |
||
2626 |
||
2627 |
// Unhide the toolbar after coming back |
|
2628 |
if(toolbar) |
|
2629 |
{ |
|
2630 |
toolbar->SetToolbarVisibilityL(ETrue); |
|
2631 |
} |
|
2632 |
} |
|
2633 |
||
2634 |
// ---------------------------------------------------------------------------- |
|
2635 |
// CCalenEventViewContainer::HandleServerAppExit |
|
2636 |
// (other items were commented in a header). |
|
2637 |
// ---------------------------------------------------------------------------- |
|
2638 |
// |
|
2639 |
void CCalenEventViewContainer::HandleServerAppExit( TInt aReason) |
|
2640 |
{ |
|
2641 |
TRACE_ENTRY_POINT; |
|
2642 |
||
2643 |
iEmbeddedFileOpened = EFalse; |
|
2644 |
iServices.GetAttachmentData()->AttachmentOpen(iEmbeddedFileOpened); |
|
2645 |
if (aReason == EAknCmdExit) |
|
2646 |
{ |
|
2647 |
//issue this notification, which will be handled by attachmentui. |
|
2648 |
} |
|
2649 |
||
2650 |
TRACE_EXIT_POINT; |
|
2651 |
} |
|
2652 |
||
2653 |
// ---------------------------------------------------------------------------- |
|
2654 |
// CCalenEventViewContainer::CheckAndOpenTappedAttachment |
|
2655 |
// Checks if it is tapped on any attachment, if yes, then opens that attachment |
|
2656 |
// (other items were commented in a header). |
|
2657 |
// ---------------------------------------------------------------------------- |
|
2658 |
// |
|
2659 |
void CCalenEventViewContainer::CheckAndOpenTappedAttachmentL(TTmPosInfo2* posInfo) |
|
2660 |
{ |
|
2661 |
// iterate through iAttachmentPosInfoArray to see if posInfo falls in any of the range |
|
2662 |
TInt attachmentToBeOpened = -1; |
|
2663 |
for(TInt i = 0; i < iAttachmentPosInfoArray.Count(); i++) |
|
2664 |
{ |
|
2665 |
if( (posInfo->iDocPos.iPos >= iAttachmentPosInfoArray[i].iDocStart) && ( posInfo->iDocPos.iPos < iAttachmentPosInfoArray[i].iDocEnd )) |
|
2666 |
{ |
|
2667 |
attachmentToBeOpened = i; |
|
2668 |
break; |
|
2669 |
} |
|
2670 |
} |
|
2671 |
if(attachmentToBeOpened != -1) |
|
2672 |
{ |
|
2673 |
OpenViewerL(attachmentToBeOpened); |
|
2674 |
} |
|
2675 |
} |
|
2676 |
||
2677 |
// ----------------------------------------------------------------------------- |
|
2678 |
// CCalenCommonUI::FindPossibleInstanceL |
|
2679 |
// Finds an instance with the given instance id and instance view. |
|
2680 |
// (other items were commented in a header). |
|
2681 |
// ----------------------------------------------------------------------------- |
|
2682 |
// |
|
2683 |
CCalInstance* CCalenEventViewContainer::FindPossibleInstanceL( |
|
2684 |
const TCalenInstanceId& aId, |
|
2685 |
CCalInstanceView& aInstanceView ) |
|
2686 |
{ |
|
2687 |
TRACE_ENTRY_POINT; |
|
2688 |
||
2689 |
RPointerArray<CCalInstance> instances; |
|
2690 |
CleanupResetAndDestroyPushL( instances ); |
|
2691 |
||
2692 |
//If timezone is changed we need to read the latest instance time |
|
2693 |
//SO we are reading all the instances in the timerange of past 24 hrs ans next 24 hrs minus |
|
2694 |
//a minute so that instanceid shouldnt match with daily repeat meeting |
|
2695 |
TCalTime momentStart, momentEnd; |
|
2696 |
momentStart.SetTimeLocalL( (aId.iInstanceTime - TTimeIntervalDays(1)) + TTimeIntervalMinutes(1)); |
|
2697 |
momentEnd.SetTimeLocalL( (aId.iInstanceTime + TTimeIntervalDays(1)) - TTimeIntervalMinutes(1)); |
|
2698 |
CalCommon::TCalTimeRange range( momentStart, momentEnd ); |
|
2699 |
aInstanceView.FindInstanceL( instances, CalCommon::EIncludeAll, range ); |
|
2700 |
||
2701 |
CCalInstance* result = NULL; |
|
2702 |
||
2703 |
// For instances finishing the next day (now possible with unified DateTime editor), |
|
2704 |
// we have to do our best to match the instance time exactly - otherwise we could |
|
2705 |
// match the LocalUid to the incorrect instance in a series. |
|
2706 |
for ( TInt i=0; i < instances.Count() && !result; ++i ) |
|
2707 |
{ |
|
2708 |
if( instances[i]->Entry().LocalUidL() == aId.iEntryLocalUid ) |
|
2709 |
{ |
|
2710 |
// Check the instance time matches. |
|
2711 |
if( instances[i]->StartTimeL().TimeLocalL() == aId.iInstanceTime ) |
|
2712 |
{ |
|
2713 |
result = instances[i]; |
|
2714 |
instances.Remove(i); |
|
2715 |
} |
|
2716 |
} |
|
2717 |
} |
|
2718 |
||
2719 |
if( !result ) |
|
2720 |
{ |
|
2721 |
// Couldn't match the instance time exactly - just use the instance |
|
2722 |
// with the same LocalUid as the one we're looking for. |
|
2723 |
for ( TInt i=0; i < instances.Count() && !result; ++i ) |
|
2724 |
{ |
|
2725 |
if( instances[i]->Entry().LocalUidL() == aId.iEntryLocalUid ) |
|
2726 |
{ |
|
2727 |
result = instances[i]; |
|
2728 |
instances.Remove(i); |
|
2729 |
} |
|
2730 |
} |
|
2731 |
} |
|
2732 |
||
2733 |
CleanupStack::PopAndDestroy( &instances ); |
|
2734 |
||
2735 |
TRACE_EXIT_POINT; |
|
2736 |
return result; |
|
2737 |
} |
|
2738 |
||
2739 |
// ----------------------------------------------------------------------------- |
|
2740 |
// CCalenEventViewContainer::OpenAttachmentL |
|
2741 |
// Opens a particular attachment |
|
2742 |
// ----------------------------------------------------------------------------- |
|
2743 |
// |
|
2744 |
void CCalenEventViewContainer::OpenAttachmentViewerL(RFile& aFile, MAknServerAppExitObserver& /*aExitObserver*/) |
|
2745 |
{ |
|
2746 |
TRACE_ENTRY_POINT; |
|
2747 |
||
2748 |
TBuf<250> fileName; |
|
2749 |
aFile.FullName(fileName); |
|
2750 |
TDataType datatype( CCalenAttachmentUtils::GetMimeType(aFile) ); |
|
2751 |
||
2752 |
TInt ret = KErrNone; |
|
2753 |
||
2754 |
if(datatype == KNotePadTextDataType()) |
|
2755 |
{ |
|
2756 |
if(iEmbeddedFileOpened) |
|
2757 |
{ |
|
2758 |
return; |
|
2759 |
} |
|
2760 |
iEmbeddedFileOpened = ETrue; |
|
2761 |
const TDesC& notepadTitle = _L("NotePad"); |
|
2762 |
ret = CNotepadApi::ExecFileViewerL( aFile, |
|
2763 |
¬epadTitle, |
|
2764 |
ETrue, |
|
2765 |
ETrue, |
|
2766 |
KCharacterSetIdentifierIso88591 ); |
|
2767 |
iEmbeddedFileOpened = EFalse; |
|
2768 |
||
2769 |
} |
|
2770 |
else |
|
2771 |
{ |
|
2772 |
//doc handler will open the other files (other than text file). |
|
2773 |
TRAP( ret, iDocHandler->OpenFileEmbeddedL( aFile, datatype ) ); |
|
2774 |
||
2775 |
if(ret == KErrNone) |
|
2776 |
{ |
|
2777 |
iEmbeddedFileOpened = ETrue; |
|
2778 |
} |
|
2779 |
} |
|
2780 |
iServices.GetAttachmentData()->AttachmentOpen(iEmbeddedFileOpened); |
|
2781 |
||
2782 |
switch(ret) |
|
2783 |
{ |
|
2784 |
case KErrNone: |
|
2785 |
break; |
|
2786 |
default: |
|
2787 |
{ |
|
2788 |
CAknInformationNote* note = new ( ELeave ) CAknInformationNote; |
|
2789 |
HBufC* cannotOpen = StringLoader::LoadLC( |
|
2790 |
R_QTN_CALEN_INFO_CANNOT_OPEN, CEikonEnv::Static() ); |
|
2791 |
note->ExecuteLD( *cannotOpen ); |
|
2792 |
CleanupStack::PopAndDestroy(); |
|
2793 |
} |
|
2794 |
break; |
|
2795 |
} |
|
2796 |
TRACE_EXIT_POINT |
|
2797 |
} |
|
2798 |
||
2799 |
// ----------------------------------------------------------------------------- |
|
2800 |
// OnCmdFindPhoneNumL |
|
2801 |
// Find phone numbers in the form. |
|
2802 |
// (other items were commented in a header). |
|
2803 |
// ----------------------------------------------------------------------------- |
|
2804 |
// |
|
2805 |
void CCalenEventViewContainer::OnCmdFindPhoneNumL() |
|
2806 |
{ |
|
2807 |
TRACE_ENTRY_POINT; |
|
2808 |
BuildSearchBufferL(); |
|
2809 |
MCalenToolbar* toolbar = iServices.ToolbarOrNull(); |
|
2810 |
CFindItemDialog* finder = CFindItemDialog::NewL( *iSearchBuf, CFindItemEngine::EFindItemSearchPhoneNumberBin); |
|
2811 |
finder->EnableSingleClick(ETrue); |
|
2812 |
toolbar->SetToolbarVisibilityL(EFalse); |
|
2813 |
finder->ExecuteLD(); |
|
2814 |
toolbar->SetToolbarVisibilityL(ETrue); |
|
2815 |
||
2816 |
TRACE_EXIT_POINT; |
|
2817 |
} |
|
2818 |
||
2819 |
// ----------------------------------------------------------------------------- |
|
2820 |
// OnCmdFindUrlL |
|
2821 |
// Find urls in the form. |
|
2822 |
// (other items were commented in a header). |
|
2823 |
// ----------------------------------------------------------------------------- |
|
2824 |
// |
|
2825 |
void CCalenEventViewContainer::OnCmdFindUrlL() |
|
2826 |
{ |
|
2827 |
TRACE_ENTRY_POINT; |
|
2828 |
BuildSearchBufferL(); |
|
2829 |
MCalenToolbar* toolbar = iServices.ToolbarOrNull(); |
|
2830 |
CFindItemDialog* finder = CFindItemDialog::NewL( *iSearchBuf, CFindItemEngine::EFindItemSearchURLBin); |
|
2831 |
finder->EnableSingleClick(ETrue); |
|
2832 |
toolbar->SetToolbarVisibilityL(EFalse); |
|
2833 |
finder->ExecuteLD(); |
|
2834 |
toolbar->SetToolbarVisibilityL(ETrue); |
|
2835 |
TRACE_EXIT_POINT; |
|
2836 |
} |
|
2837 |
||
2838 |
// ----------------------------------------------------------------------------- |
|
2839 |
// OnCmdFindEmailL |
|
2840 |
// Find email addresses in the form. |
|
2841 |
// (other items were commented in a header). |
|
2842 |
// ----------------------------------------------------------------------------- |
|
2843 |
// |
|
2844 |
void CCalenEventViewContainer::OnCmdFindEmailL() |
|
2845 |
{ |
|
2846 |
TRACE_ENTRY_POINT; |
|
2847 |
BuildSearchBufferL(); |
|
2848 |
MCalenToolbar* toolbar = iServices.ToolbarOrNull(); |
|
2849 |
CFindItemDialog* finder = CFindItemDialog::NewL( *iSearchBuf, CFindItemEngine::EFindItemSearchMailAddressBin); |
|
2850 |
finder->EnableSingleClick(ETrue); |
|
2851 |
toolbar->SetToolbarVisibilityL(EFalse); |
|
2852 |
finder->ExecuteLD(); |
|
2853 |
toolbar->SetToolbarVisibilityL(ETrue); |
|
2854 |
TRACE_EXIT_POINT; |
|
2855 |
} |
|
2856 |
||
2857 |
// end of file |
|
2858 |