author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:17:31 +0300 | |
branch | RCL_3 |
changeset 52 | 40fb776cbfb3 |
parent 39 | 65326cf895ed |
permissions | -rw-r--r-- |
39 | 1 |
/* |
2 |
* Copyright (c) 2005 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: Implementation of CDevEncUiEncrViewContainer. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
// INCLUDE FILES |
|
19 |
||
20 |
// Class includes |
|
21 |
#include "DevEncUiEncrViewContainer.h" |
|
22 |
||
23 |
// System Includes |
|
24 |
#include <aknlists.h> |
|
25 |
#include <barsread.h> |
|
26 |
#include <coemain.h> |
|
27 |
#include <devencui.rsg> |
|
28 |
#include <eikenv.h> |
|
29 |
||
30 |
// User Includes |
|
31 |
#include "DevEncLog.h" |
|
32 |
#include "DevEnc.hrh" |
|
33 |
#include "DevEncUi.pan" |
|
34 |
#include "DevEncUiAppui.h" |
|
35 |
#include "DevEncUiDocument.h" |
|
36 |
#include "DevEncUiEncrView.h" |
|
37 |
||
38 |
// ================= MEMBER FUNCTIONS ======================= |
|
39 |
||
40 |
// ----------------------------------------------------------------------------- |
|
41 |
// CDevEncUiEncrViewContainer::NewLC |
|
42 |
// |
|
43 |
// -------------------------------------------------------------------------- |
|
44 |
// |
|
45 |
CDevEncUiEncrViewContainer* CDevEncUiEncrViewContainer::NewLC( const TRect& aRect, |
|
46 |
CAknView& aOwningView ) |
|
47 |
{ |
|
48 |
CDevEncUiEncrViewContainer* self = |
|
49 |
new ( ELeave ) CDevEncUiEncrViewContainer( aOwningView ); |
|
50 |
CleanupStack::PushL( self ); |
|
51 |
self->ConstructL( aRect ); |
|
52 |
return self; |
|
53 |
} |
|
54 |
||
55 |
// -------------------------------------------------------------------------- |
|
56 |
// CDevEncUiEncrViewContainer::NewL |
|
57 |
// |
|
58 |
// -------------------------------------------------------------------------- |
|
59 |
// |
|
60 |
CDevEncUiEncrViewContainer* CDevEncUiEncrViewContainer::NewL( |
|
61 |
const TRect& aRect, |
|
62 |
CAknView& aOwningView ) |
|
63 |
{ |
|
64 |
CDevEncUiEncrViewContainer* self = NewLC( aRect, aOwningView ); |
|
65 |
CleanupStack::Pop( self ); |
|
66 |
return self; |
|
67 |
} |
|
68 |
||
69 |
||
70 |
// -------------------------------------------------------------------------- |
|
71 |
// CDevEncUiEncrViewContainer::ConstructL |
|
72 |
// |
|
73 |
// -------------------------------------------------------------------------- |
|
74 |
// |
|
75 |
void CDevEncUiEncrViewContainer::ConstructL( const TRect& aRect ) |
|
76 |
{ |
|
77 |
// Create a window for this application view |
|
78 |
CreateWindowL(); |
|
79 |
||
80 |
CreateListL(); |
|
81 |
||
82 |
// Set the windows size |
|
83 |
SetRect( aRect ); |
|
84 |
||
85 |
// Activate the window, which makes it ready to be drawn |
|
86 |
ActivateL(); |
|
87 |
} |
|
88 |
||
89 |
// -------------------------------------------------------------------------- |
|
90 |
// CDevEncUiEncrViewContainer::CreateListL |
|
91 |
// |
|
92 |
// -------------------------------------------------------------------------- |
|
93 |
// |
|
94 |
void CDevEncUiEncrViewContainer::CreateListL() |
|
95 |
{ |
|
96 |
// First phase construction |
|
97 |
iListBox = new ( ELeave ) CAknDoubleStyle2ListBox; |
|
98 |
iListBox->SetContainerWindowL( *this ); |
|
99 |
||
100 |
// Second Phase Construction |
|
101 |
TResourceReader reader; |
|
102 |
iEikonEnv->CreateResourceReaderLC( reader, R_DEVENCUI_ENCRYPTION_LISTBOX ); |
|
103 |
iListBox->ConstructFromResourceL( reader ); |
|
104 |
CleanupStack::PopAndDestroy(); // reader (Can't pass T-classes as parameter) |
|
105 |
||
106 |
iListBox->SetListBoxObserver( this ); |
|
107 |
iListBox->CreateScrollBarFrameL( ETrue ); |
|
108 |
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
109 |
CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); |
|
110 |
} |
|
111 |
||
112 |
// -------------------------------------------------------------------------- |
|
113 |
// CDevEncUiEncrViewContainer::CDevEncUiEncrViewContainer |
|
114 |
// |
|
115 |
// -------------------------------------------------------------------------- |
|
116 |
// |
|
117 |
CDevEncUiEncrViewContainer::CDevEncUiEncrViewContainer( |
|
118 |
CAknView& aOwningView ) |
|
119 |
: iOwningView( aOwningView ) |
|
120 |
{ |
|
121 |
// No implementation required |
|
122 |
} |
|
123 |
||
124 |
// -------------------------------------------------------------------------- |
|
125 |
// CDevEncUiEncrViewContainer::CDevEncUiEncrViewContainer |
|
126 |
// |
|
127 |
// -------------------------------------------------------------------------- |
|
128 |
// |
|
129 |
CDevEncUiEncrViewContainer::~CDevEncUiEncrViewContainer() |
|
130 |
{ |
|
131 |
delete iListBox; |
|
132 |
} |
|
133 |
||
134 |
// -------------------------------------------------------------------------- |
|
135 |
// CDevEncUiEncrViewContainer::HandleListBoxEventL |
|
136 |
// |
|
137 |
// -------------------------------------------------------------------------- |
|
138 |
// |
|
139 |
void CDevEncUiEncrViewContainer::HandleListBoxEventL( CEikListBox* /*aListBox*/, |
|
140 |
TListBoxEvent aEventType ) |
|
141 |
{ |
|
142 |
switch ( aEventType ) |
|
143 |
{ |
|
52
40fb776cbfb3
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
144 |
case EEventItemDoubleClicked: // FALLTHROUGH |
39 | 145 |
case EEventEnterKeyPressed: |
146 |
{ |
|
147 |
if ( iListBox->CurrentItemIndex() == 0 ) |
|
148 |
{ |
|
149 |
iOwningView.HandleCommandL( EDevEncUiCommandEncryptWithoutSavingKey ); |
|
150 |
} |
|
151 |
if ( iListBox->CurrentItemIndex() == 1 ) |
|
152 |
{ |
|
153 |
iOwningView.HandleCommandL( EDevEncUiCommandEncryptAndSaveKey ); |
|
154 |
} |
|
155 |
if ( iListBox->CurrentItemIndex() == 2 ) |
|
156 |
{ |
|
157 |
iOwningView.HandleCommandL( EDevEncUiCommandEncryptWithRestoredKey ); |
|
158 |
} |
|
159 |
} |
|
160 |
break; |
|
161 |
default: |
|
162 |
break; |
|
163 |
} |
|
164 |
} |
|
165 |
||
166 |
// -------------------------------------------------------------------------- |
|
167 |
// CDevEncUiEncrViewContainer::CountComponentControls |
|
168 |
// Return number of controls inside this container |
|
169 |
// -------------------------------------------------------------------------- |
|
170 |
// |
|
171 |
TInt CDevEncUiEncrViewContainer::CountComponentControls() const |
|
172 |
{ |
|
173 |
return 1; |
|
174 |
} |
|
175 |
||
176 |
// -------------------------------------------------------------------------- |
|
177 |
// CDevEncUiEncrViewContainer::ComponentControl |
|
178 |
// |
|
179 |
// -------------------------------------------------------------------------- |
|
180 |
// |
|
181 |
CCoeControl* CDevEncUiEncrViewContainer::ComponentControl( TInt aIndex ) const |
|
182 |
{ |
|
183 |
switch ( aIndex ) |
|
184 |
{ |
|
185 |
case 0: |
|
186 |
return iListBox; |
|
187 |
default: |
|
188 |
return NULL; |
|
189 |
} |
|
190 |
} |
|
191 |
||
192 |
// -------------------------------------------------------------------------- |
|
193 |
// CDevEncUiEncrViewContainer::Draw |
|
194 |
// |
|
195 |
// -------------------------------------------------------------------------- |
|
196 |
// |
|
197 |
void CDevEncUiEncrViewContainer::Draw( const TRect& aRect ) const |
|
198 |
{ |
|
199 |
CWindowGc& gc = SystemGc(); |
|
200 |
gc.Clear( aRect ); |
|
201 |
} |
|
202 |
||
203 |
// -------------------------------------------------------------------------- |
|
204 |
// CDevEncUiEncrViewContainer::OfferKeyEventL |
|
205 |
// |
|
206 |
// -------------------------------------------------------------------------- |
|
207 |
// |
|
208 |
TKeyResponse CDevEncUiEncrViewContainer::OfferKeyEventL( |
|
209 |
const TKeyEvent& aKeyEvent, |
|
210 |
TEventCode aType ) |
|
211 |
{ |
|
212 |
if ( !iListBox ) |
|
213 |
{ |
|
214 |
return EKeyWasNotConsumed; |
|
215 |
} |
|
216 |
if ( aKeyEvent.iCode == EKeyDevice3 /* OK key */ ) |
|
217 |
{ |
|
218 |
if ( iListBox->CurrentItemIndex() == 0 ) |
|
219 |
{ |
|
220 |
iOwningView.HandleCommandL( EDevEncUiCommandEncryptWithoutSavingKey ); |
|
221 |
} |
|
222 |
if ( iListBox->CurrentItemIndex() == 1 ) |
|
223 |
{ |
|
224 |
iOwningView.HandleCommandL( EDevEncUiCommandEncryptAndSaveKey ); |
|
225 |
} |
|
226 |
if ( iListBox->CurrentItemIndex() == 2 ) |
|
227 |
{ |
|
228 |
iOwningView.HandleCommandL( EDevEncUiCommandEncryptWithRestoredKey ); |
|
229 |
} |
|
230 |
return EKeyWasConsumed; |
|
231 |
} |
|
232 |
return iListBox->OfferKeyEventL( aKeyEvent, aType ); |
|
233 |
} |
|
234 |
||
235 |
// -------------------------------------------------------------------------- |
|
236 |
// CDevEncUiEncrViewContainer::SizeChanged() |
|
237 |
// |
|
238 |
// -------------------------------------------------------------------------- |
|
239 |
// |
|
240 |
void CDevEncUiEncrViewContainer::SizeChanged() |
|
241 |
{ |
|
242 |
if ( iListBox ) |
|
243 |
{ |
|
244 |
iListBox->SetExtent( TPoint( 0, 0 ), iListBox->MinimumSize() ); |
|
245 |
} |
|
246 |
} |
|
247 |
||
248 |
//End Of File |
|
249 |
||
250 |