|
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 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: Video on Demand schedule settings list.* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDES |
|
21 #include <vcxnsscheduleview.rsg> |
|
22 #include "vcxnsscheduleview.hrh" |
|
23 |
|
24 #include <StringLoader.h> |
|
25 #include <AknPopupFieldText.h> |
|
26 #include <aknmessagequerydialog.h> |
|
27 #include <featmgr.h> |
|
28 |
|
29 #include "CVcxNsScheduleSettingsViewContainer.h" |
|
30 #include "CVcxNsScheduleSettingsDlConditionItem.h" |
|
31 #include "CVcxNsScheduleSettingsDlTimeItem.h" |
|
32 #include "CVcxNsScheduleSettingsList.h" |
|
33 #include "vcxnsservicesettings.h" |
|
34 |
|
35 // CONSTANTS |
|
36 const TInt KIptvDownloadTimeSettingIndex = 0; |
|
37 const TInt KIptvDownloadConditionSettingIndex = 1; |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // CVcxNsScheduleSettingsList::CVcxNsScheduleSettingsList |
|
41 // C++ default constructor can NOT contain any code, that |
|
42 // might leave. |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 CVcxNsScheduleSettingsList::CVcxNsScheduleSettingsList( |
|
46 CVcxNsServiceSettings& aScheduleSettings ) |
|
47 : iDlScheduleSettings(aScheduleSettings) |
|
48 { |
|
49 iWlanSupported = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ); |
|
50 } |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // Destructor |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 CVcxNsScheduleSettingsList::~CVcxNsScheduleSettingsList() |
|
57 { |
|
58 } |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // CVcxNsScheduleSettingsList::SizeChanged |
|
62 // ----------------------------------------------------------------------------- |
|
63 // |
|
64 void CVcxNsScheduleSettingsList::SizeChanged() |
|
65 { |
|
66 CAknSettingItemList::SizeChanged(); |
|
67 if ( ListBox() ) |
|
68 { |
|
69 ListBox()->SetRect( Rect() ); |
|
70 } |
|
71 } |
|
72 |
|
73 // ----------------------------------------------------------------------------- |
|
74 // CVcxNsScheduleSettingsList::CreateSettingItemL |
|
75 // ----------------------------------------------------------------------------- |
|
76 // |
|
77 CAknSettingItem* CVcxNsScheduleSettingsList::CreateSettingItemL( TInt aId ) |
|
78 { |
|
79 switch ( aId ) |
|
80 { |
|
81 case EIptvVodScheduleSettingsViewDownloadConditionItem: |
|
82 { |
|
83 CVcxNsScheduleSettingsDlConditionItem* item = new (ELeave) |
|
84 CVcxNsScheduleSettingsDlConditionItem( |
|
85 aId, |
|
86 (TInt&)iDownloadCondition, |
|
87 iWlanSupported ); |
|
88 return item; |
|
89 } |
|
90 |
|
91 case EIptvVodScheduleSettingsViewDownloadTimeItem: |
|
92 { |
|
93 CVcxNsScheduleSettingsDlTimeItem* item = new (ELeave) |
|
94 CVcxNsScheduleSettingsDlTimeItem( |
|
95 aId, |
|
96 (TUint&)iDownloadTime ); |
|
97 return item; |
|
98 } |
|
99 |
|
100 default: |
|
101 { |
|
102 return NULL; |
|
103 } |
|
104 } |
|
105 } |
|
106 |
|
107 // ----------------------------------------------------------------------------- |
|
108 // CVcxNsScheduleSettingsList::EditItemL |
|
109 // ----------------------------------------------------------------------------- |
|
110 // |
|
111 void CVcxNsScheduleSettingsList::EditItemL ( TInt aIndex, |
|
112 TBool aCalledFromMenu ) |
|
113 { |
|
114 if ( aIndex >= 0 && aIndex < ( *SettingItemArray() ).Count() ) |
|
115 { |
|
116 TIptvVodScheduleConnectionCondition oldDownloadCondition = |
|
117 iDownloadCondition; |
|
118 CAknSettingItemList::EditItemL( aIndex, aCalledFromMenu ); |
|
119 CAknSettingItem* item = ( *SettingItemArray() ) [ aIndex ]; |
|
120 item->StoreL(); |
|
121 |
|
122 if ( aIndex == KIptvDownloadTimeSettingIndex |
|
123 && iDownloadCondition != EManual |
|
124 && iDownloadCondition != oldDownloadCondition ) |
|
125 { |
|
126 HBufC* messageText = StringLoader::LoadLC( |
|
127 R_VCXNS_SCHEDULE_AUTOMATIC_DOWNLOAD_NOTE ); |
|
128 if ( messageText ) |
|
129 { |
|
130 CAknMessageQueryDialog* dlg = |
|
131 CAknMessageQueryDialog::NewL( *messageText ); |
|
132 dlg->ExecuteLD( R_VCXNS_SCHEDULE_AUTOMATIC_DOWNLOAD_QUERY_DIALOG ); |
|
133 CleanupStack::PopAndDestroy( messageText ); |
|
134 } |
|
135 } |
|
136 |
|
137 // Show/hide download time setting item as required |
|
138 if ( aIndex == KIptvDownloadTimeSettingIndex |
|
139 && KIptvDownloadConditionSettingIndex < (*SettingItemArray()).Count() ) |
|
140 { |
|
141 if ( iDownloadCondition == EManual ) |
|
142 { |
|
143 item = ( *SettingItemArray() )[KIptvDownloadConditionSettingIndex]; |
|
144 item->SetHidden( ETrue ); |
|
145 } |
|
146 else |
|
147 { |
|
148 item = ( *SettingItemArray() )[KIptvDownloadConditionSettingIndex]; |
|
149 item->SetHidden( EFalse ); |
|
150 } |
|
151 |
|
152 HandleChangeInItemArrayOrVisibilityL(); |
|
153 } |
|
154 } |
|
155 } |
|
156 |
|
157 // ----------------------------------------------------------------------------- |
|
158 // CVcxNsScheduleSettingsList::ChangeSelectedItemL |
|
159 // ----------------------------------------------------------------------------- |
|
160 // |
|
161 void CVcxNsScheduleSettingsList::ChangeSelectedItemL() |
|
162 { |
|
163 if ( ListBox()->CurrentItemIndex() >= 0 ) |
|
164 { |
|
165 EditItemL( ListBox()->CurrentItemIndex(), ETrue ); |
|
166 } |
|
167 } |
|
168 |
|
169 // ----------------------------------------------------------------------------- |
|
170 // CVcxNsScheduleSettingsList::LoadSettingValuesL |
|
171 // ----------------------------------------------------------------------------- |
|
172 // |
|
173 void CVcxNsScheduleSettingsList::LoadSettingValuesL( TIptvServiceId aServiceId ) |
|
174 { |
|
175 iDlScheduleSettings.GetScheduledDownloadSettingsL( |
|
176 aServiceId, |
|
177 iDownloadTime, |
|
178 iDownloadCondition, |
|
179 iDownloadType ); |
|
180 |
|
181 // Note: This is needed in the case when download condition is set to WLAN, |
|
182 // but device doesn't support it. |
|
183 if ( !iWlanSupported && iDownloadCondition == EWLAN ) |
|
184 { |
|
185 iDownloadCondition = EManual; |
|
186 } |
|
187 |
|
188 // Set default value for download time to "night". |
|
189 if ( iDownloadCondition == EManual ) |
|
190 { |
|
191 iDownloadTime = ENight; |
|
192 } |
|
193 |
|
194 LoadSettingsL(); |
|
195 |
|
196 // Hide download time setting if manual download is selected. |
|
197 if ( iDownloadCondition == EManual ) |
|
198 { |
|
199 if ( KIptvDownloadConditionSettingIndex < (*SettingItemArray()).Count()) |
|
200 { |
|
201 CAknSettingItem* item = |
|
202 ( *SettingItemArray() ) [ KIptvDownloadConditionSettingIndex ]; |
|
203 item->SetHidden( ETrue ); |
|
204 HandleChangeInItemArrayOrVisibilityL(); |
|
205 } |
|
206 } |
|
207 } |
|
208 |
|
209 // ----------------------------------------------------------------------------- |
|
210 // CVcxNsScheduleSettingsList::SaveSettingValuesL |
|
211 // ----------------------------------------------------------------------------- |
|
212 // |
|
213 void CVcxNsScheduleSettingsList::SaveSettingValuesL( TIptvServiceId aServiceId ) |
|
214 { |
|
215 StoreSettingsL(); |
|
216 |
|
217 iDlScheduleSettings.SetScheduledDownloadSettingsL( |
|
218 aServiceId, |
|
219 iDownloadTime, |
|
220 iDownloadCondition, |
|
221 EDownloadAddedAfterLastScheduledDownload ); // No UI for this yet |
|
222 } |
|
223 |
|
224 // ----------------------------------------------------------------------------- |
|
225 // CVcxNsScheduleSettingsList::OfferKeyEventL |
|
226 // ----------------------------------------------------------------------------- |
|
227 // |
|
228 TKeyResponse CVcxNsScheduleSettingsList::OfferKeyEventL( |
|
229 const TKeyEvent& aKeyEvent, |
|
230 TEventCode aType ) |
|
231 { |
|
232 return CAknSettingItemList::OfferKeyEventL( aKeyEvent, aType ); |
|
233 } |
|
234 |
|
235 // ----------------------------------------------------------------------------- |
|
236 // CVcxNsScheduleSettingsList::IsSchedulingActive |
|
237 // ----------------------------------------------------------------------------- |
|
238 // |
|
239 TBool CVcxNsScheduleSettingsList::IsSchedulingActive() |
|
240 { |
|
241 if ( iDownloadCondition == EManual || iDownloadTime == ENoSchedule) |
|
242 { |
|
243 return EFalse; |
|
244 } |
|
245 return ETrue; |
|
246 } |
|
247 |
|
248 // End of File |