author | Sebastian Brannstrom <sebastianb@symbian.org> |
Sat, 04 Dec 2010 15:35:24 +0000 | |
branch | RCL_3 |
changeset 392 | 6a9baa40b241 |
parent 388 | 5f24605de6cf |
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 "ShowEngine.h" |
|
20 |
#include "FeedEngine.h" |
|
21 |
#include "FeedInfo.h" |
|
22 |
#include <bautils.h> |
|
23 |
#include <s32file.h> |
|
24 |
#include "SettingsEngine.h" |
|
25 |
#include <e32hashtab.h> |
|
26 |
#include <httperr.h> |
|
27 |
#include "debug.h" |
|
28 |
#include "PodcastUtils.h" |
|
299
56d23cf60795
Fixes for issues using #define with raptor
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
291
diff
changeset
|
29 |
#include "defines.h" |
202
e1dedb07817d
Tweaks to capabilities in DLL to enable self signing; Opening RCL_3 branch.
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
200
diff
changeset
|
30 |
|
e1dedb07817d
Tweaks to capabilities in DLL to enable self signing; Opening RCL_3 branch.
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
200
diff
changeset
|
31 |
#ifdef ENABLE_MPX_INTEGRATION |
126 | 32 |
#include <mpxcollectionhelperfactory.h> |
202
e1dedb07817d
Tweaks to capabilities in DLL to enable self signing; Opening RCL_3 branch.
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
200
diff
changeset
|
33 |
#endif |
2 | 34 |
|
35 |
const TUint KMaxDownloadErrors = 3; |
|
36 |
const TInt KMimeBufLength = 100; |
|
37 |
||
38 |
CShowEngine::CShowEngine(CPodcastModel& aPodcastModel) : |
|
39 |
iPodcastModel(aPodcastModel), |
|
40 |
iDB(*aPodcastModel.DB()) |
|
41 |
{ |
|
42 |
} |
|
43 |
||
44 |
EXPORT_C CShowEngine::~CShowEngine() |
|
45 |
{ |
|
368
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
46 |
DP("CShowEngine::~CShowEngine BEGIN"); |
2 | 47 |
delete iShowClient; |
48 |
iObservers.Close(); |
|
49 |
delete iShowDownloading; |
|
50 |
delete iMetaDataReader; |
|
51 |
iApaSession.Close(); |
|
331
c44ad45736ff
Fix for bug 3900 - MPXCollectionHelper must be Close()d, not deleted
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
326
diff
changeset
|
52 |
#ifdef ENABLE_MPX_INTEGRATION |
126 | 53 |
if (iCollectionHelper) |
331
c44ad45736ff
Fix for bug 3900 - MPXCollectionHelper must be Close()d, not deleted
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
326
diff
changeset
|
54 |
{ |
c44ad45736ff
Fix for bug 3900 - MPXCollectionHelper must be Close()d, not deleted
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
326
diff
changeset
|
55 |
iCollectionHelper->Close(); |
c44ad45736ff
Fix for bug 3900 - MPXCollectionHelper must be Close()d, not deleted
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
326
diff
changeset
|
56 |
} |
200
79076725bab9
Added #define to enable/disable MPX integration, since it requires capabilities that can't be granted when self signed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
172
diff
changeset
|
57 |
#endif |
368
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
58 |
DP("CShowEngine::~CShowEngine END"); |
2 | 59 |
} |
60 |
||
61 |
EXPORT_C CShowEngine* CShowEngine::NewL(CPodcastModel& aPodcastModel) |
|
62 |
{ |
|
63 |
CShowEngine* self = new (ELeave) CShowEngine(aPodcastModel); |
|
64 |
CleanupStack::PushL(self); |
|
65 |
self->ConstructL(); |
|
66 |
CleanupStack::Pop(self); |
|
67 |
return self; |
|
68 |
} |
|
69 |
||
70 |
EXPORT_C void CShowEngine::GetMimeType(const TDesC& aFileName, TDes& aMimeType) |
|
71 |
{ |
|
72 |
aMimeType.Zero(); |
|
73 |
RFile file; |
|
74 |
if (file.Open(iPodcastModel.FsSession(), aFileName, 0) == KErrNone) |
|
75 |
{ |
|
76 |
if (file.Read(iRecogBuffer) == KErrNone) |
|
77 |
{ |
|
78 |
TDataRecognitionResult result; |
|
79 |
if (iApaSession.RecognizeData(aFileName, iRecogBuffer, result) |
|
80 |
== KErrNone) |
|
81 |
{ |
|
82 |
aMimeType.Copy(result.iDataType.Des()); |
|
83 |
} |
|
84 |
||
85 |
} |
|
86 |
} |
|
87 |
file.Close(); |
|
88 |
} |
|
89 |
||
90 |
void CShowEngine::ConstructL() |
|
91 |
{ |
|
92 |
iShowClient = CHttpClient::NewL(iPodcastModel, *this); |
|
93 |
iShowClient->SetResumeEnabled(ETrue); |
|
94 |
iMetaDataReader = new (ELeave) CMetaDataReader(*this, iPodcastModel.FsSession()); |
|
95 |
iMetaDataReader->ConstructL(); |
|
96 |
User::LeaveIfError(iApaSession.Connect()); |
|
97 |
} |
|
98 |
||
99 |
EXPORT_C void CShowEngine::SuspendDownloads() |
|
100 |
{ |
|
101 |
iPodcastModel.SettingsEngine().SetDownloadSuspended(ETrue); |
|
102 |
iShowClient->Stop(); |
|
103 |
} |
|
104 |
||
105 |
EXPORT_C void CShowEngine::ResumeDownloadsL() |
|
106 |
{ |
|
107 |
DP("CShowEngine::ResumeDownloadsL BEGIN"); |
|
108 |
if (iPodcastModel.SettingsEngine().DownloadSuspended()) |
|
109 |
{ |
|
110 |
iPodcastModel.SettingsEngine().SetDownloadSuspended(EFalse); |
|
111 |
iDownloadErrors = 0; |
|
112 |
DownloadNextShowL(); |
|
113 |
} |
|
114 |
DP("CShowEngine::ResumeDownloadsL END"); |
|
115 |
} |
|
116 |
||
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
30
diff
changeset
|
117 |
EXPORT_C void CShowEngine::RemoveAllDownloadsL() |
2 | 118 |
{ |
119 |
if (!iPodcastModel.SettingsEngine().DownloadSuspended()) |
|
120 |
{ |
|
121 |
SuspendDownloads(); |
|
122 |
} |
|
123 |
||
111 | 124 |
DBRemoveAllDownloadsL(); |
22 | 125 |
NotifyDownloadQueueUpdatedL(); |
2 | 126 |
} |
127 |
||
111 | 128 |
EXPORT_C void CShowEngine::RemoveDownloadL(TUint aUid) |
2 | 129 |
{ |
111 | 130 |
DP("CShowEngine::RemoveDownloadL BEGIN"); |
2 | 131 |
|
132 |
TBool resumeAfterRemove = EFalse; |
|
133 |
// if trying to remove the present download, we first stop it |
|
134 |
if (!iPodcastModel.SettingsEngine().DownloadSuspended() && iShowDownloading != NULL |
|
135 |
&& iShowDownloading->Uid() == aUid) |
|
136 |
{ |
|
137 |
DP("CShowEngine::RemoveDownload\t This is the active download, we suspend downloading"); |
|
138 |
SuspendDownloads(); |
|
122 | 139 |
|
140 |
// partial downloads should be removed |
|
141 |
BaflUtils::DeleteFile(iPodcastModel.FsSession(), iShowDownloading->FileName()); |
|
142 |
||
2 | 143 |
resumeAfterRemove = ETrue; |
144 |
} |
|
145 |
||
146 |
CShowInfo *info = DBGetShowByUidL(aUid); |
|
147 |
if (info != NULL) |
|
148 |
{ |
|
149 |
info->SetDownloadState(ENotDownloaded); |
|
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
30
diff
changeset
|
150 |
DBUpdateShowL(*info); |
2 | 151 |
delete info; |
152 |
} |
|
111 | 153 |
|
154 |
DBRemoveDownloadL(aUid); |
|
2 | 155 |
|
116 | 156 |
if (resumeAfterRemove) |
157 |
{ |
|
2 | 158 |
ResumeDownloadsL(); |
116 | 159 |
} |
160 |
else |
|
161 |
{ |
|
162 |
NotifyShowDownloadUpdatedL(-1, -1); |
|
163 |
NotifyDownloadQueueUpdatedL(); |
|
164 |
} |
|
2 | 165 |
|
166 |
DownloadNextShowL(); |
|
111 | 167 |
DP("CShowEngine::RemoveDownloadL END"); |
2 | 168 |
} |
169 |
||
170 |
void CShowEngine::Connected(CHttpClient* /*aClient*/) |
|
171 |
{ |
|
172 |
||
173 |
} |
|
174 |
||
175 |
void CShowEngine::Progress(CHttpClient* /*aHttpClient */, TInt aBytes, |
|
176 |
TInt aTotalBytes) |
|
177 |
{ |
|
248
31659d49b2e7
Fix for bug 3042
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
202
diff
changeset
|
178 |
//iShowDownloading->SetShowSize(aTotalBytes); |
2 | 179 |
TRAP_IGNORE(NotifyShowDownloadUpdatedL(aBytes, aTotalBytes)); |
180 |
} |
|
181 |
||
182 |
void CShowEngine::Disconnected(CHttpClient* /*aClient */) |
|
183 |
{ |
|
184 |
} |
|
185 |
||
186 |
void CShowEngine::DownloadInfo(CHttpClient* aHttpClient, TInt aTotalBytes) |
|
187 |
{ |
|
172
c2a99fe1afd0
Proposed fix for bug 2931
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
165
diff
changeset
|
188 |
DP1("CShowEngine::DownloadInfo, About to download %d bytes", aTotalBytes); |
2 | 189 |
} |
190 |
||
111 | 191 |
void CShowEngine::GetShowL(CShowInfo *info) |
2 | 192 |
{ |
193 |
CFeedInfo *feedInfo = iPodcastModel.FeedEngine().GetFeedInfoByUid( |
|
194 |
info->FeedUid()); |
|
111 | 195 |
|
2 | 196 |
TFileName filePath; |
197 |
filePath.Copy(iPodcastModel.SettingsEngine().BaseDir()); |
|
198 |
||
199 |
TFileName relPath; |
|
200 |
relPath.Copy(feedInfo->Title()); |
|
201 |
relPath.Append('\\'); |
|
202 |
||
203 |
TFileName fileName; |
|
204 |
PodcastUtils::FileNameFromUrl(info->Url(), fileName); |
|
257
f5377b5817a0
Fix for bug 3626 - show filenames are now generated from UIDs
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
248
diff
changeset
|
205 |
|
f5377b5817a0
Fix for bug 3626 - show filenames are now generated from UIDs
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
248
diff
changeset
|
206 |
TFileName newFilename; |
291
2f62fe179bbb
For for a potential crash bug when a show URL does not contain a period
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
257
diff
changeset
|
207 |
|
2f62fe179bbb
For for a potential crash bug when a show URL does not contain a period
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
257
diff
changeset
|
208 |
TInt periodPos = fileName.LocateReverse('.'); |
2f62fe179bbb
For for a potential crash bug when a show URL does not contain a period
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
257
diff
changeset
|
209 |
|
2f62fe179bbb
For for a potential crash bug when a show URL does not contain a period
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
257
diff
changeset
|
210 |
if (periodPos != -1) |
2f62fe179bbb
For for a potential crash bug when a show URL does not contain a period
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
257
diff
changeset
|
211 |
{ |
2f62fe179bbb
For for a potential crash bug when a show URL does not contain a period
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
257
diff
changeset
|
212 |
// file extension (most likely) found |
2f62fe179bbb
For for a potential crash bug when a show URL does not contain a period
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
257
diff
changeset
|
213 |
TFileName extension; |
2f62fe179bbb
For for a potential crash bug when a show URL does not contain a period
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
257
diff
changeset
|
214 |
extension.Copy(fileName.Mid(periodPos)); |
2f62fe179bbb
For for a potential crash bug when a show URL does not contain a period
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
257
diff
changeset
|
215 |
DP1("extension=%S", &extension); |
2f62fe179bbb
For for a potential crash bug when a show URL does not contain a period
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
257
diff
changeset
|
216 |
|
2f62fe179bbb
For for a potential crash bug when a show URL does not contain a period
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
257
diff
changeset
|
217 |
newFilename.Format(_L("%u%S"), info->Uid(), &extension); |
2f62fe179bbb
For for a potential crash bug when a show URL does not contain a period
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
257
diff
changeset
|
218 |
DP1("newFilename=%S", &newFilename); |
2f62fe179bbb
For for a potential crash bug when a show URL does not contain a period
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
257
diff
changeset
|
219 |
} |
2f62fe179bbb
For for a potential crash bug when a show URL does not contain a period
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
257
diff
changeset
|
220 |
else |
2f62fe179bbb
For for a potential crash bug when a show URL does not contain a period
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
257
diff
changeset
|
221 |
{ |
2f62fe179bbb
For for a potential crash bug when a show URL does not contain a period
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
257
diff
changeset
|
222 |
// no extension found, we'll have to rely on magic numbers |
326
255972d41940
Fix for an issue with file names having zero length if the URL ends with a slash
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
299
diff
changeset
|
223 |
newFilename.Format(_L("%u"), info->Uid()); |
291
2f62fe179bbb
For for a potential crash bug when a show URL does not contain a period
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
257
diff
changeset
|
224 |
} |
257
f5377b5817a0
Fix for bug 3626 - show filenames are now generated from UIDs
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
248
diff
changeset
|
225 |
|
f5377b5817a0
Fix for bug 3626 - show filenames are now generated from UIDs
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
248
diff
changeset
|
226 |
relPath.Append(newFilename); |
2 | 227 |
PodcastUtils::EnsureProperPathName(relPath); |
228 |
||
229 |
// complete file path is base dir + rel path |
|
230 |
filePath.Append(relPath); |
|
231 |
info->SetFileNameL(filePath); |
|
232 |
||
111 | 233 |
User::LeaveIfError(iShowClient->GetL(info->Url(), filePath)); |
2 | 234 |
} |
235 |
||
111 | 236 |
EXPORT_C void CShowEngine::AddShowL(const CShowInfo& aItem) |
2 | 237 |
{ |
238 |
DP1("CShowEngine::AddShowL, title=%S", &aItem.Title()); |
|
239 |
CShowInfo *showInfo = DBGetShowByUidL(aItem.Uid()); |
|
240 |
||
241 |
if (showInfo == NULL) |
|
242 |
{ |
|
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
30
diff
changeset
|
243 |
DBAddShowL(aItem); |
2 | 244 |
} |
245 |
else |
|
246 |
{ |
|
247 |
delete showInfo; |
|
111 | 248 |
User::Leave(KErrAlreadyExists); |
2 | 249 |
} |
250 |
} |
|
251 |
||
252 |
EXPORT_C void CShowEngine::AddObserver(MShowEngineObserver *observer) |
|
253 |
{ |
|
254 |
iObservers.Append(observer); |
|
255 |
} |
|
256 |
||
257 |
EXPORT_C void CShowEngine::RemoveObserver(MShowEngineObserver *observer) |
|
258 |
{ |
|
259 |
TInt index = iObservers.Find(observer); |
|
260 |
||
261 |
if (index > KErrNotFound) |
|
262 |
{ |
|
263 |
iObservers.Remove(index); |
|
264 |
} |
|
265 |
} |
|
266 |
||
126 | 267 |
void CShowEngine::AddShowToMpxCollection(CShowInfo &aShowInfo) |
2 | 268 |
{ |
332
88a24b8b97d8
Added some more debugging for MPX integration
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
331
diff
changeset
|
269 |
DP("CShowEngine::AddShowToMpxCollection BEGIN"); |
200
79076725bab9
Added #define to enable/disable MPX integration, since it requires capabilities that can't be granted when self signed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
172
diff
changeset
|
270 |
#ifdef ENABLE_MPX_INTEGRATION |
126 | 271 |
if (!iCollectionHelper) |
272 |
iCollectionHelper = CMPXCollectionHelperFactory::NewCollectionHelperL(); |
|
2 | 273 |
|
126 | 274 |
// if this leaves, not much we can do anyway |
332
88a24b8b97d8
Added some more debugging for MPX integration
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
331
diff
changeset
|
275 |
DP(" MPX integration enabled, adding show to collection"); |
88a24b8b97d8
Added some more debugging for MPX integration
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
331
diff
changeset
|
276 |
TRAPD(err, iCollectionHelper->AddL(aShowInfo.FileName(), this)); |
88a24b8b97d8
Added some more debugging for MPX integration
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
331
diff
changeset
|
277 |
DP1(" AddL returned %d", err); |
200
79076725bab9
Added #define to enable/disable MPX integration, since it requires capabilities that can't be granted when self signed
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
172
diff
changeset
|
278 |
#endif |
332
88a24b8b97d8
Added some more debugging for MPX integration
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
331
diff
changeset
|
279 |
DP("CShowEngine::AddShowToMpxCollection END"); |
2 | 280 |
} |
281 |
||
282 |
void CShowEngine::CompleteL(CHttpClient* /*aHttpClient*/, TInt aError) |
|
283 |
{ |
|
284 |
if (iShowDownloading != NULL) |
|
285 |
{ |
|
248
31659d49b2e7
Fix for bug 3042
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
202
diff
changeset
|
286 |
DP2("CShowEngine::CompleteL file=%S, aError=%d", &iShowDownloading->FileName(), aError); |
31659d49b2e7
Fix for bug 3042
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
202
diff
changeset
|
287 |
|
2 | 288 |
if(aError != KErrCouldNotConnect) |
289 |
{ |
|
6 | 290 |
if(aError == KErrDisconnected && iPodcastModel.SettingsEngine().DownloadSuspended()) |
291 |
{ |
|
2 | 292 |
// no error if disconnect happened because of suspended downloading |
6 | 293 |
} |
294 |
else |
|
295 |
{ |
|
2 | 296 |
iShowDownloading->SetLastError(aError); |
6 | 297 |
} |
2 | 298 |
|
299 |
if (aError == KErrNone) |
|
300 |
{ |
|
301 |
TBuf<KMimeBufLength> mimeType; |
|
302 |
GetMimeType(iShowDownloading->FileName(), mimeType); |
|
303 |
_LIT(KMimeAudio,"audio"); |
|
304 |
_LIT(KMimeVideo,"video"); |
|
305 |
if (mimeType.Left(5) == KMimeAudio) |
|
306 |
{ |
|
307 |
iShowDownloading->SetShowType(EAudioPodcast); |
|
308 |
} |
|
309 |
else if (mimeType.Left(5) == KMimeVideo) |
|
310 |
{ |
|
311 |
iShowDownloading->SetShowType(EVideoPodcast); |
|
312 |
} |
|
248
31659d49b2e7
Fix for bug 3042
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
202
diff
changeset
|
313 |
|
31659d49b2e7
Fix for bug 3042
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
202
diff
changeset
|
314 |
// setting file size |
31659d49b2e7
Fix for bug 3042
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
202
diff
changeset
|
315 |
TEntry entry; |
31659d49b2e7
Fix for bug 3042
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
202
diff
changeset
|
316 |
TInt err = iPodcastModel.FsSession().Entry(iShowDownloading->FileName(), entry); |
31659d49b2e7
Fix for bug 3042
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
202
diff
changeset
|
317 |
if (err == KErrNone) |
31659d49b2e7
Fix for bug 3042
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
202
diff
changeset
|
318 |
{ |
31659d49b2e7
Fix for bug 3042
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
202
diff
changeset
|
319 |
iShowDownloading->SetShowSize(entry.iSize); |
31659d49b2e7
Fix for bug 3042
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
202
diff
changeset
|
320 |
} |
2 | 321 |
|
322 |
iShowDownloading->SetDownloadState(EDownloaded); |
|
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
30
diff
changeset
|
323 |
DBUpdateShowL(*iShowDownloading); |
111 | 324 |
DBRemoveDownloadL(iShowDownloading->Uid()); |
2 | 325 |
AddShowToMpxCollection(*iShowDownloading); |
326 |
NotifyShowFinishedL(aError); |
|
15
93d9f66bf50b
Cleaning description better for second line in search results
teknolog
parents:
6
diff
changeset
|
327 |
iDownloadErrors = 0; |
2 | 328 |
delete iShowDownloading; |
329 |
iShowDownloading = NULL; |
|
330 |
} |
|
331 |
else |
|
332 |
{ |
|
248
31659d49b2e7
Fix for bug 3042
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
202
diff
changeset
|
333 |
if (aError == HTTPStatus::ERequestedRangeNotSatisfiable) |
31659d49b2e7
Fix for bug 3042
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
202
diff
changeset
|
334 |
{ |
31659d49b2e7
Fix for bug 3042
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
202
diff
changeset
|
335 |
DP("ERequestedRangeNotSatisfiable, resetting download"); |
31659d49b2e7
Fix for bug 3042
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
202
diff
changeset
|
336 |
// file size got messed up, so delete downloaded file an re-queue |
31659d49b2e7
Fix for bug 3042
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
202
diff
changeset
|
337 |
BaflUtils::DeleteFile(iPodcastModel.FsSession(),iShowDownloading->FileName()); |
31659d49b2e7
Fix for bug 3042
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
202
diff
changeset
|
338 |
iShowDownloading->SetDownloadState(EQueued); |
31659d49b2e7
Fix for bug 3042
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
202
diff
changeset
|
339 |
DBUpdateShowL(*iShowDownloading); |
31659d49b2e7
Fix for bug 3042
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
202
diff
changeset
|
340 |
} |
2 | 341 |
// 400 and 500 series errors are serious errors on which probably another download will fail |
248
31659d49b2e7
Fix for bug 3042
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
202
diff
changeset
|
342 |
else if (aError>= HTTPStatus::EBadRequest && aError <= HTTPStatus::EBadRequest+200) |
2 | 343 |
{ |
344 |
iShowDownloading->SetDownloadState(EFailedDownload); |
|
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
30
diff
changeset
|
345 |
DBUpdateShowL(*iShowDownloading); |
111 | 346 |
DBRemoveDownloadL(iShowDownloading->Uid()); |
2 | 347 |
NotifyShowFinishedL(aError); |
348 |
||
349 |
delete iShowDownloading; |
|
350 |
iShowDownloading = NULL; |
|
351 |
} |
|
115
d87e984bd8b8
Even more robustness improvements for HTTP client - specifically disk full problems
teknolog
parents:
112
diff
changeset
|
352 |
else if (aError == KErrDiskFull) |
d87e984bd8b8
Even more robustness improvements for HTTP client - specifically disk full problems
teknolog
parents:
112
diff
changeset
|
353 |
{ |
d87e984bd8b8
Even more robustness improvements for HTTP client - specifically disk full problems
teknolog
parents:
112
diff
changeset
|
354 |
// stop downloading immediately if disk is full |
d87e984bd8b8
Even more robustness improvements for HTTP client - specifically disk full problems
teknolog
parents:
112
diff
changeset
|
355 |
iShowDownloading->SetDownloadState(EQueued); |
d87e984bd8b8
Even more robustness improvements for HTTP client - specifically disk full problems
teknolog
parents:
112
diff
changeset
|
356 |
DBUpdateShowL(*iShowDownloading); |
d87e984bd8b8
Even more robustness improvements for HTTP client - specifically disk full problems
teknolog
parents:
112
diff
changeset
|
357 |
iDownloadErrors = KMaxDownloadErrors; |
d87e984bd8b8
Even more robustness improvements for HTTP client - specifically disk full problems
teknolog
parents:
112
diff
changeset
|
358 |
} |
2 | 359 |
else // other kind of error, missing network etc, reque this show |
360 |
{ |
|
361 |
iShowDownloading->SetDownloadState(EQueued); |
|
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
30
diff
changeset
|
362 |
DBUpdateShowL(*iShowDownloading); |
2 | 363 |
} |
364 |
||
115
d87e984bd8b8
Even more robustness improvements for HTTP client - specifically disk full problems
teknolog
parents:
112
diff
changeset
|
365 |
NotifyDownloadQueueUpdatedL(); |
2 | 366 |
iDownloadErrors++; |
117
3b59b88b089e
Fixed Code Scanner L-issues; Further improvements to HTTP robustness
teknolog
parents:
116
diff
changeset
|
367 |
if (iDownloadErrors >= KMaxDownloadErrors) |
2 | 368 |
{ |
369 |
DP("Too many downloading errors, suspending downloads"); |
|
370 |
iPodcastModel.SettingsEngine().SetDownloadSuspended(ETrue); |
|
371 |
NotifyShowFinishedL(aError); |
|
372 |
} |
|
373 |
} |
|
374 |
DownloadNextShowL(); |
|
375 |
} |
|
376 |
||
377 |
else |
|
378 |
{ |
|
379 |
// Connection error |
|
380 |
if(iShowDownloading) |
|
381 |
{ |
|
382 |
iShowDownloading->SetDownloadState(EQueued); |
|
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
30
diff
changeset
|
383 |
DBUpdateShowL(*iShowDownloading); |
2 | 384 |
} |
385 |
iPodcastModel.SettingsEngine().SetDownloadSuspended(ETrue); |
|
386 |
NotifyShowFinishedL(aError); |
|
387 |
} |
|
388 |
} |
|
389 |
} |
|
390 |
||
391 |
EXPORT_C CShowInfo* CShowEngine::ShowDownloading() |
|
392 |
{ |
|
393 |
return iShowDownloading; |
|
394 |
} |
|
395 |
||
396 |
EXPORT_C CShowInfo* CShowEngine::GetShowByUidL(TUint aShowUid) |
|
397 |
{ |
|
398 |
return DBGetShowByUidL(aShowUid); |
|
399 |
} |
|
368
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
400 |
|
2 | 401 |
CShowInfo* CShowEngine::DBGetShowByUidL(TUint aUid) |
402 |
{ |
|
403 |
DP("CShowEngine::DBGetShowByUid"); |
|
404 |
CShowInfo *showInfo = NULL; |
|
368
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
405 |
_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype, deletedate from shows where uid=%u"); |
2 | 406 |
iSqlBuffer.Format(KSqlStatement, aUid); |
407 |
||
408 |
sqlite3_stmt *st; |
|
409 |
||
410 |
//DP1("SQL: %S", &iSqlBuffer.Left(KSqlDPLen)); |
|
411 |
||
412 |
int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, |
|
413 |
&st, (const void**) NULL); |
|
414 |
||
415 |
if (rc == SQLITE_OK) |
|
416 |
{ |
|
417 |
rc = sqlite3_step(st); |
|
418 |
Cleanup_sqlite3_finalize_PushL(st); |
|
419 |
if (rc == SQLITE_ROW) |
|
420 |
{ |
|
421 |
showInfo = CShowInfo::NewLC(); |
|
422 |
DBFillShowInfoFromStmtL(st, showInfo); |
|
423 |
CleanupStack::Pop(showInfo); |
|
424 |
} |
|
425 |
CleanupStack::PopAndDestroy();//st |
|
426 |
} |
|
427 |
||
428 |
return showInfo; |
|
429 |
} |
|
430 |
||
431 |
EXPORT_C CShowInfo* CShowEngine::DBGetShowByFileNameL(TFileName aFileName) |
|
432 |
{ |
|
433 |
DP("CShowEngine::DBGetShowByUid"); |
|
434 |
CShowInfo *showInfo = NULL; |
|
368
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
435 |
_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype, lasterror, deletedate from shows where filename=\"%S\""); |
2 | 436 |
iSqlBuffer.Format(KSqlStatement, &aFileName); |
437 |
||
438 |
sqlite3_stmt *st; |
|
439 |
||
440 |
int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, |
|
441 |
&st, (const void**) NULL); |
|
442 |
||
443 |
if (rc == SQLITE_OK) |
|
444 |
{ |
|
445 |
rc = sqlite3_step(st); |
|
446 |
Cleanup_sqlite3_finalize_PushL(st); |
|
447 |
if (rc == SQLITE_ROW) |
|
448 |
{ |
|
449 |
showInfo = CShowInfo::NewLC(); |
|
450 |
DBFillShowInfoFromStmtL(st, showInfo); |
|
451 |
CleanupStack::Pop(showInfo); |
|
452 |
} |
|
453 |
CleanupStack::PopAndDestroy();//st |
|
454 |
} |
|
455 |
||
456 |
return showInfo; |
|
457 |
} |
|
458 |
||
459 |
void CShowEngine::DBGetAllShowsL(RShowInfoArray& aShowArray) |
|
460 |
{ |
|
461 |
DP("CShowEngine::DBGetAllShows"); |
|
368
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
462 |
_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype, lasterror, deletedate from shows"); |
2 | 463 |
iSqlBuffer.Format(KSqlStatement); |
464 |
||
465 |
sqlite3_stmt *st; |
|
466 |
||
467 |
int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, |
|
468 |
&st, (const void**) NULL); |
|
469 |
||
470 |
if (rc == SQLITE_OK) |
|
471 |
{ |
|
472 |
rc = sqlite3_step(st); |
|
473 |
Cleanup_sqlite3_finalize_PushL(st); |
|
474 |
while (rc == SQLITE_ROW) |
|
475 |
{ |
|
476 |
CShowInfo* showInfo = CShowInfo::NewLC(); |
|
477 |
DBFillShowInfoFromStmtL(st, showInfo); |
|
478 |
aShowArray.Append(showInfo); |
|
479 |
CleanupStack::Pop(showInfo); |
|
480 |
rc = sqlite3_step(st); |
|
481 |
} |
|
482 |
CleanupStack::PopAndDestroy();//st |
|
483 |
} |
|
484 |
||
485 |
} |
|
486 |
||
487 |
void CShowEngine::DBGetAllDownloadsL(RShowInfoArray& aShowArray) |
|
488 |
{ |
|
489 |
DP("CShowEngine::DBGetAllDownloads"); |
|
368
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
490 |
_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, shows.uid, showsize, trackno, pubdate, showtype, lasterror, deletedate from downloads, shows where downloads.uid=shows.uid"); |
2 | 491 |
iSqlBuffer.Format(KSqlStatement); |
492 |
||
493 |
#ifndef DONT_SORT_SQL |
|
494 |
_LIT(KSqlSort, " order by dl_index"); |
|
495 |
iSqlBuffer.Append(KSqlSort); |
|
496 |
#endif |
|
497 |
sqlite3_stmt *st; |
|
498 |
||
499 |
int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, |
|
500 |
&st, (const void**) NULL); |
|
501 |
||
502 |
if (rc == SQLITE_OK) |
|
503 |
{ |
|
504 |
rc = sqlite3_step(st); |
|
505 |
Cleanup_sqlite3_finalize_PushL(st); |
|
506 |
while (rc == SQLITE_ROW) |
|
507 |
{ |
|
508 |
CShowInfo* showInfo = CShowInfo::NewLC(); |
|
509 |
DBFillShowInfoFromStmtL(st, showInfo); |
|
510 |
aShowArray.Append(showInfo); |
|
511 |
CleanupStack::Pop(showInfo); |
|
512 |
rc = sqlite3_step(st); |
|
513 |
} |
|
514 |
CleanupStack::PopAndDestroy();//st |
|
515 |
} |
|
111 | 516 |
else |
517 |
{ |
|
518 |
User::Leave(KErrCorrupt); |
|
519 |
} |
|
2 | 520 |
|
521 |
// delete downloads that don't have a show |
|
522 |
||
523 |
_LIT(KSqlStatement2, "delete from downloads where uid not in (select downloads.uid from shows, downloads where shows.uid=downloads.uid)"); |
|
524 |
iSqlBuffer.Format(KSqlStatement2); |
|
525 |
||
526 |
rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, &st, (const void**) NULL); |
|
527 |
||
528 |
if (rc == SQLITE_OK) |
|
529 |
{ |
|
111 | 530 |
Cleanup_sqlite3_finalize_PushL(st); |
2 | 531 |
rc = sqlite3_step(st); |
111 | 532 |
CleanupStack::PopAndDestroy(); // st |
533 |
} |
|
534 |
else |
|
535 |
{ |
|
536 |
User::Leave(KErrCorrupt); |
|
2 | 537 |
} |
538 |
} |
|
539 |
||
368
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
540 |
void CShowEngine::DBGetOldShowsL(RShowInfoArray& aShowArray) |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
541 |
{ |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
542 |
DP("CShowEngine::DBGetOldShowsL BEGIN"); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
543 |
TTime now; |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
544 |
now.HomeTime(); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
545 |
// TTimeIntervalYears years(5); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
546 |
// now += years; |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
547 |
|
376
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
548 |
_LIT(KSqlStatement, "select filename from shows where downloadstate=%d and deletedate != 0 and deletedate < \"%Ld\""); |
368
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
549 |
iSqlBuffer.Format(KSqlStatement, EDownloaded, now.Int64()); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
550 |
|
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
551 |
sqlite3_stmt *st; |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
552 |
|
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
553 |
int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
554 |
&st, (const void**) NULL); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
555 |
|
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
556 |
if (rc == SQLITE_OK) |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
557 |
{ |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
558 |
rc = sqlite3_step(st); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
559 |
Cleanup_sqlite3_finalize_PushL(st); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
560 |
while (rc == SQLITE_ROW) |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
561 |
{ |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
562 |
CShowInfo* showInfo = CShowInfo::NewLC(); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
563 |
|
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
564 |
const void *filez = sqlite3_column_text16(st, 0); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
565 |
TPtrC16 file((const TUint16*) filez); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
566 |
showInfo->SetFileNameL(file); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
567 |
|
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
568 |
aShowArray.Append(showInfo); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
569 |
CleanupStack::Pop(showInfo); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
570 |
rc = sqlite3_step(st); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
571 |
} |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
572 |
CleanupStack::PopAndDestroy();//st |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
573 |
} |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
574 |
else |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
575 |
{ |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
576 |
User::Leave(KErrCorrupt); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
577 |
} |
383
931d0db6374d
Catchup with Symbian1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
376
diff
changeset
|
578 |
|
931d0db6374d
Catchup with Symbian1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
376
diff
changeset
|
579 |
// now update DB |
931d0db6374d
Catchup with Symbian1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
376
diff
changeset
|
580 |
_LIT(KSqlStatement2, "update shows set downloadstate=%d and deletedate = 0 where downloadstate=%d and deletedate != 0 and deletedate < \"%Ld\""); |
931d0db6374d
Catchup with Symbian1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
376
diff
changeset
|
581 |
iSqlBuffer.Format(KSqlStatement2, ENotDownloaded, EDownloaded, now.Int64()); |
931d0db6374d
Catchup with Symbian1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
376
diff
changeset
|
582 |
|
931d0db6374d
Catchup with Symbian1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
376
diff
changeset
|
583 |
|
931d0db6374d
Catchup with Symbian1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
376
diff
changeset
|
584 |
rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, |
931d0db6374d
Catchup with Symbian1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
376
diff
changeset
|
585 |
&st, (const void**) NULL); |
931d0db6374d
Catchup with Symbian1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
376
diff
changeset
|
586 |
|
931d0db6374d
Catchup with Symbian1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
376
diff
changeset
|
587 |
if (rc == SQLITE_OK) |
931d0db6374d
Catchup with Symbian1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
376
diff
changeset
|
588 |
{ |
931d0db6374d
Catchup with Symbian1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
376
diff
changeset
|
589 |
rc = sqlite3_step(st); |
931d0db6374d
Catchup with Symbian1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
376
diff
changeset
|
590 |
Cleanup_sqlite3_finalize_PushL(st); |
931d0db6374d
Catchup with Symbian1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
376
diff
changeset
|
591 |
CleanupStack::PopAndDestroy();//st |
931d0db6374d
Catchup with Symbian1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
376
diff
changeset
|
592 |
} |
931d0db6374d
Catchup with Symbian1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
376
diff
changeset
|
593 |
|
931d0db6374d
Catchup with Symbian1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
376
diff
changeset
|
594 |
|
368
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
595 |
DP("CShowEngine::DBGetOldShowsL END"); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
596 |
} |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
597 |
|
2 | 598 |
CShowInfo* CShowEngine::DBGetNextDownloadL() |
599 |
{ |
|
600 |
DP("CShowEngine::DBGetNextDownload"); |
|
601 |
CShowInfo *showInfo = NULL; |
|
368
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
602 |
_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, shows.uid, showsize, trackno, pubdate, showtype, lasterror, deletedate from downloads, shows where downloads.uid=shows.uid"); |
2 | 603 |
iSqlBuffer.Format(KSqlStatement); |
604 |
||
605 |
#ifdef DONT_SORT_SQL |
|
606 |
_LIT(KSqlSort, " limit 1"); |
|
607 |
iSqlBuffer.Append(KSqlSort); |
|
608 |
#else |
|
609 |
_LIT(KSqlNoSort, " order by dl_index limit 1"); |
|
610 |
iSqlBuffer.Append(KSqlNoSort); |
|
611 |
#endif |
|
612 |
||
613 |
sqlite3_stmt *st; |
|
614 |
||
615 |
int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, |
|
616 |
&st, (const void**) NULL); |
|
617 |
||
618 |
if (rc == SQLITE_OK) |
|
619 |
{ |
|
620 |
rc = sqlite3_step(st); |
|
621 |
Cleanup_sqlite3_finalize_PushL(st); |
|
622 |
if (rc == SQLITE_ROW) |
|
623 |
{ |
|
624 |
showInfo = CShowInfo::NewLC(); |
|
625 |
DBFillShowInfoFromStmtL(st, showInfo); |
|
626 |
CleanupStack::Pop(showInfo); |
|
627 |
} |
|
111 | 628 |
else |
629 |
{ |
|
630 |
User::Leave(KErrUnknown); |
|
631 |
} |
|
2 | 632 |
CleanupStack::PopAndDestroy();//st |
633 |
} |
|
111 | 634 |
else |
635 |
{ |
|
636 |
User::Leave(KErrCorrupt); |
|
637 |
} |
|
2 | 638 |
|
639 |
return showInfo; |
|
640 |
} |
|
641 |
||
642 |
void CShowEngine::DBGetShowsByFeedL(RShowInfoArray& aShowArray, TUint aFeedUid) |
|
643 |
{ |
|
644 |
DP1("CShowEngine::DBGetShowsByFeed BEGIN, feedUid=%u", aFeedUid); |
|
368
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
645 |
_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype, lasterror, deletedate from shows where feeduid=%u"); |
2 | 646 |
iSqlBuffer.Format(KSqlStatement, aFeedUid); |
368
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
647 |
|
2 | 648 |
#ifndef DONT_SORT_SQL |
649 |
_LIT(KSqlOrderByDate, " order by pubdate desc"); |
|
650 |
iSqlBuffer.Append(KSqlOrderByDate); |
|
651 |
#endif |
|
652 |
||
653 |
sqlite3_stmt *st; |
|
654 |
||
655 |
int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, |
|
656 |
&st, (const void**) NULL); |
|
657 |
||
658 |
if (rc == SQLITE_OK) |
|
659 |
{ |
|
660 |
rc = sqlite3_step(st); |
|
661 |
Cleanup_sqlite3_finalize_PushL(st); |
|
662 |
while (rc == SQLITE_ROW) |
|
663 |
{ |
|
664 |
CShowInfo* showInfo = CShowInfo::NewLC(); |
|
665 |
DBFillShowInfoFromStmtL(st, showInfo); |
|
666 |
aShowArray.Append(showInfo); |
|
667 |
CleanupStack::Pop(showInfo); |
|
668 |
rc = sqlite3_step(st); |
|
669 |
} |
|
670 |
CleanupStack::PopAndDestroy();//st |
|
671 |
} |
|
111 | 672 |
else |
673 |
{ |
|
674 |
User::Leave(KErrCorrupt); |
|
675 |
} |
|
2 | 676 |
DP("CShowEngine::DBGetShowsByFeed END"); |
677 |
} |
|
678 |
||
111 | 679 |
TUint CShowEngine::DBGetDownloadsCountL() |
2 | 680 |
{ |
681 |
DP("CShowEngine::DBGetDownloadsCount"); |
|
682 |
||
683 |
_LIT(KSqlStatement, "select count(*) from downloads"); |
|
684 |
iSqlBuffer.Format(KSqlStatement); |
|
685 |
||
686 |
sqlite3_stmt *st; |
|
687 |
TUint count = 0; |
|
688 |
||
689 |
int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, |
|
690 |
&st, (const void**) NULL); |
|
691 |
||
692 |
if (rc == SQLITE_OK) |
|
693 |
{ |
|
111 | 694 |
Cleanup_sqlite3_finalize_PushL(st); |
2 | 695 |
rc = sqlite3_step(st); |
696 |
||
697 |
if (rc == SQLITE_ROW) |
|
698 |
{ |
|
699 |
count = sqlite3_column_int(st, 0); |
|
700 |
} |
|
111 | 701 |
else |
702 |
{ |
|
703 |
User::Leave(KErrUnknown); |
|
704 |
} |
|
705 |
||
706 |
CleanupStack::PopAndDestroy(); //st |
|
707 |
} |
|
708 |
else |
|
709 |
{ |
|
710 |
User::Leave(KErrCorrupt); |
|
2 | 711 |
} |
712 |
return count; |
|
713 |
} |
|
714 |
||
715 |
void CShowEngine::DBGetDownloadedShowsL(RShowInfoArray& aShowArray) |
|
716 |
{ |
|
717 |
DP("CShowEngine::DBGetDownloadedShows"); |
|
368
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
718 |
_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype, lasterror, deletedate from shows where downloadstate=%u"); |
2 | 719 |
iSqlBuffer.Format(KSqlStatement, EDownloaded); |
720 |
||
721 |
#ifndef DONT_SORT_SQL |
|
722 |
_LIT(KSqlSort, " order by title"); |
|
723 |
iSqlBuffer.Append(KSqlSort); |
|
724 |
#endif |
|
725 |
||
726 |
sqlite3_stmt *st; |
|
727 |
||
728 |
int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, |
|
729 |
&st, (const void**) NULL); |
|
730 |
||
731 |
if (rc == SQLITE_OK) |
|
732 |
{ |
|
733 |
rc = sqlite3_step(st); |
|
734 |
Cleanup_sqlite3_finalize_PushL(st); |
|
735 |
while (rc == SQLITE_ROW) |
|
736 |
{ |
|
737 |
CShowInfo* showInfo = CShowInfo::NewLC(); |
|
738 |
DBFillShowInfoFromStmtL(st, showInfo); |
|
739 |
aShowArray.Append(showInfo); |
|
740 |
CleanupStack::Pop(showInfo); |
|
741 |
rc = sqlite3_step(st); |
|
742 |
} |
|
743 |
CleanupStack::PopAndDestroy();//st |
|
744 |
} |
|
111 | 745 |
else |
746 |
{ |
|
747 |
User::Leave(KErrCorrupt); |
|
748 |
} |
|
2 | 749 |
} |
750 |
||
751 |
void CShowEngine::DBGetNewShowsL(RShowInfoArray& aShowArray) |
|
752 |
{ |
|
753 |
DP("CShowEngine::DBGetNewShows"); |
|
368
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
754 |
_LIT(KSqlStatement, "select url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype, lasterror from shows where playstate=%u order by pubdate desc"); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
755 |
|
2 | 756 |
iSqlBuffer.Format(KSqlStatement, ENeverPlayed); |
757 |
||
758 |
sqlite3_stmt *st; |
|
759 |
||
760 |
int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, |
|
761 |
&st, (const void**) NULL); |
|
762 |
||
763 |
if (rc == SQLITE_OK) |
|
764 |
{ |
|
765 |
rc = sqlite3_step(st); |
|
766 |
Cleanup_sqlite3_finalize_PushL(st); |
|
767 |
while (rc == SQLITE_ROW) |
|
768 |
{ |
|
769 |
CShowInfo* showInfo = CShowInfo::NewLC(); |
|
770 |
DBFillShowInfoFromStmtL(st, showInfo); |
|
771 |
aShowArray.Append(showInfo); |
|
772 |
CleanupStack::Pop(showInfo); |
|
773 |
rc = sqlite3_step(st); |
|
774 |
} |
|
775 |
CleanupStack::PopAndDestroy();//st |
|
776 |
} |
|
111 | 777 |
else |
778 |
{ |
|
779 |
User::Leave(KErrCorrupt); |
|
780 |
} |
|
2 | 781 |
} |
782 |
||
111 | 783 |
void CShowEngine::DBDeleteOldShowsByFeedL(TUint aFeedUid) |
2 | 784 |
{ |
785 |
DP("CShowEngine::DBDeleteOldShows"); |
|
786 |
||
787 |
// what we do: |
|
788 |
// 1. sort shows by pubdate |
|
789 |
// 2. select the first MaxListItems shows |
|
790 |
// 3. delete the rest if downloadstate is ENotDownloaded |
|
791 |
||
126 | 792 |
_LIT(KSqlStatement,"delete from shows where feeduid=%u and downloadstate=0 and uid not in (select uid from shows where feeduid=%u order by pubdate desc limit %u)"); |
2 | 793 |
iSqlBuffer.Format(KSqlStatement, aFeedUid, aFeedUid, iPodcastModel.SettingsEngine().MaxListItems()); |
794 |
||
795 |
sqlite3_stmt *st; |
|
796 |
||
797 |
int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, |
|
798 |
&st, (const void**) NULL); |
|
799 |
||
800 |
if (rc == SQLITE_OK) |
|
801 |
{ |
|
802 |
rc = sqlite3_step(st); |
|
803 |
sqlite3_finalize(st); |
|
804 |
} |
|
111 | 805 |
else |
806 |
{ |
|
807 |
User::Leave(KErrCorrupt); |
|
808 |
} |
|
2 | 809 |
|
810 |
_LIT(KSqlStatement2, "delete from downloads where uid not in (select downloads.uid from shows, downloads where shows.uid=downloads.uid)"); |
|
811 |
iSqlBuffer.Format(KSqlStatement2); |
|
812 |
||
813 |
rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, &st, (const void**) NULL); |
|
814 |
||
815 |
if (rc == SQLITE_OK) |
|
816 |
{ |
|
817 |
rc = sqlite3_step(st); |
|
818 |
sqlite3_finalize(st); |
|
819 |
} |
|
111 | 820 |
else |
821 |
{ |
|
822 |
User::Leave(KErrCorrupt); |
|
823 |
} |
|
2 | 824 |
} |
825 |
||
826 |
void CShowEngine::DBFillShowInfoFromStmtL(sqlite3_stmt *st, CShowInfo* showInfo) |
|
827 |
{ |
|
828 |
const void *urlz = sqlite3_column_text16(st, 0); |
|
829 |
TPtrC16 url((const TUint16*) urlz); |
|
830 |
showInfo->SetUrlL(url); |
|
831 |
||
832 |
const void *titlez = sqlite3_column_text16(st, 1); |
|
833 |
TPtrC16 title((const TUint16*) titlez); |
|
834 |
showInfo->SetTitleL(title); |
|
835 |
||
836 |
const void *descz = sqlite3_column_text16(st, 2); |
|
837 |
TPtrC16 desc((const TUint16*) descz); |
|
838 |
showInfo->SetDescriptionL(desc); |
|
839 |
||
840 |
const void *filez = sqlite3_column_text16(st, 3); |
|
841 |
TPtrC16 file((const TUint16*) filez); |
|
842 |
showInfo->SetFileNameL(file); |
|
843 |
||
844 |
sqlite3_int64 pos = sqlite3_column_int64(st, 4); |
|
845 |
TTimeIntervalMicroSeconds position(pos); |
|
846 |
showInfo->SetPosition(position); |
|
847 |
||
848 |
TUint playtime = sqlite3_column_int(st, 5); |
|
849 |
showInfo->SetPlayTime(playtime); |
|
850 |
||
851 |
TUint playstate = sqlite3_column_int(st, 6); |
|
852 |
showInfo->SetPlayState((TPlayState) playstate); |
|
853 |
||
854 |
TUint downloadstate = sqlite3_column_int(st, 7); |
|
855 |
showInfo->SetDownloadState((TDownloadState) downloadstate); |
|
856 |
||
857 |
TUint feeduid = sqlite3_column_int(st, 8); |
|
858 |
showInfo->SetFeedUid(feeduid); |
|
859 |
||
860 |
TUint uid = sqlite3_column_int(st, 9); |
|
861 |
showInfo->SetUid(uid); |
|
862 |
||
863 |
TUint showsize = sqlite3_column_int(st, 10); |
|
864 |
showInfo->SetShowSize(showsize); |
|
865 |
||
866 |
TUint trackno = sqlite3_column_int(st, 11); |
|
867 |
showInfo->SetTrackNo((TShowType) trackno); |
|
868 |
||
869 |
sqlite3_int64 pubdate = sqlite3_column_int64(st, 12); |
|
870 |
TTime timepubdate(pubdate); |
|
871 |
showInfo->SetPubDate(timepubdate); |
|
872 |
||
873 |
TUint showtype = sqlite3_column_int(st, 13); |
|
874 |
showInfo->SetShowType((TShowType) showtype); |
|
875 |
||
876 |
TInt lasterror = sqlite3_column_int(st, 14); |
|
877 |
showInfo->SetLastError(lasterror); |
|
368
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
878 |
|
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
879 |
sqlite3_int64 deletedate = sqlite3_column_int64(st, 15); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
880 |
TTime timedeletedate(deletedate); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
881 |
showInfo->SetDeleteDate(timedeletedate); |
2 | 882 |
} |
883 |
||
111 | 884 |
void CShowEngine::DBAddShowL(const CShowInfo& aItem) |
2 | 885 |
{ |
886 |
DP2("CShowEngine::DBAddShow, title=%S, URL=%S", &aItem.Title(), &aItem.Url()); |
|
887 |
||
21 | 888 |
HBufC* titleBuf = HBufC::NewLC(KMaxLineLength); |
889 |
TPtr titlePtr(titleBuf->Des()); |
|
890 |
titlePtr.Copy(aItem.Title()); |
|
891 |
PodcastUtils::SQLEncode(titlePtr); |
|
892 |
||
893 |
HBufC* descBuf = HBufC::NewLC(KMaxLineLength); |
|
894 |
TPtr descPtr(descBuf->Des()); |
|
895 |
descPtr.Copy(aItem.Description()); |
|
896 |
PodcastUtils::SQLEncode(descPtr); |
|
897 |
||
368
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
898 |
_LIT(KSqlStatement, "insert into shows (url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype, deletedate) values (\"%S\",\"%S\", \"%S\", \"%S\", \"%Lu\", \"%u\", \"%u\", \"%u\", \"%u\", \"%u\", \"%u\", \"%u\", \"%Lu\", \"%d\", \"%Lu\")"); |
21 | 899 |
|
900 |
iSqlBuffer.Format(KSqlStatement, &aItem.Url(), &titlePtr, &descPtr, |
|
2 | 901 |
&aItem.FileName(), aItem.Position().Int64(), aItem.PlayTime(), |
902 |
aItem.PlayState(), aItem.DownloadState(), aItem.FeedUid(), |
|
903 |
aItem.Uid(), aItem.ShowSize(), aItem.TrackNo(), |
|
368
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
904 |
aItem.PubDate().Int64(), aItem.ShowType(), aItem.DeleteDate().Int64()); |
2 | 905 |
|
21 | 906 |
CleanupStack::PopAndDestroy(descBuf); |
907 |
CleanupStack::PopAndDestroy(titleBuf); |
|
908 |
||
2 | 909 |
sqlite3_stmt *st; |
910 |
||
911 |
int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, |
|
912 |
&st, (const void**) NULL); |
|
111 | 913 |
|
2 | 914 |
if (rc == SQLITE_OK) |
915 |
{ |
|
111 | 916 |
Cleanup_sqlite3_finalize_PushL(st); |
2 | 917 |
rc = sqlite3_step(st); |
111 | 918 |
if (rc != SQLITE_DONE) |
2 | 919 |
{ |
111 | 920 |
User::Leave(KErrAlreadyExists); |
2 | 921 |
} |
111 | 922 |
CleanupStack::PopAndDestroy(); // st |
2 | 923 |
} |
924 |
else |
|
925 |
{ |
|
111 | 926 |
User::Leave(KErrCorrupt); |
2 | 927 |
} |
928 |
} |
|
929 |
||
111 | 930 |
void CShowEngine::DBAddDownloadL(TUint aUid) |
2 | 931 |
{ |
932 |
DP1("CShowEngine::DBAddDownload, aUid=%u", aUid); |
|
933 |
||
934 |
_LIT(KSqlStatement, "insert into downloads (uid) values (%u)"); |
|
935 |
iSqlBuffer.Format(KSqlStatement, aUid); |
|
936 |
sqlite3_stmt *st; |
|
937 |
||
938 |
int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, |
|
939 |
&st, (const void**) NULL); |
|
940 |
||
941 |
if (rc == SQLITE_OK) |
|
942 |
{ |
|
111 | 943 |
Cleanup_sqlite3_finalize_PushL(st); |
2 | 944 |
rc = sqlite3_step(st); |
116 | 945 |
if (rc != SQLITE_DONE) |
111 | 946 |
{ |
947 |
User::Leave(KErrUnknown); |
|
948 |
} |
|
949 |
CleanupStack::PopAndDestroy(); // st |
|
2 | 950 |
} |
111 | 951 |
else |
952 |
{ |
|
953 |
User::Leave(KErrCorrupt); |
|
954 |
} |
|
2 | 955 |
} |
956 |
||
111 | 957 |
void CShowEngine::DBUpdateShowL(CShowInfo& aItem) |
2 | 958 |
{ |
959 |
DP1("CShowEngine::DBUpdateShow, title='%S'", &aItem.Title()); |
|
960 |
||
30
7bca37ba5fa9
Added SQLEncoding for update of showinfo. Removed ABLD.BAT from repo
teknolog
parents:
22
diff
changeset
|
961 |
HBufC* titleBuf = HBufC::NewLC(KMaxLineLength); |
7bca37ba5fa9
Added SQLEncoding for update of showinfo. Removed ABLD.BAT from repo
teknolog
parents:
22
diff
changeset
|
962 |
TPtr titlePtr(titleBuf->Des()); |
7bca37ba5fa9
Added SQLEncoding for update of showinfo. Removed ABLD.BAT from repo
teknolog
parents:
22
diff
changeset
|
963 |
titlePtr.Copy(aItem.Title()); |
7bca37ba5fa9
Added SQLEncoding for update of showinfo. Removed ABLD.BAT from repo
teknolog
parents:
22
diff
changeset
|
964 |
PodcastUtils::SQLEncode(titlePtr); |
7bca37ba5fa9
Added SQLEncoding for update of showinfo. Removed ABLD.BAT from repo
teknolog
parents:
22
diff
changeset
|
965 |
|
7bca37ba5fa9
Added SQLEncoding for update of showinfo. Removed ABLD.BAT from repo
teknolog
parents:
22
diff
changeset
|
966 |
HBufC* descBuf = HBufC::NewLC(KMaxLineLength); |
7bca37ba5fa9
Added SQLEncoding for update of showinfo. Removed ABLD.BAT from repo
teknolog
parents:
22
diff
changeset
|
967 |
TPtr descPtr(descBuf->Des()); |
7bca37ba5fa9
Added SQLEncoding for update of showinfo. Removed ABLD.BAT from repo
teknolog
parents:
22
diff
changeset
|
968 |
descPtr.Copy(aItem.Description()); |
7bca37ba5fa9
Added SQLEncoding for update of showinfo. Removed ABLD.BAT from repo
teknolog
parents:
22
diff
changeset
|
969 |
PodcastUtils::SQLEncode(descPtr); |
7bca37ba5fa9
Added SQLEncoding for update of showinfo. Removed ABLD.BAT from repo
teknolog
parents:
22
diff
changeset
|
970 |
|
368
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
971 |
_LIT(KSqlStatement, "update shows set url=\"%S\", title=\"%S\", description=\"%S\", filename=\"%S\", position=\"%Lu\", playtime=\"%u\", playstate=\"%u\", downloadstate=\"%u\", feeduid=\"%u\", showsize=\"%u\", trackno=\"%u\",pubdate=\"%Lu\", showtype=\"%d\", lasterror=\"%d\", deletedate=\"%Lu\" where uid=\"%u\""); |
30
7bca37ba5fa9
Added SQLEncoding for update of showinfo. Removed ABLD.BAT from repo
teknolog
parents:
22
diff
changeset
|
972 |
iSqlBuffer.Format(KSqlStatement, &aItem.Url(), &titlePtr, &descPtr, |
2 | 973 |
&aItem.FileName(), aItem.Position().Int64(), aItem.PlayTime(), |
974 |
aItem.PlayState(), aItem.DownloadState(), aItem.FeedUid(), |
|
975 |
aItem.ShowSize(), aItem.TrackNo(), aItem.PubDate().Int64(), |
|
368
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
976 |
aItem.ShowType(), aItem.LastError(), aItem.DeleteDate().Int64(), aItem.Uid()); |
2 | 977 |
|
30
7bca37ba5fa9
Added SQLEncoding for update of showinfo. Removed ABLD.BAT from repo
teknolog
parents:
22
diff
changeset
|
978 |
CleanupStack::PopAndDestroy(descBuf); |
7bca37ba5fa9
Added SQLEncoding for update of showinfo. Removed ABLD.BAT from repo
teknolog
parents:
22
diff
changeset
|
979 |
CleanupStack::PopAndDestroy(titleBuf); |
7bca37ba5fa9
Added SQLEncoding for update of showinfo. Removed ABLD.BAT from repo
teknolog
parents:
22
diff
changeset
|
980 |
|
2 | 981 |
sqlite3_stmt *st; |
982 |
||
983 |
int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, |
|
984 |
&st, (const void**) NULL); |
|
985 |
||
986 |
if (rc == SQLITE_OK) |
|
987 |
{ |
|
111 | 988 |
Cleanup_sqlite3_finalize_PushL(st); |
989 |
rc = sqlite3_step(st); |
|
2 | 990 |
|
116 | 991 |
if (rc != SQLITE_DONE) |
2 | 992 |
{ |
111 | 993 |
User::Leave(KErrUnknown); |
2 | 994 |
} |
111 | 995 |
CleanupStack::PopAndDestroy(); // st |
2 | 996 |
} |
997 |
else |
|
998 |
{ |
|
111 | 999 |
User::Leave(KErrCorrupt); |
2 | 1000 |
} |
1001 |
} |
|
1002 |
||
111 | 1003 |
void CShowEngine::DBDeleteShowL(TUint aUid) |
2 | 1004 |
{ |
1005 |
DP("CShowEngine::DBDeleteShow"); |
|
1006 |
||
1007 |
_LIT(KSqlStatement, "delete from shows where uid=%u"); |
|
1008 |
iSqlBuffer.Format(KSqlStatement, aUid); |
|
1009 |
||
1010 |
sqlite3_stmt *st; |
|
1011 |
||
1012 |
int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, |
|
1013 |
&st, (const void**) NULL); |
|
1014 |
||
1015 |
if (rc == SQLITE_OK) |
|
1016 |
{ |
|
111 | 1017 |
Cleanup_sqlite3_finalize_PushL(st); |
2 | 1018 |
rc = sqlite3_step(st); |
1019 |
||
116 | 1020 |
if (rc != SQLITE_DONE) |
2 | 1021 |
{ |
111 | 1022 |
User::Leave(KErrUnknown); |
2 | 1023 |
} |
111 | 1024 |
CleanupStack::PopAndDestroy(); // st |
2 | 1025 |
} |
1026 |
else |
|
1027 |
{ |
|
111 | 1028 |
User::Leave(KErrCorrupt); |
2 | 1029 |
} |
1030 |
} |
|
1031 |
||
111 | 1032 |
void CShowEngine::DBDeleteAllShowsByFeedL(TUint aFeedUid) |
2 | 1033 |
{ |
1034 |
DP("CShowEngine::DBDeleteAllShowsByFeed"); |
|
1035 |
||
1036 |
_LIT(KSqlStatement, "delete from shows where feeduid=%u"); |
|
1037 |
iSqlBuffer.Format(KSqlStatement, aFeedUid); |
|
1038 |
||
1039 |
sqlite3_stmt *st; |
|
1040 |
||
1041 |
int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, |
|
1042 |
&st, (const void**) NULL); |
|
1043 |
||
1044 |
if (rc == SQLITE_OK) |
|
1045 |
{ |
|
111 | 1046 |
Cleanup_sqlite3_finalize_PushL(st); |
2 | 1047 |
rc = sqlite3_step(st); |
1048 |
||
116 | 1049 |
if (rc != SQLITE_DONE) |
2 | 1050 |
{ |
111 | 1051 |
User::Leave(KErrUnknown); |
2 | 1052 |
} |
111 | 1053 |
CleanupStack::PopAndDestroy(); // st |
2 | 1054 |
} |
1055 |
else |
|
1056 |
{ |
|
111 | 1057 |
User::Leave(KErrCorrupt); |
2 | 1058 |
} |
1059 |
} |
|
1060 |
||
111 | 1061 |
void CShowEngine::DBRemoveAllDownloadsL() |
2 | 1062 |
{ |
1063 |
DP("CShowEngine::DBRemoveAllDownloads"); |
|
1064 |
||
1065 |
_LIT(KSqlStatement, "delete from downloads"); |
|
1066 |
iSqlBuffer.Format(KSqlStatement); |
|
1067 |
||
1068 |
sqlite3_stmt *st; |
|
1069 |
||
1070 |
int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, |
|
1071 |
&st, (const void**) NULL); |
|
1072 |
||
1073 |
if (rc == SQLITE_OK) |
|
1074 |
{ |
|
1075 |
rc = sqlite3_step(st); |
|
1076 |
sqlite3_finalize(st); |
|
1077 |
} |
|
111 | 1078 |
else |
1079 |
{ |
|
1080 |
User::Leave(KErrCorrupt); |
|
1081 |
} |
|
2 | 1082 |
|
1083 |
_LIT(KSqlStatement2, "update shows set downloadstate=0 where downloadstate=1"); |
|
1084 |
iSqlBuffer.Format(KSqlStatement2); |
|
1085 |
||
1086 |
rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, &st, |
|
1087 |
(const void**) NULL); |
|
1088 |
||
1089 |
if (rc == SQLITE_OK) |
|
1090 |
{ |
|
111 | 1091 |
Cleanup_sqlite3_finalize_PushL(st); |
2 | 1092 |
rc = sqlite3_step(st); |
116 | 1093 |
if (rc != SQLITE_DONE) |
111 | 1094 |
{ |
1095 |
User::Leave(KErrUnknown); |
|
1096 |
} |
|
1097 |
CleanupStack::PopAndDestroy(); // st |
|
1098 |
} |
|
1099 |
else |
|
1100 |
{ |
|
1101 |
User::Leave(KErrCorrupt); |
|
2 | 1102 |
} |
1103 |
||
1104 |
} |
|
1105 |
||
111 | 1106 |
void CShowEngine::DBRemoveDownloadL(TUint aUid) |
2 | 1107 |
{ |
1108 |
DP("CShowEngine::DBRemoveDownload"); |
|
1109 |
||
1110 |
_LIT(KSqlStatement, "delete from downloads where uid=%u"); |
|
1111 |
iSqlBuffer.Format(KSqlStatement, aUid); |
|
1112 |
||
1113 |
sqlite3_stmt *st; |
|
1114 |
||
1115 |
int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, |
|
1116 |
&st, (const void**) NULL); |
|
1117 |
||
1118 |
if (rc == SQLITE_OK) |
|
1119 |
{ |
|
111 | 1120 |
Cleanup_sqlite3_finalize_PushL(st); |
2 | 1121 |
rc = sqlite3_step(st); |
116 | 1122 |
if (rc != SQLITE_DONE) |
111 | 1123 |
{ |
1124 |
User::Leave(KErrUnknown); |
|
1125 |
} |
|
1126 |
CleanupStack::PopAndDestroy(); // st |
|
1127 |
} |
|
1128 |
else |
|
1129 |
{ |
|
1130 |
User::Leave(KErrCorrupt); |
|
2 | 1131 |
} |
1132 |
} |
|
1133 |
||
151 | 1134 |
void CShowEngine::DBSwapDownloadsL(TDownload aFirstDL, TDownload aSecondDL) |
1135 |
{ |
|
1136 |
DP("CShowEngine::DBSwapDownloadsL"); |
|
1137 |
_LIT(KSqlStatement, "update downloads set uid=%u where dl_index=%d"); |
|
1138 |
||
1139 |
iSqlBuffer.Format(KSqlStatement, aFirstDL.iUid, aSecondDL.iIndex); |
|
1140 |
sqlite3_stmt *st; |
|
1141 |
int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, |
|
1142 |
&st, (const void**) NULL); |
|
1143 |
||
1144 |
if (rc == SQLITE_OK) |
|
1145 |
{ |
|
1146 |
Cleanup_sqlite3_finalize_PushL(st); |
|
1147 |
rc = sqlite3_step(st); |
|
1148 |
if (rc != SQLITE_DONE) |
|
1149 |
{ |
|
1150 |
User::Leave(KErrUnknown); |
|
1151 |
} |
|
1152 |
CleanupStack::PopAndDestroy(); // st |
|
1153 |
} |
|
1154 |
else |
|
1155 |
{ |
|
1156 |
User::Leave(KErrCorrupt); |
|
1157 |
} |
|
1158 |
||
1159 |
iSqlBuffer.Format(KSqlStatement, aSecondDL.iUid, aFirstDL.iIndex); |
|
1160 |
||
1161 |
rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, |
|
1162 |
&st, (const void**) NULL); |
|
1163 |
||
1164 |
if (rc == SQLITE_OK) |
|
1165 |
{ |
|
1166 |
Cleanup_sqlite3_finalize_PushL(st); |
|
1167 |
rc = sqlite3_step(st); |
|
1168 |
if (rc != SQLITE_DONE) |
|
1169 |
{ |
|
1170 |
User::Leave(KErrUnknown); |
|
1171 |
} |
|
1172 |
CleanupStack::PopAndDestroy(); // st |
|
1173 |
} |
|
1174 |
else |
|
1175 |
{ |
|
1176 |
User::Leave(KErrCorrupt); |
|
1177 |
} |
|
1178 |
} |
|
1179 |
||
2 | 1180 |
EXPORT_C CShowInfo* CShowEngine::GetNextShowByTrackL(CShowInfo* aShowInfo) |
1181 |
{ |
|
1182 |
CShowInfo* nextShow = NULL; |
|
1183 |
RShowInfoArray array; |
|
1184 |
DBGetShowsByFeedL(array, aShowInfo->FeedUid()); |
|
1185 |
TUint diff = KMaxTInt; |
|
1186 |
for (TInt loop = 0; loop < array.Count(); loop++) |
|
1187 |
{ |
|
1188 |
if (aShowInfo->TrackNo() < array[loop]->TrackNo()) |
|
1189 |
{ |
|
1190 |
if ((array[loop]->TrackNo() - aShowInfo->TrackNo()) < diff) |
|
1191 |
{ |
|
1192 |
diff = array[loop]->TrackNo() - aShowInfo->TrackNo(); |
|
1193 |
nextShow = array[loop]; |
|
1194 |
} |
|
1195 |
} |
|
1196 |
} |
|
1197 |
array.ResetAndDestroy(); |
|
1198 |
return nextShow; |
|
1199 |
} |
|
1200 |
||
1201 |
TBool CShowEngine::CompareShowsByUid(const CShowInfo &a, const CShowInfo &b) |
|
1202 |
{ |
|
1203 |
return a.Uid() == b.Uid(); |
|
1204 |
} |
|
1205 |
||
1206 |
TInt CShowEngine::CompareShowsByDate(const CShowInfo &a, const CShowInfo &b) |
|
1207 |
{ |
|
1208 |
if (a.PubDate() > b.PubDate()) |
|
1209 |
{ |
|
1210 |
// DP2("Sorting %S less than %S", &a.iTitle, &b.iTitle); |
|
1211 |
return -1; |
|
1212 |
} |
|
1213 |
else if (a.PubDate() == b.PubDate()) |
|
1214 |
{ |
|
1215 |
// DP2("Sorting %S equal to %S", &a.iTitle, &b.iTitle); |
|
1216 |
return 0; |
|
1217 |
} |
|
1218 |
else |
|
1219 |
{ |
|
1220 |
// DP2("Sorting %S greater than %S", &a.iTitle, &b.iTitle); |
|
1221 |
return 1; |
|
1222 |
} |
|
1223 |
} |
|
1224 |
||
1225 |
TInt CShowEngine::CompareShowsByTrackNo(const CShowInfo &a, const CShowInfo &b) |
|
1226 |
{ |
|
1227 |
if (a.TrackNo() < b.TrackNo()) |
|
1228 |
{ |
|
1229 |
return -1; |
|
1230 |
} |
|
1231 |
else if (a.TrackNo() == b.TrackNo()) |
|
1232 |
{ |
|
1233 |
return 0; |
|
1234 |
} |
|
1235 |
else |
|
1236 |
{ |
|
1237 |
return 1; |
|
1238 |
} |
|
1239 |
} |
|
1240 |
||
1241 |
TInt CShowEngine::CompareShowsByTitle(const CShowInfo &a, const CShowInfo &b) |
|
1242 |
{ |
|
1243 |
if (a.Title() < b.Title()) |
|
1244 |
{ |
|
1245 |
// DP2("Sorting %S less than %S", &a.iTitle, &b.iTitle); |
|
1246 |
return -1; |
|
1247 |
} |
|
1248 |
else if (a.Title() == b.Title()) |
|
1249 |
{ |
|
1250 |
// DP2("Sorting %S equal to %S", &a.iTitle, &b.iTitle); |
|
1251 |
return 0; |
|
1252 |
} |
|
1253 |
else |
|
1254 |
{ |
|
1255 |
// DP2("Sorting %S greater than %S", &a.iTitle, &b.iTitle); |
|
1256 |
return 1; |
|
1257 |
} |
|
1258 |
} |
|
1259 |
||
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
30
diff
changeset
|
1260 |
EXPORT_C void CShowEngine::DeletePlayedShowsL(RShowInfoArray &aShowInfoArray) |
2 | 1261 |
{ |
1262 |
for (TInt i = 0; i < aShowInfoArray.Count(); i++) |
|
1263 |
{ |
|
1264 |
if (aShowInfoArray[i]->PlayState() == EPlayed |
|
1265 |
&& aShowInfoArray[i]->FileName().Length() > 0) |
|
1266 |
{ |
|
1267 |
BaflUtils::DeleteFile(iPodcastModel.FsSession(), aShowInfoArray[i]->FileName()); |
|
1268 |
aShowInfoArray[i]->SetDownloadState(ENotDownloaded); |
|
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
30
diff
changeset
|
1269 |
DBUpdateShowL(*aShowInfoArray[i]); |
2 | 1270 |
} |
1271 |
} |
|
1272 |
} |
|
1273 |
||
1274 |
EXPORT_C void CShowEngine::DeleteAllShowsByFeedL(TUint aFeedUid, TBool aDeleteFiles) |
|
1275 |
{ |
|
1276 |
RShowInfoArray array; |
|
1277 |
DBGetShowsByFeedL(array, aFeedUid); |
|
1278 |
||
1279 |
const TInt count = array.Count(); |
|
1280 |
||
1281 |
for (TInt i = count - 1; i >= 0; i--) |
|
1282 |
{ |
|
53 | 1283 |
if (iShowDownloading && iShowDownloading->Uid() == array[i]->Uid()) |
1284 |
{ |
|
1285 |
// trying to delete the active download |
|
1286 |
RemoveDownloadL(iShowDownloading->Uid()); |
|
1287 |
} |
|
1288 |
||
1289 |
// delete downloaded file |
|
2 | 1290 |
if (array[i]->FileName().Length() > 0) |
1291 |
{ |
|
1292 |
if (aDeleteFiles) |
|
1293 |
{ |
|
1294 |
BaflUtils::DeleteFile(iPodcastModel.FsSession(), array[i]->FileName()); |
|
1295 |
} |
|
1296 |
} |
|
1297 |
} |
|
1298 |
array.ResetAndDestroy(); |
|
53 | 1299 |
|
1300 |
// delete all shows from DB |
|
111 | 1301 |
DBDeleteAllShowsByFeedL(aFeedUid); |
53 | 1302 |
|
1303 |
// this will clear out deleted shows from the download queue |
|
1304 |
DBGetAllDownloadsL(array); |
|
1305 |
array.ResetAndDestroy(); |
|
1306 |
||
1307 |
NotifyDownloadQueueUpdatedL(); |
|
2 | 1308 |
} |
1309 |
||
111 | 1310 |
EXPORT_C void CShowEngine::DeleteOldShowsByFeedL(TUint aFeedUid) |
2 | 1311 |
{ |
111 | 1312 |
DBDeleteOldShowsByFeedL(aFeedUid); |
2 | 1313 |
} |
1314 |
||
1315 |
EXPORT_C void CShowEngine::DeleteShowL(TUint aShowUid, TBool aRemoveFile) |
|
1316 |
{ |
|
1317 |
||
1318 |
CShowInfo *info = DBGetShowByUidL(aShowUid); |
|
1319 |
||
1320 |
if (info != NULL) |
|
1321 |
{ |
|
1322 |
if (info->FileName().Length() > 0 && aRemoveFile) |
|
1323 |
{ |
|
1324 |
BaflUtils::DeleteFile(iPodcastModel.FsSession(), info->FileName()); |
|
1325 |
} |
|
1326 |
||
1327 |
info->SetDownloadState(ENotDownloaded); |
|
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
30
diff
changeset
|
1328 |
DBUpdateShowL(*info); |
2 | 1329 |
delete info; |
1330 |
} |
|
1331 |
} |
|
1332 |
||
1333 |
EXPORT_C void CShowEngine::GetShowsByFeedL(RShowInfoArray& aShowArray, TUint aFeedUid) |
|
1334 |
{ |
|
1335 |
DP("CShowEngine::GetShowsByFeed"); |
|
1336 |
DBGetShowsByFeedL(aShowArray, aFeedUid); |
|
1337 |
} |
|
1338 |
||
1339 |
EXPORT_C void CShowEngine::GetAllShowsL(RShowInfoArray &aArray) |
|
1340 |
{ |
|
1341 |
DP("CShowEngine::GetAllShows"); |
|
1342 |
DBGetAllShowsL(aArray); |
|
1343 |
} |
|
1344 |
||
1345 |
EXPORT_C void CShowEngine::GetShowsDownloadedL(RShowInfoArray &aArray) |
|
1346 |
{ |
|
1347 |
DP("CShowEngine::GetShowsDownloaded"); |
|
1348 |
DBGetDownloadedShowsL(aArray); |
|
1349 |
} |
|
1350 |
||
1351 |
EXPORT_C void CShowEngine::GetNewShowsL(RShowInfoArray &aArray) |
|
1352 |
{ |
|
1353 |
DP("CShowEngine::GetNewShows"); |
|
1354 |
DBGetNewShowsL(aArray); |
|
1355 |
} |
|
1356 |
||
1357 |
EXPORT_C void CShowEngine::GetShowsDownloadingL(RShowInfoArray &aArray) |
|
1358 |
{ |
|
1359 |
DP("CShowEngine::GetShowsDownloading"); |
|
1360 |
DBGetAllDownloadsL(aArray); |
|
1361 |
} |
|
1362 |
||
1363 |
EXPORT_C TInt CShowEngine::GetNumDownloadingShows() |
|
1364 |
{ |
|
116 | 1365 |
TUint count = 0; |
111 | 1366 |
TRAP_IGNORE(count = DBGetDownloadsCountL()); |
1367 |
||
1368 |
return (const TInt) count; |
|
2 | 1369 |
} |
1370 |
||
1371 |
EXPORT_C void CShowEngine::AddDownloadL(CShowInfo& aInfo) |
|
1372 |
{ |
|
1373 |
aInfo.SetDownloadState(EQueued); |
|
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
30
diff
changeset
|
1374 |
DBUpdateShowL(aInfo); |
111 | 1375 |
DBAddDownloadL(aInfo.Uid()); |
2 | 1376 |
DownloadNextShowL(); |
1377 |
} |
|
1378 |
||
1379 |
void CShowEngine::DownloadNextShowL() |
|
1380 |
{ |
|
1381 |
DP("CShowEngine::DownloadNextShowL BEGIN"); |
|
1382 |
// Check if we have anything in the download queue |
|
111 | 1383 |
const TInt count = DBGetDownloadsCountL(); |
2 | 1384 |
DP("CShowEngine::DownloadNextShow\tTrying to start new download");DP1("CShowEngine::DownloadNextShow\tShows in download queue %d", count); |
1385 |
||
1386 |
if (count > 0) |
|
1387 |
{ |
|
1388 |
if (iPodcastModel.SettingsEngine().DownloadSuspended()) |
|
1389 |
{ |
|
1390 |
DP("CShowEngine::DownloadNextShow\tDownload process is suspended, ABORTING"); |
|
34 | 1391 |
// Inform the observers |
1392 |
NotifyDownloadQueueUpdatedL(); |
|
2 | 1393 |
return; |
1394 |
} |
|
1395 |
else if (iShowClient->IsActive()) |
|
1396 |
{ |
|
1397 |
DP("CShowEngine::DownloadNextShow\tDownload process is already active."); |
|
34 | 1398 |
// Inform the observers |
1399 |
NotifyDownloadQueueUpdatedL(); |
|
2 | 1400 |
return; |
1401 |
} |
|
1402 |
else |
|
1403 |
{ |
|
116 | 1404 |
if (iShowDownloading) { |
1405 |
delete iShowDownloading; |
|
1406 |
} |
|
1407 |
||
2 | 1408 |
// Start the download |
116 | 1409 |
iShowDownloading = DBGetNextDownloadL(); |
1410 |
||
1411 |
while(iShowDownloading != NULL) |
|
2 | 1412 |
{ |
116 | 1413 |
DP1("CShowEngine::DownloadNextShow\tDownloading: %S", &(iShowDownloading->Title())); |
1414 |
iShowDownloading->SetDownloadState(EDownloading); |
|
1415 |
iShowDownloading->SetLastError(KErrNone); |
|
1416 |
DBUpdateShowL(*iShowDownloading); |
|
34 | 1417 |
// Inform the observers |
1418 |
// important to do this after we change download state |
|
1419 |
NotifyDownloadQueueUpdatedL(); |
|
1420 |
||
116 | 1421 |
TRAPD(error,GetShowL(iShowDownloading)); |
1422 |
if (error == KErrNone) |
|
2 | 1423 |
{ |
1424 |
break; |
|
1425 |
} |
|
116 | 1426 |
else |
1427 |
{ |
|
1428 |
iShowDownloading->SetDownloadState(EFailedDownload); |
|
1429 |
DBRemoveDownloadL(iShowDownloading->Uid()); |
|
1430 |
DBUpdateShowL(*iShowDownloading); |
|
1431 |
CleanupStack::PopAndDestroy(iShowDownloading); |
|
1432 |
||
1433 |
iShowDownloading = DBGetNextDownloadL(); |
|
1434 |
if(iShowDownloading == NULL) |
|
1435 |
{ |
|
1436 |
iPodcastModel.SettingsEngine().SetDownloadSuspended(ETrue); |
|
1437 |
} |
|
1438 |
} |
|
2 | 1439 |
} |
1440 |
} |
|
1441 |
} |
|
1442 |
else |
|
1443 |
{ |
|
34 | 1444 |
// Inform the observers |
1445 |
NotifyDownloadQueueUpdatedL(); |
|
2 | 1446 |
iShowDownloading = NULL;DP("CShowEngine::DownloadNextShow\tNothing to download"); |
1447 |
} |
|
1448 |
DP("CShowEngine::DownloadNextShowL END"); |
|
1449 |
} |
|
1450 |
||
1451 |
void CShowEngine::NotifyDownloadQueueUpdatedL() |
|
1452 |
{ |
|
1453 |
const TInt count = iObservers.Count(); |
|
1454 |
for (TInt i = 0; i < count; i++) |
|
1455 |
{ |
|
111 | 1456 |
iObservers[i]->DownloadQueueUpdatedL(1, DBGetDownloadsCountL() - 1); |
2 | 1457 |
} |
1458 |
} |
|
1459 |
||
1460 |
void CShowEngine::NotifyShowDownloadUpdatedL(TInt aBytesOfCurrentDownload, TInt aBytesTotal) |
|
1461 |
{ |
|
1462 |
const TInt count = iObservers.Count(); |
|
1463 |
for (TInt i = 0; i < count; i++) |
|
1464 |
{ |
|
1465 |
iObservers[i]->ShowDownloadUpdatedL(aBytesOfCurrentDownload, aBytesTotal); |
|
1466 |
} |
|
1467 |
} |
|
1468 |
||
1469 |
void CShowEngine::NotifyShowFinishedL(TInt aError) |
|
1470 |
{ |
|
1471 |
const TInt count = iObservers.Count(); |
|
1472 |
for (TInt i = 0; i < count; i++) |
|
1473 |
{ |
|
1474 |
iObservers[i]->ShowDownloadFinishedL(iShowDownloading?iShowDownloading->Uid():0, aError); |
|
1475 |
} |
|
1476 |
} |
|
1477 |
||
1478 |
EXPORT_C void CShowEngine::NotifyShowListUpdatedL() |
|
1479 |
{ |
|
1480 |
for (TInt i = 0; i < iObservers.Count(); i++) |
|
1481 |
{ |
|
1482 |
iObservers[i]->ShowListUpdatedL(); |
|
1483 |
} |
|
1484 |
} |
|
1485 |
||
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
30
diff
changeset
|
1486 |
void CShowEngine::ReadMetaDataL(CShowInfo& aShowInfo) |
2 | 1487 |
{ |
1488 |
//DP1("Read %S", &(aShowInfo->Title())); |
|
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
30
diff
changeset
|
1489 |
DBUpdateShowL(aShowInfo); |
2 | 1490 |
} |
1491 |
||
1492 |
void CShowEngine::ReadMetaDataCompleteL() |
|
1493 |
{ |
|
1494 |
NotifyShowListUpdatedL(); |
|
1495 |
MetaDataReader().SetIgnoreTrackNo(EFalse); |
|
1496 |
} |
|
1497 |
||
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
30
diff
changeset
|
1498 |
EXPORT_C void CShowEngine::UpdateShowL(CShowInfo& aInfo) |
2 | 1499 |
{ |
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
30
diff
changeset
|
1500 |
DBUpdateShowL(aInfo); |
376
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
1501 |
|
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
1502 |
// hack to ensure change in playstate is stored for the show actively downloading |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
1503 |
if (iShowDownloading && iShowDownloading->Uid() == aInfo.Uid()) |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
1504 |
{ |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
1505 |
iShowDownloading->SetPlayState(aInfo.PlayState()); |
31968c23152c
Merging fixes from Symbian 1
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
369
diff
changeset
|
1506 |
} |
2 | 1507 |
} |
1508 |
||
1509 |
EXPORT_C CMetaDataReader& CShowEngine::MetaDataReader() |
|
1510 |
{ |
|
1511 |
return *iMetaDataReader; |
|
1512 |
} |
|
1513 |
||
1514 |
void CShowEngine::FileError(TUint /*aError*/) |
|
1515 |
{ |
|
1516 |
iDownloadErrors = KMaxDownloadErrors; |
|
1517 |
} |
|
118
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1518 |
|
368
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1519 |
EXPORT_C void CShowEngine::ExpireOldShows() |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1520 |
{ |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1521 |
DP("CShowEngine::ExpireOldShows BEGIN"); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1522 |
RShowInfoArray oldShowsArray; |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1523 |
|
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1524 |
TRAPD(err, DBGetOldShowsL(oldShowsArray)); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1525 |
|
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1526 |
if (err == KErrNone) |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1527 |
{ |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1528 |
for (int i=0;i<oldShowsArray.Count();i++) |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1529 |
{ |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1530 |
DP1(" deleting %S", &oldShowsArray[i]->FileName()); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1531 |
BaflUtils::DeleteFile(iPodcastModel.FsSession(), oldShowsArray[i]->FileName()); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1532 |
} |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1533 |
} |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1534 |
DP("CShowEngine::ExpireOldShows END"); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1535 |
} |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1536 |
|
118
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1537 |
EXPORT_C void CShowEngine::CheckForDeletedShows(TUint aFeedUid) |
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1538 |
{ |
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1539 |
RShowInfoArray shows; |
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1540 |
|
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1541 |
TRAPD(err, DBGetShowsByFeedL(shows, aFeedUid)); |
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1542 |
|
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1543 |
if (err != KErrNone) |
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1544 |
{ |
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1545 |
// probably a catastrophic error, but it doesn't |
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1546 |
// matter for this method |
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1547 |
return; |
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1548 |
} |
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1549 |
|
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1550 |
for (int i=0;i<shows.Count();i++) |
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1551 |
{ |
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1552 |
if (shows[i]->DownloadState() == EDownloaded && shows[i]->FileName() != KNullDesC) |
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1553 |
{ |
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1554 |
if(!BaflUtils::FileExists(iPodcastModel.FsSession(),shows[i]->FileName())) |
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1555 |
{ |
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1556 |
// file doesn't exist anymore, assume it was deleted from outside |
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1557 |
DP1("Show %S does not exist on disk, flagging as non downloaded", &shows[i]->FileName()); |
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1558 |
shows[i]->SetDownloadState(ENotDownloaded); |
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1559 |
shows[i]->SetPlayState(EPlayed); |
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1560 |
TRAP_IGNORE(DBUpdateShowL(*shows[i])); |
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1561 |
} |
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1562 |
} |
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1563 |
} |
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1564 |
} |
b03018fb3418
Added method that checks for deleted downloaded files and updates DB accordingly
teknolog
parents:
117
diff
changeset
|
1565 |
|
151 | 1566 |
EXPORT_C void CShowEngine::MoveDownloadUpL(TUint aUid) |
1567 |
{ |
|
1568 |
DP("CShowEngine::MoveDownLoadUpL"); |
|
1569 |
_LIT(KSqlStatement, "select * from downloads"); |
|
1570 |
iSqlBuffer.Format(KSqlStatement); |
|
1571 |
||
1572 |
sqlite3_stmt *st; |
|
1573 |
||
1574 |
int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, |
|
1575 |
&st, (const void**) NULL); |
|
1576 |
||
1577 |
if (rc == SQLITE_OK) |
|
1578 |
{ |
|
1579 |
RArray<TDownload> downloads; |
|
1580 |
CleanupClosePushL(downloads); |
|
1581 |
||
1582 |
rc = sqlite3_step(st); |
|
1583 |
Cleanup_sqlite3_finalize_PushL(st); |
|
1584 |
||
1585 |
TInt selectedIdx = -1; |
|
1586 |
while (rc == SQLITE_ROW && selectedIdx == -1) |
|
1587 |
{ |
|
1588 |
TDownload download; |
|
1589 |
||
1590 |
download.iIndex = sqlite3_column_int(st, 0); |
|
1591 |
download.iUid = sqlite3_column_int(st, 1); |
|
1592 |
||
1593 |
downloads.Append(download); |
|
1594 |
||
1595 |
if (download.iUid == aUid) |
|
1596 |
{ |
|
1597 |
selectedIdx = downloads.Count()-1; |
|
1598 |
} |
|
1599 |
||
1600 |
rc = sqlite3_step(st); |
|
1601 |
} |
|
1602 |
CleanupStack::PopAndDestroy();//st, downloads |
|
1603 |
||
1604 |
// If the selected download was found in the database |
|
1605 |
if (selectedIdx != -1) |
|
1606 |
{ |
|
1607 |
// Swap the specified download with the one above it |
|
1608 |
TDownload selectedDownload = downloads[selectedIdx]; |
|
1609 |
TDownload previousDownload = downloads[selectedIdx - 1]; |
|
1610 |
||
1611 |
// SQL - Update index (with index of selected download) where uid is of previous download |
|
1612 |
// and update index (with index of previous download) where uid if of selected download |
|
1613 |
DBSwapDownloadsL(selectedDownload, previousDownload); |
|
1614 |
} |
|
1615 |
else |
|
1616 |
{ |
|
1617 |
User::Leave(KErrNotFound); |
|
1618 |
} |
|
1619 |
||
1620 |
CleanupStack::PopAndDestroy(); // downloads |
|
1621 |
} |
|
1622 |
else |
|
1623 |
{ |
|
1624 |
User::Leave(KErrCorrupt); |
|
1625 |
} |
|
1626 |
} |
|
1627 |
||
1628 |
EXPORT_C void CShowEngine::MoveDownloadDownL(TUint aUid) |
|
1629 |
{ |
|
1630 |
DP("CShowEngine::MoveDownLoadDownL"); |
|
1631 |
||
1632 |
// An upside-down list will result in the download moving down |
|
1633 |
_LIT(KSqlStatement, "select * from downloads order by dl_index desc"); |
|
1634 |
iSqlBuffer.Format(KSqlStatement); |
|
1635 |
||
1636 |
sqlite3_stmt *st; |
|
1637 |
||
1638 |
int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, |
|
1639 |
&st, (const void**) NULL); |
|
1640 |
||
1641 |
if (rc == SQLITE_OK) |
|
1642 |
{ |
|
1643 |
RArray<TDownload> downloads; |
|
1644 |
CleanupClosePushL(downloads); |
|
1645 |
||
1646 |
rc = sqlite3_step(st); |
|
1647 |
Cleanup_sqlite3_finalize_PushL(st); |
|
1648 |
||
1649 |
TInt selectedIdx = -1; |
|
1650 |
while (rc == SQLITE_ROW && selectedIdx == -1) |
|
1651 |
{ |
|
1652 |
TDownload download; |
|
1653 |
||
1654 |
download.iIndex = sqlite3_column_int(st, 0); |
|
1655 |
download.iUid = sqlite3_column_int(st, 1); |
|
1656 |
||
1657 |
downloads.Append(download); |
|
1658 |
||
1659 |
if (download.iUid == aUid) |
|
1660 |
{ |
|
1661 |
selectedIdx = downloads.Count()-1; |
|
1662 |
} |
|
1663 |
||
1664 |
rc = sqlite3_step(st); |
|
1665 |
} |
|
1666 |
CleanupStack::PopAndDestroy();//st, downloads |
|
1667 |
||
1668 |
// If the selected download was found in the database |
|
1669 |
if (selectedIdx != -1) |
|
1670 |
{ |
|
1671 |
// Swap the specified download with the one above it |
|
1672 |
TDownload selectedDownload = downloads[selectedIdx]; |
|
1673 |
TDownload previousDownload = downloads[selectedIdx - 1]; |
|
1674 |
||
1675 |
// SQL - Update index (with index of selected download) where uid is of previous download |
|
1676 |
// and update index (with index of previous download) where uid if of selected download |
|
1677 |
DBSwapDownloadsL(selectedDownload, previousDownload); |
|
1678 |
} |
|
1679 |
else |
|
1680 |
{ |
|
1681 |
User::Leave(KErrNotFound); |
|
1682 |
} |
|
1683 |
||
1684 |
CleanupStack::PopAndDestroy(); // downloads |
|
1685 |
} |
|
1686 |
else |
|
1687 |
{ |
|
1688 |
User::Leave(KErrCorrupt); |
|
1689 |
} |
|
165
d886725e4499
Fix for 2608 - Title is sometimes not reset to "Podcatcher" after leaving ShowsView
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
151
diff
changeset
|
1690 |
} |
368
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1691 |
|
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1692 |
EXPORT_C void CShowEngine::PostPlayHandling(CShowInfo *aShow) |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1693 |
{ |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1694 |
DP("CShowEngine::PostPlayHandling BEGIN"); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1695 |
if (!aShow) |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1696 |
return; |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1697 |
|
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1698 |
aShow->SetPlayState(EPlayed); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1699 |
|
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1700 |
TAutoDeleteSetting deleteSetting = iPodcastModel.SettingsEngine().DeleteAutomatically(); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1701 |
TTimeIntervalDays daysAhead; |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1702 |
|
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1703 |
switch (deleteSetting) |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1704 |
{ |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1705 |
case EAutoDeleteOff: |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1706 |
break; |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1707 |
case EAutoDeleteAfter1Day: |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1708 |
daysAhead = 1; |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1709 |
break; |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1710 |
case EAutoDeleteAfter7Days: |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1711 |
daysAhead = 7; |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1712 |
break; |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1713 |
} |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1714 |
|
369
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
368
diff
changeset
|
1715 |
if (daysAhead.Int() > 0) |
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
368
diff
changeset
|
1716 |
{ |
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
368
diff
changeset
|
1717 |
TTime deleteDate; |
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
368
diff
changeset
|
1718 |
deleteDate.HomeTime(); |
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
368
diff
changeset
|
1719 |
deleteDate += daysAhead; |
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
368
diff
changeset
|
1720 |
aShow->SetDeleteDate(deleteDate); |
388
5f24605de6cf
Added query when marking all played in shows view; Fix for auto delete
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
383
diff
changeset
|
1721 |
DP2("Setting show %S to be deleted on the %d th", &aShow->Title(), deleteDate.DayNoInMonth()+1); |
369
c683165bec63
More catchup with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
368
diff
changeset
|
1722 |
} |
368
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1723 |
|
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1724 |
UpdateShowL(*aShow); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1725 |
DP("CShowEngine::PostPlayHandling END"); |
b131f7696342
Catch up with 5th edition
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
332
diff
changeset
|
1726 |
} |