author | Sebastian Brannstrom <sebastianb@symbian.org> |
Fri, 09 Jul 2010 23:58:47 +0100 | |
branch | 3rded |
changeset 175 | cd124c4eb6b9 |
parent 164 | 000f9fc147b2 |
child 176 | 1c8b56cb6409 |
child 211 | aa8e7de6f033 |
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 <commdb.h> |
|
20 |
#include "PodcastModel.h" |
|
21 |
#include "FeedEngine.h" |
|
22 |
#include "SettingsEngine.h" |
|
23 |
#include "ShowEngine.h" |
|
24 |
#include "connectionengine.h" |
|
60 | 25 |
#include "podcastutils.h" |
26 |
#include "Podcatcher.pan" |
|
2 | 27 |
|
28 |
#include <cmdestination.h> |
|
29 |
#include <cmmanager.h> |
|
30 |
#include <bautils.h> |
|
90
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
88
diff
changeset
|
31 |
#include <aknserverapp.h> // MAknServerAppExitObserver |
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
88
diff
changeset
|
32 |
#include <DocumentHandler.h> |
2 | 33 |
|
164
000f9fc147b2
Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
148
diff
changeset
|
34 |
|
2 | 35 |
const TInt KDefaultGranu = 5; |
36 |
_LIT(KDBFileName, "podcatcher.sqlite"); |
|
37 |
_LIT(KDBTemplateFileName, "podcatcher.sqlite.template"); |
|
38 |
||
39 |
EXPORT_C CPodcastModel* CPodcastModel::NewL() |
|
40 |
{ |
|
41 |
CPodcastModel* self = new (ELeave) CPodcastModel; |
|
42 |
CleanupStack::PushL(self); |
|
43 |
self->ConstructL(); |
|
44 |
CleanupStack::Pop(self); |
|
45 |
return self; |
|
46 |
} |
|
47 |
||
48 |
CPodcastModel::~CPodcastModel() |
|
49 |
{ |
|
50 |
||
51 |
delete iFeedEngine; |
|
52 |
delete iSettingsEngine; |
|
53 |
delete iShowEngine; |
|
54 |
||
55 |
delete iIapNameArray; |
|
56 |
iIapIdArray.Close(); |
|
57 |
||
58 |
delete iSNAPNameArray; |
|
59 |
iSNAPIdArray.Close(); |
|
60 |
delete iCommDB; |
|
61 |
sqlite3_close(iDB); |
|
62 |
iFsSession.Close(); |
|
63 |
iActiveShowList.ResetAndDestroy(); |
|
64 |
iActiveShowList.Close(); |
|
65 |
delete iConnectionEngine; |
|
66 |
iCmManager.Close(); |
|
67 |
delete iImageHandler; |
|
90
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
88
diff
changeset
|
68 |
delete iDocHandler; |
2 | 69 |
} |
70 |
||
71 |
CPodcastModel::CPodcastModel() |
|
72 |
{ |
|
73 |
} |
|
74 |
||
75 |
void CPodcastModel::ConstructL() |
|
76 |
{ |
|
77 |
DP("CPodcastModel::ConstructL BEGIN"); |
|
78 |
User::LeaveIfError(iFsSession.Connect()); |
|
79 |
iCommDB = CCommsDatabase::NewL (EDatabaseTypeUnspecified); |
|
80 |
iIapNameArray = new (ELeave) CDesCArrayFlat(KDefaultGranu); |
|
81 |
iSNAPNameArray = new (ELeave) CDesCArrayFlat(KDefaultGranu); |
|
164
000f9fc147b2
Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
148
diff
changeset
|
82 |
|
60 | 83 |
iImageHandler = CImageHandler::NewL(FsSession(), *this); |
90
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
88
diff
changeset
|
84 |
iDocHandler = CDocumentHandler::NewL(CEikonEnv::Static()->Process()); |
164
000f9fc147b2
Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
148
diff
changeset
|
85 |
|
000f9fc147b2
Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
148
diff
changeset
|
86 |
TRAPD(err,iCmManager.OpenL()); |
000f9fc147b2
Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
148
diff
changeset
|
87 |
DP1("iCmManager.OpenL(),err=%d;", err); |
000f9fc147b2
Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
148
diff
changeset
|
88 |
|
000f9fc147b2
Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
148
diff
changeset
|
89 |
if (err == KErrNone) |
000f9fc147b2
Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
148
diff
changeset
|
90 |
{ |
000f9fc147b2
Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
148
diff
changeset
|
91 |
UpdateIAPListL(); |
000f9fc147b2
Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
148
diff
changeset
|
92 |
UpdateSNAPListL(); |
000f9fc147b2
Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
148
diff
changeset
|
93 |
} |
2 | 94 |
|
95 |
iSettingsEngine = CSettingsEngine::NewL(*this); |
|
96 |
iConnectionEngine = CConnectionEngine::NewL(*this); |
|
97 |
||
164
000f9fc147b2
Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
148
diff
changeset
|
98 |
TRAP(err, OpenDBL()); |
60 | 99 |
|
100 |
if (err != KErrNone) |
|
101 |
{ |
|
102 |
ResetDB(); |
|
103 |
||
104 |
TRAP(err, OpenDBL()); |
|
105 |
||
106 |
if (err != KErrNone) |
|
107 |
{ |
|
108 |
Panic(EPodcatcherPanicDB); |
|
109 |
} |
|
110 |
||
111 |
} |
|
112 |
||
2 | 113 |
iFeedEngine = CFeedEngine::NewL(*this); |
114 |
iShowEngine = CShowEngine::NewL(*this); |
|
115 |
||
116 |
DP("CPodcastModel::ConstructL END"); |
|
117 |
} |
|
118 |
||
119 |
||
120 |
||
121 |
EXPORT_C void CPodcastModel::UpdateIAPListL() |
|
122 |
{ |
|
123 |
iIapNameArray->Reset(); |
|
124 |
iIapIdArray.Reset(); |
|
125 |
||
126 |
CCommsDbTableView* table = iCommDB->OpenTableLC (TPtrC (IAP)); |
|
127 |
TInt ret = table->GotoFirstRecord (); |
|
128 |
TPodcastIAPItem IAPItem; |
|
129 |
TBuf <KCommsDbSvrMaxFieldLength> bufName; |
|
130 |
while (ret == KErrNone) // There was a first record |
|
131 |
{ |
|
132 |
table->ReadUintL(TPtrC(COMMDB_ID), IAPItem.iIapId); |
|
133 |
table->ReadTextL (TPtrC(COMMDB_NAME), bufName); |
|
134 |
table->ReadTextL (TPtrC(IAP_BEARER_TYPE), IAPItem.iBearerType); |
|
135 |
table->ReadTextL (TPtrC(IAP_SERVICE_TYPE), IAPItem.iServiceType); |
|
136 |
||
137 |
iIapIdArray.Append(IAPItem); |
|
138 |
iIapNameArray->AppendL(bufName); |
|
139 |
ret = table->GotoNextRecord(); |
|
140 |
} |
|
141 |
CleanupStack::PopAndDestroy(); // Close table |
|
142 |
} |
|
143 |
||
144 |
EXPORT_C void CPodcastModel::UpdateSNAPListL() |
|
145 |
{ |
|
146 |
DP("CPodcastModel::UpdateSNAPListL BEGIN"); |
|
147 |
iSNAPNameArray->Reset(); |
|
148 |
iSNAPIdArray.Reset(); |
|
149 |
||
150 |
RCmDestination destination; |
|
151 |
TPodcastIAPItem IAPItem; |
|
152 |
||
153 |
RArray<TUint32> destArray; |
|
154 |
CleanupClosePushL(destArray); |
|
155 |
iCmManager.AllDestinationsL(destArray); |
|
156 |
||
157 |
TInt cnt = destArray.Count(); |
|
158 |
DP1("destArray.Count==%d", cnt); |
|
159 |
for(TInt loop = 0;loop<cnt;loop++) |
|
160 |
{ |
|
161 |
destination = iCmManager.DestinationL (destArray[loop]); |
|
162 |
CleanupClosePushL(destination); |
|
163 |
if(!destination.IsHidden()) |
|
164 |
{ |
|
165 |
IAPItem.iIapId = destArray[loop]; |
|
166 |
HBufC* name = destination.NameLC(); |
|
167 |
DP1(" destination.NameLC==%S", name); |
|
168 |
iSNAPNameArray->AppendL(*name); |
|
169 |
CleanupStack::PopAndDestroy(name); |
|
170 |
iSNAPIdArray.Append(IAPItem); |
|
171 |
} |
|
172 |
CleanupStack::PopAndDestroy();//close destination |
|
173 |
} |
|
174 |
CleanupStack::PopAndDestroy();// close destArray |
|
175 |
||
176 |
DP("CPodcastModel::UpdateSNAPListL END"); |
|
177 |
} |
|
178 |
||
179 |
EXPORT_C CDesCArrayFlat* CPodcastModel::IAPNames() |
|
180 |
{ |
|
181 |
return iIapNameArray; |
|
182 |
} |
|
183 |
||
184 |
EXPORT_C RArray<TPodcastIAPItem>& CPodcastModel::IAPIds() |
|
185 |
{ |
|
186 |
return iIapIdArray; |
|
187 |
} |
|
188 |
||
189 |
EXPORT_C CDesCArrayFlat* CPodcastModel::SNAPNames() |
|
190 |
{ |
|
191 |
return iSNAPNameArray; |
|
192 |
} |
|
193 |
||
194 |
EXPORT_C RArray<TPodcastIAPItem>& CPodcastModel::SNAPIds() |
|
195 |
{ |
|
196 |
return iSNAPIdArray; |
|
197 |
} |
|
198 |
||
199 |
||
200 |
RFs& CPodcastModel::FsSession() |
|
201 |
{ |
|
202 |
return iFsSession; |
|
203 |
} |
|
204 |
||
205 |
EXPORT_C void CPodcastModel::SetPlayingPodcast(CShowInfo* aPodcast) |
|
206 |
{ |
|
207 |
iPlayingPodcast = aPodcast; |
|
208 |
} |
|
209 |
||
210 |
EXPORT_C CShowInfo* CPodcastModel::PlayingPodcast() |
|
211 |
{ |
|
212 |
return iPlayingPodcast; |
|
213 |
} |
|
214 |
||
215 |
EXPORT_C CFeedEngine& CPodcastModel::FeedEngine() |
|
216 |
{ |
|
217 |
return *iFeedEngine; |
|
218 |
} |
|
219 |
||
220 |
EXPORT_C CShowEngine& CPodcastModel::ShowEngine() |
|
221 |
{ |
|
222 |
return *iShowEngine; |
|
223 |
} |
|
224 |
||
225 |
EXPORT_C CSettingsEngine& CPodcastModel::SettingsEngine() |
|
226 |
{ |
|
227 |
return *iSettingsEngine; |
|
228 |
} |
|
229 |
||
230 |
EXPORT_C CConnectionEngine& CPodcastModel::ConnectionEngine() |
|
231 |
{ |
|
232 |
return *iConnectionEngine; |
|
233 |
} |
|
234 |
||
164
000f9fc147b2
Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
148
diff
changeset
|
235 |
EXPORT_C void CPodcastModel::PlayPausePodcastL(CShowInfo* aPodcast, TBool /* aPlayOnInit */) |
2 | 236 |
{ |
136
cee38af14bcf
Merged show playback error handling from S^3 branch
teknolog
parents:
90
diff
changeset
|
237 |
DP("CPodcastModel::PlayPausePodcastL BEGIN"); |
90
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
88
diff
changeset
|
238 |
TRAPD(err, LaunchFileEmbeddedL(aPodcast->FileName())); |
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
88
diff
changeset
|
239 |
|
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
88
diff
changeset
|
240 |
if (err == KErrNone) |
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
88
diff
changeset
|
241 |
{ |
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
88
diff
changeset
|
242 |
aPodcast->SetPlayState(EPlayed); |
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
88
diff
changeset
|
243 |
iShowEngine->UpdateShowL(*aPodcast); |
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
88
diff
changeset
|
244 |
} |
136
cee38af14bcf
Merged show playback error handling from S^3 branch
teknolog
parents:
90
diff
changeset
|
245 |
else |
cee38af14bcf
Merged show playback error handling from S^3 branch
teknolog
parents:
90
diff
changeset
|
246 |
{ |
cee38af14bcf
Merged show playback error handling from S^3 branch
teknolog
parents:
90
diff
changeset
|
247 |
User::Leave(err); |
cee38af14bcf
Merged show playback error handling from S^3 branch
teknolog
parents:
90
diff
changeset
|
248 |
} |
cee38af14bcf
Merged show playback error handling from S^3 branch
teknolog
parents:
90
diff
changeset
|
249 |
DP("CPodcastModel::PlayPausePodcastL END"); |
2 | 250 |
} |
251 |
||
252 |
EXPORT_C CFeedInfo* CPodcastModel::ActiveFeedInfo() |
|
253 |
{ |
|
254 |
return iActiveFeed; |
|
255 |
} |
|
256 |
||
257 |
EXPORT_C void CPodcastModel::SetActiveFeedInfo(CFeedInfo* aFeedInfo) |
|
258 |
{ |
|
259 |
iActiveFeed = aFeedInfo; |
|
260 |
} |
|
261 |
||
262 |
EXPORT_C RShowInfoArray& CPodcastModel::ActiveShowList() |
|
263 |
{ |
|
264 |
return iActiveShowList; |
|
265 |
} |
|
266 |
||
267 |
void CPodcastModel::SetActiveShowList(RShowInfoArray& aShowArray) |
|
268 |
{ |
|
269 |
iActiveShowList.ResetAndDestroy(); |
|
270 |
TInt cnt = aShowArray.Count(); |
|
271 |
||
272 |
for(TInt loop = 0;loop < cnt; loop++) |
|
273 |
{ |
|
274 |
iActiveShowList.Append(aShowArray[loop]); |
|
275 |
} |
|
276 |
} |
|
277 |
||
60 | 278 |
EXPORT_C void CPodcastModel::DropDB() |
279 |
{ |
|
280 |
if (iDB != NULL) |
|
281 |
{ |
|
282 |
sqlite3_close(iDB); |
|
283 |
iDB = NULL; |
|
284 |
} |
|
285 |
||
286 |
TFileName dbFileName; |
|
287 |
dbFileName.Copy(iSettingsEngine->PrivatePath()); |
|
288 |
dbFileName.Append(KDBFileName); |
|
289 |
||
290 |
// remove the old DB file |
|
291 |
if (BaflUtils::FileExists(iFsSession, dbFileName)) |
|
292 |
{ |
|
293 |
BaflUtils::DeleteFile(iFsSession, dbFileName); |
|
294 |
} |
|
295 |
} |
|
296 |
||
297 |
void CPodcastModel::ResetDB() |
|
298 |
{ |
|
299 |
DP("CPodcastModel::ResetDB BEGIN"); |
|
300 |
||
301 |
DropDB(); |
|
302 |
||
303 |
TFileName dbFileName; |
|
304 |
dbFileName.Copy(iSettingsEngine->PrivatePath()); |
|
305 |
dbFileName.Append(KDBFileName); |
|
306 |
||
307 |
// remove the old DB file |
|
308 |
if (BaflUtils::FileExists(iFsSession, dbFileName)) |
|
309 |
{ |
|
310 |
BaflUtils::DeleteFile(iFsSession, dbFileName); |
|
311 |
} |
|
312 |
||
313 |
// copy template to new DB |
|
314 |
TFileName dbTemplate; |
|
315 |
dbTemplate.Copy(iSettingsEngine->PrivatePath()); |
|
316 |
dbTemplate.Append(KDBTemplateFileName); |
|
317 |
||
318 |
BaflUtils::CopyFile(iFsSession, dbTemplate,dbFileName); |
|
319 |
iIsFirstStartup = ETrue; |
|
320 |
DP("CPodcastModel::ResetDB END"); |
|
321 |
} |
|
322 |
||
323 |
||
324 |
void CPodcastModel::OpenDBL() |
|
325 |
{ |
|
326 |
DP("CPodcastModel::OpenDBL BEGIN"); |
|
327 |
||
328 |
if (iDB != NULL) |
|
329 |
{ |
|
330 |
sqlite3_close(iDB); |
|
331 |
iDB = NULL; |
|
332 |
} |
|
333 |
||
334 |
TFileName dbFileName; |
|
335 |
dbFileName.Copy(iSettingsEngine->PrivatePath()); |
|
336 |
dbFileName.Append(KDBFileName); |
|
337 |
||
338 |
if (!BaflUtils::FileExists(iFsSession, dbFileName)) |
|
339 |
{ |
|
340 |
User::Leave(KErrNotFound); |
|
341 |
} |
|
342 |
||
343 |
if (iDB == NULL) { |
|
344 |
// open DB |
|
345 |
TBuf8<KMaxFileName> filename8; |
|
346 |
filename8.Copy(dbFileName); |
|
347 |
int rc = sqlite3_open((const char*) filename8.PtrZ(), &iDB); |
|
348 |
if(rc != SQLITE_OK){ |
|
349 |
User::Leave(KErrCorrupt); |
|
350 |
} |
|
351 |
||
352 |
// do a test query |
|
353 |
sqlite3_stmt *st; |
|
354 |
rc = sqlite3_prepare_v2(iDB,"select count(*) from feeds" , -1, &st, (const char**) NULL); |
|
355 |
if( rc==SQLITE_OK ) |
|
356 |
{ |
|
357 |
Cleanup_sqlite3_finalize_PushL(st); |
|
358 |
rc = sqlite3_step(st); |
|
359 |
||
360 |
if (rc != SQLITE_ROW) |
|
361 |
{ |
|
362 |
User::Leave(KErrCorrupt); |
|
363 |
} |
|
364 |
CleanupStack::PopAndDestroy(); // st |
|
365 |
} |
|
366 |
else |
|
367 |
{ |
|
368 |
User::Leave(KErrCorrupt); |
|
369 |
} |
|
370 |
} |
|
371 |
||
372 |
DP("CPodcastModel::OpenDBL END"); |
|
373 |
} |
|
374 |
||
2 | 375 |
sqlite3* CPodcastModel::DB() |
376 |
{ |
|
377 |
return iDB; |
|
378 |
} |
|
379 |
||
380 |
void CPodcastModel::SetProxyUsageIfNeededL(RHTTPSession& aSession) |
|
381 |
{ |
|
382 |
TBool useProxy = EFalse; |
|
383 |
HBufC* serverName = NULL; |
|
384 |
TUint32 port = 0; |
|
385 |
||
386 |
TRAPD(err,GetProxyInformationForConnectionL(useProxy, serverName, port)); |
|
387 |
if (err == KErrNone && useProxy) |
|
388 |
{ |
|
389 |
CleanupStack::PushL(serverName); |
|
390 |
TBuf8<128> proxyAddr; |
|
391 |
proxyAddr.Append(*serverName); |
|
392 |
proxyAddr.Append(':'); |
|
393 |
proxyAddr.AppendNum(port); |
|
394 |
||
395 |
RStringF prxAddr = aSession.StringPool().OpenFStringL(proxyAddr); |
|
396 |
CleanupClosePushL(prxAddr); |
|
397 |
THTTPHdrVal prxUsage(aSession.StringPool().StringF(HTTP::EUseProxy,RHTTPSession::GetTable())); |
|
398 |
||
399 |
aSession.ConnectionInfo().SetPropertyL( |
|
400 |
aSession.StringPool().StringF(HTTP::EProxyUsage,RHTTPSession::GetTable()), |
|
401 |
aSession.StringPool().StringF(HTTP::EUseProxy,RHTTPSession::GetTable())); |
|
402 |
||
403 |
aSession.ConnectionInfo().SetPropertyL(aSession.StringPool().StringF(HTTP::EProxyAddress,RHTTPSession::GetTable()), prxAddr); |
|
404 |
||
405 |
CleanupStack::PopAndDestroy(&prxAddr); |
|
406 |
CleanupStack::PopAndDestroy(serverName); |
|
407 |
} |
|
408 |
} |
|
409 |
||
410 |
||
411 |
void CPodcastModel::GetProxyInformationForConnectionL(TBool& aIsUsed, HBufC*& aProxyServerName, TUint32& aPort) |
|
412 |
{ |
|
413 |
TInt iapId = GetIapId(); |
|
414 |
CCommsDbTableView* table = iCommDB->OpenViewMatchingUintLC(TPtrC(IAP), TPtrC(COMMDB_ID), iapId); |
|
415 |
||
416 |
TUint32 iapService; |
|
417 |
HBufC* iapServiceType; |
|
418 |
table->ReadUintL(TPtrC(IAP_SERVICE), iapService); |
|
419 |
iapServiceType = table->ReadLongTextLC(TPtrC(IAP_SERVICE_TYPE)); |
|
420 |
||
421 |
CCommsDbTableView* proxyTableView = iCommDB->OpenViewOnProxyRecordLC(iapService, *iapServiceType); |
|
422 |
TInt err = proxyTableView->GotoFirstRecord(); |
|
423 |
if( err != KErrNone) |
|
424 |
{ |
|
425 |
User::Leave(KErrNotFound); |
|
426 |
} |
|
427 |
||
428 |
proxyTableView->ReadBoolL(TPtrC(PROXY_USE_PROXY_SERVER), aIsUsed); |
|
429 |
if(aIsUsed) |
|
430 |
{ |
|
431 |
HBufC* serverName = proxyTableView->ReadLongTextLC(TPtrC(PROXY_SERVER_NAME)); |
|
432 |
proxyTableView->ReadUintL(TPtrC(PROXY_PORT_NUMBER), aPort); |
|
433 |
aProxyServerName = serverName->AllocL(); |
|
434 |
CleanupStack::PopAndDestroy(serverName); |
|
435 |
} |
|
436 |
||
437 |
CleanupStack::PopAndDestroy(proxyTableView); |
|
438 |
CleanupStack::PopAndDestroy(iapServiceType); |
|
439 |
CleanupStack::PopAndDestroy(table); |
|
440 |
} |
|
441 |
||
442 |
TInt CPodcastModel::GetIapId() |
|
443 |
{ |
|
444 |
_LIT(KSetting, "IAP\\Id"); |
|
445 |
TUint32 iapId = 0; |
|
446 |
iConnectionEngine->Connection().GetIntSetting(KSetting, iapId); |
|
447 |
return iapId; |
|
448 |
} |
|
449 |
||
8 | 450 |
EXPORT_C void CPodcastModel::GetShowsDownloadingL() |
2 | 451 |
{ |
452 |
iActiveShowList.ResetAndDestroy(); |
|
8 | 453 |
iShowEngine->GetShowsDownloadingL(iActiveShowList); |
2 | 454 |
} |
455 |
||
8 | 456 |
EXPORT_C void CPodcastModel::GetShowsByFeedL(TUint aFeedUid) |
2 | 457 |
{ |
458 |
iActiveShowList.ResetAndDestroy(); |
|
88
f4b512d870e8
Moved call to DeleteOldShowsByFeedL to when a feed is listed. This prevents a race condition which likely caused
teknolog
parents:
67
diff
changeset
|
459 |
iShowEngine->DeleteOldShowsByFeedL(aFeedUid); |
60 | 460 |
iShowEngine->CheckForDeletedShows(aFeedUid); |
8 | 461 |
iShowEngine->GetShowsByFeedL(iActiveShowList, aFeedUid); |
2 | 462 |
} |
463 |
||
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
8
diff
changeset
|
464 |
EXPORT_C void CPodcastModel::MarkSelectionPlayedL() |
2 | 465 |
{ |
466 |
for (int i=0;i<iActiveShowList.Count();i++) { |
|
467 |
if(iActiveShowList[i]->PlayState() != EPlayed) { |
|
468 |
iActiveShowList[i]->SetPlayState(EPlayed); |
|
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
8
diff
changeset
|
469 |
iShowEngine->UpdateShowL(*iActiveShowList[i]); |
2 | 470 |
} |
471 |
} |
|
472 |
} |
|
473 |
||
474 |
TInt CPodcastModel::FindActiveShowByUid(TUint aUid) |
|
475 |
{ |
|
476 |
for (int i=0;i<iActiveShowList.Count();i++) { |
|
477 |
if (iActiveShowList[i]->Uid() == aUid) { |
|
478 |
return i; |
|
479 |
} |
|
480 |
} |
|
481 |
||
482 |
return KErrNotFound; |
|
483 |
} |
|
484 |
||
485 |
EXPORT_C TBool CPodcastModel::IsFirstStartup() |
|
486 |
{ |
|
487 |
return iIsFirstStartup; |
|
488 |
} |
|
489 |
||
490 |
||
60 | 491 |
void CPodcastModel::ImageOperationCompleteL(TInt /*aError*/, TUint /*aHandle*/, CPodcastModel& /*aPodcastModel*/) |
2 | 492 |
{ |
493 |
||
494 |
} |
|
495 |
||
496 |
EXPORT_C CImageHandler& CPodcastModel::ImageHandler() |
|
497 |
{ |
|
498 |
return *iImageHandler; |
|
499 |
} |
|
90
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
88
diff
changeset
|
500 |
|
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
88
diff
changeset
|
501 |
void CPodcastModel::LaunchFileEmbeddedL(const TDesC& aFilename) |
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
88
diff
changeset
|
502 |
{ |
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
88
diff
changeset
|
503 |
//Set the exit observer so HandleServerAppExit will be called |
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
88
diff
changeset
|
504 |
iDocHandler->SetExitObserver(this); |
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
88
diff
changeset
|
505 |
|
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
88
diff
changeset
|
506 |
TDataType emptyDataType = TDataType(); |
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
88
diff
changeset
|
507 |
//Open a file embedded |
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
88
diff
changeset
|
508 |
iDocHandler->OpenFileEmbeddedL(aFilename, emptyDataType); |
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
88
diff
changeset
|
509 |
} |
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
88
diff
changeset
|
510 |
|
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
88
diff
changeset
|
511 |
void CPodcastModel::HandleServerAppExit(TInt aReason) |
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
88
diff
changeset
|
512 |
{ |
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
88
diff
changeset
|
513 |
//Handle closing the handler application |
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
88
diff
changeset
|
514 |
MAknServerAppExitObserver::HandleServerAppExit(aReason); |
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
88
diff
changeset
|
515 |
} |
164
000f9fc147b2
Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
148
diff
changeset
|
516 |