messagingfw/msgurlhandler/test/ui/inc/TestMsgUrlHandlerApp.H
changeset 62 db3f5fa34ec7
parent 0 8e480a14352b
equal deleted inserted replaced
60:9f5ae1728557 62:db3f5fa34ec7
       
     1 // Copyright (c) 2001-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 // This file contains the API definition for the classes 
       
    15 // CTestMsgUrlHandlerApplication, CTestMsgUrlHandlerAppView, 
       
    16 // CTestMsgUrlHandlerAppUi, CTestMsgUrlHandlerDocument.
       
    17 // 
       
    18 //
       
    19 
       
    20 /**
       
    21  @file
       
    22 */
       
    23 
       
    24 #ifndef __TESTMSGURLHANDLERAPP__H
       
    25 #define __TESTMSGURLHANDLERAPP__H
       
    26 
       
    27 #include <coeccntx.h>
       
    28 
       
    29 #include <eikenv.h> 
       
    30 #include <eikappui.h>
       
    31 #include <eikapp.h>
       
    32 #include <eikdoc.h>
       
    33 #include <techview/eikmenup.h> 
       
    34 
       
    35 #include <techview/eikon.hrh> 
       
    36 #include <msvstd.h>
       
    37 #include <msvapi.h>
       
    38 
       
    39 #include <testhandler.rsg>
       
    40 #include "TestMsgUrlHandler.hrh"
       
    41 
       
    42 
       
    43 /**
       
    44 	@class
       
    45 	Comments :	Defines the application's UID and manufactures a new, 
       
    46 				blank document.
       
    47 	@since 6.0
       
    48 */
       
    49 class CTestMsgUrlHandlerApplication : public CEikApplication
       
    50 	{
       
    51 private: 
       
    52 
       
    53 /**
       
    54 	@fn				CreateDocumentL()
       
    55 	Intended Usage	:	This function is inherited from class CApaApplication.
       
    56 						This function is called by the UI framework at
       
    57 						application start-up. It creates an instance of the
       
    58 						document class.
       
    59 	@since			6.0
       
    60 	@return			CApaDocument
       
    61  */
       
    62 	CApaDocument* CreateDocumentL();
       
    63 
       
    64 /**
       
    65 	@fn				AppDllUid() const
       
    66 	Intended Usage	:	The function is called by the UI framework to ask for the
       
    67 						application's UID.
       
    68 	@since			6.0
       
    69 	@return			TUid 
       
    70  */
       
    71 	TUid AppDllUid() const;
       
    72 	};
       
    73 
       
    74 
       
    75 /**
       
    76 	@class
       
    77 	Comments :	This class displays the application data on screen and allows 
       
    78 				user interaction.
       
    79 	@since 6.0
       
    80 */
       
    81 class CTestMsgUrlHandlerAppView : public CCoeControl
       
    82     {
       
    83 public:
       
    84 
       
    85 /**
       
    86 	@fn				NewL(const TRect& aRect)
       
    87 	Intended Usage	:	Static factory constructor. Uses two phase construction and 
       
    88 						leaves nothing on the CleanupStack.
       
    89 	@since			6.0
       
    90 	@return			A pointer to the newly created CTestMsgUrlHandlerAppView object. 
       
    91 	@pre 			None
       
    92 	@post			A fully constructed and initialised CTestMsgUrlHandlerAppView object.
       
    93  */
       
    94 	static CTestMsgUrlHandlerAppView* NewL(const TRect& aRect);
       
    95 
       
    96 private:
       
    97 
       
    98 /**
       
    99 	@fn				CTestMsgUrlHandlerAppView()
       
   100 	Intended Usage	:	Constructor. First phase of two-phase construction method. Does 
       
   101 						non-allocating construction.
       
   102 	@since			6.0
       
   103  */
       
   104 	CTestMsgUrlHandlerAppView();
       
   105 
       
   106 /**
       
   107 	@fn				~CTestMsgUrlHandlerAppView()
       
   108 	Intended Usage	:	Destructor.
       
   109 	@since			6.0
       
   110  */
       
   111 	~CTestMsgUrlHandlerAppView();
       
   112 
       
   113 /**
       
   114 	@fn				ConstructL(const TRect& aRect)
       
   115 	Intended Usage	:	Second phase of two-phase construction method. Does any 
       
   116 						allocations required to fully construct the object.
       
   117 	@since			6.0
       
   118 	@pre 			First phase of construction is complete
       
   119 	@post			The object is fully constructed and initialised.
       
   120  */
       
   121     void ConstructL(const TRect& aRect);
       
   122 
       
   123 /**
       
   124 	@fn				Draw(const TRect&) const
       
   125 	Intended Usage	:	This function is inherited from CCoeControl.
       
   126 						Draws the view - consists of a simple outline rectangle
       
   127 						with text in the middle using the Normal font 
       
   128 						supplied by the UI.
       
   129 	@since			6.0
       
   130 	@param			aRect 
       
   131 	@return			CTestMsgUrlHandlerAppView
       
   132 	@pre 			None
       
   133 	@post			The view is drawn
       
   134  */
       
   135 	void Draw(const TRect& /*aRect*/) const;
       
   136 
       
   137 private:
       
   138 	HBufC*  iText;
       
   139     };
       
   140 
       
   141 
       
   142 /**
       
   143 	@class
       
   144 	Comments :	This class handles command generated by the menu items, toolbar
       
   145 				buttons and shortcut keys. It delegates drawing and screen based
       
   146 				interaction to the app view and other controls.
       
   147 	@since 6.0
       
   148 */
       
   149 class CTestMsgUrlHandlerAppUi : public CEikAppUi
       
   150     {
       
   151 
       
   152 public:
       
   153 
       
   154 /**
       
   155 	@fn				CTestMsgUrlHandlerAppUi()
       
   156 	Intended Usage	:	Constructor. First phase of two-phase construction method. Does 
       
   157 						non-allocating construction.
       
   158 	@since			6.0
       
   159  */
       
   160 	CTestMsgUrlHandlerAppUi();
       
   161 
       
   162 private:
       
   163 
       
   164 /**
       
   165 	@fn				ConstructL()
       
   166 	Intended Usage	:	Second phase of two-phase construction method. Does any 
       
   167 						allocations required to fully construct the object.
       
   168 
       
   169 						This function is called by Eikon hence no NewL().
       
   170 
       
   171 						Starts the Idle time active object which calls the callback
       
   172 						function. This starts the background task.
       
   173 						This background task is encapsulated in the callback function. 
       
   174 	@since			6.0
       
   175 	@pre 			First phase of construction is complete
       
   176 	@post			The object is fully constructed and initialised.
       
   177 					The background task has started.
       
   178  */
       
   179     void ConstructL();
       
   180 
       
   181 /**
       
   182 	@fn				~CTestMsgUrlHandlerAppUi()
       
   183 	Intended Usage	:	Destructor.
       
   184 	@since			6.0
       
   185  */
       
   186 	~CTestMsgUrlHandlerAppUi();
       
   187 
       
   188 /**
       
   189 	@fn				HandleCommandL(TInt aCommand)
       
   190 	Intended Usage	:	Closes the application from the menu item and the shortcut
       
   191 						key Ctrl-e.
       
   192 	@since			6.0
       
   193 	@param			aCommand 
       
   194 	@return			void 
       
   195 	@pre 			None
       
   196 	@post			Application is closed if the menu item or the shortcut key is used. 
       
   197  */
       
   198 	void HandleCommandL(TInt aCommand);	
       
   199 
       
   200 /**
       
   201 	@fn				LaunchMailEditorL(const TDesC& aUrl)
       
   202 	Intended Usage	:	Parses the url (i.e the command line) and 
       
   203 						launches the correct mail editor.
       
   204 	Error Condition	:	This function leaves with KErrNotFound if the messaging
       
   205 						scheme is not found.
       
   206 	@since			6.0
       
   207 	@param			aUrl		An url descriptor
       
   208 	@return			void 
       
   209 	@pre 			None
       
   210 	@post			Parses the url and launches the correct mail editor.
       
   211  */
       
   212 	void LaunchMailEditorL(const TDesC& aUrl);
       
   213 
       
   214 private:
       
   215 	CCoeControl* iAppView;
       
   216 	};
       
   217 
       
   218 
       
   219 /**
       
   220 	@class
       
   221 	Comments :	Launches the App UI
       
   222 	@since 6.0
       
   223 */
       
   224 class CTestMsgUrlHandlerDocument : public CEikDocument
       
   225 	{
       
   226 public:
       
   227 
       
   228 /**
       
   229 	@fn				NewL(CEikApplication& aApp)
       
   230 	Intended Usage	:	Static factory constructor. Uses two phase construction and 
       
   231 						leaves nothing on the CleanupStack.
       
   232 	@since			6.0
       
   233 	@return			A pointer to the newly created CTestMsgUrlHandlerDocument object. 
       
   234 	@pre 			None
       
   235 	@post			A fully constructed and initialised CTestMsgUrlHandlerDocument object.
       
   236  */
       
   237 	static CTestMsgUrlHandlerDocument* NewL(CEikApplication& aApp);
       
   238 
       
   239 private:
       
   240 
       
   241 /**
       
   242 	@fn				CTestMsgUrlHandlerDocument(CEikApplication& aApp)
       
   243 	Intended Usage	:	Constructor. First phase of two-phase construction method. Does 
       
   244 						non-allocating construction.
       
   245 	@since			6.0
       
   246  */
       
   247 	CTestMsgUrlHandlerDocument(CEikApplication& aApp);
       
   248 
       
   249 /**
       
   250 	@fn				ConstructL()
       
   251 	Intended Usage	:	Second phase of two-phase construction method. Does any 
       
   252 						allocations required to fully construct the object.
       
   253 	@since			6.0
       
   254 	@pre 			First phase of construction is complete
       
   255 	@post			The object is fully constructed and initialised.
       
   256  */
       
   257 	void ConstructL();
       
   258 
       
   259 /**
       
   260 	@fn				CEikAppUi* CreateAppUiL()
       
   261 	Intended Usage	:	This function is inherited from CEikDocument.
       
   262 						Launches the App UI.
       
   263 	@since			6.0
       
   264 	@return			CEikAppUi* 
       
   265 	@pre 			App is created
       
   266 	@post			App UI is launched.
       
   267  */
       
   268 	CEikAppUi* CreateAppUiL();
       
   269 
       
   270 	void CreateSMSServiceL();
       
   271 	void CreateEmailServiceL();
       
   272 	void ServiceIdL(TUid aMtm, TMsvId& rFirstId);
       
   273 	};
       
   274 
       
   275 class CDummyObserver : public CBase, public MMsvSessionObserver
       
   276 	{
       
   277 public:
       
   278 	void HandleSessionEventL(TMsvSessionEvent, TAny*, TAny*, TAny*) {};
       
   279 	};
       
   280 
       
   281 
       
   282 #endif