|
1 /* |
|
2 * Copyright (c) 2004-2008 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: Implementation of the PhCltExtension Image handler interface. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CPHCLTIMAGEHANDLERIMPLEMENTATION_H |
|
21 #define CPHCLTIMAGEHANDLERIMPLEMENTATION_H |
|
22 |
|
23 |
|
24 // INCLUDES |
|
25 #include <CPhCltImageHandler.h> |
|
26 #include "RPhCltImageHandler.h" |
|
27 #include "RPhCltServer.h" |
|
28 |
|
29 /** |
|
30 * Implementation of image handler interface. |
|
31 * |
|
32 * @lib PhoneClient.lib |
|
33 * @since Series60 3.2 |
|
34 */ |
|
35 NONSHARABLE_CLASS ( CPhCltImageHandlerImplementation ) |
|
36 : public CPhCltImageHandler, public MPhCltImageObserver |
|
37 { |
|
38 public: // Constructors and destructor |
|
39 |
|
40 /** |
|
41 * Two-phased constructor. |
|
42 */ |
|
43 static CPhCltImageHandlerImplementation* NewL(); |
|
44 |
|
45 /** |
|
46 * Destructor. |
|
47 */ |
|
48 ~CPhCltImageHandlerImplementation(); |
|
49 |
|
50 public: // Functions from base classes |
|
51 |
|
52 /** |
|
53 * @see CPhCltImageHandler. |
|
54 */ |
|
55 TInt SaveImages( CPhCltImageParams& aParams ); |
|
56 |
|
57 /** |
|
58 * @see CPhCltImageHandler. |
|
59 */ |
|
60 TInt LoadImages( CPhCltImageParams*& aParams ); |
|
61 |
|
62 /** |
|
63 * @see CPhCltImageHandler::CPhCltBaseImageParamsL(). |
|
64 */ |
|
65 virtual CPhCltImageParams* |
|
66 CPhCltBaseImageParamsL( const TPhCltImageType aType ); |
|
67 |
|
68 /** |
|
69 * @see CPhCltImageHandler::OpenDefaultVtImage(). |
|
70 */ |
|
71 virtual TInt OpenDefaultVtImage( RFile& aFile ); |
|
72 |
|
73 /** |
|
74 * @see CPhCltImageHandler::SaveVtImage() |
|
75 */ |
|
76 virtual void SaveVtImageL( MPhCltImageObserver& aObserver, |
|
77 const TDesC& aImagePath ); |
|
78 |
|
79 /** |
|
80 * @see CPhCltImageHandler::CancelSaveVtImage |
|
81 */ |
|
82 virtual void CancelSaveVtImage(); |
|
83 |
|
84 /** |
|
85 * @see CPhCltImageHandler::OpenVtImage() |
|
86 */ |
|
87 virtual TInt OpenVtImage( RFile& aFile ); |
|
88 |
|
89 public: // from MPhCltImageObserver |
|
90 |
|
91 virtual void HandleImageSaveCompleteL( TInt aResult ); |
|
92 |
|
93 private: |
|
94 |
|
95 /** |
|
96 * C++ constructor. |
|
97 */ |
|
98 CPhCltImageHandlerImplementation(); |
|
99 |
|
100 /** |
|
101 * By default Symbian 2nd phase constructor is private. |
|
102 */ |
|
103 void ConstructL(); |
|
104 |
|
105 /** |
|
106 * Common code for opening default and user defined image. |
|
107 */ |
|
108 TInt OpenVtImageCommon( |
|
109 RFile& aFile, |
|
110 const TBool aDefaultImage ); |
|
111 |
|
112 /** |
|
113 * Internal class for handling asynchronous image saving. |
|
114 */ |
|
115 class CVtImageSaver : public CActive |
|
116 { |
|
117 public: |
|
118 |
|
119 /** Saves VT image. Deletes itself after observer callback |
|
120 * or cancellation */ |
|
121 static CVtImageSaver* SaveLD( |
|
122 MPhCltImageObserver& aObserver, |
|
123 RPhCltImageHandler& aHandler, |
|
124 const TDesC& aImagePath ); |
|
125 |
|
126 private: |
|
127 CVtImageSaver( |
|
128 MPhCltImageObserver& aObserver, |
|
129 RPhCltImageHandler& aHandler ); |
|
130 |
|
131 ~CVtImageSaver(); |
|
132 |
|
133 private: |
|
134 void DoSave( const TDesC& aImagePath ); |
|
135 |
|
136 private: // from CActive |
|
137 |
|
138 /** handles observer callback */ |
|
139 void RunL(); |
|
140 |
|
141 /** */ |
|
142 void DoCancel(); |
|
143 |
|
144 private: |
|
145 |
|
146 MPhCltImageObserver& iObserver; |
|
147 RPhCltImageHandler& iHandler; |
|
148 }; |
|
149 |
|
150 private: // Data |
|
151 RPhCltImageHandler iStillHandler; |
|
152 |
|
153 //RPhCltServer class instance creates phonesession |
|
154 RPhCltServer iServer; |
|
155 |
|
156 // Observer for async image saving |
|
157 MPhCltImageObserver* iObserver; |
|
158 |
|
159 // not owned |
|
160 CVtImageSaver* iVtImageSaver; |
|
161 |
|
162 |
|
163 }; |
|
164 |
|
165 #endif // CPHCLTIMAGEHANDLERIMPLEMENTATION_H |
|
166 |
|
167 |
|
168 // End of File |