author | Sebastian Brannstrom <sebastianb@symbian.org> |
Sat, 16 Oct 2010 18:39:26 +0100 | |
branch | symbian1 |
changeset 244 | d6c20128dad5 |
parent 183 | 913f0f0e98fc |
child 263 | c71e68f962c6 |
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> |
|
34 |
||
35 |
#define KMaxMessageLength 200 |
|
36 |
||
37 |
||
38 |
CPodcastQueueView* CPodcastQueueView::NewL(CPodcastModel& aPodcastModel) |
|
39 |
{ |
|
40 |
CPodcastQueueView* self = CPodcastQueueView::NewLC(aPodcastModel); |
|
41 |
CleanupStack::Pop(self); |
|
42 |
return self; |
|
43 |
} |
|
44 |
||
45 |
CPodcastQueueView* CPodcastQueueView::NewLC(CPodcastModel& aPodcastModel) |
|
46 |
{ |
|
47 |
CPodcastQueueView* self = new ( ELeave ) CPodcastQueueView(aPodcastModel); |
|
48 |
CleanupStack::PushL(self); |
|
49 |
self->ConstructL(); |
|
50 |
return self; |
|
51 |
} |
|
52 |
||
53 |
CPodcastQueueView::CPodcastQueueView(CPodcastModel& aPodcastModel) : |
|
60 | 54 |
CPodcastShowsView(aPodcastModel) |
2 | 55 |
{ |
56 |
} |
|
57 |
||
58 |
void CPodcastQueueView::ConstructL() |
|
59 |
{ |
|
60 |
BaseConstructL(R_PODCAST_QUEUEVIEW); |
|
61 |
CPodcastListView::ConstructL(); |
|
60 | 62 |
|
63 |
CreateIconsL(); |
|
64 |
||
2 | 65 |
iListContainer->Listbox()->SetListBoxObserver(this); |
66 |
||
67 |
iPodcastModel.FeedEngine().AddObserver(this); |
|
68 |
iPodcastModel.ShowEngine().AddObserver(this); |
|
69 |
||
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
70 |
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
|
71 |
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
|
72 |
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
|
73 |
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
|
74 |
|
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
75 |
CleanupStack::PopAndDestroy(); |
164
000f9fc147b2
Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
149
diff
changeset
|
76 |
|
2 | 77 |
SetEmptyTextL(R_PODCAST_EMPTY_QUEUE); |
78 |
} |
|
79 |
||
80 |
TKeyResponse CPodcastQueueView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) |
|
81 |
{ |
|
82 |
if (aType == EEventKey) |
|
83 |
{ |
|
84 |
CShowInfo *activeShow = NULL; |
|
85 |
||
86 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
87 |
if(index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
|
88 |
{ |
|
89 |
activeShow = iPodcastModel.ActiveShowList()[index]; |
|
90 |
} |
|
91 |
||
92 |
if (activeShow != NULL) { |
|
93 |
DP1("aKeyEvent.iCode=%d", aKeyEvent.iCode); |
|
94 |
switch (aKeyEvent.iCode) { |
|
95 |
case EKeyBackspace: |
|
96 |
case EKeyDelete: |
|
97 |
HandleCommandL(EPodcastRemoveDownload); |
|
98 |
break; |
|
99 |
default: |
|
100 |
break; |
|
101 |
} |
|
102 |
UpdateToolbar(); |
|
103 |
} |
|
104 |
} |
|
105 |
return CPodcastListView::OfferKeyEventL(aKeyEvent, aType); |
|
106 |
} |
|
107 |
||
108 |
CPodcastQueueView::~CPodcastQueueView() |
|
109 |
{ |
|
110 |
iPodcastModel.ShowEngine().RemoveObserver(this); |
|
111 |
iPodcastModel.FeedEngine().RemoveObserver(this); |
|
112 |
||
113 |
if(iStylusPopupMenu) |
|
114 |
delete iStylusPopupMenu, iStylusPopupMenu = NULL; |
|
115 |
} |
|
116 |
||
117 |
||
118 |
TUid CPodcastQueueView::Id() const |
|
119 |
{ |
|
120 |
return KUidPodcastQueueViewID; |
|
121 |
} |
|
122 |
||
123 |
void CPodcastQueueView::DoActivateL(const TVwsViewId& aPrevViewId, |
|
124 |
TUid aCustomMessageId, const TDesC8& aCustomMessage) |
|
125 |
{ |
|
126 |
DP("CPodcastQueueView::DoActivateL BEGIN"); |
|
127 |
||
128 |
CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage); |
|
45
56d4e0784e5d
Nicer way to handle back from queue view to feed/show view
teknolog
parents:
36
diff
changeset
|
129 |
iPreviousView = aPrevViewId; |
2 | 130 |
|
131 |
UpdateFeedUpdateStateL(); |
|
132 |
UpdateToolbar(); |
|
133 |
DP("CPodcastQueueView::DoActivateL END"); |
|
134 |
} |
|
135 |
||
136 |
void CPodcastQueueView::DoDeactivate() |
|
137 |
{ |
|
138 |
CPodcastListView::DoDeactivate(); |
|
139 |
} |
|
140 |
||
141 |
void CPodcastQueueView::HandleListBoxEventL(CEikListBox* /*aListBox*/, |
|
142 |
TListBoxEvent aEventType) |
|
143 |
{ |
|
144 |
switch (aEventType) |
|
145 |
{ |
|
146 |
case EEventEnterKeyPressed: |
|
147 |
case EEventItemActioned: |
|
148 |
case EEventItemDoubleClicked: |
|
149 |
break; |
|
150 |
default: |
|
151 |
break; |
|
152 |
} |
|
153 |
UpdateToolbar(); |
|
154 |
} |
|
155 |
||
156 |
void CPodcastQueueView::UpdateListboxItemsL() |
|
157 |
{ |
|
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 |
iListContainer->Listbox()->DrawItem(loop); |
|
193 |
} |
|
194 |
} |
|
195 |
else |
|
196 |
{ |
|
197 |
iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL(); |
|
198 |
iListContainer->Listbox()->Reset(); |
|
199 |
iItemIdArray.Reset(); |
|
200 |
iItemArray->Reset(); |
|
201 |
||
202 |
if (len > 0) |
|
203 |
{ |
|
204 |
for (TInt i=0; i<len; i++) |
|
205 |
{ |
|
206 |
CShowInfo *si = fItems[i]; |
|
207 |
FormatShowInfoListBoxItemL(*si); |
|
208 |
iItemIdArray.Append(si->Uid()); |
|
209 |
iItemArray->AppendL(iListboxFormatbuffer); |
|
210 |
} |
|
211 |
} |
|
212 |
else |
|
213 |
{ |
|
214 |
iItemArray->Reset(); |
|
215 |
iItemIdArray.Reset(); |
|
216 |
||
217 |
itemProps.SetDimmed(ETrue); |
|
218 |
itemProps.SetHiddenSelection(ETrue); |
|
219 |
} |
|
220 |
iListContainer->Listbox()->HandleItemAdditionL(); |
|
221 |
} |
|
222 |
} |
|
223 |
} |
|
224 |
} |
|
225 |
||
226 |
/** |
|
227 |
* Command handling function intended for overriding by sub classes. |
|
228 |
* Default implementation is empty. |
|
229 |
* @param aCommand ID of the command to respond to. |
|
230 |
*/ |
|
231 |
void CPodcastQueueView::HandleCommandL(TInt aCommand) |
|
232 |
{ |
|
233 |
switch (aCommand) |
|
234 |
{ |
|
235 |
case EPodcastRemoveAllDownloads: |
|
236 |
{ |
|
237 |
TBuf<KMaxMessageLength> msg; |
|
238 |
iEikonEnv->ReadResourceL(msg, R_CLEAR_QUERY); |
|
239 |
||
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
23
diff
changeset
|
240 |
if(ShowQueryMessageL(msg)) |
2 | 241 |
{ |
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
23
diff
changeset
|
242 |
iPodcastModel.ShowEngine().RemoveAllDownloadsL(); |
2 | 243 |
UpdateListboxItemsL(); |
244 |
} |
|
245 |
} |
|
246 |
break; |
|
247 |
case EPodcastRemoveDownload: |
|
248 |
{ |
|
249 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
250 |
if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
|
251 |
{ |
|
183
913f0f0e98fc
Fix so listbox position is kept when removing a show from queue
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
173
diff
changeset
|
252 |
// 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
|
253 |
// 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
|
254 |
// 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
|
255 |
iDontUpdateList = ETrue; |
60 | 256 |
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
|
257 |
iDontUpdateList = EFalse; |
913f0f0e98fc
Fix so listbox position is kept when removing a show from queue
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
173
diff
changeset
|
258 |
} |
913f0f0e98fc
Fix so listbox position is kept when removing a show from queue
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
173
diff
changeset
|
259 |
UpdateListboxItemsL(); |
913f0f0e98fc
Fix so listbox position is kept when removing a show from queue
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
173
diff
changeset
|
260 |
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
|
261 |
{ |
913f0f0e98fc
Fix so listbox position is kept when removing a show from queue
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
173
diff
changeset
|
262 |
iListContainer->Listbox()->SetCurrentItemIndex(index - 1); |
2 | 263 |
} |
264 |
} |
|
265 |
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
|
266 |
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
|
267 |
{ |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
268 |
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
|
269 |
TBool resumeAfterMove = EFalse; |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
270 |
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
|
271 |
{ |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
272 |
iPodcastModel.ShowEngine().SuspendDownloads(); |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
273 |
resumeAfterMove = ETrue; |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
274 |
} |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
275 |
|
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
276 |
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
|
277 |
{ |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
278 |
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
|
279 |
} |
149
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
280 |
|
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
281 |
if(resumeAfterMove) |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
282 |
{ |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
283 |
iPodcastModel.ShowEngine().ResumeDownloadsL(); |
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 |
|
173
8466fe8528b6
Minor fix for highlight move in queue view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
169
diff
changeset
|
286 |
UpdateListboxItemsL(); |
169
9c77455964f8
Improvement to queue shifting function - move the highlight too.
Brendan Donegan <brendand@symbian.org>
parents:
164
diff
changeset
|
287 |
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
|
288 |
} |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
289 |
break; |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
290 |
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
|
291 |
{ |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
292 |
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
|
293 |
TBool resumeAfterMove = EFalse; |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
294 |
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
|
295 |
{ |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
296 |
iPodcastModel.ShowEngine().SuspendDownloads(); |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
297 |
resumeAfterMove = ETrue; |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
298 |
} |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
299 |
|
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
300 |
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
|
301 |
{ |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
302 |
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
|
303 |
} |
149
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
304 |
|
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
305 |
if(resumeAfterMove) |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
306 |
{ |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
307 |
iPodcastModel.ShowEngine().ResumeDownloadsL(); |
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 |
|
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
310 |
UpdateListboxItemsL(); |
173
8466fe8528b6
Minor fix for highlight move in queue view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
169
diff
changeset
|
311 |
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
|
312 |
} |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
313 |
break; |
2 | 314 |
case EPodcastSuspendDownloads: |
315 |
{ |
|
316 |
iPodcastModel.ShowEngine().SuspendDownloads(); |
|
317 |
UpdateListboxItemsL(); |
|
318 |
} |
|
319 |
break; |
|
320 |
case EPodcastResumeDownloads: |
|
321 |
{ |
|
322 |
iPodcastModel.ShowEngine().ResumeDownloadsL(); |
|
323 |
UpdateListboxItemsL(); |
|
324 |
} |
|
325 |
break; |
|
326 |
default: |
|
327 |
CPodcastListView::HandleCommandL(aCommand); |
|
328 |
break; |
|
329 |
} |
|
50 | 330 |
iListContainer->SetLongTapDetectedL(EFalse); // in case we got here by long tapping |
2 | 331 |
UpdateToolbar(); |
332 |
} |
|
333 |
||
334 |
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
|
335 |
{ |
2 | 336 |
if(aResourceId == R_PODCAST_SHOWSVIEW_MENU) |
337 |
{ |
|
338 |
aMenuPane->SetItemDimmed(EPodcastMarkAllPlayed, ETrue); |
|
339 |
} |
|
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
340 |
} |
2 | 341 |
|
13 | 342 |
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
|
343 |
{ |
2 | 344 |
CAknToolbar* toolbar = Toolbar(); |
345 |
||
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
346 |
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
|
347 |
{ |
13 | 348 |
RShowInfoArray &fItems = iPodcastModel.ActiveShowList(); |
349 |
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
|
350 |
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
|
351 |
{ |
14
4e75731546eb
Fix so toolbars only change visibility for the visible view
teknolog
parents:
13
diff
changeset
|
352 |
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
|
353 |
} |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
354 |
|
13 | 355 |
toolbar->HideItem(EPodcastRemoveAllDownloads, EFalse, ETrue); |
356 |
toolbar->SetItemDimmed(EPodcastRemoveAllDownloads, itemCnt == 0, ETrue); |
|
357 |
toolbar->HideItem(EPodcastSuspendDownloads,iPodcastModel.SettingsEngine().DownloadSuspended(), ETrue); |
|
358 |
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
|
359 |
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
|
360 |
} |
13 | 361 |
} |
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
362 |
|
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
363 |
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
|
364 |
{ |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
365 |
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
|
366 |
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
|
367 |
|
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
368 |
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
|
369 |
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
|
370 |
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
|
371 |
|
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
372 |
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
|
373 |
{ |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
374 |
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
|
375 |
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
|
376 |
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
|
377 |
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
|
378 |
|
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
379 |
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
|
380 |
iStylusPopupMenu->SetItemDimmed(EPodcastMoveDownloadUp, dimUp); |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
381 |
|
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
382 |
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
|
383 |
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
|
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 |
|
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
386 |
DP("CPodcastQueueView::HandleLongTapEventL END"); |
2 | 387 |
} |