|
1 /* |
|
2 * Copyright (c) 2006-2007 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 application container class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <coemain.h> |
|
20 #include <barsread.h> |
|
21 #include <aknappui.h> |
|
22 #include <eikprogi.h> |
|
23 #include <aknenv.h> |
|
24 #include <avkon.hrh> |
|
25 #include <akntitle.h> |
|
26 #include <aknquerydialog.h> |
|
27 #include <bctestlauncher.rsg> |
|
28 #include <stringloader.h> // StringLoader |
|
29 #include <f32file.h> // link against efsrv.lib |
|
30 #include <s32file.h> |
|
31 #include <eikenv.h> |
|
32 #include <aknnotewrappers.h> |
|
33 |
|
34 #include "bctestlauncherdefs.h" |
|
35 #include "bctestlaunchercontainer.h" |
|
36 |
|
37 // ============================ MEMBER FUNCTIONS ============================= |
|
38 |
|
39 // --------------------------------------------------------------------------- |
|
40 // CBCTestLauncherContainer::CBCTestLauncherContainer() |
|
41 // C++ default constructor can NOT contain any code, that |
|
42 // might leave. |
|
43 // --------------------------------------------------------------------------- |
|
44 // |
|
45 CBCTestLauncherContainer::CBCTestLauncherContainer() |
|
46 { |
|
47 } |
|
48 |
|
49 // --------------------------------------------------------------------------- |
|
50 // CBCTestLauncherContainer::ConstructL |
|
51 // Symbian 2nd phase constructor can leave. |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 void CBCTestLauncherContainer::ConstructL( const TRect& aRect ) |
|
55 { |
|
56 CreateWindowL(); |
|
57 |
|
58 Window().SetShadowDisabled( EFalse ); |
|
59 |
|
60 CEikStatusPane *sp = |
|
61 ( ( CAknAppUi* )iEikonEnv->EikAppUi() )->StatusPane(); |
|
62 iTitlePane = ( CAknTitlePane * )sp->ControlL( |
|
63 TUid::Uid( EEikStatusPaneUidTitle ) ); |
|
64 iCba = CEikButtonGroupContainer::Current(); |
|
65 |
|
66 SetRect( aRect ); |
|
67 ActivateL(); |
|
68 } |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // CBCTestLauncherContainer::~CBCTestLauncherContainer |
|
72 // Destructor |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
|
75 CBCTestLauncherContainer::~CBCTestLauncherContainer() |
|
76 { |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------------------------- |
|
80 // CBCTestLauncherContainer::CountComponentControls() const |
|
81 // amount of component controls |
|
82 // --------------------------------------------------------------------------- |
|
83 // |
|
84 TInt CBCTestLauncherContainer::CountComponentControls() const |
|
85 { |
|
86 return 0; // return nbr of controls inside this container |
|
87 } |
|
88 |
|
89 // --------------------------------------------------------------------------- |
|
90 // CBCTestLauncherContainer::ComponentControl( TInt aIndex ) const |
|
91 // Returns ptr to component controls |
|
92 // --------------------------------------------------------------------------- |
|
93 // |
|
94 CCoeControl* CBCTestLauncherContainer::ComponentControl( |
|
95 TInt /*aIndex*/ ) const |
|
96 { |
|
97 return NULL; |
|
98 } |
|
99 |
|
100 // --------------------------------------------------------------------------- |
|
101 // CBCTestLauncherContainer::Draw( const TRect& aRect ) const |
|
102 // Draw function |
|
103 // --------------------------------------------------------------------------- |
|
104 // |
|
105 void CBCTestLauncherContainer::Draw( const TRect& aRect ) const |
|
106 { |
|
107 CWindowGc& gc = SystemGc(); |
|
108 gc.SetPenStyle( CGraphicsContext::ENullPen ); |
|
109 gc.SetBrushColor( KRgbWhite ); |
|
110 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
111 gc.DrawRect( aRect ); |
|
112 gc.Clear(); |
|
113 } |
|
114 |
|
115 // --------------------------------------------------------------------------- |
|
116 // CBCTestLauncherContainer::HandleControlEventL( |
|
117 // CCoeControl* aControl,TCoeEvent aEventType) |
|
118 // --------------------------------------------------------------------------- |
|
119 // |
|
120 void CBCTestLauncherContainer::HandleControlEventL( |
|
121 CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/ ) |
|
122 { |
|
123 } |
|
124 // --------------------------------------------------------------------------- |
|
125 // CBCTestLauncherContainer::ClearScreen() |
|
126 // Clears the screen. |
|
127 // --------------------------------------------------------------------------- |
|
128 // |
|
129 void CBCTestLauncherContainer::ClearScreen() |
|
130 { |
|
131 CEikStatusPaneBase* sp = |
|
132 ( ( CAknAppUi* )iEikonEnv->EikAppUi() )->StatusPane(); |
|
133 sp->MakeVisible( EFalse ); |
|
134 iCba->MakeVisible( EFalse ); |
|
135 DrawNow(); |
|
136 } |
|
137 |
|
138 // --------------------------------------------------------------------------- |
|
139 // CBCTestLauncherContainer::RestoreScreen() |
|
140 // Makes status pane and cba labels visible which ClearScreen() hides. |
|
141 // --------------------------------------------------------------------------- |
|
142 // |
|
143 void CBCTestLauncherContainer::RestoreScreen() |
|
144 { |
|
145 CEikStatusPaneBase *sp = |
|
146 ( ( CAknAppUi* )iEikonEnv->EikAppUi() )->StatusPane(); |
|
147 sp->MakeVisible( ETrue ); |
|
148 iCba->MakeVisible( ETrue ); |
|
149 DrawNow(); |
|
150 } |
|
151 |
|
152 // ----------------------------------------------------------------------------- |
|
153 // CBCTestLauncherContainer::SetSdkVersion |
|
154 // Set the SDK version. |
|
155 // ----------------------------------------------------------------------------- |
|
156 // |
|
157 void CBCTestLauncherContainer::SetSdkVersion() |
|
158 { |
|
159 TBuf<8> sdkVer; |
|
160 CAknTextQueryDialog* verQuery = CAknTextQueryDialog::NewL( sdkVer ); |
|
161 CleanupStack::PushL(verQuery); |
|
162 verQuery->SetMaxLength( 2 ); |
|
163 //EAknEditorSecretAlphaInputMode EAknEditorNumericInputMode |
|
164 verQuery->SetDefaultInputMode( EAknEditorNumericInputMode ); |
|
165 HBufC* prompt; |
|
166 // Pushes prompt onto the Cleanup Stack. |
|
167 prompt = StringLoader::LoadLC(R_BCTESTLAUNCHER_QUERY_CAPTION); |
|
168 verQuery->SetPromptL(*prompt); |
|
169 CleanupStack::PopAndDestroy(prompt); |
|
170 CleanupStack::Pop(verQuery); |
|
171 if (verQuery->ExecuteLD(R_AVKON_DIALOG_QUERY_VALUE_NUMBER)) |
|
172 { |
|
173 // write sdk version into file |
|
174 RFs fs; |
|
175 User::LeaveIfError( fs.Connect() ); |
|
176 CleanupClosePushL( fs ); |
|
177 RFileWriteStream writeStream; |
|
178 writeStream.Replace( fs, KSdkVerFile, EFileWrite ); |
|
179 CleanupClosePushL( writeStream ); |
|
180 //writeStream.WriteL( sdkVer ); |
|
181 TInt verNum; |
|
182 TLex lex(sdkVer); |
|
183 lex.Val(verNum); |
|
184 |
|
185 TBuf<120> buf; |
|
186 if ( verNum<MinVersionValue || verNum >MaxVersionValue ) |
|
187 { |
|
188 verNum = 0; |
|
189 CAknInformationNote* tInfoNote = new( ELeave ) CAknInformationNote(); |
|
190 buf.Format( _L( "The value should between %d and %d" ), |
|
191 MinVersionValue, MaxVersionValue ); |
|
192 tInfoNote->ExecuteLD( buf ); |
|
193 } |
|
194 |
|
195 writeStream.WriteInt32L(verNum); |
|
196 writeStream.CommitL (); |
|
197 CleanupStack::PopAndDestroy( 2 ); |
|
198 fs.Close(); |
|
199 |
|
200 } |
|
201 } |
|
202 |