messagingfw/msgurlhandler/urlhandler/inc/MsgUrlHandlerApp.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 // CMsgUrlHandlerApplication, CMsgUrlHandlerAppView, 
       
    16 // CMsgUrlHandlerAppUi, CMsgUrlHandlerDocument.
       
    17 // 
       
    18 //
       
    19 
       
    20 /**
       
    21  @file
       
    22 */
       
    23 
       
    24 #ifndef __MSGURLHANDLERAPP_H__
       
    25 #define __MSGURLHANDLERAPP_H__
       
    26 
       
    27 #include <coeccntx.h>
       
    28 
       
    29 #include <eikappui.h>
       
    30 #include <eikapp.h>
       
    31 #include <eikdoc.h>
       
    32 
       
    33 #include <uikon.hrh> 
       
    34 
       
    35 #include <msgurlhandler.rsg>
       
    36 
       
    37 
       
    38 /**
       
    39 	@class
       
    40 	Dependencies : CEikApplication
       
    41 	Comments :	Defines the application's UID and manufactures a new, 
       
    42 				blank document.
       
    43 	@since 7.0
       
    44 */
       
    45 class CMsgUrlHandlerApplication : public CEikApplication
       
    46 /**
       
    47 @internalComponent
       
    48 @released
       
    49 */
       
    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			7.0
       
    60 	@leave		KErrNoMemory.
       
    61 	@return			Returns the document class
       
    62  */
       
    63 	CApaDocument* CreateDocumentL();
       
    64 
       
    65 /**
       
    66 	@fn				AppDllUid() const
       
    67 	Intended Usage	:	The function is called by the UI framework to ask for the
       
    68 						application's UID.
       
    69 	@since			7.0
       
    70 	@return			Returns the apps uid.
       
    71  */
       
    72 	TUid AppDllUid() const;
       
    73 	};
       
    74 
       
    75 /**
       
    76 	@class
       
    77 	Dependencies : CEikAppUi
       
    78 	Comments :	This class handles command generated by the menu items, toolbar
       
    79 				buttons and shortcut keys. It delegates drawing and screen based
       
    80 				interaction to the app view and other controls.
       
    81 	@since 7.0
       
    82 */
       
    83 class CMsgUrlHandlerAppUi : public CEikAppUi
       
    84 /**
       
    85 @internalComponent
       
    86 @released
       
    87 */
       
    88     {
       
    89 
       
    90 public:
       
    91 
       
    92 /**
       
    93 	@fn				CMsgUrlHandlerAppUi()
       
    94 	Intended Usage	:	Constructor. First phase of two-phase construction method. Does 
       
    95 						non-allocating construction.
       
    96 	@since			7.0
       
    97  */
       
    98 	CMsgUrlHandlerAppUi();
       
    99 
       
   100 /**
       
   101 	@fn				~CMsgUrlHandlerAppUi()
       
   102 	Intended Usage	:	Destructor.
       
   103 	@since			7.0
       
   104  */
       
   105 	~CMsgUrlHandlerAppUi();
       
   106 
       
   107 private:
       
   108 
       
   109 /**
       
   110 	@fn				ConstructL()
       
   111 	Intended Usage	:	Second phase of two-phase construction method. Does any 
       
   112 						allocations required to fully construct the object.
       
   113 
       
   114 						This function is called by Eikon hence no NewL().
       
   115 
       
   116 						Starts the Idle time active object which calls the callback
       
   117 						function. This starts the background task.
       
   118 						This background task is encapsulated in the callback function. 
       
   119 	@since			7.0
       
   120 	@pre 			First phase of construction is complete
       
   121 	@post			The object is fully constructed and initialised.
       
   122 					The background task has started.
       
   123  */
       
   124     void ConstructL();
       
   125 
       
   126 /**
       
   127 	@fn				ProcessCommandParametersL(TApaCommand aCommand,TFileName& aDocumentName,const TDesC8& aTail)
       
   128 	Intended Usage	:	This function is inherirted from class CEikAppUi.
       
   129 						Reads and assigns the commandline (i.e the url) from apparc.  
       
   130 	@since			7.0
       
   131 	@param			aCommand			The shell command sent to the application. 
       
   132 	@param			aDocumentName		At call time, the name of the document as specified
       
   133 										on the command line. On return, the name for the 
       
   134 										file which will be created by the calling framework. 
       
   135 	@param			aTail				Command line tail.  
       
   136 	@return			Whether the final value of aDocumentName represents an existing file.
       
   137 					For this form of the function this is ETrue if the Uikon application 
       
   138 					framework needs to open an existing file called aDocumentName. 
       
   139 					Otherwise, this will be EFalse if the Uikon application framework 
       
   140 					needs to create the file.
       
   141 	@pre 			None
       
   142 	@post			The commandline is assigned.
       
   143  */
       
   144 	TBool ProcessCommandParametersL(TApaCommand aCommand,TFileName& aDocumentName,const TDesC8& aTail);
       
   145 
       
   146 /**
       
   147 	@fn				HandleCommandL(TInt aCommand)
       
   148 	Intended Usage	:	Closes the application from the menu item and the shortcut
       
   149 						key Ctrl-e.
       
   150 	@since			7.0
       
   151 	@param			aCommand		A command ID. 
       
   152 	@pre 			None
       
   153 	@post			Application is closed if the menu item or the shortcut key is used. 
       
   154  */
       
   155 	void HandleCommandL(TInt aCommand);	
       
   156 
       
   157 /**
       
   158 	@fn				static TInt IdleConstructCallbackL(TAny* aThis)
       
   159 	Intended Usage	:	This is an idle constructor for the callback function.
       
   160 						It calls the idle constructor.
       
   161 	@since			7.0
       
   162 	@param			aThis		Not used 
       
   163 	@return			If returned true than the active object is scheduled to run again 
       
   164 					later. If returned false than the active object is no longer scheduled 
       
   165 					to run. 
       
   166 	@pre 			The idle active object has started.
       
   167 	@post			Runs the background task.
       
   168  */
       
   169 	static TInt IdleConstructCallbackL(TAny* aThis);
       
   170 
       
   171 /**
       
   172 	@fn				IdleConstructL()
       
   173 	Intended Usage	:	Idle constructor. Calls the LoadStartPageL function.
       
   174 	@since			7.0
       
   175 	@pre 			The idle active object has started.
       
   176 	@post			Runs the background task.
       
   177  */
       
   178 	void IdleConstructL();
       
   179 
       
   180 /**
       
   181 	@fn				LoadStartPageL()
       
   182 	Intended Usage	:	If the command line exists than it calls the 
       
   183 						LaunchMailEditor function. 
       
   184 	@return			void 
       
   185 	@pre 			The idle active object is running.
       
   186 	@post			calls the LaunchMailEditor function if the command line exists. 
       
   187  */
       
   188 	void LoadStartPageL();
       
   189 
       
   190 /**
       
   191 	@fn				LaunchMailEditorL(const TDesC& aUrl)
       
   192 	Intended Usage	:	Parses the url (i.e the command line) and 
       
   193 						launches the correct mail editor.
       
   194 	Error Condition	:	This function leaves with KErrNotFound if the messaging
       
   195 						scheme is not found.
       
   196 	@since			7.0
       
   197 	@leave		KErrNotSupported
       
   198 	@param			aUrl		A url descriptor
       
   199 	@pre 			None
       
   200 	@post			Parses the url and launches the correct mail editor.
       
   201  */
       
   202 	void LaunchMailEditorL(const TDesC& aUrl);
       
   203 
       
   204 private:
       
   205 	/** The descriptor buffer that contains the commandline from apparc
       
   206 		i.e the messaging url.
       
   207 	*/
       
   208 	HBufC* iCommandLineFileName;
       
   209 
       
   210 	/** The Idle active object */
       
   211 	CIdle* iIdleConstructor;
       
   212 	};
       
   213 
       
   214 
       
   215 /**
       
   216 	@class
       
   217 	Dependencies : CEikDocument
       
   218 	Comments :	Launches the App UI
       
   219 	@since 7.0
       
   220 */
       
   221 class CMsgUrlHandlerDocument : public CEikDocument
       
   222 /**
       
   223 @internalComponent
       
   224 @released
       
   225 */
       
   226 	{
       
   227 public:
       
   228 
       
   229 /**
       
   230 	@fn				NewL(CEikApplication& aApp)
       
   231 	Intended Usage	:	Static factory constructor. Uses two phase construction and 
       
   232 						leaves nothing on the CleanupStack.
       
   233 	@since			7.0
       
   234 	@leave		KErrNoMemory.
       
   235 	@param			aApp		The CEikApplication app
       
   236 	@return			A pointer to the newly created CMsgUrlHandlerDocument object. 
       
   237 	@pre 			None
       
   238 	@post			A fully constructed and initialised CMsgUrlHandlerDocument object.
       
   239  */
       
   240 	static CMsgUrlHandlerDocument* NewL(CEikApplication& aApp);
       
   241 
       
   242 private:
       
   243 
       
   244 /**
       
   245 	@fn				CMsgUrlHandlerDocument(CEikApplication& aApp)
       
   246 	Intended Usage	:	Constructor. First phase of two-phase construction method. Does 
       
   247 						non-allocating construction.
       
   248 	@param			aApp		The CEikApplication app
       
   249 	@since			7.0
       
   250  */
       
   251 	CMsgUrlHandlerDocument(CEikApplication& aApp);
       
   252 
       
   253 /**
       
   254 	@fn				ConstructL()
       
   255 	Intended Usage	:	Second phase of two-phase construction method. Does any 
       
   256 						allocations required to fully construct the object.
       
   257 	@since			7.0
       
   258 	@leave		KErrNoMemory.
       
   259 	@pre 			First phase of construction is complete
       
   260 	@post			The object is fully constructed and initialised.
       
   261  */
       
   262 	void ConstructL();
       
   263 
       
   264 /**
       
   265 	@fn				CEikAppUi* CreateAppUiL()
       
   266 	Intended Usage	:	This function is inherited from CEikDocument.
       
   267 						Launches the App UI.
       
   268 	@since			7.0
       
   269 	@leave		KErrNoMemory.
       
   270 	@return			Returns a pointer to CEikAppUi  
       
   271 	@pre 			App is created
       
   272 	@post			None
       
   273  */
       
   274 	CEikAppUi* CreateAppUiL();
       
   275 	};
       
   276 
       
   277 
       
   278 #endif