1 /* |
|
2 * Copyright (c) 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: avatar selection handler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CVIMPSTUIAVATARSELECTIONHANDLER_H |
|
21 #define CVIMPSTUIAVATARSELECTIONHANDLER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <MMGFetchVerifier.h> |
|
26 #include <apgcli.h> // RApaLsSession |
|
27 #include <AknServerApp.h> // MAknServerAppExitObserver |
|
28 #include <NewFileService.hrh> // TNewServiceFileType |
|
29 |
|
30 #include "tvimpstenums.h" |
|
31 // FORWARD DECLARATIONS |
|
32 |
|
33 class CDocumentHandler; |
|
34 class CImageDecoder; |
|
35 |
|
36 |
|
37 // CLASS DECLARATION |
|
38 |
|
39 /** |
|
40 * avatar selection handler |
|
41 * |
|
42 */ |
|
43 class CAvatarSelectionHandler : public CActive, |
|
44 public MAknServerAppExitObserver |
|
45 { |
|
46 public: // Constructors and destructor |
|
47 |
|
48 /** |
|
49 * Two-phased constructor. |
|
50 */ |
|
51 static CAvatarSelectionHandler* NewLC(); |
|
52 |
|
53 /** |
|
54 * Destructor. |
|
55 */ |
|
56 virtual ~CAvatarSelectionHandler(); |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 public: |
|
63 /** |
|
64 * funtion to select the avatar image file , and allocates memory for |
|
65 * selected filename if any file gets selected lese returns NULL |
|
66 * |
|
67 * @param aCommand , command value , which says |
|
68 * image should be selected from gallery or camera. |
|
69 * |
|
70 * @return allocated value for filename if image is selected else NULL |
|
71 * ownership is transfered to the caller |
|
72 */ |
|
73 HBufC* HandleAvatarSelectionL(TInt aCommand ); |
|
74 |
|
75 /** |
|
76 * Gives the mimetype for the selected file |
|
77 * The return value is valid if its called aftter |
|
78 * calling HandleAvatarSelectionL |
|
79 * else the returns NULL |
|
80 * |
|
81 * |
|
82 * @return allocated value for mimetype if image is selected else NULL |
|
83 * |
|
84 */ |
|
85 const TDesC8& MimeTypeL(); |
|
86 |
|
87 protected: // Functions from base classes |
|
88 |
|
89 /** |
|
90 * @see MAknServerAppExitObserver |
|
91 * |
|
92 */ |
|
93 void HandleServerAppExit( TInt aReason ); |
|
94 |
|
95 |
|
96 protected: // From CActive |
|
97 |
|
98 /** |
|
99 * @see CActive |
|
100 */ |
|
101 void RunL(); |
|
102 |
|
103 /** |
|
104 * @see CActive |
|
105 */ |
|
106 void DoCancel(); |
|
107 |
|
108 /** |
|
109 * @see CActive. |
|
110 */ |
|
111 TInt RunError( TInt aError ); |
|
112 |
|
113 private: |
|
114 /** |
|
115 * funtion to show the errors based on the param passed |
|
116 * |
|
117 * @param aErrorType : TErrorType enum value |
|
118 */ |
|
119 void ShowErrorL(TErrorType aErrorType); |
|
120 /** |
|
121 * C++ default constructor. |
|
122 */ |
|
123 CAvatarSelectionHandler(); |
|
124 |
|
125 /** |
|
126 * By default Symbian 2nd phase constructor is private. |
|
127 */ |
|
128 void ConstructL(); |
|
129 |
|
130 /** |
|
131 * Retrieves the optimal decode size (as small as possible) |
|
132 * for validating the image |
|
133 */ |
|
134 TSize DecodeSize( const TSize& aSize ); |
|
135 |
|
136 /** |
|
137 * Retrieves the mime type from the file |
|
138 * |
|
139 * @param filename for which the mimetype to be find |
|
140 */ |
|
141 void StoreMimeTypeL(const TDesC& aFilename); |
|
142 |
|
143 /** |
|
144 * Verifies selected files |
|
145 * |
|
146 * @param aSelectedFiles Array of files to be verified |
|
147 */ |
|
148 TBool VerifySelectedFilesL( const MDesCArray* aSelectedFiles ); |
|
149 |
|
150 |
|
151 private: // Data |
|
152 |
|
153 // Exit reason for server apps |
|
154 TInt iServerAppExitReason; |
|
155 |
|
156 // Activescheduler wait |
|
157 CActiveSchedulerWait iWait; |
|
158 |
|
159 // apa session owns |
|
160 RApaLsSession iApaSession; |
|
161 |
|
162 // owns, document handler |
|
163 CDocumentHandler* iDocHandler; |
|
164 |
|
165 // owns |
|
166 CImageDecoder* iDecoder; |
|
167 |
|
168 //owns |
|
169 HBufC8* iMimeType; |
|
170 }; |
|
171 |
|
172 #endif // CVIMPSTUIAVATARSELECTIONHANDLER_H |
|
173 |
|
174 // End of File |
|