54
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2008 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: Base view for all the views in General Settings
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include "GSLocalBaseView.h"
|
|
21 |
|
|
22 |
#include <aknViewAppUi.h>
|
|
23 |
#include <akntitle.h>
|
|
24 |
#include <barsread.h>
|
|
25 |
#include <aknnavi.h>
|
|
26 |
#include <akntabgrp.h>
|
|
27 |
#include <aknnavide.h>
|
|
28 |
#include <AknUtils.h>
|
|
29 |
#include <bldvariant.hrh>
|
|
30 |
#include <gsbasecontainer.h>
|
|
31 |
#include <gstelpluginrsc.rsg>
|
|
32 |
|
|
33 |
//Disabling warning caused by KGSDoActivateError constant
|
|
34 |
#pragma diag_suppress 177
|
|
35 |
// CONSTANTS
|
|
36 |
_LIT( KGSDoActivateError, "DoActivateL" );
|
|
37 |
|
|
38 |
// ========================= MEMBER FUNCTIONS ================================
|
|
39 |
|
|
40 |
// ---------------------------------------------------------------------------
|
|
41 |
// CGSLocalBaseView::CGSLocalBaseView
|
|
42 |
//
|
|
43 |
// C++ constructor
|
|
44 |
// ---------------------------------------------------------------------------
|
|
45 |
//
|
|
46 |
CGSLocalBaseView::CGSLocalBaseView()
|
|
47 |
{
|
|
48 |
iAppUi = iAvkonViewAppUi;
|
|
49 |
}
|
|
50 |
|
|
51 |
|
|
52 |
// ---------------------------------------------------------------------------
|
|
53 |
// CGSLocalBaseView::~CGSLocalBaseView
|
|
54 |
//
|
|
55 |
// Destructor
|
|
56 |
// ---------------------------------------------------------------------------
|
|
57 |
//
|
|
58 |
CGSLocalBaseView::~CGSLocalBaseView()
|
|
59 |
{
|
|
60 |
if ( iContainer && iAppUi )
|
|
61 |
{
|
|
62 |
iAppUi->RemoveFromViewStack( *this, iContainer );
|
|
63 |
delete iContainer;
|
|
64 |
}
|
|
65 |
}
|
|
66 |
|
|
67 |
|
|
68 |
// ---------------------------------------------------------------------------
|
|
69 |
// CGSLocalBaseView::SetCurrentItem
|
|
70 |
//
|
|
71 |
//
|
|
72 |
// ---------------------------------------------------------------------------
|
|
73 |
//
|
|
74 |
void CGSLocalBaseView::SetCurrentItem( TInt aIndex )
|
|
75 |
{
|
|
76 |
iCurrentItem = aIndex;
|
|
77 |
if( iContainer )
|
|
78 |
{
|
|
79 |
iContainer->SetSelectedItem( aIndex );
|
|
80 |
}
|
|
81 |
}
|
|
82 |
|
|
83 |
|
|
84 |
// ---------------------------------------------------------------------------
|
|
85 |
// CGSLocalBaseView::HandleListBoxEventL
|
|
86 |
//
|
|
87 |
//
|
|
88 |
// ---------------------------------------------------------------------------
|
|
89 |
//
|
|
90 |
void CGSLocalBaseView::HandleListBoxEventL( CEikListBox* /*aListBox*/,
|
|
91 |
TListBoxEvent aEventType )
|
|
92 |
{
|
|
93 |
switch ( aEventType )
|
|
94 |
{
|
|
95 |
case EEventEnterKeyPressed:
|
|
96 |
case EEventItemSingleClicked:
|
|
97 |
HandleListBoxSelectionL();
|
|
98 |
break;
|
|
99 |
default:
|
|
100 |
break;
|
|
101 |
}
|
|
102 |
}
|
|
103 |
|
|
104 |
|
|
105 |
// ---------------------------------------------------------------------------
|
|
106 |
// CGSLocalBaseView::SetNaviPaneL
|
|
107 |
//
|
|
108 |
//
|
|
109 |
// ---------------------------------------------------------------------------
|
|
110 |
//
|
|
111 |
void CGSLocalBaseView::SetNaviPaneL()
|
|
112 |
{
|
|
113 |
}
|
|
114 |
|
|
115 |
|
|
116 |
// ---------------------------------------------------------------------------
|
|
117 |
// CGSLocalBaseView::CreateNaviPaneContextL
|
|
118 |
//
|
|
119 |
//
|
|
120 |
// ---------------------------------------------------------------------------
|
|
121 |
//
|
|
122 |
void CGSLocalBaseView::CreateNaviPaneContextL( TInt /*aResourceId*/ )
|
|
123 |
{
|
|
124 |
}
|
|
125 |
|
|
126 |
|
|
127 |
// ---------------------------------------------------------------------------
|
|
128 |
// CGSLocalBaseView::HandleClientRectChange
|
|
129 |
//
|
|
130 |
//
|
|
131 |
// ---------------------------------------------------------------------------
|
|
132 |
//
|
|
133 |
void CGSLocalBaseView::HandleClientRectChange()
|
|
134 |
{
|
|
135 |
if ( iContainer && iContainer->iListBox )
|
|
136 |
{
|
|
137 |
iContainer->SetRect( ClientRect() );
|
|
138 |
}
|
|
139 |
}
|
|
140 |
|
|
141 |
|
|
142 |
// ---------------------------------------------------------------------------
|
|
143 |
// CGSLocalBaseView::DoActivateL
|
|
144 |
// Activates the view.
|
|
145 |
//
|
|
146 |
// ---------------------------------------------------------------------------
|
|
147 |
//
|
|
148 |
void CGSLocalBaseView::DoActivateL(const TVwsViewId& /*aPrevViewId*/,
|
|
149 |
TUid /*aCustomMessageId*/,
|
|
150 |
const TDesC8& /*aCustomMessage*/)
|
|
151 |
{
|
|
152 |
if( iContainer )
|
|
153 |
{
|
|
154 |
iAppUi->RemoveFromViewStack( *this, iContainer );
|
|
155 |
delete iContainer;
|
|
156 |
iContainer = NULL;
|
|
157 |
}
|
|
158 |
|
|
159 |
CreateContainerL();
|
|
160 |
|
|
161 |
iAppUi->AddToViewStackL( *this, iContainer );
|
|
162 |
iContainer->iListBox->SetListBoxObserver( this );
|
|
163 |
|
|
164 |
SetNaviPaneL();
|
|
165 |
}
|
|
166 |
|
|
167 |
|
|
168 |
// ---------------------------------------------------------------------------
|
|
169 |
// CGSLocalBaseView::DoDeactivate()
|
|
170 |
//
|
|
171 |
//
|
|
172 |
// ---------------------------------------------------------------------------
|
|
173 |
//
|
|
174 |
void CGSLocalBaseView::DoDeactivate()
|
|
175 |
{
|
|
176 |
if ( iContainer )
|
|
177 |
{
|
|
178 |
iAppUi->RemoveFromViewStack( *this, iContainer );
|
|
179 |
delete iContainer;
|
|
180 |
iContainer = NULL;
|
|
181 |
}
|
|
182 |
}
|
|
183 |
|
|
184 |
|
|
185 |
// ---------------------------------------------------------------------------
|
|
186 |
// CGSLocalBaseView::CreateContainerL()
|
|
187 |
//
|
|
188 |
//
|
|
189 |
// ---------------------------------------------------------------------------
|
|
190 |
//
|
|
191 |
void CGSLocalBaseView::CreateContainerL()
|
|
192 |
{
|
|
193 |
NewContainerL();
|
|
194 |
__ASSERT_DEBUG( iContainer,
|
|
195 |
User::Panic( KGSDoActivateError, EGSViewPanicNullPtr ) );
|
|
196 |
iContainer->SetMopParent( this );
|
|
197 |
|
|
198 |
TRAPD( error, iContainer->ConstructL( ClientRect() ) );
|
|
199 |
|
|
200 |
if ( error )
|
|
201 |
{
|
|
202 |
delete iContainer;
|
|
203 |
iContainer = NULL;
|
|
204 |
User::Leave( error );
|
|
205 |
}
|
|
206 |
}
|
|
207 |
|
|
208 |
|
|
209 |
//End of File
|