|
1 /* |
|
2 * Copyright (c) 2005-2006 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: Methods for Server Profiles Container |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <aknPopup.h> // popup dialogs |
|
21 #include <StringLoader.h> |
|
22 #include <AknQueryDialog.h> |
|
23 #include <textresolver.h> |
|
24 #include <AknIconArray.h> |
|
25 #include <AknsUtils.h> |
|
26 #include <featmgr.h> |
|
27 |
|
28 #include <AknUtils.h> |
|
29 |
|
30 #include "NSmlDMProfilesContainer.h" |
|
31 #include "NSmlDMProfilesView.h" |
|
32 #include "NSmlDMSyncApp.h" |
|
33 #include "NSmlDMSyncAppEngine.h" |
|
34 #include "NSmlDMSyncUi.hrh" |
|
35 #include "NSmlDMdef.h" |
|
36 #include "NSmlDMSyncDebug.h" |
|
37 #include <NSmlDMSync.rsg> |
|
38 #include <nsmldmsync.mbg> |
|
39 #include <data_caging_path_literals.hrh> |
|
40 |
|
41 |
|
42 #include <csxhelp/dm.hlp.hrh> |
|
43 |
|
44 |
|
45 // ========================== MEMBER FUNCTIONS ================================= |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 // CNSmlDMProfilesContainer::NewL |
|
49 // Two-phased constructor. |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 CNSmlDMProfilesContainer* CNSmlDMProfilesContainer::NewL( CAknView* aView, |
|
53 const TRect& aRect ) |
|
54 { |
|
55 CNSmlDMProfilesContainer* self = new( ELeave ) CNSmlDMProfilesContainer( aView ); |
|
56 |
|
57 CleanupStack::PushL( self ); |
|
58 self->SetMopParent( (MObjectProvider*) aView ); |
|
59 self->ConstructL( aRect ); |
|
60 CleanupStack::Pop(); |
|
61 |
|
62 return self; |
|
63 } |
|
64 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // CNSmlDMProfilesContainer::CNSmlDMProfilesContainer |
|
67 // C++ default constructor can NOT contain any code, that |
|
68 // might leave. |
|
69 // ----------------------------------------------------------------------------- |
|
70 // |
|
71 CNSmlDMProfilesContainer::CNSmlDMProfilesContainer( CAknView* aView ) |
|
72 : iView( aView ) |
|
73 { |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CNSmlDMProfilesContainer::ConstructL |
|
78 // Symbian 2nd phase constructor can leave. |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 void CNSmlDMProfilesContainer::ConstructL( const TRect& aRect ) |
|
82 { |
|
83 CreateWindowL(); |
|
84 |
|
85 iContextMenuUp = EFalse; |
|
86 iAppUi = STATIC_CAST( CNSmlDMSyncAppUi*, iEikonEnv->EikAppUi()); |
|
87 iDocument = STATIC_CAST( CNSmlDMSyncDocument*, iAppUi->Document() ); |
|
88 |
|
89 iProfilesListBox = new ( ELeave ) CAknDoubleLargeStyleListBox; |
|
90 iProfilesListBox->SetContainerWindowL( *this ); |
|
91 iProfilesListBox->ConstructL( this, EAknListBoxSelectionList ); |
|
92 |
|
93 iProfilesListBox->SetListBoxObserver( this ); |
|
94 |
|
95 iProfilesListBox->CreateScrollBarFrameL( ETrue ); |
|
96 iProfilesListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
97 CEikScrollBarFrame::EOff, |
|
98 CEikScrollBarFrame::EAuto ); |
|
99 |
|
100 iDocument->RefreshProfileListL(); |
|
101 AddIconsL(); |
|
102 |
|
103 //Comment this for Moduletests |
|
104 ReadProfileListL(); |
|
105 |
|
106 iProfilesListBox->UpdateScrollBarsL(); |
|
107 iProfilesListBox->ScrollBarFrame()->MoveVertThumbTo( 0 ); |
|
108 |
|
109 SetRect( aRect ); |
|
110 ActivateL(); |
|
111 } |
|
112 |
|
113 // Destructor |
|
114 CNSmlDMProfilesContainer::~CNSmlDMProfilesContainer() |
|
115 { |
|
116 FLOG( "[OMADM] CNSmlDMProfilesContainer::~CNSmlDMProfilesContainer" ); |
|
117 delete iProfilesListBox; |
|
118 } |
|
119 |
|
120 // ----------------------------------------------------------------------------- |
|
121 // CNSmlDMProfilesContainer::SizeChanged |
|
122 // ----------------------------------------------------------------------------- |
|
123 // |
|
124 void CNSmlDMProfilesContainer::SizeChanged() |
|
125 { |
|
126 iProfilesListBox->SetRect( Rect() ); // Mandatory, otherwise not drawn |
|
127 } |
|
128 |
|
129 // ----------------------------------------------------------------------------- |
|
130 // CNSmlDMProfilesContainer::HandleResourceChange |
|
131 // ----------------------------------------------------------------------------- |
|
132 // |
|
133 void CNSmlDMProfilesContainer::HandleResourceChange( TInt aType ) |
|
134 { |
|
135 CCoeControl::HandleResourceChange( aType ); |
|
136 |
|
137 //Handle change in layout orientation |
|
138 if ( aType == KEikDynamicLayoutVariantSwitch || aType == KAknsMessageSkinChange ) |
|
139 { |
|
140 if ( aType == KAknsMessageSkinChange ) |
|
141 { |
|
142 // Skin changed; we'll have to reload the icon array |
|
143 CArrayPtr<CGulIcon>* iconArray = |
|
144 iProfilesListBox->ItemDrawer()->FormattedCellData()->IconArray(); |
|
145 if ( iconArray ) |
|
146 { |
|
147 iconArray->ResetAndDestroy(); |
|
148 delete iconArray; |
|
149 iconArray = NULL; |
|
150 } |
|
151 TRAP_IGNORE( AddIconsL() ); |
|
152 } |
|
153 |
|
154 TRect mainPaneRect; |
|
155 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPaneRect ); |
|
156 SetRect( mainPaneRect ); |
|
157 DrawDeferred(); |
|
158 } |
|
159 } |
|
160 |
|
161 // ----------------------------------------------------------------------------- |
|
162 // CNSmlDMProfilesContainer::CountComponentControls |
|
163 // ----------------------------------------------------------------------------- |
|
164 // |
|
165 TInt CNSmlDMProfilesContainer::CountComponentControls() const |
|
166 { |
|
167 TInt retval( 0 ); |
|
168 if ( iProfilesListBox ) |
|
169 { |
|
170 retval = 1; |
|
171 } |
|
172 return retval; // return nbr of controls inside this container |
|
173 } |
|
174 |
|
175 // ----------------------------------------------------------------------------- |
|
176 // CNSmlDMProfilesContainer::ComponentControl |
|
177 // ----------------------------------------------------------------------------- |
|
178 // |
|
179 CCoeControl* CNSmlDMProfilesContainer::ComponentControl( TInt aIndex ) const |
|
180 { |
|
181 switch ( aIndex ) |
|
182 { |
|
183 case 0: |
|
184 { |
|
185 return iProfilesListBox; |
|
186 } |
|
187 default: |
|
188 { |
|
189 return NULL; |
|
190 } |
|
191 } |
|
192 } |
|
193 |
|
194 // ----------------------------------------------------------------------------- |
|
195 // CNSmlDMProfilesContainer::Draw |
|
196 // ----------------------------------------------------------------------------- |
|
197 // |
|
198 void CNSmlDMProfilesContainer::Draw( const TRect& /* aRect */ ) const |
|
199 { |
|
200 } |
|
201 |
|
202 |
|
203 // ----------------------------------------------------------------------------- |
|
204 // CNSmlDMProfilesContainer::HandleControlEventL |
|
205 // ----------------------------------------------------------------------------- |
|
206 // |
|
207 void CNSmlDMProfilesContainer::HandleControlEventL( CCoeControl* /* aControl */, |
|
208 TCoeEvent /* aEventType */ ) |
|
209 { |
|
210 } |
|
211 |
|
212 // ----------------------------------------------------------------------------- |
|
213 // CNSmlDMProfilesContainer::OfferKeyEventL |
|
214 // ----------------------------------------------------------------------------- |
|
215 // |
|
216 TKeyResponse CNSmlDMProfilesContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
217 TEventCode aType ) |
|
218 { |
|
219 FLOG( "[OMADM] CNSmlDMProfilesContainer::OfferKeyEventL()" ); |
|
220 FTRACE( FPrint( |
|
221 _L("[OMADM]\t CNSmlDMProfilesContainer::OfferKeyEventL>> Begin code = 0x%x"),aKeyEvent.iCode ) ); |
|
222 |
|
223 if ( iProfilesListBox && aType == EEventKey ) |
|
224 { |
|
225 switch ( aKeyEvent.iCode ) |
|
226 { |
|
227 case EStdKeyHome: |
|
228 { |
|
229 // delete only in main view |
|
230 if ( iDocument->ProfileCount() != 0 ) |
|
231 { |
|
232 iAvkonAppUi->HandleCommandL( ENSmlMenuCmdEraseProfile ); |
|
233 } |
|
234 break; |
|
235 } |
|
236 case EKeyEnter: //Enter key |
|
237 case EKeyOK: // OK button |
|
238 { |
|
239 if ( ! iAppUi->Synchronise() ) |
|
240 { |
|
241 if (iSettingsView != EFalse) |
|
242 { |
|
243 return EKeyWasNotConsumed; |
|
244 } |
|
245 else |
|
246 { |
|
247 ShowContextMenuL( R_SMLSYNC_CONTXT_MENUBAR_PROFILES_VIEW ); |
|
248 } |
|
249 } |
|
250 return EKeyWasConsumed; |
|
251 } |
|
252 case EKeyEscape: |
|
253 { |
|
254 if ( (iSettingsView != EFalse) || ( iAppUi->Synchronise() ) ) |
|
255 { |
|
256 return EKeyWasNotConsumed; |
|
257 } |
|
258 else |
|
259 { |
|
260 iAvkonAppUi->ProcessCommandL( EEikCmdExit ); |
|
261 } |
|
262 break; |
|
263 } |
|
264 case EKeyUpArrow: |
|
265 case EKeyDownArrow: |
|
266 { |
|
267 TKeyResponse retVal = |
|
268 iProfilesListBox->OfferKeyEventL( aKeyEvent, aType ); |
|
269 iDocument->SetCurrentIndex( iProfilesListBox->CurrentItemIndex() ); |
|
270 return retVal; |
|
271 } |
|
272 case EKeyLeftArrow: |
|
273 case EKeyRightArrow: |
|
274 { |
|
275 break; // AppUi handles the tab changes |
|
276 } |
|
277 default: |
|
278 { |
|
279 return iProfilesListBox->OfferKeyEventL( aKeyEvent, aType ); |
|
280 } |
|
281 } |
|
282 } |
|
283 FLOG( "[OMADM] CNSmlDMProfilesContainer::OfferKeyEventL() completed, key was not consumed" ); |
|
284 return EKeyWasNotConsumed; |
|
285 } |
|
286 |
|
287 // ----------------------------------------------------------------------------- |
|
288 // CNSmlDMProfilesContainer::PostLayoutDynInitL |
|
289 // ----------------------------------------------------------------------------- |
|
290 // |
|
291 void CNSmlDMProfilesContainer::PostLayoutDynInitL() |
|
292 { |
|
293 FLOG( "[OMADM] CNSmlDMProfilesContainer::PostLayoutDynInitL()" ); |
|
294 |
|
295 iConfirmationNoteUp = EFalse; |
|
296 iMenuUp = 0; |
|
297 |
|
298 if ( iProfilesListBox->Model()->NumberOfItems() == 0 ) |
|
299 { |
|
300 HBufC* emptyText = |
|
301 iEikonEnv->AllocReadResourceLC( R_SML_MAIN_NOPROFILES ); |
|
302 iProfilesListBox->View()->SetListEmptyTextL( emptyText->Des() ); |
|
303 CleanupStack::PopAndDestroy( emptyText ); |
|
304 |
|
305 iConfirmationNoteUp = ETrue; // using flag for preventing the popupmenu |
|
306 // from popping up while dialog is up |
|
307 HBufC* newProfile = |
|
308 iEikonEnv->AllocReadResourceLC( R_SML_APPUI_NOTE_TEXT_NEW ); |
|
309 |
|
310 CAknQueryDialog* startDialog = new (ELeave) CAknQueryDialog(); |
|
311 |
|
312 if ( startDialog->ExecuteLD( R_STARTQUERY_NOTE, newProfile->Des() ) ) |
|
313 { |
|
314 iAppUi->ShowEditProfileDialogL( ESmlNewProfile ); |
|
315 } |
|
316 startDialog = NULL; |
|
317 CleanupStack::PopAndDestroy( newProfile ); |
|
318 iConfirmationNoteUp = EFalse; |
|
319 } |
|
320 else |
|
321 { |
|
322 iDocument->SetCurrentIndex(0); |
|
323 iProfilesListBox->ScrollBarFrame()->MoveVertThumbTo( |
|
324 iProfilesListBox->CurrentItemIndex() ); |
|
325 } |
|
326 |
|
327 FLOG( "[OMADM] CNSmlDMProfilesContainer::PostLayoutDynInitL() completed" ); |
|
328 } |
|
329 |
|
330 // ----------------------------------------------------------------------------- |
|
331 // CNSmlDMProfilesContainer::PreLayoutDynInitL |
|
332 // ----------------------------------------------------------------------------- |
|
333 // |
|
334 void CNSmlDMProfilesContainer::PreLayoutDynInitL() |
|
335 { |
|
336 FLOG( "[OMADM] CNSmlDMProfilesContainer::PreLayoutDynInitL" ); |
|
337 |
|
338 } |
|
339 |
|
340 // ----------------------------------------------------------------------------- |
|
341 // CNSmlDMProfilesContainer::HandleListBoxEventL |
|
342 // ----------------------------------------------------------------------------- |
|
343 // |
|
344 void CNSmlDMProfilesContainer::HandleListBoxEventL( CEikListBox* aListBox, |
|
345 TListBoxEvent aEventType ) |
|
346 { |
|
347 FLOG( "[OMADM] CNSmlDMProfilesContainer::HandleListBoxEventL()" ); |
|
348 iProfilesListBox->SetCurrentItemIndexAndDraw( aListBox->CurrentItemIndex() ); |
|
349 iDocument->SetCurrentIndex( aListBox->CurrentItemIndex() ); |
|
350 if ( aEventType == MEikListBoxObserver::EEventItemSingleClicked ) |
|
351 { |
|
352 ShowContextMenuL( R_SMLSYNC_CONTXT_MENUBAR_PROFILES_VIEW ); |
|
353 } |
|
354 FLOG( "[OMADM] CNSmlDMProfilesContainer::HandleListBoxEventL() completed" ); |
|
355 } |
|
356 |
|
357 // ----------------------------------------------------------------------------- |
|
358 // CNSmlDMProfilesContainer::ShowContextMenuL |
|
359 // ----------------------------------------------------------------------------- |
|
360 // |
|
361 void CNSmlDMProfilesContainer::ShowContextMenuL( TInt aResource ) |
|
362 { |
|
363 FLOG( "[OMADM] CNSmlDMProfilesContainer::ShowContextMenuL()" ); |
|
364 // Switch to Context specific options menu, |
|
365 // Show it and switch back to main options menu. |
|
366 CEikMenuBar* menuBar = iView->MenuBar(); |
|
367 menuBar->SetMenuTitleResourceId( aResource ); |
|
368 menuBar->SetMenuType( CEikMenuBar::EMenuContext ); |
|
369 // TRAP displaying of menu bar. |
|
370 // If it fails, the correct resource is set back before leave. |
|
371 TRAPD( err, menuBar->TryDisplayMenuBarL() ); |
|
372 menuBar->SetMenuTitleResourceId( R_SMLSYNC_MENUBAR_PROFILES_VIEW ); |
|
373 menuBar->SetMenuType( CEikMenuBar::EMenuOptions ); |
|
374 User::LeaveIfError( err ); |
|
375 FLOG( "[OMADM] CNSmlDMProfilesContainer::ShowContextMenuL() completed" ); |
|
376 } |
|
377 |
|
378 |
|
379 // ----------------------------------------------------------------------------- |
|
380 // CNSmlDMProfilesContainer::ReadProfileListL |
|
381 // ----------------------------------------------------------------------------- |
|
382 // |
|
383 void CNSmlDMProfilesContainer::ReadProfileListL() |
|
384 { |
|
385 FLOG( "[OMADM] CNSmlDMProfilesContainer::ReadProfileListL()" ); |
|
386 |
|
387 TInt index = 0; |
|
388 TInt lockindex = 0; |
|
389 iDocument->RefreshProfileListL(); |
|
390 CArrayFixFlat<TNSmlDMProfileItem> *profileList = |
|
391 iDocument->ProfileList( index ); |
|
392 CDesCArray* items = (CDesCArray*) iProfilesListBox->Model()->ItemTextArray(); |
|
393 |
|
394 items->Reset(); |
|
395 |
|
396 TBuf<KNSmlMaxTextLength256> text; |
|
397 TBuf<KNSmlMaxTextLength64> timeString; |
|
398 TBuf<KNSmlMaxTextLength64> dateString; |
|
399 TBuf<5> indexBuf; |
|
400 |
|
401 HBufC* timeFormatted; |
|
402 |
|
403 TBool settingEnforcement = TUtil::SettingEnforcementState(); |
|
404 TBool btObex = FeatureManager::FeatureSupported(KFeatureIdSyncMlDmObex); |
|
405 |
|
406 for ( TInt i = 0; i < profileList->Count(); i++ ) |
|
407 { |
|
408 text.Zero(); |
|
409 TInt index( EProfileInternet ); //internet |
|
410 |
|
411 if ( ( *profileList )[i].iBearer != EProfileInternet ) |
|
412 { |
|
413 // EProfileObexBlueTooth is defined to 1, but that index has |
|
414 // the HTTP "off" icon. Looking at AddIconsL, BlueTooth icons |
|
415 // should be 2 and 3, if present. |
|
416 //index = EProfileObexBlueTooth; |
|
417 index = EProfileObexBlueTooth + 1; |
|
418 } |
|
419 if ( ( *profileList )[i].iActive == 0 ) |
|
420 { |
|
421 index++; |
|
422 } |
|
423 |
|
424 if (settingEnforcement ||( *profileList )[i].iProfileLocked ) |
|
425 { |
|
426 // Locked setting item icon |
|
427 lockindex = 2; |
|
428 if (btObex) |
|
429 { |
|
430 // BlueTooth icons are present |
|
431 lockindex = 4; |
|
432 } |
|
433 } |
|
434 |
|
435 indexBuf.Num( index ); |
|
436 text.Append ( KNSmlTab ); |
|
437 text.Append ( ( *profileList )[i].iProfileName ); |
|
438 text.Append ( KNSmlTab ); |
|
439 if ( ( *profileList )[i].iSynced ) // profile has been synchronised |
|
440 { |
|
441 timeFormatted = TUtil::SyncTimeLC( ( *profileList )[i].iLastSuccessSync ); |
|
442 } |
|
443 else |
|
444 { |
|
445 timeFormatted = |
|
446 iEikonEnv->AllocReadResourceLC( R_SML_MAIN_NOTSYNCED ); |
|
447 } |
|
448 timeString.Append( timeFormatted->Des() ); |
|
449 |
|
450 text.Append ( timeString ); |
|
451 timeString.Zero(); |
|
452 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( text ); |
|
453 text.Insert( 0, indexBuf ); |
|
454 if ( settingEnforcement || ( *profileList )[i].iProfileLocked) |
|
455 { |
|
456 indexBuf.Num( lockindex ); |
|
457 text.Append ( KNSmlTab ); |
|
458 text.Insert( text.Length(), indexBuf ); |
|
459 } |
|
460 items->AppendL ( text ); |
|
461 CleanupStack::PopAndDestroy( timeFormatted ); |
|
462 } |
|
463 |
|
464 iProfilesListBox->HandleItemAdditionL(); |
|
465 |
|
466 if ( iProfilesListBox->Model()->NumberOfItems() == 0 ) |
|
467 { |
|
468 //For Main pane primary text |
|
469 HBufC* emptyPrimText = |
|
470 iEikonEnv->AllocReadResourceLC( R_SML_MAIN_NOPROFILES ); |
|
471 //For Main pane secondary text |
|
472 HBufC* emptySecText = |
|
473 iEikonEnv->AllocReadResourceLC( R_SML_MAIN_NOPROFILES_SEC_TXT ); |
|
474 HBufC* emptyText = HBufC::NewLC( emptyPrimText->Length() + emptySecText->Length()+ 2 ); |
|
475 emptyText->Des().Append( emptyPrimText->Des() ); |
|
476 emptyText->Des().Append( KSmlEOL ); |
|
477 emptyText->Des().Append( emptySecText->Des() ); |
|
478 iProfilesListBox->View()->SetListEmptyTextL( emptyText->Des() ); |
|
479 CleanupStack::PopAndDestroy( emptyText ); |
|
480 CleanupStack::PopAndDestroy( emptySecText ); |
|
481 CleanupStack::PopAndDestroy( emptyPrimText ); |
|
482 } |
|
483 |
|
484 FTRACE( FPrint( |
|
485 _L("[OMADM] CNSmlDMProfilesContainer::ReadProfileListL() completed, profile count = %d"), |
|
486 profileList->Count() ) ); |
|
487 } |
|
488 |
|
489 // ----------------------------------------------------------------------------- |
|
490 // CNSmlDMProfilesContainer::RefreshL |
|
491 // ----------------------------------------------------------------------------- |
|
492 // |
|
493 void CNSmlDMProfilesContainer::RefreshL() |
|
494 { |
|
495 ReadProfileListL(); |
|
496 //SetCurrentIndex( iProfilesListBox->CurrentItemIndex() ); |
|
497 SetCurrentIndex( iDocument->CurrentIndex() ); |
|
498 } |
|
499 |
|
500 // ----------------------------------------------------------------------------- |
|
501 // CNSmlDMProfilesContainer::SetCurrentIndex |
|
502 // ----------------------------------------------------------------------------- |
|
503 // |
|
504 void CNSmlDMProfilesContainer::SetCurrentIndex( const TInt aIndex ) |
|
505 { |
|
506 FTRACE( FPrint( |
|
507 _L("[OMADM] CNSmlDMProfilesContainer::SetCurrentIndex() aIndex = %d"), |
|
508 aIndex ) ); |
|
509 |
|
510 TInt newIndex( aIndex ); |
|
511 |
|
512 if ( iProfilesListBox->Model()->NumberOfItems() > 0 ) |
|
513 { |
|
514 if ( newIndex < 0 ) |
|
515 { |
|
516 newIndex = 0; |
|
517 } |
|
518 if ( newIndex > ( iProfilesListBox->Model()->NumberOfItems() - 1 ) ) |
|
519 { |
|
520 newIndex = iProfilesListBox->Model()->NumberOfItems() - 1; |
|
521 iDocument->SetCurrentIndex(newIndex); |
|
522 } |
|
523 iProfilesListBox->SetCurrentItemIndexAndDraw( newIndex ); |
|
524 } |
|
525 |
|
526 FLOG( "[OMADM] CNSmlDMProfilesContainer::SetCurrentIndex() completed" ); |
|
527 } |
|
528 |
|
529 // ----------------------------------------------------------------------------- |
|
530 // CNSmlDMProfilesContainer::ClosePopupMenu |
|
531 // ----------------------------------------------------------------------------- |
|
532 // |
|
533 void CNSmlDMProfilesContainer::ClosePopupMenuL() |
|
534 { |
|
535 FLOG( "[OMADM] CNSmlDMProfilesContainer::ClosePopupMenu" ); |
|
536 |
|
537 if (iContextMenuUp) |
|
538 { |
|
539 iAppUi->SetFadedL( EFalse ); |
|
540 |
|
541 CEikButtonGroupContainer* controlPane = |
|
542 CEikButtonGroupContainer::Current(); |
|
543 controlPane->AddCommandSetToStackL( |
|
544 R_NSML_FOTA_PROFILES_VIEW_MSK_OPTIONS_EXIT_CONTEXTOPTIONS ); |
|
545 controlPane->DrawNow(); |
|
546 iEikonEnv->AppUiFactory()->ClosePopup( iEikonEnv->EikAppUi() ); |
|
547 iContextMenuUp = EFalse; |
|
548 } |
|
549 } |
|
550 |
|
551 |
|
552 // ----------------------------------------------------------------------------- |
|
553 // CNSmlDMProfilesContainer::GetHelpContext |
|
554 // ----------------------------------------------------------------------------- |
|
555 // |
|
556 void CNSmlDMProfilesContainer::GetHelpContext( TCoeHelpContext& aContext ) const |
|
557 { |
|
558 FLOG( "[OMADM] CNSmlDMProfilesContainer::GetHelpContext" ); |
|
559 |
|
560 aContext.iMajor = KUidSmlSyncApp; |
|
561 aContext.iContext = KDM_HLP_SERVERS_VIEW; |
|
562 } |
|
563 |
|
564 |
|
565 |
|
566 // ----------------------------------------------------------------------------- |
|
567 // CNSmlDMProfilesContainer::FocusChanged |
|
568 // ----------------------------------------------------------------------------- |
|
569 // |
|
570 void CNSmlDMProfilesContainer::FocusChanged( TDrawNow /*aDrawNow*/ ) |
|
571 { |
|
572 if ( iProfilesListBox ) |
|
573 { |
|
574 iProfilesListBox->SetFocus( IsFocused() ); |
|
575 } |
|
576 } |
|
577 |
|
578 // ----------------------------------------------------------------------------- |
|
579 // CNSmlDMProfilesContainer::AddIconsL |
|
580 // ----------------------------------------------------------------------------- |
|
581 // |
|
582 void CNSmlDMProfilesContainer::AddIconsL() |
|
583 { |
|
584 FLOG( "[OMADM] CNSmlDMSyncMainDialog::AddIconsL" ); |
|
585 |
|
586 HBufC* appIconFilePath = HBufC::NewLC( 5 + KDC_APP_BITMAP_DIR().Length() |
|
587 + KDMAppIconFileName().Length() ); |
|
588 TPtr ptr = appIconFilePath->Des(); |
|
589 ptr.Append( KZDrive ); |
|
590 ptr.Append( KDC_APP_BITMAP_DIR ); |
|
591 ptr.Append( KDMAppIconFileName ); |
|
592 |
|
593 CArrayPtr<CGulIcon>* icons = new (ELeave) CArrayPtrFlat<CGulIcon>(10); |
|
594 iProfilesListBox->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons ); |
|
595 |
|
596 icons->AppendL( AknsUtils::CreateGulIconL( |
|
597 AknsUtils::SkinInstance(), |
|
598 KAknsIIDQgnPropSmlHttp, |
|
599 *appIconFilePath, |
|
600 EMbmNsmldmsyncQgn_prop_sml_http, |
|
601 EMbmNsmldmsyncQgn_prop_sml_http_mask ) ); |
|
602 |
|
603 icons->AppendL( AknsUtils::CreateGulIconL( |
|
604 AknsUtils::SkinInstance(), |
|
605 KAknsIIDQgnPropSmlHttpOff, |
|
606 *appIconFilePath, |
|
607 EMbmNsmldmsyncQgn_prop_sml_http_off, |
|
608 EMbmNsmldmsyncQgn_prop_sml_http_off_mask ) ); |
|
609 |
|
610 if ( FeatureManager::FeatureSupported( KFeatureIdSyncMlDmObex ) ) |
|
611 { |
|
612 icons->AppendL( AknsUtils::CreateGulIconL( |
|
613 AknsUtils::SkinInstance(), |
|
614 KAknsIIDQgnPropSmlBt, |
|
615 *appIconFilePath, |
|
616 EMbmNsmldmsyncQgn_prop_sml_bt, |
|
617 EMbmNsmldmsyncQgn_prop_sml_bt_mask ) ); |
|
618 |
|
619 icons->AppendL( AknsUtils::CreateGulIconL( |
|
620 AknsUtils::SkinInstance(), |
|
621 KAknsIIDQgnPropSmlBtOff, |
|
622 *appIconFilePath, |
|
623 EMbmNsmldmsyncQgn_prop_sml_bt_off, |
|
624 EMbmNsmldmsyncQgn_prop_sml_bt_off_mask ) ); |
|
625 } |
|
626 |
|
627 icons->AppendL( AknsUtils::CreateGulIconL( |
|
628 AknsUtils::SkinInstance(), |
|
629 KAknsIIDQgnIndiSettProtectedAdd, |
|
630 *appIconFilePath, |
|
631 EMbmNsmldmsyncQgn_indi_sett_protected_add, |
|
632 EMbmNsmldmsyncQgn_indi_sett_protected_add_mask ) ); |
|
633 |
|
634 CleanupStack::PopAndDestroy( appIconFilePath ); |
|
635 |
|
636 FLOG( "[OMADM] CNSmlDMSyncMainDialog::AddIconsL Done" ); |
|
637 } |
|
638 |
|
639 void CNSmlDMProfilesContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
640 { |
|
641 if ( AknLayoutUtils::PenEnabled() ) |
|
642 { |
|
643 if (iProfilesListBox->Model()->NumberOfItems() == 0 ) |
|
644 { |
|
645 if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
|
646 { |
|
647 if ( iContextMenuUp ) |
|
648 { |
|
649 // Absorb EButton1Up event if we already launched the stylus |
|
650 // popup menu |
|
651 iContextMenuUp = EFalse; |
|
652 } |
|
653 else |
|
654 { |
|
655 ShowContextMenuL( R_SMLSYNC_CONTXT_MENUBAR_PROFILES_VIEW ); |
|
656 } |
|
657 |
|
658 } |
|
659 else |
|
660 CCoeControl::HandlePointerEventL(aPointerEvent); |
|
661 } |
|
662 else |
|
663 CCoeControl::HandlePointerEventL(aPointerEvent); |
|
664 } |
|
665 } |
|
666 // End of File |