1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // nslookup.h - nslookup client main module |
|
15 // |
|
16 |
|
17 |
|
18 |
|
19 /** |
|
20 @internalComponent |
|
21 */ |
|
22 #ifndef __NSLOOKUP_H |
|
23 #define __NSLOOKUP_H |
|
24 |
|
25 #include <coecntrl.h> |
|
26 #include <coeccntx.h> |
|
27 #include <techview/eiklabel.h> |
|
28 #include <txtrich.h> |
|
29 #include <eikrted.h> |
|
30 #include <eikappui.h> |
|
31 #include <eikapp.h> |
|
32 #include <techview/eikdialg.h> |
|
33 #include <eikdoc.h> |
|
34 #include <eikconso.h> |
|
35 #ifdef CALYPSO |
|
36 #include <AknQueryDialog.h> |
|
37 #include <AknSettingItemList.h> |
|
38 #include <AknAppUi.h> |
|
39 #endif |
|
40 |
|
41 |
|
42 // UID of app |
|
43 |
|
44 |
|
45 const TUid KUidNslookupApp = { 0x10000892 } ; |
|
46 const TUid KUidNslookupVersionUid = { 0x10000892 } ; |
|
47 |
|
48 #ifdef CALYPSO |
|
49 |
|
50 class CNslookupBinaryPopupSettingItem : public CAknBinaryPopupSettingItem |
|
51 { |
|
52 public: |
|
53 CNslookupBinaryPopupSettingItem( TInt aIdentifier, TBool& aBinaryValue ); |
|
54 |
|
55 virtual void LoadL(); |
|
56 }; |
|
57 |
|
58 class CNslookupTextSettingItem : public CAknSettingItem |
|
59 { |
|
60 public: |
|
61 CNslookupTextSettingItem( TInt aIdentifier, TDes& aText ); |
|
62 CNslookupTextSettingItem::~CNslookupTextSettingItem(); |
|
63 virtual void StoreL(); |
|
64 virtual void LoadL(); // Called from 2nd stage constructors |
|
65 virtual const TDesC& SettingTextL(); |
|
66 virtual void EditItemL( TBool aCalledFromMenu ); |
|
67 |
|
68 protected: |
|
69 TPtr& InternalTextPtr(); |
|
70 TPtrC ExternalText(); |
|
71 void SetExternalText( TDesC& aNewExternalText ); |
|
72 |
|
73 private: |
|
74 TDes& iExternalText; |
|
75 HBufC* iInternalText; |
|
76 TPtr iInternalTextPtr; |
|
77 }; |
|
78 |
|
79 class CSettingView : public CAknSettingItemList, public MEikCommandObserver |
|
80 { |
|
81 public: |
|
82 CSettingView(CNslookup *aModel); |
|
83 ~CSettingView(); |
|
84 void ConstructL(const TRect& aRect); |
|
85 void ProcessCommandL(TInt aCommand); |
|
86 CAknSettingItem* CreateSettingItemL( TInt identifier ); |
|
87 TBool SaveSettingsL(); |
|
88 |
|
89 private: |
|
90 TBool iLimitPacketCount; // Indicates if unlimited packet number |
|
91 TBuf<5> iMaxPacketCount; // Number of ICMP Echo Request packets to send |
|
92 TBuf<5> iPacketDataSize; // Default data size (not including ICMP header) |
|
93 TBuf<5> iWaitTime; // Time between sent packets (default 1 second) |
|
94 TBuf<5> iLastWaitTime; // Time to wait for the last packet (default 2 seconds) |
|
95 TBuf<MAX_PATTERN_LENGTH> iPattern; // Pattern to fill the packet (default 0xFF) |
|
96 TBool iQuiet; // No packet info, just statistics |
|
97 TBool iVerbose; // Verbose Output. All ICMP packets, not only Echo reply |
|
98 TBool iDebug; // Set the SO_DEBUG flag in the socket |
|
99 |
|
100 CNslookup *iModel; |
|
101 }; |
|
102 |
|
103 #endif // #ifdef CALYPSO |
|
104 |
|
105 // |
|
106 // CSimpleConsole |
|
107 // |
|
108 /* |
|
109 enum TMessageControlFontStyle |
|
110 { |
|
111 EStyleElementBold=EMenuCommandBold, |
|
112 EStyleElementItalic=EMenuCommandItalic, |
|
113 EStyleElementInverse=EMenuCommandInverse, |
|
114 EStyleElementUnderline=EMenuCommandUnderline, |
|
115 EStyleElementColor=EMenuCommandColor |
|
116 }; |
|
117 */ |
|
118 class CConsoleControl : public CCoeControl |
|
119 { |
|
120 public: |
|
121 CConsoleControl() {} |
|
122 ~CConsoleControl(); |
|
123 //void ConstructL(TInt aFlags); |
|
124 //void ConstructL(TPoint aLeftTop,const TSize& aSize,TInt aFlags,CCoeControl *aParent); |
|
125 void ConstructL(const TPoint& aTopLeft,const TSize& aSize,TInt aFlags); |
|
126 //TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
127 //void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
128 //void DynInitMenuPaneL(TInt aMenuId,CEikMenuPane* aMenuPane); |
|
129 void HandleCommandL(TInt aCommand); |
|
130 void ActivateL(); |
|
131 void SetScrollBarVisibilityL(CEikScrollBarFrame::TScrollBarVisibility aHBarVisibility, CEikScrollBarFrame::TScrollBarVisibility aVBarVisibility); |
|
132 void DrawCursor(); |
|
133 void Write(const TDesC &aDes); |
|
134 CEikConsoleControl *ConsoleControl() const; |
|
135 TBool UpdateScrollBars(); |
|
136 void ClearScreen(); |
|
137 void Redraw(const TRect &aRect); |
|
138 void Lf(); |
|
139 TSize ScreenSize() const; |
|
140 protected: |
|
141 void FocusChanged(TDrawNow aDrawNow); |
|
142 private: |
|
143 //void ToggleFontStyleAndRedrawL(TMessageControlFontStyle aStyleElement); |
|
144 |
|
145 private: |
|
146 CEikConsoleScreen* iConsole; |
|
147 TInt iHistory; |
|
148 //TInt iAllPrintable,iScrollLock,iIgnoreCursor,iHideCursor; |
|
149 //TDesC* iSelBufPtr; |
|
150 //TInt iSmallScreen; |
|
151 //TInt iHighCursor; |
|
152 }; |
|
153 |
|
154 |
|
155 class CNslookupContainer: public CCoeControl, public MCoeControlObserver |
|
156 { |
|
157 public: |
|
158 // Construction |
|
159 CNslookupContainer(CNslookup* aModel); |
|
160 void ConstructL(const TRect& aRect); |
|
161 |
|
162 // Destruction |
|
163 ~CNslookupContainer(); |
|
164 //void ConstructFromResourceL(TResourceReader& aReader); |
|
165 //void CSmileyContainer::PrepareForFocusLossL(); |
|
166 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
167 void WriteHostL(const TDesC& aHostname); |
|
168 void WriteLine(const TDesC& abuf); |
|
169 void ResetScreen(); |
|
170 |
|
171 //protected: |
|
172 //void FocusChanged(TDrawNow aDrawNow); |
|
173 private: |
|
174 // Virtual, defined by CCoeControl; replaces the default implementation |
|
175 // provided by CCoeControl. |
|
176 void Draw(const TRect& aRect) const; |
|
177 |
|
178 // Virtual, defined by CCoeControl; replaces the default implementation |
|
179 // provided by CCoeControl. |
|
180 TInt CountComponentControls() const; |
|
181 |
|
182 // Virtual, defined by CCoeControl; replaces the default implementation |
|
183 // provided by CCoeControl. |
|
184 CCoeControl* ComponentControl(TInt aIndex) const; |
|
185 |
|
186 // Defined as pure virtual by the mixin class MCoeControlObserver |
|
187 // inherited by CCoeControl. An empty implementation provided by |
|
188 // this class (its containees do not report events). |
|
189 void HandleControlEventL(CCoeControl* aControl, |
|
190 TCoeEvent aEventType); |
|
191 |
|
192 void CreateConsoleL(const TRect& aRect); |
|
193 private: |
|
194 // Member functions defined and used by this class |
|
195 private: |
|
196 // Data members defined and used by this class. |
|
197 CNslookup *iModel; |
|
198 CEikLabel* iLabel; // label for status messages |
|
199 CEikLabel* iLabel2; // label for status messages |
|
200 |
|
201 CConsoleControl* iConsole; |
|
202 }; |
|
203 |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 // |
|
210 // class CNslookupView |
|
211 // |
|
212 |
|
213 class CNslookupView : public CCoeControl, public MCoeControlBrushContext |
|
214 { |
|
215 public: |
|
216 CNslookupView(CNslookup *aModel); |
|
217 void ConstructL(const TRect& aRect); |
|
218 ~CNslookupView(); |
|
219 // changing view |
|
220 void ConstructViewL(); |
|
221 void ResetScreen(); |
|
222 // various types of update |
|
223 |
|
224 |
|
225 private: // from CCoeControl |
|
226 void Draw(const TRect& /*aRect*/) const; |
|
227 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
228 TInt CountComponentControls() const; |
|
229 CCoeControl* ComponentControl(TInt aIndex) const; |
|
230 private: // new function |
|
231 void CreateLabelL(); |
|
232 private: // data |
|
233 CNslookup *iModel; |
|
234 CNslookupContainer* iContainer; |
|
235 }; |
|
236 |
|
237 #ifdef CALYPSO |
|
238 class CHostNameDialog : public CAknTextQueryDialog |
|
239 #else |
|
240 class CHostNameDialog : public CEikDialog |
|
241 #endif |
|
242 { |
|
243 public: |
|
244 #ifdef CALYPSO |
|
245 CHostNameDialog(TDes& aHostname); |
|
246 #else |
|
247 CHostNameDialog(CNslookup *aModel); |
|
248 #endif |
|
249 |
|
250 private: |
|
251 TBool OkToExitL(TInt aButton); |
|
252 void PreLayoutDynInitL(); |
|
253 private: |
|
254 TBool iOKPressed; |
|
255 CNslookup *iModel; |
|
256 }; |
|
257 |
|
258 // |
|
259 // CNslookupAppUi |
|
260 // |
|
261 |
|
262 #ifdef CALYPSO |
|
263 class CNslookupAppUi : public CAknAppUi |
|
264 #else |
|
265 class CNslookupAppUi : public CEikAppUi |
|
266 #endif |
|
267 { |
|
268 public: |
|
269 void ConstructL(); |
|
270 ~CNslookupAppUi(); |
|
271 |
|
272 #ifdef CALYPSO |
|
273 |
|
274 private: |
|
275 TBool iAppViewOnStack; |
|
276 TBool iSettingViewOnStack; |
|
277 void AppViewToStackL(); |
|
278 void AppViewFromStack(); |
|
279 void SettingViewToStackL(); |
|
280 void SettingViewFromStack(); |
|
281 void ShowAppViewL(); |
|
282 void ShowSettingViewL(); |
|
283 CSettingView* iSettingView; |
|
284 |
|
285 #endif // #ifdef CALYPSO |
|
286 |
|
287 private: // from CEikAppUi |
|
288 static TInt Launcher(TAny* x); |
|
289 void InitModelL(); |
|
290 void HandleCommandL(TInt aCommand); |
|
291 void CreateOptionsDialog(); |
|
292 TBool CreateHostNameDialogL(); |
|
293 void CreateAboutDialogL() const; |
|
294 void RestorePreferencesL(TPreferences& aPreferences) const; |
|
295 void StorePreferencesL(const TPreferences &aPreferences) const; |
|
296 //void UnDimStop(); |
|
297 //void DimStop(); |
|
298 |
|
299 private: |
|
300 CNslookupView* iAppView; |
|
301 CNslookup *iModel; //contains all related Data |
|
302 //TBossPuzzle* iModel; |
|
303 }; |
|
304 |
|
305 // |
|
306 // CExampleShellDocument |
|
307 // |
|
308 |
|
309 class CNslookupDocument : public CEikDocument |
|
310 { |
|
311 public: |
|
312 CNslookupDocument(CEikApplication& aApp); |
|
313 //CNslookupDocument(CEikApplication& aApp): CEikDocument(aApp) { } |
|
314 //TBossPuzzle* Model() { return(&iModel); } |
|
315 private: // from CEikDocument |
|
316 CEikAppUi* CreateAppUiL(); |
|
317 private: |
|
318 //TBossPuzzle iModel; |
|
319 }; |
|
320 |
|
321 // |
|
322 // CNslookupApplication |
|
323 // |
|
324 |
|
325 class CNslookupApplication : public CEikApplication |
|
326 { |
|
327 private: // from CApaApplication |
|
328 CApaDocument* CreateDocumentL(); |
|
329 TUid AppDllUid() const; |
|
330 }; |
|
331 |
|
332 #endif |
|