1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: List class for Usage Reporting checkbox |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "drmsettingsusagelist.h" |
|
21 #include "drmsettingsmodel.h" |
|
22 |
|
23 // CONSTANTS |
|
24 const TInt KDRMSettingsListGranularity( 5 ); |
|
25 |
|
26 // ================= MEMBER FUNCTIONS ======================= |
|
27 |
|
28 // ---------------------------------------------------------------------------- |
|
29 // CDRMSettingUsageList::NewL |
|
30 // Two-phased constructor. |
|
31 // ---------------------------------------------------------------------------- |
|
32 // |
|
33 CDRMSettingUsageList* CDRMSettingUsageList::NewL( |
|
34 CDRMSettingsModel* aModel ) |
|
35 { |
|
36 CDRMSettingUsageList* self( |
|
37 new( ELeave ) CDRMSettingUsageList( aModel ) ); |
|
38 CleanupStack::PushL( self ); |
|
39 self->ConstructL(); |
|
40 CleanupStack::Pop( self ); |
|
41 return self; |
|
42 } |
|
43 |
|
44 // ---------------------------------------------------------------------------- |
|
45 // CDRMSettingUsageList::CDRMSettingUsageList |
|
46 // Default constructor. |
|
47 // ---------------------------------------------------------------------------- |
|
48 // |
|
49 CDRMSettingUsageList::CDRMSettingUsageList( CDRMSettingsModel* aModel ) |
|
50 : CSelectionItemList( KDRMSettingsListGranularity ), iModel( aModel ) |
|
51 { |
|
52 } |
|
53 |
|
54 // ---------------------------------------------------------------------------- |
|
55 // CDRMSettingUsageList::ConstructL |
|
56 // ---------------------------------------------------------------------------- |
|
57 // |
|
58 void CDRMSettingUsageList::ConstructL() |
|
59 { |
|
60 for ( TInt i( 0 ); i < iModel->GetRiContextCount(); i++ ) |
|
61 { |
|
62 HBufC* alias( iModel->GetSingleRIAliasL( i ) ); |
|
63 CleanupStack::PushL( alias ); |
|
64 TBool isAllowed( iModel->IsMeteringAllowed( i ) ); |
|
65 CSelectableItem* selItem( new (ELeave) CSelectableItem( *alias, |
|
66 isAllowed ) ); |
|
67 selItem->ConstructL(); |
|
68 this->AppendL( selItem ); |
|
69 CleanupStack::PopAndDestroy( alias ); |
|
70 } |
|
71 } |
|
72 |
|
73 // ---------------------------------------------------------------------------- |
|
74 // CDRMSettingUsageList::~CDRMSettingUsageList |
|
75 // |
|
76 // Destructor |
|
77 // ---------------------------------------------------------------------------- |
|
78 // |
|
79 CDRMSettingUsageList::~CDRMSettingUsageList() |
|
80 { |
|
81 this->ResetAndDestroy(); |
|
82 } |
|
83 |
|
84 // ---------------------------------------------------------------------------- |
|
85 // CDRMSettingUsageList::UpdateContexts |
|
86 // ---------------------------------------------------------------------------- |
|
87 // |
|
88 void CDRMSettingUsageList::UpdateContexts() |
|
89 { |
|
90 for ( TInt i( 0 ); i < iModel->GetRiContextCount(); i++ ) |
|
91 { |
|
92 CSelectableItem* selItem( this->At( i ) ); |
|
93 iModel->SetMeteringStatus( i, selItem->SelectionStatus() ); |
|
94 } |
|
95 } |
|
96 |
|
97 // End of File |
|