author | Sebastian Brannstrom <sebastianb@symbian.org> |
Mon, 15 Nov 2010 21:37:46 +0000 | |
branch | newlist |
changeset 353 | 33963ffd3082 |
parent 347 | b8d687bb7ca1 |
child 355 | 075b3a49cb55 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
2 |
* Copyright (c) 2007-2010 Sebastian Brannstrom, Lars Persson, EmbedDev AB |
|
3 |
* |
|
4 |
* All rights reserved. |
|
5 |
* This component and the accompanying materials are made available |
|
6 |
* under the terms of the License "Eclipse Public License v1.0" |
|
7 |
* which accompanies this distribution, and is available |
|
8 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 |
* |
|
10 |
* Initial Contributors: |
|
11 |
* EmbedDev AB - initial contribution. |
|
12 |
* |
|
13 |
* Contributors: |
|
14 |
* |
|
15 |
* Description: |
|
16 |
* |
|
17 |
*/ |
|
18 |
||
19 |
#include "PodcastQueueView.h" |
|
20 |
#include "PodcastAppUi.h" |
|
21 |
#include "ShowEngine.h" |
|
22 |
#include "SettingsEngine.h" |
|
23 |
#include "PodcastApp.h" |
|
24 |
#include "Constants.h" |
|
25 |
#include "imagehandler.h" |
|
26 |
#include "PodcastShowsView.h" |
|
27 |
||
28 |
#include <podcast.rsg> |
|
29 |
#include <podcast.mbg> |
|
30 |
#include <gulicon.h> |
|
31 |
#include <barsread.h> |
|
32 |
#include <aknnotedialog.h> |
|
33 |
#include <aknmessagequerydialog.h> |
|
347
b8d687bb7ca1
Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
336
diff
changeset
|
34 |
#include <akntitle.h> |
2 | 35 |
|
36 |
#define KMaxMessageLength 200 |
|
37 |
||
38 |
||
39 |
CPodcastQueueView* CPodcastQueueView::NewL(CPodcastModel& aPodcastModel) |
|
40 |
{ |
|
41 |
CPodcastQueueView* self = CPodcastQueueView::NewLC(aPodcastModel); |
|
42 |
CleanupStack::Pop(self); |
|
43 |
return self; |
|
44 |
} |
|
45 |
||
46 |
CPodcastQueueView* CPodcastQueueView::NewLC(CPodcastModel& aPodcastModel) |
|
47 |
{ |
|
48 |
CPodcastQueueView* self = new ( ELeave ) CPodcastQueueView(aPodcastModel); |
|
49 |
CleanupStack::PushL(self); |
|
50 |
self->ConstructL(); |
|
51 |
return self; |
|
52 |
} |
|
53 |
||
54 |
CPodcastQueueView::CPodcastQueueView(CPodcastModel& aPodcastModel) : |
|
60 | 55 |
CPodcastShowsView(aPodcastModel) |
2 | 56 |
{ |
57 |
} |
|
58 |
||
59 |
void CPodcastQueueView::ConstructL() |
|
60 |
{ |
|
61 |
BaseConstructL(R_PODCAST_QUEUEVIEW); |
|
62 |
CPodcastListView::ConstructL(); |
|
60 | 63 |
|
64 |
CreateIconsL(); |
|
2 | 65 |
|
66 |
iPodcastModel.FeedEngine().AddObserver(this); |
|
67 |
iPodcastModel.ShowEngine().AddObserver(this); |
|
68 |
||
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
69 |
iStylusPopupMenu = CAknStylusPopUpMenu::NewL( this , TPoint(0,0)); |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
70 |
TResourceReader reader; |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
71 |
iCoeEnv->CreateResourceReaderLC(reader,R_QUEUEVIEW_POPUP_MENU); |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
72 |
iStylusPopupMenu->ConstructFromResourceL(reader); |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
73 |
|
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
74 |
CleanupStack::PopAndDestroy(); |
164
000f9fc147b2
Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
149
diff
changeset
|
75 |
|
2 | 76 |
SetEmptyTextL(R_PODCAST_EMPTY_QUEUE); |
77 |
} |
|
78 |
||
79 |
TKeyResponse CPodcastQueueView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) |
|
80 |
{ |
|
81 |
if (aType == EEventKey) |
|
82 |
{ |
|
83 |
CShowInfo *activeShow = NULL; |
|
84 |
||
85 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
86 |
if(index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
|
87 |
{ |
|
88 |
activeShow = iPodcastModel.ActiveShowList()[index]; |
|
89 |
} |
|
90 |
||
91 |
if (activeShow != NULL) { |
|
92 |
DP1("aKeyEvent.iCode=%d", aKeyEvent.iCode); |
|
93 |
switch (aKeyEvent.iCode) { |
|
94 |
case EKeyBackspace: |
|
95 |
case EKeyDelete: |
|
96 |
HandleCommandL(EPodcastRemoveDownload); |
|
97 |
break; |
|
98 |
default: |
|
99 |
break; |
|
100 |
} |
|
101 |
UpdateToolbar(); |
|
102 |
} |
|
103 |
} |
|
104 |
return CPodcastListView::OfferKeyEventL(aKeyEvent, aType); |
|
105 |
} |
|
106 |
||
107 |
CPodcastQueueView::~CPodcastQueueView() |
|
108 |
{ |
|
109 |
iPodcastModel.ShowEngine().RemoveObserver(this); |
|
110 |
iPodcastModel.FeedEngine().RemoveObserver(this); |
|
111 |
||
112 |
if(iStylusPopupMenu) |
|
113 |
delete iStylusPopupMenu, iStylusPopupMenu = NULL; |
|
114 |
} |
|
115 |
||
116 |
||
117 |
TUid CPodcastQueueView::Id() const |
|
118 |
{ |
|
119 |
return KUidPodcastQueueViewID; |
|
120 |
} |
|
121 |
||
122 |
void CPodcastQueueView::DoActivateL(const TVwsViewId& aPrevViewId, |
|
123 |
TUid aCustomMessageId, const TDesC8& aCustomMessage) |
|
124 |
{ |
|
125 |
DP("CPodcastQueueView::DoActivateL BEGIN"); |
|
126 |
||
127 |
CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage); |
|
45
56d4e0784e5d
Nicer way to handle back from queue view to feed/show view
teknolog
parents:
36
diff
changeset
|
128 |
iPreviousView = aPrevViewId; |
347
b8d687bb7ca1
Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
336
diff
changeset
|
129 |
UpdateViewTitleL(); |
2 | 130 |
UpdateFeedUpdateStateL(); |
131 |
UpdateToolbar(); |
|
132 |
DP("CPodcastQueueView::DoActivateL END"); |
|
133 |
} |
|
134 |
||
135 |
void CPodcastQueueView::DoDeactivate() |
|
136 |
{ |
|
137 |
CPodcastListView::DoDeactivate(); |
|
138 |
} |
|
139 |
||
140 |
void CPodcastQueueView::HandleListBoxEventL(CEikListBox* /*aListBox*/, |
|
141 |
TListBoxEvent aEventType) |
|
142 |
{ |
|
143 |
switch (aEventType) |
|
144 |
{ |
|
145 |
case EEventEnterKeyPressed: |
|
146 |
case EEventItemActioned: |
|
147 |
case EEventItemDoubleClicked: |
|
148 |
break; |
|
149 |
default: |
|
150 |
break; |
|
151 |
} |
|
152 |
UpdateToolbar(); |
|
153 |
} |
|
154 |
||
155 |
void CPodcastQueueView::UpdateListboxItemsL() |
|
156 |
{ |
|
336
3d6c1417e8bd
Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
263
diff
changeset
|
157 |
DP("CPodcastQueueView::UpdateListboxItemsL BEGIN"); |
183
913f0f0e98fc
Fix so listbox position is kept when removing a show from queue
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
173
diff
changeset
|
158 |
if (iListContainer->IsVisible() && !iDontUpdateList) |
2 | 159 |
{ |
160 |
TListItemProperties itemProps; |
|
161 |
TInt len = 0; |
|
162 |
||
8 | 163 |
iPodcastModel.GetShowsDownloadingL(); |
2 | 164 |
|
165 |
RShowInfoArray &fItems = iPodcastModel.ActiveShowList(); |
|
166 |
len = fItems.Count(); |
|
167 |
||
168 |
if (iListContainer->Listbox() != NULL) |
|
169 |
{ |
|
170 |
TBool allUidsMatch = EFalse; |
|
171 |
||
172 |
if (len == iListContainer->Listbox()->Model()->NumberOfItems()) |
|
173 |
{ |
|
174 |
allUidsMatch = ETrue; |
|
175 |
TUint itemId = 0; |
|
176 |
for (TInt loop = 0; loop< len; loop++) |
|
177 |
{ |
|
178 |
itemId = iItemIdArray[loop]; |
|
179 |
if (fItems[loop]->Uid() != itemId) |
|
180 |
{ |
|
181 |
allUidsMatch = EFalse; |
|
182 |
break; |
|
183 |
} |
|
184 |
} |
|
185 |
} |
|
186 |
||
187 |
if (allUidsMatch && len > 0) |
|
188 |
{ |
|
189 |
for (TInt loop = 0; loop< len; loop++) |
|
190 |
{ |
|
191 |
UpdateShowItemDataL(fItems[loop], loop); |
|
192 |
} |
|
263
c71e68f962c6
Fix for bug 3853
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
183
diff
changeset
|
193 |
iListContainer->Listbox()->DrawNow(); |
2 | 194 |
} |
195 |
else |
|
196 |
{ |
|
336
3d6c1417e8bd
Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
263
diff
changeset
|
197 |
//iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL(); |
2 | 198 |
iListContainer->Listbox()->Reset(); |
199 |
iItemIdArray.Reset(); |
|
200 |
iItemArray->Reset(); |
|
336
3d6c1417e8bd
Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
263
diff
changeset
|
201 |
iItemArrayShort->Reset(); |
2 | 202 |
|
203 |
if (len > 0) |
|
204 |
{ |
|
205 |
for (TInt i=0; i<len; i++) |
|
206 |
{ |
|
207 |
CShowInfo *si = fItems[i]; |
|
208 |
FormatShowInfoListBoxItemL(*si); |
|
209 |
iItemIdArray.Append(si->Uid()); |
|
210 |
iItemArray->AppendL(iListboxFormatbuffer); |
|
336
3d6c1417e8bd
Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
263
diff
changeset
|
211 |
iItemArrayShort->AppendL(iListboxFormatbufferShort); |
2 | 212 |
} |
213 |
} |
|
214 |
else |
|
215 |
{ |
|
216 |
iItemArray->Reset(); |
|
336
3d6c1417e8bd
Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
263
diff
changeset
|
217 |
iItemArrayShort->Reset(); |
2 | 218 |
iItemIdArray.Reset(); |
219 |
||
220 |
itemProps.SetDimmed(ETrue); |
|
221 |
itemProps.SetHiddenSelection(ETrue); |
|
222 |
} |
|
223 |
iListContainer->Listbox()->HandleItemAdditionL(); |
|
224 |
} |
|
225 |
} |
|
226 |
} |
|
336
3d6c1417e8bd
Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
263
diff
changeset
|
227 |
DP("CPodcastQueueView::UpdateListboxItemsL END"); |
2 | 228 |
} |
229 |
||
230 |
/** |
|
231 |
* Command handling function intended for overriding by sub classes. |
|
232 |
* Default implementation is empty. |
|
233 |
* @param aCommand ID of the command to respond to. |
|
234 |
*/ |
|
235 |
void CPodcastQueueView::HandleCommandL(TInt aCommand) |
|
236 |
{ |
|
237 |
switch (aCommand) |
|
238 |
{ |
|
239 |
case EPodcastRemoveAllDownloads: |
|
240 |
{ |
|
241 |
TBuf<KMaxMessageLength> msg; |
|
242 |
iEikonEnv->ReadResourceL(msg, R_CLEAR_QUERY); |
|
243 |
||
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
23
diff
changeset
|
244 |
if(ShowQueryMessageL(msg)) |
2 | 245 |
{ |
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
23
diff
changeset
|
246 |
iPodcastModel.ShowEngine().RemoveAllDownloadsL(); |
2 | 247 |
UpdateListboxItemsL(); |
248 |
} |
|
249 |
} |
|
250 |
break; |
|
251 |
case EPodcastRemoveDownload: |
|
252 |
{ |
|
253 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
254 |
if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
|
255 |
{ |
|
183
913f0f0e98fc
Fix so listbox position is kept when removing a show from queue
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
173
diff
changeset
|
256 |
// this is an ugly hack to prevent UpdateListboxItemsL from being |
913f0f0e98fc
Fix so listbox position is kept when removing a show from queue
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
173
diff
changeset
|
257 |
// triggered from the show engine, which causes focus to jump |
913f0f0e98fc
Fix so listbox position is kept when removing a show from queue
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
173
diff
changeset
|
258 |
// around in an ugly fashion |
913f0f0e98fc
Fix so listbox position is kept when removing a show from queue
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
173
diff
changeset
|
259 |
iDontUpdateList = ETrue; |
60 | 260 |
TRAP_IGNORE(iPodcastModel.ShowEngine().RemoveDownloadL(iPodcastModel.ActiveShowList()[index]->Uid())); |
183
913f0f0e98fc
Fix so listbox position is kept when removing a show from queue
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
173
diff
changeset
|
261 |
iDontUpdateList = EFalse; |
913f0f0e98fc
Fix so listbox position is kept when removing a show from queue
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
173
diff
changeset
|
262 |
} |
913f0f0e98fc
Fix so listbox position is kept when removing a show from queue
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
173
diff
changeset
|
263 |
UpdateListboxItemsL(); |
913f0f0e98fc
Fix so listbox position is kept when removing a show from queue
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
173
diff
changeset
|
264 |
if (index > 0) |
913f0f0e98fc
Fix so listbox position is kept when removing a show from queue
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
173
diff
changeset
|
265 |
{ |
913f0f0e98fc
Fix so listbox position is kept when removing a show from queue
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
173
diff
changeset
|
266 |
iListContainer->Listbox()->SetCurrentItemIndex(index - 1); |
2 | 267 |
} |
268 |
} |
|
269 |
break; |
|
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
270 |
case EPodcastMoveDownloadUp: |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
271 |
{ |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
272 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
149
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
273 |
TBool resumeAfterMove = EFalse; |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
274 |
if (index == 1 && !iPodcastModel.SettingsEngine().DownloadSuspended()) |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
275 |
{ |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
276 |
iPodcastModel.ShowEngine().SuspendDownloads(); |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
277 |
resumeAfterMove = ETrue; |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
278 |
} |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
279 |
|
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
280 |
if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
281 |
{ |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
282 |
TRAP_IGNORE(iPodcastModel.ShowEngine().MoveDownloadUpL(iPodcastModel.ActiveShowList()[index]->Uid())); |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
283 |
} |
149
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
284 |
|
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
285 |
if(resumeAfterMove) |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
286 |
{ |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
287 |
iPodcastModel.ShowEngine().ResumeDownloadsL(); |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
288 |
} |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
289 |
|
173
8466fe8528b6
Minor fix for highlight move in queue view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
169
diff
changeset
|
290 |
UpdateListboxItemsL(); |
169
9c77455964f8
Improvement to queue shifting function - move the highlight too.
Brendan Donegan <brendand@symbian.org>
parents:
164
diff
changeset
|
291 |
iListContainer->Listbox()->SetCurrentItemIndex(index - 1); |
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
292 |
} |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
293 |
break; |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
294 |
case EPodcastMoveDownloadDown: |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
295 |
{ |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
296 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
149
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
297 |
TBool resumeAfterMove = EFalse; |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
298 |
if (index == 0 && !iPodcastModel.SettingsEngine().DownloadSuspended()) |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
299 |
{ |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
300 |
iPodcastModel.ShowEngine().SuspendDownloads(); |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
301 |
resumeAfterMove = ETrue; |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
302 |
} |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
303 |
|
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
304 |
if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
305 |
{ |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
306 |
TRAP_IGNORE(iPodcastModel.ShowEngine().MoveDownloadDownL(iPodcastModel.ActiveShowList()[index]->Uid())); |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
307 |
} |
149
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
308 |
|
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
309 |
if(resumeAfterMove) |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
310 |
{ |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
311 |
iPodcastModel.ShowEngine().ResumeDownloadsL(); |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
312 |
} |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
313 |
|
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
314 |
UpdateListboxItemsL(); |
173
8466fe8528b6
Minor fix for highlight move in queue view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
169
diff
changeset
|
315 |
iListContainer->Listbox()->SetCurrentItemIndex(index + 1); |
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
316 |
} |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
317 |
break; |
2 | 318 |
case EPodcastSuspendDownloads: |
319 |
{ |
|
263
c71e68f962c6
Fix for bug 3853
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
183
diff
changeset
|
320 |
iDontUpdateList = ETrue; |
2 | 321 |
iPodcastModel.ShowEngine().SuspendDownloads(); |
263
c71e68f962c6
Fix for bug 3853
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
183
diff
changeset
|
322 |
iDontUpdateList = EFalse; |
2 | 323 |
UpdateListboxItemsL(); |
324 |
} |
|
325 |
break; |
|
326 |
case EPodcastResumeDownloads: |
|
327 |
{ |
|
263
c71e68f962c6
Fix for bug 3853
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
183
diff
changeset
|
328 |
iDontUpdateList = ETrue; |
2 | 329 |
iPodcastModel.ShowEngine().ResumeDownloadsL(); |
263
c71e68f962c6
Fix for bug 3853
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
183
diff
changeset
|
330 |
iDontUpdateList = EFalse; |
2 | 331 |
UpdateListboxItemsL(); |
332 |
} |
|
333 |
break; |
|
336
3d6c1417e8bd
Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
263
diff
changeset
|
334 |
case EPodcastShowInfo: |
3d6c1417e8bd
Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
263
diff
changeset
|
335 |
{ |
3d6c1417e8bd
Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
263
diff
changeset
|
336 |
DisplayShowInfoDialogL(); |
3d6c1417e8bd
Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
263
diff
changeset
|
337 |
} |
3d6c1417e8bd
Merged all the later Symbian3 updates into Symbian1 branch; new SIS v. 1.00.32
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
263
diff
changeset
|
338 |
break; |
2 | 339 |
default: |
353
33963ffd3082
UI improvements for automatic delete
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
347
diff
changeset
|
340 |
CPodcastShowsView::HandleCommandL(aCommand); |
2 | 341 |
break; |
342 |
} |
|
50 | 343 |
iListContainer->SetLongTapDetectedL(EFalse); // in case we got here by long tapping |
2 | 344 |
UpdateToolbar(); |
345 |
} |
|
346 |
||
347 |
void CPodcastQueueView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane) |
|
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
348 |
{ |
2 | 349 |
if(aResourceId == R_PODCAST_SHOWSVIEW_MENU) |
350 |
{ |
|
351 |
aMenuPane->SetItemDimmed(EPodcastMarkAllPlayed, ETrue); |
|
352 |
} |
|
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
353 |
} |
2 | 354 |
|
13 | 355 |
void CPodcastQueueView::UpdateToolbar(TBool aVisible) |
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
356 |
{ |
2 | 357 |
CAknToolbar* toolbar = Toolbar(); |
358 |
||
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
359 |
if (toolbar) |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
360 |
{ |
13 | 361 |
RShowInfoArray &fItems = iPodcastModel.ActiveShowList(); |
362 |
TInt itemCnt = fItems.Count(); |
|
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
363 |
if (iListContainer->IsVisible()) |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
364 |
{ |
14
4e75731546eb
Fix so toolbars only change visibility for the visible view
teknolog
parents:
13
diff
changeset
|
365 |
toolbar->SetToolbarVisibility(aVisible); |
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
366 |
} |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
367 |
|
13 | 368 |
toolbar->HideItem(EPodcastRemoveAllDownloads, EFalse, ETrue); |
369 |
toolbar->SetItemDimmed(EPodcastRemoveAllDownloads, itemCnt == 0, ETrue); |
|
370 |
toolbar->HideItem(EPodcastSuspendDownloads,iPodcastModel.SettingsEngine().DownloadSuspended(), ETrue); |
|
371 |
toolbar->HideItem(EPodcastResumeDownloads,!iPodcastModel.SettingsEngine().DownloadSuspended(), ETrue); |
|
23
cf4b850bbffb
Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents:
14
diff
changeset
|
372 |
toolbar->SetItemDimmed(EPodcastRemoveDownload, itemCnt == 0, ETrue); |
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
373 |
} |
13 | 374 |
} |
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
375 |
|
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
376 |
void CPodcastQueueView::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /* aPenEventScreenLocation */) |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
377 |
{ |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
378 |
DP("CPodcastQueueView::HandleLongTapEventL BEGIN"); |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
379 |
iListContainer->SetLongTapDetectedL(ETrue); |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
380 |
|
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
381 |
const TInt KListboxDefaultHeight = 19; // for some reason it returns 19 for an empty listbox in S^1 |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
382 |
TInt lbHeight = iListContainer->Listbox()->CalcHeightBasedOnNumOfItems( |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
383 |
iListContainer->Listbox()->Model()->NumberOfItems()) - KListboxDefaultHeight; |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
384 |
|
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
385 |
if(iStylusPopupMenu && aPenEventLocation.iY < lbHeight) |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
386 |
{ |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
387 |
TBool dimDown = (iListContainer->Listbox()->CurrentItemIndex() >= iPodcastModel.ActiveShowList().Count() - 1 ? |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
388 |
ETrue : EFalse); |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
389 |
TBool dimUp = (iListContainer->Listbox()->CurrentItemIndex() <= 0 ? |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
390 |
ETrue : EFalse); |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
391 |
|
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
392 |
iStylusPopupMenu->SetItemDimmed(EPodcastMoveDownloadDown, dimDown); |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
393 |
iStylusPopupMenu->SetItemDimmed(EPodcastMoveDownloadUp, dimUp); |
353
33963ffd3082
UI improvements for automatic delete
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
347
diff
changeset
|
394 |
|
33963ffd3082
UI improvements for automatic delete
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
347
diff
changeset
|
395 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
33963ffd3082
UI improvements for automatic delete
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
347
diff
changeset
|
396 |
CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
33963ffd3082
UI improvements for automatic delete
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
347
diff
changeset
|
397 |
|
33963ffd3082
UI improvements for automatic delete
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
347
diff
changeset
|
398 |
iStylusPopupMenu->SetItemDimmed(EPodcastMarkAsPlayed, info->PlayState() != ENeverPlayed); |
33963ffd3082
UI improvements for automatic delete
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
347
diff
changeset
|
399 |
iStylusPopupMenu->SetItemDimmed(EPodcastMarkAsUnplayed, info->PlayState() == ENeverPlayed); |
33963ffd3082
UI improvements for automatic delete
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
347
diff
changeset
|
400 |
|
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
401 |
iStylusPopupMenu->ShowMenu(); |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
402 |
iStylusPopupMenu->SetPosition(aPenEventLocation); |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
403 |
} |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
404 |
|
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
405 |
DP("CPodcastQueueView::HandleLongTapEventL END"); |
2 | 406 |
} |
347
b8d687bb7ca1
Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
336
diff
changeset
|
407 |
|
b8d687bb7ca1
Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
336
diff
changeset
|
408 |
void CPodcastQueueView::UpdateViewTitleL() |
b8d687bb7ca1
Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
336
diff
changeset
|
409 |
{ |
b8d687bb7ca1
Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
336
diff
changeset
|
410 |
CAknTitlePane* titlePane = static_cast<CAknTitlePane*> |
b8d687bb7ca1
Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
336
diff
changeset
|
411 |
( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
b8d687bb7ca1
Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
336
diff
changeset
|
412 |
|
b8d687bb7ca1
Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
336
diff
changeset
|
413 |
HBufC *title = iEikonEnv->AllocReadResourceLC(R_DOWNLOAD_QUEUE); |
b8d687bb7ca1
Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
336
diff
changeset
|
414 |
titlePane->SetTextL(*title); |
b8d687bb7ca1
Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
336
diff
changeset
|
415 |
CleanupStack::PopAndDestroy(title); |
b8d687bb7ca1
Experimenting with adding a new view to list all new shows
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
336
diff
changeset
|
416 |
} |