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