37 #include <skinlayout.cdl.h> |
37 #include <skinlayout.cdl.h> |
38 |
38 |
39 #include <akntransitionutils.h> |
39 #include <akntransitionutils.h> |
40 #include <akntranseffect.h> |
40 #include <akntranseffect.h> |
41 #include <gfxtranseffect/gfxtranseffect.h> |
41 #include <gfxtranseffect/gfxtranseffect.h> |
42 #include <WidgetRegistryConstants.h> |
|
43 #include <WidgetRegistryData.h> |
|
44 #include <featmgr.h> |
42 #include <featmgr.h> |
45 #include <aknglobalpopupprioritycontroller.h> |
43 #include <aknglobalpopupprioritycontroller.h> |
46 #include <centralrepository.h> |
44 #include <centralrepository.h> |
47 #include <AknTasHook.h> |
45 #include <AknTasHook.h> |
48 #include <touchfeedback.h> |
46 #include <touchfeedback.h> |
155 CAknTransitionUtils::RemoveObserver( this, aEvent ); |
153 CAknTransitionUtils::RemoveObserver( this, aEvent ); |
156 _AKNTRACE_FUNC_EXIT; |
154 _AKNTRACE_FUNC_EXIT; |
157 return KErrNone; |
155 return KErrNone; |
158 } |
156 } |
159 |
157 |
160 NONSHARABLE_CLASS(CAknWidgetList) : public CBase |
|
161 { |
|
162 public: |
|
163 static CAknWidgetList* NewL( CAknFastSwapWindowControl& aParent ); |
|
164 /** Destructor */ |
|
165 ~CAknWidgetList(); |
|
166 |
|
167 /** |
|
168 * Initializes the list that stores widgets. |
|
169 * @return - |
|
170 */ |
|
171 void InitializeWidgetListL(); |
|
172 |
|
173 /** |
|
174 * Check if a uid is the uid of the widget application. |
|
175 * @param aAppUid The application uid to be checked. |
|
176 * @return ETrue application uid belongs to widget application - EFalse otherwise. |
|
177 */ |
|
178 TBool IsWidgetAppUI( TUid aAppUid ); |
|
179 |
|
180 /** |
|
181 * Check if the window group id value refers to widget. |
|
182 * @param aWgId window group id. |
|
183 * @return ETrue if window group id has value that refers to widget. |
|
184 */ |
|
185 TBool IsWidget( TInt aWgId ); |
|
186 |
|
187 /** |
|
188 * Map tasklist application index to application Uid. |
|
189 * |
|
190 * @param aIndex index of tasklist item array. |
|
191 * @param aAlwaysShownCount number of applications that are always shown on |
|
192 the active applications list. |
|
193 * @return application Uid |
|
194 */ |
|
195 TUid IndexToAppUid( TInt aIndex, TInt aAlwaysShownCount ); |
|
196 |
|
197 private: |
|
198 /** Constructor */ |
|
199 CAknWidgetList( CAknFastSwapWindowControl& aParent ); |
|
200 void ConstructL(); |
|
201 void ResetArrayOfWidgetInfo( RWidgetInfoArray& aWidgetInfoArr ); |
|
202 |
|
203 static void CleanupConnect( TAny* aThis ); |
|
204 |
|
205 public: |
|
206 /** Contains list of widgets that are currently running */ |
|
207 RWidgetInfoArray iRunningWidgets; |
|
208 private: |
|
209 CAknFastSwapWindowControl& iParent; |
|
210 RWidgetRegistryClientSession iWidgetRegistryClientSession; |
|
211 }; |
|
212 |
|
213 |
|
214 CAknWidgetList* CAknWidgetList::NewL( CAknFastSwapWindowControl& aParent ) |
|
215 { |
|
216 _AKNTRACE_FUNC_ENTER; |
|
217 CAknWidgetList* self = new (ELeave) CAknWidgetList( aParent ); |
|
218 CleanupStack::PushL(self); |
|
219 self->ConstructL(); |
|
220 CleanupStack::Pop(); //self |
|
221 _AKNTRACE_FUNC_EXIT; |
|
222 return self; |
|
223 } |
|
224 |
|
225 CAknWidgetList::CAknWidgetList( CAknFastSwapWindowControl& aParent ): iParent( aParent ) |
|
226 { |
|
227 } |
|
228 |
|
229 CAknWidgetList::~CAknWidgetList() |
|
230 { |
|
231 _AKNTRACE_FUNC_ENTER; |
|
232 ResetArrayOfWidgetInfo( iRunningWidgets ); |
|
233 iRunningWidgets.Reset(); |
|
234 _AKNTRACE_FUNC_EXIT; |
|
235 } |
|
236 |
|
237 void CAknWidgetList::ConstructL() |
|
238 { |
|
239 } |
|
240 |
|
241 void CAknWidgetList::CleanupConnect( TAny* aThis ) |
|
242 { |
|
243 _AKNTRACE_FUNC_ENTER; |
|
244 (( CAknWidgetList*)aThis)->iWidgetRegistryClientSession.Disconnect(); |
|
245 _AKNTRACE_FUNC_EXIT; |
|
246 } |
|
247 |
|
248 void CAknWidgetList::InitializeWidgetListL() |
|
249 { |
|
250 _AKNTRACE_FUNC_ENTER; |
|
251 ResetArrayOfWidgetInfo( iRunningWidgets ); |
|
252 iRunningWidgets.Reset(); |
|
253 User::LeaveIfError( iWidgetRegistryClientSession.Connect() ); |
|
254 CleanupStack::PushL( TCleanupItem( CleanupConnect, this) ); |
|
255 iWidgetRegistryClientSession.RunningWidgetsL(iRunningWidgets); |
|
256 for ( TInt i = iRunningWidgets.Count() - 1; i > -1; i-- ) |
|
257 { |
|
258 if ( !iWidgetRegistryClientSession.IsWidgetInFullView(iRunningWidgets[i]->iUid) ) |
|
259 { |
|
260 delete iRunningWidgets[i]; |
|
261 iRunningWidgets.Remove(i); |
|
262 } |
|
263 } |
|
264 CleanupStack::Pop(); // clean WidgetRegistryClientSession item |
|
265 iWidgetRegistryClientSession.Disconnect(); |
|
266 _AKNTRACE_FUNC_EXIT; |
|
267 } |
|
268 |
|
269 TBool CAknWidgetList::IsWidgetAppUI( TUid aAppUid ) |
|
270 { |
|
271 _AKNTRACE( "[%s] aAppUid = %d", |
|
272 __FUNCTION__, aAppUid.iUid ); |
|
273 return (aAppUid == KWidgetAppUid); |
|
274 } |
|
275 |
|
276 TBool CAknWidgetList::IsWidget( TInt aWgId ) |
|
277 { |
|
278 _AKNTRACE( "[%s] aWgId = %d", |
|
279 __FUNCTION__, aWgId ); |
|
280 return (aWgId == KWidgetWithoutWG); |
|
281 } |
|
282 |
|
283 TUid CAknWidgetList::IndexToAppUid( TInt aIndex, TInt aAlwaysShownCount ) |
|
284 { |
|
285 _AKNTRACE( "[%s] aIndex = %d aAlwaysShownCount = %d", |
|
286 __FUNCTION__, aIndex, aAlwaysShownCount ); |
|
287 return iRunningWidgets[aIndex + iRunningWidgets.Count() + |
|
288 aAlwaysShownCount - iParent.iNumberOfWGs]->iUid; |
|
289 } |
|
290 |
|
291 void CAknWidgetList::ResetArrayOfWidgetInfo( |
|
292 RWidgetInfoArray& aWidgetInfoArr ) |
|
293 { |
|
294 _AKNTRACE_FUNC_ENTER; |
|
295 for ( TInt i = 0; i < aWidgetInfoArr.Count(); i++ ) |
|
296 { |
|
297 CWidgetInfo *item = aWidgetInfoArr[i]; |
|
298 delete item ; |
|
299 } |
|
300 _AKNTRACE_FUNC_EXIT; |
|
301 } |
|
302 |
|
303 |
|
304 NONSHARABLE_CLASS(CAknAlwaysShownAppList) : public CBase |
158 NONSHARABLE_CLASS(CAknAlwaysShownAppList) : public CBase |
305 { |
159 { |
306 public: |
160 public: |
307 // always shown application info |
161 // always shown application info |
308 // used in the always shown application list |
162 // used in the always shown application list |
526 // ================= MEMBER FUNCTIONS ======================= |
380 // ================= MEMBER FUNCTIONS ======================= |
527 // C++ default constructor can NOT contain any code, that |
381 // C++ default constructor can NOT contain any code, that |
528 // might leave. |
382 // might leave. |
529 // |
383 // |
530 CAknFastSwapWindowControl::CAknFastSwapWindowControl(CAknCapAppServerAppUi& aAppUi) |
384 CAknFastSwapWindowControl::CAknFastSwapWindowControl(CAknCapAppServerAppUi& aAppUi) |
531 : iAppUi( aAppUi ),iLowMemory( EFalse ), iLowMemIcons( EFalse ), iAppArcSessionInitiated( EFalse ), |
385 : iAppUi( aAppUi ), iLowMemory( EFalse ), iLowMemIcons( EFalse ), iAppArcSessionInitiated( EFalse ), |
532 iWidgetAppUiWgId(-1), iWidgetsSupported( EFalse ), |
386 iTooltipModeTouch( EFalse ), iTransparencyEnabled( CAknEnv::Static()->TransparencyEnabled() ), |
533 iTooltipModeTouch( EFalse ),iTransparencyEnabled( CAknEnv::Static()->TransparencyEnabled() ), |
|
534 iIsStylusPopupShow(EFalse), iState( EWaiting ) |
387 iIsStylusPopupShow(EFalse), iState( EWaiting ) |
535 { |
388 { |
536 AKNTASHOOK_ADD( this, "CAknFastSwapWindowControl" ); |
389 AKNTASHOOK_ADD( this, "CAknFastSwapWindowControl" ); |
537 } |
390 } |
538 |
391 |
884 iAppArcSessionInitiated = ETrue; |
729 iAppArcSessionInitiated = ETrue; |
885 } |
730 } |
886 iAppArcSession.GetAllApps(); |
731 iAppArcSession.GetAllApps(); |
887 // create list for always shown applications |
732 // create list for always shown applications |
888 iAlwaysShownList->InitializeAlwaysShownListL(); |
733 iAlwaysShownList->InitializeAlwaysShownListL(); |
889 if (iWidgetsSupported) |
734 |
890 { |
|
891 iWidgetList->InitializeWidgetListL(); |
|
892 } |
|
893 //Initializes CAknFastSwapWindowControl private data ( iWgIds, iNumberOfWGs ) |
735 //Initializes CAknFastSwapWindowControl private data ( iWgIds, iNumberOfWGs ) |
894 RWsSession& wsSession=iEikonEnv->WsSession(); |
736 RWsSession& wsSession=iEikonEnv->WsSession(); |
895 TInt count=wsSession.NumWindowGroups( 0 ); |
737 TInt count=wsSession.NumWindowGroups( 0 ); |
896 |
738 |
897 RArray<RWsSession::TWindowGroupChainInfo>* allWgIds = new (ELeave) |
739 RArray<RWsSession::TWindowGroupChainInfo>* allWgIds = new (ELeave) |
938 // always shown applications are appended to the end of window group list |
780 // always shown applications are appended to the end of window group list |
939 if ( iAlwaysShownList->IsAlwaysShownApp( applicationUid ) ) |
781 if ( iAlwaysShownList->IsAlwaysShownApp( applicationUid ) ) |
940 { |
782 { |
941 iAlwaysShownList->AddWgGroupToAlwaysShownList( applicationUid, wgId ); |
783 iAlwaysShownList->AddWgGroupToAlwaysShownList( applicationUid, wgId ); |
942 } |
784 } |
943 else if (iWidgetsSupported && iWidgetList->IsWidgetAppUI(applicationUid)) |
785 |
944 { |
|
945 iWidgetAppUiWgId = wgId; |
|
946 } |
|
947 // could't use windowName->IsAppReady(), because then java and console application |
786 // could't use windowName->IsAppReady(), because then java and console application |
948 // wouldn't be seen in FSW. Now it is possible that some system apps are seen at the |
787 // wouldn't be seen in FSW. Now it is possible that some system apps are seen at the |
949 // beginning of their start for a while in FSW (even they should be hidden all the time) |
788 // beginning of their start for a while in FSW (even they should be hidden all the time) |
950 // temporary solution since application shell is normally hidden from tasklist |
789 // temporary solution since application shell is normally hidden from tasklist |
951 // and in the new solution it should be shown |
790 // and in the new solution it should be shown |
3031 // if this leaves, okToClose will be left as ETrue |
2842 // if this leaves, okToClose will be left as ETrue |
3032 iTooltip->HideInfoPopupNote(); |
2843 iTooltip->HideInfoPopupNote(); |
3033 |
2844 |
3034 iIsClosing = ETrue; |
2845 iIsClosing = ETrue; |
3035 |
2846 |
3036 if (iWidgetsSupported && iWidgetList->IsWidget( iConfirmCloseWgId )) |
2847 if ( aIsShift ) |
3037 { |
|
3038 TWsEvent event; |
|
3039 event.SetType(EEventUser); |
|
3040 |
|
3041 TUid widgetUid = iWidgetList->IndexToAppUid(aIndex, iAlwaysShownList->iAppList->Count()); |
|
3042 |
|
3043 TInt32 widgetAppUiUidInt = KWidgetAppUid.iUid; |
|
3044 TInt32 widgetUidInt = widgetUid.iUid; |
|
3045 TUint8* eventData = event.EventData(); |
|
3046 // Fill bits 0-31 with widget application Uid. |
|
3047 (TUint32&)*eventData = widgetAppUiUidInt; |
|
3048 eventData+=sizeof(TUint32); |
|
3049 // Fill bits 32-63 with uid of the widget that should be closed. |
|
3050 (TUint32&)*eventData = widgetUidInt; |
|
3051 // Send the event to Widget AppUi. |
|
3052 iEikonEnv->WsSession().SendEventToWindowGroup(iWidgetAppUiWgId, event); |
|
3053 } |
|
3054 else if ( aIsShift ) |
|
3055 { |
2848 { |
3056 TApaTask task( iEikonEnv->WsSession() ); |
2849 TApaTask task( iEikonEnv->WsSession() ); |
3057 task.SetWgId( iConfirmCloseWgId ); |
2850 task.SetWgId( iConfirmCloseWgId ); |
3058 task.SendSystemEvent( EApaSystemEventShutdown); |
2851 task.SendSystemEvent( EApaSystemEventShutdown); |
3059 } |
2852 } |