emailuis/emailui/sendasmtm/fsmtms/ui/src/cfsuimtm.cpp
branchRCL_3
changeset 25 3533d4323edc
parent 0 8466d47a6819
equal deleted inserted replaced
24:d189ee25cf9d 25:3533d4323edc
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Implementation of the class CFsMtmUi
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 // Messaging includes
       
    21 #include "emailtrace.h"
       
    22 #include <msvuids.h>
       
    23 #include <msvids.h>
       
    24 #include <eikappui.h>
       
    25 #include <eikenv.h>
       
    26 #include <coeaui.h>
       
    27 #include <data_caging_path_literals.hrh>
       
    28 
       
    29 #include "FreestyleEmailUiConstants.h"
       
    30 #include "fsmtmsconstants.h"
       
    31 #include "cfsuimtm.h"
       
    32 #include "cfssendashelper.h"
       
    33 
       
    34 // ---------------------------------------------------------------------------
       
    35 // CFsMtmUi::NewL
       
    36 // Exported factory function
       
    37 // ---------------------------------------------------------------------------
       
    38 //
       
    39 EXPORT_C CFsMtmUi* CFsMtmUi::NewL( CBaseMtm& aBaseMtm, 
       
    40     CRegisteredMtmDll& aRegisteredMtmDll)
       
    41     {
       
    42     FUNC_LOG;
       
    43     
       
    44     CFsMtmUi* self = new(ELeave) CFsMtmUi( aBaseMtm, aRegisteredMtmDll );
       
    45     CleanupStack::PushL( self );
       
    46     self->ConstructL();
       
    47     CleanupStack::Pop();
       
    48 
       
    49     return self;
       
    50     }
       
    51 
       
    52 // ---------------------------------------------------------------------------
       
    53 // CFsMtmUi::CFsMtmUi
       
    54 // ---------------------------------------------------------------------------
       
    55 //
       
    56 CFsMtmUi::CFsMtmUi( CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll)
       
    57     : CBaseMtmUi(aBaseMtm, aRegisteredMtmDll )
       
    58     {
       
    59     FUNC_LOG;
       
    60     }
       
    61 
       
    62 // ---------------------------------------------------------------------------
       
    63 // CFsMtmUi::~CFsMtmUi
       
    64 // ---------------------------------------------------------------------------
       
    65 //
       
    66 CFsMtmUi::~CFsMtmUi()
       
    67     {
       
    68     FUNC_LOG;
       
    69     }
       
    70 
       
    71 // ---------------------------------------------------------------------------
       
    72 // CFsMtmUi::ConstructL
       
    73 // ---------------------------------------------------------------------------
       
    74 //
       
    75 void CFsMtmUi::ConstructL()
       
    76     {
       
    77     FUNC_LOG;
       
    78 
       
    79     CBaseMtmUi::ConstructL();
       
    80     
       
    81     }
       
    82 
       
    83 // ---------------------------------------------------------------------------
       
    84 // CFsMtmUi::CancelL
       
    85 // ---------------------------------------------------------------------------
       
    86 //
       
    87 CMsvOperation* CFsMtmUi::CancelL( TRequestStatus& /*aStatus*/, 
       
    88     const CMsvEntrySelection& /*aSelection*/ )
       
    89     {
       
    90     FUNC_LOG;
       
    91     
       
    92     User::Leave(KErrNotSupported); 
       
    93     
       
    94     return NULL; //Statisfies the compiler
       
    95     }
       
    96 
       
    97 // ---------------------------------------------------------------------------
       
    98 // CFsMtmUi::GetResourceFileName
       
    99 // Resource file loading 
       
   100 // ---------------------------------------------------------------------------
       
   101 //
       
   102 void CFsMtmUi::GetResourceFileName( TFileName& aFileName ) const
       
   103     {
       
   104     FUNC_LOG;
       
   105     TFileName dllFileName;
       
   106     Dll::FileName( dllFileName );      
       
   107     TParse parse;
       
   108     parse.Set( KFsMtmUiResourceFile, &KDC_MTM_RESOURCE_DIR, &dllFileName );
       
   109     aFileName= parse.FullName();   
       
   110 
       
   111     
       
   112     }
       
   113 
       
   114 // ---------------------------------------------------------------------------
       
   115 // CFsMtmUi::OpenL
       
   116 // ---------------------------------------------------------------------------
       
   117 //
       
   118 CMsvOperation* CFsMtmUi::OpenL( TRequestStatus& aStatus )
       
   119     {
       
   120     FUNC_LOG;
       
   121     
       
   122    	CEikAppUi* appUi = CEikonEnv::Static()->EikAppUi();
       
   123     CCoeAppUi* coeAppUi = static_cast<CCoeAppUi*>( appUi );
       
   124     TVwsViewId viewId = TVwsViewId( KFSEmailUiUid, MailListId );
       
   125 	TMailListActivationData tmp;
       
   126 	
       
   127     TMsvId accountId = iBaseMtm.Entry().Entry().iServiceId;	
       
   128     CMsvEntry* accountEntry = CMsvEntry::NewL( Session(), accountId,
       
   129         TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ));	
       
   130     CleanupStack::PushL( accountEntry );
       
   131     
       
   132 	tmp.iMailBoxId = TFSMailMsgId( accountEntry->Entry().MtmData1(), accountEntry->Entry().MtmData2() );
       
   133     
       
   134    
       
   135 	TPckgBuf<TMailListActivationData> pkgOut( tmp );
       
   136 	coeAppUi->ActivateViewL( viewId, KStartListWithFolderId, pkgOut);
       
   137 
       
   138     CleanupStack::PopAndDestroy( accountEntry );
       
   139 	
       
   140     
       
   141     TBufC8<1> buf;  
       
   142     return CMsvCompletedOperation::NewL( Session(), Type(), buf, 
       
   143             KMsvLocalServiceIndexEntryId, aStatus, KErrNone ); 
       
   144     }
       
   145 
       
   146 // ---------------------------------------------------------------------------
       
   147 // CFsMtmUi::OpenL
       
   148 // ---------------------------------------------------------------------------
       
   149 //
       
   150 CMsvOperation* CFsMtmUi::OpenL( TRequestStatus& aStatus, 
       
   151     const CMsvEntrySelection& /*aSelection*/ )
       
   152     {
       
   153     FUNC_LOG;
       
   154 
       
   155     return OpenL(aStatus);
       
   156     }
       
   157 
       
   158 // ---------------------------------------------------------------------------
       
   159 // CFsMtmUi::CloseL
       
   160 // ---------------------------------------------------------------------------
       
   161 //
       
   162 CMsvOperation* CFsMtmUi::CloseL(TRequestStatus& /*aStatus*/)
       
   163     {
       
   164     FUNC_LOG;
       
   165     
       
   166     User::Leave(KErrNotSupported); 
       
   167     
       
   168     return NULL;     
       
   169     }
       
   170 
       
   171 // ---------------------------------------------------------------------------
       
   172 // CFsMtmUi::CloseL
       
   173 // ---------------------------------------------------------------------------
       
   174 //
       
   175 CMsvOperation* CFsMtmUi::CloseL( TRequestStatus& /*aStatus*/, 
       
   176     const CMsvEntrySelection& /*aSelection*/ )
       
   177     {
       
   178     FUNC_LOG;
       
   179     User::Leave(KErrNotSupported); 
       
   180     return NULL;     
       
   181     }
       
   182 
       
   183 // ---------------------------------------------------------------------------
       
   184 // CFsMtmUi::CreateL
       
   185 // ---------------------------------------------------------------------------
       
   186 //
       
   187 CMsvOperation* CFsMtmUi::CreateL( const TMsvEntry& aEntry, 
       
   188     CMsvEntry& /*aParent*/, TRequestStatus& aStatus )
       
   189     {
       
   190     FUNC_LOG;
       
   191     // INFO: By doing this the accountEntry will get further details that are 
       
   192     // required to launch the respective accounts in email UI.
       
   193     TMsvId accountId = aEntry.iServiceId;
       
   194     CMsvEntry* accountEntry = CMsvEntry::NewL( Session(), accountId,
       
   195         TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ));
       
   196     CleanupStack::PushL( accountEntry );
       
   197     
       
   198 
       
   199     CFsSendAsHelper* sendAsHelper = CFsSendAsHelper::NewL();
       
   200     CleanupStack::PushL( sendAsHelper );
       
   201 
       
   202     // Send Plugin Id and Mailbox Id for Launching.
       
   203     TUint pluginId = accountEntry->Entry().MtmData1();
       
   204     TUint id = accountEntry->Entry().MtmData2();
       
   205     sendAsHelper->LaunchUiL( pluginId, id, ETrue, EFalse );
       
   206 
       
   207     CleanupStack::PopAndDestroy( sendAsHelper );
       
   208     CleanupStack::PopAndDestroy( accountEntry );
       
   209     TBufC8<1> buf;  
       
   210     
       
   211     //Complete ourselves.
       
   212     return CMsvCompletedOperation::NewL( Session(), Type(), buf, 
       
   213         KMsvLocalServiceIndexEntryId, aStatus, KErrNone );
       
   214     }
       
   215 
       
   216 // ---------------------------------------------------------------------------
       
   217 // CFsMtmUi::EditL
       
   218 // ---------------------------------------------------------------------------
       
   219 //
       
   220 CMsvOperation* CFsMtmUi::EditL( TRequestStatus& aStatus )
       
   221     {
       
   222     FUNC_LOG;
       
   223 
       
   224     TUid type = iBaseMtm.Entry().Entry().iType;
       
   225 	//__ASSERT_DEBUG(type==KUidMsvMessageEntry || type==KUidMsvServiceEntry,
       
   226 	//		Panic(ETextMtmUiWrongEntryType));
       
   227     TMsvId accountId = iBaseMtm.Entry().Entry().iServiceId;
       
   228     CMsvEntry* accountEntry = CMsvEntry::NewL( Session(), accountId,
       
   229         TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ));
       
   230     CleanupStack::PushL( accountEntry );    
       
   231     TUint puginId = accountEntry->Entry().MtmData1();
       
   232     TUint id = accountEntry->Entry().MtmData2();
       
   233     CFsSendAsHelper* sendAsHelper = CFsSendAsHelper::NewL();
       
   234     CleanupStack::PushL( sendAsHelper );
       
   235     if ( type == KUidMsvMessageEntry )
       
   236 		{	    
       
   237 	    // FS UI when - Createmessage -> email -> FS Email account    
       
   238 	    sendAsHelper->LaunchUiL( puginId, id, EFalse, EFalse );
       
   239 		}
       
   240 	else
       
   241 		{
       
   242 	    // Settings when - Messages -> Options->Email Settings -> Email account.
       
   243 	    sendAsHelper->LaunchUiL( puginId, id, EFalse, ETrue );
       
   244 		}
       
   245     CleanupStack::PopAndDestroy( sendAsHelper );
       
   246     CleanupStack::PopAndDestroy( accountEntry );
       
   247     TBufC8<1> buf;
       
   248     
       
   249     //Complete ourselves.
       
   250     return CMsvCompletedOperation::NewL( Session(), Type(), buf, 
       
   251         KMsvLocalServiceIndexEntryId, aStatus, KErrNone );
       
   252     }
       
   253 
       
   254 // ---------------------------------------------------------------------------
       
   255 // CFsMtmUi::EditL
       
   256 // ---------------------------------------------------------------------------
       
   257 //
       
   258 CMsvOperation* CFsMtmUi::EditL( TRequestStatus& /*aStatus*/, 
       
   259     const CMsvEntrySelection& /*aSelection*/ )
       
   260     {
       
   261     FUNC_LOG;
       
   262     
       
   263     User::Leave(KErrNotSupported); 
       
   264     
       
   265     return NULL;     
       
   266     }
       
   267 
       
   268 // ---------------------------------------------------------------------------
       
   269 // CFsMtmUi::ViewL
       
   270 // ---------------------------------------------------------------------------
       
   271 //
       
   272 CMsvOperation* CFsMtmUi::ViewL( TRequestStatus& /*aStatus*/)
       
   273     {
       
   274     FUNC_LOG;
       
   275     
       
   276     User::Leave(KErrNotSupported); 
       
   277     
       
   278     return NULL;     
       
   279     }
       
   280 
       
   281 // ---------------------------------------------------------------------------
       
   282 // CFsMtmUi::ViewL
       
   283 // ---------------------------------------------------------------------------
       
   284 //
       
   285 CMsvOperation* CFsMtmUi::ViewL( TRequestStatus& /*aStatus*/, 
       
   286     const CMsvEntrySelection& /*aSelection*/)
       
   287     {
       
   288     FUNC_LOG;
       
   289     
       
   290     User::Leave(KErrNotSupported); 
       
   291     
       
   292     return NULL;     
       
   293     }
       
   294 
       
   295 // ---------------------------------------------------------------------------
       
   296 // CFsMtmUi::DeleteFromL
       
   297 // ---------------------------------------------------------------------------
       
   298 //
       
   299 CMsvOperation* CFsMtmUi::DeleteFromL( const CMsvEntrySelection& /*aSelection*/,
       
   300                                        TRequestStatus& /*aStatus*/)
       
   301     {
       
   302     FUNC_LOG;
       
   303     
       
   304     User::Leave(KErrNotSupported); 
       
   305     
       
   306     return NULL;     
       
   307     }
       
   308 
       
   309 // ---------------------------------------------------------------------------
       
   310 // CFsMtmUi::CopyToL
       
   311 // ---------------------------------------------------------------------------
       
   312 //
       
   313 CMsvOperation* CFsMtmUi::CopyToL( const CMsvEntrySelection& /*aSelection*/, 
       
   314     TRequestStatus& /*aStatus*/)
       
   315     {
       
   316     FUNC_LOG;
       
   317     
       
   318     User::Leave(KErrNotSupported); 
       
   319     
       
   320     return NULL;     
       
   321     }
       
   322 
       
   323 // ---------------------------------------------------------------------------
       
   324 // CFsMtmUi::MoveToL
       
   325 // ---------------------------------------------------------------------------
       
   326 //
       
   327 CMsvOperation* CFsMtmUi::MoveToL( const CMsvEntrySelection& /*aSelection*/, 
       
   328     TRequestStatus& /*aStatus*/)
       
   329     {
       
   330     FUNC_LOG;
       
   331     
       
   332     User::Leave(KErrNotSupported); 
       
   333     
       
   334     return NULL;     
       
   335     }
       
   336 
       
   337 // ---------------------------------------------------------------------------
       
   338 // CFsMtmUi::CopyFromL
       
   339 // ---------------------------------------------------------------------------
       
   340 //
       
   341 CMsvOperation* CFsMtmUi::CopyFromL( const CMsvEntrySelection& /*aSelection*/, 
       
   342     TMsvId /*aTargetId*/, TRequestStatus& /*aStatus*/)
       
   343     {
       
   344     FUNC_LOG;
       
   345     
       
   346     User::Leave(KErrNotSupported); 
       
   347     
       
   348     return NULL;     
       
   349     }
       
   350 
       
   351 // ---------------------------------------------------------------------------
       
   352 // CFsMtmUi::MoveFromL
       
   353 // ---------------------------------------------------------------------------
       
   354 //
       
   355 CMsvOperation* CFsMtmUi::MoveFromL( const CMsvEntrySelection& /*aSelection*/, 
       
   356     TMsvId /*aTargetId*/, TRequestStatus& /*aStatus*/ )
       
   357 // Moves entries in selection from current context to aTargetId id    
       
   358     {
       
   359     FUNC_LOG;
       
   360     
       
   361     User::Leave( KErrNotSupported ); 
       
   362     
       
   363     return NULL;     
       
   364     }
       
   365 
       
   366 //
       
   367 //    MTM-specific functionality
       
   368 //
       
   369 // ---------------------------------------------------------------------------
       
   370 // CFsMtmUi::InvokeSyncFunctionL
       
   371 // ---------------------------------------------------------------------------
       
   372 //
       
   373 void CFsMtmUi::InvokeSyncFunctionL( TInt /*aFunctionId*/, 
       
   374     const CMsvEntrySelection& /*aSelection*/, TDes8& /*aParameter*/ )
       
   375     {
       
   376     FUNC_LOG;
       
   377 
       
   378     User::Leave(KErrNotSupported); 
       
   379     
       
   380     }
       
   381 
       
   382 // ---------------------------------------------------------------------------
       
   383 // CFsMtmUi::InvokeAsyncFunctionL
       
   384 // ---------------------------------------------------------------------------
       
   385 //
       
   386 CMsvOperation* CFsMtmUi::InvokeAsyncFunctionL( TInt /*aFunctionId*/, 
       
   387     const CMsvEntrySelection& /*aSelection*/, 
       
   388     TRequestStatus& /*aCompletionStatus*/, TDes8& /*aParameter*/ )
       
   389     {
       
   390     FUNC_LOG;
       
   391     
       
   392     User::Leave(KErrNotSupported); 
       
   393     
       
   394     return NULL;     
       
   395     }
       
   396 
       
   397 //
       
   398 //    Message responding
       
   399 //
       
   400 // ---------------------------------------------------------------------------
       
   401 // CFsMtmUi::ReplyL
       
   402 // Reply to message - no UI support
       
   403 // ---------------------------------------------------------------------------
       
   404 //
       
   405 CMsvOperation* CFsMtmUi::ReplyL( TMsvId /*aDestination*/, 
       
   406     TMsvPartList /*aPartlist*/, TRequestStatus& /*aCompletionStatus*/ )
       
   407     {
       
   408     FUNC_LOG;
       
   409     
       
   410     User::Leave( KErrNotSupported );
       
   411     
       
   412     return NULL;     
       
   413 
       
   414     }
       
   415 
       
   416 // ---------------------------------------------------------------------------
       
   417 // CFsMtmUi::ForwardL
       
   418 // Forwarded message - no UI support
       
   419 // ---------------------------------------------------------------------------
       
   420 //
       
   421 CMsvOperation* CFsMtmUi::ForwardL( TMsvId /*aDestination*/, 
       
   422     TMsvPartList /*aPartlist*/, TRequestStatus& /*aCompletionStatus*/ )
       
   423     {
       
   424     FUNC_LOG;
       
   425     
       
   426     User::Leave(KErrNotSupported);
       
   427     
       
   428     return NULL;     
       
   429     }
       
   430 
       
   431 //
       
   432 //    Progress information
       
   433 //
       
   434 // ---------------------------------------------------------------------------
       
   435 // CFsMtmUi::GetProgress
       
   436 // ---------------------------------------------------------------------------
       
   437 //
       
   438 TInt CFsMtmUi::GetProgress( const TDesC8& /*aProgress*/, 
       
   439     TBuf<EProgressStringMaxLen>& /*aReturnString*/, 
       
   440     TInt& /*aTotalEntryCount*/, TInt& /*aEntriesDone*/,
       
   441     TInt& /*aCurrentEntrySize*/, TInt& /*aCurrentBytesTrans*/) const
       
   442     {
       
   443     FUNC_LOG;
       
   444     return KErrNone;     
       
   445     }
       
   446 
       
   447 // End of file
       
   448