author | Sebastian Brannstrom <sebastianb@symbian.org> |
Wed, 07 Jul 2010 14:19:21 +0100 | |
branch | symbian1 |
changeset 164 | 000f9fc147b2 |
parent 149 | 70b2f592a460 |
child 169 | 9c77455964f8 |
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 |
{ |
|
158 |
if (iListContainer->IsVisible()) |
|
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 |
{ |
|
60 | 252 |
TRAP_IGNORE(iPodcastModel.ShowEngine().RemoveDownloadL(iPodcastModel.ActiveShowList()[index]->Uid())); |
2 | 253 |
} |
254 |
} |
|
255 |
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
|
256 |
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
|
257 |
{ |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
258 |
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
|
259 |
TBool resumeAfterMove = EFalse; |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
260 |
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
|
261 |
{ |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
262 |
iPodcastModel.ShowEngine().SuspendDownloads(); |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
263 |
resumeAfterMove = ETrue; |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
264 |
} |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
265 |
|
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 |
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
|
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 |
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
|
269 |
} |
149
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
270 |
|
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
271 |
if(resumeAfterMove) |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
272 |
{ |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
273 |
iPodcastModel.ShowEngine().ResumeDownloadsL(); |
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 |
UpdateListboxItemsL(); |
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 |
break; |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
279 |
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
|
280 |
{ |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
281 |
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
|
282 |
TBool resumeAfterMove = EFalse; |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
283 |
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
|
284 |
{ |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
285 |
iPodcastModel.ShowEngine().SuspendDownloads(); |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
286 |
resumeAfterMove = ETrue; |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
287 |
} |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
288 |
|
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
289 |
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
|
290 |
{ |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
291 |
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
|
292 |
} |
149
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
293 |
|
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
294 |
if(resumeAfterMove) |
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().ResumeDownloadsL(); |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
297 |
} |
70b2f592a460
Enabled Brendan's download queue operations; Fixed minor bug in queue swapping method
teknolog
parents:
146
diff
changeset
|
298 |
|
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
299 |
UpdateListboxItemsL(); |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
300 |
} |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
301 |
break; |
2 | 302 |
case EPodcastSuspendDownloads: |
303 |
{ |
|
304 |
iPodcastModel.ShowEngine().SuspendDownloads(); |
|
305 |
UpdateListboxItemsL(); |
|
306 |
} |
|
307 |
break; |
|
308 |
case EPodcastResumeDownloads: |
|
309 |
{ |
|
310 |
iPodcastModel.ShowEngine().ResumeDownloadsL(); |
|
311 |
UpdateListboxItemsL(); |
|
312 |
} |
|
313 |
break; |
|
314 |
default: |
|
315 |
CPodcastListView::HandleCommandL(aCommand); |
|
316 |
break; |
|
317 |
} |
|
50 | 318 |
iListContainer->SetLongTapDetectedL(EFalse); // in case we got here by long tapping |
2 | 319 |
UpdateToolbar(); |
320 |
} |
|
321 |
||
322 |
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
|
323 |
{ |
2 | 324 |
if(aResourceId == R_PODCAST_SHOWSVIEW_MENU) |
325 |
{ |
|
326 |
aMenuPane->SetItemDimmed(EPodcastMarkAllPlayed, ETrue); |
|
327 |
} |
|
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
328 |
} |
2 | 329 |
|
13 | 330 |
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
|
331 |
{ |
2 | 332 |
CAknToolbar* toolbar = Toolbar(); |
333 |
||
145
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
334 |
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
|
335 |
{ |
13 | 336 |
RShowInfoArray &fItems = iPodcastModel.ActiveShowList(); |
337 |
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
|
338 |
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
|
339 |
{ |
14
4e75731546eb
Fix so toolbars only change visibility for the visible view
teknolog
parents:
13
diff
changeset
|
340 |
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
|
341 |
} |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
342 |
|
13 | 343 |
toolbar->HideItem(EPodcastRemoveAllDownloads, EFalse, ETrue); |
344 |
toolbar->SetItemDimmed(EPodcastRemoveAllDownloads, itemCnt == 0, ETrue); |
|
345 |
toolbar->HideItem(EPodcastSuspendDownloads,iPodcastModel.SettingsEngine().DownloadSuspended(), ETrue); |
|
346 |
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
|
347 |
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
|
348 |
} |
13 | 349 |
} |
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 |
|
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
351 |
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
|
352 |
{ |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
353 |
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
|
354 |
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
|
355 |
|
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
356 |
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
|
357 |
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
|
358 |
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
|
359 |
|
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
360 |
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
|
361 |
{ |
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
362 |
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
|
363 |
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
|
364 |
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
|
365 |
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
|
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 |
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
|
368 |
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
|
369 |
|
cc0182a5da39
Fix for Bug 2604 and bulk of the work towards implementing Bug 2737
Brendan Donegan <brendand@symbian.org>
parents:
70
diff
changeset
|
370 |
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
|
371 |
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
|
372 |
} |
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 |
DP("CPodcastQueueView::HandleLongTapEventL END"); |
2 | 375 |
} |