|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: CNcdFileDownloadHandler implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <f32file.h> |
|
20 |
|
21 #include "ncdnode.h" |
|
22 #include "catalogshttpoperation.h" |
|
23 #include "catalogshttpconfig.h" |
|
24 #include "catalogshttpsession.h" |
|
25 #include "catalogsdebug.h" |
|
26 #include "ncdfiledownloadhandler.h" |
|
27 #include "ncdnodeidentifier.h" |
|
28 |
|
29 |
|
30 |
|
31 // ======== MEMBER FUNCTIONS ======== |
|
32 |
|
33 // --------------------------------------------------------------------------- |
|
34 // NewL |
|
35 // --------------------------------------------------------------------------- |
|
36 // |
|
37 CNcdFileDownloadHandler* CNcdFileDownloadHandler::NewL( |
|
38 const CNcdNodeIdentifier& aNodeId, |
|
39 CNcdNodeManager& aNodeManager, |
|
40 MCatalogsHttpSession& aHttpSession ) |
|
41 { |
|
42 CNcdFileDownloadHandler* self = new( ELeave ) |
|
43 CNcdFileDownloadHandler( aNodeManager, aHttpSession ); |
|
44 CleanupStack::PushL( self ); |
|
45 self->ConstructL( aNodeId ); |
|
46 CleanupStack::Pop( self ); |
|
47 |
|
48 return self; |
|
49 } |
|
50 |
|
51 |
|
52 // --------------------------------------------------------------------------- |
|
53 // Destructor |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 CNcdFileDownloadHandler::~CNcdFileDownloadHandler() |
|
57 { |
|
58 } |
|
59 |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // DownloadL |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 MCatalogsHttpOperation* CNcdFileDownloadHandler::DownloadL() |
|
66 { |
|
67 DLTRACEIN(( _L("Creating download for URI: %S"), |
|
68 &NodeId().NodeNameSpace() )); |
|
69 |
|
70 |
|
71 MCatalogsHttpOperation* dl = HttpSession().CreateDownloadL( |
|
72 NodeId().NodeNameSpace(), |
|
73 EFalse ); |
|
74 CleanupStack::PushL( dl ); |
|
75 |
|
76 DLTRACE(( _L("Parsing path: %S"), &NodeId().NodeId() )); |
|
77 TParsePtrC path( NodeId().NodeId() ); |
|
78 |
|
79 dl->Config().SetDirectoryL( path.DriveAndPath() ); |
|
80 dl->Config().SetFilenameL( path.NameAndExt() ); |
|
81 |
|
82 SetCurrentDownload( CurrentDownload() + 1 ); |
|
83 CleanupStack::Pop( dl ); |
|
84 DLTRACEOUT(( "" )); |
|
85 return dl; |
|
86 } |
|
87 |
|
88 |
|
89 // --------------------------------------------------------------------------- |
|
90 // FinishDownloadL |
|
91 // --------------------------------------------------------------------------- |
|
92 // |
|
93 void CNcdFileDownloadHandler::FinishDownloadL( |
|
94 MCatalogsHttpOperation& /*aDownload*/, |
|
95 MNcdFileHandler* /*aFileHandler*/) |
|
96 { |
|
97 DLTRACEIN(("")); |
|
98 /** |
|
99 * Transport takes care of this |
|
100 */ |
|
101 DLTRACEOUT(("")); |
|
102 } |
|
103 |
|
104 |
|
105 // --------------------------------------------------------------------------- |
|
106 // Constructor |
|
107 // --------------------------------------------------------------------------- |
|
108 // |
|
109 CNcdFileDownloadHandler::CNcdFileDownloadHandler( |
|
110 CNcdNodeManager& aNodeManager, |
|
111 MCatalogsHttpSession& aHttpSession ) : |
|
112 CNcdBaseDownloadHandler( aNodeManager, aHttpSession ) |
|
113 { |
|
114 } |