meetingrequest/mrcasplugin/src/cesmrcaspluginuilauncher.cpp
branchRCL_3
changeset 12 4ce476e64c59
parent 0 8466d47a6819
child 16 b5fbb9b25d57
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
    23 // <cmail> Profiler removed. </cmail>
    23 // <cmail> Profiler removed. </cmail>
    24 
    24 
    25 #include <badesca.h>
    25 #include <badesca.h>
    26 //<cmail>
    26 //<cmail>
    27 #include "tfsccontactactionpluginparams.h"
    27 #include "tfsccontactactionpluginparams.h"
    28 #include <MVPbkStoreContact.h>
    28 #include <mvpbkstorecontact.h>
    29 #include <CalenInterimUtils2.h>
    29 #include <caleninterimutils2.h>
    30 #include <cmrmailboxutils.h>
    30 #include <cmrmailboxutils.h>
    31 #include <calsession.h>
    31 #include <calsession.h>
    32 #include <calentry.h>
    32 #include <calentry.h>
    33 #include <CAgnEntryUi.h>
    33 #include <cagnentryui.h>
    34 #include <caluser.h>
    34 #include <caluser.h>
    35 #include "mfscactionutils.h"
    35 #include "mfscactionutils.h"
    36 //</cmail>
    36 //</cmail>
    37 #include <aknPopup.h>
    37 #include <aknpopup.h>
    38 #include <aknlists.h>
    38 #include <aknlists.h>
    39 #include <utf.h>
    39 #include <utf.h>
    40 #include <ecom/ecom.h>
    40 #include <ecom/ecom.h>
    41 #include "esmrcommands.h"
    41 #include "esmrcommands.h"
    42 #include <esmrcasplugindata.rsg>
    42 #include <esmrcasplugindata.rsg>
    43 #include <StringLoader.h>
    43 #include <stringloader.h>
    44 #include <aknnotewrappers.h>
    44 #include <aknnotewrappers.h>
    45 
    45 
    46 
    46 
    47 // Unnamed namespace for local definitions and functions
    47 // Unnamed namespace for local definitions and functions
    48 namespace { // codescanner::namespace
    48 namespace { // codescanner::namespace
   317     editorsPlugin->ExecuteViewL( entries, iInParams, iOutParams, *this );
   317     editorsPlugin->ExecuteViewL( entries, iInParams, iOutParams, *this );
   318 
   318 
   319     if (iOutParams.iAction == MAgnEntryUi::EMeetingSaved)
   319     if (iOutParams.iAction == MAgnEntryUi::EMeetingSaved)
   320     	{
   320     	{
   321     	TInt res = R_FS_MR_NOTE_SAVED;
   321     	TInt res = R_FS_MR_NOTE_SAVED;
   322         HBufC* prompt = StringLoader::LoadLC( res, CEikonEnv::Static() );
   322         HBufC* prompt = StringLoader::LoadLC( res, CEikonEnv::Static() );// codescanner::eikonenvstatic
   323         CAknConfirmationNote* dialog = new( ELeave )CAknConfirmationNote();
   323         CAknConfirmationNote* dialog = new( ELeave )CAknConfirmationNote();
   324         dialog->ExecuteLD( *prompt );
   324         dialog->ExecuteLD( *prompt );
   325         CleanupStack::PopAndDestroy( prompt );
   325         CleanupStack::PopAndDestroy( prompt );
   326     	}
   326     	}
   327 
   327 
   378 //
   378 //
   379 void CESMRCasPluginUiLauncher::AddOrganizerL()
   379 void CESMRCasPluginUiLauncher::AddOrganizerL()
   380     {
   380     {
   381     FUNC_LOG;
   381     FUNC_LOG;
   382     CMRMailboxUtils::TMailboxInfo defaultMailBox;
   382     CMRMailboxUtils::TMailboxInfo defaultMailBox;
   383     
   383     if ( KErrNotFound == iMBUtils.GetDefaultMRMailBoxL(defaultMailBox) )
   384     RArray<CMRMailboxUtils::TMailboxInfo> mailBoxes;
   384         {
   385 	CleanupClosePushL( mailBoxes );
   385         RArray<CMRMailboxUtils::TMailboxInfo> mailBoxes;
   386 	SupportedMailboxesL( iMBUtils, mailBoxes );
   386         CleanupClosePushL( mailBoxes );
   387         
   387 
   388     if ( KErrNone == iMBUtils.GetDefaultMRMailBoxL(defaultMailBox) )
   388         SupportedMailboxesL( iMBUtils, mailBoxes );
   389 		{
   389 
   390 			for ( TInt i(0); i < mailBoxes.Count(); i++ )
   390         TInt selectedMailbox( PromptForDefaultMailboxL(mailBoxes) );
   391 			{
   391 
   392 				if ( (defaultMailBox.iEntryId != mailBoxes[i].iEntryId) && 
   392         if ( KErrCancel != selectedMailbox )
   393 					( i == mailBoxes.Count() - 1 ) )
   393             {
   394 				{
   394             iMBUtils.SetDefaultMRMailBoxL( mailBoxes[selectedMailbox].iEntryId );
   395 				TInt selectedMailbox( PromptForDefaultMailboxL(mailBoxes) );
   395             iMBUtils.GetDefaultMRMailBoxL(defaultMailBox);
   396 				
   396             }
   397 				if ( KErrCancel != selectedMailbox )
   397         CleanupStack::PopAndDestroy( &mailBoxes );
   398 					{
   398 
   399 					iMBUtils.SetDefaultMRMailBoxL( mailBoxes[selectedMailbox].iEntryId );
   399         // This will leave if user cancelled the mailbox selection
   400 					iMBUtils.GetDefaultMRMailBoxL(defaultMailBox);
   400         User::LeaveIfError( selectedMailbox );
   401 					}
   401         }
   402 				
   402 
   403 				// This will leave if user cancelled the mailbox selection
       
   404 				User::LeaveIfError( selectedMailbox );
       
   405 				}
       
   406 			}
       
   407 		}
       
   408     
       
   409     CleanupStack::PopAndDestroy( &mailBoxes );
       
   410     
       
   411     delete iMtmUid; iMtmUid = NULL;
   403     delete iMtmUid; iMtmUid = NULL;
   412     iMtmUid = defaultMailBox.iMtmUid.Name().AllocL();
   404     iMtmUid = defaultMailBox.iMtmUid.Name().AllocL();
       
   405     
       
   406     // iMtmUid needs to be upper case due to resource file definition, 
       
   407     // so let's make sure 
       
   408     TPtr mtm( iMtmUid->Des() );
       
   409     mtm.UpperCase();
   413 
   410 
   414     //Set the organizer from the selected mailbox
   411     //Set the organizer from the selected mailbox
   415     CCalUser* organizer = CCalUser::NewL( defaultMailBox.iEmailAddress );
   412     CCalUser* organizer = CCalUser::NewL( defaultMailBox.iEmailAddress );
   416     CleanupStack::PushL(organizer );
   413     CleanupStack::PushL(organizer );
   417     iCalEntry->SetOrganizerL(organizer );
   414     iCalEntry->SetOrganizerL(organizer );