64
|
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: ESMR UI Container class
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include "cesmrvieweralldayeventfield.h"
|
|
20 |
#include "cesmreditor.h"
|
|
21 |
#include "mesmrlistobserver.h"
|
|
22 |
#include "nmrlayoutmanager.h"
|
|
23 |
#include "cmrlabel.h"
|
|
24 |
#include "cmrimage.h"
|
|
25 |
#include "cesmrglobalnote.h"
|
|
26 |
|
|
27 |
#include <caluser.h>
|
|
28 |
#include <calalarm.h>
|
|
29 |
#include <calentry.h>
|
|
30 |
#include <StringLoader.h>
|
|
31 |
#include <AknLayout2ScalableDef.h>
|
|
32 |
#include <esmrgui.rsg>
|
|
33 |
|
|
34 |
#include "emailtrace.h"
|
|
35 |
|
|
36 |
|
|
37 |
// ======== MEMBER FUNCTIONS ========
|
|
38 |
|
|
39 |
// ---------------------------------------------------------------------------
|
|
40 |
// CESMRViewerAllDayEventField::NewL()
|
|
41 |
// ---------------------------------------------------------------------------
|
|
42 |
//
|
|
43 |
CESMRViewerAllDayEventField* CESMRViewerAllDayEventField::NewL()
|
|
44 |
{
|
|
45 |
FUNC_LOG;
|
|
46 |
CESMRViewerAllDayEventField* self = new (ELeave) CESMRViewerAllDayEventField();
|
|
47 |
CleanupStack::PushL( self );
|
|
48 |
self->ConstructL();
|
|
49 |
CleanupStack::Pop( self );
|
|
50 |
return self;
|
|
51 |
}
|
|
52 |
|
|
53 |
// ---------------------------------------------------------------------------
|
|
54 |
// CESMRViewerAllDayEventField::~CESMRViewerAllDayEventField()
|
|
55 |
// ---------------------------------------------------------------------------
|
|
56 |
//
|
|
57 |
CESMRViewerAllDayEventField::~CESMRViewerAllDayEventField()
|
|
58 |
{
|
|
59 |
FUNC_LOG;
|
|
60 |
delete iIcon;
|
|
61 |
delete iLockIcon;
|
|
62 |
}
|
|
63 |
|
|
64 |
// ---------------------------------------------------------------------------
|
|
65 |
// CESMRViewerAllDayEventField::CESMRViewerAllDayEventField()
|
|
66 |
// ---------------------------------------------------------------------------
|
|
67 |
//
|
|
68 |
CESMRViewerAllDayEventField::CESMRViewerAllDayEventField()
|
|
69 |
{
|
|
70 |
FUNC_LOG;
|
|
71 |
SetFieldId( EESMRFieldAllDayEvent );
|
|
72 |
SetFocusType( EESMRHighlightFocus );
|
|
73 |
}
|
|
74 |
|
|
75 |
// ---------------------------------------------------------------------------
|
|
76 |
// CESMRViewerAllDayEventField::ConstructL()
|
|
77 |
// ---------------------------------------------------------------------------
|
|
78 |
//
|
|
79 |
void CESMRViewerAllDayEventField::ConstructL()
|
|
80 |
{
|
|
81 |
FUNC_LOG;
|
|
82 |
iLabel = CMRLabel::NewL( this );
|
|
83 |
CESMRField::ConstructL( iLabel ); // ownership transfered
|
|
84 |
|
|
85 |
iIcon = CMRImage::NewL(
|
|
86 |
NMRBitmapManager::EMRBitmapCheckBoxOn,
|
|
87 |
this );
|
|
88 |
}
|
|
89 |
|
|
90 |
// ---------------------------------------------------------------------------
|
|
91 |
// CESMRViewerAllDayEventField::InternalizeL()
|
|
92 |
// ---------------------------------------------------------------------------
|
|
93 |
//
|
|
94 |
void CESMRViewerAllDayEventField::InternalizeL( MESMRCalEntry& aEntry )
|
|
95 |
{
|
|
96 |
FUNC_LOG;
|
|
97 |
if ( aEntry.IsAllDayEventL() )
|
|
98 |
{
|
|
99 |
HBufC* allDayEventText =
|
|
100 |
StringLoader::LoadLC( R_QTN_MEET_REQ_ALL_DAY_EVENT, iEikonEnv );
|
|
101 |
iLabel->SetTextL( *allDayEventText );
|
|
102 |
CleanupStack::PopAndDestroy( allDayEventText );
|
|
103 |
}
|
|
104 |
else
|
|
105 |
{
|
|
106 |
// set the field as hidden:
|
|
107 |
MakeVisible( EFalse );
|
|
108 |
}
|
|
109 |
}
|
|
110 |
|
|
111 |
// ---------------------------------------------------------------------------
|
|
112 |
// CESMRViewerAllDayEventField::InitializeL()
|
|
113 |
// ---------------------------------------------------------------------------
|
|
114 |
//
|
|
115 |
void CESMRViewerAllDayEventField::InitializeL()
|
|
116 |
{
|
|
117 |
// No implementation yet
|
|
118 |
}
|
|
119 |
|
|
120 |
// ---------------------------------------------------------------------------
|
|
121 |
// CESMRViewerAllDayEventField::SizeChanged()
|
|
122 |
// ---------------------------------------------------------------------------
|
|
123 |
//
|
|
124 |
void CESMRViewerAllDayEventField::SizeChanged()
|
|
125 |
{
|
|
126 |
TRect rect = Rect();
|
|
127 |
TAknLayoutRect rowLayoutRect =
|
|
128 |
NMRLayoutManager::GetFieldRowLayoutRect( rect, 1 );
|
|
129 |
rect = rowLayoutRect.Rect();
|
|
130 |
|
|
131 |
TAknWindowComponentLayout iconLayout =
|
|
132 |
NMRLayoutManager::GetWindowComponentLayout( NMRLayoutManager::EMRLayoutTextEditorIcon );
|
|
133 |
AknLayoutUtils::LayoutImage( iIcon, rect, iconLayout );
|
|
134 |
|
|
135 |
// Layouting lock icon
|
|
136 |
if( iLockIcon )
|
|
137 |
{
|
|
138 |
TAknWindowComponentLayout iconLayout(
|
|
139 |
NMRLayoutManager::GetWindowComponentLayout(
|
|
140 |
NMRLayoutManager::EMRLayoutSingleRowDColumnGraphic ) );
|
|
141 |
AknLayoutUtils::LayoutImage( iLockIcon, rect, iconLayout );
|
|
142 |
}
|
|
143 |
|
|
144 |
// Layouting label
|
|
145 |
TAknTextComponentLayout viewerLayoutText;
|
|
146 |
|
|
147 |
if( iLockIcon )
|
|
148 |
{
|
|
149 |
viewerLayoutText = NMRLayoutManager::GetTextComponentLayout(
|
|
150 |
NMRLayoutManager::EMRTextLayoutSingleRowEditorText );
|
|
151 |
}
|
|
152 |
else
|
|
153 |
{
|
|
154 |
viewerLayoutText = NMRLayoutManager::GetTextComponentLayout(
|
|
155 |
NMRLayoutManager::EMRTextLayoutTextEditor );
|
|
156 |
}
|
|
157 |
|
|
158 |
AknLayoutUtils::LayoutLabel( iLabel, rect, viewerLayoutText );
|
|
159 |
TRect viewerRect( iLabel->Rect() );
|
|
160 |
|
|
161 |
// Move focus rect so that it's relative to field's position.
|
|
162 |
viewerRect.Move( -Position() );
|
|
163 |
SetFocusRect( viewerRect );
|
|
164 |
}
|
|
165 |
|
|
166 |
// ---------------------------------------------------------------------------
|
|
167 |
// CESMRViewerAllDayEventField::CountComponentControls()
|
|
168 |
// ---------------------------------------------------------------------------
|
|
169 |
//
|
|
170 |
TInt CESMRViewerAllDayEventField::CountComponentControls() const
|
|
171 |
{
|
|
172 |
TInt count( 0 );
|
|
173 |
if ( iIcon )
|
|
174 |
{
|
|
175 |
++count;
|
|
176 |
}
|
|
177 |
|
|
178 |
if ( iLabel )
|
|
179 |
{
|
|
180 |
++count;
|
|
181 |
}
|
|
182 |
if ( iLockIcon )
|
|
183 |
{
|
|
184 |
++count;
|
|
185 |
}
|
|
186 |
return count;
|
|
187 |
}
|
|
188 |
|
|
189 |
// ---------------------------------------------------------------------------
|
|
190 |
// CESMRViewerAllDayEventField::ComponentControl()
|
|
191 |
// ---------------------------------------------------------------------------
|
|
192 |
//
|
|
193 |
CCoeControl* CESMRViewerAllDayEventField::ComponentControl( TInt aIndex ) const
|
|
194 |
{
|
|
195 |
switch ( aIndex )
|
|
196 |
{
|
|
197 |
case 0:
|
|
198 |
return iIcon;
|
|
199 |
case 1:
|
|
200 |
return iLabel;
|
|
201 |
case 2:
|
|
202 |
return iLockIcon;
|
|
203 |
default:
|
|
204 |
return NULL;
|
|
205 |
}
|
|
206 |
}
|
|
207 |
|
|
208 |
// ---------------------------------------------------------------------------
|
|
209 |
// CESMRViewerStartDateField::SetOutlineFocusL()
|
|
210 |
// ---------------------------------------------------------------------------
|
|
211 |
//
|
|
212 |
void CESMRViewerAllDayEventField::SetOutlineFocusL( TBool aFocus )
|
|
213 |
{
|
|
214 |
CESMRField::SetOutlineFocusL ( aFocus );
|
|
215 |
|
|
216 |
iLabel->SetFocus( aFocus );
|
|
217 |
}
|
|
218 |
|
|
219 |
// ---------------------------------------------------------------------------
|
|
220 |
// CESMRViewerStartDateField::LockL()
|
|
221 |
// ---------------------------------------------------------------------------
|
|
222 |
//
|
|
223 |
void CESMRViewerAllDayEventField::LockL()
|
|
224 |
{
|
|
225 |
FUNC_LOG;
|
|
226 |
if( IsLocked() )
|
|
227 |
{
|
|
228 |
return;
|
|
229 |
}
|
|
230 |
|
|
231 |
CESMRField::LockL();
|
|
232 |
|
|
233 |
delete iLockIcon;
|
|
234 |
iLockIcon = NULL;
|
|
235 |
iLockIcon = CMRImage::NewL(
|
|
236 |
NMRBitmapManager::EMRBitmapLockField,
|
|
237 |
this,
|
|
238 |
ETrue );
|
|
239 |
}
|
|
240 |
|
|
241 |
// ---------------------------------------------------------------------------
|
|
242 |
// CESMRViewerStartDateField::ExecuteGenericCommandL()
|
|
243 |
// ---------------------------------------------------------------------------
|
|
244 |
//
|
|
245 |
TBool CESMRViewerAllDayEventField::ExecuteGenericCommandL( TInt aCommand )
|
|
246 |
{
|
|
247 |
FUNC_LOG;
|
|
248 |
|
|
249 |
TBool retValue( EFalse );
|
|
250 |
|
|
251 |
if( (aCommand == EAknCmdOpen) && IsLocked() )
|
|
252 |
{
|
|
253 |
HandleTactileFeedbackL();
|
|
254 |
|
|
255 |
CESMRGlobalNote::ExecuteL(
|
|
256 |
CESMRGlobalNote::EESMRUnableToEdit );
|
|
257 |
retValue = ETrue;
|
|
258 |
}
|
|
259 |
|
|
260 |
return retValue;
|
|
261 |
}
|
|
262 |
|
|
263 |
// EOF
|