1 /* |
|
2 * Copyright (c) 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: Implementation of setup Wizard |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <StringLoader.h> |
|
21 #include <cmsappwizard.rsg> |
|
22 #include "upnpavdevice.h" |
|
23 #include "upnpavcontroller.h" |
|
24 #include "upnpavcontrollerfactory.h" |
|
25 #include <driveinfo.h> |
|
26 #include <utf.h> |
|
27 #include <aknnotewrappers.h> |
|
28 |
|
29 #include "cmdriveinfo.h" |
|
30 #include "cmmediaserverfull.h" |
|
31 #include "cmstorerulecontainer.h" |
|
32 #include "cmstorerule.h" |
|
33 #include "cmfillrulecontainer.h" |
|
34 #include "cmfillrule.h" |
|
35 #include "cmsappwizard.h" |
|
36 #include "msengine.h" |
|
37 #include "cmsmultiselectionpopup.h" |
|
38 #include "cmsselectionstorage.h" |
|
39 #include "msconstants.h" |
|
40 #include "msdebug.h" |
|
41 #include "upnpavdevicelist.h" |
|
42 |
|
43 // CONSTANTS |
|
44 _LIT( KMSSetupWizardRscFile, "\\resource\\apps\\cmsappwizard.rsc" ); |
|
45 #ifdef _DEBUG |
|
46 _LIT( KPanicedUnit, "MSAPPWIZARD" ); |
|
47 #endif // _DEBUG |
|
48 |
|
49 const TInt KArrayGranularity = 3; |
|
50 const TInt KFillListGranularity = 3; |
|
51 const TInt KStoreListGranularity = 5; |
|
52 |
|
53 |
|
54 // -------------------------------------------------------------------------- |
|
55 // CMSAppWizard::CMSAppWizard |
|
56 // -------------------------------------------------------------------------- |
|
57 // |
|
58 CMSAppWizard::CMSAppWizard( CMSEngine& aMSEngine ) |
|
59 { |
|
60 iMSEngine = &aMSEngine; |
|
61 iMaxSteps = ELastStep; |
|
62 LOG(_L("[MSAppWizard]\t CMSAppWizard::CMSAppWizard")); |
|
63 } |
|
64 |
|
65 // -------------------------------------------------------------------------- |
|
66 // CMSAppWizard::ConstructL() |
|
67 // Symbian 2nd phase constructor can leave. |
|
68 // -------------------------------------------------------------------------- |
|
69 // |
|
70 void CMSAppWizard::ConstructL() |
|
71 { |
|
72 LOG(_L("[MSAppWizard]\t CMSAppWizard::ConstructL begin")); |
|
73 |
|
74 iCoeEnv = CEikonEnv::Static(); |
|
75 iFileSession = iCoeEnv->FsSession(); |
|
76 |
|
77 // Load resource file |
|
78 TFileName rscFileName( KMSSetupWizardRscFile ); |
|
79 User::LeaveIfError( CompleteWithAppPath( rscFileName ) ); |
|
80 |
|
81 // Get the exact filename of the resource file |
|
82 BaflUtils::NearestLanguageFile( iFileSession, rscFileName ); |
|
83 // Check if the resource file exists or not |
|
84 if ( !BaflUtils::FileExists( iFileSession, rscFileName ) ) |
|
85 { |
|
86 User::Leave( KErrNotFound ); |
|
87 } |
|
88 |
|
89 TInt err(KErrNone); |
|
90 TRAP( err, iResFileOffset = iCoeEnv->AddResourceFileL( rscFileName ) ); |
|
91 User::LeaveIfError( err ); |
|
92 |
|
93 iSelections = CMSSelectionStorage::NewL( *iMSEngine, |
|
94 iMediaServers, |
|
95 iFileSession ); |
|
96 |
|
97 iDeviceNameArray = new (ELeave) CDesCArrayFlat( KArrayGranularity ); |
|
98 |
|
99 // original servers |
|
100 iOriginalServers = iMSEngine->GetMediaServersL(); |
|
101 ClearServersSystemUpdateId(); |
|
102 |
|
103 // Start searching servers |
|
104 TInt error = CreateAvControllerL(); |
|
105 if ( !error && iAvController ) |
|
106 { |
|
107 // Process devices that AVController has already discovered. |
|
108 FetchAlreadyDiscoveredDevicesL(); |
|
109 } |
|
110 |
|
111 #if _DEBUG |
|
112 RDebug::Printf("[MSAppWizard]\t CMSAppWizard::ConstructL: %s, %s\n",\ |
|
113 __DATE__,__TIME__); |
|
114 #endif |
|
115 LOG( _L("[MSAppWizard]\t CMSAppWizard::ConstructL end") ); |
|
116 } |
|
117 |
|
118 // -------------------------------------------------------------------------- |
|
119 // CMSAppWizard::NewL() |
|
120 // Two-phased constructor. |
|
121 // -------------------------------------------------------------------------- |
|
122 // |
|
123 EXPORT_C CMSAppWizard* CMSAppWizard::NewL( CMSEngine& aMSEngine ) |
|
124 { |
|
125 LOG( _L("[MSAppWizard]\t CMSAppWizard::NewL begin") ); |
|
126 |
|
127 CMSAppWizard* self = CMSAppWizard::NewLC( aMSEngine ); |
|
128 |
|
129 CleanupStack::Pop( self ); |
|
130 LOG( _L("[MSAppWizard]\t CMSAppWizard::NewL end") ); |
|
131 return self; |
|
132 } |
|
133 |
|
134 // -------------------------------------------------------------------------- |
|
135 // CMSAppWizard::NewLC() |
|
136 // Two-phased constructor. |
|
137 // -------------------------------------------------------------------------- |
|
138 // |
|
139 EXPORT_C CMSAppWizard* CMSAppWizard::NewLC( CMSEngine& aMSEngine ) |
|
140 { |
|
141 LOG( _L("[MSAppWizard]\t CMSAppWizard::NewLC begin") ); |
|
142 |
|
143 CMSAppWizard* self = new ( ELeave) CMSAppWizard( aMSEngine ); |
|
144 CleanupStack::PushL( self ); |
|
145 |
|
146 self->ConstructL(); |
|
147 |
|
148 LOG( _L("[MSAppWizard]\t CMSAppWizard::NewLC end") ); |
|
149 return self; |
|
150 } |
|
151 |
|
152 // -------------------------------------------------------------------------- |
|
153 // Destructor |
|
154 // -------------------------------------------------------------------------- |
|
155 // |
|
156 CMSAppWizard::~CMSAppWizard() |
|
157 { |
|
158 LOG( _L("[MSAppWizard]\t CMSAppWizard::~CMSAppWizard begin") ); |
|
159 |
|
160 // stop device search |
|
161 CancelDeviceSearch(); |
|
162 |
|
163 // UnLoad resource file |
|
164 iCoeEnv->DeleteResourceFile( iResFileOffset ); |
|
165 |
|
166 if ( iOriginalServers ) |
|
167 { |
|
168 iOriginalServers->ResetAndDestroy(); |
|
169 iOriginalServers->Close(); |
|
170 delete iOriginalServers; |
|
171 } |
|
172 |
|
173 if ( iDeviceNameArray ) |
|
174 { |
|
175 iDeviceNameArray->Reset(); |
|
176 delete iDeviceNameArray; |
|
177 } |
|
178 |
|
179 iDriveIndexes.Close(); |
|
180 |
|
181 iDriveArray.ResetAndDestroy(); |
|
182 iDriveArray.Close(); |
|
183 |
|
184 iStoreServers.Reset(); |
|
185 iStoreServers.Close(); |
|
186 |
|
187 iMediaServers.ResetAndDestroy(); |
|
188 iMediaServers.Close(); |
|
189 |
|
190 delete iSelections; |
|
191 |
|
192 if ( iAvController ) |
|
193 { |
|
194 iAvController->RemoveDeviceObserver(); |
|
195 iAvController->Release(); |
|
196 iAvController = NULL; |
|
197 } |
|
198 |
|
199 CloseWaitDialog(); |
|
200 |
|
201 if ( iWait.IsStarted() ) |
|
202 { |
|
203 iWait.AsyncStop(); |
|
204 } |
|
205 |
|
206 LOG( _L("[MSAppWizard]\t CMSAppWizard::~CMSAppWizard end") ); |
|
207 } |
|
208 |
|
209 // -------------------------------------------------------------------------- |
|
210 // CMSAppWizard::StartL |
|
211 // The main loop of setup wizard |
|
212 // -------------------------------------------------------------------------- |
|
213 // |
|
214 |
|
215 EXPORT_C TInt CMSAppWizard::StartL() |
|
216 { |
|
217 LOG( _L("[MSAppWizard]\t CMSAppWizard::StartL begin") ); |
|
218 TInt ret(KErrNone); |
|
219 do |
|
220 { |
|
221 switch ( iStep ) |
|
222 { |
|
223 case EStep1: |
|
224 { |
|
225 HBufC* head = StringLoader::LoadLC( |
|
226 R_MS_HEADING_STEP_1, ELastStep ); |
|
227 ret = ShowInfoStepL( iStep, head->Des() ); |
|
228 CleanupStack::PopAndDestroy( head ); |
|
229 break; |
|
230 } |
|
231 case EStep2: |
|
232 { |
|
233 HBufC* head = StringLoader::LoadLC( |
|
234 R_MS_HEADING_STEP_2, ELastStep ); |
|
235 ret = ShowInfoStepL( iStep, head->Des() ); |
|
236 CleanupStack::PopAndDestroy( head ); |
|
237 break; |
|
238 } |
|
239 case EStep3: |
|
240 { |
|
241 HBufC* head = StringLoader::LoadLC( |
|
242 R_MS_HEADING_STEP_3, ELastStep ); |
|
243 |
|
244 CDesCArrayFlat* itemArray = |
|
245 CreateMultiselectionFillListItemsLC(); |
|
246 |
|
247 CArrayFix<TInt>* resultArray = |
|
248 new (ELeave) CArrayFixFlat<TInt>( KFillListGranularity ); |
|
249 CleanupStack::PushL( resultArray ); |
|
250 |
|
251 ret = ShowMultiselectionStepL( *itemArray, |
|
252 *resultArray, |
|
253 head->Des() ); |
|
254 // keep selection safe |
|
255 iSelections->SetFillListSelections( *resultArray ); |
|
256 CleanupStack::Pop( resultArray ); |
|
257 CleanupStack::PopAndDestroy( itemArray ); |
|
258 CleanupStack::PopAndDestroy( head ); |
|
259 break; |
|
260 } |
|
261 case EStep4: |
|
262 { |
|
263 HBufC* head = StringLoader::LoadLC( |
|
264 R_MS_HEADING_STEP_4, ELastStep ); |
|
265 ret = ShowInfoStepL( iStep, head->Des() ); |
|
266 CleanupStack::PopAndDestroy( head ); |
|
267 break; |
|
268 } |
|
269 case EStep5: |
|
270 { |
|
271 CreateServerNameListL( iMediaServers ); |
|
272 |
|
273 if ( iDeviceNameArray->Count() == 0 ) |
|
274 { |
|
275 // no devices yet - show wait note |
|
276 ShowWaitNoteL(); |
|
277 // wait here for the first device before |
|
278 // showing device selection |
|
279 iWait.Start(); |
|
280 } |
|
281 if ( !iUserCancelledSearch ) |
|
282 { |
|
283 HBufC* head = StringLoader::LoadLC( |
|
284 R_MS_HEADING_STEP_5, ELastStep ); |
|
285 |
|
286 CArrayFix<TInt>* selectedIndexes = |
|
287 new (ELeave) CArrayFixFlat<TInt>( KArrayGranularity ); |
|
288 CleanupStack::PushL( selectedIndexes ); |
|
289 ret = ShowMultiselectionStepL( *iDeviceNameArray, |
|
290 *selectedIndexes, |
|
291 head->Des() ); |
|
292 iSelections->SetServersForFillRulesL( *selectedIndexes ); |
|
293 CleanupStack::PopAndDestroy( selectedIndexes ); |
|
294 CleanupStack::PopAndDestroy( head ); |
|
295 } |
|
296 else |
|
297 { |
|
298 ret = KErrCancel; |
|
299 } |
|
300 |
|
301 break; |
|
302 } |
|
303 case EStep6: |
|
304 { |
|
305 HBufC* head = StringLoader::LoadLC( |
|
306 R_MS_HEADING_STEP_6, ELastStep ); |
|
307 ret = ShowInfoStepL( iStep, head->Des() ); |
|
308 CleanupStack::PopAndDestroy( head ); |
|
309 break; |
|
310 } |
|
311 case EStep7: |
|
312 { |
|
313 HBufC* head = StringLoader::LoadLC( |
|
314 R_MS_HEADING_STEP_7, ELastStep ); |
|
315 //used CreateMultiselectionStoreListItemsLC before, modify then to |
|
316 //make it the same with UI spec |
|
317 CDesCArrayFlat* itemArray = |
|
318 CreateMultiselectionUIStoreListStringLC(); |
|
319 |
|
320 CArrayFix<TInt>* resultArray = |
|
321 new (ELeave) CArrayFixFlat<TInt>( KStoreListGranularity ); |
|
322 CleanupStack::PushL( resultArray ); |
|
323 |
|
324 ret = ShowMultiselectionStepL( *itemArray, |
|
325 *resultArray, |
|
326 head->Des() ); |
|
327 // keep selection safe |
|
328 iSelections->SetStoreListSelections( *resultArray ); |
|
329 CleanupStack::Pop( resultArray ); |
|
330 CleanupStack::PopAndDestroy( itemArray ); |
|
331 CleanupStack::PopAndDestroy( head ); |
|
332 break; |
|
333 } |
|
334 case EStep8: |
|
335 { |
|
336 HBufC* head = StringLoader::LoadLC( |
|
337 R_MS_HEADING_STEP_8, ELastStep ); |
|
338 ret = ShowInfoStepL( iStep, head->Des() ); |
|
339 CleanupStack::PopAndDestroy( head ); |
|
340 break; |
|
341 } |
|
342 case EStep9: |
|
343 { |
|
344 HBufC* head = StringLoader::LoadLC( |
|
345 R_MS_HEADING_STEP_9, ELastStep ); |
|
346 |
|
347 // Clear previous store servers |
|
348 iStoreServers.Reset(); |
|
349 |
|
350 // copy those media servers to store servers list, |
|
351 // where copy capability is active |
|
352 for ( TInt index=0; index < iMediaServers.Count(); index++ ) |
|
353 { |
|
354 if ( iMediaServers.operator[](index)->CopyCapability() ) |
|
355 { |
|
356 iStoreServers.AppendL( |
|
357 iMediaServers.operator[]( index ) ); |
|
358 } |
|
359 } |
|
360 |
|
361 // append items to iDeviceNameArray |
|
362 CreateServerNameListL( iStoreServers ); |
|
363 |
|
364 CArrayFix<TInt>* selectedIndexes = |
|
365 new (ELeave) CArrayFixFlat<TInt>( KArrayGranularity ); |
|
366 CleanupStack::PushL( selectedIndexes ); |
|
367 |
|
368 if ( iDeviceNameArray->Count() ) |
|
369 { |
|
370 ret = ShowMultiselectionStepL( *iDeviceNameArray, |
|
371 *selectedIndexes, |
|
372 head->Des() ); |
|
373 if ( ret > 0 && selectedIndexes->Count() == 0 ) |
|
374 { |
|
375 ShowInfoNoteL( R_MS_NO_TARGET_DEVICES_SELECTED_INFO ); |
|
376 // clear store list selections |
|
377 iSelections->ClearStoreListSelections(); |
|
378 } |
|
379 iSelections->SetServersForStoreRulesL( *selectedIndexes, |
|
380 iStoreServers ); |
|
381 } |
|
382 else // no devices available - show info note |
|
383 { |
|
384 ret = ShowInfoStepL( iStep, head->Des() ); |
|
385 if ( ret > KErrNone ) |
|
386 { |
|
387 // clear store list selections |
|
388 iSelections->ClearStoreListSelections(); |
|
389 iSelections->SetServersForStoreRulesL( |
|
390 *selectedIndexes, |
|
391 iStoreServers ); |
|
392 } |
|
393 } |
|
394 |
|
395 CleanupStack::PopAndDestroy( selectedIndexes ); |
|
396 CleanupStack::PopAndDestroy( head ); |
|
397 break; |
|
398 } |
|
399 |
|
400 case EStep10: |
|
401 { |
|
402 HBufC* head = StringLoader::LoadLC( |
|
403 R_MS_HEADING_STEP_10, ELastStep ); |
|
404 ret = ShowInfoStepL( iStep, head->Des() ); |
|
405 CleanupStack::PopAndDestroy( head ); |
|
406 break; |
|
407 } |
|
408 case EStep11: |
|
409 { |
|
410 HBufC* head = StringLoader::LoadLC( |
|
411 R_MS_HEADING_STEP_11, ELastStep ); |
|
412 ret = ShowListStepL( R_MS_WIZARD_SELECTION_DIALOG_8, |
|
413 head->Des() ); |
|
414 CleanupStack::PopAndDestroy( head ); |
|
415 break; |
|
416 } |
|
417 case EStep12: |
|
418 { |
|
419 // two parameters |
|
420 CArrayFix<TInt>* stepArray = |
|
421 new ( ELeave ) CArrayFixFlat<TInt>(2); |
|
422 CleanupStack::PushL( stepArray ); |
|
423 stepArray->AppendL( ELastStep ); |
|
424 stepArray->AppendL( ELastStep ); |
|
425 HBufC* head = StringLoader::LoadLC( |
|
426 R_MS_HEADING_STEP_12, *stepArray ); |
|
427 ret = ShowInfoStepL( iStep, head->Des() ); |
|
428 CleanupStack::PopAndDestroy( head ); |
|
429 CleanupStack::PopAndDestroy( stepArray ); |
|
430 break; |
|
431 } |
|
432 case ELastStep: |
|
433 { |
|
434 // stop device search |
|
435 CancelDeviceSearch(); |
|
436 |
|
437 // set remove status and name to old servers |
|
438 CheckAndSetServerStateL(); |
|
439 // clear ids again because there might be new unselected servers |
|
440 ClearServersSystemUpdateId(); |
|
441 |
|
442 iMSEngine->SetMediaServersL( *iOriginalServers ); |
|
443 |
|
444 // Set used drives |
|
445 iSelections->SetDriveInformationL(); |
|
446 |
|
447 iSelections->StoreMSSettingsL(); |
|
448 |
|
449 ret = ELastStep; // stop looping |
|
450 break; |
|
451 } |
|
452 case ECancelWizard: |
|
453 { |
|
454 // stop device search |
|
455 CancelDeviceSearch(); |
|
456 |
|
457 // Wizard is cancelled, do not start information refreshing |
|
458 ret = KErrNone; |
|
459 break; |
|
460 } |
|
461 default : |
|
462 { |
|
463 LOG( _L("[MSAppWizard]\t CMSAppWizard::StartL: default!") ); |
|
464 __ASSERT_DEBUG( EFalse, User::Panic( KPanicedUnit, 0 ) ); |
|
465 break; |
|
466 } |
|
467 } |
|
468 |
|
469 SetNextStep( ret ); |
|
470 } |
|
471 while ( iStep != EWizardEnd ); |
|
472 |
|
473 LOG(_L("[MSAppWizard]\t CMSAppWizard::StartL end")); |
|
474 |
|
475 return ret; |
|
476 } |
|
477 |
|
478 // --------------------------------------------------------------------------- |
|
479 // CMSAppWizard::DialogDismissedL |
|
480 // --------------------------------------------------------------------------- |
|
481 // |
|
482 void CMSAppWizard::DialogDismissedL( TInt aButtonId ) |
|
483 { |
|
484 LOG(_L("[MSAppWizard]\t CMSAppWizard::DialogDismissedL")); |
|
485 if( aButtonId != EAknSoftkeyDone ) |
|
486 { |
|
487 LOG(_L("[MSAppWizard]\t CMSAppWizard::DialogDismissedL CANCEL")); |
|
488 if ( aButtonId == EAknSoftkeyCancel ) |
|
489 { |
|
490 iUserCancelledSearch = ETrue; |
|
491 } |
|
492 } |
|
493 if ( iWait.IsStarted() ) |
|
494 { |
|
495 iWait.AsyncStop(); |
|
496 } |
|
497 } |
|
498 |
|
499 // -------------------------------------------------------------------------- |
|
500 // CMSAppWizard::ShowInfoNoteL |
|
501 // -------------------------------------------------------------------------- |
|
502 // |
|
503 void CMSAppWizard::ShowInfoNoteL( TInt aBodyTextResource ) |
|
504 { |
|
505 LOG(_L("[MSAppWizard]\t CMSAppWizard::ShowInfoNoteL")); |
|
506 CAknInformationNote* dlg = new(ELeave)CAknInformationNote( ETrue ); |
|
507 CleanupStack::PushL( dlg ); |
|
508 HBufC* noteText = StringLoader::LoadLC( aBodyTextResource ); |
|
509 dlg->ExecuteLD( *noteText ); |
|
510 CleanupStack::PopAndDestroy( noteText ); |
|
511 CleanupStack::Pop( dlg ); |
|
512 } |
|
513 |
|
514 // -------------------------------------------------------------------------- |
|
515 // CMSAppWizard::AddDeviceNameL |
|
516 // -------------------------------------------------------------------------- |
|
517 // |
|
518 void CMSAppWizard::AddDeviceNameL( const CUpnpAVDevice& aDevice ) |
|
519 { |
|
520 CUpnpAVDevice* device = const_cast<CUpnpAVDevice*> ( &aDevice ); |
|
521 |
|
522 HBufC* devName = CnvUtfConverter::ConvertToUnicodeFromUtf8L( |
|
523 device->FriendlyName() ); |
|
524 CleanupStack::PushL( devName ); |
|
525 TRACE(Print(_L("[MSAppWizard]\t device Name= %S"), devName )); |
|
526 iDeviceNameArray->AppendL( *devName ); |
|
527 CleanupStack::PopAndDestroy( devName ); |
|
528 } |
|
529 |
|
530 // -------------------------------------------------------------------------- |
|
531 // CMSAppWizard::ShowInfoStepL |
|
532 // |
|
533 // -------------------------------------------------------------------------- |
|
534 // |
|
535 TInt CMSAppWizard::ShowInfoStepL( TInt aStep, TPtr aHeading ) |
|
536 { |
|
537 LOG(_L("[MSAppWizard]\t CMSAppWizard::ShowInfoStepL")); |
|
538 TInt returnValue( KErrNone ); |
|
539 |
|
540 CAknMessageQueryDialog* dlg = new (ELeave) |
|
541 CAknMessageQueryDialog( CAknQueryDialog::ENoTone ); |
|
542 CleanupStack::PushL( dlg ); |
|
543 |
|
544 dlg->PrepareLC( R_MS_WIZARD_INFO_DIALOG ); |
|
545 |
|
546 // do number conversion |
|
547 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( aHeading ); |
|
548 |
|
549 dlg->SetHeaderTextL( aHeading ); |
|
550 HBufC* body = NULL; |
|
551 switch ( aStep ) |
|
552 { |
|
553 case EStep1: |
|
554 { |
|
555 body = StringLoader::LoadLC( R_MS_STEP_1_BODY_TEXT ); |
|
556 break; |
|
557 } |
|
558 case EStep2: |
|
559 { |
|
560 body = StringLoader::LoadLC( R_MS_STEP_2_BODY_TEXT ); |
|
561 break; |
|
562 } |
|
563 case EStep4: |
|
564 { |
|
565 body = StringLoader::LoadLC( R_MS_STEP_4_BODY_TEXT ); |
|
566 break; |
|
567 } |
|
568 case EStep6: |
|
569 { |
|
570 body = StringLoader::LoadLC( R_MS_STEP_6_BODY_TEXT ); |
|
571 break; |
|
572 } |
|
573 case EStep8: |
|
574 { |
|
575 body = StringLoader::LoadLC( R_MS_STEP_8_BODY_TEXT ); |
|
576 break; |
|
577 } |
|
578 case EStep9: |
|
579 { |
|
580 body = StringLoader::LoadLC( R_MS_STEP_9_2_BODY_TEXT ); |
|
581 break; |
|
582 } |
|
583 case EStep10: |
|
584 { |
|
585 body = StringLoader::LoadLC( R_MS_STEP_10_BODY_TEXT ); |
|
586 break; |
|
587 } |
|
588 case EStep12: |
|
589 { |
|
590 body = StringLoader::LoadLC( R_MS_LAST_STEP_BODY_TEXT ); |
|
591 break; |
|
592 } |
|
593 default: |
|
594 { |
|
595 LOG(_L("[MSAppWizard]\t CMSAppWizard::ShowInfoStepL \ |
|
596 Step not found")); |
|
597 break; |
|
598 } |
|
599 } |
|
600 |
|
601 if ( body ) // long body text |
|
602 { |
|
603 dlg->SetMessageTextL( *body ); |
|
604 CleanupStack::PopAndDestroy( body ); |
|
605 } |
|
606 |
|
607 returnValue = dlg->RunLD(); |
|
608 CleanupStack::Pop( dlg ); |
|
609 |
|
610 return returnValue; |
|
611 } |
|
612 |
|
613 // -------------------------------------------------------------------------- |
|
614 // CMSAppWizard::ShowListStepL |
|
615 // Show the UI dialog with selection list |
|
616 // -------------------------------------------------------------------------- |
|
617 // |
|
618 TInt CMSAppWizard::ShowListStepL( TInt aMain, TPtr aHeading ) |
|
619 { |
|
620 LOG(_L("[MSAppWizard]\t CMSAppWizard::ShowListStepL begin")); |
|
621 TInt returnValue(KErrNone); |
|
622 |
|
623 TBool currSelection = iSelections->AutoManualSelection(); |
|
624 |
|
625 CDesCArrayFlat* storeTypeSelection = new (ELeave) CDesCArrayFlat( |
|
626 KArrayGranularity ); |
|
627 CleanupStack::PushL( storeTypeSelection ); |
|
628 |
|
629 HBufC* itemText1 = StringLoader::LoadLC( R_MS_AUTOMATIC_TEXT ); |
|
630 HBufC* itemText2 = StringLoader::LoadLC( R_MS_MANUAL_TEXT ); |
|
631 |
|
632 storeTypeSelection->AppendL( *itemText1 ); |
|
633 storeTypeSelection->AppendL( *itemText2 ); |
|
634 |
|
635 CleanupStack::PopAndDestroy(2, itemText1 ); |
|
636 |
|
637 CAknListQueryDialog* dlg = new |
|
638 ( ELeave ) CAknListQueryDialog( &currSelection ); |
|
639 |
|
640 dlg->PrepareLC( aMain ); |
|
641 |
|
642 // do number conversion |
|
643 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( aHeading ); |
|
644 |
|
645 dlg->SetHeaderTextL( aHeading ); |
|
646 dlg->SetItemTextArray( storeTypeSelection ); |
|
647 dlg->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
648 |
|
649 CListBoxView* listBoxView = dlg->ListBox()->View(); |
|
650 listBoxView->SetCurrentItemIndex( currSelection ); |
|
651 |
|
652 returnValue = dlg->RunLD(); |
|
653 |
|
654 TRACE( |
|
655 Print( _L("MSAppWizard]\t ShowListStepL exit dlg: %d" ), |
|
656 returnValue ) ); |
|
657 iSelections->SetAutoManualSelection( currSelection ); |
|
658 |
|
659 CleanupStack::PopAndDestroy( storeTypeSelection ); |
|
660 |
|
661 LOG(_L("[MSAppWizard]\t CMSAppWizard::ShowListStepL ends")); |
|
662 return returnValue; |
|
663 } |
|
664 |
|
665 // -------------------------------------------------------------------------- |
|
666 // CMSAppWizard::ShowMultiselectionStepL |
|
667 // Show the multiselection popup dialog for setting content to share |
|
668 // -------------------------------------------------------------------------- |
|
669 // |
|
670 TInt CMSAppWizard::ShowMultiselectionStepL( CDesCArrayFlat& aItemArray, |
|
671 CArrayFix<TInt>& aResultArray, |
|
672 TPtr aHeading |
|
673 ) |
|
674 { |
|
675 LOG(_L("[MSAppWizard]\t CMSAppWizard::ShowMultiselectionStepL")); |
|
676 TInt returnValue(KErrNone); |
|
677 |
|
678 // do number conversion |
|
679 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( aHeading ); |
|
680 |
|
681 iMultiSelectionDlg = CMSMultiselectionPopup::NewL( |
|
682 &aItemArray, |
|
683 &aResultArray, |
|
684 aHeading ); |
|
685 |
|
686 iMultiSelectionDlg->PrepareLC( R_MS_WIZARD_MULTISELECTION_DIALOG ); |
|
687 |
|
688 // For Device selection |
|
689 if ( iStep == EStep5 || iStep == EStep9 ) |
|
690 { |
|
691 #ifndef __WINS__ |
|
692 iMultiSelectionDlg->QueryHeading()->SetHeaderAnimationL( |
|
693 R_MS_ANIMATION_FOR_SELECTION_DIALOG ); |
|
694 #endif |
|
695 if ( iStep == EStep9 ) // no upload servers found |
|
696 { |
|
697 HBufC* defaultText = |
|
698 StringLoader::LoadLC( R_MS_STEP_9_2_BODY_TEXT ); |
|
699 iMultiSelectionDlg->ListBox()->View()->SetListEmptyTextL( |
|
700 *defaultText ); |
|
701 CleanupStack::PopAndDestroy( defaultText ); |
|
702 } |
|
703 } |
|
704 |
|
705 returnValue = iMultiSelectionDlg->RunLD(); |
|
706 iMultiSelectionDlg = NULL; |
|
707 |
|
708 return returnValue; |
|
709 } |
|
710 |
|
711 // -------------------------------------------------------------------------- |
|
712 // CMSAppWizard::ShowWaitNoteL |
|
713 // -------------------------------------------------------------------------- |
|
714 // |
|
715 TInt CMSAppWizard::ShowWaitNoteL() |
|
716 { |
|
717 TInt returnValue( 0 ); |
|
718 |
|
719 iUserCancelledSearch = EFalse; |
|
720 iWLanLost = EFalse; |
|
721 iWaitDialog = new ( ELeave ) CAknWaitDialog( |
|
722 ( REINTERPRET_CAST( CEikDialog**, &iWaitDialog ) ) ); |
|
723 iWaitDialog->SetCallback( this ); |
|
724 iWaitDialog->ExecuteLD( R_MS_WIZARD_WAIT_DIALOG ); |
|
725 |
|
726 return returnValue; |
|
727 } |
|
728 |
|
729 // -------------------------------------------------------------------------- |
|
730 // CMSAppWizard::SetNextStep |
|
731 // Calculates the next step in wizard |
|
732 // -------------------------------------------------------------------------- |
|
733 // |
|
734 void CMSAppWizard::SetNextStep( const TInt aDirection ) |
|
735 { |
|
736 LOG(_L("[MSAppWizard]\t CMSAppWizard::SetNextStep")); |
|
737 |
|
738 if ( aDirection > 0 || EEikBidOk == aDirection ) |
|
739 { |
|
740 iStep++; |
|
741 } |
|
742 else if ( iStep <= 0 ) |
|
743 { |
|
744 iStep = ECancelWizard; |
|
745 } |
|
746 else |
|
747 { |
|
748 iStep--; |
|
749 } |
|
750 } |
|
751 |
|
752 // -------------------------------------------------------------------------- |
|
753 // CMSAppWizard::CancelDeviceSearch |
|
754 // |
|
755 // -------------------------------------------------------------------------- |
|
756 // |
|
757 void CMSAppWizard::CancelDeviceSearch() |
|
758 { |
|
759 LOG(_L("[MSAppWizard]\t CMSAppWizard::CancelDeviceSearch")); |
|
760 |
|
761 if ( iAvController ) |
|
762 { |
|
763 iAvController->RemoveDeviceObserver(); |
|
764 iAvController->Release(); |
|
765 iAvController = NULL; |
|
766 } |
|
767 } |
|
768 |
|
769 // -------------------------------------------------------------------------- |
|
770 // CMSAppWizard::CreateAvControllerL |
|
771 // |
|
772 // -------------------------------------------------------------------------- |
|
773 // |
|
774 TInt CMSAppWizard::CreateAvControllerL() |
|
775 { |
|
776 LOG(_L("[MSAppWizard]\t CMSAppWizard::CreateAvControllerL begins")); |
|
777 |
|
778 TInt retVal(KErrNone); |
|
779 |
|
780 |
|
781 iMediaServers.ResetAndDestroy(); |
|
782 iMediaServers.Close(); |
|
783 |
|
784 |
|
785 if( iDeviceNameArray ) |
|
786 { |
|
787 iDeviceNameArray->Reset(); |
|
788 delete iDeviceNameArray; |
|
789 iDeviceNameArray = NULL; |
|
790 iDeviceNameArray = new (ELeave) CDesCArrayFlat( KArrayGranularity ); |
|
791 } |
|
792 |
|
793 if( iAvController ) |
|
794 { |
|
795 iAvController->Release(); |
|
796 iAvController = NULL; |
|
797 } |
|
798 |
|
799 LOG(_L("[MSAppWizard]\t CMSAppWizard::CreateAvControllerL before")); |
|
800 TRAP( retVal, |
|
801 iAvController = UPnPAVControllerFactory::NewUPnPAVControllerL() ); |
|
802 |
|
803 LOG(_L("[MSAppWizard]\t CMSAppWizard::CreateAvControllerL afterr")); |
|
804 |
|
805 if( retVal != KErrNone ) |
|
806 { |
|
807 TRACE( Print( |
|
808 _L("[MediaServant]\t AvController create FAILED, \ |
|
809 err = %d"), retVal) |
|
810 ); |
|
811 if( retVal == KErrCancel ) |
|
812 { |
|
813 //operation cancelled, return to dialog 4/8 |
|
814 CloseWaitDialog(); |
|
815 } |
|
816 } |
|
817 else |
|
818 { |
|
819 iAvController->SetDeviceObserver( *this ); |
|
820 } |
|
821 |
|
822 LOG(_L("[MSAppWizard]\t CMSAppWizard::CreateAvControllerL ends")); |
|
823 return retVal; |
|
824 } |
|
825 |
|
826 // --------------------------------------------------------------------------- |
|
827 // CMSAppWizard::UpdateDevicePopupDlgL |
|
828 // Updates popup data with found device |
|
829 // --------------------------------------------------------------------------- |
|
830 // |
|
831 void CMSAppWizard::UpdateDevicePopupDlgL() |
|
832 { |
|
833 LOG(_L("[MSAppWizard]\t CMSAppWizard::UpdateDevicePopupDlgL begins")); |
|
834 |
|
835 iMultiSelectionDlg->UpdateAndDrawPopupL( iDeviceNameArray ); |
|
836 LOG(_L("[MSAppWizard]\t CMSAppWizard::UpdateDevicePopupDlgL ends")); |
|
837 } |
|
838 |
|
839 |
|
840 // --------------------------------------------------------------------------- |
|
841 // CMSAppWizard::UPnPDeviceDiscovered |
|
842 // Returns discovered device from UPnP AV control point |
|
843 // --------------------------------------------------------------------------- |
|
844 // |
|
845 void CMSAppWizard::UPnPDeviceDiscovered( const CUpnpAVDevice& aDevice ) |
|
846 { |
|
847 LOG(_L("[MediaServant]\t CMSSettingItemDevices::\ |
|
848 UPnPDeviceDiscovered")); |
|
849 |
|
850 TRAP_IGNORE( UPnPDeviceDiscoveredL(aDevice) ); |
|
851 } |
|
852 |
|
853 |
|
854 // --------------------------------------------------------------------------- |
|
855 // CMSAppWizard::UPnPDeviceDiscoveredL |
|
856 // |
|
857 // --------------------------------------------------------------------------- |
|
858 // |
|
859 void CMSAppWizard::UPnPDeviceDiscoveredL( const CUpnpAVDevice& aDevice ) |
|
860 { |
|
861 LOG(_L("[MSAppWizard]\t CMSAppWizard::DeviceDiscoveredL begins")); |
|
862 |
|
863 CUpnpAVDevice* device = const_cast<CUpnpAVDevice*> ( &aDevice ); |
|
864 |
|
865 if( device->DeviceType() == CUpnpAVDevice::EMediaServer && |
|
866 device->SearchCapability() && |
|
867 device->DlnaCompatible() ) |
|
868 { |
|
869 LOG(_L("[MSAppWizard]\t Found device is Media server!")); |
|
870 CCmMediaServerFull* tempServer = CCmMediaServerFull::NewL(); |
|
871 CleanupStack::PushL( tempServer ); |
|
872 tempServer->SetUDNL( device->Uuid() ); |
|
873 tempServer->SetMediaServerNameL( device->FriendlyName() ); |
|
874 tempServer->SetSystemUpdateID( -1 ); |
|
875 tempServer->SetCopyCapability( aDevice.CopyCapability() ); |
|
876 |
|
877 TTime timeStamp; |
|
878 timeStamp.HomeTime(); |
|
879 tempServer->SetVisibleDate( timeStamp ); |
|
880 iMediaServers.AppendL( tempServer ); |
|
881 |
|
882 if ( iStep == EStep9 ) |
|
883 { |
|
884 // Add only store servers in step EStep9 |
|
885 if ( tempServer->CopyCapability() ) |
|
886 { |
|
887 iStoreServers.AppendL( tempServer ); |
|
888 AddDeviceNameL( aDevice ); |
|
889 } |
|
890 } |
|
891 else |
|
892 { |
|
893 AddDeviceNameL( aDevice ); |
|
894 } |
|
895 |
|
896 CleanupStack::Pop( tempServer ); |
|
897 } |
|
898 else |
|
899 { |
|
900 LOG(_L("[MSAppWizard]\t Found device is NOT Dlna compliant \ |
|
901 Media server!")); |
|
902 return; |
|
903 } |
|
904 |
|
905 if ( iWaitDialog ) |
|
906 { |
|
907 CloseWaitDialog(); |
|
908 } |
|
909 // Ensure that we are in device selection step before adding items |
|
910 // to the dialog |
|
911 else if( iMultiSelectionDlg && ( iStep == EStep5 || iStep == EStep9 )) |
|
912 { |
|
913 //update device list for UI |
|
914 UpdateDevicePopupDlgL(); |
|
915 } |
|
916 |
|
917 LOG(_L("[MSAppWizard]\t CMSAppWizard::DeviceDiscoveredL ends")); |
|
918 |
|
919 } |
|
920 |
|
921 // --------------------------------------------------------------------------- |
|
922 // CMSAppWizard::UPnPDeviceDisappeared |
|
923 // Returns disappeared device from UPnP AV control point. |
|
924 // --------------------------------------------------------------------------- |
|
925 // |
|
926 void CMSAppWizard::UPnPDeviceDisappeared( const CUpnpAVDevice& aDevice ) |
|
927 { |
|
928 LOG(_L("[MediaServant]\t CMSSettingItemDevices::\ |
|
929 UPnPDeviceDisappeared")); |
|
930 |
|
931 TRAP_IGNORE( UPnPDeviceDisappearedL( aDevice ) ); |
|
932 } |
|
933 |
|
934 // --------------------------------------------------------------------------- |
|
935 // CMSAppWizard::UPnPDeviceDisappearedL |
|
936 // |
|
937 // --------------------------------------------------------------------------- |
|
938 // |
|
939 void CMSAppWizard::UPnPDeviceDisappearedL( const CUpnpAVDevice& aDevice ) |
|
940 { |
|
941 LOG(_L("[MSAppWizard]\t CMSAppWizard::DeviceDisappearedL begins")); |
|
942 TPtrC8 ptr( aDevice.Uuid() ); |
|
943 TInt serverIndex(0); |
|
944 |
|
945 if (!ptr.Compare(_L8("ConnectionLost"))) |
|
946 { |
|
947 LOG(_L("[MSAppWizard]\t CMSAppWizard::\ |
|
948 UPnPDeviceDisappearedL: Connection lost!")); |
|
949 } |
|
950 |
|
951 TPtrC8 serverUid = aDevice.Uuid(); |
|
952 |
|
953 if( MatchFoundServer( serverUid, serverIndex ) == KErrNone ) |
|
954 { |
|
955 // remove server and update screen |
|
956 LOG(_L("[MSAppWizard]\t CMSAppWizard::DeviceDisappearedL, MATCH")); |
|
957 delete (iMediaServers)[serverIndex]; |
|
958 (iMediaServers)[serverIndex] = NULL; |
|
959 iMediaServers.Remove( serverIndex ); |
|
960 iDeviceNameArray->Delete( serverIndex ); |
|
961 |
|
962 if( iMultiSelectionDlg && ( iStep == EStep5 || iStep == EStep9 ) ) |
|
963 { |
|
964 UpdateDevicePopupDlgL(); |
|
965 } |
|
966 } |
|
967 |
|
968 LOG(_L("[MSAppWizard]\t CMSAppWizard::DeviceDisappearedL ends")); |
|
969 } |
|
970 |
|
971 // --------------------------------------------------------------------------- |
|
972 // CMSAppWizard::WLANConnectionLost |
|
973 // Called when wlan connection is lost |
|
974 // --------------------------------------------------------------------------- |
|
975 // |
|
976 void CMSAppWizard::WLANConnectionLost() |
|
977 { |
|
978 LOG(_L("[MSAppWizard]\t CMSAppWizard::WLANConnectionLost")); |
|
979 iWLanLost = ETrue; |
|
980 TRAP_IGNORE( DialogDismissedL( EAknSoftkeyCancel ) ); |
|
981 } |
|
982 |
|
983 // --------------------------------------------------------------------------- |
|
984 // CMSAppWizard::MatchFoundServer |
|
985 // returns KErrNone if match found |
|
986 // --------------------------------------------------------------------------- |
|
987 // |
|
988 TInt CMSAppWizard::MatchFoundServer( TDesC8& aUid, TInt &aServerIndex ) |
|
989 { |
|
990 TInt retVal( KErrNotFound ); |
|
991 TInt devicecount = iMediaServers.Count(); |
|
992 |
|
993 for( TInt i=0; i<devicecount; i++ ) |
|
994 { |
|
995 |
|
996 retVal = (iMediaServers)[i]->MediaServer().Compare( aUid ); |
|
997 |
|
998 if ( retVal == KErrNone ) |
|
999 { |
|
1000 aServerIndex = i; |
|
1001 i = devicecount; // break from the for loop |
|
1002 } |
|
1003 } |
|
1004 return retVal; |
|
1005 } |
|
1006 |
|
1007 // --------------------------------------------------------------------------- |
|
1008 // CMSAppWizard::CheckAndSetServerStateL |
|
1009 // sets remove state to server if it is old one |
|
1010 // also update the server name |
|
1011 // --------------------------------------------------------------------------- |
|
1012 // |
|
1013 void CMSAppWizard::CheckAndSetServerStateL() |
|
1014 { |
|
1015 LOG(_L("[MSAppWizard]\t CMSAppWizard::CheckAndSetServerStateL")); |
|
1016 |
|
1017 TKeyArrayFix sortKey( 0, ECmpNormal ); |
|
1018 |
|
1019 // set remove status to all original servers |
|
1020 for ( TInt ind = 0; ind < iOriginalServers->Count(); ind++ ) |
|
1021 { |
|
1022 CCmMediaServerFull* tempServer = (*iOriginalServers)[ind]; |
|
1023 tempServer->SetIsActive( KServerRemoved ); |
|
1024 tempServer->SetStoreUsage( EFalse ); |
|
1025 tempServer->SetFillUsage( EFalse ); |
|
1026 } |
|
1027 |
|
1028 // Change found servers statuses |
|
1029 for ( TInt i = 0; i < iMediaServers.Count(); i++ ) |
|
1030 { |
|
1031 CCmMediaServerFull* newServer = iMediaServers[i]; |
|
1032 TBool found( EFalse ); |
|
1033 TInt iterations = iOriginalServers->Count(); |
|
1034 for ( TInt j = 0; j < iterations; j++ ) |
|
1035 { |
|
1036 CCmMediaServerFull* origServer = (*iOriginalServers)[j]; |
|
1037 { |
|
1038 if ( origServer->MediaServer() == newServer->MediaServer()) |
|
1039 { |
|
1040 origServer->SetIsActive( newServer->IsActive() ); |
|
1041 origServer->SetStoreUsage( newServer->StoreUsage() ); |
|
1042 origServer->SetFillUsage( newServer->FillUsage() ); |
|
1043 found = ETrue; |
|
1044 j = iterations; // break loop |
|
1045 //update the server name |
|
1046 origServer->SetMediaServerNameL( |
|
1047 newServer->MediaServerName() ); |
|
1048 } |
|
1049 } |
|
1050 } |
|
1051 if ( !found ) |
|
1052 { |
|
1053 // append new server to the server list |
|
1054 iOriginalServers->Append( newServer ); |
|
1055 |
|
1056 iMediaServers.Remove( i ); |
|
1057 // reduce index because of the server remove to |
|
1058 // check all items |
|
1059 i--; |
|
1060 } |
|
1061 } |
|
1062 |
|
1063 } |
|
1064 |
|
1065 // --------------------------------------------------------------------------- |
|
1066 // CMSAppWizard::ClearServersSystemUpdateId |
|
1067 // clears system update ids of unselected servers |
|
1068 // --------------------------------------------------------------------------- |
|
1069 // |
|
1070 void CMSAppWizard::ClearServersSystemUpdateId() |
|
1071 { |
|
1072 LOG(_L("[MSAppWizard]\t CMSAppWizard::ClearServersSystemUpdateId")); |
|
1073 |
|
1074 for ( TInt ind = 0; ind < iOriginalServers->Count(); ind++ ) |
|
1075 { |
|
1076 CCmMediaServerFull* server = (*iOriginalServers)[ind]; |
|
1077 if ( !server->IsActive() ) |
|
1078 { |
|
1079 server->SetSystemUpdateID( -1 ); |
|
1080 } |
|
1081 } |
|
1082 } |
|
1083 |
|
1084 // --------------------------------------------------------------------------- |
|
1085 // CMSAppWizard::FetchAlreadyDiscoveredDevicesL |
|
1086 // Fetches devices from AVController and calls |
|
1087 // DeviceDiscovered-callback for each of them. |
|
1088 // --------------------------------------------------------------------------- |
|
1089 // |
|
1090 void CMSAppWizard::FetchAlreadyDiscoveredDevicesL() |
|
1091 { |
|
1092 LOG( _L("[MSAppWizard]\t CMSAppWizard::FetchAlreadyDiscoveredDevicesL") ); |
|
1093 |
|
1094 // If iAvController is not created, this method is unusable. |
|
1095 // Call CreateAvControllerL first. |
|
1096 User::LeaveIfNull( iAvController ); |
|
1097 |
|
1098 // Fetch already found devices from AVController. |
|
1099 CUpnpAVDeviceList* discoveredDevices = |
|
1100 iAvController->GetMediaServersL(); |
|
1101 CleanupStack::PushL( discoveredDevices ); |
|
1102 |
|
1103 if ( discoveredDevices && discoveredDevices->Count() > 0 ) |
|
1104 { |
|
1105 // the AVController already has some devices. |
|
1106 LOG(_L("[MSAppWizard]\t CMSAppWizard::FetchAlreadyDiscoveredDevicesL:\ |
|
1107 AVController has already discovered devices")); |
|
1108 |
|
1109 // process the already existing devices |
|
1110 for ( TInt i = 0 ; i < discoveredDevices->Count() ; i++ ) |
|
1111 { |
|
1112 UPnPDeviceDiscovered( |
|
1113 *( discoveredDevices->operator[](i) ) ); |
|
1114 } |
|
1115 } |
|
1116 |
|
1117 // clean up |
|
1118 CleanupStack::PopAndDestroy( discoveredDevices ); |
|
1119 discoveredDevices = NULL; |
|
1120 } |
|
1121 |
|
1122 // --------------------------------------------------------------------------- |
|
1123 // CMSAppWizard::CloseWaitDialog |
|
1124 // Close wait dialog |
|
1125 // --------------------------------------------------------------------------- |
|
1126 void CMSAppWizard::CloseWaitDialog() |
|
1127 { |
|
1128 LOG( _L("[MSAppWizard]\t CMSAppWizard::CloseWaitDialog") ); |
|
1129 if ( iWaitDialog ) |
|
1130 { |
|
1131 TRAP_IGNORE( iWaitDialog->ProcessFinishedL() ); |
|
1132 iWaitDialog = NULL; |
|
1133 } |
|
1134 } |
|
1135 |
|
1136 // --------------------------------------------------------------------------- |
|
1137 // CMSAppWizard::CreateMultiselectionFillListItemsLC |
|
1138 // --------------------------------------------------------------------------- |
|
1139 CDesCArrayFlat* CMSAppWizard::CreateMultiselectionFillListItemsLC() |
|
1140 { |
|
1141 LOG(_L("[MSAppWizard]\t CMSAppWizard:: \ |
|
1142 CreateMultiselectionFillListItemsLC")); |
|
1143 |
|
1144 CDesCArrayFlat* itemArray = new (ELeave) CDesCArrayFlat( |
|
1145 KFillListGranularity ); |
|
1146 CleanupStack::PushL( itemArray ); |
|
1147 |
|
1148 // Read fill lists from engine |
|
1149 CCmFillRuleContainer* listContainer = iMSEngine->FillRulesL(); |
|
1150 |
|
1151 for ( TInt index = 0; index < listContainer->FillRuleCount(); index++ ) |
|
1152 { |
|
1153 CCmFillRule* rule = listContainer->FillRule( index ); |
|
1154 HBufC* itemText = CnvUtfConverter::ConvertToUnicodeFromUtf8L( |
|
1155 rule->Name() ); |
|
1156 CleanupStack::PushL( itemText ); |
|
1157 |
|
1158 itemArray->AppendL( *itemText ); |
|
1159 |
|
1160 CleanupStack::PopAndDestroy( itemText ); |
|
1161 } |
|
1162 |
|
1163 delete listContainer; |
|
1164 listContainer = NULL; |
|
1165 |
|
1166 return itemArray; |
|
1167 } |
|
1168 |
|
1169 // --------------------------------------------------------------------------- |
|
1170 // CMSAppWizard::CreateMultiselectionStoreListItemsLC |
|
1171 // --------------------------------------------------------------------------- |
|
1172 CDesCArrayFlat* CMSAppWizard::CreateMultiselectionStoreListItemsLC() |
|
1173 { |
|
1174 LOG(_L("[MSAppWizard]\t CMSAppWizard:: \ |
|
1175 CreateMultiselectionStoreListItemsLC")); |
|
1176 |
|
1177 CDesCArrayFlat* itemArray = new (ELeave) CDesCArrayFlat( |
|
1178 KFillListGranularity ); |
|
1179 CleanupStack::PushL( itemArray ); |
|
1180 |
|
1181 // Read store lists from engine |
|
1182 CCmStoreRuleContainer* listContainer = iMSEngine->StoreRulesL(); |
|
1183 |
|
1184 for ( TInt index = 0; index < listContainer->StoreRuleCount(); index++ ) |
|
1185 { |
|
1186 CCmStoreRule* rule = listContainer->StoreRule( index ); |
|
1187 HBufC* itemText = CnvUtfConverter::ConvertToUnicodeFromUtf8L( |
|
1188 rule->Name() ); |
|
1189 CleanupStack::PushL( itemText ); |
|
1190 |
|
1191 itemArray->AppendL( *itemText ); |
|
1192 |
|
1193 CleanupStack::PopAndDestroy( itemText ); |
|
1194 } |
|
1195 |
|
1196 delete listContainer; |
|
1197 listContainer = NULL; |
|
1198 |
|
1199 return itemArray; |
|
1200 } |
|
1201 |
|
1202 |
|
1203 // --------------------------------------------------------------------------- |
|
1204 // CMSAppWizard::CreateMultiselectionUIStoreListStringLC |
|
1205 // --------------------------------------------------------------------------- |
|
1206 CDesCArrayFlat* CMSAppWizard::CreateMultiselectionUIStoreListStringLC() |
|
1207 { |
|
1208 LOG(_L("[MSAppWizard]\t CMSAppWizard:: \ |
|
1209 CreateMultiselectionUIStoreListStringLC")); |
|
1210 |
|
1211 CDesCArrayFlat* itemArray = new (ELeave) CDesCArrayFlat( |
|
1212 KStoreListGranularity ); |
|
1213 CleanupStack::PushL( itemArray ); |
|
1214 |
|
1215 HBufC* capturedPic = StringLoader::LoadLC( R_MS_WIZARD_CAPTURED_IMAGES ); |
|
1216 HBufC* otherPic = StringLoader::LoadLC( R_MS_WIZARD_OTHER_IMAGES ); |
|
1217 HBufC* capturedVideo = StringLoader::LoadLC( R_MS_WIZARD_CAPTURED_VIDEOS ); |
|
1218 HBufC* otherVideo = StringLoader::LoadLC( R_MS_WIZARD_OTHER_VIDEOS ); |
|
1219 HBufC* music = StringLoader::LoadLC( R_MS_WIZARD_MUSIC ); |
|
1220 |
|
1221 itemArray->AppendL( *capturedPic ); |
|
1222 itemArray->AppendL( *otherPic ); |
|
1223 itemArray->AppendL( *capturedVideo ); |
|
1224 itemArray->AppendL( *otherVideo ); |
|
1225 itemArray->AppendL( *music ); |
|
1226 |
|
1227 CleanupStack::PopAndDestroy( 5 ); |
|
1228 |
|
1229 return itemArray; |
|
1230 } |
|
1231 |
|
1232 // --------------------------------------------------------------------------- |
|
1233 // CMSAppWizard::CreateServerNameListL |
|
1234 // --------------------------------------------------------------------------- |
|
1235 void CMSAppWizard::CreateServerNameListL( |
|
1236 RPointerArray<CCmMediaServerFull>& aServerArray ) |
|
1237 { |
|
1238 LOG(_L("[MSAppWizard]\t CMSAppWizard::CreateServerNameListL")); |
|
1239 |
|
1240 // reset previous names |
|
1241 iDeviceNameArray->Reset(); |
|
1242 |
|
1243 for ( TInt i = 0; i < aServerArray.Count(); i++ ) |
|
1244 { |
|
1245 CCmMediaServerFull* server = aServerArray[i]; |
|
1246 HBufC* name = CnvUtfConverter::ConvertToUnicodeFromUtf8L( |
|
1247 server->MediaServerName() ); |
|
1248 CleanupStack::PushL( name ); |
|
1249 iDeviceNameArray->AppendL( *name ); |
|
1250 CleanupStack::PopAndDestroy( name ); |
|
1251 } |
|
1252 } |
|
1253 |
|
1254 // End of File |
|