25
|
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 |
iDocument->SetCurrentIndex( aListBox->CurrentItemIndex() );
|
|
349 |
if ( aEventType == MEikListBoxObserver::EEventItemSingleClicked )
|
|
350 |
{
|
|
351 |
ShowContextMenuL( R_SMLSYNC_CONTXT_MENUBAR_PROFILES_VIEW );
|
|
352 |
}
|
|
353 |
FLOG( "[OMADM] CNSmlDMProfilesContainer::HandleListBoxEventL() completed" );
|
|
354 |
}
|
|
355 |
|
|
356 |
// -----------------------------------------------------------------------------
|
|
357 |
// CNSmlDMProfilesContainer::ShowContextMenuL
|
|
358 |
// -----------------------------------------------------------------------------
|
|
359 |
//
|
|
360 |
void CNSmlDMProfilesContainer::ShowContextMenuL( TInt aResource )
|
|
361 |
{
|
|
362 |
FLOG( "[OMADM] CNSmlDMProfilesContainer::ShowContextMenuL()" );
|
|
363 |
// Switch to Context specific options menu,
|
|
364 |
// Show it and switch back to main options menu.
|
|
365 |
CEikMenuBar* menuBar = iView->MenuBar();
|
|
366 |
menuBar->SetMenuTitleResourceId( aResource );
|
|
367 |
menuBar->SetMenuType( CEikMenuBar::EMenuContext );
|
|
368 |
// TRAP displaying of menu bar.
|
|
369 |
// If it fails, the correct resource is set back before leave.
|
|
370 |
TRAPD( err, menuBar->TryDisplayMenuBarL() );
|
|
371 |
menuBar->SetMenuTitleResourceId( R_SMLSYNC_MENUBAR_PROFILES_VIEW );
|
|
372 |
menuBar->SetMenuType( CEikMenuBar::EMenuOptions );
|
|
373 |
User::LeaveIfError( err );
|
|
374 |
FLOG( "[OMADM] CNSmlDMProfilesContainer::ShowContextMenuL() completed" );
|
|
375 |
}
|
|
376 |
|
|
377 |
|
|
378 |
// -----------------------------------------------------------------------------
|
|
379 |
// CNSmlDMProfilesContainer::ReadProfileListL
|
|
380 |
// -----------------------------------------------------------------------------
|
|
381 |
//
|
|
382 |
void CNSmlDMProfilesContainer::ReadProfileListL()
|
|
383 |
{
|
|
384 |
FLOG( "[OMADM] CNSmlDMProfilesContainer::ReadProfileListL()" );
|
|
385 |
|
|
386 |
TInt index = 0;
|
|
387 |
TInt lockindex = 0;
|
|
388 |
iDocument->RefreshProfileListL();
|
|
389 |
CArrayFixFlat<TNSmlDMProfileItem> *profileList =
|
|
390 |
iDocument->ProfileList( index );
|
|
391 |
CDesCArray* items = (CDesCArray*) iProfilesListBox->Model()->ItemTextArray();
|
|
392 |
|
|
393 |
items->Reset();
|
|
394 |
|
|
395 |
TBuf<KNSmlMaxTextLength256> text;
|
|
396 |
TBuf<KNSmlMaxTextLength64> timeString;
|
|
397 |
TBuf<KNSmlMaxTextLength64> dateString;
|
|
398 |
TBuf<5> indexBuf;
|
|
399 |
|
|
400 |
HBufC* timeFormatted;
|
|
401 |
|
|
402 |
TBool settingEnforcement = TUtil::SettingEnforcementState();
|
|
403 |
TBool btObex = FeatureManager::FeatureSupported(KFeatureIdSyncMlDmObex);
|
|
404 |
|
|
405 |
for ( TInt i = 0; i < profileList->Count(); i++ )
|
|
406 |
{
|
|
407 |
text.Zero();
|
|
408 |
TInt index( EProfileInternet ); //internet
|
|
409 |
|
|
410 |
if ( ( *profileList )[i].iBearer != EProfileInternet )
|
|
411 |
{
|
|
412 |
// EProfileObexBlueTooth is defined to 1, but that index has
|
|
413 |
// the HTTP "off" icon. Looking at AddIconsL, BlueTooth icons
|
|
414 |
// should be 2 and 3, if present.
|
|
415 |
//index = EProfileObexBlueTooth;
|
|
416 |
index = EProfileObexBlueTooth + 1;
|
|
417 |
}
|
|
418 |
if ( ( *profileList )[i].iActive == 0 )
|
|
419 |
{
|
|
420 |
index++;
|
|
421 |
}
|
|
422 |
|
|
423 |
if (settingEnforcement ||( *profileList )[i].iProfileLocked )
|
|
424 |
{
|
|
425 |
// Locked setting item icon
|
|
426 |
lockindex = 2;
|
|
427 |
if (btObex)
|
|
428 |
{
|
|
429 |
// BlueTooth icons are present
|
|
430 |
lockindex = 4;
|
|
431 |
}
|
|
432 |
}
|
|
433 |
|
|
434 |
indexBuf.Num( index );
|
|
435 |
text.Append ( KNSmlTab );
|
|
436 |
text.Append ( ( *profileList )[i].iProfileName );
|
|
437 |
text.Append ( KNSmlTab );
|
|
438 |
if ( ( *profileList )[i].iSynced ) // profile has been synchronised
|
|
439 |
{
|
|
440 |
timeFormatted = TUtil::SyncTimeLC( ( *profileList )[i].iLastSuccessSync );
|
|
441 |
}
|
|
442 |
else
|
|
443 |
{
|
|
444 |
timeFormatted =
|
|
445 |
iEikonEnv->AllocReadResourceLC( R_SML_MAIN_NOTSYNCED );
|
|
446 |
}
|
|
447 |
timeString.Append( timeFormatted->Des() );
|
|
448 |
|
|
449 |
text.Append ( timeString );
|
|
450 |
timeString.Zero();
|
|
451 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion( text );
|
|
452 |
text.Insert( 0, indexBuf );
|
|
453 |
if ( settingEnforcement || ( *profileList )[i].iProfileLocked)
|
|
454 |
{
|
|
455 |
indexBuf.Num( lockindex );
|
|
456 |
text.Append ( KNSmlTab );
|
|
457 |
text.Insert( text.Length(), indexBuf );
|
|
458 |
}
|
|
459 |
items->AppendL ( text );
|
|
460 |
CleanupStack::PopAndDestroy( timeFormatted );
|
|
461 |
}
|
|
462 |
|
|
463 |
iProfilesListBox->HandleItemAdditionL();
|
|
464 |
|
|
465 |
if ( iProfilesListBox->Model()->NumberOfItems() == 0 )
|
|
466 |
{
|
|
467 |
//For Main pane primary text
|
|
468 |
HBufC* emptyPrimText =
|
|
469 |
iEikonEnv->AllocReadResourceLC( R_SML_MAIN_NOPROFILES );
|
|
470 |
//For Main pane secondary text
|
|
471 |
HBufC* emptySecText =
|
|
472 |
iEikonEnv->AllocReadResourceLC( R_SML_MAIN_NOPROFILES_SEC_TXT );
|
|
473 |
HBufC* emptyText = HBufC::NewLC( emptyPrimText->Length() + emptySecText->Length()+ 2 );
|
|
474 |
emptyText->Des().Append( emptyPrimText->Des() );
|
|
475 |
emptyText->Des().Append( KSmlEOL );
|
|
476 |
emptyText->Des().Append( emptySecText->Des() );
|
|
477 |
iProfilesListBox->View()->SetListEmptyTextL( emptyText->Des() );
|
|
478 |
CleanupStack::PopAndDestroy( emptyText );
|
|
479 |
CleanupStack::PopAndDestroy( emptySecText );
|
|
480 |
CleanupStack::PopAndDestroy( emptyPrimText );
|
|
481 |
}
|
|
482 |
|
|
483 |
FTRACE( FPrint(
|
|
484 |
_L("[OMADM] CNSmlDMProfilesContainer::ReadProfileListL() completed, profile count = %d"),
|
|
485 |
profileList->Count() ) );
|
|
486 |
}
|
|
487 |
|
|
488 |
// -----------------------------------------------------------------------------
|
|
489 |
// CNSmlDMProfilesContainer::RefreshL
|
|
490 |
// -----------------------------------------------------------------------------
|
|
491 |
//
|
|
492 |
void CNSmlDMProfilesContainer::RefreshL()
|
|
493 |
{
|
|
494 |
ReadProfileListL();
|
|
495 |
//SetCurrentIndex( iProfilesListBox->CurrentItemIndex() );
|
|
496 |
SetCurrentIndex( iDocument->CurrentIndex() );
|
|
497 |
}
|
|
498 |
|
|
499 |
// -----------------------------------------------------------------------------
|
|
500 |
// CNSmlDMProfilesContainer::SetCurrentIndex
|
|
501 |
// -----------------------------------------------------------------------------
|
|
502 |
//
|
|
503 |
void CNSmlDMProfilesContainer::SetCurrentIndex( const TInt aIndex )
|
|
504 |
{
|
|
505 |
FTRACE( FPrint(
|
|
506 |
_L("[OMADM] CNSmlDMProfilesContainer::SetCurrentIndex() aIndex = %d"),
|
|
507 |
aIndex ) );
|
|
508 |
|
|
509 |
TInt newIndex( aIndex );
|
|
510 |
|
|
511 |
if ( iProfilesListBox->Model()->NumberOfItems() > 0 )
|
|
512 |
{
|
|
513 |
if ( newIndex < 0 )
|
|
514 |
{
|
|
515 |
newIndex = 0;
|
|
516 |
}
|
|
517 |
if ( newIndex > ( iProfilesListBox->Model()->NumberOfItems() - 1 ) )
|
|
518 |
{
|
|
519 |
newIndex = iProfilesListBox->Model()->NumberOfItems() - 1;
|
|
520 |
iDocument->SetCurrentIndex(newIndex);
|
|
521 |
}
|
|
522 |
iProfilesListBox->SetCurrentItemIndexAndDraw( newIndex );
|
|
523 |
}
|
|
524 |
|
|
525 |
FLOG( "[OMADM] CNSmlDMProfilesContainer::SetCurrentIndex() completed" );
|
|
526 |
}
|
|
527 |
|
|
528 |
// -----------------------------------------------------------------------------
|
|
529 |
// CNSmlDMProfilesContainer::ClosePopupMenu
|
|
530 |
// -----------------------------------------------------------------------------
|
|
531 |
//
|
|
532 |
void CNSmlDMProfilesContainer::ClosePopupMenuL()
|
|
533 |
{
|
|
534 |
FLOG( "[OMADM] CNSmlDMProfilesContainer::ClosePopupMenu" );
|
|
535 |
|
|
536 |
if (iContextMenuUp)
|
|
537 |
{
|
|
538 |
iAppUi->SetFadedL( EFalse );
|
|
539 |
|
|
540 |
CEikButtonGroupContainer* controlPane =
|
|
541 |
CEikButtonGroupContainer::Current();
|
|
542 |
controlPane->AddCommandSetToStackL(
|
|
543 |
R_NSML_FOTA_PROFILES_VIEW_MSK_OPTIONS_EXIT_CONTEXTOPTIONS );
|
|
544 |
controlPane->DrawNow();
|
|
545 |
iEikonEnv->AppUiFactory()->ClosePopup( iEikonEnv->EikAppUi() );
|
|
546 |
iContextMenuUp = EFalse;
|
|
547 |
}
|
|
548 |
}
|
|
549 |
|
|
550 |
|
|
551 |
// -----------------------------------------------------------------------------
|
|
552 |
// CNSmlDMProfilesContainer::GetHelpContext
|
|
553 |
// -----------------------------------------------------------------------------
|
|
554 |
//
|
|
555 |
void CNSmlDMProfilesContainer::GetHelpContext( TCoeHelpContext& aContext ) const
|
|
556 |
{
|
|
557 |
FLOG( "[OMADM] CNSmlDMProfilesContainer::GetHelpContext" );
|
|
558 |
|
|
559 |
aContext.iMajor = KUidSmlSyncApp;
|
|
560 |
aContext.iContext = KDM_HLP_SERVERS_VIEW;
|
|
561 |
}
|
|
562 |
|
|
563 |
|
|
564 |
|
|
565 |
// -----------------------------------------------------------------------------
|
|
566 |
// CNSmlDMProfilesContainer::FocusChanged
|
|
567 |
// -----------------------------------------------------------------------------
|
|
568 |
//
|
|
569 |
void CNSmlDMProfilesContainer::FocusChanged( TDrawNow /*aDrawNow*/ )
|
|
570 |
{
|
|
571 |
if ( iProfilesListBox )
|
|
572 |
{
|
|
573 |
iProfilesListBox->SetFocus( IsFocused() );
|
|
574 |
}
|
|
575 |
}
|
|
576 |
|
|
577 |
// -----------------------------------------------------------------------------
|
|
578 |
// CNSmlDMProfilesContainer::AddIconsL
|
|
579 |
// -----------------------------------------------------------------------------
|
|
580 |
//
|
|
581 |
void CNSmlDMProfilesContainer::AddIconsL()
|
|
582 |
{
|
|
583 |
FLOG( "[OMADM] CNSmlDMSyncMainDialog::AddIconsL" );
|
|
584 |
|
|
585 |
HBufC* appIconFilePath = HBufC::NewLC( 5 + KDC_APP_BITMAP_DIR().Length()
|
|
586 |
+ KDMAppIconFileName().Length() );
|
|
587 |
TPtr ptr = appIconFilePath->Des();
|
|
588 |
ptr.Append( KZDrive );
|
|
589 |
ptr.Append( KDC_APP_BITMAP_DIR );
|
|
590 |
ptr.Append( KDMAppIconFileName );
|
|
591 |
|
|
592 |
CArrayPtr<CGulIcon>* icons = new (ELeave) CArrayPtrFlat<CGulIcon>(10);
|
|
593 |
iProfilesListBox->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons );
|
|
594 |
|
|
595 |
icons->AppendL( AknsUtils::CreateGulIconL(
|
|
596 |
AknsUtils::SkinInstance(),
|
|
597 |
KAknsIIDQgnPropSmlHttp,
|
|
598 |
*appIconFilePath,
|
|
599 |
EMbmNsmldmsyncQgn_prop_sml_http,
|
|
600 |
EMbmNsmldmsyncQgn_prop_sml_http_mask ) );
|
|
601 |
|
|
602 |
icons->AppendL( AknsUtils::CreateGulIconL(
|
|
603 |
AknsUtils::SkinInstance(),
|
|
604 |
KAknsIIDQgnPropSmlHttpOff,
|
|
605 |
*appIconFilePath,
|
|
606 |
EMbmNsmldmsyncQgn_prop_sml_http_off,
|
|
607 |
EMbmNsmldmsyncQgn_prop_sml_http_off_mask ) );
|
|
608 |
|
|
609 |
if ( FeatureManager::FeatureSupported( KFeatureIdSyncMlDmObex ) )
|
|
610 |
{
|
|
611 |
icons->AppendL( AknsUtils::CreateGulIconL(
|
|
612 |
AknsUtils::SkinInstance(),
|
|
613 |
KAknsIIDQgnPropSmlBt,
|
|
614 |
*appIconFilePath,
|
|
615 |
EMbmNsmldmsyncQgn_prop_sml_bt,
|
|
616 |
EMbmNsmldmsyncQgn_prop_sml_bt_mask ) );
|
|
617 |
|
|
618 |
icons->AppendL( AknsUtils::CreateGulIconL(
|
|
619 |
AknsUtils::SkinInstance(),
|
|
620 |
KAknsIIDQgnPropSmlBtOff,
|
|
621 |
*appIconFilePath,
|
|
622 |
EMbmNsmldmsyncQgn_prop_sml_bt_off,
|
|
623 |
EMbmNsmldmsyncQgn_prop_sml_bt_off_mask ) );
|
|
624 |
}
|
|
625 |
|
|
626 |
icons->AppendL( AknsUtils::CreateGulIconL(
|
|
627 |
AknsUtils::SkinInstance(),
|
|
628 |
KAknsIIDQgnIndiSettProtectedAdd,
|
|
629 |
*appIconFilePath,
|
|
630 |
EMbmNsmldmsyncQgn_indi_sett_protected_add,
|
|
631 |
EMbmNsmldmsyncQgn_indi_sett_protected_add_mask ) );
|
|
632 |
|
|
633 |
CleanupStack::PopAndDestroy( appIconFilePath );
|
|
634 |
|
|
635 |
FLOG( "[OMADM] CNSmlDMSyncMainDialog::AddIconsL Done" );
|
|
636 |
}
|
|
637 |
|
|
638 |
void CNSmlDMProfilesContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent)
|
|
639 |
{
|
|
640 |
if ( AknLayoutUtils::PenEnabled() )
|
|
641 |
{
|
|
642 |
if (iProfilesListBox->Model()->NumberOfItems() == 0 )
|
|
643 |
{
|
|
644 |
if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
|
|
645 |
{
|
|
646 |
if ( iContextMenuUp )
|
|
647 |
{
|
|
648 |
// Absorb EButton1Up event if we already launched the stylus
|
|
649 |
// popup menu
|
|
650 |
iContextMenuUp = EFalse;
|
|
651 |
}
|
|
652 |
else
|
|
653 |
{
|
|
654 |
ShowContextMenuL( R_SMLSYNC_CONTXT_MENUBAR_PROFILES_VIEW );
|
|
655 |
}
|
|
656 |
|
|
657 |
}
|
|
658 |
else
|
|
659 |
CCoeControl::HandlePointerEventL(aPointerEvent);
|
|
660 |
}
|
|
661 |
else
|
|
662 |
CCoeControl::HandlePointerEventL(aPointerEvent);
|
|
663 |
}
|
|
664 |
}
|
|
665 |
// End of File
|