wvuing/wvuiave/AppSrc/CCAAccessListDialog.cpp
branchRCL_3
changeset 13 a941bc465d9f
parent 0 094583676ce7
equal deleted inserted replaced
12:6ca72c0fe49a 13:a941bc465d9f
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Access list dialog. This dialog displays accessed persons.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include	"CCAAccessListDialog.h"
       
    21 #include	"chatngclient.hrh"
       
    22 #include	"CCAAppUi.h"
       
    23 #include	"CCAAccessArray.h"
       
    24 #include	"CCAStatusPaneHandler.h"
       
    25 #include    "ChatDefinitions.h"
       
    26 #include    "CAExternalInterface.h"
       
    27 #include    "ChatDebugPrint.h"
       
    28 #include    "IMUtils.h"
       
    29 #include    "IMDialogUtils.h"
       
    30 #include    "CAUtils.h"
       
    31 #include    "CCAApp.h"
       
    32 #include    "CCAVariantFactory.h"
       
    33 #include    "CCAContactSelectionDialog.h"
       
    34 #include    "MCASkinVariant.h"
       
    35 #include    "MCAMainViewArrayPC.h"
       
    36 #include    "MCASettingsPC.h"
       
    37 #include    "MCAProcessManager.h"
       
    38 #include    "MCAGroupPropertiesPC.h"
       
    39 
       
    40 
       
    41 #include	<aknlists.h>
       
    42 #include	<Chatng.rsg>
       
    43 #include	<aknpopup.h>
       
    44 #include	<AknMessageQueryDialog.h>
       
    45 #include	<stringloader.h>
       
    46 #include	<eikmenub.h>
       
    47 #include    <hlplch.h>
       
    48 #include    <csxhelp/imng.hlp.hrh>
       
    49 #include    <featmgr.h>
       
    50 
       
    51 // The Settings have been moved to Cenrep (also retained in the Resource file),
       
    52 // so the enums for keys and central repository header is added here
       
    53 #include 	"VariantKeys.h"
       
    54 // local variation
       
    55 #include    "IMPrivateCRKeys.h"
       
    56 #include    "IMVariant.hrh"
       
    57 
       
    58 // ================= MEMBER FUNCTIONS =======================
       
    59 // ---------------------------------------------------------
       
    60 // CCAAccessListDialog::CCAAccessListDialog
       
    61 // C++ default constructor can NOT contain any code, that
       
    62 // might leave.
       
    63 // ---------------------------------------------------------
       
    64 //
       
    65 //
       
    66 CCAAccessListDialog::CCAAccessListDialog( CCAStatusPaneHandler& aTitlePane,
       
    67                                           CDesCArray& aUserList,
       
    68                                           TBool& aIsMemberAccessModified,
       
    69                                           TBool aFirstItemCanBeEdited,
       
    70                                           TBool aRemoveAllShouldExitDialog,
       
    71                                           TInt aTitleResource,
       
    72                                           TListType aListType,
       
    73                                           CDesCArray* aFilterList,
       
    74                                           CDesCArray* aFilterList2 )
       
    75         :   iTitlePane( &aTitlePane ),
       
    76         iUserList( aUserList ),
       
    77         iIsMemberAccessModified( aIsMemberAccessModified ),
       
    78         iFirstItemCanBeEdited( aFirstItemCanBeEdited ),
       
    79         iRemoveAllShouldExitDialog( aRemoveAllShouldExitDialog ),
       
    80         iTitleResource( aTitleResource ),
       
    81         iFilterList( aFilterList ),
       
    82         iFilterList2( aFilterList2 ),
       
    83         iListType( aListType ),
       
    84         iAppUi( static_cast<CCAAppUi*>( CCoeEnv::Static()->AppUi() ) ),
       
    85         iGroupPropertiesPC( iAppUi->GetProcessManager().GetGroupPropertiesPC() )
       
    86     {
       
    87 
       
    88     }
       
    89 // ---------------------------------------------------------
       
    90 // CCAAccessListDialog::ConstructL()
       
    91 // destructor
       
    92 // ---------------------------------------------------------
       
    93 //
       
    94 void CCAAccessListDialog::ConstructL( TInt aMenuBarResourceId )
       
    95     {
       
    96     // other resources depends of aTitleResource
       
    97     switch ( iTitleResource )
       
    98         {
       
    99         case R_CHATCLIENT_EDITRIGHT_TITLE:
       
   100             {
       
   101             iMenuBarResourceId = R_CHATCLIENT_EDITINGRIGHTS_MENUBAR_POPUP_MENU;
       
   102             iDeletePromptResourceId = R_DELETE_EDITINGRIGHTS_PROMPT;
       
   103             iDeleteAllPromptResourceId = R_DELETE_ALL_EDITINGRIGHTS_PROMPT;
       
   104             iHelpTopic = &KIMNG_HLP_GROUP_EDIT;
       
   105             // not used, as the user's WVID is always displayed
       
   106             iEmptyText = NULL;
       
   107             break;
       
   108             }
       
   109         case R_CHATCLIENT_BANLIST_TITLE:
       
   110             {
       
   111             iMenuBarResourceId = R_CHATCLIENT_BANNEDLIST_MENUBAR_POPUP_MENU;
       
   112             iDeletePromptResourceId = R_DELETE_BANNED_PROMPT;
       
   113             iDeleteAllPromptResourceId = R_DELETE_ALL_BANNED_PROMPT;
       
   114             iHelpTopic = &KIMNG_HLP_GROUP_BAN;
       
   115             iEmptyText = IMUtils::CombineStringFromResourceLC( R_QTN_CHAT_EMPTY_BANNED_LIST_PRIMARY, R_QTN_CHAT_EMPTY_BANNED_LIST );
       
   116             CleanupStack::Pop( iEmptyText );
       
   117             break;
       
   118             }
       
   119         default: // currently same as R_CHATCLIENT_ACLIST_TITLE
       
   120             {
       
   121             iMenuBarResourceId = R_CHATCLIENT_ACCESSLIST_MENUBAR_POPUP_MENU;
       
   122             iDeletePromptResourceId = R_DELETE_ACCESS_PROMPT;
       
   123             iDeleteAllPromptResourceId = R_DELETE_ALL_ACCESS_PROMPT;
       
   124             iHelpTopic = &KIMNG_HLP_ACCLIST ;
       
   125             iEmptyText = IMUtils::CombineStringFromResourceLC( R_QTN_CHAT_EMPTY_ACCESS_LIST_PRIMARY, R_QTN_CHAT_EMPTY_ACCESS_LIST );
       
   126             CleanupStack::Pop( iEmptyText );
       
   127             break;
       
   128             }
       
   129         }
       
   130 
       
   131     // read it here and store it, faster than re-reading every time in
       
   132     // DisplayManualDataQueryL
       
   133 
       
   134     iTextualInputMode = IMUtils::IntResourceValueL( RSC_CHAT_VARIATION_USERID_TEXTUAL_INPUTMODE );
       
   135 
       
   136     CAknDialog::ConstructL( aMenuBarResourceId );
       
   137     }
       
   138 
       
   139 // ---------------------------------------------------------
       
   140 // CCAAccessListDialog::~CCAAccessListDialog()
       
   141 // destructor
       
   142 // ---------------------------------------------------------
       
   143 //
       
   144 CCAAccessListDialog::~CCAAccessListDialog()
       
   145     {
       
   146     // no need to mess with the tab group, since this dialog is always invoked
       
   147     // via group properties dialog.  otherwise the tab group flashes once if we
       
   148     // prohibit it in constructor and restore in destructor.
       
   149 
       
   150     delete iWVUserId;
       
   151     if ( iPopupMenu )
       
   152         {
       
   153         iEikonEnv->EikAppUi()->RemoveFromStack( iPopupMenu );
       
   154         delete iPopupMenu;
       
   155         }
       
   156     delete iItemArray;
       
   157 
       
   158     delete iEmptyText;
       
   159     }
       
   160 
       
   161 // ---------------------------------------------------------
       
   162 // CCAAccessListDialog::DisplayManualDataQueryL()
       
   163 // This method launches dataquery
       
   164 // (other items were commented in a header).
       
   165 // ---------------------------------------------------------
       
   166 //
       
   167 void CCAAccessListDialog::DisplayManualDataQueryL()
       
   168     {
       
   169     CAknSingleStyleListBox* listBox = static_cast< CAknSingleStyleListBox* >
       
   170                                       ( Control( EChatClientControlIdAccessList ) );
       
   171 
       
   172     HBufC* prompt = iEikonEnv->AllocReadResourceLC(
       
   173                         RSC_CHAT_ACCESSLIST_PROMPT );
       
   174     TPtr wvuserid( iWVUserId->Des() );
       
   175 
       
   176     CAknTextQueryDialog* dlg = CAknTextQueryDialog::NewL( wvuserid,
       
   177                                                           CAknQueryDialog::ENoTone );
       
   178 
       
   179     dlg->SetPredictiveTextInputPermitted( ETrue ); // T9
       
   180     TInt result( dlg->ExecuteLD(
       
   181                      iTextualInputMode ?
       
   182                      R_CHATCLIENT_ACCESSLIST_MANUAL_QUERY :
       
   183                      R_CHATCLIENT_ACCESSLIST_MANUAL_QUERY2,
       
   184                      *prompt ) );
       
   185 
       
   186     //Codescanner warning ignored
       
   187     CleanupStack::PopAndDestroy(); //prompt
       
   188 
       
   189     if ( ( result == EAknSoftkeyOk ) || ( result == EAknSoftkeyYes )  )
       
   190         {
       
   191         if ( CanUserBeAddedToListL( iUserList, *iWVUserId ) )
       
   192             {
       
   193             iItemArray->AppendL( *iWVUserId );
       
   194             iIsMemberAccessModified = ETrue;
       
   195             }
       
   196         listBox->HandleItemAdditionL();
       
   197         }
       
   198     }
       
   199 
       
   200 // ---------------------------------------------------------
       
   201 // CCAAccessListDialog::DisplayPopupFriendsListL()
       
   202 // This method launches popup list full of friends
       
   203 // (other items were commented in a header).
       
   204 // ---------------------------------------------------------
       
   205 //
       
   206 void CCAAccessListDialog::DisplayPopupFriendsListL()
       
   207     {
       
   208     MCAMainViewArrayPC& mainViewArrayPC = *( iAppUi->GetProcessManager().GetArrayInterface() );
       
   209     MCASettingsPC& settingsPC = *iAppUi->GetProcessManager().GetSettingsInterface();
       
   210 
       
   211 
       
   212     CDesCArray* selectedContacts = new ( ELeave ) CDesCArrayFlat( KArrayGranularity );
       
   213     CleanupStack::PushL( selectedContacts );
       
   214 
       
   215     MCASkinVariant* skinVar = static_cast<CCAApp*>( iAppUi->Application() )
       
   216                               ->VariantFactory()->SkinVariantL();
       
   217 
       
   218 
       
   219     // show selection dialog
       
   220     TBool contacts( CCAContactSelectionDialog::ShowDialogL(
       
   221                         *selectedContacts,
       
   222                         mainViewArrayPC,
       
   223                         *skinVar,
       
   224                         settingsPC,
       
   225                         iAppUi->MbmFullPath(),
       
   226                         TEnumsPC::EMultiSelect,
       
   227                         R_CONTACT_SELECTION_DIALOG,
       
   228                         *iAppUi->CAStatusPane(),
       
   229                         NULL,
       
   230                         TEnumsPC::EFilterNotDefined,
       
   231                         TEnumsPC::EFilterNotDefined,
       
   232                         ETrue ) );
       
   233     if ( !contacts )
       
   234         {
       
   235         // no contacts. Note: code scanner warning is ignored
       
   236         CleanupStack::PopAndDestroy(); // selectedContacts.Close()
       
   237         return;
       
   238         }
       
   239 
       
   240     // handle selected contacts (if any)
       
   241     TInt count( selectedContacts->MdcaCount() );
       
   242     CHAT_DP( D_CHAT_LIT( "selection count %d" ), count );
       
   243     for ( TInt i( 0 ); i < count; ++i )
       
   244         {
       
   245         TPtrC wvid( selectedContacts->MdcaPoint( i ) );
       
   246         CHAT_DP( D_CHAT_LIT( "..adding %S to access list" ), &wvid );
       
   247 
       
   248         if ( CanUserBeAddedToListL( iUserList, wvid ) )
       
   249             {
       
   250             iItemArray->AppendL( wvid );
       
   251             iIsMemberAccessModified = ETrue;
       
   252             }
       
   253         }
       
   254 
       
   255     if ( iIsMemberAccessModified )
       
   256         {
       
   257         CAknSingleStyleListBox* listBox = static_cast< CAknSingleStyleListBox* >
       
   258                                           ( Control( EChatClientControlIdAccessList ) );
       
   259         listBox->HandleItemAdditionL();
       
   260         }
       
   261     //Codescanner warning ignored
       
   262     CleanupStack::PopAndDestroy(); // selectedContacts.Close()
       
   263     }
       
   264 
       
   265 // ---------------------------------------------------------
       
   266 // CCAAccessListDialog::ProcessCommandL( TInt aCommand )
       
   267 // This method catches commands
       
   268 // (other items were commented in a header).
       
   269 // ---------------------------------------------------------
       
   270 //
       
   271 void CCAAccessListDialog::ProcessCommandL( TInt aCommand )
       
   272     {
       
   273     HideMenu();
       
   274     if ( iPopupMenu->IsDisplayed() )
       
   275         {
       
   276         iPopupMenu->StopDisplayingMenuBar();
       
   277         }
       
   278 
       
   279     switch ( aCommand )
       
   280         {
       
   281         case EChatClientAccessListManual:
       
   282             {
       
   283             DisplayManualDataQueryL();
       
   284             break;
       
   285             }
       
   286         case EChatClientAccessListFriend:
       
   287             {
       
   288             DisplayPopupFriendsListL();
       
   289             break;
       
   290             }
       
   291         case EChatClientAccessListRemove:
       
   292             {
       
   293             DisplayRmvConfirmationL();
       
   294             break;
       
   295             }
       
   296         case EChatClientAccessListRemoveAll:
       
   297             {
       
   298             DisplayRmvAllConfirmationL();
       
   299             break;
       
   300             }
       
   301         case EChatClientCmdExit:
       
   302             {
       
   303             iEikonEnv->EikAppUi()->HandleCommandL( EAknSoftkeyExit );
       
   304             break;
       
   305             }
       
   306         case EChatClientCmdHelp:
       
   307             {
       
   308             HlpLauncher::LaunchHelpApplicationL( CEikonEnv::Static()->WsSession(),
       
   309                                                  ( CCoeEnv::Static()->AppUi() )->AppHelpContextL () );
       
   310             break;
       
   311             }
       
   312         default:
       
   313             {
       
   314             iEikonEnv->EikAppUi()->HandleCommandL( aCommand );
       
   315             break;
       
   316             }
       
   317         }
       
   318     }
       
   319 
       
   320 // ---------------------------------------------------------
       
   321 // CCAAccessListDialog::DynInitMenuPaneL
       
   322 // Dynamically initialises menu pane
       
   323 // (other items were commented in a header).
       
   324 // ---------------------------------------------------------
       
   325 //
       
   326 void CCAAccessListDialog::DynInitMenuPaneL( TInt aResourceId,
       
   327                                             CEikMenuPane* aMenuPane )
       
   328     {
       
   329     CHAT_DP_TXT( "CCAAccessListDialog::DynInitMenuPaneL" );
       
   330 
       
   331     // if we're displaying general menu and help feature is not supported..
       
   332     if ( aResourceId == R_CHATCLIENT_GENERAL_MENU &&
       
   333          !FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
   334         {
       
   335         // dimm the help menu item
       
   336         aMenuPane->SetItemDimmed( EChatClientCmdHelp, ETrue );
       
   337         }
       
   338 
       
   339     if ( aResourceId == R_CHATCLIENT_ACCESSLIST_OPTIONS_MENU ||
       
   340          aResourceId == R_CHATCLIENT_EDITINGRIGHTS_OPTIONS_MENU ||
       
   341          aResourceId == R_CHATCLIENT_BANNEDLIST_OPTIONS_MENU ||
       
   342          aResourceId == R_CHATCLIENT_ACCESSLIST_POPUP_MENU ||
       
   343          aResourceId == R_CHATCLIENT_EDITINGRIGHTS_POPUP_MENU ||
       
   344          aResourceId == R_CHATCLIENT_BANNEDLIST_POPUP_MENU )
       
   345         {
       
   346         CAknSingleStyleListBox* listBox =
       
   347             static_cast< CAknSingleStyleListBox* >(
       
   348                 Control( EChatClientControlIdAccessList ) );
       
   349         TInt index( listBox->CurrentItemIndex() );
       
   350         TInt emptyCount( iFirstItemCanBeEdited ? 0 : 1 );
       
   351         if ( iItemArray->MdcaCount() == emptyCount )
       
   352             {
       
   353             aMenuPane->SetItemDimmed( EChatClientAccessListRemove, ETrue );
       
   354 
       
   355             if ( ( aResourceId != R_CHATCLIENT_ACCESSLIST_POPUP_MENU ) &&
       
   356                  ( aResourceId != R_CHATCLIENT_EDITINGRIGHTS_POPUP_MENU ) &&
       
   357                  ( aResourceId != R_CHATCLIENT_BANNEDLIST_POPUP_MENU ) )
       
   358                 {
       
   359                 // popup menu doesn't contain "remove all"-option
       
   360                 aMenuPane->SetItemDimmed( EChatClientAccessListRemoveAll,
       
   361                                           ETrue );
       
   362                 }
       
   363             }
       
   364         else if ( index == 0 && !iFirstItemCanBeEdited )
       
   365             {
       
   366             aMenuPane->SetItemDimmed( EChatClientAccessListRemove, ETrue );
       
   367             }
       
   368         }
       
   369     CHAT_DP_TXT( "CCAAccessListDialog::DynInitMenuPaneL ENDS" );
       
   370     }
       
   371 
       
   372 
       
   373 // ---------------------------------------------------------
       
   374 // CCAAccessListDialog::HandleListBoxEventL()
       
   375 // (other items were commented in a header).
       
   376 // ---------------------------------------------------------
       
   377 //
       
   378 void CCAAccessListDialog::HandleListBoxEventL( CEikListBox* /*aListBox*/,
       
   379                                                TListBoxEvent aEventType )
       
   380     {
       
   381     if ( aEventType == EEventItemDoubleClicked )
       
   382         {
       
   383         DisplayPopupMenuL();
       
   384         }
       
   385     }
       
   386 
       
   387 // ---------------------------------------------------------
       
   388 // CCAAccessListDialog::PreLayoutDynInitL()
       
   389 // Sets the layout for dialog
       
   390 // (other items were commented in a header).
       
   391 // ---------------------------------------------------------
       
   392 //
       
   393 void CCAAccessListDialog::PreLayoutDynInitL()
       
   394     {
       
   395     iPopupMenu = new( ELeave ) CEikMenuBar;
       
   396     iPopupMenu->ConstructL( this, 0, iMenuBarResourceId );
       
   397     iEikonEnv->EikAppUi()->AddToStackL( iPopupMenu );
       
   398 
       
   399     // Context sensitive menu
       
   400 #ifndef RD_30_DISABLE_TOUCH
       
   401     iMenuBar->SetContextMenuTitleResourceId( iMenuBarResourceId );
       
   402 #endif
       
   403 
       
   404     iWVUserId = HBufC::NewL( KMaxWVIDLength );
       
   405     CAknSingleStyleListBox* listBox = static_cast< CAknSingleStyleListBox* >
       
   406                                       ( Control( EChatClientControlIdAccessList ) );
       
   407 
       
   408     listBox->CreateScrollBarFrameL( ETrue );
       
   409     listBox->ScrollBarFrame()->SetScrollBarVisibilityL(
       
   410         CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
       
   411 
       
   412     listBox->HandleItemAdditionL();
       
   413     listBox->UpdateScrollBarsL();
       
   414     listBox->SetListBoxObserver( this );
       
   415 
       
   416     // If simplified flag is set -> then show descriptive empty list text
       
   417     if ( IMUtils::CRKeyL( KCRUidIMVariation, KIMVariationKey ) & EIMFeatSimplifiedUI &&
       
   418          iEmptyText )
       
   419         {
       
   420         // we should set the empty text
       
   421         listBox->View()->SetListEmptyTextL( *iEmptyText  );
       
   422 
       
   423         }
       
   424 
       
   425     iItemArray = CCAAccessArray::NewL(
       
   426                      iGroupPropertiesPC,
       
   427                      iUserList );
       
   428 
       
   429     listBox->Model()->SetItemTextArray( iItemArray );
       
   430     listBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
       
   431 
       
   432     iTitlePane->ClearNaviPaneL();
       
   433 
       
   434     iTitlePane->SetTitleL( iEikonEnv, iTitleResource );
       
   435     }
       
   436 
       
   437 // ---------------------------------------------------------
       
   438 // CCAAccessListDialog::OkToExitL( TInt aButtonId )
       
   439 // Handles buttonids
       
   440 // (other items were commented in a header).
       
   441 // ---------------------------------------------------------
       
   442 //
       
   443 TBool CCAAccessListDialog::OkToExitL( TInt aButtonId )
       
   444     {
       
   445     if ( aButtonId == EAknSoftkeyOptions )
       
   446         {
       
   447         DisplayMenuL();
       
   448         return EFalse;
       
   449         }
       
   450     if ( aButtonId == EAknSoftkeyContextOptions )
       
   451         {
       
   452         DisplayPopupMenuL();    // MSK command, show context sensitive
       
   453         // options menu
       
   454         return EFalse;
       
   455         }
       
   456 
       
   457     return ETrue;
       
   458     }
       
   459 
       
   460 // ---------------------------------------------------------
       
   461 // CCAAccessListDialog::OfferKeyEventL
       
   462 // (other items were commented in a header).
       
   463 // ---------------------------------------------------------
       
   464 //
       
   465 TKeyResponse CCAAccessListDialog::OfferKeyEventL( const TKeyEvent& aKeyEvent,
       
   466                                                   TEventCode aType )
       
   467     {
       
   468     CAknSingleStyleListBox* listBox = static_cast< CAknSingleStyleListBox* >
       
   469                                       ( Control( EChatClientControlIdAccessList ) );
       
   470 
       
   471     if ( aKeyEvent.iCode == EKeyEnter || aKeyEvent.iCode == EKeyOK )
       
   472         {
       
   473         DisplayPopupMenuL();
       
   474         return EKeyWasConsumed;
       
   475         }
       
   476     if ( aKeyEvent.iCode == EKeyBackspace )
       
   477         {
       
   478         CAknSingleStyleListBox* listBox =
       
   479             static_cast< CAknSingleStyleListBox* >(
       
   480                 Control( EChatClientControlIdAccessList ) );
       
   481         TInt index( listBox->CurrentItemIndex() );
       
   482 
       
   483         if ( ( index == 0 && iFirstItemCanBeEdited ) || index > 0 )
       
   484             {
       
   485             DisplayRmvConfirmationL();
       
   486             return EKeyWasConsumed;
       
   487             }
       
   488         }
       
   489     if ( aKeyEvent.iCode == EKeyEscape ) // handle dialog shutdown.
       
   490         {
       
   491         TryExitL( EAknSoftkeyCancel );
       
   492         return EKeyWasConsumed;
       
   493         }
       
   494     return listBox->OfferKeyEventL( aKeyEvent, aType );
       
   495     }
       
   496 
       
   497 // ---------------------------------------------------------
       
   498 // CCAAccessListDialog::MappedCommandId()
       
   499 // (other items were commented in a header).
       
   500 // ---------------------------------------------------------
       
   501 //
       
   502 TInt CCAAccessListDialog::MappedCommandId( TInt aButtonId )
       
   503     {
       
   504     if ( aButtonId == EEikBidCancel )
       
   505         {
       
   506         // return something else than cancel.
       
   507         // the returned value is irrelevant
       
   508         return EEikBidCancel + 1;
       
   509         }
       
   510 
       
   511     return aButtonId;
       
   512     }
       
   513 
       
   514 // ---------------------------------------------------------
       
   515 // CCAAccessListDialog::DisplayRmvConfirmationL()
       
   516 // Displays confirmation note
       
   517 // (other items were commented in a header).
       
   518 // ---------------------------------------------------------
       
   519 //
       
   520 void CCAAccessListDialog::DisplayRmvConfirmationL()
       
   521     {
       
   522     CAknSingleStyleListBox* listBox =
       
   523         static_cast< CAknSingleStyleListBox* >(
       
   524             Control( EChatClientControlIdAccessList ) );
       
   525 
       
   526     TInt index( listBox->CurrentItemIndex() );
       
   527     TPtrC wvid( iItemArray->RawData( index ) );
       
   528 
       
   529 
       
   530     HBufC* prompt = StringLoader::LoadLC( iDeletePromptResourceId,
       
   531                                           iGroupPropertiesPC->GetIdentificationL( wvid ) );
       
   532     // Show confirmation
       
   533     TInt ret( IMDialogUtils::DisplayQueryDialogL( R_DELETE_ACCESS_QUERY,
       
   534                                                   *prompt ) );
       
   535     CleanupStack::PopAndDestroy( prompt );
       
   536 
       
   537     if ( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) )
       
   538         {
       
   539         iIsMemberAccessModified = ETrue;
       
   540         iItemArray->Delete( index, 1 );
       
   541         listBox->HandleItemRemovalL();
       
   542 
       
   543         TInt currentItemIndex( index );
       
   544         if ( currentItemIndex < 0 )
       
   545             {
       
   546             currentItemIndex = 0;
       
   547             }
       
   548         if ( currentItemIndex >= iItemArray->MdcaCount() )
       
   549             {
       
   550             currentItemIndex = iItemArray->MdcaCount() - 1;
       
   551             }
       
   552         if ( iItemArray->MdcaCount() > 0 )
       
   553             {
       
   554             listBox->SetCurrentItemIndexAndDraw( currentItemIndex );
       
   555             }
       
   556         }
       
   557     DrawNow();
       
   558     }
       
   559 
       
   560 // ---------------------------------------------------------
       
   561 // CCAAccessListDialog::DisplayRmvAllConfirmationL()
       
   562 // Displays confirmation if all are removed
       
   563 // (other items were commented in a header).
       
   564 // ---------------------------------------------------------
       
   565 //
       
   566 void CCAAccessListDialog::DisplayRmvAllConfirmationL()
       
   567     {
       
   568     CAknSingleStyleListBox* listBox =
       
   569         static_cast< CAknSingleStyleListBox* >(
       
   570             Control( EChatClientControlIdAccessList ) );
       
   571 
       
   572     HBufC* prompt = iEikonEnv->AllocReadResourceLC(
       
   573                         iDeleteAllPromptResourceId );
       
   574     TInt ret( IMDialogUtils::DisplayQueryDialogL( R_DELETE_ALL_ACCESS_QUERY,
       
   575                                                   *prompt ) );
       
   576     CleanupStack::PopAndDestroy( prompt );
       
   577 
       
   578     if ( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) )
       
   579         {
       
   580         iIsMemberAccessModified = ETrue;
       
   581         if ( iFirstItemCanBeEdited )
       
   582             {
       
   583             iItemArray->Reset();
       
   584             }
       
   585         else
       
   586             {
       
   587 
       
   588             if ( iItemArray->MdcaCount() > 0 ) //added array bound check
       
   589                 {
       
   590                 // don't delete first item
       
   591                 iItemArray->Delete( 1, iItemArray->MdcaCount() - 1 );
       
   592                 }
       
   593             listBox->SetCurrentItemIndex( 0 );
       
   594             }
       
   595 
       
   596         listBox->HandleItemRemovalL();
       
   597 
       
   598         if ( iRemoveAllShouldExitDialog )
       
   599             {
       
   600             // exit the dialog
       
   601             TryExitL( EAknSoftkeyOk );
       
   602             }
       
   603         }
       
   604     }
       
   605 
       
   606 // ---------------------------------------------------------
       
   607 // CCAAccessListDialog::DisplayPopupMenuL
       
   608 // Displays pop-up menu
       
   609 // (other items were commented in a header).
       
   610 // ---------------------------------------------------------
       
   611 //
       
   612 void CCAAccessListDialog::DisplayPopupMenuL()
       
   613     {
       
   614 #ifndef RD_30_DISABLE_TOUCH
       
   615     iMenuBar->TryDisplayContextMenuBarL();
       
   616 #else
       
   617     iPopupMenu->TryDisplayMenuBarL();
       
   618 #endif //RD_30_DISABLE_TOUCH
       
   619     }
       
   620 
       
   621 // ---------------------------------------------------------
       
   622 // CCAAccessListDialog::CanUserBeAddedToListL
       
   623 // (other items were commented in a header).
       
   624 // ---------------------------------------------------------
       
   625 //
       
   626 TBool CCAAccessListDialog::CanUserBeAddedToListL( const CDesCArray& aUserList,
       
   627                                                   const TDesC& aUserId )
       
   628     {
       
   629     // Check first that id does not exists in filter lists.
       
   630     TInt index( IMUtils::NeutralFind( *iFilterList, aUserId ) );
       
   631     TInt index2 = KErrNotFound;
       
   632     if ( iFilterList2 )
       
   633         {
       
   634         index2 = IMUtils::NeutralFind( *iFilterList2, aUserId );
       
   635         }
       
   636 
       
   637     if ( index != KErrNotFound || index2 != KErrNotFound )
       
   638         {
       
   639         TInt resource;
       
   640         switch ( iListType )
       
   641             {
       
   642             case EAccessList:
       
   643                 {
       
   644                 resource = R_QTN_CHAT_ACLIST_MOVE_TO_ACCESS;
       
   645                 break;
       
   646                 }
       
   647             case EBannedList:
       
   648                 {
       
   649                 resource = R_QTN_CHAT_ACLIST_MOVE_TO_BANNED;
       
   650                 break;
       
   651                 }
       
   652             default:
       
   653                 {
       
   654                 resource = R_QTN_CHAT_ACLIST_MOVE_TO_ADMIN;
       
   655                 break;
       
   656                 }
       
   657             }
       
   658         // ask from user should be moved from other list.
       
   659         HBufC* text = StringLoader::LoadLC( resource,
       
   660                                             iGroupPropertiesPC->GetIdentificationL( aUserId ) );
       
   661         TInt okToMove( IMDialogUtils::DisplayYesNoConfirmationDialogL( *text ) );
       
   662         CleanupStack::PopAndDestroy( text );
       
   663         if ( okToMove )
       
   664             {
       
   665             // Delete from correct filter list
       
   666             if ( index != KErrNotFound )
       
   667                 {
       
   668                 iFilterList->Delete( index );
       
   669                 }
       
   670             if ( index2 != KErrNotFound )
       
   671                 {
       
   672                 iFilterList2->Delete( index2 );
       
   673                 }
       
   674             }
       
   675         else
       
   676             {
       
   677             return EFalse;
       
   678             }
       
   679         }
       
   680     return ( IMUtils::NeutralFind( aUserList, aUserId ) == KErrNotFound );
       
   681     }
       
   682 
       
   683 
       
   684 /**
       
   685  * Help Key Support
       
   686  * This function is called by the Framework to get the context to launch
       
   687  * Help
       
   688  *
       
   689  * @param aContext	The context that contains the appid and the help id.
       
   690  */
       
   691 void CCAAccessListDialog::GetHelpContext(
       
   692     TCoeHelpContext& aContext ) const
       
   693     {
       
   694     aContext.iMajor = KUidChatClient;
       
   695     aContext.iContext = *iHelpTopic;
       
   696     }
       
   697 //  End of File