1 /* |
|
2 * Copyright (c) 2005 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: The implementation for AppUi class of Settings UI Server |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <w32std.h> |
|
20 #include <apgwgnam.h> |
|
21 #include <akntitle.h> |
|
22 #include <eikdoc.h> |
|
23 #include <eikapp.h> |
|
24 #include <bldvariant.hrh> |
|
25 |
|
26 #include "locsettingsuisrvappui.h" |
|
27 #include "locsettingsuilaunchmgr.h" |
|
28 |
|
29 const TInt KWsArrayGranularity = 4; |
|
30 |
|
31 // ======== MEMBER FUNCTIONS ======== |
|
32 |
|
33 // --------------------------------------------------------------------------- |
|
34 // CLocSettingsUISrvAppUi::CLocSettingsUISrvAppUi() |
|
35 // --------------------------------------------------------------------------- |
|
36 // |
|
37 CLocSettingsUISrvAppUi::CLocSettingsUISrvAppUi() |
|
38 { |
|
39 } |
|
40 |
|
41 |
|
42 // --------------------------------------------------------------------------- |
|
43 // CLocSettingsUISrvAppUi::CLocSettingsUISrvAppUi() |
|
44 // --------------------------------------------------------------------------- |
|
45 // |
|
46 CLocSettingsUISrvAppUi::~CLocSettingsUISrvAppUi() |
|
47 { |
|
48 } |
|
49 |
|
50 |
|
51 // --------------------------------------------------------------------------- |
|
52 // CLocSettingsUISrvAppUi::CLocSettingsUISrvAppUi() |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 void CLocSettingsUISrvAppUi::ConstructL() |
|
56 { |
|
57 BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible); |
|
58 |
|
59 // The Caption text for Location Settings UI Server should be that of the |
|
60 // application which is currently in the background. Hence, loop through |
|
61 // all the background applications and obtain the Caption from the |
|
62 // application at the top of the stack |
|
63 RWsSession& wsSession=iEikonEnv->WsSession(); |
|
64 TInt count=wsSession.NumWindowGroups( 0 ); |
|
65 |
|
66 RArray<RWsSession::TWindowGroupChainInfo>* allWgIds = new (ELeave) |
|
67 RArray<RWsSession::TWindowGroupChainInfo>( KWsArrayGranularity ); |
|
68 |
|
69 CleanupDeletePushL( allWgIds ); |
|
70 CleanupClosePushL( *allWgIds ); |
|
71 |
|
72 User::LeaveIfError( wsSession.WindowGroupList( 0, allWgIds) ); |
|
73 |
|
74 count = allWgIds->Count(); |
|
75 for (TInt index=0; index<count; index++) |
|
76 { |
|
77 RWsSession::TWindowGroupChainInfo& info = (*allWgIds)[index]; |
|
78 if ( info.iParentId <= 0 ) |
|
79 { |
|
80 CApaWindowGroupName* windowName = |
|
81 CApaWindowGroupName::NewLC(wsSession, info.iId); |
|
82 |
|
83 if ( !windowName->Hidden() && |
|
84 Document()->Application()->AppDllUid() != windowName->AppUid()) |
|
85 { |
|
86 // Got the first non-hidden app. |
|
87 // This should be the background application. |
|
88 |
|
89 CAknTitlePane* title = static_cast<CAknTitlePane*>( |
|
90 StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ))); |
|
91 |
|
92 HBufC* buf = HBufC::NewL(windowName->Caption().Length()); |
|
93 buf->Des().Copy(windowName->Caption()); |
|
94 title->SetText( buf ); // Takes ownership of buf |
|
95 CleanupStack::PopAndDestroy( windowName ); |
|
96 break; |
|
97 } |
|
98 CleanupStack::PopAndDestroy( windowName ); |
|
99 } |
|
100 } |
|
101 CleanupStack::PopAndDestroy( 2, allWgIds ); // destroy allwgIds |
|
102 } |
|
103 |
|
104 // --------------------------------------------------------------------------- |
|
105 // CLocSettingsUISrvAppUi::SetFullScreenState( TBool aFullScreenState ) |
|
106 // --------------------------------------------------------------------------- |
|
107 // |
|
108 void CLocSettingsUISrvAppUi::SetFullScreenState( TBool aFullScreenState ) |
|
109 { |
|
110 SetFullScreenApp( aFullScreenState ); |
|
111 } |
|
112 |
|
113 // --------------------------------------------------------------------------- |
|
114 // CLocSettingsUISrvAppUi::HandleCommandL(TInt aCommand) |
|
115 // --------------------------------------------------------------------------- |
|
116 // |
|
117 void CLocSettingsUISrvAppUi::HandleCommandL(TInt aCommand) |
|
118 { |
|
119 switch(aCommand) |
|
120 { |
|
121 case EEikCmdExit: |
|
122 case EAknSoftkeyExit: |
|
123 { |
|
124 CLocSettingsUILaunchMgr* launchMgr = |
|
125 CLocSettingsUILaunchMgr::InstanceL(); |
|
126 if ( iEikonEnv->StartedAsServerApp() ) |
|
127 { |
|
128 // In case of Embedded Application indicate that |
|
129 // server application is going to close after the |
|
130 // request is completed. |
|
131 launchMgr->CloseRunningSettingsUi(EEikCmdExit); |
|
132 // If it is an Embedded App then close the Server |
|
133 // Application. |
|
134 Exit(); |
|
135 } |
|
136 else |
|
137 { |
|
138 // In case of Normal launch behave as if the User |
|
139 // pressed back soft key and not exit. |
|
140 // So we will continue with the next request. |
|
141 launchMgr->CloseRunningSettingsUi(KErrNone); |
|
142 } |
|
143 break; |
|
144 } |
|
145 default: |
|
146 CEikAppUi::HandleCommandL(aCommand); |
|
147 } |
|
148 } |
|
149 |
|
150 |
|
151 //End of file |
|