|
1 /* |
|
2 * Copyright (c) 2006-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 the License "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: Class for "Add service list" in Settings UI.* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <akntextsettingpage.h> |
|
22 #include <aknViewAppUi.h> |
|
23 |
|
24 #include "CIptvService.h" |
|
25 #include "feedsettingsviewaddservicelistbox.h" |
|
26 #include "feedsettingsviewcontainer.h" |
|
27 #include "feedsettingsview.hrh" |
|
28 |
|
29 // CONSTANTS |
|
30 _LIT(KCompulsoryChar, "*"); |
|
31 |
|
32 // ========================= MEMBER FUNCTIONS ================================== |
|
33 |
|
34 // ------------------------------------------------------------------------------ |
|
35 // CVcSettingsViewAddServiceListbox::CVcSettingsViewAddServiceListbox() |
|
36 // ------------------------------------------------------------------------------ |
|
37 // |
|
38 CVcxNsSettingsViewAddServiceListbox::CVcxNsSettingsViewAddServiceListbox( |
|
39 CVcxNsSettingsViewContainer* aParent, |
|
40 TDes& aServiceName, |
|
41 TDes& aAddress, |
|
42 TInt& aPluginType ) |
|
43 : iParent(aParent), |
|
44 iAdding(ETrue), |
|
45 iServiceName(aServiceName), |
|
46 iAddress(aAddress), |
|
47 iServicePluginType(aPluginType) |
|
48 { |
|
49 __ASSERT_DEBUG(iParent, User::Panic(KNullDesC, KErrBadHandle)); |
|
50 } |
|
51 |
|
52 // ---------------------------------------------------------------------------- |
|
53 // CVcSettingsViewAddServiceListbox::CreateSettingItemL() |
|
54 // ---------------------------------------------------------------------------- |
|
55 // |
|
56 CAknSettingItem* CVcxNsSettingsViewAddServiceListbox::CreateSettingItemL( |
|
57 TInt aIdentifier ) |
|
58 { |
|
59 switch (aIdentifier) |
|
60 { |
|
61 case EVcSettingsViewAddServiceServiceNameItem: |
|
62 { |
|
63 iServiceNameItem = new (ELeave) CAknTextSettingItem( aIdentifier, |
|
64 iServiceName ); |
|
65 return iServiceNameItem; |
|
66 } |
|
67 |
|
68 case EVcSettingsViewAddServiceAddressItem: |
|
69 { |
|
70 iAddressItem = new (ELeave) CAknTextSettingItem(aIdentifier, iAddress); |
|
71 iAddressItem->SetCompulsoryIndTextL(KCompulsoryChar); |
|
72 return iAddressItem; |
|
73 } |
|
74 |
|
75 case EVcSettingsViewAddServiceServiceTypeItem: |
|
76 { |
|
77 iPluginTypeItem = |
|
78 new (ELeave) CAknEnumeratedTextPopupSettingItem( aIdentifier, |
|
79 iServicePluginType ); |
|
80 return iPluginTypeItem; |
|
81 } |
|
82 |
|
83 default: |
|
84 { |
|
85 return NULL; |
|
86 } |
|
87 } |
|
88 } |
|
89 |
|
90 // --------------------------------------------------------- |
|
91 // CVcSettingsViewAddServiceListbox::EditCurrentItemL() |
|
92 // --------------------------------------------------------- |
|
93 // |
|
94 void CVcxNsSettingsViewAddServiceListbox::EditCurrentItemL() |
|
95 { |
|
96 TInt itemIndex = ListBox()->CurrentItemIndex(); |
|
97 |
|
98 if (itemIndex >= 0) |
|
99 { |
|
100 iParent->AppUi()->SetOrientationL( |
|
101 CAknAppUiBase::EAppUiOrientationUnspecified ); |
|
102 |
|
103 EditItemL(itemIndex, EFalse); |
|
104 } |
|
105 } |
|
106 |
|
107 // --------------------------------------------------------- |
|
108 // CVcSettingsViewAddServiceListbox::LoadAddServiceInformationL() |
|
109 // iAppSettings -> UI |
|
110 // --------------------------------------------------------- |
|
111 // |
|
112 void CVcxNsSettingsViewAddServiceListbox::LoadAddServiceInformationL( |
|
113 TBool aAdding, |
|
114 TDes& aServiceName, |
|
115 TDes& aAddress, |
|
116 CIptvService::TServiceType aServiceType, |
|
117 TInt& aPluginType ) |
|
118 { |
|
119 iAdding = aAdding; |
|
120 iServiceName = aServiceName; |
|
121 iAddress = aAddress; |
|
122 iServiceType = aServiceType; |
|
123 iServicePluginType = aPluginType; |
|
124 |
|
125 LoadSettingsL(); |
|
126 |
|
127 if (iPluginTypeItem) |
|
128 { |
|
129 if (aServiceType != CIptvService::ELiveTv) |
|
130 { |
|
131 iPluginTypeItem->SetHidden(ETrue); |
|
132 } |
|
133 else |
|
134 { |
|
135 iPluginTypeItem->SetHidden(EFalse); |
|
136 } |
|
137 HandleChangeInItemArrayOrVisibilityL(); |
|
138 iPluginTypeItem->UpdateListBoxTextL(); |
|
139 } |
|
140 |
|
141 if (iServiceNameItem && iAddressItem) |
|
142 { |
|
143 iServiceNameItem->UpdateListBoxTextL(); |
|
144 iAddressItem->SetCompulsoryIndTextL(KCompulsoryChar); |
|
145 iAddressItem->UpdateListBoxTextL(); |
|
146 } |
|
147 } |
|
148 |
|
149 // --------------------------------------------------------- |
|
150 // CVcSettingsViewAddServiceListbox::SaveAddServiceInformationL() |
|
151 // UI -> iAppSettings |
|
152 // --------------------------------------------------------- |
|
153 // |
|
154 void CVcxNsSettingsViewAddServiceListbox::SaveAddServiceInformationL() |
|
155 { |
|
156 StoreSettingsL(); |
|
157 } |
|
158 |
|
159 // --------------------------------------------------------- |
|
160 // CVcSettingsViewAddServiceListbox::IsAdding() |
|
161 // --------------------------------------------------------- |
|
162 // |
|
163 TBool CVcxNsSettingsViewAddServiceListbox::IsAdding() |
|
164 { |
|
165 return iAdding; |
|
166 } |
|
167 |
|
168 // ----------------------------------------------------------------------------- |
|
169 // CVcSettingsViewAddServiceListbox::SizeChanged() |
|
170 // ----------------------------------------------------------------------------- |
|
171 // |
|
172 void CVcxNsSettingsViewAddServiceListbox::SizeChanged() |
|
173 { |
|
174 CAknSettingItemList::SizeChanged(); |
|
175 |
|
176 if (ListBox()) |
|
177 { |
|
178 ListBox()->SetRect(Rect()); |
|
179 } |
|
180 } |
|
181 // ----------------------------------------------------------------------------- |
|
182 // CVcSettingsViewAddServiceListbox::OfferKeyEventL() |
|
183 // ----------------------------------------------------------------------------- |
|
184 // |
|
185 TKeyResponse CVcxNsSettingsViewAddServiceListbox::OfferKeyEventL( |
|
186 const TKeyEvent& aKeyEvent, |
|
187 TEventCode aType ) |
|
188 { |
|
189 return CAknSettingItemList::OfferKeyEventL(aKeyEvent, aType); |
|
190 } |
|
191 |
|
192 |
|
193 // -------------------------------------------------------------------------- |
|
194 // CMPSettingsVideoSettingItemList::HandleListBoxEventL() |
|
195 // -------------------------------------------------------------------------- |
|
196 // |
|
197 void CVcxNsSettingsViewAddServiceListbox::HandleListBoxEventL( |
|
198 CEikListBox* aListBox, |
|
199 TListBoxEvent aListBoxEvent ) |
|
200 { |
|
201 if ( aListBoxEvent == EEventEnterKeyPressed || |
|
202 aListBoxEvent == EEventItemSingleClicked || |
|
203 aListBoxEvent == EEventItemDoubleClicked ) |
|
204 { |
|
205 CAknSettingItemList::HandleListBoxEventL( aListBox, aListBoxEvent ); |
|
206 if ( iParent ) |
|
207 { |
|
208 iParent->DrawDeferred(); |
|
209 } |
|
210 } |
|
211 } |
|
212 |