|
1 /* |
|
2 * Copyright (c) 2006 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: Dialog for showing the Terms of Use for a chat server |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef CCNUITERMSOFUSEDLG_H |
|
21 #define CCNUITERMSOFUSEDLG_H |
|
22 |
|
23 #include <akndialog.h> |
|
24 #include <itemfinder.h> |
|
25 |
|
26 class CEikRichTextEditor; |
|
27 class CParaFormatLayer; |
|
28 class CCharFormatLayer; |
|
29 class CAknsBasicBackgroundControlContext; |
|
30 class CFindItemMenu; |
|
31 class CAknTitlePane; |
|
32 |
|
33 /** |
|
34 * Dialog for showing the Terms of use -text |
|
35 * |
|
36 * @lib IMPSConnectionUi.lib |
|
37 * @since S60 3.1u |
|
38 */ |
|
39 NONSHARABLE_CLASS( CCnUiTermsOfUseDlg ) : public CAknDialog, |
|
40 public MItemFinderObserver |
|
41 { |
|
42 public: |
|
43 |
|
44 /** |
|
45 * Executes the dialog and destroys it before returning |
|
46 * @since 3.1u |
|
47 * @return EAknSoftkeyOk if user accepted. |
|
48 * EAknSoftkeyCancel if user cancelled |
|
49 */ |
|
50 TInt RunDialogLD( TInt aResourceId ); |
|
51 |
|
52 static CCnUiTermsOfUseDlg* NewL( const TDesC& aToUFileName ); |
|
53 |
|
54 static CCnUiTermsOfUseDlg* NewLC( const TDesC& aToUFileName ); |
|
55 |
|
56 virtual ~CCnUiTermsOfUseDlg(); |
|
57 |
|
58 public: // from MObjectProvider |
|
59 |
|
60 TTypeUid::Ptr MopSupplyObject( TTypeUid aId ); |
|
61 |
|
62 protected: // from CEikDialog |
|
63 |
|
64 /** |
|
65 * @see CEikDialog |
|
66 */ |
|
67 void PreLayoutDynInitL(); |
|
68 |
|
69 /** |
|
70 * @see CEikDialog |
|
71 */ |
|
72 void PostLayoutDynInitL(); |
|
73 |
|
74 /** |
|
75 * @see CEikDialog |
|
76 */ |
|
77 TBool OkToExitL( TInt aButtonId ); |
|
78 |
|
79 /** |
|
80 * @see CEikDialog |
|
81 */ |
|
82 void SetSizeAndPosition( const TSize& aSize ); |
|
83 |
|
84 /** |
|
85 * @see CEikDialog |
|
86 */ |
|
87 void SizeChanged(); |
|
88 |
|
89 protected: //from base class CCoeControl |
|
90 |
|
91 /** |
|
92 * @see CCoeControl |
|
93 */ |
|
94 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
95 TEventCode aType ); |
|
96 |
|
97 void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); |
|
98 |
|
99 /** |
|
100 * @see CCoeControl |
|
101 */ |
|
102 void HandleResourceChange( TInt aType ); |
|
103 |
|
104 protected: // From MItemFinderObserver |
|
105 |
|
106 /** |
|
107 * @see MItemFinderObserver |
|
108 */ |
|
109 void HandleParsingComplete(); |
|
110 |
|
111 private: |
|
112 |
|
113 CCnUiTermsOfUseDlg(); |
|
114 |
|
115 void ConstructL( const TDesC& aToUFileName ); |
|
116 |
|
117 private: //from MEikCommandObserver |
|
118 |
|
119 /** |
|
120 * @see MEikCommandObserver |
|
121 */ |
|
122 void ProcessCommandL( TInt aCommand ); |
|
123 |
|
124 private: // new functions |
|
125 |
|
126 /** |
|
127 * Inserts line to rich text object |
|
128 * @since 3.1u |
|
129 * @param aTextResourceId Resource for text in line |
|
130 * @param aBold Should text be bolded |
|
131 */ |
|
132 void InsertLineL( TInt aTextResourceId, TBool aBold = EFalse ); |
|
133 |
|
134 /** |
|
135 * Inserts line to rich text object |
|
136 * @since 3.1u |
|
137 * @param aText Text for line |
|
138 * @param aBold Should text be bolded |
|
139 */ |
|
140 void InsertLineL( const TDesC& aText, TBool aBold = EFalse ); |
|
141 |
|
142 /** |
|
143 * Search the LAF specified font for invite dialog |
|
144 * @since 3.1u |
|
145 * @return LAF specified font |
|
146 */ |
|
147 const CFont* GetLayoutFont(); |
|
148 |
|
149 /** |
|
150 * Show confirmation query when user tries to cancel TOU dialog |
|
151 * @since 3.1u |
|
152 * @return Query return value |
|
153 */ |
|
154 TInt AskCancelConfirmationL(); |
|
155 |
|
156 /** |
|
157 * Show accept terms -list query |
|
158 * @since 3.1u |
|
159 * @return Query return value |
|
160 */ |
|
161 TInt AcceptTermsL(); |
|
162 |
|
163 /** |
|
164 * Gets the instance of the title pane |
|
165 * @return Title pane pointer |
|
166 * @since 3.1u |
|
167 */ |
|
168 CAknTitlePane* GetTitlePaneInstanceL() const; |
|
169 |
|
170 /** |
|
171 * Stores the old title pane text and sets a custom one |
|
172 * @since 3.1u |
|
173 */ |
|
174 void SetNewTitleTextL(); |
|
175 |
|
176 /** |
|
177 * Retores the old title pane text |
|
178 * @since 3.1u |
|
179 */ |
|
180 void RestoreTitlePaneTextL() const; |
|
181 |
|
182 /** |
|
183 * Updates CBA. |
|
184 * @since S60 v3.2 |
|
185 */ |
|
186 void UpdateCbaL(); |
|
187 |
|
188 /** |
|
189 * Helper method to update TOU message text color according to |
|
190 * current skin. |
|
191 * Note! This will not update text control |
|
192 * @since S60 v3.1u |
|
193 */ |
|
194 void UpdateTextColorL(); |
|
195 |
|
196 /** |
|
197 * Reads Terms of Use (ToU) message from file (iToUFileName). |
|
198 * Leaves the returned descriptor in CleanupStack. |
|
199 * @since S60 v3.1 |
|
200 * @return HBufC* Pointer to descriptor containing |
|
201 * the ToU message. |
|
202 */ |
|
203 HBufC* ReadToUMessageLC(); |
|
204 |
|
205 private: // data |
|
206 |
|
207 // own. |
|
208 CFindItemMenu* iFindItemMenu; |
|
209 |
|
210 // not own |
|
211 CEikRichTextEditor* iEditor; |
|
212 |
|
213 // own |
|
214 CItemFinder* iItemFinder; |
|
215 |
|
216 // Return value of this dialog |
|
217 TInt iReturnVal; |
|
218 |
|
219 // Not Own. Paragraph formatter |
|
220 CParaFormatLayer* iParaFormatLayer; |
|
221 |
|
222 // Not Own. Character formatter |
|
223 CCharFormatLayer* iCharFormatLayer; |
|
224 |
|
225 // Own. For controlling the background image |
|
226 CAknsBasicBackgroundControlContext* iBgContext; |
|
227 |
|
228 // Own. |
|
229 HBufC* iOldTitleText; |
|
230 |
|
231 TInt* iRetVal; // Not own, return value of the dialog, |
|
232 |
|
233 // Own. |
|
234 HBufC* iToUFileName; |
|
235 }; |
|
236 |
|
237 #endif // CCNUITERMSOFUSEDLG_H |