|
1 /* |
|
2 * Copyright (c) 2005 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: The modified list item for the type selection |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 |
|
22 #include "sipsettlistsipprofsettypelistitem.h" |
|
23 #include "sipsettlistsipprofsetmodel.h" |
|
24 #include <akntitle.h> |
|
25 #include "gssippluginlogger.h" |
|
26 |
|
27 // LOCAL CONSTANTS AND MACROS |
|
28 |
|
29 const TInt KNullTextArray = 1; |
|
30 const TInt KTextArray = 5; |
|
31 |
|
32 // ============================ MEMBER FUNCTIONS =============================== |
|
33 |
|
34 // ----------------------------------------------------------------------------- |
|
35 // CSIPSettListSIPProfSetTypeListItem::CSIPSettListSIPProfSetTypeListItem |
|
36 // C++ default constructor can NOT contain any code, that |
|
37 // might leave. |
|
38 // ----------------------------------------------------------------------------- |
|
39 // |
|
40 CSIPSettListSIPProfSetTypeListItem::CSIPSettListSIPProfSetTypeListItem( |
|
41 TInt aResourceId, |
|
42 TInt& aValue, |
|
43 CSIPSettListSIPProfSetModel* aModel ) : |
|
44 CAknEnumeratedTextPopupSettingItem( aResourceId, aValue ), |
|
45 iModel( aModel ), |
|
46 iEnumValue( aValue ) |
|
47 { |
|
48 __GSLOGSTRING("CSIPSettListSIPProfSetTypeListItem::CSIPSettListSIPProfSetTypeListItem" ) |
|
49 } |
|
50 |
|
51 // Destructor |
|
52 CSIPSettListSIPProfSetTypeListItem::~CSIPSettListSIPProfSetTypeListItem() |
|
53 { |
|
54 __GSLOGSTRING("CSIPSettListSIPProfSetTypeListItem::~CSIPSettListSIPProfSetTypeListItem" ) |
|
55 } |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // CSIPSettListSIPProfSetTypeListItem::InitializeListL() |
|
59 // Initializes the enumeration list/txt pairs for the pop-up list |
|
60 // ----------------------------------------------------------------------------- |
|
61 // |
|
62 void CSIPSettListSIPProfSetTypeListItem::InitializeListL( |
|
63 CArrayPtr<CAknEnumeratedText>*& aTextArray, |
|
64 CArrayPtr<HBufC>*& aNullTextArray ) |
|
65 { |
|
66 __GSLOGSTRING("CSIPSettListSIPProfSetTypeListItem::InitializeListL" ) |
|
67 // The text-enumerated thing pair |
|
68 aTextArray = new ( ELeave ) CArrayPtrFlat<CAknEnumeratedText>( KTextArray ); |
|
69 TCleanupItem clItem( ResetAndDestroy, &aTextArray ); |
|
70 |
|
71 CleanupStack::PushL( clItem ); |
|
72 |
|
73 // This must be valid, but is empty |
|
74 aNullTextArray = new ( ELeave ) CArrayPtrFlat<HBufC>( KNullTextArray ); |
|
75 CleanupStack::PushL( aNullTextArray ); |
|
76 |
|
77 // Get & set lists |
|
78 iModel->GetTypeListL( aTextArray, iEnumValue ); |
|
79 |
|
80 // Ownership has changed, we can pop the arrays |
|
81 CleanupStack::Pop( aNullTextArray ); |
|
82 CleanupStack::Pop(); //clItem |
|
83 } |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // CSIPSettListSIPProfSetTypeListItem::CompleteConstructionL |
|
87 // Fetches and changes the lists after the construction is completed |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 void CSIPSettListSIPProfSetTypeListItem::CompleteConstructionL() |
|
91 { |
|
92 __GSLOGSTRING("CSIPSettListSIPProfSetTypeListItem::CompleteConstructionL" ) |
|
93 CArrayPtr<CAknEnumeratedText>* textArray = NULL; |
|
94 CArrayPtr<HBufC>* nullTextArray = NULL; |
|
95 |
|
96 CAknEnumeratedTextPopupSettingItem::CompleteConstructionL(); |
|
97 |
|
98 // Read the AP list |
|
99 InitializeListL( textArray, nullTextArray ); |
|
100 |
|
101 // Set new text arrays |
|
102 SetEnumeratedTextArrays( textArray, nullTextArray ); |
|
103 |
|
104 // Update the lists internally |
|
105 HandleTextArrayUpdateL(); |
|
106 } |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // CSIPSettListSIPProfSetTypeListItem::EditItemL |
|
110 // Called before the pop-up list is shown. Updates it, if there was a |
|
111 // non-matching AP UID at the start-up |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 void CSIPSettListSIPProfSetTypeListItem::EditItemL( |
|
115 TBool aCalledFromMenu ) |
|
116 { |
|
117 __GSLOGSTRING("CSIPSettListSIPProfSetTypeListItem::EditItemL Start" ) |
|
118 CArrayPtr<CAknEnumeratedText>* array = EnumeratedTextArray(); |
|
119 TBool found = EFalse; |
|
120 TInt i( 0 ); |
|
121 for ( i = 0; i < array->Count(); i++ ) |
|
122 { |
|
123 if ( array->At( i )->EnumerationValue() == iEnumValue ) |
|
124 { |
|
125 found = ETrue; |
|
126 } |
|
127 } |
|
128 |
|
129 if ( !found && array->Count() > KErrNone ) |
|
130 { |
|
131 iEnumValue = array->At( 0 )->EnumerationValue(); |
|
132 } |
|
133 |
|
134 CAknEnumeratedTextPopupSettingItem::EditItemL( aCalledFromMenu ); |
|
135 __GSLOGSTRING("CSIPSettListSIPProfSetTypeListItem::EditItemL End" ) |
|
136 } |
|
137 |
|
138 // ----------------------------------------------------------------------------- |
|
139 // CSIPSettListSIPProfSetTypeListItem::ResetAndDestroy |
|
140 // For deleting array in case of leave |
|
141 // ----------------------------------------------------------------------------- |
|
142 // |
|
143 void CSIPSettListSIPProfSetTypeListItem::ResetAndDestroy( TAny* aPointerArray ) |
|
144 { |
|
145 __GSLOGSTRING("CSIPSettListSIPProfSetTypeListItem::ResetAndDestroy" ) |
|
146 CArrayPtrFlat<CAknEnumeratedText>* array = |
|
147 static_cast<CArrayPtrFlat<CAknEnumeratedText>*>( aPointerArray ); |
|
148 array->ResetAndDestroy(); |
|
149 delete array; |
|
150 } |
|
151 |
|
152 // End of File |