meetingrequest/mrgui/src/cesmrtrackingviewdialog.cpp
branchRCL_3
changeset 12 4ce476e64c59
parent 0 8466d47a6819
child 16 b5fbb9b25d57
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
     1 /*
     1 /*
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 *  Description : ESMR tracking view dialog
    14 *  Description : ESMR tracking view dialog
    15 *  Version     : %version: tr1sido#9 %
    15 *  Version     : %version: e002sa33#15 %
    16 *
    16 *
    17 */
    17 */
    18 
    18 
    19 #include "emailtrace.h"
    19 #include "emailtrace.h"
    20 #include "cesmrtrackingviewdialog.h"
    20 #include "cesmrtrackingviewdialog.h"
    21 
    21 
    22 // SYSTEM INCLUDE
    22 // SYSTEM INCLUDE
    23 #include <AknUtils.h>
    23 #include <aknutils.h>
    24 #include <StringLoader.h>
    24 #include <stringloader.h>
    25 #include <calentry.h>
    25 #include <calentry.h>
    26 #include <AiwServiceHandler.h>
    26 #include <magnentryui.h>
    27 #include <featmgr.h>
       
    28 #include <bldvariant.hrh>
       
    29 //<cmail>
    27 //<cmail>
    30 #include <featmgr.h>
       
    31 //</cmail>
       
    32 
       
    33 #include "cesmrpolicy.h"
    28 #include "cesmrpolicy.h"
    34 //</cmail>
    29 //</cmail>
    35 #include <esmrgui.rsg>
    30 #include <esmrgui.rsg>
    36 
    31 
    37 #include "esmrgui.hrh"
    32 #include "esmrgui.hrh"
    38 #include "cesmrview.h"
    33 #include "cesmrtrackingview.h"
    39 #include "cesmrviewerfieldstorage.h"
    34 #include "cesmrviewerfieldstorage.h"
    40 #include "mesmrcalentry.h"
    35 #include "mesmrcalentry.h"
    41 #include "cesmrcontactmenuhandler.h"
    36 #include "cesmrcontactmenuhandler.h"
    42 #include "esmrconfig.hrh"
    37 #include "esmrconfig.hrh"
    43 #include "esmrinternaluid.h"
    38 #include "esmrinternaluid.h"
    65 // ---------------------------------------------------------------------------
    60 // ---------------------------------------------------------------------------
    66 // CESMRTrackingViewDialog::NewL
    61 // CESMRTrackingViewDialog::NewL
    67 // ---------------------------------------------------------------------------
    62 // ---------------------------------------------------------------------------
    68 //
    63 //
    69 CESMRTrackingViewDialog* CESMRTrackingViewDialog::NewL(
    64 CESMRTrackingViewDialog* CESMRTrackingViewDialog::NewL(
    70 		CESMRPolicy* aPolicy,
    65 		const CESMRPolicy& aPolicy,
    71 		MESMRCalEntry& aEntry,
    66 		MESMRCalEntry& aEntry,
    72 		MAgnEntryUiCallback& aCallback )
    67 		MAgnEntryUiCallback& aCallback )
    73     {
    68     {
    74     FUNC_LOG;
    69     FUNC_LOG;
    75     CESMRTrackingViewDialog* self =
    70     CESMRTrackingViewDialog* self =
    76 	new (ELeave) CESMRTrackingViewDialog(aEntry,aCallback);
    71 	new (ELeave) CESMRTrackingViewDialog( aPolicy, aEntry, aCallback);
    77 	CleanupStack::PushL( self );
    72 	CleanupStack::PushL( self );
    78 	self->ConstructL( aPolicy );
    73 	self->ConstructL();
    79 	CleanupStack::Pop( self );
    74 	CleanupStack::Pop( self );
    80 	return self;
    75 	return self;
    81     }
    76     }
    82 
    77 
    83 // ---------------------------------------------------------------------------
    78 // ---------------------------------------------------------------------------
    85 // ---------------------------------------------------------------------------
    80 // ---------------------------------------------------------------------------
    86 //
    81 //
    87 CESMRTrackingViewDialog::~CESMRTrackingViewDialog()
    82 CESMRTrackingViewDialog::~CESMRTrackingViewDialog()
    88     {
    83     {
    89     FUNC_LOG;
    84     FUNC_LOG;
    90     if ( iFeatureManagerInitialized )
    85     
    91         {
       
    92         FeatureManager::UnInitializeLib();
       
    93         }
       
    94 
       
    95     if ( iServiceHandler )
       
    96         {
       
    97         iServiceHandler->DetachMenu(R_MR_TRACKING_VIEW_MENU, R_PS_AIW_INTEREST);
       
    98         delete iServiceHandler;
       
    99         }
       
   100 
       
   101     iESMRStatic.Close();
    86     iESMRStatic.Close();
   102     }
    87     }
   103 
    88 
   104 // ---------------------------------------------------------------------------
    89 // ---------------------------------------------------------------------------
   105 // CESMRTrackingViewDialog::CESMRTrackingViewDialog
    90 // CESMRTrackingViewDialog::CESMRTrackingViewDialog
   106 // ---------------------------------------------------------------------------
    91 // ---------------------------------------------------------------------------
   107 //
    92 //
   108 CESMRTrackingViewDialog::CESMRTrackingViewDialog( 
    93 CESMRTrackingViewDialog::CESMRTrackingViewDialog(
       
    94         const CESMRPolicy& aPolicy,
   109 		MESMRCalEntry& aEntry,
    95 		MESMRCalEntry& aEntry,
   110 		MAgnEntryUiCallback& aCallback) :
    96 		MAgnEntryUiCallback& aCallback) :
   111     iEntry( aEntry ),
    97     iPolicy( aPolicy ),
       
    98 	iEntry( aEntry ),
   112     iCallback(aCallback)
    99     iCallback(aCallback)
   113     {
   100     {
   114     FUNC_LOG;
   101     FUNC_LOG;
   115     // Do nothing
   102     // Do nothing
   116     }
   103     }
   117 
   104 
   118 // ---------------------------------------------------------------------------
   105 // ---------------------------------------------------------------------------
   119 // CESMRTrackingViewDialog::ConstructL
   106 // CESMRTrackingViewDialog::ConstructL
   120 // ---------------------------------------------------------------------------
   107 // ---------------------------------------------------------------------------
   121 //
   108 //
   122 void CESMRTrackingViewDialog::ConstructL(CESMRPolicy* aPolicy)
   109 void CESMRTrackingViewDialog::ConstructL()
   123     {
   110     {
   124     FUNC_LOG;
   111     FUNC_LOG;
   125     CAknDialog::ConstructL ( R_TRACKING_DIALOG_MENUBAR );
   112     CAknDialog::ConstructL ( R_TRACKING_DIALOG_MENUBAR );
   126     iPolicy = aPolicy;
       
   127     iESMRStatic.ConnectL();
   113     iESMRStatic.ConnectL();
   128     iESMRStatic.ContactMenuHandlerL().Reset();
   114     iESMRStatic.ContactMenuHandlerL().Reset();
   129 
   115 
   130     TRect clientRect;
   116     TRect clientRect;
   131     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, clientRect );
   117     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, clientRect );
   132 
       
   133     TBool responseReady(EFalse);
       
   134 
       
   135     FeatureManager::InitializeLibL();
       
   136     iFeatureManagerInitialized = ETrue;
       
   137 
       
   138 	// <cmail> remove custom feature KFeatureIdPrintingFrameworkCalendarPlugin 
       
   139 	// </cmail>		
       
   140 
   118 
   141     // Sort the attendees list so that Req attendeees comes  first
   119     // Sort the attendees list so that Req attendeees comes  first
   142     // and then opt attendees
   120     // and then opt attendees
   143     SortAttendeesL();
   121     SortAttendeesL();
   144 
   122 
   145     // Set the index of builder to zero so that
   123     // Set the index of builder to zero so that
   146     // participant field is created from index.
   124     // participant field is created from index.
   147 
   125 
   148     iESMRStatic.SetCurrentFieldIndex(0);
   126     iESMRStatic.SetCurrentFieldIndex(0);
   149 
   127 
   150     CESMRViewerFieldStorage* storage =
   128     iView = CESMRTrackingView::NewL( iEntry, clientRect,
   151              CESMRViewerFieldStorage::NewL(
   129             CountAttendeesL(CCalAttendee::EReqParticipant),
   152                      aPolicy,
   130             CountAttendeesL(CCalAttendee::EOptParticipant));
   153                      NULL,
   131     iView->SetParentDialog(this);
   154                      responseReady,
   132 
   155                      *this,
       
   156                      CountAttendeesL(CCalAttendee::EReqParticipant),
       
   157                      CountAttendeesL(CCalAttendee::EOptParticipant) );
       
   158 
       
   159     CleanupStack::PushL( storage );
       
   160     // storage ownership is transferred to CESMRView
       
   161     iView = CESMRView::NewL(storage, iEntry, clientRect );
       
   162     CleanupStack::Pop( storage ); 
       
   163      
       
   164     if ( iEntry.Entry().SummaryL().Length() == 0 )
   133     if ( iEntry.Entry().SummaryL().Length() == 0 )
   165 		 {
   134 		 {
   166 		 // if no title, set unnamed text:
   135 		 // if no title, set unnamed text:
   167 		 HBufC* title = StringLoader::LoadLC (R_QTN_MEET_REQ_CONFLICT_UNNAMED);
   136 		 HBufC* title = StringLoader::LoadLC (R_QTN_MEET_REQ_CONFLICT_UNNAMED);
   168 		 iView->SetTitleL( *title, ETrue );
   137 		 iView->SetTitleL( *title );
   169 		 CleanupStack::PopAndDestroy( title );
   138 		 CleanupStack::PopAndDestroy( title );
   170 		 }
   139 		 }
   171     else
   140     else
   172          {
   141          {
   173          iView->SetTitleL( iEntry.Entry().SummaryL(), ETrue );
   142          iView->SetTitleL( iEntry.Entry().SummaryL() );
   174          }
   143          }
       
   144 
       
   145     iMenuBar->SetContextMenuTitleResourceId( R_MR_TRACKING_VIEW_CONTEXT_MENU );
   175     }
   146     }
   176 
   147 
   177 // ---------------------------------------------------------------------------
   148 // ---------------------------------------------------------------------------
   178 // CESMRTrackingViewDialog::CreateCustomControlL
   149 // CESMRTrackingViewDialog::CreateCustomControlL
   179 // ---------------------------------------------------------------------------
   150 // ---------------------------------------------------------------------------
   202 TKeyResponse CESMRTrackingViewDialog::OfferKeyEventL
   173 TKeyResponse CESMRTrackingViewDialog::OfferKeyEventL
   203         (const TKeyEvent& aEvent, TEventCode aType)
   174         (const TKeyEvent& aEvent, TEventCode aType)
   204     {
   175     {
   205     FUNC_LOG;
   176     FUNC_LOG;
   206     TKeyResponse response = CAknDialog::OfferKeyEventL( aEvent, aType );
   177     TKeyResponse response = CAknDialog::OfferKeyEventL( aEvent, aType );
   207 	
   178 
   208     if ( ( response == EKeyWasNotConsumed && aEvent.iCode != EKeyEscape)
   179     if ( ( response == EKeyWasNotConsumed && aEvent.iCode != EKeyEscape)
   209 		   && (!MenuShowing()) )
   180 		   && (!MenuShowing()) )
   210 		{
   181 		{
   211 		response = iView->OfferKeyEventL( aEvent, aType );
   182 		response = iView->OfferKeyEventL( aEvent, aType );
   212 		}
   183 		}
   226         {
   197         {
   227         case EAknSoftkeyOptions:
   198         case EAknSoftkeyOptions:
   228             {
   199             {
   229             CAknDialog::DisplayMenuL();
   200             CAknDialog::DisplayMenuL();
   230             break;
   201             break;
   231             }            
   202             }
   232         case EESMRCmdBack:
   203         case EESMRCmdBack:
   233             {
   204             {
   234             res = ETrue;
   205             res = ETrue;
   235             break;
   206             break;
   236             }            
   207             }
   237         case EESMRCmdCall:
   208         case EESMRCmdCall:
   238             {
   209             {
   239             iESMRStatic.ContactMenuHandlerL().ExecuteOptionsMenuL( 
   210             iESMRStatic.ContactMenuHandlerL().ExecuteOptionsMenuL(
   240 												EESMRCmdActionMenuFirst );
   211 												EESMRCmdActionMenuFirst );
   241             break;
   212             break;
   242             }
   213             }
   243         default:
   214         default:
   244             {
   215             {
   245             res = CAknDialog::OkToExitL( aButtonId );
   216             res = CAknDialog::OkToExitL( aButtonId );
   246             break;
   217             break;
   247             }       
   218             }
   248         }
   219         }
   249 
   220 
   250     return res;
   221     return res;
   251     }
   222     }
   252 
   223 
   257 TInt CESMRTrackingViewDialog::CountAttendeesL( // codescanner::intleaves
   228 TInt CESMRTrackingViewDialog::CountAttendeesL( // codescanner::intleaves
   258         CCalAttendee::TCalRole aRole)
   229         CCalAttendee::TCalRole aRole)
   259     {
   230     {
   260     FUNC_LOG;
   231     FUNC_LOG;
   261     RPointerArray<CCalAttendee>& calAttendeeList = iEntry.Entry().AttendeesL();
   232     RPointerArray<CCalAttendee>& calAttendeeList = iEntry.Entry().AttendeesL();
   262     
   233 
   263     TInt totalParticipants = calAttendeeList.Count();
   234     TInt totalParticipants = calAttendeeList.Count();
   264     TInt totalAttendees(0);
   235     TInt totalAttendees(0);
   265 
   236 
   266     for (TInt i=0; i< totalParticipants; i++)
   237     for (TInt i=0; i< totalParticipants; i++)
   267         {
   238         {
   332     {
   303     {
   333     FUNC_LOG;
   304     FUNC_LOG;
   334     CAknDialog::ProcessCommandL( aCommand );
   305     CAknDialog::ProcessCommandL( aCommand );
   335     switch ( aCommand )
   306     switch ( aCommand )
   336         {
   307         {
   337         case EESMRCmdPrint: // Fall through
       
   338         case EESMRCmdPrint_Reserved1: // Fall through
       
   339         case EESMRCmdPrint_Reserved2: // Fall through
       
   340         case EESMRCmdPrint_Reserved3: // Fall through
       
   341         case EESMRCmdPrint_Reserved4:
       
   342             {
       
   343             this->MakeVisible(EFalse); 
       
   344             HandlePrintCommandL(aCommand);
       
   345             this->MakeVisible(ETrue); 
       
   346             break;
       
   347             }
       
   348         case EAknCmdExit:
   308         case EAknCmdExit:
   349         	{
   309         	{
   350             TryExitL( aCommand );
   310             TryExitL( aCommand );
   351             break;
   311             break;
   352         	}
   312         	}
   355             iView->LaunchViewerHelpL();
   315             iView->LaunchViewerHelpL();
   356             break;
   316             break;
   357             }
   317             }
   358         default:
   318         default:
   359         	{
   319         	{
   360             if ( aCommand >= EESMRCmdActionMenuFirst && 
   320             if ( aCommand >= EESMRCmdActionMenuFirst &&
   361             	 aCommand <= EESMRCmdActionMenuLast )
   321             	 aCommand <= EESMRCmdActionMenuLast )
   362                 {
   322                 {
   363                 iESMRStatic.ContactMenuHandlerL().ExecuteOptionsMenuL( 
   323                 iESMRStatic.ContactMenuHandlerL().ExecuteOptionsMenuL(
   364 																aCommand );
   324 																aCommand );
   365                 }
   325                 }
   366             else
   326             else
   367                 {
   327                 {
   368                 __ASSERT_DEBUG( EFalse, 
   328                 __ASSERT_DEBUG( EFalse,
   369                 		Panic( EESMRTrackingVieweDlgInvalidCommand ) );
   329                 		Panic( EESMRTrackingVieweDlgInvalidCommand ) );
   370                 }
   330                 }
   371             break;
   331             break;
   372         	}
   332         	}
   373         }
   333         }
   380 void CESMRTrackingViewDialog::DynInitMenuPaneL(
   340 void CESMRTrackingViewDialog::DynInitMenuPaneL(
   381 		TInt aResourceId,
   341 		TInt aResourceId,
   382         CEikMenuPane* aMenuPane )
   342         CEikMenuPane* aMenuPane )
   383     {
   343     {
   384     FUNC_LOG;
   344     FUNC_LOG;
   385     if ( iServiceHandler )
       
   386         {
       
   387         if ( iServiceHandler->HandleSubmenuL ( *aMenuPane ) )
       
   388             {
       
   389             return;
       
   390             }
       
   391         }
       
   392     if ( aResourceId == R_ACTION_MENU )
   345     if ( aResourceId == R_ACTION_MENU )
   393         {
   346         {
   394         iESMRStatic.ContactMenuHandlerL().InitOptionsMenuL( aMenuPane );
   347         iESMRStatic.ContactMenuHandlerL().InitOptionsMenuL( aMenuPane );
   395         }
   348         }
   396 
   349 
   397     if ( aResourceId == R_MR_TRACKING_VIEW_MENU )
   350     if ( aResourceId == R_MR_TRACKING_VIEW_MENU )
   398         {
   351         {
   399 	    if (FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration ))
   352         aMenuPane->SetItemDimmed( EESMRCmdActionMenu,
   400 		   {
       
   401 		   // remove help support in pf5250
       
   402 		   aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue);      
       
   403 		   }
       
   404 		
       
   405 	    // <cmail> remove custom feature KFeatureIdPrintingFrameworkCalendarPlugin 
       
   406 	    // </cmail>				
       
   407         aMenuPane->SetItemDimmed( EESMRCmdPrint, ETrue );
       
   408 
       
   409         aMenuPane->SetItemDimmed( EESMRCmdActionMenu, 
       
   410         		!iESMRStatic.ContactMenuHandlerL().OptionsMenuAvailable() );
   353         		!iESMRStatic.ContactMenuHandlerL().OptionsMenuAvailable() );
   411         }
   354         }
   412     }
   355     }
   413 
   356 
   414 // ---------------------------------------------------------------------------
   357 // ---------------------------------------------------------------------------
   431     FUNC_LOG;
   374     FUNC_LOG;
   432     return ExecuteLD( R_MRTRACKING_DIALOG );
   375     return ExecuteLD( R_MRTRACKING_DIALOG );
   433     }
   376     }
   434 
   377 
   435 // ---------------------------------------------------------------------------
   378 // ---------------------------------------------------------------------------
   436 // CESMRTrackingViewDialog::HandlePrintCommandL
       
   437 // ---------------------------------------------------------------------------
       
   438 //
       
   439 void CESMRTrackingViewDialog::HandlePrintCommandL(TInt aCommand)
       
   440     {
       
   441     FUNC_LOG;
       
   442     CAiwGenericParamList& inParams = iServiceHandler->InParamListL();
       
   443 
       
   444     // Param date
       
   445 
       
   446     TCalTime startTime = iEntry.Entry().StartTimeL();
       
   447 
       
   448     TAiwGenericParam dateParam( EGenericParamDateTime );
       
   449     TTime activeDay = startTime.TimeUtcL();
       
   450 
       
   451     TAiwGenericParam calendarParam( EGenericParamCalendarItem );
       
   452     calendarParam.Value().Set( TUid::Uid(iEntry.Entry().LocalUidL()) );
       
   453     inParams.AppendL( calendarParam );
       
   454 
       
   455     // Append date param
       
   456     dateParam.Value().Set( activeDay );
       
   457     inParams.AppendL( dateParam );
       
   458 
       
   459     const TUid uid( TUid::Uid( KUidCalendarApplication ) );
       
   460     TAiwGenericParam uidParam( EGenericParamApplication );
       
   461     uidParam.Value().Set( uid );
       
   462     inParams.AppendL( uidParam );
       
   463 
       
   464     // Execute service command with given parameters
       
   465     iServiceHandler->ExecuteMenuCmdL( aCommand,
       
   466                                       inParams,
       
   467                                       iServiceHandler->OutParamListL(),
       
   468                                       0,
       
   469                                       NULL );
       
   470 
       
   471     }
       
   472 
       
   473 // ---------------------------------------------------------------------------
       
   474 // CESMRTrackingViewDialog::HandleFieldEventL
   379 // CESMRTrackingViewDialog::HandleFieldEventL
   475 // ---------------------------------------------------------------------------
   380 // ---------------------------------------------------------------------------
   476 //
   381 
   477 void CESMRTrackingViewDialog::HandleFieldEventL(
   382 void CESMRTrackingViewDialog::HandleListEventL()
   478         const MESMRFieldEvent& /*aEvent*/ )
   383     {
   479     {
   384     FUNC_LOG;
   480     FUNC_LOG;
   385     iMenuBar->TryDisplayContextMenuBarL();
   481     // From MESMRFieldEventObserver. Do nothing
       
   482     }
   386     }
   483 
   387 
   484 // End of File
   388 // End of File
   485 
   389