|
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: RSFW notifier server plugin |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef C_RSFWNOTPLUGIN_H |
|
19 #define C_RSFWNOTPLUGIN_H |
|
20 |
|
21 #include <e32def.h> |
|
22 #include <e32base.h> |
|
23 #include <eiknotapi.h> // MEikSrvNotifierBase |
|
24 #include <MAknMemorySelectionObserver.h> |
|
25 #include "rsfwauthenticationdlgrequest.h" |
|
26 #include "rsfwsavetodlgrequest.h" |
|
27 #include "rsfwnotpluginrequest.h" |
|
28 |
|
29 class CAknDialog; |
|
30 |
|
31 |
|
32 IMPORT_C CArrayPtr<MEikSrvNotifierBase2>* NotifierArray(); |
|
33 |
|
34 /** |
|
35 * Remote Storage FW plugin to the notifier server. |
|
36 * |
|
37 * This plugin implements the custom global dialogs needed by |
|
38 * Remote Storage Framework. |
|
39 * |
|
40 * @lib rsfwnotplugin.dll |
|
41 * @since S60 v3.2 |
|
42 */ |
|
43 class CRsfwNotPluginDlg : public CActive, |
|
44 public MEikSrvNotifierBase2, |
|
45 public MAknMemorySelectionObserver, |
|
46 public MProgressDialogCallback |
|
47 { |
|
48 public: |
|
49 |
|
50 static CRsfwNotPluginDlg* NewL(); |
|
51 |
|
52 ~CRsfwNotPluginDlg(); |
|
53 |
|
54 // for base class CActive |
|
55 |
|
56 /** |
|
57 * From CActive |
|
58 * Handles an active object's request completion event. |
|
59 * |
|
60 * @since S60 v3.2 |
|
61 */ |
|
62 void RunL(); |
|
63 |
|
64 /** |
|
65 * From CActive |
|
66 * Handles a leave occurring in the request completion event handler RunL(). |
|
67 * |
|
68 * @since S60 v3.2 |
|
69 */ |
|
70 TInt RunError(TInt aError); |
|
71 |
|
72 /** |
|
73 * From CActive |
|
74 * Implements cancellation of an outstanding request. |
|
75 * |
|
76 * @since S60 v3.2 |
|
77 */ |
|
78 void DoCancel(); |
|
79 |
|
80 // from base class MEikSrvNotifierBase2 |
|
81 |
|
82 /** |
|
83 * From .MEikSrvNotifierBase2 |
|
84 * Called when all resources allocated by notifiers should be freed. |
|
85 * |
|
86 * @since S60 v3.2 |
|
87 * |
|
88 */ |
|
89 virtual void Release(); |
|
90 |
|
91 |
|
92 /** |
|
93 * From MEikSrvNotifierBase2 |
|
94 * Called when a notifier is first loaded to allow any initial construction that is required. |
|
95 * |
|
96 * @since S60 v3.2 |
|
97 * |
|
98 */ |
|
99 virtual MEikSrvNotifierBase2::TNotifierInfo RegisterL(); |
|
100 |
|
101 |
|
102 /** |
|
103 * From MEikSrvNotifierBase2 |
|
104 * Return the priority a notifier takes and the channels it acts on. The return value may be varied |
|
105 * at run-time. |
|
106 * |
|
107 * @since S60 v3.2 |
|
108 */ |
|
109 virtual MEikSrvNotifierBase2::TNotifierInfo Info() const; |
|
110 |
|
111 |
|
112 /** |
|
113 * From MEikSrvNotifierBase2 |
|
114 * Start the notifier with data aBuffer and return an initial response. |
|
115 * |
|
116 * @since S60 v3.2 |
|
117 * @param aBuffer Data that can be passed from the client-side. The format and |
|
118 * meaning of any data is implementation dependent. |
|
119 */ |
|
120 virtual TPtrC8 StartL(const TDesC8& aBuffer); |
|
121 |
|
122 |
|
123 /** |
|
124 * From MEikSrvNotifierBase2 |
|
125 * Start the notifier with data aBuffer. aMessage should be completed when the notifier is deactivated. |
|
126 * May be called multiple times if more than one client starts the notifier. The notifier is immediately |
|
127 * responsible for completing aMessage. |
|
128 * |
|
129 * @since S60 v3.2 |
|
130 * @param aBuffer Data that can be passed from the client-side. The format and |
|
131 * meaning of any data is implementation dependent. |
|
132 * @param aReplySlot Identifies which message argument to use for the reply. |
|
133 * This message argument will refer to a modifiable descriptor, a TDes8 type, |
|
134 * into which data can be returned. The format and meaning of any returned data |
|
135 * is implementation dependent. |
|
136 @param aMessage Encapsulates a client request |
|
137 */ |
|
138 virtual void StartL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); |
|
139 |
|
140 |
|
141 /** |
|
142 * From MEikSrvNotifierBase2 |
|
143 * The notifier has been deactivated so resources can be freed and outstanding messages completed. |
|
144 * |
|
145 * @since S60 v3.2 |
|
146 */ |
|
147 virtual void Cancel(); |
|
148 |
|
149 |
|
150 /** |
|
151 * From MEikSrvNotifierBase2 |
|
152 * Update a currently active notifier with data aBuffer. |
|
153 * |
|
154 * @since S60 v3.2 |
|
155 * @param aBuffer Data that can be passed from the client-side. The format and |
|
156 * meaning of any data is implementation dependent. |
|
157 * @return A pointer descriptor representing data that may be returned. The format |
|
158 * and meaning of any data is implementation dependent. |
|
159 */ |
|
160 virtual TPtrC8 UpdateL(const TDesC8& aBuffer); |
|
161 |
|
162 // from base class MAknMemorySelectionObserver |
|
163 |
|
164 /** |
|
165 * From MAknMemorySelectionObserver |
|
166 * Logic to decide whether the inputs given in the dialog are ok |
|
167 * |
|
168 * @since S60 v3.2 |
|
169 * @param aMemory the selected memory |
|
170 */ |
|
171 TBool OkToExitL( CAknMemorySelectionDialog::TMemory aMemory ); |
|
172 |
|
173 // from base class MProgressDialogCallback |
|
174 |
|
175 /** |
|
176 * From MProgressDialogCallback |
|
177 * Callback we receive when a non-modal wait dialog is dismissed |
|
178 * |
|
179 * @since S60 v3.2 |
|
180 * @param aButtonId the button user pressed |
|
181 */ |
|
182 void DialogDismissedL( TInt aButtonId ); |
|
183 |
|
184 private: |
|
185 |
|
186 /** |
|
187 * C++ default constructor. |
|
188 */ |
|
189 CRsfwNotPluginDlg(); |
|
190 |
|
191 /** |
|
192 * By default Symbian 2nd phase constructor is private. |
|
193 */ |
|
194 void ConstructL(); |
|
195 |
|
196 // New functions |
|
197 |
|
198 // Helpers |
|
199 void HandleAsyncRequestL(); |
|
200 |
|
201 // show dialogs |
|
202 TInt ShowAuthenticationDialogL(); |
|
203 TBool ShowUnavailableRetryNoteL(); |
|
204 TBool ShowSaveToDlgL(); |
|
205 void ShowWaitNoteL(); |
|
206 |
|
207 /** |
|
208 * Returns the type of given item index in CFileManagerItemProperties bitmask |
|
209 * @param aFullPath Full path to item which type is needed.. |
|
210 * @return CFileManagerItemProperties bitmask |
|
211 */ |
|
212 TUint32 FileTypeL( const TDesC& aFullPath ) const; |
|
213 |
|
214 void Cleanup(); |
|
215 |
|
216 TBool GetValidNameL(TDesC& aPath, TDes& aName); |
|
217 |
|
218 void ShowDiskFullNoteL( TBool aInternal ); |
|
219 |
|
220 void CancelL(); |
|
221 |
|
222 /** |
|
223 * Temporarily disables 'app key', so that user cannot switch or close |
|
224 * the app when global dialog is being displayed |
|
225 */ |
|
226 void BlockAppSwitching(); |
|
227 void UnblockAppSwitching(); |
|
228 |
|
229 private: // Data |
|
230 TInt iMethod; // See TRsfwNotPluginRequest::TRsfwNotPluginMethod |
|
231 RMessagePtr2 iMessage; |
|
232 TInt iReplySlot; |
|
233 MEikSrvNotifierBase2::TNotifierInfo iInfo; |
|
234 |
|
235 // for all dialogs |
|
236 TBuf<KRsfwMaxDrivenameLength> iDriveName; |
|
237 // for authentication dialog |
|
238 HBufC* iUserName; |
|
239 HBufC* iPassword; |
|
240 |
|
241 // param structs |
|
242 TRsfwAuthParamsPckg* iAuthRequest; |
|
243 TRsfwSaveToParamsPckg* iSaveToRequest; |
|
244 |
|
245 // Valid during showing a dialog |
|
246 CAknDialog* iDialog; |
|
247 CAknWaitDialog* iWaitDialog; |
|
248 TBool iCancelled; |
|
249 |
|
250 // for save as dialog |
|
251 HBufC* iFileName; |
|
252 TInt iFileSize; |
|
253 TBuf<KRsfwMaxDriveletterLength> iCacheDrive; |
|
254 CAknMemorySelectionDialog* iMemDialog; |
|
255 HBufC* iCurrentRootPath; |
|
256 RFs iFs; |
|
257 |
|
258 // |
|
259 TBool iDialogDismissedCalled; |
|
260 TBool iAppSwitchingBlocked; // is 'app key' disabled |
|
261 }; |
|
262 |
|
263 #endif |