0
|
1 |
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
//
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
@internalTechnology
|
|
21 |
@released
|
|
22 |
*/
|
|
23 |
|
|
24 |
|
|
25 |
#include "coredumpui.h"
|
|
26 |
#include "coredumpcdsdialog.h"
|
|
27 |
|
|
28 |
// CConfigureCDSDialog //
|
|
29 |
|
|
30 |
CConfigureCDSDialog::CConfigureCDSDialog(RCoreDumpSession &aCoreDumpSession)
|
|
31 |
: CCoreDumpDialogBase(aCoreDumpSession)
|
|
32 |
{
|
|
33 |
}
|
|
34 |
|
|
35 |
CConfigureCDSDialog::~CConfigureCDSDialog()
|
|
36 |
{
|
|
37 |
iConfs.ResetAndDestroy();
|
|
38 |
}
|
|
39 |
|
|
40 |
void CConfigureCDSDialog::PreLayoutDynInitL()
|
|
41 |
{
|
|
42 |
UpdateDialogDataL();
|
|
43 |
}
|
|
44 |
|
|
45 |
void CConfigureCDSDialog::PostLayoutDynInitL()
|
|
46 |
{
|
|
47 |
}
|
|
48 |
|
|
49 |
void CConfigureCDSDialog::UpdateDialogDataL()
|
|
50 |
{
|
|
51 |
//update dialog
|
|
52 |
RPointerArray<CEikEdwin> edwins;
|
|
53 |
CEikEdwin *edwin = static_cast<CEikEdwin*>(Control(EEdwin1));
|
|
54 |
edwins.Append(edwin);
|
|
55 |
edwin = static_cast<CEikEdwin*>(Control(EEdwin2));
|
|
56 |
edwins.Append(edwin);
|
|
57 |
edwin = static_cast<CEikEdwin*>(Control(EEdwin3));
|
|
58 |
edwins.Append(edwin);
|
|
59 |
edwin = static_cast<CEikEdwin*>(Control(EEdwin4));
|
|
60 |
edwins.Append(edwin);
|
|
61 |
edwin = static_cast<CEikEdwin*>(Control(EEdwin5));
|
|
62 |
edwins.Append(edwin);
|
|
63 |
edwin = static_cast<CEikEdwin*>(Control(EEdwin6));
|
|
64 |
edwins.Append(edwin);
|
|
65 |
edwin = static_cast<CEikEdwin*>(Control(EEdwin7));
|
|
66 |
edwins.Append(edwin);
|
|
67 |
for (TInt i = 0; i < edwins.Count(); i++)
|
|
68 |
{
|
|
69 |
edwins[i]->SetDimmed(ETrue);
|
|
70 |
edwins[i]->SetReadOnly(ETrue);
|
|
71 |
}
|
|
72 |
|
|
73 |
RPointerArray<CEikLabel> labels;
|
|
74 |
CEikLabel *label = static_cast<CEikLabel*>(Control(ELabel1));
|
|
75 |
labels.Append(label);
|
|
76 |
label = static_cast<CEikLabel*>(Control(ELabel2));
|
|
77 |
labels.Append(label);
|
|
78 |
label = static_cast<CEikLabel*>(Control(ELabel3));
|
|
79 |
labels.Append(label);
|
|
80 |
label = static_cast<CEikLabel*>(Control(ELabel4));
|
|
81 |
labels.Append(label);
|
|
82 |
label = static_cast<CEikLabel*>(Control(ELabel5));
|
|
83 |
labels.Append(label);
|
|
84 |
label = static_cast<CEikLabel*>(Control(ELabel6));
|
|
85 |
labels.Append(label);
|
|
86 |
label = static_cast<CEikLabel*>(Control(ELabel7));
|
|
87 |
labels.Append(label);
|
|
88 |
|
|
89 |
// Read config parameters from CDS
|
|
90 |
TInt noConfigParams = 0;
|
|
91 |
iConfs.ResetAndDestroy();
|
|
92 |
|
|
93 |
TRAPD(err, noConfigParams = iCoreDumpSession.GetNumberConfigParametersL());
|
|
94 |
if(err != KErrNone)
|
|
95 |
{
|
|
96 |
TBuf<23> error;
|
|
97 |
error.Format(_L("Error: %d"), err);
|
|
98 |
CEikonEnv::InfoWinL(_L("Could not get number of config params!"), error);
|
|
99 |
User::Leave(err);
|
|
100 |
}
|
|
101 |
TInt control = 0;
|
|
102 |
//RDebug::Print(_L("CConfigureCDSDialog::UpdateDialogDataL: noConfigParams: %d"), noConfigParams);
|
|
103 |
for (TInt i = 0; i < noConfigParams; i++)
|
|
104 |
{
|
|
105 |
COptionConfig* conf;
|
|
106 |
conf = iCoreDumpSession.GetConfigParameterL(i);
|
|
107 |
if (conf->Source()== COptionConfig::ECoreDumpServer)
|
|
108 |
{
|
|
109 |
iConfs.Append(conf);
|
|
110 |
TBuf<255> buf = conf->Prompt();
|
|
111 |
switch (conf->Type())
|
|
112 |
{
|
|
113 |
case COptionConfig::ETInt:
|
|
114 |
{
|
|
115 |
buf.Append(_L("\n(Signed int)"));
|
|
116 |
TBuf<255> value;
|
|
117 |
value.Format(_L("%d"), iConfs[control]->Value());
|
|
118 |
edwins[control]->SetTextL(&value);
|
|
119 |
}
|
|
120 |
break;
|
|
121 |
|
|
122 |
case COptionConfig::ETUInt:
|
|
123 |
{
|
|
124 |
buf.Append(_L("\n(Unsigned int)"));
|
|
125 |
TBuf<255> value;
|
|
126 |
value.Format(_L("%d"), iConfs[control]->Value());
|
|
127 |
edwins[control]->SetTextL(&value);
|
|
128 |
}
|
|
129 |
break;
|
|
130 |
|
|
131 |
case COptionConfig::ETString:
|
|
132 |
{
|
|
133 |
buf.Append(_L("\n(String)"));
|
|
134 |
edwins[control]->SetTextL(&(iConfs[control]->ValueAsDesc()));
|
|
135 |
}
|
|
136 |
break;
|
|
137 |
|
|
138 |
case COptionConfig::ETFileName:
|
|
139 |
{
|
|
140 |
buf.Append(_L("\n(File name)"));
|
|
141 |
edwins[control]->SetTextL(&(iConfs[control]->ValueAsDesc()));
|
|
142 |
}
|
|
143 |
break;
|
|
144 |
|
|
145 |
case COptionConfig::ETSingleEntryEnum:
|
|
146 |
{
|
|
147 |
buf.Append(_L("\n"));
|
|
148 |
buf.Append(conf->Options());
|
|
149 |
edwins[control]->SetTextL(&(iConfs[control]->ValueAsDesc()));
|
|
150 |
}
|
|
151 |
break;
|
|
152 |
|
|
153 |
case COptionConfig::ETMultiEntryEnum:
|
|
154 |
{
|
|
155 |
buf.Append(_L("\n"));
|
|
156 |
buf.Append(conf->Options());
|
|
157 |
edwins[control]->SetTextL(&(iConfs[control]->ValueAsDesc()));
|
|
158 |
}
|
|
159 |
break;
|
|
160 |
|
|
161 |
case COptionConfig::ETBool:
|
|
162 |
{
|
|
163 |
buf.Append(_L("\n"));
|
|
164 |
buf.Append(conf->Options());
|
|
165 |
TBuf<255> value;
|
|
166 |
iConfs[control]->Value() ? value = _L("True") : value = _L("False");
|
|
167 |
edwins[control]->SetTextL(&value);
|
|
168 |
}
|
|
169 |
break;
|
|
170 |
|
|
171 |
default:
|
|
172 |
break;
|
|
173 |
}
|
|
174 |
labels[control]->SetTextL(buf);
|
|
175 |
edwins[control]->SetDimmed(EFalse);
|
|
176 |
edwins[control++]->SetReadOnly(EFalse);
|
|
177 |
}
|
|
178 |
else
|
|
179 |
{
|
|
180 |
delete conf;
|
|
181 |
}
|
|
182 |
}
|
|
183 |
edwins.Close();
|
|
184 |
labels.Close();
|
|
185 |
}
|
|
186 |
|
|
187 |
TBool CConfigureCDSDialog::OkToExitL(TInt aButtonId)
|
|
188 |
{
|
|
189 |
LOG_MSG( "-> CConfigureCDSDialog::OkToExitL" );
|
|
190 |
TBool ret = ETrue;
|
|
191 |
TInt err;
|
|
192 |
|
|
193 |
RPointerArray<CEikEdwin> edwins;
|
|
194 |
CEikEdwin *edwin = static_cast<CEikEdwin*>(Control(EEdwin1));
|
|
195 |
edwins.Append(edwin);
|
|
196 |
edwin = static_cast<CEikEdwin*>(Control(EEdwin2));
|
|
197 |
edwins.Append(edwin);
|
|
198 |
edwin = static_cast<CEikEdwin*>(Control(EEdwin3));
|
|
199 |
edwins.Append(edwin);
|
|
200 |
edwin = static_cast<CEikEdwin*>(Control(EEdwin4));
|
|
201 |
edwins.Append(edwin);
|
|
202 |
edwin = static_cast<CEikEdwin*>(Control(EEdwin5));
|
|
203 |
edwins.Append(edwin);
|
|
204 |
edwin = static_cast<CEikEdwin*>(Control(EEdwin6));
|
|
205 |
edwins.Append(edwin);
|
|
206 |
edwin = static_cast<CEikEdwin*>(Control(EEdwin7));
|
|
207 |
edwins.Append(edwin);
|
|
208 |
|
|
209 |
switch (aButtonId)
|
|
210 |
{
|
|
211 |
case EEikBidCancel:
|
|
212 |
{
|
|
213 |
//RDebug::Print(_L("CConfigureCDSDialog::OkToExitL: Cancel pressed"));
|
|
214 |
}
|
|
215 |
break;
|
|
216 |
case EBidCDSConfigure:
|
|
217 |
{
|
|
218 |
//RDebug::Print(_L("CConfigureCDSDialog::OkToExitL: iConfs.Count() == %d"), iConfs.Count());
|
|
219 |
for (TInt i = 0; ( i < iConfs.Count() ) && ret; i++)
|
|
220 |
{
|
|
221 |
err = KErrNone;
|
|
222 |
|
|
223 |
HBufC *input = NULL;
|
|
224 |
if (edwins[i]->TextLength() > 0)
|
|
225 |
{
|
|
226 |
input = edwins[i]->GetTextInHBufL();
|
|
227 |
}
|
|
228 |
if ( ! input )
|
|
229 |
{
|
|
230 |
LOG_MSG2( " NULL input for param %d" , i );
|
|
231 |
continue;
|
|
232 |
}
|
|
233 |
|
|
234 |
//RDebug::Print(_L("CConfigureCDSDialog::OkToExitL: iConfs[i]->Type() == %d"), iConfs[i]->Type());
|
|
235 |
|
|
236 |
switch (iConfs[i]->Type())
|
|
237 |
{
|
|
238 |
case COptionConfig::ETInt:
|
|
239 |
case COptionConfig::ETUInt:
|
|
240 |
{
|
|
241 |
TLex opts(*input);
|
|
242 |
TInt32 conf;
|
|
243 |
err = opts.Val(conf);
|
|
244 |
if ( err )
|
|
245 |
{
|
|
246 |
LOG_MSG(" error from opts.Val(conf) -> CConfigureCDSDialog::CEikonEnv::Static()->InfoMsg;" );
|
|
247 |
CEikonEnv::Static()->InfoMsg(_L("Value must be an integer"));
|
|
248 |
break;
|
|
249 |
}
|
|
250 |
|
|
251 |
//RDebug::Print(_L("CConfigureCDSDialog::OkToExitL: conf == %d"), conf);
|
|
252 |
iConfs[i]->Value(conf);
|
|
253 |
TRAP( err, iCoreDumpSession.SetConfigParameterL( *iConfs[i]) );
|
|
254 |
}
|
|
255 |
break;
|
|
256 |
|
|
257 |
case COptionConfig::ETFileName:
|
|
258 |
case COptionConfig::ETString:
|
|
259 |
case COptionConfig::ETSingleEntryEnum:
|
|
260 |
case COptionConfig::ETMultiEntryEnum:
|
|
261 |
{
|
|
262 |
TRAP( err, iConfs[i]->ValueL(*input) );
|
|
263 |
if ( KErrNone == err )
|
|
264 |
{
|
|
265 |
TRAP( err, iCoreDumpSession.SetConfigParameterL( *iConfs[i]) );
|
|
266 |
}
|
|
267 |
}
|
|
268 |
break;
|
|
269 |
|
|
270 |
case COptionConfig::ETBool:
|
|
271 |
if (input->CompareF(_L("True"))== 0)
|
|
272 |
{
|
|
273 |
iConfs[i]->Value(ETrue);
|
|
274 |
iConfs[i]->ValueL(_L("True"));
|
|
275 |
}
|
|
276 |
else if (input->CompareF(_L("False"))== 0)
|
|
277 |
{
|
|
278 |
iConfs[i]->Value(EFalse);
|
|
279 |
iConfs[i]->ValueL(_L("False"));
|
|
280 |
}
|
|
281 |
else
|
|
282 |
{
|
|
283 |
err = KErrCorrupt;
|
|
284 |
}
|
|
285 |
|
|
286 |
if ( KErrNone == err )
|
|
287 |
{
|
|
288 |
TRAP( err, iCoreDumpSession.SetConfigParameterL( *iConfs[i]) );
|
|
289 |
}
|
|
290 |
|
|
291 |
break;
|
|
292 |
|
|
293 |
default:
|
|
294 |
CEikonEnv::Static()->InfoMsg(_L("Error with parameter type"));
|
|
295 |
LOG_MSG( "CConfigureCDSDialog::OkToExitL: none of the above" );
|
|
296 |
err = KErrCorrupt;
|
|
297 |
break;
|
|
298 |
|
|
299 |
}//switch
|
|
300 |
|
|
301 |
if ( err )
|
|
302 |
{
|
|
303 |
RBuf errorString;
|
|
304 |
CleanupClosePushL( errorString );
|
|
305 |
errorString.CreateL( 128 );
|
|
306 |
errorString.Append( _L("CDS Error ") );
|
|
307 |
errorString.AppendNum( err );
|
|
308 |
errorString.Append( _L(" setting parameter number ") );
|
|
309 |
errorString.AppendNum( i );
|
|
310 |
CEikonEnv::InfoWinL( errorString, KNullDesC );
|
|
311 |
CleanupStack::PopAndDestroy( &errorString );
|
|
312 |
ret = EFalse;
|
|
313 |
}
|
|
314 |
if(input)
|
|
315 |
{
|
|
316 |
delete input;
|
|
317 |
input = NULL;
|
|
318 |
}
|
|
319 |
}
|
|
320 |
}
|
|
321 |
break;
|
|
322 |
default:
|
|
323 |
break;
|
|
324 |
}
|
|
325 |
|
|
326 |
edwins.Close();
|
|
327 |
return ret;
|
|
328 |
}
|
|
329 |
|
|
330 |
|