meetingui/attendeeview/UiSrc/CAttendeeViewerDlg.cpp
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2004 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:  Provides methods for .
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "cattendeeviewerdlg.h"
       
    22 #include "cattendeedialogbase.h"
       
    23 #include "mattendeeeng.h"
       
    24 #include "cattendeedetailsdlg.h"
       
    25 #include "attendeeviewuid.h"
       
    26 #include "attendeeview.hrh"
       
    27 
       
    28 #include <attendeeview_res.rsg>
       
    29 #include <stringloader.h>
       
    30 #include <caluser.h>
       
    31 #include <csxhelp/cale.hlp.hrh>
       
    32 #include <mrcommands.hrh>
       
    33 
       
    34 // ============================ MEMBER FUNCTIONS ==============================
       
    35 CAttendeeViewerDlg* CAttendeeViewerDlg::NewL( 
       
    36                                  MDesCArray *aArray,
       
    37                                  TInt aMenuBarResourceId,                                          
       
    38                                  TInt aOkMenuBarResourceId,
       
    39                                  MAttendeeEng& aEngine,
       
    40                                  TCoeHelpContext& aHelpContext,
       
    41                                  MAgnEntryUiCallback& aEntryUiCallback )
       
    42     {
       
    43     CAttendeeViewerDlg* self = NewLC( aArray,
       
    44                                       aMenuBarResourceId,
       
    45                                       aOkMenuBarResourceId,
       
    46                                       aEngine,
       
    47                                       aHelpContext,
       
    48                                       aEntryUiCallback );
       
    49     CleanupStack::Pop(self); //self
       
    50   
       
    51     return self;
       
    52     }
       
    53 
       
    54 CAttendeeViewerDlg* CAttendeeViewerDlg::NewLC( 
       
    55                                    MDesCArray *aArray,
       
    56                                    TInt aMenuBarResourceId,
       
    57                                    TInt aOkMenuBarResourceId,
       
    58                                    MAttendeeEng& aEngine,
       
    59                                    TCoeHelpContext& aHelpContext,
       
    60                                    MAgnEntryUiCallback& aEntryUiCallback )
       
    61     {
       
    62     CAttendeeViewerDlg* self = 
       
    63         new(ELeave)CAttendeeViewerDlg( aArray, 
       
    64                                        aEngine,
       
    65                                        aMenuBarResourceId,
       
    66                                        aOkMenuBarResourceId,
       
    67                                        aHelpContext,
       
    68                                        aEntryUiCallback );
       
    69     CleanupStack::PushL( self );
       
    70     self->ConstructL( aMenuBarResourceId );
       
    71     
       
    72     return self;
       
    73     }
       
    74 // ----------------------------------------------------------------------------
       
    75 // CAttendeeViewerDlg::CAttendeeViewerDlg
       
    76 // C++ default constructor can NOT contain any code, that
       
    77 // might leave.
       
    78 // ----------------------------------------------------------------------------
       
    79 //
       
    80 CAttendeeViewerDlg::CAttendeeViewerDlg( 
       
    81                                  MDesCArray *aArray, 
       
    82                                  MAttendeeEng& aEngine,
       
    83                                  TInt aMenuBarResourceId,
       
    84                                  TInt aOkMenuBarResourceId,
       
    85                                  TCoeHelpContext& aHelpContext,
       
    86                                  MAgnEntryUiCallback& aEntryUiCallback ):
       
    87     CAttendeeDialogBase( aArray, 
       
    88                          aEngine, 
       
    89                          aMenuBarResourceId, 
       
    90                          aOkMenuBarResourceId,
       
    91                          aEntryUiCallback ),
       
    92     iHelpContext( aHelpContext )
       
    93     {
       
    94 
       
    95     }
       
    96 
       
    97 // ---------------------------------------------------------
       
    98 // CAttendeeViewerDlg::~CAttendeeViewerDlg
       
    99 // ---------------------------------------------------------
       
   100 //
       
   101 CAttendeeViewerDlg::~CAttendeeViewerDlg()
       
   102     {
       
   103     }
       
   104 
       
   105 // ---------------------------------------------------------
       
   106 // CAttendeeViewerDlg::DynInitMenuPaneL
       
   107 // ---------------------------------------------------------
       
   108 //
       
   109 void CAttendeeViewerDlg::DynInitMenuPaneL( TInt aResourceId,
       
   110                                             CEikMenuPane* aMenuPane )
       
   111     {
       
   112 
       
   113     const TInt visible( ListBox()->Model()->NumberOfItems() );
       
   114     const TInt marked( ListBox()->SelectionIndexes()->Count() );
       
   115     switch( aResourceId )
       
   116         {      
       
   117         case R_ATTENDEEVIEW_VIEWER_MENU:
       
   118             {
       
   119             if ( iEntryUiCallback.IsCommandAvailable( EMRCommandRespondAccept )
       
   120                     && marked <= 0 )
       
   121                 {
       
   122                 aMenuPane->SetItemDimmed( EAttCmdRespond, EFalse );
       
   123                 }
       
   124             else
       
   125                 {
       
   126                 aMenuPane->SetItemDimmed( EAttCmdRespond, ETrue );
       
   127                 }
       
   128                 
       
   129             if ( marked > 0 )
       
   130                 {
       
   131                 aMenuPane->SetItemDimmed( EAttDetails, ETrue );
       
   132                 }
       
   133             if ( visible <= 0 ) 
       
   134                 {
       
   135                 aMenuPane->SetItemDimmed( EAttDetails, ETrue );
       
   136                 }
       
   137             break;
       
   138             }
       
   139         case R_ATTENDEEVIEW_VIEWER_CONTEXT_MENU:
       
   140             {
       
   141             if ( marked > 0 )
       
   142                 {                
       
   143                 aMenuPane->SetItemDimmed( EAttDetails, ETrue );                
       
   144                 aMenuPane->SetItemDimmed( EAttCmdRespond, ETrue );
       
   145                 aMenuPane->SetItemDimmed( EAttCmdSend, EFalse );                               
       
   146                 }
       
   147             else
       
   148                 {                
       
   149                 if ( iEntryUiCallback.IsCommandAvailable( EMRCommandRespondAccept ) )
       
   150                     {
       
   151                     aMenuPane->SetItemDimmed( EAttCmdRespond, EFalse );
       
   152                     }
       
   153                 else
       
   154                     {
       
   155                     aMenuPane->SetItemDimmed( EAttCmdRespond, ETrue );
       
   156                     }
       
   157                     
       
   158                 aMenuPane->SetItemDimmed( EAttCmdSend, ETrue );
       
   159                 }
       
   160             break;
       
   161             }
       
   162         default:
       
   163             {
       
   164             CAttendeeDialogBase::DynInitMenuPaneL( aResourceId, aMenuPane );
       
   165             break;
       
   166             }
       
   167         }
       
   168     }
       
   169 
       
   170 // ----------------------------------------------------
       
   171 // CAttendeeViewerDlg::MakeEmptyTextListBoxL
       
   172 // ----------------------------------------------------
       
   173 //
       
   174 void CAttendeeViewerDlg::MakeEmptyTextListBoxL()
       
   175     {
       
   176     HBufC* textFromResourceFile;
       
   177     textFromResourceFile = 
       
   178         StringLoader::LoadLC( R_ATTENDEE_VIEWER_EMPTY_TEXT, 
       
   179                               CEikonEnv::Static() );    
       
   180     ListBox()->View()->SetListEmptyTextL( *textFromResourceFile );
       
   181     CleanupStack::PopAndDestroy( textFromResourceFile ); 
       
   182     }
       
   183 
       
   184 // ----------------------------------------------------
       
   185 // CAttendeeDialogBase::DetailsCmdL
       
   186 // ---------------------------------------------------------
       
   187 //
       
   188 void CAttendeeViewerDlg::DetailsCmdL()
       
   189     {
       
   190     TInt index( ListBox()->CurrentItemIndex() );
       
   191     if ( index >= 0 && index < ListBox()->Model()->NumberOfItems() 
       
   192          && index < iEngine.NumberOfItems())
       
   193         {
       
   194         CPbkContactItem* item = iEngine.PbkContactItemL( index );
       
   195         if ( !item )
       
   196             {
       
   197             item = CreateContactL(
       
   198                     iEngine.At( index ).AgnAttendee()->Address() );
       
   199             }
       
   200         CleanupStack::PushL( item );
       
   201 
       
   202         CAttendeeDetailsDlg* dlg = CAttendeeDetailsDlg::NewL(
       
   203                                 item,
       
   204                                 &iEngine.ContactEngine(),
       
   205                                 iEngine.At( index ).AgnAttendee()->StatusL(),
       
   206                                 EFalse ); 
       
   207         dlg->RunLD();
       
   208 
       
   209         CleanupStack::PopAndDestroy( item );
       
   210         }
       
   211     }
       
   212 
       
   213 // -----------------------------------------------------------------------------
       
   214 // CAttendeeDialogBase::GetHelpContext
       
   215 // -----------------------------------------------------------------------------
       
   216 //
       
   217 void CAttendeeViewerDlg::GetHelpContext( TCoeHelpContext& aContext ) const
       
   218     {
       
   219     
       
   220     //If help text was given in construction use it 
       
   221     if(!iHelpContext.IsNull())
       
   222         {
       
   223         aContext = iHelpContext;
       
   224         }
       
   225     else
       
   226         {
       
   227         //Remove comments after new cale.hlp.hrh is ready
       
   228         //aContext.iContext = KCALE_HLP_ATTENDEE_VIEW;
       
   229         //aContext.iMajor = TUid::Uid( KEcomDllUID );
       
   230         }    
       
   231     }
       
   232    
       
   233 // End of File