|
1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * class definition for CUISettingsSrvServer and CUISettingsSrvSession |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef __UISettingsSrv_H__ |
|
20 #define __UISettingsSrv_H__ |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <f32file.h> |
|
25 // #include "ScSelectableShortcutListObserver.h" |
|
26 // #include "ScShortcutUids.h" |
|
27 // #include "ScShortcutEngineObserver.h" |
|
28 #include <gsasyncimagehandling.h> |
|
29 #include <mgsasyncimagehandlingobserver.h> |
|
30 |
|
31 // CONSTANTS |
|
32 // MACROS |
|
33 //#define ?macro ?macro_def |
|
34 |
|
35 // DATA TYPES |
|
36 |
|
37 // reasons for server panic |
|
38 enum TUISettingsSrvPanic |
|
39 { |
|
40 EBadRequest, |
|
41 EBadDescriptor, |
|
42 EMainSchedulerError, |
|
43 ESvrCreateServer, |
|
44 ESvrStartServer, |
|
45 ECreateTrapCleanup, |
|
46 ENotImplementedYet |
|
47 }; |
|
48 |
|
49 |
|
50 // FUNCTION PROTOTYPES |
|
51 |
|
52 // function to panic the server |
|
53 GLREF_C void PanicServer(TUISettingsSrvPanic aPanic); |
|
54 // thread function for server |
|
55 GLREF_C TInt CountServerThread(TAny *); |
|
56 |
|
57 |
|
58 |
|
59 // FORWARD DECLARATIONS |
|
60 |
|
61 // class CScShortcutEngine; |
|
62 class CScSelectableShortcutList; |
|
63 |
|
64 // CLASS DECLARATION |
|
65 const TUint KUISettingsSrvShutdownDelay = 120000000L; |
|
66 |
|
67 class CShutdown : public CTimer |
|
68 { |
|
69 public: |
|
70 inline CShutdown(); |
|
71 inline void ConstructL(); |
|
72 inline void Start(); |
|
73 void RunL(); |
|
74 }; |
|
75 |
|
76 |
|
77 //********************************** |
|
78 //CUISettingsSrvServer |
|
79 //********************************** |
|
80 //The server class; an active object. |
|
81 //Contains an instance of RServer; a handle to the kernel server representation which is used |
|
82 //to receive messages. |
|
83 |
|
84 class CUISettingsSrvServer : public CPolicyServer |
|
85 // , public MScSelectableShortcutListObserver |
|
86 // , public MScEngineObserver |
|
87 , public MGSAsyncImageHandlingObserver |
|
88 { |
|
89 public: |
|
90 static CUISettingsSrvServer* NewL(); |
|
91 virtual ~CUISettingsSrvServer(); |
|
92 |
|
93 virtual CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const; |
|
94 static TInt ThreadFunction(TAny* aStarted); |
|
95 |
|
96 // From MScSelectableShortcutListObserver |
|
97 void ScSSLOHandleListChangedL(); |
|
98 void ScSSLOHandleListConstructionComplete(TInt aError); |
|
99 |
|
100 // From MScEngineObserver |
|
101 //TBool MScEngineHandleShortcutEvent( |
|
102 // TScShortcutEvent aEvent, |
|
103 // TScActionType aType |
|
104 // ); |
|
105 |
|
106 void GetShortcutTargetListL(); |
|
107 |
|
108 void AddListChangeNotifierL(TInt *aFlag); |
|
109 void RemoveListChangeNotifierL(TInt *aFlag); |
|
110 void SetShortcutListMaskL(CScSelectableShortcutList& aScAppList, TInt aMask); |
|
111 |
|
112 void GetShortcutTargetCountL(const RMessage2 &aMessage); |
|
113 void GetShortcutTargetTypeL(const RMessage2 &aMessage); |
|
114 void GetShortcutTargetAppUidL(const RMessage2 &aMessage); |
|
115 void GetShortcutTargetIndexFromATL(const RMessage2 &aMessage); |
|
116 void GetShortcutTargetIndexL(const RMessage2 &aMessage); |
|
117 void SetShortcutTargetAppIndexL(const RMessage2 &aMessage); |
|
118 void GetShortcutRtTypeL(const RMessage2 &aMessage); |
|
119 |
|
120 void SetShortcutTargetCaptionL(const RMessage2 &aMessage); |
|
121 void GetShortcutTargetCaptionL(const RMessage2 &aMessage); |
|
122 |
|
123 void SetShortcutTargetBitmapL(const RMessage2 &aMessage, TBool aIsMask=EFalse); |
|
124 void GetShortcutTargetBitmapL(const RMessage2 &aMessage, TBool aIsMask=EFalse); |
|
125 |
|
126 void SetSoftkeyBitmapL(const RMessage2 &aMessage, TBool aIsMask=EFalse); |
|
127 void GetSoftkeyBitmapL(const RMessage2 &aMessage, TBool aIsMask=EFalse); |
|
128 |
|
129 void SetStartupImageL( const TDesC &aFilePath ); |
|
130 void SetStartupImageL(const RMessage2 &aMessage); |
|
131 void GetStartupImagePathL(const RMessage2 &aMessage); |
|
132 void SetStartupTextL(const RMessage2 &aMessage); |
|
133 void GetStartupTextL(const RMessage2 &aMessage); |
|
134 void GetStartupTextSizeL(const RMessage2 &aMessage); |
|
135 void SetStartupNoteTypeL(const RMessage2 &aMessage); |
|
136 void GetStartupNoteTypeL(const RMessage2 &aMessage); |
|
137 |
|
138 CFbsBitmap* LoadBitmapL( const TDesC& aFileName, const TDesC8& aType ); |
|
139 |
|
140 // From MGSAsyncImageHandlingObserver |
|
141 void ImageHandlingCompleteL( TInt aError ); |
|
142 |
|
143 public: |
|
144 void AddSession(); |
|
145 void RemoveSession(); |
|
146 void Shutdown(); |
|
147 |
|
148 protected: |
|
149 CUISettingsSrvServer(TInt aPriority); |
|
150 void ConstructL(); |
|
151 |
|
152 private: |
|
153 CPolicyServer::TCustomResult CustomSecurityCheckL(const RMessage2& aMsg, TInt& aAction, TSecurityInfo& aMissing); |
|
154 |
|
155 private: |
|
156 RFs iFs; |
|
157 TInt iActive; |
|
158 TInt iSessionCount; |
|
159 CShutdown iShutdownTimer; |
|
160 CActiveSchedulerWait iASWait; |
|
161 // CScShortcutEngine* iShortcuts; |
|
162 RArray<TInt32> iIndeces; |
|
163 RArray<TInt*> iNotifyChanges; |
|
164 CGSAsyncImageHandling* iImgHandling; |
|
165 CRepository* iStartupRep; |
|
166 CScSelectableShortcutList* iAppList; |
|
167 const TUid iIdleBitmapUid; |
|
168 const TUid iAIBitmapUid; |
|
169 TFileName iTemporaryImageFile; |
|
170 TInt iImageHandlingError; |
|
171 |
|
172 #define UISETTINGSSRV_POLICYCOUNT 2 |
|
173 static const CPolicyServer::TPolicy iConnectionPolicy; |
|
174 static const TInt iRanges[UISETTINGSSRV_POLICYCOUNT]; |
|
175 static const TUint8 iElementsIndex[UISETTINGSSRV_POLICYCOUNT]; |
|
176 }; |
|
177 |
|
178 //********************************** |
|
179 //CUISettingsSrvSession |
|
180 //********************************** |
|
181 //This class represents a session in the server. |
|
182 //CSession::Client() returns the client thread. |
|
183 //Functions are provided to respond appropriately to client messages. |
|
184 |
|
185 |
|
186 class CUISettingsSrvSession : public CSession2 |
|
187 { |
|
188 public: |
|
189 |
|
190 // construct / destruct |
|
191 static CUISettingsSrvSession* NewL(CUISettingsSrvServer * aServer); |
|
192 |
|
193 ~CUISettingsSrvSession(); |
|
194 |
|
195 //service request |
|
196 virtual void ServiceL(const RMessage2 &aMessage); |
|
197 TBool DispatchMessageL(const RMessage2 &aMessage); |
|
198 |
|
199 void SetStartupImageL(const RMessage2 &aMessage); |
|
200 void GetStartupImagePathL(const RMessage2 &aMessage); |
|
201 void SetStartupTextL(const RMessage2 &aMessage); |
|
202 void GetStartupTextL(const RMessage2 &aMessage); |
|
203 void GetStartupTextSizeL(const RMessage2 &aMessage); |
|
204 void SetStartupNoteTypeL(const RMessage2 &aMessage); |
|
205 void GetStartupNoteTypeL(const RMessage2 &aMessage); |
|
206 |
|
207 void GetShortcutTargetListL( ); |
|
208 void GetShortcutTargetCountL(const RMessage2 &aMessage); |
|
209 void GetShortcutTargetTypeL(const RMessage2 &aMessage); |
|
210 void GetShortcutTargetAppUidL(const RMessage2 &aMessage); |
|
211 void GetShortcutTargetIndexFromATL(const RMessage2 &aMessage); |
|
212 void GetShortcutTargetIndexL(const RMessage2 &aMessage); |
|
213 void SetShortcutTargetAppIndexL(const RMessage2 &aMessage); |
|
214 void GetShortcutRtTypeL(const RMessage2 &aMessage); |
|
215 |
|
216 void SetShortcutTargetCaptionL(const RMessage2 &aMessage); |
|
217 void GetShortcutTargetCaptionL(const RMessage2 &aMessage); |
|
218 |
|
219 void SetShortcutTargetBitmapL(const RMessage2 &aMessage, TBool aIsMask=EFalse); |
|
220 void GetShortcutTargetBitmapL(const RMessage2 &aMessage, TBool aIsMask=EFalse); |
|
221 |
|
222 void SetSoftkeyBitmapL(const RMessage2 &aMessage, TBool aIsMask=EFalse); |
|
223 void GetSoftkeyBitmapL(const RMessage2 &aMessage, TBool aIsMask=EFalse); |
|
224 |
|
225 void AppListCheckL(); |
|
226 |
|
227 static HBufC8* CopyParameter8L( const RMessage2 &aMsg, TInt aIndex ); |
|
228 static HBufC16* CopyParameter16L( const RMessage2 &aMsg, TInt aIndex ); |
|
229 |
|
230 protected: |
|
231 // panic the client |
|
232 void PanicClient(const RMessagePtr2& aMessage,TInt aPanic); |
|
233 // safewrite between client and server |
|
234 void Write(const TAny* aPtr,const TDesC8& aDes,TInt anOffset=0); |
|
235 |
|
236 CUISettingsSrvSession(CUISettingsSrvServer * aServer); |
|
237 void ConstructL(); |
|
238 |
|
239 private: |
|
240 CUISettingsSrvServer *iServer; |
|
241 TInt iCount; |
|
242 TInt iListChanged; |
|
243 }; |
|
244 |
|
245 #endif // __UISettingsSrv_H__ |