|
1 /* |
|
2 * Copyright (c) 2009 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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_APPLICATIONSTATESOURCEPLUGIN_H |
|
20 #define C_APPLICATIONSTATESOURCEPLUGIN_H |
|
21 |
|
22 // INCLUDES |
|
23 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
24 #include <viewcli.h> |
|
25 #else |
|
26 #include <viewcli.h> |
|
27 #include <viewclipartner.h> |
|
28 #endif |
|
29 #include <cfcontextsourceplugin.h> |
|
30 #include <cfcontextobject.h> |
|
31 #include <cenrepnotifyhandler.h> |
|
32 |
|
33 #include "cfapplicationstatesettings.h" |
|
34 #include "uidorientationpair.h" |
|
35 |
|
36 // FORWARD DECLARATIONS |
|
37 class CRepository; |
|
38 class CCenRepNotifyHandler; |
|
39 |
|
40 // CLASS DECLARATION |
|
41 |
|
42 /** |
|
43 * Application state source plugin. |
|
44 * Application state source plugin is responsible for listening view activations |
|
45 * from view server client session and mapping them to foreground application and |
|
46 * view contexts. |
|
47 * |
|
48 * @lib - |
|
49 * @since S60 4.0 |
|
50 */ |
|
51 NONSHARABLE_CLASS( CApplicationStateSourcePlugIn ): |
|
52 public CCFContextSourcePlugIn, |
|
53 public MVwsSessionWrapperObserver, |
|
54 public MCenRepNotifyHandlerCallback |
|
55 { |
|
56 public: // Constructors and destructor |
|
57 |
|
58 // Two phased constructors |
|
59 static CApplicationStateSourcePlugIn* NewL( |
|
60 TContextSourceInitParams* aParams ); |
|
61 static CApplicationStateSourcePlugIn* NewLC( |
|
62 TContextSourceInitParams* aParams ); |
|
63 |
|
64 // Destructor |
|
65 ~CApplicationStateSourcePlugIn(); |
|
66 |
|
67 public: // From CCFContextSourcePlugIn |
|
68 |
|
69 // @see CCFContextSourcePlugIn |
|
70 void HandleSettingL( CCFContextSourceSettingArray* aSettingList ); |
|
71 |
|
72 // @see CCFContextSourcePlugIn |
|
73 void DefineContextsL(); |
|
74 |
|
75 // @see CCFContextSourcePlugIn |
|
76 void InitializeL(); |
|
77 |
|
78 public: // From MVwsSessionWrapperObserver |
|
79 |
|
80 // @see MVwsSessionWrapperObserver |
|
81 void HandleViewEventL( const TVwsViewEvent& aEvent ); |
|
82 |
|
83 public: // From MCenRepNotifyHandlerCallback |
|
84 |
|
85 // @see MCenRepNotifyHandlerCallback |
|
86 void HandleNotifyGeneric( TUint32 aId ); |
|
87 |
|
88 private: // Constructors |
|
89 |
|
90 // C++ constrcutor |
|
91 CApplicationStateSourcePlugIn( TContextSourceInitParams* aParams ); |
|
92 |
|
93 // Symbian second-phase constructor |
|
94 void ConstructL(); |
|
95 |
|
96 private: // New functions |
|
97 |
|
98 /** |
|
99 * Converts string to hex. |
|
100 * |
|
101 * @since S60 v4.0 |
|
102 * @param aString Hexadecimal number as string having "0x" prefix. |
|
103 * @param aValue Storage for the unsigned integer. |
|
104 * @return KErrNone if successful, KErrNotFound otherwise. |
|
105 */ |
|
106 TInt ConvertToHex( const TDesC& aString, TUint32& aValue ); |
|
107 |
|
108 // Initialize application settings from XML |
|
109 void InitializeApplicationsFromXMLL(); |
|
110 |
|
111 // Initialize the fg application context |
|
112 void InitializeFgApplicationL(); |
|
113 |
|
114 // Handles the view server event |
|
115 void DoHandleViewEventL( const TVwsViewEvent& aEvent ); |
|
116 |
|
117 // Resolve fg app orientation |
|
118 TPtrC ResolveFgAppOrientation( const TUid& aUid ); |
|
119 |
|
120 // Find app from cache by uid |
|
121 TInt FindByUid( const TUid& aUid ) const; |
|
122 |
|
123 private: // Data |
|
124 |
|
125 // Buffers for default settings. |
|
126 HBufC* iDefaultAppName; |
|
127 HBufC* iDefaultViewName; |
|
128 HBufC* iApplDefaultState; |
|
129 TInt iDefStateSetManyTimes; |
|
130 |
|
131 // View server client session for foreground application notifications. |
|
132 CVwsSessionWrapper* iVws; |
|
133 |
|
134 // Context instance for all the generated contexts. |
|
135 CCFContextObject* iContext; |
|
136 |
|
137 // The name of the previous foreground application used by background |
|
138 // application context publishing when the application was closed. |
|
139 // Additionally, used to control context publishing based on change. |
|
140 TPtrC iPreviousForegroundApplication; |
|
141 |
|
142 // The name of the previous foreground view used to control context |
|
143 // publishing based on change. |
|
144 TPtrC iPreviousForegroundView; |
|
145 |
|
146 // My settings. |
|
147 CCFContextSourceSettingArray* iSettings; |
|
148 |
|
149 // Foreground application setting list |
|
150 RApplicationStateSettingsPointerArray iApplicationSettings; |
|
151 |
|
152 // Previous foreground application orientation |
|
153 TPtrC iPreviousOrientation; |
|
154 |
|
155 // KCRUidDefaultAppOrientation cenrep |
|
156 CRepository* iCRAppOrientation; |
|
157 |
|
158 // Default application orientation |
|
159 TInt iDefaultFgAppOrientation; |
|
160 |
|
161 // Application uid and orientation cache |
|
162 RUidOrientationList iUidOrientationList; |
|
163 |
|
164 // KCRUidDefaultAppOrientation listener |
|
165 CCenRepNotifyHandler* iCRAppOrientationListener; |
|
166 }; |
|
167 |
|
168 #endif // C_APPLICATIONSTATESOURCEPLUGIN_H |