wvuing/wvuiave/AppSrc/CCARecordedChatsView.cpp
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     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:  View for recorded chats.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include "MCAProcessManager.h"
       
    23 #include "MCASettingsPC.h"
       
    24 #include "IMUtils.h"
       
    25 #include "CCARecordedChatsView.h"
       
    26 #include "CCARecordedChatsContainer.h"
       
    27 #include "MCARecordedChatProvider.h"
       
    28 #include "CCAUiMessageUtils.h"
       
    29 #include "chatngclient.hrh"
       
    30 #include "CCAAppUi.h"
       
    31 #include "CCAStatusPaneHandler.h"
       
    32 #include "CAExternalInterface.h"
       
    33 #include "ChatDebugPrint.h"
       
    34 #include "ChatDefinitions.h"
       
    35 #include "IMPrivateCRKeys.h"
       
    36 #include "IMVariant.hrh"
       
    37 #include "MCARecordedChatsPC.h"
       
    38 
       
    39 #include <chatNG.rsg>
       
    40 #include <eikmenup.h>
       
    41 #include <aknlists.h>
       
    42 #include <FeatMgr.h>
       
    43 #include <StringLoader.h>
       
    44 #include <hlplch.h>
       
    45 #include <bldvariant.hrh>
       
    46 #include <eikmenub.h>
       
    47 #include <senduiconsts.h>
       
    48 #include <finditem.hrh>
       
    49 #include <finditemmenu.h>
       
    50 // The Settings have been moved to Cenrep (also retained in the Resource file),
       
    51 // so the enums for keys and central repository header is added here
       
    52 #include 	"VariantKeys.h"
       
    53 
       
    54 
       
    55 const TInt KGranularity = 2;
       
    56 // ================= MEMBER FUNCTIONS =======================
       
    57 // -----------------------------------------------------------------------------
       
    58 // CCARecordedChatsView::~CCARecordedChatsView
       
    59 // Destructor
       
    60 // -----------------------------------------------------------------------------
       
    61 //
       
    62 CCARecordedChatsView::~CCARecordedChatsView()
       
    63     {
       
    64     if ( iContainer && iAppUI )
       
    65         {
       
    66         iAppUI->RemoveFromViewStack( *this, iContainer );
       
    67         }
       
    68     delete iContainer;
       
    69     delete iFormat;
       
    70     if ( iContextMenu && iAppUI )
       
    71         {
       
    72         iAppUI->RemoveFromViewStack( *this, iContextMenu );
       
    73         }
       
    74     delete iContextMenu;
       
    75     delete iFindMenu;
       
    76     delete iItemFinder;
       
    77     }
       
    78 
       
    79 // ---------------------------------------------------------
       
    80 // CCARecordedChatsView::ConstructL()
       
    81 // Symbian OS default constructor
       
    82 // (other items were commented in a header).
       
    83 // ---------------------------------------------------------
       
    84 //
       
    85 void CCARecordedChatsView::ConstructL( TInt aAvkonViewResourceId, TUid aViewId )
       
    86     {
       
    87     BaseConstructL( aAvkonViewResourceId, aViewId );
       
    88 
       
    89     // get and format the time/date string
       
    90     HBufC* tFormat = CCoeEnv::Static()->AllocReadResourceLC(
       
    91                          R_QTN_TIME_USUAL_WITH_ZERO );
       
    92     HBufC* dFormat = CCoeEnv::Static()->AllocReadResourceLC(
       
    93                          R_QTN_DATE_SHORT_WITH_ZERO );
       
    94     CDesCArray* array = new( ELeave ) CDesCArrayFlat( KGranularity ); // two items
       
    95     CleanupStack::PushL( array );
       
    96     array->AppendL( *tFormat );
       
    97     array->AppendL( *dFormat );
       
    98     iFormat = StringLoader::LoadL( R_QTN_CHAT_RECORD_END_NAVI, *array );
       
    99 
       
   100     CleanupStack::PopAndDestroy( 3, tFormat ); // tFormat,dFormat,array
       
   101 
       
   102     iNewOptionsMenu = IMUtils::CRKeyL( KCRUidIMVariation,
       
   103                                        KIMVariationKey ) & EIMFeatRecordedChatOptions;
       
   104 
       
   105     // Context sensitivie menu for S60 3.0
       
   106     iContextMenu = new( ELeave ) CEikMenuBar;
       
   107     TInt contextResource = iNewOptionsMenu ?
       
   108                            R_CHATCLIENT_MENUBAR_FINDITEMUI :
       
   109                            R_CHATCLIENT_RECORDEDCHATS_MENUBAR_CONTEXT;
       
   110     iContextMenu->ConstructL( this, 0, contextResource );
       
   111 
       
   112     iFindMenu = CFindItemMenu::NewL( EChatClientFindMenuPlaceHolder );
       
   113     iFindMenu->AttachItemFinderMenuL( R_CHATCLIENT_RECORDEDCHATS_VIEW_MENU );
       
   114     // automatic finder on by default
       
   115 
       
   116     if ( iNewOptionsMenu )
       
   117         {
       
   118         iFindMenu->HandleItemFinderCommandL( EFindItemCmdEnableAutoFind );
       
   119         }
       
   120     else
       
   121         {
       
   122         iFindMenu->HandleItemFinderCommandL( EFindItemCmdDisableAutoFind );
       
   123         }
       
   124 
       
   125     iItemFinder = CItemFinder::NewL();
       
   126 
       
   127     iAppUI = static_cast <CCAAppUi*> ( CCoeEnv::Static()->AppUi() );
       
   128     }
       
   129 
       
   130 // ---------------------------------------------------------
       
   131 // CCARecordedChatsView::HandleCommandL(TInt aCommand)
       
   132 // Handle commands
       
   133 // ---------------------------------------------------------
       
   134 //
       
   135 void CCARecordedChatsView::HandleCommandL( TInt aCommand )
       
   136     {
       
   137     HideContextMenu();
       
   138     switch ( aCommand )
       
   139         {
       
   140             // new stuff
       
   141         case EAknSoftkeyOpen: // flowthrough
       
   142         case EChatClientOpenObject:
       
   143             {
       
   144             if ( iOpenObject )
       
   145                 {
       
   146                 return;
       
   147                 }
       
   148 
       
   149             MCAConversationMessage* msg = iContainer->SelectedMessage();
       
   150             if ( msg )
       
   151                 {
       
   152                 CCAUiMessageUtils* utils = CCAUiMessageUtils::NewLC();
       
   153 
       
   154                 // Set the indicator to true
       
   155                 iOpenObject = ETrue;
       
   156 
       
   157                 TRAPD( err, utils->OpenObjectL( *msg ) );
       
   158 
       
   159                 // Set it back
       
   160                 iOpenObject = EFalse;
       
   161 
       
   162                 CleanupStack::PopAndDestroy( utils );
       
   163                 User::LeaveIfError( err );
       
   164                 }
       
   165             break;
       
   166             }
       
   167 
       
   168         case EAknSoftkeyEmpty:
       
   169             {
       
   170             // Show context menu with selection key
       
   171             if ( !iNewOptionsMenu )
       
   172                 {
       
   173                 ShowPopUpMenuL();
       
   174                 }
       
   175             break;
       
   176             }
       
   177 
       
   178         case EChatClientSaveObject:
       
   179             {
       
   180             MCAConversationMessage* msg = iContainer->SelectedMessage();
       
   181             if ( msg )
       
   182                 {
       
   183                 CCAUiMessageUtils* utils = CCAUiMessageUtils::NewLC();
       
   184                 TInt err = utils->SaveObjectL( *msg );
       
   185                 //if the image is saved then we have to update
       
   186                 //the file. So mark iDirty as ETrue
       
   187                 //fix - refer Ui Spec Approved Version 1.0
       
   188                 //(Instant Messaging NG 001 151006.pdf)
       
   189                 //Section 10.2.10 Pg 131 -
       
   190                 //"In case user has saved the image already or sent it
       
   191                 //by himself, this option(save) is not available."
       
   192                 if ( err == KErrNone )
       
   193                     {
       
   194                     iDirty = ETrue;
       
   195                     }
       
   196                 CleanupStack::PopAndDestroy( utils );
       
   197                 }
       
   198             break;
       
   199             }
       
   200 
       
   201         case EChatClientIboxForwardToGroup:
       
   202             {
       
   203             iContainer->ForwardToGroupL();
       
   204             break;
       
   205             }
       
   206 
       
   207         case EChatClientIboxForwardToContact:
       
   208             {
       
   209             iContainer->ForwardToContactL();
       
   210             break;
       
   211             }
       
   212 
       
   213         // flow through
       
   214         case EFindItemCmdEnableAutoFind:
       
   215         case EFindItemCmdDisableAutoFind:
       
   216             {
       
   217             iContainer->SetItemHighlightL(
       
   218                 aCommand == EFindItemCmdEnableAutoFind );
       
   219             iFindMenu->HandleItemFinderCommandL( aCommand );
       
   220             if ( iContextMenu->IsDisplayed() )
       
   221                 {
       
   222                 iContextMenu->StopDisplayingMenuBar();
       
   223                 }
       
   224             break;
       
   225             }
       
   226 
       
   227         // Fall through
       
   228         case EAknSoftkeyBack:
       
   229         case EChatClientCmdBack:
       
   230             {
       
   231             iContainer->FreeMemoryForViewSwitch();
       
   232             iAppUI->SwitchViewL( KUidRecordedChatListView );
       
   233             break;
       
   234             }
       
   235         case EChatClientSavedListViewCmdDelete:
       
   236             {
       
   237             if ( iRecChatArrayProvider->DeleteChatL() )
       
   238                 {
       
   239                 iContainer->FreeMemoryForViewSwitch();
       
   240                 iAppUI->SwitchViewBackL( KUidRecordedChatListView );
       
   241                 }
       
   242             break;
       
   243             }
       
   244 
       
   245         // Help key support EChatClientCmdHelp is assigned EAknCmdHelp in
       
   246         // chatngclient.hrh
       
   247         case EChatClientCmdHelp:
       
   248             {
       
   249             HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(),
       
   250                                                  iAppUI->AppHelpContextL() );
       
   251             break;
       
   252             }
       
   253         case EChatClientSavedListViewCmdSendOpt:
       
   254             {
       
   255             iRecChatArrayProvider->SendChatViaMTML();
       
   256             break;
       
   257             }
       
   258         case EChatClientSavedListViewCmdSendSMS:
       
   259             {
       
   260             iRecChatArrayProvider->SendChatViaMTML(
       
   261                 TUid::Uid( KSenduiMtmSmsUidValue ) );
       
   262             break;
       
   263             }
       
   264         case EChatClientSavedListViewCmdSendMultimedia:
       
   265             {
       
   266             iRecChatArrayProvider->SendChatViaMTML(
       
   267                 TUid::Uid( KSenduiMtmMmsUidValue ) );
       
   268             break;
       
   269             }
       
   270         case EChatClientSavedListViewCmdSendInfrared:
       
   271             {
       
   272             iRecChatArrayProvider->SendChatViaMTML(
       
   273                 TUid::Uid( KSenduiMtmIrUidValue ) );
       
   274             break;
       
   275             }
       
   276         case EChatClientSavedListViewCmdSendBluetooth:
       
   277             {
       
   278             iRecChatArrayProvider->SendChatViaMTML(
       
   279                 TUid::Uid( KSenduiMtmBtUidValue ) );
       
   280             break;
       
   281             }
       
   282         case EChatClientCall:
       
   283             {
       
   284             UpdateItemTypeL();
       
   285             iFindMenu->HandleCallL( *iItemFinder->CurrentItemExt().iItemDescriptor );
       
   286             break;
       
   287             }
       
   288         default:
       
   289             {
       
   290             // check if it is find menu command
       
   291             if ( iFindMenu->CommandIsValidL( aCommand ) )
       
   292                 {
       
   293                 iFindMenu->HandleItemFinderCommandL( aCommand );
       
   294                 }
       
   295             else
       
   296                 {
       
   297                 if ( aCommand == EChatClientMainViewCmdChangeStatus )
       
   298                     {
       
   299                     UISessionManager().LoginL( MCAUiLoginCmdCB::ELogin );
       
   300                     if ( !UISessionManager().IsLoggedIn() )
       
   301                         {
       
   302                         return;
       
   303                         }
       
   304                     }
       
   305                 iAppUI->HandleCommandL( aCommand );
       
   306                 }
       
   307             break;
       
   308             }
       
   309         }
       
   310     }
       
   311 
       
   312 // ---------------------------------------------------------
       
   313 // CCARecordedChatsView::DoActivateL(...)
       
   314 // called when view is activated
       
   315 // ---------------------------------------------------------
       
   316 //
       
   317 void CCARecordedChatsView::DoActivateL(
       
   318     const TVwsViewId& /*aPrevViewId*/, TUid /*aCustomMessageId*/,
       
   319     const TDesC8& /*aCustomMessage*/ )
       
   320     {
       
   321     //This must be set before view is used with SetRecordedChatProvider method.
       
   322     if ( !iRecChatArrayProvider )
       
   323         {
       
   324         User::Leave( KErrNotFound );
       
   325         }
       
   326 
       
   327     // Unregister the view that was registered from Forward option.
       
   328     // didn't find any better place to put this.
       
   329     if ( TEnumsPC::EToBeUnregistered == iAppUI->RetForwardTo() )
       
   330         {
       
   331         iAppUI->UnRegisterPreviousview( );
       
   332         iAppUI->SetResetForwardTo( TEnumsPC::EUnregistered );
       
   333         }
       
   334     iContainer = CCARecordedChatsContainer::NewL(
       
   335                      ClientRect(),
       
   336                      static_cast<MCAViewSwitcher&>( *iAppUI ),
       
   337                      *iRecChatArrayProvider,
       
   338                      *this,
       
   339                      *this,
       
   340                      *( iAppUI->GetProcessManager().GetSettingsInterface() ),
       
   341                      iAppUI,
       
   342                      *( iAppUI->GetProcessManager().GetRecordedChatsPC() ) );
       
   343 
       
   344     iAppUI->AddToViewStackL( *this, iContainer );
       
   345     iAppUI->AddToViewStackL( *this, iContextMenu, 0,
       
   346                              ECoeStackFlagRefusesFocus );
       
   347 
       
   348     const TDesC& chatViewTitle = iRecChatArrayProvider->RecordedChatName();
       
   349     HBufC* chatNaviPane = HBufC::NewLC( iFormat->Length() ); //check length
       
   350 
       
   351     TPtr ptrDate( chatNaviPane->Des() );
       
   352     iRecChatArrayProvider->RecordedEndDate().FormatL( ptrDate, *iFormat );
       
   353     AknTextUtils::LanguageSpecificNumberConversion( ptrDate );
       
   354 
       
   355     iAppUI->CAStatusPane()->SetTitleL( chatViewTitle );
       
   356     iAppUI->CAStatusPane()->SetNaviLabelL( *chatNaviPane );
       
   357     CleanupStack::PopAndDestroy( chatNaviPane );
       
   358 
       
   359     // set the context menu for menubar (launched with middle softkey)
       
   360 #ifndef RD_30_DISABLE_TOUCH
       
   361     TInt contextResource = iNewOptionsMenu ?
       
   362                            R_CHATCLIENT_MENUBAR_FINDITEMUI :
       
   363                            R_CHATCLIENT_RECORDEDCHATS_MENUBAR_CONTEXT;
       
   364     MenuBar()->SetContextMenuTitleResourceId( contextResource );
       
   365 #endif
       
   366 
       
   367     // Automatic highlight
       
   368     iContainer->SetItemHighlightL( iNewOptionsMenu ? ETrue : EFalse );
       
   369 
       
   370     //Initialise
       
   371     iDirty = EFalse;
       
   372 
       
   373     CHAT_DP_TXT( "CCARecordedChatsView activated" );
       
   374     }
       
   375 
       
   376 // ---------------------------------------------------------
       
   377 // CCARecordedChatsView::HandleCommandL(TInt aCommand)
       
   378 // Called when view is deactivated
       
   379 // ---------------------------------------------------------
       
   380 //
       
   381 void CCARecordedChatsView::DoDeactivate()
       
   382     {
       
   383 
       
   384     //if any image is saved from recorded chats view
       
   385     //the file is dirty and has to be recommitted
       
   386     //fix - refer Ui Spec Approved Version 1.0 (Instant Messaging NG 001 151006.pdf)
       
   387     //Section 10.2.10 Pg 131 -
       
   388     //"In case user has saved the image already or sent it by himself,
       
   389     // this option(save) is not available."
       
   390     if ( iDirty )
       
   391         {
       
   392         TRAP_IGNORE( iAppUI->GetProcessManager().GetRecordedChatsPC()->ReLoggingL() );
       
   393         }
       
   394 
       
   395 
       
   396     if ( iContainer )
       
   397         {
       
   398         iAppUI->RemoveFromViewStack( *this, iContainer );
       
   399         }
       
   400     if ( iContextMenu )
       
   401         {
       
   402         iAppUI->RemoveFromViewStack( *this, iContextMenu );
       
   403         }
       
   404 
       
   405     delete iContainer;
       
   406     iContainer = NULL;
       
   407 
       
   408     //reset
       
   409     iDirty = EFalse;
       
   410 
       
   411     // Free memory used by message container in engine side
       
   412     TRAP_IGNORE( iRecChatArrayProvider->DeleteRecordedChatContainerL() );
       
   413 
       
   414     CHAT_DP_TXT( "CCARecordedChatsView deactivated" );
       
   415     }
       
   416 
       
   417 // ---------------------------------------------------------
       
   418 // CCARecordedChatsView::DynInitMenuPaneL()
       
   419 // (other items were commented in a header).
       
   420 // ---------------------------------------------------------
       
   421 //
       
   422 void CCARecordedChatsView::DynInitMenuPaneL( TInt aResourceId,
       
   423                                              CEikMenuPane* aMenuPane )
       
   424     {
       
   425     TBool showFwdToContact = iContainer->FwdContactVisible();
       
   426     TBool showFwdToGroup   = iContainer->FwdGroupVisible();
       
   427 
       
   428     // if we're displaying general menu and help feature is not supported..
       
   429     switch ( aResourceId )
       
   430         {
       
   431         case R_CHATCLIENT_GENERAL_MENU:
       
   432             {
       
   433             if ( !FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
   434                 {
       
   435                 // dimm the help menu item
       
   436                 aMenuPane->SetItemDimmed( EChatClientCmdHelp, ETrue );
       
   437                 }
       
   438             break;
       
   439             }
       
   440 
       
   441         case R_CHATCLIENT_RECORDEDCHATS_VIEW_MENU:
       
   442             {
       
   443             if ( iNewOptionsMenu )
       
   444                 {
       
   445 
       
   446                 if ( ! iAppUI->UISessionManager().IsSupported(
       
   447                          CCAUISessionManager::EGroup ) )
       
   448                     {
       
   449                     // groups are not supported, hide forward to group
       
   450                     showFwdToGroup = EFalse;
       
   451                     }
       
   452 
       
   453                 TBool showForwardMenu = showFwdToGroup || showFwdToContact;
       
   454 
       
   455                 TBool openable = EFalse;
       
   456                 TBool savePossible = EFalse;
       
   457                 TBool object = iContainer->IsObjectSelected( openable , savePossible );
       
   458 
       
   459                 // "open"
       
   460                 aMenuPane->SetItemDimmed( EChatClientOpenObject, !openable );
       
   461 
       
   462                 // "save"
       
   463                 aMenuPane->SetItemDimmed( EChatClientSaveObject, !savePossible );
       
   464 
       
   465                 // item finder menu
       
   466                 aMenuPane->SetItemDimmed( EChatClientFindMenuPlaceHolder, ETrue );
       
   467                 if ( iContainer->IsStopped() )
       
   468                     {
       
   469                     UpdateItemTypeL();
       
   470                     iFindMenu->AddItemFindMenuL( iItemFinder, aMenuPane,
       
   471                                                  EChatClientFindMenuPlaceHolder,
       
   472                                                  KNullDesC ); // we can ignore the sender here
       
   473                     }
       
   474 
       
   475                 // "forward" hiding logic case 3
       
   476                 // Hide also when focus on object that is not openable
       
   477                 if ( !showForwardMenu || ( object && !openable ) )
       
   478                     {
       
   479                     CHAT_DP_TXT( "CCARecordedChatsView::DynInitMenuPaneL \
       
   480  			              Hide the whole forward menu" );
       
   481                     aMenuPane->SetItemDimmed( EChatClientIboxForward, ETrue );
       
   482                     }
       
   483                 else
       
   484                     {
       
   485                     CHAT_DP_TXT( "CCARecordedChatsView::DynInitMenuPaneL \
       
   486  			              Show the forward menu" );
       
   487                     aMenuPane->SetItemDimmed(
       
   488                         EChatClientIboxForward, !iContainer->IsStopped() );
       
   489                     }
       
   490                 }
       
   491             else
       
   492                 {
       
   493                 // Old options menu
       
   494                 aMenuPane->SetItemDimmed( EChatClientOpenObject, ETrue );
       
   495                 aMenuPane->SetItemDimmed( EChatClientSaveObject, ETrue );
       
   496                 aMenuPane->SetItemDimmed( EChatClientFindMenuPlaceHolder, ETrue );
       
   497                 aMenuPane->SetItemDimmed( EChatClientIboxForward, ETrue );
       
   498                 }
       
   499 
       
   500             break;
       
   501             }
       
   502         case R_CHATCLIENT_IBOX_FORWARD_SUBMENU:
       
   503             {
       
   504             aMenuPane->SetItemDimmed( EChatClientIboxForwardToGroup,
       
   505                                       ! showFwdToGroup );
       
   506             aMenuPane->SetItemDimmed( EChatClientIboxForwardToContact,
       
   507                                       ! showFwdToContact );
       
   508             break;
       
   509             }
       
   510         case R_CHATCLIENT_FINDITEMUI_MENU:
       
   511             {
       
   512             if ( iContainer->IsStopped() && iNewOptionsMenu )
       
   513                 {
       
   514                 UpdateItemTypeL();
       
   515                 iFindMenu->AddItemFindMenuL( iItemFinder, aMenuPane,
       
   516                                              EFindItemContextMenuPlaceHolder,
       
   517                                              KNullDesC, // we can ignore the sender here
       
   518                                              EFalse, ETrue ); // context menu
       
   519                 }
       
   520             break;
       
   521             }
       
   522 
       
   523         default:
       
   524             {
       
   525             // update find menu
       
   526             if ( iNewOptionsMenu )
       
   527                 {
       
   528                 iFindMenu->UpdateItemFinderMenuL( aResourceId, aMenuPane );
       
   529                 }
       
   530 
       
   531             break;
       
   532             }
       
   533         }
       
   534     }
       
   535 
       
   536 // -----------------------------------------------------------------------------
       
   537 // CCARecordedChatsView::SetRecordedChatProvider
       
   538 // Set provider for recorded chats.
       
   539 // -----------------------------------------------------------------------------
       
   540 //
       
   541 void CCARecordedChatsView::SetRecordedChatProvider(
       
   542     MCARecordedChatProvider& aRecChatArrayProvider )
       
   543     {
       
   544     iRecChatArrayProvider = &aRecChatArrayProvider;
       
   545     }
       
   546 
       
   547 // -----------------------------------------------------------------------------
       
   548 // CCARecordedChatsView::HideContextMenu
       
   549 // Hide context sensitive menu if active
       
   550 // -----------------------------------------------------------------------------
       
   551 //
       
   552 void CCARecordedChatsView::HideContextMenu()
       
   553     {
       
   554     if ( iContextMenu->IsDisplayed() )
       
   555         {
       
   556         iContextMenu->StopDisplayingMenuBar();
       
   557         }
       
   558     }
       
   559 
       
   560 // ---------------------------------------------------------
       
   561 // CCARecordedChatsView::UpdateItemTypeL
       
   562 // (other items were commented in a header).
       
   563 // ---------------------------------------------------------
       
   564 //
       
   565 void CCARecordedChatsView::UpdateItemTypeL()
       
   566     {
       
   567     CItemFinder::CFindItemExt& item = iItemFinder->CurrentItemExt();
       
   568     switch ( iContainer->SelectedItemType() )
       
   569         {
       
   570         case CFindItemEngine::EFindItemSearchPhoneNumberBin:
       
   571             {
       
   572             item.iItemType = CItemFinder::EPhoneNumber;
       
   573             break;
       
   574             }
       
   575         case CFindItemEngine::EFindItemSearchMailAddressBin:
       
   576             {
       
   577             item.iItemType = CItemFinder::EEmailAddress;
       
   578             break;
       
   579             }
       
   580         case CFindItemEngine::EFindItemSearchURLBin:
       
   581             {
       
   582             item.iItemType = CItemFinder::EUrlAddress;
       
   583             break;
       
   584             }
       
   585         case CFindItemEngine::EFindItemSearchScheme:
       
   586             {
       
   587             item.iItemType = CItemFinder::EUriScheme;
       
   588             break;
       
   589             }
       
   590         case KErrNotFound:  // flowthrough
       
   591         default:
       
   592             {
       
   593             item.iItemType = CItemFinder::ENoneSelected;
       
   594             break;
       
   595             }
       
   596         }
       
   597     delete item.iItemDescriptor;
       
   598     item.iItemDescriptor = NULL;
       
   599     item.iItemDescriptor = iContainer->SelectedItemL();  // takes the ownership
       
   600 
       
   601     // this logic comes from CItemFinder::ResolveAndSetItemTypeL.
       
   602     // should be in ItemFinder engine, but for some reason it isn't,
       
   603     // so, next few lines are copypasted from AknItemFinder.cpp..
       
   604     if ( item.iItemType == CItemFinder::EUrlAddress )
       
   605         {
       
   606         // old url types need prefix in order to work w/ schemehandler
       
   607         const TDesC& pref = item.iItemDescriptor->Des().Left( 4 );
       
   608         if ( pref.CompareF( KIMHTTPPREFIX().Left( 4 ) ) != 0 )
       
   609             {
       
   610             HBufC* tmp = item.iItemDescriptor->ReAlloc(
       
   611                              item.iItemDescriptor->Length() + KIMHTTPPREFIX().Length() );
       
   612             if ( tmp )
       
   613                 {
       
   614                 // realloc succeeded
       
   615                 item.iItemDescriptor = tmp;
       
   616                 item.iItemDescriptor->Des().Insert( 0, KIMHTTPPREFIX );
       
   617                 }
       
   618             }
       
   619         }
       
   620     if ( item.iItemType == CItemFinder::EUriScheme )
       
   621         {
       
   622         // some schemes (ie. "old ones") have special handling
       
   623         const TDesC& pref = item.iItemDescriptor->Des().Left( 4 );
       
   624         if ( pref.CompareF( KIMHTTPPREFIX().Left( 4 ) ) == 0
       
   625              || pref.CompareF( KIMRTSP ) == 0 )
       
   626             {
       
   627             item.iItemType = CItemFinder::EUrlAddress;
       
   628             }
       
   629         }
       
   630     }
       
   631 
       
   632 // ---------------------------------------------------------
       
   633 // CCARecordedChatsView::ShowRecipientsListL()
       
   634 // Leaving function dummy implemented from base class
       
   635 // (other items were commented in a header).
       
   636 // ---------------------------------------------------------
       
   637 //
       
   638 TInt CCARecordedChatsView::ShowRecipientsListL( TInt /*aResourceId*/ )
       
   639     {
       
   640     // Nothing to do here
       
   641     User::Leave( KErrGeneral );
       
   642     return KErrNotFound;
       
   643     }
       
   644 
       
   645 // ---------------------------------------------------------
       
   646 // CCARecordedChatsView::ShowPopUpMenuL()
       
   647 // (other items were commented in a header).
       
   648 // ---------------------------------------------------------
       
   649 //
       
   650 void CCARecordedChatsView::ShowPopUpMenuL( )
       
   651     {
       
   652 #ifndef RD_30_DISABLE_TOUCH
       
   653     // S60 COMMON
       
   654     MenuBar()->StopDisplayingMenuBar();
       
   655     MenuBar()->TryDisplayContextMenuBarL();
       
   656 #else
       
   657     // S60 3.0
       
   658     iContextMenu->StopDisplayingMenuBar();
       
   659     iContextMenu->TryDisplayMenuBarL();
       
   660 #endif //RD_30_DISABLE_TOUCH
       
   661     }
       
   662 // ---------------------------------------------------------
       
   663 // CCARecordedChatsView::ProcessCommandL
       
   664 // from CAknView::ProcessCommandL .
       
   665 // ---------------------------------------------------------
       
   666 void CCARecordedChatsView::ProcessCommandL(TInt aCommand)
       
   667 	  {
       
   668 	  if ( iContainer )
       
   669 	      {
       
   670 	      CAknView::ProcessCommandL(aCommand);
       
   671 	  	  }
       
   672 	  }
       
   673 // End of File