author | Sebastian Brannstrom <sebastianb@symbian.org> |
Mon, 01 Nov 2010 22:59:47 +0000 | |
branch | RCL_3 |
changeset 328 | 75a70f4a4f6d |
parent 323 | 0bd524909716 |
child 341 | a648d7ca5e27 |
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 "PodcastFeedView.h" |
|
20 |
#include "PodcastAppUi.h" |
|
21 |
#include "ShowEngine.h" |
|
22 |
#include "SettingsEngine.h" |
|
23 |
#include "PodcastApp.h" |
|
24 |
#include "PodcastUtils.h" |
|
25 |
#include "PodcastFeedViewUpdater.h" |
|
26 |
#include "Podcast.hrh" |
|
27 |
#include <caknfileselectiondialog.h> |
|
28 |
#include <podcast.rsg> |
|
29 |
#include <podcast.mbg> |
|
30 |
#include <gulicon.h> |
|
31 |
#include <aknquerydialog.h> |
|
32 |
#include <BAUTILS.H> |
|
33 |
#include <pathinfo.h> |
|
107
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
34 |
#include <akncommondialogsdynmem.h> |
114 | 35 |
#include "Podcatcher.pan" |
328
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
36 |
#include <aknmessagequerydialog.h> |
2 | 37 |
|
38 |
const TInt KMaxFeedNameLength = 100; |
|
39 |
const TInt KMaxUnplayedFeedsLength =64; |
|
40 |
const TInt KADayInHours = 24; |
|
41 |
#define KMaxMessageLength 200 |
|
42 |
#define KMaxTitleLength 100 |
|
43 |
||
313
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
44 |
_LIT(KFeedFormatPortrait, "%d\t%S\t%S%S"); |
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
45 |
//_LIT(KFeedFormatPortrait, "%d\t%S"); |
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
46 |
_LIT(KFeedFormatLandscape, "%d\t%S"); |
2 | 47 |
enum |
48 |
{ |
|
49 |
EFeedIcon |
|
50 |
}; |
|
51 |
||
52 |
CPodcastFeedView* CPodcastFeedView::NewL(CPodcastModel& aPodcastModel) |
|
53 |
{ |
|
54 |
CPodcastFeedView* self = CPodcastFeedView::NewLC(aPodcastModel); |
|
55 |
CleanupStack::Pop( self ); |
|
56 |
return self; |
|
57 |
} |
|
58 |
||
59 |
CPodcastFeedView* CPodcastFeedView::NewLC(CPodcastModel& aPodcastModel) |
|
60 |
{ |
|
61 |
CPodcastFeedView* self = new ( ELeave ) CPodcastFeedView(aPodcastModel); |
|
62 |
CleanupStack::PushL( self ); |
|
63 |
self->ConstructL(); |
|
64 |
return self; |
|
65 |
} |
|
66 |
||
314
e7776f6a2198
Dual listbox solution now mostly works
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
313
diff
changeset
|
67 |
void CPodcastFeedView::LoadIcons() |
e7776f6a2198
Dual listbox solution now mostly works
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
313
diff
changeset
|
68 |
{ |
313
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
69 |
iFeedIdForIconArray.Reset(); |
316 | 70 |
|
313
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
71 |
CFbsBitmap* bitmap = NULL; |
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
72 |
CFbsBitmap* mask = NULL; |
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
73 |
_LIT(KAsterisk, "*"); |
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
74 |
// Load the bitmap for empty icon |
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
75 |
TFileName fname; |
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
76 |
fname.Copy(KAsterisk); |
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
77 |
TParsePtr parser(fname); |
316 | 78 |
CArrayPtrFlat< CGulIcon > *iconArray= new(ELeave) CArrayPtrFlat< CGulIcon >(1); |
79 |
CleanupStack::PushL( iconArray ); |
|
313
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
80 |
|
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
81 |
// Load svg.-image and mask with a single call |
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
82 |
AknIconUtils::CreateIconL(bitmap, |
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
83 |
mask, |
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
84 |
iEikonEnv->EikAppUi()->Application()->BitmapStoreName(), |
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
85 |
EMbmPodcastFeed, |
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
86 |
EMbmPodcastFeed_mask); |
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
87 |
|
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
88 |
/*bitmap = iEikonEnv->CreateBitmapL(KAsterisk,EMbmPodcastFeed_40x40); |
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
89 |
* */ |
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
90 |
CleanupStack::PushL( bitmap ); |
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
91 |
// Load the mask for feed icon |
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
92 |
//mask = iEikonEnv->CreateBitmapL(KAsterisk,EMbmPodcastFeed_40x40m ); |
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
93 |
CleanupStack::PushL( mask ); |
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
94 |
// Append the feed icon to icon array |
316 | 95 |
iconArray->AppendL( CGulIcon::NewL( bitmap, mask ) ); |
313
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
96 |
CleanupStack::Pop(2); // bitmap, mask |
316 | 97 |
iListContainer->SetListboxIcons(iconArray); |
98 |
CleanupStack::Pop(iconArray); // icons |
|
313
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
99 |
} |
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
100 |
|
2 | 101 |
CPodcastFeedView::CPodcastFeedView(CPodcastModel& aPodcastModel):iPodcastModel(aPodcastModel) |
102 |
{ |
|
103 |
iFirstActivateAfterLaunch = ETrue; |
|
104 |
} |
|
105 |
#define KAsterisk iEikonEnv->EikAppUi()->Application()->BitmapStoreName() |
|
106 |
void CPodcastFeedView::ConstructL() |
|
107 |
{ |
|
108 |
DP("CPodcastFeedView::ConstructL BEGIN"); |
|
109 |
//_LIT(KAsterisk, "*"); |
|
110 |
BaseConstructL(R_PODCAST_FEEDVIEW); |
|
111 |
iNeverUpdated = iEikonEnv->AllocReadResourceL(R_PODCAST_FEEDS_NEVER_UPDATED); |
|
112 |
iFeedsFormat = iEikonEnv->AllocReadResourceL(R_PODCAST_FEEDS_STATUS_FORMAT); |
|
113 |
CPodcastListView::ConstructL(); |
|
114 |
iPodcastModel.FeedEngine().AddObserver(this); |
|
313
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
115 |
SetEmptyTextL(R_PODCAST_NO_FEEDS); |
2 | 116 |
|
314
e7776f6a2198
Dual listbox solution now mostly works
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
313
diff
changeset
|
117 |
LoadIcons(); |
2 | 118 |
|
119 |
iUpdater = CPodcastFeedViewUpdater::NewL(*this); |
|
120 |
DP("CPodcastFeedView::ConstructL END"); |
|
121 |
} |
|
122 |
||
123 |
CPodcastFeedView::~CPodcastFeedView() |
|
124 |
{ |
|
125 |
iPodcastModel.FeedEngine().RemoveObserver(this); |
|
126 |
delete iFeedsFormat; |
|
127 |
delete iNeverUpdated; |
|
128 |
delete iUpdater; |
|
94
8d36b7608232
Further updates to podcatchers handling of cached icons. Now cache the uid of icon in feedview and reuse if already cloned. Only one icon loaded anyway.
Lars Persson <lars.persson@embeddev.se>
parents:
93
diff
changeset
|
129 |
iFeedIdForIconArray.Close(); |
2 | 130 |
} |
131 |
||
132 |
void CPodcastFeedView::UpdateItemL(TInt aIndex) |
|
133 |
{ |
|
114 | 134 |
__ASSERT_DEBUG(iListContainer->IsVisible(), Panic(EPodcatcherPanicFeedView)); |
135 |
__ASSERT_ALWAYS(iItemIdArray.Count() > aIndex, Panic(EPodcatcherPanicFeedView)); |
|
2 | 136 |
|
137 |
const RFeedInfoArray& sortedItems = iPodcastModel.FeedEngine().GetSortedFeeds(); |
|
114 | 138 |
__ASSERT_ALWAYS(sortedItems.Count() > aIndex, Panic(EPodcatcherPanicFeedView)); |
2 | 139 |
|
140 |
// Update UID of for the feed at aIndex |
|
141 |
iItemIdArray[aIndex] = sortedItems[aIndex]->Uid(); |
|
142 |
||
143 |
// Prepare data to update the listbox item with |
|
306
a36dc474cae2
Fix so "Updating..." text remains for a feed when list is updated
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
302
diff
changeset
|
144 |
FormatFeedInfoListBoxItemL(*sortedItems[aIndex], sortedItems[aIndex]->Uid() == iFeedUpdating); |
2 | 145 |
|
146 |
// If nothing has changed, we are done here |
|
147 |
if (iListboxFormatbuffer == iItemArray->MdcaPoint(aIndex)) |
|
148 |
{ |
|
149 |
return; |
|
150 |
} |
|
151 |
||
152 |
// Something has changed, update the listbox item |
|
153 |
TListItemProperties itemProps; |
|
154 |
itemProps.SetDimmed(EFalse); |
|
155 |
iItemArray->Delete(aIndex); |
|
156 |
iItemArray->InsertL(aIndex, iListboxFormatbuffer); |
|
316 | 157 |
iItemArrayShort->Delete(aIndex); |
158 |
iItemArrayShort->InsertL(aIndex, iListboxFormatbufferShort); |
|
159 |
||
317
5afc95a6ad83
Stability fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
316
diff
changeset
|
160 |
//iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(aIndex, itemProps); |
2 | 161 |
// If item is visible, redraw it |
162 |
if (iListContainer->Listbox()->TopItemIndex() <= aIndex |
|
323
0bd524909716
Proper fix for bug 3875
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
320
diff
changeset
|
163 |
&& iListContainer->Listbox()->BottomItemIndex() > aIndex) |
2 | 164 |
{ |
165 |
iListContainer->Listbox()->DrawItem(aIndex); |
|
166 |
} |
|
167 |
} |
|
168 |
||
323
0bd524909716
Proper fix for bug 3875
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
320
diff
changeset
|
169 |
void CPodcastFeedView::UpdateItemsComplete() |
0bd524909716
Proper fix for bug 3875
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
320
diff
changeset
|
170 |
{ |
0bd524909716
Proper fix for bug 3875
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
320
diff
changeset
|
171 |
} |
0bd524909716
Proper fix for bug 3875
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
320
diff
changeset
|
172 |
|
2 | 173 |
TUid CPodcastFeedView::Id() const |
174 |
{ |
|
175 |
return KUidPodcastFeedViewID; |
|
176 |
} |
|
177 |
||
178 |
void CPodcastFeedView::DoActivateL(const TVwsViewId& aPrevViewId, |
|
179 |
TUid aCustomMessageId, |
|
180 |
const TDesC8& aCustomMessage) |
|
181 |
{ |
|
311
606f4f6babf6
Fix so feed icons are scaled nicely when rotating view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
306
diff
changeset
|
182 |
DP("CPodcastFeedView::DoActivateL BEGIN"); |
2 | 183 |
CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage); |
49
43e204e6ae2e
Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents:
33
diff
changeset
|
184 |
|
312
2faae209e72b
More elegant view handling between search view and feeds view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
311
diff
changeset
|
185 |
|
2faae209e72b
More elegant view handling between search view and feeds view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
311
diff
changeset
|
186 |
UpdateListboxItemsL(); |
2faae209e72b
More elegant view handling between search view and feeds view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
311
diff
changeset
|
187 |
UpdateToolbar(); |
2faae209e72b
More elegant view handling between search view and feeds view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
311
diff
changeset
|
188 |
|
25
ae65906c4347
Added feature to show showsview on return from queue if previously showed showsview
teknolog
parents:
24
diff
changeset
|
189 |
if (aPrevViewId.iViewUid == KUidPodcastShowsViewID) |
ae65906c4347
Added feature to show showsview on return from queue if previously showed showsview
teknolog
parents:
24
diff
changeset
|
190 |
{ |
ae65906c4347
Added feature to show showsview on return from queue if previously showed showsview
teknolog
parents:
24
diff
changeset
|
191 |
// back key from shows view |
ae65906c4347
Added feature to show showsview on return from queue if previously showed showsview
teknolog
parents:
24
diff
changeset
|
192 |
iViewingShows = EFalse; |
ae65906c4347
Added feature to show showsview on return from queue if previously showed showsview
teknolog
parents:
24
diff
changeset
|
193 |
} |
ae65906c4347
Added feature to show showsview on return from queue if previously showed showsview
teknolog
parents:
24
diff
changeset
|
194 |
|
312
2faae209e72b
More elegant view handling between search view and feeds view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
311
diff
changeset
|
195 |
// when we receive a UID argument, this comes from search view after |
2faae209e72b
More elegant view handling between search view and feeds view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
311
diff
changeset
|
196 |
// a new feed has been added |
2faae209e72b
More elegant view handling between search view and feeds view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
311
diff
changeset
|
197 |
if (aCustomMessageId.iUid != 0) |
2faae209e72b
More elegant view handling between search view and feeds view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
311
diff
changeset
|
198 |
{ |
2faae209e72b
More elegant view handling between search view and feeds view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
311
diff
changeset
|
199 |
TUint feedUid = aCustomMessageId.iUid; |
2faae209e72b
More elegant view handling between search view and feeds view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
311
diff
changeset
|
200 |
ShowItem(feedUid); |
2faae209e72b
More elegant view handling between search view and feeds view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
311
diff
changeset
|
201 |
TBuf<KMaxMessageLength> message; |
2faae209e72b
More elegant view handling between search view and feeds view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
311
diff
changeset
|
202 |
iEikonEnv->ReadResourceL(message, R_ADD_FEED_SUCCESS); |
2faae209e72b
More elegant view handling between search view and feeds view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
311
diff
changeset
|
203 |
if(ShowQueryMessageL(message)) |
2faae209e72b
More elegant view handling between search view and feeds view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
311
diff
changeset
|
204 |
{ |
2faae209e72b
More elegant view handling between search view and feeds view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
311
diff
changeset
|
205 |
iPodcastModel.FeedEngine().UpdateFeedL(feedUid); |
2faae209e72b
More elegant view handling between search view and feeds view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
311
diff
changeset
|
206 |
} |
2faae209e72b
More elegant view handling between search view and feeds view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
311
diff
changeset
|
207 |
} |
2faae209e72b
More elegant view handling between search view and feeds view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
311
diff
changeset
|
208 |
|
50 | 209 |
if (iFirstActivateAfterLaunch) |
210 |
{ |
|
211 |
iFirstActivateAfterLaunch = EFalse; |
|
2 | 212 |
} |
311
606f4f6babf6
Fix so feed icons are scaled nicely when rotating view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
306
diff
changeset
|
213 |
|
606f4f6babf6
Fix so feed icons are scaled nicely when rotating view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
306
diff
changeset
|
214 |
DP("CPodcastFeedView::DoActivateL END"); |
2 | 215 |
} |
216 |
||
217 |
void CPodcastFeedView::DoDeactivate() |
|
218 |
{ |
|
219 |
iUpdater->StopUpdate(); |
|
220 |
CPodcastListView::DoDeactivate(); |
|
221 |
} |
|
222 |
||
223 |
||
224 |
void CPodcastFeedView::HandleListBoxEventL(CEikListBox* /* aListBox */, TListBoxEvent aEventType) |
|
225 |
{ |
|
315 | 226 |
// DP("CPodcastFeedView::HandleListBoxEventL BEGIN"); |
2 | 227 |
|
228 |
switch(aEventType) |
|
229 |
{ |
|
137
eefed4bda2e2
Minor fixes to comply with single tap technical solution description. By this I consider bug 2056 closed.
teknolog
parents:
126
diff
changeset
|
230 |
case EEventItemSingleClicked: |
17
4bcc91e70483
Configuration changes to default podcasts. Changed Download to Get in toolbar
teknolog
parents:
14
diff
changeset
|
231 |
case EEventEnterKeyPressed: |
2 | 232 |
case EEventItemDoubleClicked: |
17
4bcc91e70483
Configuration changes to default podcasts. Changed Download to Get in toolbar
teknolog
parents:
14
diff
changeset
|
233 |
case EEventItemActioned: |
2 | 234 |
{ |
235 |
const RFeedInfoArray* sortedItems = NULL; |
|
236 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
237 |
sortedItems = &iPodcastModel.FeedEngine().GetSortedFeeds(); |
|
238 |
||
328
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
239 |
DP1("Desc: %S",&((*sortedItems)[index]->Description().Left(30))); |
2 | 240 |
if(index >= 0 && index < sortedItems->Count()) |
241 |
{ |
|
242 |
iPodcastModel.SetActiveFeedInfo((*sortedItems)[index]); |
|
25
ae65906c4347
Added feature to show showsview on return from queue if previously showed showsview
teknolog
parents:
24
diff
changeset
|
243 |
iViewingShows = ETrue; |
2 | 244 |
AppUi()->ActivateLocalViewL(KUidPodcastShowsViewID, TUid::Uid(0), KNullDesC8()); |
245 |
} |
|
246 |
} |
|
247 |
break; |
|
248 |
default: |
|
249 |
break; |
|
250 |
} |
|
315 | 251 |
// DP("CPodcastFeedView::HandleListBoxEventL END"); |
2 | 252 |
} |
253 |
||
254 |
void CPodcastFeedView::FeedUpdateAllCompleteL(TFeedState /*aState*/) |
|
255 |
{ |
|
306
a36dc474cae2
Fix so "Updating..." text remains for a feed when list is updated
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
302
diff
changeset
|
256 |
DP("FeedUpdateAllCompleteL"); |
a36dc474cae2
Fix so "Updating..." text remains for a feed when list is updated
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
302
diff
changeset
|
257 |
iFeedUpdating = 0; |
2 | 258 |
UpdateToolbar(); |
259 |
} |
|
260 |
||
261 |
void CPodcastFeedView::FeedDownloadStartedL(TFeedState /*aState*/, TUint aFeedUid) |
|
262 |
{ |
|
263 |
// Update status text |
|
306
a36dc474cae2
Fix so "Updating..." text remains for a feed when list is updated
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
302
diff
changeset
|
264 |
iFeedUpdating = aFeedUid; |
2 | 265 |
UpdateFeedInfoStatusL(aFeedUid, ETrue); |
266 |
||
267 |
UpdateToolbar(); |
|
268 |
} |
|
269 |
||
270 |
void CPodcastFeedView::FeedDownloadFinishedL(TFeedState aState,TUint aFeedUid, TInt aError) |
|
271 |
{ |
|
272 |
switch(aError) |
|
273 |
{ |
|
274 |
case KErrCouldNotConnect: |
|
275 |
{ |
|
276 |
if(aState == MFeedEngineObserver::EFeedManualUpdate) |
|
277 |
{ |
|
278 |
TBuf<KMaxMessageLength> message; |
|
279 |
iEikonEnv->ReadResourceL(message, R_PODCAST_CONNECTION_ERROR); |
|
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
26
diff
changeset
|
280 |
ShowErrorMessageL(message); |
2 | 281 |
} |
282 |
} |
|
283 |
break; |
|
284 |
default: // Do nothing |
|
285 |
break; |
|
286 |
} |
|
287 |
UpdateFeedInfoStatusL(aFeedUid, EFalse); |
|
288 |
} |
|
289 |
||
290 |
void CPodcastFeedView::UpdateFeedInfoStatusL(TUint aFeedUid, TBool aIsUpdating) |
|
291 |
{ |
|
316 | 292 |
DP("CPodcastFeedView::UpdateFeedInfoStatusL BEGIN"); |
2 | 293 |
const RFeedInfoArray& feeds = iPodcastModel.FeedEngine().GetSortedFeeds(); |
294 |
||
295 |
// Find the index for the feed i both the feed-array and the listbox |
|
296 |
TInt feedsIdx = KErrNotFound; |
|
297 |
TInt listboxIdx = KErrNotFound; |
|
298 |
for (TInt i = 0; i < feeds.Count(); i++) |
|
299 |
{ |
|
300 |
if (feeds[i]->Uid() == aFeedUid) |
|
301 |
{ |
|
302 |
feedsIdx = i; |
|
303 |
break; |
|
304 |
} |
|
305 |
} |
|
306 |
for (TInt j = 0; j < iItemIdArray.Count(); j++) |
|
307 |
{ |
|
308 |
if (iItemIdArray[j] == aFeedUid) |
|
309 |
{ |
|
310 |
listboxIdx = j; |
|
311 |
break; |
|
312 |
} |
|
313 |
} |
|
314 |
||
315 |
if (feedsIdx != KErrNotFound && listboxIdx != KErrNotFound) |
|
316 |
{ |
|
317 |
// TODO In the long run we want to move the sorting resposibility from |
|
318 |
// CFeedEngine to CPodcastFeedView. |
|
319 |
// Hackish fix to make sure the listbox is sorted. |
|
320 |
if (listboxIdx != feedsIdx) |
|
321 |
{ |
|
322 |
iItemIdArray.Remove(listboxIdx); |
|
323 |
iItemIdArray.InsertL(aFeedUid, feedsIdx); |
|
324 |
iItemArray->Delete(listboxIdx); |
|
325 |
iItemArray->InsertL(feedsIdx, KNullDesC); |
|
316 | 326 |
iItemArrayShort->Delete(listboxIdx); |
327 |
iItemArrayShort->InsertL(feedsIdx, KNullDesC); |
|
2 | 328 |
iListContainer->Listbox()->HandleItemAdditionL(); |
329 |
} |
|
330 |
// Update the listbox info |
|
331 |
UpdateFeedInfoDataL(feeds[feedsIdx], feedsIdx, aIsUpdating); |
|
332 |
//TODO sort the listbox after update |
|
333 |
} |
|
334 |
// Update all visible listbox items that are affected by sorting and update. |
|
335 |
TInt minIdx = Max(Min(feedsIdx, listboxIdx), iListContainer->Listbox()->TopItemIndex()); |
|
336 |
TInt maxIdx = Min(Max(feedsIdx, listboxIdx), iListContainer->Listbox()->BottomItemIndex()); |
|
337 |
for (TInt k = minIdx; k <= maxIdx; k++) |
|
338 |
{ |
|
339 |
iListContainer->Listbox()->DrawItem(k); |
|
340 |
} |
|
316 | 341 |
DP("CPodcastFeedView::UpdateFeedInfoStatusL END"); |
2 | 342 |
} |
343 |
||
344 |
void CPodcastFeedView::FormatFeedInfoListBoxItemL(CFeedInfo& aFeedInfo, TBool aIsUpdating) |
|
345 |
{ |
|
316 | 346 |
DP("CPodcastFeedView::FormatFeedInfoListBoxItemL BEGIN"); |
2 | 347 |
TBuf<KMaxShortDateFormatSpec*2> updatedDate; |
348 |
TBuf<KMaxUnplayedFeedsLength> unplayedShows; |
|
349 |
TUint unplayedCount = 0; |
|
350 |
TUint showCount = 0; |
|
351 |
TInt iconIndex = EFeedIcon; |
|
352 |
||
353 |
if(aIsUpdating) |
|
354 |
{ |
|
355 |
iEikonEnv->ReadResourceL(updatedDate, R_PODCAST_FEEDS_IS_UPDATING); |
|
356 |
unplayedShows = KNullDesC(); |
|
357 |
} |
|
358 |
else |
|
359 |
{ |
|
109 | 360 |
// we will get a leave if there are no shows for this feed, for instance, which is fine |
361 |
TRAP_IGNORE(iPodcastModel.FeedEngine().GetStatsByFeedL(aFeedInfo.Uid(), showCount, unplayedCount)); |
|
2 | 362 |
|
363 |
if (unplayedCount) { |
|
364 |
unplayedShows.Format(*iFeedsFormat, unplayedCount); |
|
365 |
} else { |
|
366 |
unplayedShows.Zero(); |
|
367 |
} |
|
368 |
||
369 |
if (aFeedInfo.LastUpdated().Int64() == 0) |
|
370 |
{ |
|
371 |
updatedDate.Copy(*iNeverUpdated); |
|
372 |
unplayedShows.Zero(); |
|
373 |
} |
|
374 |
else |
|
375 |
{ |
|
376 |
TTime now; |
|
377 |
TTimeIntervalHours interval; |
|
378 |
now.HomeTime(); |
|
379 |
now.HoursFrom(aFeedInfo.LastUpdated(), interval); |
|
380 |
if (interval.Int() < KADayInHours) |
|
381 |
{ |
|
382 |
aFeedInfo.LastUpdated().FormatL(updatedDate, KTimeFormat()); |
|
383 |
} |
|
384 |
else |
|
385 |
{ |
|
386 |
aFeedInfo.LastUpdated().FormatL(updatedDate, KDateFormatShort()); |
|
387 |
} |
|
388 |
} |
|
32
26a3f2dfba08
Fix for bug where we always load the feed icon a large number of times
teknolog
parents:
26
diff
changeset
|
389 |
|
26a3f2dfba08
Fix for bug where we always load the feed icon a large number of times
teknolog
parents:
26
diff
changeset
|
390 |
if(aFeedInfo.LastError() != KErrNone) |
26a3f2dfba08
Fix for bug where we always load the feed icon a large number of times
teknolog
parents:
26
diff
changeset
|
391 |
{ |
26a3f2dfba08
Fix for bug where we always load the feed icon a large number of times
teknolog
parents:
26
diff
changeset
|
392 |
GetFeedErrorText(unplayedShows, aFeedInfo.LastError()); |
112 | 393 |
updatedDate.Zero(); |
32
26a3f2dfba08
Fix for bug where we always load the feed icon a large number of times
teknolog
parents:
26
diff
changeset
|
394 |
} |
2 | 395 |
} |
313
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
396 |
|
94
8d36b7608232
Further updates to podcatchers handling of cached icons. Now cache the uid of icon in feedview and reuse if already cloned. Only one icon loaded anyway.
Lars Persson <lars.persson@embeddev.se>
parents:
93
diff
changeset
|
397 |
iconIndex = iFeedIdForIconArray.Find(aFeedInfo.Uid()); |
109 | 398 |
if(iconIndex == KErrNotFound && aFeedInfo.FeedIcon() != NULL && aFeedInfo.ImageFileName().Length() > 0 && |
93
bbf5c5204844
We always build the static version of sqlite for now. Further improvements for signaling when icons has been generated so these can be used in the feedview
Lars Persson <lars.persson@embeddev.se>
parents:
91
diff
changeset
|
399 |
aFeedInfo.FeedIcon()->SizeInPixels().iHeight > 0 && |
bbf5c5204844
We always build the static version of sqlite for now. Further improvements for signaling when icons has been generated so these can be used in the feedview
Lars Persson <lars.persson@embeddev.se>
parents:
91
diff
changeset
|
400 |
aFeedInfo.FeedIcon()->SizeInPixels().iWidth > 0) |
bbf5c5204844
We always build the static version of sqlite for now. Further improvements for signaling when icons has been generated so these can be used in the feedview
Lars Persson <lars.persson@embeddev.se>
parents:
91
diff
changeset
|
401 |
{ |
bbf5c5204844
We always build the static version of sqlite for now. Further improvements for signaling when icons has been generated so these can be used in the feedview
Lars Persson <lars.persson@embeddev.se>
parents:
91
diff
changeset
|
402 |
// Hopefully temporary haxx to prevent double delete. I would prefer if |
bbf5c5204844
We always build the static version of sqlite for now. Further improvements for signaling when icons has been generated so these can be used in the feedview
Lars Persson <lars.persson@embeddev.se>
parents:
91
diff
changeset
|
403 |
// this could be solved with a little better design. |
bbf5c5204844
We always build the static version of sqlite for now. Further improvements for signaling when icons has been generated so these can be used in the feedview
Lars Persson <lars.persson@embeddev.se>
parents:
91
diff
changeset
|
404 |
CFbsBitmap* bmpCopy = new (ELeave) CFbsBitmap; |
bbf5c5204844
We always build the static version of sqlite for now. Further improvements for signaling when icons has been generated so these can be used in the feedview
Lars Persson <lars.persson@embeddev.se>
parents:
91
diff
changeset
|
405 |
CleanupStack::PushL(bmpCopy); |
bbf5c5204844
We always build the static version of sqlite for now. Further improvements for signaling when icons has been generated so these can be used in the feedview
Lars Persson <lars.persson@embeddev.se>
parents:
91
diff
changeset
|
406 |
bmpCopy->Duplicate(aFeedInfo.FeedIcon()->Handle()); |
316 | 407 |
CArrayPtr<CGulIcon>* icons = iListContainer->ListboxIcons(); |
408 |
||
409 |
icons->AppendL( CGulIcon::NewL(AknIconUtils::CreateIconL(bmpCopy), NULL)); |
|
311
606f4f6babf6
Fix so feed icons are scaled nicely when rotating view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
306
diff
changeset
|
410 |
|
94
8d36b7608232
Further updates to podcatchers handling of cached icons. Now cache the uid of icon in feedview and reuse if already cloned. Only one icon loaded anyway.
Lars Persson <lars.persson@embeddev.se>
parents:
93
diff
changeset
|
411 |
iFeedIdForIconArray.Append(aFeedInfo.Uid()); |
93
bbf5c5204844
We always build the static version of sqlite for now. Further improvements for signaling when icons has been generated so these can be used in the feedview
Lars Persson <lars.persson@embeddev.se>
parents:
91
diff
changeset
|
412 |
CleanupStack::Pop(bmpCopy); |
316 | 413 |
iconIndex = icons->Count()-1; |
94
8d36b7608232
Further updates to podcatchers handling of cached icons. Now cache the uid of icon in feedview and reuse if already cloned. Only one icon loaded anyway.
Lars Persson <lars.persson@embeddev.se>
parents:
93
diff
changeset
|
414 |
} |
93
bbf5c5204844
We always build the static version of sqlite for now. Further improvements for signaling when icons has been generated so these can be used in the feedview
Lars Persson <lars.persson@embeddev.se>
parents:
91
diff
changeset
|
415 |
else |
bbf5c5204844
We always build the static version of sqlite for now. Further improvements for signaling when icons has been generated so these can be used in the feedview
Lars Persson <lars.persson@embeddev.se>
parents:
91
diff
changeset
|
416 |
{ |
94
8d36b7608232
Further updates to podcatchers handling of cached icons. Now cache the uid of icon in feedview and reuse if already cloned. Only one icon loaded anyway.
Lars Persson <lars.persson@embeddev.se>
parents:
93
diff
changeset
|
417 |
iconIndex++; |
8d36b7608232
Further updates to podcatchers handling of cached icons. Now cache the uid of icon in feedview and reuse if already cloned. Only one icon loaded anyway.
Lars Persson <lars.persson@embeddev.se>
parents:
93
diff
changeset
|
418 |
} |
93
bbf5c5204844
We always build the static version of sqlite for now. Further improvements for signaling when icons has been generated so these can be used in the feedview
Lars Persson <lars.persson@embeddev.se>
parents:
91
diff
changeset
|
419 |
|
112 | 420 |
if (unplayedShows.Length() > 0 && updatedDate.Length() > 0) { |
2 | 421 |
unplayedShows.Insert(0,_L(", ")); |
422 |
} |
|
313
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
423 |
|
314
e7776f6a2198
Dual listbox solution now mostly works
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
313
diff
changeset
|
424 |
iListboxFormatbuffer.Format(KFeedFormatPortrait(), iconIndex, &(aFeedInfo.Title()), &updatedDate, &unplayedShows); |
317
5afc95a6ad83
Stability fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
316
diff
changeset
|
425 |
iListboxFormatbufferShort.Format(KFeedFormatLandscape(), iconIndex, &(aFeedInfo.Title())); |
316 | 426 |
DP("CPodcastFeedView::FormatFeedInfoListBoxItemL END"); |
2 | 427 |
} |
428 |
||
93
bbf5c5204844
We always build the static version of sqlite for now. Further improvements for signaling when icons has been generated so these can be used in the feedview
Lars Persson <lars.persson@embeddev.se>
parents:
91
diff
changeset
|
429 |
void CPodcastFeedView::ImageOperationCompleteL(TInt aError, TUint aHandle, CPodcastModel& /*aPodcastModel*/) |
2 | 430 |
{ |
431 |
if (aError == KErrNone) { |
|
93
bbf5c5204844
We always build the static version of sqlite for now. Further improvements for signaling when icons has been generated so these can be used in the feedview
Lars Persson <lars.persson@embeddev.se>
parents:
91
diff
changeset
|
432 |
UpdateFeedInfoStatusL(aHandle, EFalse); |
bbf5c5204844
We always build the static version of sqlite for now. Further improvements for signaling when icons has been generated so these can be used in the feedview
Lars Persson <lars.persson@embeddev.se>
parents:
91
diff
changeset
|
433 |
} |
2 | 434 |
} |
435 |
||
436 |
void CPodcastFeedView::UpdateFeedInfoDataL(CFeedInfo* aFeedInfo, TInt aIndex, TBool aIsUpdating ) |
|
317
5afc95a6ad83
Stability fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
316
diff
changeset
|
437 |
{ |
5afc95a6ad83
Stability fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
316
diff
changeset
|
438 |
DP("CPodcastFeedView::UpdateFeedInfoDataL BEGIN"); |
2 | 439 |
TListItemProperties itemProps; |
440 |
itemProps.SetDimmed(aIsUpdating); |
|
441 |
FormatFeedInfoListBoxItemL(*aFeedInfo, aIsUpdating); |
|
442 |
||
443 |
TPtrC compareTo((*iItemArray)[aIndex]); |
|
444 |
||
445 |
if (iListboxFormatbuffer.Compare(compareTo) != 0) { |
|
446 |
iItemArray->Delete(aIndex); |
|
316 | 447 |
iItemArrayShort->Delete(aIndex); |
2 | 448 |
if(aIndex>= iItemArray->MdcaCount()) |
449 |
{ |
|
450 |
iItemArray->AppendL(iListboxFormatbuffer); |
|
316 | 451 |
iItemArrayShort->AppendL(iListboxFormatbufferShort); |
2 | 452 |
} |
453 |
else |
|
454 |
{ |
|
455 |
iItemArray->InsertL(aIndex, iListboxFormatbuffer); |
|
316 | 456 |
iItemArrayShort->InsertL(aIndex, iListboxFormatbufferShort); |
2 | 457 |
} |
458 |
} |
|
317
5afc95a6ad83
Stability fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
316
diff
changeset
|
459 |
//iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(aIndex, itemProps); |
5afc95a6ad83
Stability fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
316
diff
changeset
|
460 |
DP("CPodcastFeedView::UpdateFeedInfoDataL END"); |
2 | 461 |
} |
462 |
||
463 |
||
464 |
void CPodcastFeedView::UpdateListboxItemsL() |
|
465 |
{ |
|
153
1d3315159ef5
Fix for bug 3051 - search wait dialog doesn't close if search fails; some extra debugging output added
teknolog
parents:
137
diff
changeset
|
466 |
DP("CPodcastFeedView::UpdateListboxItemsL BEGIN"); |
2 | 467 |
// No reason to do any work if it isn't going to show.. |
468 |
if(!iListContainer->IsVisible()) |
|
469 |
{ |
|
470 |
return; |
|
471 |
} |
|
472 |
||
473 |
TInt nbrItems = iPodcastModel.FeedEngine().GetSortedFeeds().Count(); |
|
474 |
if (nbrItems > 0) |
|
475 |
{ |
|
476 |
// Ensure that there are as many elements in iItemIdArray as in FeedEngine |
|
477 |
while (iItemIdArray.Count() < nbrItems) |
|
478 |
{ |
|
479 |
iItemIdArray.AppendL(0); |
|
480 |
} |
|
481 |
while (iItemIdArray.Count() > nbrItems) |
|
482 |
{ |
|
483 |
iItemIdArray.Remove(iItemIdArray.Count() - 1); |
|
484 |
} |
|
485 |
||
486 |
// Ensure that there are as many elements in iItemArray as in FeedEngine |
|
487 |
while (iItemArray->Count() < nbrItems) |
|
488 |
{ |
|
489 |
iItemArray->AppendL(KNullDesC); |
|
316 | 490 |
iItemArrayShort->AppendL(KNullDesC); |
2 | 491 |
TListItemProperties itemProps; |
317
5afc95a6ad83
Stability fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
316
diff
changeset
|
492 |
//iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(iItemArray->Count() - 1, itemProps); |
2 | 493 |
} |
494 |
while (iItemArray->Count() > nbrItems) |
|
495 |
{ |
|
496 |
iItemArray->Delete(iItemArray->Count() - 1); |
|
316 | 497 |
iItemArrayShort->Delete(iItemArray->Count() - 1); |
2 | 498 |
} |
313
0f30a75610de
First implementation of two listboxes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
312
diff
changeset
|
499 |
//iListContainer->Listbox()-> |
2 | 500 |
iUpdater->StartUpdate(nbrItems); |
501 |
} |
|
502 |
else |
|
503 |
{ |
|
504 |
// No feeds at all in the list , add dummy list item |
|
505 |
TBuf<KMaxFeedNameLength> itemName; |
|
506 |
iEikonEnv->ReadResourceL(itemName, R_PODCAST_FEEDS_NO_FEEDS); |
|
507 |
iItemArray->Reset(); |
|
316 | 508 |
iItemArrayShort->Reset(); |
2 | 509 |
iItemIdArray.Reset(); |
510 |
||
511 |
TListItemProperties itemProps; |
|
512 |
itemProps.SetDimmed(ETrue); |
|
513 |
itemProps.SetHiddenSelection(ETrue); |
|
317
5afc95a6ad83
Stability fixes
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
316
diff
changeset
|
514 |
//iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(0, itemProps); |
2 | 515 |
} |
153
1d3315159ef5
Fix for bug 3051 - search wait dialog doesn't close if search fails; some extra debugging output added
teknolog
parents:
137
diff
changeset
|
516 |
iListContainer->Listbox()->HandleItemAdditionL(); |
1d3315159ef5
Fix for bug 3051 - search wait dialog doesn't close if search fails; some extra debugging output added
teknolog
parents:
137
diff
changeset
|
517 |
DP("CPodcastFeedView::UpdateListboxItemsL END"); |
2 | 518 |
} |
519 |
||
520 |
/** |
|
521 |
* Command handling function intended for overriding by sub classes. |
|
522 |
* Default implementation is empty. |
|
523 |
* @param aCommand ID of the command to respond to. |
|
524 |
*/ |
|
525 |
void CPodcastFeedView::HandleCommandL(TInt aCommand) |
|
526 |
{ |
|
153
1d3315159ef5
Fix for bug 3051 - search wait dialog doesn't close if search fails; some extra debugging output added
teknolog
parents:
137
diff
changeset
|
527 |
DP("CPodcastFeedView::HandleCommandL BEGIN"); |
1d3315159ef5
Fix for bug 3051 - search wait dialog doesn't close if search fails; some extra debugging output added
teknolog
parents:
137
diff
changeset
|
528 |
|
2 | 529 |
switch(aCommand) |
530 |
{ |
|
531 |
case EPodcastAddFeed: |
|
532 |
HandleAddFeedL(); |
|
533 |
break; |
|
534 |
case EPodcastImportFeeds: |
|
535 |
HandleImportFeedsL(); |
|
536 |
break; |
|
537 |
case EPodcastExportFeeds: |
|
538 |
HandleExportFeedsL(); |
|
539 |
break; |
|
540 |
case EPodcastEditFeed: |
|
541 |
HandleEditFeedL(); |
|
542 |
break; |
|
543 |
case EPodcastDeleteFeedHardware: |
|
544 |
case EPodcastDeleteFeed: |
|
545 |
HandleRemoveFeedL(); |
|
546 |
break; |
|
547 |
case EPodcastUpdateAllFeeds: |
|
548 |
{ |
|
315 | 549 |
iPodcastModel.FeedEngine().UpdateAllFeedsL(); |
550 |
UpdateToolbar(); |
|
2 | 551 |
}break; |
552 |
case EPodcastUpdateFeed: |
|
553 |
{ |
|
554 |
HandleUpdateFeedL(); |
|
555 |
}break; |
|
556 |
case EPodcastCancelUpdateAllFeeds: |
|
557 |
{ |
|
306
a36dc474cae2
Fix so "Updating..." text remains for a feed when list is updated
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
302
diff
changeset
|
558 |
if(iFeedUpdating) |
2 | 559 |
{ |
560 |
iPodcastModel.FeedEngine().CancelUpdateAllFeeds(); |
|
561 |
} |
|
562 |
}break; |
|
328
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
563 |
case EPodcastShowInfo: |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
564 |
DisplayFeedInfoDialogL(); |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
565 |
break; |
2 | 566 |
default: |
567 |
CPodcastListView::HandleCommandL(aCommand); |
|
568 |
break; |
|
569 |
} |
|
26 | 570 |
|
2 | 571 |
UpdateToolbar(); |
153
1d3315159ef5
Fix for bug 3051 - search wait dialog doesn't close if search fails; some extra debugging output added
teknolog
parents:
137
diff
changeset
|
572 |
DP("CPodcastFeedView::HandleCommandL END"); |
2 | 573 |
} |
574 |
||
328
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
575 |
void CPodcastFeedView::DisplayFeedInfoDialogL() |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
576 |
{ |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
577 |
const RFeedInfoArray* sortedItems = NULL; |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
578 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
579 |
sortedItems = &iPodcastModel.FeedEngine().GetSortedFeeds(); |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
580 |
|
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
581 |
if(index >= 0 && index < sortedItems->Count()) |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
582 |
{ |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
583 |
CFeedInfo *info = (*sortedItems)[index]; |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
584 |
HBufC* description = info->Description().AllocL(); |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
585 |
HBufC* title = info->Title().AllocL(); |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
586 |
CAknMessageQueryDialog* note = new ( ELeave ) CAknMessageQueryDialog( description, title ); |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
587 |
|
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
588 |
note->PrepareLC( R_SHOW_INFO_NOTE ); // Adds to CleanupStack |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
589 |
note->RunLD(); |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
590 |
} |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
591 |
} |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
592 |
|
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
593 |
void CPodcastFeedView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane) |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
594 |
{ |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
595 |
if(aResourceId == R_PODCAST_FEEDVIEW_MENU) |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
596 |
{ |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
597 |
const RFeedInfoArray* sortedItems = NULL; |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
598 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
599 |
sortedItems = &iPodcastModel.FeedEngine().GetSortedFeeds(); |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
600 |
|
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
601 |
if(index >= 0 && index < sortedItems->Count()) |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
602 |
{ |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
603 |
CFeedInfo *info = (*sortedItems)[index]; |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
604 |
aMenuPane->SetItemDimmed(EPodcastShowInfo, !info->Description().Length()); |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
605 |
} |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
606 |
} |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
607 |
} |
75a70f4a4f6d
Fix for bug 2060 - added info view for feeds
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
323
diff
changeset
|
608 |
|
13 | 609 |
void CPodcastFeedView::UpdateToolbar(TBool aVisible) |
2 | 610 |
{ |
153
1d3315159ef5
Fix for bug 3051 - search wait dialog doesn't close if search fails; some extra debugging output added
teknolog
parents:
137
diff
changeset
|
611 |
DP("CPodcastFeedView::UpdateToolbar BEGIN"); |
2 | 612 |
CAknToolbar* toolbar = Toolbar(); |
613 |
||
614 |
if (toolbar) |
|
615 |
{ |
|
14
4e75731546eb
Fix so toolbars only change visibility for the visible view
teknolog
parents:
13
diff
changeset
|
616 |
if (iListContainer->IsVisible()) { |
4e75731546eb
Fix so toolbars only change visibility for the visible view
teknolog
parents:
13
diff
changeset
|
617 |
toolbar->SetToolbarVisibility(aVisible); |
4e75731546eb
Fix so toolbars only change visibility for the visible view
teknolog
parents:
13
diff
changeset
|
618 |
} |
306
a36dc474cae2
Fix so "Updating..." text remains for a feed when list is updated
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
302
diff
changeset
|
619 |
toolbar->HideItem(EPodcastUpdateAllFeeds, iFeedUpdating, ETrue); |
a36dc474cae2
Fix so "Updating..." text remains for a feed when list is updated
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
302
diff
changeset
|
620 |
toolbar->HideItem(EPodcastCancelUpdateAllFeeds, !iFeedUpdating, ETrue ); |
a36dc474cae2
Fix so "Updating..." text remains for a feed when list is updated
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
302
diff
changeset
|
621 |
toolbar->SetItemDimmed(EPodcastAddFeed, iFeedUpdating, ETrue ); |
a36dc474cae2
Fix so "Updating..." text remains for a feed when list is updated
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
302
diff
changeset
|
622 |
toolbar->SetItemDimmed(EPodcastSettings, iFeedUpdating, ETrue ); |
2 | 623 |
} |
153
1d3315159ef5
Fix for bug 3051 - search wait dialog doesn't close if search fails; some extra debugging output added
teknolog
parents:
137
diff
changeset
|
624 |
DP("CPodcastFeedView::UpdateToolbar END"); |
2 | 625 |
} |
626 |
||
627 |
void CPodcastFeedView::HandleAddFeedL() |
|
628 |
{ |
|
207
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
629 |
TInt selection; |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
630 |
CDesCArrayFlat* array = iCoeEnv->ReadDesC16ArrayResourceL(R_FEEDVIEW_ADD_URL_OR_SEARCH_ARRAY ); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
631 |
CleanupStack::PushL( array ); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
632 |
|
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
633 |
CAknListQueryDialog* dialog = new ( ELeave ) CAknListQueryDialog( &selection ); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
634 |
CleanupStack::PushL( dialog ); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
635 |
dialog->PrepareLC( R_FEEDVIEW_ADD_URL_OR_SEARCH ); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
636 |
CleanupStack::Pop( dialog ); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
637 |
|
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
638 |
dialog->SetItemTextArray( array ); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
639 |
dialog->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
640 |
|
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
641 |
if ( dialog->RunLD() ) |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
642 |
{ |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
643 |
if (selection == 0) |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
644 |
{ |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
645 |
// Enter URL selected |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
646 |
HandleAddFeedUrlL(); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
647 |
} |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
648 |
else |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
649 |
{ |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
650 |
// Search selected |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
651 |
HandleAddFeedSearchL(); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
652 |
} |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
653 |
} |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
654 |
CleanupStack::PopAndDestroy( array ); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
655 |
} |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
656 |
|
311
606f4f6babf6
Fix so feed icons are scaled nicely when rotating view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
306
diff
changeset
|
657 |
void CPodcastFeedView::ShowItem(TUint aUid) |
606f4f6babf6
Fix so feed icons are scaled nicely when rotating view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
306
diff
changeset
|
658 |
{ |
606f4f6babf6
Fix so feed icons are scaled nicely when rotating view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
306
diff
changeset
|
659 |
TInt listIndex = -1; |
606f4f6babf6
Fix so feed icons are scaled nicely when rotating view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
306
diff
changeset
|
660 |
for (TUint i=0;i<iItemIdArray.Count();i++) |
606f4f6babf6
Fix so feed icons are scaled nicely when rotating view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
306
diff
changeset
|
661 |
{ |
606f4f6babf6
Fix so feed icons are scaled nicely when rotating view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
306
diff
changeset
|
662 |
if (iItemIdArray[i] == aUid) |
606f4f6babf6
Fix so feed icons are scaled nicely when rotating view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
306
diff
changeset
|
663 |
{ |
606f4f6babf6
Fix so feed icons are scaled nicely when rotating view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
306
diff
changeset
|
664 |
listIndex = i; |
606f4f6babf6
Fix so feed icons are scaled nicely when rotating view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
306
diff
changeset
|
665 |
} |
606f4f6babf6
Fix so feed icons are scaled nicely when rotating view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
306
diff
changeset
|
666 |
} |
606f4f6babf6
Fix so feed icons are scaled nicely when rotating view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
306
diff
changeset
|
667 |
|
606f4f6babf6
Fix so feed icons are scaled nicely when rotating view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
306
diff
changeset
|
668 |
if (listIndex != -1) |
606f4f6babf6
Fix so feed icons are scaled nicely when rotating view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
306
diff
changeset
|
669 |
iListContainer->Listbox()->ScrollToMakeItemVisible(listIndex); |
606f4f6babf6
Fix so feed icons are scaled nicely when rotating view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
306
diff
changeset
|
670 |
|
606f4f6babf6
Fix so feed icons are scaled nicely when rotating view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
306
diff
changeset
|
671 |
} |
606f4f6babf6
Fix so feed icons are scaled nicely when rotating view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
306
diff
changeset
|
672 |
|
207
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
673 |
void CPodcastFeedView::HandleAddFeedUrlL() |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
674 |
{ |
2 | 675 |
TBuf<KFeedUrlLength> url; |
676 |
url.Copy(_L("http://")); |
|
207
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
677 |
|
2 | 678 |
CAknTextQueryDialog * dlg =CAknTextQueryDialog::NewL(url); |
679 |
dlg->PrepareLC(R_PODCAST_ADD_FEED_DLG); |
|
207
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
680 |
|
2 | 681 |
HBufC* prompt = iEikonEnv->AllocReadResourceLC(R_PODCAST_ADDFEED_PROMPT); |
682 |
dlg->SetPromptL(*prompt); |
|
683 |
CleanupStack::PopAndDestroy(prompt); |
|
684 |
||
685 |
if(dlg->RunLD()) |
|
686 |
{ |
|
207
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
687 |
PodcastUtils::FixProtocolsL(url); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
688 |
|
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
689 |
CFeedInfo* newFeedInfo = CFeedInfo::NewL(); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
690 |
CleanupStack::PushL(newFeedInfo); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
691 |
newFeedInfo->SetUrlL(url); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
692 |
newFeedInfo->SetTitleL(newFeedInfo->Url()); |
2 | 693 |
|
207
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
694 |
TBool added = iPodcastModel.FeedEngine().AddFeedL(*newFeedInfo); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
695 |
|
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
696 |
if (added) |
2 | 697 |
{ |
207
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
698 |
UpdateListboxItemsL(); |
153
1d3315159ef5
Fix for bug 3051 - search wait dialog doesn't close if search fails; some extra debugging output added
teknolog
parents:
137
diff
changeset
|
699 |
|
207
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
700 |
// ask if users wants to update it now |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
701 |
TBuf<KMaxMessageLength> message; |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
702 |
iEikonEnv->ReadResourceL(message, R_ADD_FEED_SUCCESS); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
703 |
if(ShowQueryMessageL(message)) |
153
1d3315159ef5
Fix for bug 3051 - search wait dialog doesn't close if search fails; some extra debugging output added
teknolog
parents:
137
diff
changeset
|
704 |
{ |
311
606f4f6babf6
Fix so feed icons are scaled nicely when rotating view
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
306
diff
changeset
|
705 |
ShowItem(newFeedInfo->Uid()); |
207
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
706 |
iPodcastModel.FeedEngine().UpdateFeedL(newFeedInfo->Uid()); |
153
1d3315159ef5
Fix for bug 3051 - search wait dialog doesn't close if search fails; some extra debugging output added
teknolog
parents:
137
diff
changeset
|
707 |
} |
2 | 708 |
} |
709 |
else |
|
710 |
{ |
|
207
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
711 |
TBuf<KMaxMessageLength> message; |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
712 |
iEikonEnv->ReadResourceL(message, R_ADD_FEED_EXISTS); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
713 |
ShowErrorMessageL(message); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
714 |
} |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
715 |
|
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
716 |
CleanupStack::PopAndDestroy(newFeedInfo); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
717 |
} |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
718 |
} |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
719 |
|
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
720 |
void CPodcastFeedView::HandleAddFeedSearchL() |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
721 |
{ |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
722 |
TBuf<KFeedUrlLength> url; |
2 | 723 |
|
207
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
724 |
CAknTextQueryDialog * dlg =CAknTextQueryDialog::NewL(url); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
725 |
dlg->PrepareLC(R_PODCAST_ADD_FEED_DLG); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
726 |
|
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
727 |
HBufC* prompt = iEikonEnv->AllocReadResourceLC(R_PODCAST_SEARCHFEED_PROMPT); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
728 |
dlg->SetPromptL(*prompt); |
272
e6d095ba6756
Icons in tabs
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
243
diff
changeset
|
729 |
dlg->SetPredictiveTextInputPermitted(ETrue); |
207
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
730 |
CleanupStack::PopAndDestroy(prompt); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
731 |
|
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
732 |
if(dlg->RunLD()) |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
733 |
{ |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
734 |
HBufC *waitText = iEikonEnv->AllocReadResourceLC(R_SEARCHING); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
735 |
ShowWaitDialogL(*waitText); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
736 |
CleanupStack::PopAndDestroy(waitText); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
737 |
|
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
738 |
iOpmlState = EOpmlSearching; |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
739 |
TRAPD(err, iPodcastModel.FeedEngine().SearchForFeedL(url)); |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
740 |
|
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
741 |
if (err != KErrNone) |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
742 |
{ |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
743 |
delete iWaitDialog; |
9fef0425017e
Bug 2865 - added option to search or enter URL for feed adding
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
744 |
iOpmlState = EOpmlIdle; |
2 | 745 |
} |
746 |
} |
|
747 |
} |
|
748 |
||
749 |
void CPodcastFeedView::HandleEditFeedL() |
|
750 |
{ |
|
751 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
752 |
||
753 |
if(index < iItemArray->MdcaCount() && index >= 0) |
|
754 |
{ |
|
755 |
CFeedInfo *info = iPodcastModel.FeedEngine().GetSortedFeeds()[index]; |
|
756 |
||
757 |
TBuf<KFeedTitleLength> title; |
|
758 |
title.Copy(info->Title()); |
|
759 |
TBuf<KFeedUrlLength> url; |
|
760 |
url.Copy(info->Url()); |
|
761 |
CAknMultiLineDataQueryDialog *dlg = CAknMultiLineDataQueryDialog ::NewL(title, url); |
|
762 |
||
763 |
if (dlg->ExecuteLD(R_PODCAST_EDIT_FEED_DLG)) |
|
764 |
{ |
|
765 |
||
766 |
if(info->Url().Compare(url) != 0) |
|
767 |
{ |
|
768 |
TBuf<KMaxMessageLength> dlgMessage; |
|
769 |
iEikonEnv->ReadResourceL(dlgMessage, R_ADD_FEED_REPLACE); |
|
770 |
||
771 |
// Ask the user if it is OK to remove all shows |
|
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
26
diff
changeset
|
772 |
if ( ShowQueryMessageL(dlgMessage)) |
2 | 773 |
{ |
774 |
PodcastUtils::FixProtocolsL(url); |
|
775 |
||
776 |
//----- HACK ---- // |
|
777 |
CFeedInfo* temp = CFeedInfo::NewLC(); |
|
778 |
temp->SetUrlL(url); |
|
779 |
TBool added = iPodcastModel.FeedEngine().AddFeedL(*temp); |
|
780 |
if (added) { |
|
781 |
// The Feed URL did not exist |
|
782 |
// Remove the temp entry so that the correct entry could be changed |
|
783 |
iPodcastModel.FeedEngine().RemoveFeedL(temp->Uid()); |
|
784 |
||
12 | 785 |
// we remove the existing feed |
786 |
iPodcastModel.FeedEngine().RemoveFeedL(info->Uid()); |
|
787 |
||
788 |
CFeedInfo* newFeed = CFeedInfo::NewLC(); |
|
789 |
newFeed->SetUrlL(url); |
|
790 |
newFeed->SetTitleL(title); |
|
791 |
||
792 |
iPodcastModel.FeedEngine().AddFeedL(*newFeed); |
|
793 |
CleanupStack::PopAndDestroy(newFeed); |
|
2 | 794 |
UpdateListboxItemsL(); |
795 |
} else { |
|
796 |
// the feed existed. Object deleted in AddFeed. |
|
797 |
TBuf<KMaxMessageLength> dlgMessage; |
|
798 |
iEikonEnv->ReadResourceL(dlgMessage, R_ADD_FEED_EXISTS); |
|
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
26
diff
changeset
|
799 |
ShowErrorMessageL(dlgMessage); |
2 | 800 |
} |
801 |
CleanupStack::PopAndDestroy(temp); |
|
802 |
} |
|
803 |
} else { // no url change, maybe title? |
|
804 |
// Update the title |
|
805 |
if (info->Title().Compare(title) != 0) |
|
806 |
{ |
|
807 |
info->SetTitleL(title); |
|
808 |
info->SetCustomTitle(); |
|
102 | 809 |
iPodcastModel.FeedEngine().UpdateFeedInfoL(info); |
2 | 810 |
UpdateListboxItemsL(); |
811 |
} |
|
812 |
} |
|
813 |
} |
|
814 |
} |
|
815 |
} |
|
816 |
||
817 |
void CPodcastFeedView::HandleRemoveFeedL() |
|
818 |
{ |
|
819 |
if(iListContainer->Listbox() != NULL) |
|
820 |
{ |
|
821 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
822 |
||
823 |
if(index < iItemArray->MdcaCount() && index >= 0) |
|
824 |
{ |
|
825 |
CFeedInfo *info = iPodcastModel.FeedEngine().GetFeedInfoByUid(iItemIdArray[index]); |
|
826 |
TBuf<KMaxMessageLength> templ; |
|
827 |
TBuf<KMaxMessageLength> message; |
|
828 |
iEikonEnv->ReadResourceL(templ, R_PODCAST_REMOVE_FEED_PROMPT); |
|
829 |
message.Format(templ, &info->Title()); |
|
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
26
diff
changeset
|
830 |
if(ShowQueryMessageL(message)) |
2 | 831 |
{ |
832 |
iPodcastModel.FeedEngine().RemoveFeedL(iItemIdArray[index]); |
|
833 |
iItemArray->Delete(index); |
|
316 | 834 |
iItemArrayShort->Delete(index); |
2 | 835 |
iItemIdArray.Remove(index); |
836 |
iListContainer->Listbox()->HandleItemRemovalL(); |
|
837 |
iListContainer->Listbox()->DrawNow(); |
|
838 |
} |
|
839 |
} |
|
840 |
UpdateListboxItemsL(); |
|
841 |
} |
|
842 |
} |
|
843 |
||
844 |
void CPodcastFeedView::HandleUpdateFeedL() |
|
845 |
{ |
|
846 |
TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
847 |
||
848 |
if(index < iItemArray->MdcaCount() && index >= 0) |
|
849 |
{ |
|
850 |
CFeedInfo *info = iPodcastModel.FeedEngine().GetSortedFeeds()[index]; |
|
851 |
iPodcastModel.FeedEngine().UpdateFeedL(info->Uid()); |
|
852 |
} |
|
853 |
} |
|
854 |
||
855 |
void CPodcastFeedView::HandleImportFeedsL() |
|
856 |
{ |
|
107
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
857 |
TFileName fileName; |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
858 |
fileName.Zero(); |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
859 |
TFileName startFolder; |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
860 |
startFolder.Zero(); |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
861 |
TInt types = AknCommonDialogsDynMem::EMemoryTypePhone | AknCommonDialogsDynMem::EMemoryTypeMMC |AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage| AknCommonDialogsDynMem::EMemoryTypeRemote; |
2 | 862 |
|
107
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
863 |
HBufC *title = iCoeEnv->AllocReadResourceLC(R_PODCAST_SELECT_OPML); |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
864 |
if (AknCommonDialogsDynMem::RunSelectDlgLD (types, fileName, |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
865 |
startFolder, NULL, NULL, *title)) |
2 | 866 |
{ |
107
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
867 |
|
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
868 |
if(fileName.Length()>0) |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
869 |
{ |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
870 |
HBufC *waitText = iEikonEnv->AllocReadResourceLC(R_IMPORTING); |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
871 |
iOpmlState = EOpmlImporting; |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
872 |
ShowWaitDialogL(*waitText); |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
873 |
CleanupStack::PopAndDestroy(waitText); |
2 | 874 |
|
107
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
875 |
TRAPD(err, iPodcastModel.FeedEngine().ImportFeedsL(fileName)); |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
876 |
|
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
877 |
if (err != KErrNone) { |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
878 |
TBuf<KMaxMessageLength> message; |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
879 |
iEikonEnv->ReadResourceL(message, R_IMPORT_FEED_FAILURE); |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
880 |
ShowErrorMessageL(message); |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
881 |
} |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
882 |
} |
2 | 883 |
|
884 |
} |
|
107
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
885 |
CleanupStack::PopAndDestroy(title); |
2 | 886 |
} |
887 |
||
888 |
void CPodcastFeedView::HandleExportFeedsL() |
|
889 |
{ |
|
107
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
890 |
TFileName fileName; |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
891 |
fileName.Copy(_L("feeds.opml")); |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
892 |
TFileName startFolder; |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
893 |
startFolder.Zero(); |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
894 |
TInt types = AknCommonDialogsDynMem::EMemoryTypePhone | AknCommonDialogsDynMem::EMemoryTypeMMC |AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage| AknCommonDialogsDynMem::EMemoryTypeRemote; |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
895 |
|
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
896 |
HBufC *title = iCoeEnv->AllocReadResourceLC(R_PODCAST_SELECT_FOLDER); |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
897 |
if (AknCommonDialogsDynMem::RunSaveDlgLD (types, fileName, |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
898 |
startFolder, NULL, NULL, *title)) |
2 | 899 |
{ |
107
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
900 |
TFileName temp; |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
901 |
TRAPD(err, iPodcastModel.FeedEngine().ExportFeedsL(temp)); |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
902 |
BaflUtils::CopyFile(iEikonEnv->FsSession(), temp, fileName); |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
903 |
BaflUtils::DeleteFile(iEikonEnv->FsSession(),temp); |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
904 |
if (err == KErrNone) |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
905 |
{ |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
906 |
UpdateListboxItemsL(); |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
907 |
TInt numFeeds = iPodcastModel.FeedEngine().GetSortedFeeds().Count(); |
2 | 908 |
|
107
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
909 |
TBuf<KMaxMessageLength> message; |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
910 |
TBuf<KMaxMessageLength> templ; |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
911 |
iEikonEnv->ReadResourceL(templ, R_EXPORT_FEED_SUCCESS); |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
912 |
message.Format(templ, numFeeds); |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
913 |
ShowOkMessageL(message); |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
914 |
} |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
915 |
else |
2 | 916 |
{ |
107
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
917 |
TBuf<KMaxMessageLength> message; |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
918 |
iEikonEnv->ReadResourceL(message, R_EXPORT_FEED_FAILURE); |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
919 |
ShowErrorMessageL(message); |
2 | 920 |
} |
107
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
921 |
} |
af6475fdf8d6
Improved error handling; Implemented support for more than 2 flash drives also for import/export feeds
teknolog
parents:
102
diff
changeset
|
922 |
CleanupStack::PopAndDestroy(title); |
2 | 923 |
} |
924 |
||
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
26
diff
changeset
|
925 |
void CPodcastFeedView::CheckResumeDownloadL() |
2 | 926 |
{ |
927 |
// if there are shows queued for downloading, ask if we should resume now |
|
928 |
RShowInfoArray showsDownloading; |
|
929 |
iPodcastModel.ShowEngine().GetShowsDownloadingL(showsDownloading); |
|
930 |
||
931 |
if (showsDownloading.Count() > 0) |
|
932 |
{ |
|
933 |
TBuf<KMaxMessageLength> msg; |
|
934 |
iEikonEnv->ReadResourceL(msg, R_PODCAST_ENABLE_DOWNLOADS_PROMPT); |
|
935 |
||
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
26
diff
changeset
|
936 |
if (ShowQueryMessageL(msg)) |
2 | 937 |
{ |
938 |
// need to suspend downloads before ResumeDownloadL will work :) |
|
939 |
iPodcastModel.SettingsEngine().SetDownloadSuspended(ETrue); |
|
940 |
// resume downloading if user says yes |
|
941 |
iPodcastModel.ShowEngine().ResumeDownloadsL(); |
|
942 |
} |
|
943 |
else |
|
944 |
{ |
|
945 |
// we disable downloading if user says no |
|
946 |
iPodcastModel.SettingsEngine().SetDownloadSuspended(ETrue); |
|
947 |
} |
|
948 |
} |
|
949 |
||
950 |
// if no shows in queue, we keep whichever state suspend is in |
|
951 |
showsDownloading.ResetAndDestroy(); |
|
952 |
} |
|
953 |
||
292
655dbce90b70
Added check and query when downloading is active while trying to exit
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
272
diff
changeset
|
954 |
void CPodcastFeedView::CheckConfirmExit() |
655dbce90b70
Added check and query when downloading is active while trying to exit
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
272
diff
changeset
|
955 |
{ |
302
cf14797d0023
Fix for broken check for active downloads when exiting
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
297
diff
changeset
|
956 |
DP("CPodcastFeedView::CheckConfirmExit"); |
292
655dbce90b70
Added check and query when downloading is active while trying to exit
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
272
diff
changeset
|
957 |
RShowInfoArray showsDownloading; |
655dbce90b70
Added check and query when downloading is active while trying to exit
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
272
diff
changeset
|
958 |
iPodcastModel.ShowEngine().GetShowsDownloadingL(showsDownloading); |
302
cf14797d0023
Fix for broken check for active downloads when exiting
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
297
diff
changeset
|
959 |
TUint count = showsDownloading.Count(); |
cf14797d0023
Fix for broken check for active downloads when exiting
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
297
diff
changeset
|
960 |
showsDownloading.ResetAndDestroy(); |
cf14797d0023
Fix for broken check for active downloads when exiting
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
297
diff
changeset
|
961 |
showsDownloading.Close(); |
292
655dbce90b70
Added check and query when downloading is active while trying to exit
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
272
diff
changeset
|
962 |
|
302
cf14797d0023
Fix for broken check for active downloads when exiting
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
297
diff
changeset
|
963 |
if (count > 0 && !iPodcastModel.SettingsEngine().DownloadSuspended()) |
292
655dbce90b70
Added check and query when downloading is active while trying to exit
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
272
diff
changeset
|
964 |
{ |
655dbce90b70
Added check and query when downloading is active while trying to exit
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
272
diff
changeset
|
965 |
TBuf<256> msg; |
655dbce90b70
Added check and query when downloading is active while trying to exit
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
272
diff
changeset
|
966 |
iEikonEnv->ReadResourceL(msg, R_EXIT_SHOWS_DOWNLOADING); |
655dbce90b70
Added check and query when downloading is active while trying to exit
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
272
diff
changeset
|
967 |
|
655dbce90b70
Added check and query when downloading is active while trying to exit
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
272
diff
changeset
|
968 |
if (!ShowQueryMessageL(msg)) |
655dbce90b70
Added check and query when downloading is active while trying to exit
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
272
diff
changeset
|
969 |
{ |
655dbce90b70
Added check and query when downloading is active while trying to exit
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
272
diff
changeset
|
970 |
return; |
655dbce90b70
Added check and query when downloading is active while trying to exit
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
272
diff
changeset
|
971 |
} |
655dbce90b70
Added check and query when downloading is active while trying to exit
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
272
diff
changeset
|
972 |
} |
655dbce90b70
Added check and query when downloading is active while trying to exit
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
272
diff
changeset
|
973 |
|
655dbce90b70
Added check and query when downloading is active while trying to exit
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
272
diff
changeset
|
974 |
AppUi()->Exit(); |
655dbce90b70
Added check and query when downloading is active while trying to exit
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
272
diff
changeset
|
975 |
} |
655dbce90b70
Added check and query when downloading is active while trying to exit
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
272
diff
changeset
|
976 |
|
7 | 977 |
void CPodcastFeedView::OpmlParsingComplete(TInt aError, TUint aNumFeedsImported) |
2 | 978 |
{ |
117
3b59b88b089e
Fixed Code Scanner L-issues; Further improvements to HTTP robustness
teknolog
parents:
115
diff
changeset
|
979 |
TRAP_IGNORE(OpmlParsingCompleteL(aError, aNumFeedsImported)); |
3b59b88b089e
Fixed Code Scanner L-issues; Further improvements to HTTP robustness
teknolog
parents:
115
diff
changeset
|
980 |
} |
3b59b88b089e
Fixed Code Scanner L-issues; Further improvements to HTTP robustness
teknolog
parents:
115
diff
changeset
|
981 |
|
3b59b88b089e
Fixed Code Scanner L-issues; Further improvements to HTTP robustness
teknolog
parents:
115
diff
changeset
|
982 |
void CPodcastFeedView::OpmlParsingCompleteL(TInt aError, TUint aNumFeedsImported) |
3b59b88b089e
Fixed Code Scanner L-issues; Further improvements to HTTP robustness
teknolog
parents:
115
diff
changeset
|
983 |
{ |
2 | 984 |
DP("CPodcastFeedView::OpmlParsingComplete BEGIN"); |
985 |
||
7 | 986 |
switch (aError) |
2 | 987 |
{ |
7 | 988 |
case KErrCouldNotConnect: |
2 | 989 |
{ |
990 |
TBuf<KMaxMessageLength> message; |
|
7 | 991 |
iEikonEnv->ReadResourceL(message, R_PODCAST_CONNECTION_ERROR); |
153
1d3315159ef5
Fix for bug 3051 - search wait dialog doesn't close if search fails; some extra debugging output added
teknolog
parents:
137
diff
changeset
|
992 |
delete iWaitDialog; |
1d3315159ef5
Fix for bug 3051 - search wait dialog doesn't close if search fails; some extra debugging output added
teknolog
parents:
137
diff
changeset
|
993 |
iOpmlState = EOpmlIdle; |
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
26
diff
changeset
|
994 |
ShowErrorMessageL(message); |
2 | 995 |
} |
996 |
break; |
|
7 | 997 |
case KErrNone: |
998 |
default: // we don't do more error handling here, just show 0 imported feeds |
|
999 |
switch (iOpmlState) |
|
1000 |
{ |
|
1001 |
case EOpmlIdle: |
|
1002 |
break; |
|
1003 |
case EOpmlImporting: |
|
2 | 1004 |
{ |
7 | 1005 |
UpdateListboxItemsL(); |
1006 |
delete iWaitDialog; |
|
1007 |
iOpmlState = EOpmlIdle; |
|
1008 |
||
2 | 1009 |
TBuf<KMaxMessageLength> message; |
7 | 1010 |
TBuf<KMaxMessageLength> templ; |
1011 |
iEikonEnv->ReadResourceL(templ, R_IMPORT_FEED_SUCCESS); |
|
1012 |
message.Format(templ, aNumFeedsImported); |
|
1013 |
||
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
26
diff
changeset
|
1014 |
if(ShowQueryMessageL(message)) |
7 | 1015 |
{ |
1016 |
HandleCommandL(EPodcastUpdateAllFeeds); |
|
1017 |
} |
|
2 | 1018 |
} |
7 | 1019 |
break; |
1020 |
case EOpmlSearching: |
|
1021 |
delete iWaitDialog; |
|
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
26
diff
changeset
|
1022 |
iWaitDialog = NULL; |
7 | 1023 |
if (iPodcastModel.FeedEngine().GetSearchResults().Count() == 0) |
1024 |
{ |
|
1025 |
TBuf<KMaxMessageLength> message; |
|
1026 |
iEikonEnv->ReadResourceL(message, R_SEARCH_NORESULTS); |
|
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
26
diff
changeset
|
1027 |
ShowErrorMessageL(message); |
7 | 1028 |
} |
1029 |
else |
|
1030 |
{ |
|
302
cf14797d0023
Fix for broken check for active downloads when exiting
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
297
diff
changeset
|
1031 |
iToolbar->SetToolbarVisibility(EFalse); |
7 | 1032 |
AppUi()->ActivateLocalViewL(KUidPodcastSearchViewID, TUid::Uid(0), KNullDesC8()); |
1033 |
} |
|
1034 |
iOpmlState = EOpmlIdle; |
|
1035 |
break; |
|
1036 |
default: |
|
1037 |
break; |
|
1038 |
} |
|
2 | 1039 |
} |
1040 |
||
1041 |
DP("CPodcastFeedView::OpmlParsingComplete END"); |
|
1042 |
} |
|
1043 |
||
1044 |
void CPodcastFeedView::DialogDismissedL(TInt /*aButtonId*/) |
|
1045 |
{ |
|
1046 |
iPodcastModel.FeedEngine().CancelUpdateAllFeeds(); |
|
1047 |
} |
|
5 | 1048 |
|
1049 |
void CPodcastFeedView::GetFeedErrorText(TDes &aErrorMessage, TInt aErrorCode) |
|
1050 |
{ |
|
117
3b59b88b089e
Fixed Code Scanner L-issues; Further improvements to HTTP robustness
teknolog
parents:
115
diff
changeset
|
1051 |
TRAP_IGNORE(((CPodcastAppUi*)AppUi())->GetErrorTextL(aErrorMessage,aErrorCode)); |
5 | 1052 |
} |
8 | 1053 |
|
45
56d4e0784e5d
Nicer way to handle back from queue view to feed/show view
teknolog
parents:
36
diff
changeset
|
1054 |
TBool CPodcastFeedView::ViewingShows() |
56d4e0784e5d
Nicer way to handle back from queue view to feed/show view
teknolog
parents:
36
diff
changeset
|
1055 |
{ |
56d4e0784e5d
Nicer way to handle back from queue view to feed/show view
teknolog
parents:
36
diff
changeset
|
1056 |
return iViewingShows; |
56d4e0784e5d
Nicer way to handle back from queue view to feed/show view
teknolog
parents:
36
diff
changeset
|
1057 |
} |