|
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: Application UI. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "AboutAppUi.h" |
|
22 #include "AboutContainer.h" |
|
23 #include <avkon.hrh> |
|
24 #include <sysversioninfo.h> |
|
25 |
|
26 // local constant |
|
27 const TUint32 KSettingAppID = 0x100058EC; |
|
28 |
|
29 // ================= MEMBER FUNCTIONS ======================= |
|
30 // |
|
31 // ---------------------------------------------------------- |
|
32 // CAboutAppUi::ConstructL() |
|
33 // Default constructor |
|
34 // ---------------------------------------------------------- |
|
35 // |
|
36 void CAboutAppUi::ConstructL() |
|
37 { |
|
38 BaseConstructL(); |
|
39 |
|
40 // Gets whether server is required or not. |
|
41 iSettingType = iEikonEnv->StartedAsServerApp(); |
|
42 |
|
43 iAppContainer = new( ELeave ) CAboutContainer; |
|
44 iAppContainer->SetMopParent( this ); |
|
45 iAppContainer->ConstructL( ClientRect() ); |
|
46 AddToStackL( iAppContainer ); |
|
47 SetNaviPaneLabelL(); |
|
48 } |
|
49 |
|
50 // ---------------------------------------------------- |
|
51 // CAboutAppUi::~CAboutAppUi() |
|
52 // Destructor |
|
53 // Frees reserved resources |
|
54 // ---------------------------------------------------- |
|
55 // |
|
56 CAboutAppUi::~CAboutAppUi() |
|
57 { |
|
58 if ( iAppContainer ) |
|
59 { |
|
60 RemoveFromStack( iAppContainer ); |
|
61 delete iAppContainer; |
|
62 } |
|
63 if ( iNaviDecorator ) |
|
64 { |
|
65 delete iNaviDecorator; |
|
66 iNaviDecorator = NULL; |
|
67 } |
|
68 } |
|
69 |
|
70 // ---------------------------------------------------- |
|
71 // CAboutAppUi::HandleCommandL( TInt aCommand ) |
|
72 // Takes care of command handling |
|
73 // ---------------------------------------------------- |
|
74 // |
|
75 void CAboutAppUi::HandleCommandL( TInt aCommand ) |
|
76 { |
|
77 switch ( aCommand ) |
|
78 { |
|
79 case EAknSoftkeyExit: |
|
80 case EAknSoftkeyBack: |
|
81 { |
|
82 Exit(); |
|
83 break; |
|
84 } |
|
85 case EEikCmdExit: |
|
86 { |
|
87 // Close Ctrl.panel after pressing call terminal key. |
|
88 if ( iSettingType ) |
|
89 { |
|
90 RWsSession& ws = iCoeEnv->WsSession(); |
|
91 TApaTaskList taskList( ws ); |
|
92 TUid appUid = { KSettingAppID }; |
|
93 TApaTask task = taskList.FindApp( appUid ); |
|
94 if ( task.Exists() ) |
|
95 { |
|
96 task.SendToBackground(); |
|
97 task.EndTask(); |
|
98 } |
|
99 } |
|
100 Exit(); |
|
101 break; |
|
102 } |
|
103 |
|
104 default: |
|
105 break; |
|
106 } |
|
107 } |
|
108 |
|
109 // ---------------------------------------------------- |
|
110 // CAboutAppUi::SetNaviPaneLabel() |
|
111 // Set the name of the product to navi pane. |
|
112 // ---------------------------------------------------- |
|
113 // |
|
114 void CAboutAppUi::SetNaviPaneLabelL() |
|
115 { |
|
116 TUid naviPaneUid; |
|
117 naviPaneUid.iUid = EEikStatusPaneUidNavi; |
|
118 CEikStatusPane* statusPane = StatusPane(); |
|
119 CEikStatusPaneBase::TPaneCapabilities subPane = statusPane->PaneCapabilities( naviPaneUid ); |
|
120 |
|
121 if ( subPane.IsPresent() && subPane.IsAppOwned() ) |
|
122 { |
|
123 CAknNavigationControlContainer* naviPane = dynamic_cast<CAknNavigationControlContainer*> |
|
124 ( statusPane->ControlL( naviPaneUid ) ); |
|
125 if ( naviPane ) |
|
126 { |
|
127 TBuf<KSysVersionInfoTextLength> name; |
|
128 SysVersionInfo::TProductVersion info; |
|
129 SysVersionInfo::GetVersionInfo( info ); |
|
130 name.Append( info.iModel ); |
|
131 |
|
132 if ( iNaviDecorator ) |
|
133 { |
|
134 delete iNaviDecorator; |
|
135 iNaviDecorator = NULL; |
|
136 } |
|
137 |
|
138 //set label for the pane |
|
139 iNaviDecorator = naviPane->CreateNavigationLabelL( name ); |
|
140 naviPane->PushL( *iNaviDecorator ); |
|
141 } |
|
142 } |
|
143 } |
|
144 // End of File |