|
1 /* |
|
2 * Copyright (c) 2004 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: It provides functionality to exit the foreground application. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CPHONEAPPLICATIONEXIT_H |
|
21 #define CPHONEAPPLICATIONEXIT_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class CPhoneViewController; |
|
28 class RWsSession; |
|
29 |
|
30 // CLASS DECLARATION |
|
31 |
|
32 /** |
|
33 * It provides functionality to exit the foreground application. |
|
34 * |
|
35 * @since Series 60 2.6 |
|
36 */ |
|
37 class CPhoneApplicationExit |
|
38 : public CBase |
|
39 { |
|
40 public: // Constructors and destructor |
|
41 |
|
42 /** |
|
43 * Two-phased constructor. |
|
44 * @param aViewController Phone UI View controller |
|
45 * @param aWsSession window server session. |
|
46 * @param aUikonWgId UIKON server window group id. |
|
47 * @return new CPhoneApplicationExit instance. |
|
48 */ |
|
49 static CPhoneApplicationExit* NewL( |
|
50 CPhoneViewController* aViewController, |
|
51 RWsSession& aWsSession, |
|
52 const TInt aUikonWgId ); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 virtual ~CPhoneApplicationExit(); |
|
58 |
|
59 public: // New functions |
|
60 |
|
61 /** |
|
62 * Exits the active application. |
|
63 * @return error code. |
|
64 */ |
|
65 TInt ExitApplication(); |
|
66 |
|
67 private: |
|
68 |
|
69 // Inner class. |
|
70 class CElement; |
|
71 |
|
72 // Basic cases. |
|
73 class CElementBasic; |
|
74 |
|
75 // UID range element. |
|
76 class CElementUid; |
|
77 |
|
78 // Drive element. |
|
79 class CElementDrive; |
|
80 |
|
81 /** |
|
82 * C++ constructor. |
|
83 * @param aViewController Phone UI View controller |
|
84 * @param aWsSession window server session. |
|
85 * @param aUikonWgId UIKON server window group id. |
|
86 */ |
|
87 CPhoneApplicationExit( |
|
88 CPhoneViewController* aViewController, |
|
89 RWsSession& aWsSession, |
|
90 const TInt aUikonWgId ); |
|
91 |
|
92 /** |
|
93 * Exits the application. |
|
94 */ |
|
95 void ExitApplicationL(); |
|
96 |
|
97 /** |
|
98 * Checks if application should be closed using product |
|
99 * specific variation variables. |
|
100 * @param aUid application UID. |
|
101 * @return ETrue if application should be closed. |
|
102 */ |
|
103 TBool CheckApplicationClosingL( const TUid& aUid ); |
|
104 |
|
105 /** |
|
106 * Checks if included to "close" list. |
|
107 * @param aUid application UID. |
|
108 * @return ETrue if included. |
|
109 */ |
|
110 TBool IsIncludedToCloseListL( const TUid& aUid ) const; |
|
111 |
|
112 /** |
|
113 * Checks if included to "don't close" list. |
|
114 * @param aUid application UID. |
|
115 * @return ETrue if included. |
|
116 */ |
|
117 TBool IsIncludedToDontCloseListL( const TUid& aUid ) const; |
|
118 |
|
119 /** |
|
120 * Checks if application UID is included to the list. |
|
121 * @param aSource list to be checked. |
|
122 * @param aUid application UID. |
|
123 * @return ETrue if application UID is included to the list. |
|
124 */ |
|
125 TBool CheckListL( |
|
126 const RPointerArray< CElement >& aSource, |
|
127 const TUid& aUid ) const; |
|
128 |
|
129 /** |
|
130 * Reads lists from variation variables. |
|
131 */ |
|
132 void ReadListsL(); |
|
133 |
|
134 /** |
|
135 * Builds list from text description. |
|
136 * @param aTarget it will contain list of elements. |
|
137 * @param aSource source description. |
|
138 * @param aOomAllowed ETrue if OOM is allowed in the description. |
|
139 */ |
|
140 void BuildListL( |
|
141 RPointerArray< CElement >& aTarget, |
|
142 const TDesC& aSource, |
|
143 TBool aOomAllowed ); |
|
144 |
|
145 /** |
|
146 * Parses string from lexer. |
|
147 * @param aLexer lexer. |
|
148 * @param aString string to be checked. |
|
149 * @return ETrue if string was next element. |
|
150 */ |
|
151 TBool ParseString( |
|
152 TLex& aLexer, |
|
153 const TDesC& aString ); |
|
154 |
|
155 /** |
|
156 * Parses UID from lexer. |
|
157 * @param aLexer lexer. |
|
158 * @param aUidStart it will contain UID. |
|
159 * @param aUidEnd it will contain UID. |
|
160 * @return ETrue if UID or UID range was next element. |
|
161 */ |
|
162 TBool ParseUid( |
|
163 TLex& aLexer, |
|
164 TUid& aUidStart, |
|
165 TUid& aUidEnd ); |
|
166 |
|
167 /** |
|
168 * Parses driver identifier from lexerl. |
|
169 * @param aLexer lexer. |
|
170 * @param aChar it will contain drive character. |
|
171 * @return ETrue if drive identifier was next element. |
|
172 */ |
|
173 TBool ParseDrive( |
|
174 TLex& aLexer, |
|
175 TChar& aChar ); |
|
176 |
|
177 /** |
|
178 * Checks that the element ends appropriately - |
|
179 * next character must be space or then input has ended. |
|
180 * @param aLexer lexer. |
|
181 * @return ETrue if element ends appropriately. |
|
182 */ |
|
183 inline TBool CheckEnd( TLex& aLexer ); |
|
184 |
|
185 /** |
|
186 * Checks if application closing is enabled. |
|
187 * @return ETrue if application closing is enabled. |
|
188 */ |
|
189 TBool IsApplicationClosingEnabled() const; |
|
190 |
|
191 private: // Data |
|
192 |
|
193 // Reference to Phone UI View Controller. |
|
194 CPhoneViewController* iViewController; |
|
195 |
|
196 // Reference to window server session. |
|
197 RWsSession& iWsSession; |
|
198 |
|
199 // UIKON server window group id. |
|
200 const TInt iUikonWgId; |
|
201 |
|
202 // ETrue if product specific variables have been read. |
|
203 TBool iListsRead; |
|
204 |
|
205 // Owned product specific "close" list. |
|
206 RPointerArray<CElement> iCloseList; |
|
207 |
|
208 // Owned product specific "don't close" list. |
|
209 RPointerArray<CElement> iDontCloseList; |
|
210 |
|
211 }; |
|
212 |
|
213 #endif // CPHONEAPPLICATIONEXIT_H |
|
214 |
|
215 // End of File |