messagingfw/msgsrvnstore/mtmbase/src/MTMUIBAS.CPP
changeset 62 db3f5fa34ec7
parent 0 8e480a14352b
child 44 7c176670643f
equal deleted inserted replaced
60:9f5ae1728557 62:db3f5fa34ec7
       
     1 // Copyright (c) 1998-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 // MODULE - Message Type Module
       
    15 // 
       
    16 //
       
    17 
       
    18 // Generic includes
       
    19 #include <coemain.h>	// CCoeEnv
       
    20 #include <bautils.h>	// BaflUtils
       
    21 #include <basched.h>	// KErrExtended
       
    22 
       
    23 // Messaging includes
       
    24 #include <msvreg.h>
       
    25 #include <msvuids.h>
       
    26 #include <msvruids.h>
       
    27 #include "msvutils.h"
       
    28 
       
    29 // Specific includes
       
    30 #include "MTMUIBAS.H"
       
    31 #include "MTUIPAN.H"
       
    32 
       
    33 
       
    34 //
       
    35 // CBaseMtmUi - MTMUi base API (public methods)  //
       
    36 //
       
    37 EXPORT_C CBaseMtmUi::~CBaseMtmUi()
       
    38 /** Destructor.
       
    39 
       
    40 Cleans up the base class. CBaseMtmUi-derived objects must be deleted by client 
       
    41 applications when they are no longer required. 
       
    42 
       
    43 Derived classes can implement a destructor to do any additional clean up tasks 
       
    44 that they require. */
       
    45 	{
       
    46 	iRegisteredMtmDll.ReleaseLibrary();
       
    47 	if (iResourceFileOffset)
       
    48 		iCoeEnv->DeleteResourceFile(iResourceFileOffset);
       
    49 	}
       
    50 
       
    51 EXPORT_C void CBaseMtmUi::SetPreferences(TUint aFlags)
       
    52 /** Sets flags that communicate the MTM's preferences to the application UI.
       
    53 
       
    54 @param aFlags Bitmask of preference flags */
       
    55 	{
       
    56 	iFlags = aFlags;
       
    57 	}
       
    58 
       
    59 EXPORT_C TUint CBaseMtmUi::Preferences() const
       
    60 /** Gets flags that communicate the MTM's preferences to the application UI.
       
    61 
       
    62 @return Bitmask of preference flags */
       
    63 	{
       
    64 	return iFlags;
       
    65 	}
       
    66 
       
    67 EXPORT_C TUid CBaseMtmUi::Type() const
       
    68 /** Gets the Type UID of the message type associated with the User Interface MTM.
       
    69 
       
    70 @return UID of the message type associated with the MTM */
       
    71 	{
       
    72 	return iBaseMtm.Type();
       
    73 	}
       
    74 
       
    75 EXPORT_C CBaseMtm& CBaseMtmUi::BaseMtm() const
       
    76 /** Gets a reference to the Client-side MTM that requested this object.
       
    77 
       
    78 @return Client-side MTM that requested this object */
       
    79 	{
       
    80 	return iBaseMtm;
       
    81 	}
       
    82 
       
    83 //
       
    84 // --- Functions NOT dependent on the current context ---
       
    85 //
       
    86 EXPORT_C CMsvOperation* CBaseMtmUi::CreateL(const TMsvEntry& aEntry, CMsvEntry& aParent, TRequestStatus& aStatus)
       
    87 // Default implementation simply delegates to the message server
       
    88 /** Creates a new entry as a child. 
       
    89 
       
    90 Typically, after creating the entry, the function would launch a suitable interface, 
       
    91 such as a message editor, for the user to edit the new entry.
       
    92 
       
    93 The returned CMsvOperation object completes when creation is complete (for 
       
    94 example, when the message editor application is closed).
       
    95 
       
    96 Requirements:
       
    97 
       
    98 The default implementation simply calls aParent.CreateL() to create the entry. 
       
    99 If creating entries is not supported, implementations should leave with KErrNotSupported. 
       
   100 Otherwise, implementations should:
       
   101 
       
   102 1. check aEntry.iType.iUid to ensure that they can create the requested type 
       
   103 of entry and leave with code KErrNotSupported if they cannot
       
   104 
       
   105 2. return a CMsvOperation-derived object to provide asynchronous control and 
       
   106 monitoring of the operation
       
   107 
       
   108 3. for messages, launch a suitable editor application developed for the message 
       
   109 type.
       
   110 
       
   111 @param aEntry The data to be copied into the new entry 
       
   112 @param aParent The parent of the new entry 
       
   113 @param aStatus The request status to be completed when the operation has finished 
       
   114 
       
   115 @leave KErrNotSupported The requested type of entry cannot be created 
       
   116 @leave Other Dependent on implementation 
       
   117 @return If successful, this is an asynchronously completing create operation. 
       
   118 If failed, this is a completed operation, with status set to the relevant 
       
   119 error code. */
       
   120 	{
       
   121 	return aParent.CreateL(aEntry, aStatus);
       
   122 	}
       
   123 
       
   124 //
       
   125 // --- Deletion ---
       
   126 // --- Deletes entries from the current context, which must be a folder or service of the relevant MTM ---
       
   127 //
       
   128 EXPORT_C CMsvOperation* CBaseMtmUi::DeleteFromL(const CMsvEntrySelection& aSelection, TRequestStatus& aStatus)
       
   129 /** Deletes a selection of entries owned by the current context. 
       
   130 
       
   131 The current context must be a folder or service of the relevant MTM. The returned CMsvOperation 
       
   132 object completes when deleting is complete. 
       
   133 
       
   134 Requirements:
       
   135 
       
   136 The default implementation simply calls CMsvEntry::DeleteL() to delete the 
       
   137 entries. Implementations can override this to provide any additional checking 
       
   138 or user interaction. If deleting entries is not supported, implementations 
       
   139 should leave with KErrNotSupported.
       
   140 
       
   141 Where this function is implemented, it should return a CMsvOperation-derived 
       
   142 object to provide asynchronous control and monitoring of the operation.
       
   143 
       
   144 @param aSelection Selection of message entries 
       
   145 @param aStatus The request status to be completed when the operation has finished 
       
   146 @leave KErrNotSupported The User Interface MTM does not support delete operations, 
       
   147 or deleting is inappropriate to the current context 
       
   148 @leave Other Dependent on implementation 
       
   149 @return If successful, this is an asynchronously completing delete operation. 
       
   150 If failed, this is a completed operation, with status set to the relevant 
       
   151 error code. */
       
   152 	{
       
   153 	__ASSERT_DEBUG(aSelection.Count(), Panic(EMtuiEmptySelection));
       
   154 
       
   155 //	const TMsvEntry& context=BaseMtm().Entry().Entry();
       
   156 //@	__ASSERT_ALWAYS(context.iType.iUid==KUidMsvServiceEntryValue || context.iType.iUid==KUidMsvFolderEntryValue, Panic(EMtuiContextNotFolderOrService));
       
   157 
       
   158 	return BaseMtm().Entry().DeleteL(aSelection, aStatus);
       
   159 	}
       
   160 
       
   161 EXPORT_C CMsvOperation* CBaseMtmUi::UnDeleteFromL(const CMsvEntrySelection& /*aSelection*/, TRequestStatus& /*aStatus*/)
       
   162 /** Undeletes the specified selection.
       
   163 
       
   164 The default implementation leaves with KErrNotSupported.
       
   165 
       
   166 @param aSelection Selection of message entries 
       
   167 @param aStatus The request status to be completed when the operation has finished 
       
   168 @leave KErrNotSupported The User Interface MTM does not support undelete operations, 
       
   169 or undeleting is inappropriate to the current context 
       
   170 @leave Other Dependent on implementation 
       
   171 @return If successful, this is an asynchronously completing undelete operation. 
       
   172 If failed, this is a completed operation, with status set to the relevant 
       
   173 error code. */
       
   174 	{
       
   175 	User::Leave(KErrNotSupported);
       
   176 	return NULL;
       
   177 	}
       
   178 //
       
   179 // --- Deletes service, which need not be the current context ---
       
   180 EXPORT_C CMsvOperation* CBaseMtmUi::DeleteServiceL(const TMsvEntry& aService, TRequestStatus& aStatus)
       
   181 /** Deletes a specified service entry. 
       
   182 
       
   183 This entry does not have to be the current context. The usual behaviour is to remove the 
       
   184 service settings, disabling further use of that service. The returned CMsvOperation 
       
   185 object completes when deleting is complete.
       
   186 
       
   187 Requirements:
       
   188 
       
   189 The default implementation calls CMsvEntry::DeleteL() to delete the entry. 
       
   190 Implementations can override this to provide any additional checking or user 
       
   191 interaction. If deleting services is not supported, implementations should 
       
   192 leave with KErrNotSupported.
       
   193 
       
   194 Where this function is implemented, it should return a CMsvOperation-derived 
       
   195 object to provide asynchronous control and monitoring of the operation.
       
   196 
       
   197 @param aService Service to delete 
       
   198 @param aStatus The request status to be completed when the operation has finished 
       
   199 
       
   200 @leave KErrNotSupported This User Interface MTM does not support delete service 
       
   201 operations 
       
   202 @leave Other Dependent on implementation 
       
   203 @return If successful, this is an asynchronously completing delete operation. 
       
   204 If failed, this is a completed operation, with status set to the relevant 
       
   205 error code. */
       
   206 	{
       
   207 	__ASSERT_DEBUG(aService.iType.iUid==KUidMsvServiceEntryValue, Panic(EMtuiEntryNotService));
       
   208 
       
   209 	CMsvEntry* parent=Session().GetEntryL(aService.Parent());
       
   210 	CleanupStack::PushL(parent);
       
   211 	CMsvOperation* deleteoperation=parent->DeleteL(aService.Id(), aStatus);
       
   212 	CleanupStack::PopAndDestroy();// parent
       
   213 	
       
   214 	return deleteoperation;
       
   215 	}
       
   216 
       
   217 
       
   218 //
       
   219 // --- Copy and move functions ---
       
   220 // --- Context should be set to folder or entry of this MTM ---
       
   221 // --- Default implementations simply call the relevant CMsvEntry functions ---
       
   222 //
       
   223 EXPORT_C CMsvOperation* CBaseMtmUi::CopyToL(const CMsvEntrySelection& aSelection, TRequestStatus& aStatus)
       
   224 // Copies entries in that selection to the current context
       
   225 // All entries in the selection must have the same parent
       
   226 /** Copies an entry selection to a remote service. 
       
   227 
       
   228 All entries in the selection must have the same parent. The current context must be the MTM folder or service 
       
   229 to which to copy. The returned CMsvOperation object completes when copying 
       
   230 the entries is complete.
       
   231 
       
   232 The usual result of this function is to send messages. The exact behaviour varies 
       
   233 between MTMs: for example, a Fax MTM would transmit a fax when asked to copy a fax 
       
   234 from a local folder to a fax service. 
       
   235 
       
   236 Requirements:
       
   237 
       
   238 The default implementation calls CMsvEntry::CopyL() to do the copy. If message 
       
   239 copying is not supported, implementations should leave with KErrNotSupported.
       
   240 
       
   241 Where this function is implemented, it should return a CMsvOperation-derived 
       
   242 object to provide asynchronous control and monitoring of the operation.
       
   243 
       
   244 @param aSelection Selection of message entries 
       
   245 @param aStatus The request status to be completed when the operation has finished 
       
   246 @leave KErrNotSupported The User Interface MTM does not support copy to operations 
       
   247 @leave Other Dependent on implementation 
       
   248 @return If successful, this is an asynchronously completing copy operation. 
       
   249 If failed, this is a completed operation, with status set to the relevant 
       
   250 error code. */
       
   251 	{
       
   252 	__ASSERT_DEBUG(aSelection.Count(), Panic(EMtuiEmptySelection));
       
   253 
       
   254 	const TMsvEntry& context=BaseMtm().Entry().Entry();
       
   255 	__ASSERT_ALWAYS(context.iType.iUid==KUidMsvServiceEntryValue || context.iType.iUid==KUidMsvFolderEntryValue, Panic(EMtuiContextNotFolderOrService));
       
   256 
       
   257 	CMsvEntry* sourceEntry=Session().GetEntryL(aSelection.At(0));
       
   258 	CleanupStack::PushL(sourceEntry);
       
   259 
       
   260 	CMsvOperation* op=sourceEntry->CopyL(aSelection, context.Id(), aStatus);
       
   261 
       
   262 	CleanupStack::PopAndDestroy();// sourceEntry
       
   263 
       
   264 	return op;
       
   265 	}
       
   266 
       
   267 EXPORT_C CMsvOperation* CBaseMtmUi::MoveToL(const CMsvEntrySelection& aSelection, TRequestStatus& aStatus)
       
   268 /** Moves an entry selection to a remote service. 
       
   269 
       
   270 All entries in the selection must have the same parent. The current context must be the 
       
   271 MTM folder or service to which to move the entries. The returned CMsvOperation object completes 
       
   272 when moving the entries is complete.
       
   273 
       
   274 The usual result of this function is to send messages, in a similar way to 
       
   275 CopyToL(). The difference is that CopyToL() does not remove the original entries. 
       
   276 
       
   277 The exact behaviour varies between MTMs, as described for CopyToL().
       
   278 
       
   279 Requirements:
       
   280 
       
   281 The default implementation calls CMsvEntry::MoveL() to do the move. Implementations 
       
   282 are likely to be similar to those for CopyToL(), and may indeed share code.
       
   283 
       
   284 If an MTM does not support message moving, then it should leave with value 
       
   285 KErrNotSupported.
       
   286 
       
   287 Where this function is implemented, it should return a CMsvOperation-derived 
       
   288 object to provide asynchronous control and monitoring of the operation.
       
   289 
       
   290 @param aSelection Selection of message entries 
       
   291 @param aStatus The request status to be completed when the operation has finished 
       
   292 @leave KErrNotSupported The User Interface MTM does not support move to operations 
       
   293 @leave Other Dependent on implementation 
       
   294 @return If successful, this is an asynchronously completing move operation. 
       
   295 If failed, this is a completed operation, with status set to the relevant 
       
   296 error code. */
       
   297 	{
       
   298 	__ASSERT_DEBUG(aSelection.Count(), Panic(EMtuiEmptySelection));
       
   299 
       
   300 	const TMsvEntry& context=BaseMtm().Entry().Entry();
       
   301 	__ASSERT_ALWAYS(context.iType.iUid==KUidMsvServiceEntryValue || context.iType.iUid==KUidMsvFolderEntryValue, Panic(EMtuiContextNotFolderOrService));
       
   302 
       
   303 	CMsvEntry* sourceEntry=Session().GetEntryL(aSelection.At(0));
       
   304 	CleanupStack::PushL(sourceEntry);
       
   305 
       
   306 	CMsvOperation* op=sourceEntry->MoveL(aSelection, context.Id(), aStatus);
       
   307 
       
   308 	CleanupStack::PopAndDestroy();// sourceEntry
       
   309 
       
   310 	return op;
       
   311 	}
       
   312 
       
   313 EXPORT_C CMsvOperation* CBaseMtmUi::CopyFromL(const CMsvEntrySelection& aSelection, TMsvId aTargetId, TRequestStatus& aStatus)
       
   314 /** Copies an entry selection from a remote service. 
       
   315 
       
   316 All entries in the selection 
       
   317 must have the same parent. The current context must be the MTM folder or service 
       
   318 from which to copy. The returned CMsvOperation object completes when copying 
       
   319 the entries is complete.
       
   320 
       
   321 The usual result of this function is to get messages. It is called when the 
       
   322 user copies and pastes messages from a remote service. The exact behaviour 
       
   323 varies between MTMs. 
       
   324 
       
   325 Requirements:
       
   326 
       
   327 The default implementation calls CMsvEntry::CopyL() to do the copy. If message 
       
   328 copying is not supported, implementations should leave with KErrNotSupported.
       
   329 
       
   330 Where this function is implemented, it should return a CMsvOperation-derived 
       
   331 object to provide asynchronous control and monitoring of the operation.
       
   332 
       
   333 @param aSelection Selection of message entries 
       
   334 @param aTargetId The ID of the entry to own the copies 
       
   335 @param aStatus The request status to be completed when the operation has finished 
       
   336 @leave KErrNotSupported The User Interface MTM does not support copy from operations 
       
   337 @leave Other Dependent on implementation 
       
   338 @return If successful, this is an asynchronously completing copy operation. 
       
   339 If failed, this is a completed operation, with status set to the relevant 
       
   340 error code. */
       
   341 	{
       
   342 	__ASSERT_DEBUG(aSelection.Count(), Panic(EMtuiEmptySelection));
       
   343 	return BaseMtm().Entry().CopyL(aSelection, aTargetId, aStatus);
       
   344 	}
       
   345 
       
   346 EXPORT_C CMsvOperation* CBaseMtmUi::MoveFromL(const CMsvEntrySelection& aSelection, TMsvId aTargetId, TRequestStatus& aStatus)
       
   347 /** Moves an entry selection from a remote service. 
       
   348 
       
   349 All entries in the selection 
       
   350 must have the same parent. The current context must be the MTM folder or service 
       
   351 from which to move. The returned CMsvOperation object completes when moving 
       
   352 the entries is complete.
       
   353 
       
   354 The usual result of this function is to get messages, in a similar way to 
       
   355 CopyFromL(). The difference is that CopyFromL() does not remove the original 
       
   356 entries. 
       
   357 
       
   358 Requirements:
       
   359 
       
   360 The default implementation calls CMsvEntry::MoveL() to do the move. Implementations 
       
   361 are likely to be similar to those for CopyToL(), and may indeed share code.
       
   362 
       
   363 If an MTM does not support message moving, then it should leave with value 
       
   364 KErrNotSupported.
       
   365 
       
   366 Where this function is implemented, it should return a CMsvOperation-derived 
       
   367 object to provide asynchronous control and monitoring of the operation.
       
   368 
       
   369 @param aSelection Selection of message entries 
       
   370 @param aTargetId The entry ID of the remote service 
       
   371 @param aStatus The request status to be completed when the operation has finished 
       
   372 @leave KErrNotSupported The User Interface MTM does not support get operations 
       
   373 @leave Other Dependent on implementation 
       
   374 @return If successful, this is an asynchronously completing move operation. 
       
   375 If failed, this is a completed operation, with status set to the relevant 
       
   376 error code. */
       
   377 	{
       
   378 	__ASSERT_DEBUG(aSelection.Count(), Panic(EMtuiEmptySelection));
       
   379 	return BaseMtm().Entry().MoveL(aSelection, aTargetId, aStatus);
       
   380 	}
       
   381 
       
   382 //
       
   383 // --- Interpret transfer progress ---
       
   384 //
       
   385 EXPORT_C TInt CBaseMtmUi::DisplayProgressSummary(const TDesC8& /*aProgress*/) const
       
   386 /** Displays a message describing the progress of an operation. 
       
   387 
       
   388 Requirements:
       
   389 
       
   390 The default implementation simply returns KErrNotSupported. 
       
   391 
       
   392 Implementations should unpack the passed aProgress buffer, construct from 
       
   393 this a suitable message, and display it. The implementation of this function 
       
   394 should share an understanding of the format of the buffer with the implementations 
       
   395 of CMsvOperation-derived classes.
       
   396 
       
   397 @param aProgress Progress information obtained from a call to CMsvOperation::Progress() 
       
   398 @return A system error code */
       
   399 	{// Default implementation
       
   400 	return KErrNotSupported;
       
   401 	}
       
   402 
       
   403 EXPORT_C TInt CBaseMtmUi::GetProgress(const TDesC8& /*aProgress*/, TBuf<EProgressStringMaxLen>& /*aReturnString*/, TInt& /*aTotalEntryCount*/,
       
   404 							 TInt& /*aEntriesDone*/, TInt& /*aCurrentEntrySize*/, TInt& /*aCurrentBytesTrans*/) const
       
   405 /** Obtains progress information description and statistics. A message client application 
       
   406 can then display this information to the user. 
       
   407 
       
   408 Requirements:
       
   409 
       
   410 The default implementation returns KErrNotSupported.
       
   411 
       
   412 Implementations should unpack the passed aProgress buffer, and fill in the 
       
   413 return values appropriately. The implementation of this function should share 
       
   414 an understanding of the format of the buffer with the implementations of CMsvOperation-derived 
       
   415 classes.
       
   416 
       
   417 @param aProgress MTM-specific transfer progress information 
       
   418 @param aReturnString On return, a string describing the progress status 
       
   419 @param aTotalEntryCount On return, the total number of entries the operation 
       
   420 is acting upon 
       
   421 @param aEntriesDone On return, the number of entries which the operation has 
       
   422 completed on 
       
   423 @param aCurrentEntrySize On return, the size of the current entry the operation 
       
   424 is acting upon 
       
   425 @param aCurrentBytesTrans On return, the number of bytes of the current entry 
       
   426 which have been completed 
       
   427 @return A system error code */
       
   428 	{// Default implementation
       
   429 	return KErrNotSupported;
       
   430 	}
       
   431 
       
   432 //	
       
   433 // --- RTTI functions ---
       
   434 //
       
   435 EXPORT_C TInt CBaseMtmUi::QueryCapability(TUid aCapability, TInt& aResponse)
       
   436 /** Queries if the MTM supports a particular capability, specified by a UID. 
       
   437 
       
   438 For MTM-specific UIDs, see the documentation for the relevant MTM.
       
   439 
       
   440 Requirements:
       
   441 
       
   442 The default implementation calls iBaseMtm->QueryCapability() (i.e. the corresponding 
       
   443 function on the Client-side MTM) to do the query. This is sufficient for many 
       
   444 implementations. 
       
   445 
       
   446 However, it is expected that each MTM-specific function is indicated by a 
       
   447 capability. For example, if the MTM supports a function with UID KMtmUiMessagingXYZ, 
       
   448 then there might be a capability KMtmUiQueryMessagingXYZ. Therefore, if different 
       
   449 MTM-specific functions are supported by a User Interface MTM and by the corresponding 
       
   450 Client-side MTM, this function should be implemented to reflect this.
       
   451 
       
   452 @param aCapability Capability for which to query 
       
   453 @param aResponse On return, indicates whether the capability is supported, 
       
   454 or some other property of the capability.. 
       
   455 @return KErrNone if successful, KErrNotSupported: aCapability is not a recognised 
       
   456 value 
       
   457 @see InvokeAsyncFunctionL()
       
   458 @see InvokeSyncFunctionL() */
       
   459 	{
       
   460 	return iBaseMtm.QueryCapability(aCapability, aResponse);
       
   461 	}
       
   462 
       
   463 EXPORT_C void CBaseMtmUi::InvokeSyncFunctionL(TInt aFunctionId, const CMsvEntrySelection& aSelection, TDes8& aParameter)
       
   464 /** Invokes synchronous protocol-specific operations. For asynchronous operations, 
       
   465 a similar function, InvokeAsyncFunctionL(), is available.
       
   466 
       
   467 aSelection and aParameter allow data to be passed to the operation. 
       
   468 
       
   469 Requirements:
       
   470 
       
   471 The default implementation calls the corresponding function on the Client-side 
       
   472 MTM (through iBaseMtm). This is sufficient for many implementations. However, 
       
   473 there may be certain MTM-specific functions which require interaction with 
       
   474 the user. These should be implemented here.
       
   475 
       
   476 @param aFunctionId ID of the requested function 
       
   477 @param aSelection Selection of message entries. This is used if the operation 
       
   478 requires message entries to work on. 
       
   479 @param aParameter Buffer containing input and output parameters. The format 
       
   480 of this is specific to the operation. 
       
   481 @leave KErrNotSupported aFunctionId is not a recognised function ID 
       
   482 @leave Other Dependent on implementation */
       
   483 	{
       
   484 	iBaseMtm.InvokeSyncFunctionL(aFunctionId, aSelection, aParameter);
       
   485 	}
       
   486 
       
   487 EXPORT_C CMsvOperation* CBaseMtmUi::InvokeAsyncFunctionL(TInt aFunctionId, const CMsvEntrySelection& aSelection, TRequestStatus& aCompletionStatus, 
       
   488 						TDes8& aParameter)
       
   489 /**
       
   490 Invokes asynchronous protocol-specific operations. For synchronous operations, a 
       
   491 similar function, InvokeSyncFunctionL(), is available.
       
   492 
       
   493 aSelection and aParameter allow data to be passed to the operation. The TRequestStatus 
       
   494 and CMsvOperation objects are used as normal to control and monitor the operation.
       
   495 
       
   496 Requirements:
       
   497 
       
   498 The default implementation calls the corresponding function on the Client-side MTM 
       
   499 (through iBaseMtm). This is sufficient for many implementations. However, there may 
       
   500 be certain MTM-specific functions which require interaction with the user. 
       
   501 These should be implemented here.
       
   502 
       
   503 InvokeAsyncFunctionL() should return a CMsvOperation-derived object to provide 
       
   504 asynchronous control and monitoring of the operation.
       
   505 
       
   506 @return	If successful, this is an asynchronously completing operation. If failed, 
       
   507 this is a completed operation, with status set to the relevant error code. 		
       
   508 @param aFunctionId ID of the requested function 
       
   509 @param aSelection Selection of message entries. This is used if the operation 
       
   510 requires message entries to work on. 
       
   511 @param aParameter Buffer containing input and output parameters. The format 
       
   512 of this is specific to the operation.
       
   513 @param aCompletionStatus The request status to be completed when the operation has finished 
       
   514 @leave KErrNotSupported aFunctionId is not a recognised function ID 
       
   515 @leave Other Dependent on implementation */
       
   516 	{
       
   517 	return iBaseMtm.InvokeAsyncFunctionL(aFunctionId, aSelection, aParameter, aCompletionStatus);
       
   518 	}
       
   519 
       
   520 //
       
   521 // CBaseMtmUi - MTMUi base (protected methods)   //
       
   522 //
       
   523 EXPORT_C CBaseMtmUi::CBaseMtmUi(CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll)
       
   524 	:	iBaseMtm(aBaseMtm), 
       
   525 		iCoeEnv(CCoeEnv::Static()),
       
   526 		iRegisteredMtmDll(aRegisteredMtmDll)
       
   527 /** Constructor, which initialises member variables from the passed arguments. 
       
   528 
       
   529 Client applications do not use this function. It is relevant only to implementers of derived classes.
       
   530 
       
   531 The value of aBaseMtm is stored in the protected data member iBaseMtm, so 
       
   532 it can be accessed by derived classes.
       
   533 
       
   534 Derived classes can implement a constructor to perform any additional MTM-specific 
       
   535 setup that can be safely carried out in a constructor. Such constructors must 
       
   536 call the base class constructor function.
       
   537 
       
   538 @param aBaseMtm The CBaseMtm requesting the object 
       
   539 @param aRegisteredMtmDll Registration data for the DLL */
       
   540 	{
       
   541 	__DECLARE_NAME(_S("CBaseMtmUi"));
       
   542 	}
       
   543 
       
   544 EXPORT_C void CBaseMtmUi::ConstructL()
       
   545 /** Second-phase constructor.
       
   546 
       
   547 Client applications do not use this function. It is relevant only to implementers 
       
   548 of derived classes.
       
   549 
       
   550 Requirements:
       
   551 
       
   552 Derived classes implement two-phase construction functions (NewL(), ConstructL()) 
       
   553 to create a new instance of the object, in which any dynamic allocation should 
       
   554 be performed. ConstructL() should be called from the NewL() function of the 
       
   555 derived class.
       
   556 
       
   557 The default implementation of this function loads resources required by the 
       
   558 base class. Derived classes can implement this function to perform any additional 
       
   559 MTM-specific second stage construction tasks that they require. Implementations 
       
   560 must call the base class ConstructL() function.
       
   561 
       
   562 Concrete MTMs must also implement a factory function by which a MTM registry 
       
   563 can request an instance of the class.
       
   564 
       
   565 @see MtmUiFactoryFunctionL */
       
   566 	{
       
   567 	// Get resource file
       
   568 	TFileName resourceFileName;
       
   569  	GetResourceFileName(resourceFileName);
       
   570 	
       
   571 	MsvUtils::AddPathAndExtensionToResFileL(resourceFileName);
       
   572  
       
   573 	//Now look for the nearest filename--will search the system drive if specified
       
   574 	BaflUtils::NearestLanguageFile(iCoeEnv->FsSession(), resourceFileName);
       
   575 
       
   576 	TRAPD(ret, iResourceFileOffset=iCoeEnv->AddResourceFileL(resourceFileName));
       
   577 	User::LeaveIfError(ret);
       
   578 	}
       
   579 
       
   580 EXPORT_C CMsvSession& CBaseMtmUi::Session() const
       
   581 /** Gets a reference to the session object used by the Client-side MTM that requested 
       
   582 the User Interface MTM.
       
   583 
       
   584 @return Session object used by the Client-side MTM */
       
   585 	{ 
       
   586 	return iBaseMtm.Session(); 
       
   587 	}
       
   588 
       
   589 /**
       
   590 Returns a pointer to the interface with the specified Uid. 
       
   591 
       
   592 This method is the first part of an extension pattern to allow for
       
   593 more functionality to be supported without adding virtual methods
       
   594 to this base class.
       
   595 
       
   596 The default implementation returns a NULL pointer.
       
   597  
       
   598 @param	aUid  
       
   599 Uid of the extension interface
       
   600 @return
       
   601 Pointer to the extension interface
       
   602 */
       
   603 EXPORT_C TAny* CBaseMtmUi::GetInterface(TUid /*aUid*/)
       
   604  	{
       
   605 	return NULL;
       
   606  	}