phoneuis/BubbleManager/Src/BMBubbleOutlookMiddleCnap.cpp
branchRCL_3
changeset 25 5266b1f337bd
equal deleted inserted replaced
24:41a7f70b3818 25:5266b1f337bd
       
     1 /*
       
     2 * Copyright (c) 2007 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: Implementation of CBubbleOutMiddleCnap class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include    "BMBubbleManager.h" //for enumerations
       
    21 #include    "BMBubbleOutlookMiddleCnap.h"
       
    22 #include    "BMBubbleImageManager.h"
       
    23 #include    "BMResourceManager.h"
       
    24 #include    "BMBubbleHeader.h"
       
    25 #include    "BMLayout.h"
       
    26 #include    "BMUtils.h"
       
    27 #include    "BMLayout2.h"
       
    28 #include    "telbubblecustomelement.h"
       
    29 
       
    30 #include    <eiklabel.h> 
       
    31 #include    <eikimage.h>
       
    32 #include    <eikenv.h>
       
    33 #include    <AknsUtils.h>
       
    34 #include    <AknsDrawUtils.h>
       
    35 
       
    36 // ================= MEMBER FUNCTIONS =======================
       
    37 
       
    38 // C++ default constructor can NOT contain any code, that
       
    39 // might leave.
       
    40 //
       
    41 CBubbleOutlookMiddleCnap::CBubbleOutlookMiddleCnap
       
    42     ( CBubbleManager& aBubbleManager )
       
    43     : CBubbleOutlookThreeLined( aBubbleManager )
       
    44     {
       
    45     }
       
    46 
       
    47 // Symbian OS default constructor can leave.
       
    48 void CBubbleOutlookMiddleCnap::ConstructL()
       
    49     {
       
    50     CBubbleOutlookThreeLined::ConstructL();
       
    51     }
       
    52 
       
    53     
       
    54 // Destructor
       
    55 CBubbleOutlookMiddleCnap::~CBubbleOutlookMiddleCnap()
       
    56     {
       
    57     Reset();
       
    58     }
       
    59 
       
    60 
       
    61 // ---------------------------------------------------------------------------
       
    62 // CBubbleOutlookMiddleCnap::ReadBubbleHeader
       
    63 //
       
    64 //  
       
    65 // ---------------------------------------------------------------------------
       
    66 //
       
    67 void CBubbleOutlookMiddleCnap::ReadBubbleHeader( CBubbleHeader& aHeader )
       
    68     {
       
    69     iHeader = &aHeader;
       
    70     
       
    71     iBubble = iBubbleManager.ResourceManager().ReserveEikImage( ETrue );        
       
    72     
       
    73     if ( !iCallObjectDisplay )
       
    74         {
       
    75         GetCall1BubbleBitmaps();    
       
    76         }
       
    77     
       
    78     CBubbleOutlookThreeLined::ReadBubbleHeader( aHeader );
       
    79     }
       
    80 
       
    81 // ---------------------------------------------------------------------------
       
    82 // CBubbleOutlookMiddleCnap::SizeChanged
       
    83 // called by framwork when the view size is changed
       
    84 //  
       
    85 // ---------------------------------------------------------------------------
       
    86 //
       
    87 void CBubbleOutlookMiddleCnap::SizeChanged()
       
    88     {
       
    89     if( !iHeader )
       
    90         {
       
    91         return;
       
    92         }
       
    93 
       
    94     AknsUtils::RegisterControlPosition( this );
       
    95 
       
    96     if ( !iCallObjectDisplay )
       
    97         {
       
    98         DoCall1Layout();    
       
    99         }
       
   100     else
       
   101         {
       
   102         TRAPD( err, DoCall2LayoutL() );
       
   103         if ( err )    
       
   104             {
       
   105             iBubble->SetPicture( NULL, NULL );
       
   106                 
       
   107             MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   108             AknsDrawUtils::PrepareFrame( skin,
       
   109                                          iOuterRect,
       
   110                                          iInnerRect,
       
   111                                          iFrameId,
       
   112                                          KAknsIIDDefault );
       
   113             }  
       
   114         }      
       
   115     }
       
   116 
       
   117 // ---------------------------------------------------------------------------
       
   118 // CBubbleOutlookMiddleCnap::DoCall1Layout
       
   119 // ---------------------------------------------------------------------------
       
   120 //    
       
   121 void CBubbleOutlookMiddleCnap::DoCall1Layout()
       
   122     {
       
   123     // Deprecated
       
   124     }
       
   125 
       
   126 // ---------------------------------------------------------------------------
       
   127 // CBubbleOutlookMiddleCnap::DoCall2Layout
       
   128 // ---------------------------------------------------------------------------
       
   129 //
       
   130 void CBubbleOutlookMiddleCnap::DoCall2LayoutL()
       
   131     {
       
   132     iBubble->SetPictureOwnedExternally( EFalse );
       
   133     iBubble->SetPicture( NULL, NULL );
       
   134     
       
   135     const TRect rect = Rect();
       
   136     CBubbleManager::TPhoneCallState callState = iHeader->CallState();
       
   137     switch ( callState )
       
   138         {
       
   139         case CBubbleManager::EIncoming:
       
   140         case CBubbleManager::EOutgoing:
       
   141         case CBubbleManager::EAlerting:
       
   142         case CBubbleManager::EWaiting:
       
   143         case CBubbleManager::EAlertToDisconnected:
       
   144             {
       
   145             ///////////////////////////////////////////////////////////////////
       
   146             // Incoming call layout. Three lines of text. Number entry open.
       
   147             ///////////////////////////////////////////////////////////////////
       
   148             
       
   149             // Layout create bubble image
       
   150             TAknLayoutRect bubbleRect;
       
   151             bubbleRect.LayoutRect( 
       
   152                 rect, 
       
   153                 BubbleLayout2::popup_call2_audio_in_background(6) );
       
   154             
       
   155             TRect frameRect( TPoint(0,0), bubbleRect.Rect().Size() );
       
   156             TRect outerRect;
       
   157             TRect innerRect;
       
   158             BubbleLayout2::RectFrameInnerOuterRects( frameRect, 
       
   159                                                      outerRect, 
       
   160                                                      innerRect);
       
   161             
       
   162             iFrameId = ( callState == CBubbleManager::EAlertToDisconnected ) ?
       
   163                                       KAknsIIDQsnFrCall2RectDisconn : 
       
   164                                       KAknsIIDQsnFrCall2Rect;
       
   165             
       
   166             iOuterRect = outerRect;
       
   167             iOuterRect.Move( Rect().iTl );
       
   168             iInnerRect = innerRect;
       
   169             iInnerRect.Move( Rect().iTl );
       
   170 
       
   171             // Call indicator
       
   172             BubbleUtils::LayoutCustomElement(
       
   173                 iBigCallIndicator, 
       
   174                 rect, 
       
   175                 BubbleLayout2::popup_call2_audio_out_call_waiting_icon(1) );
       
   176             
       
   177             // Ciphering off
       
   178             BubbleUtils::LayoutControl( 
       
   179                 iCyphOffImage, 
       
   180                 rect,
       
   181                 BubbleLayout2::popup_call2_audio_in_ciphering_icon(6) );                
       
   182             
       
   183             // Number type icon
       
   184             BubbleUtils::LayoutCustomElement(
       
   185                 iNumberType, 
       
   186                 rect, 
       
   187                 BubbleLayout2::popup_call2_audio_in_call_number_type_icon(6) );
       
   188 
       
   189             // Text line 1
       
   190             BubbleUtils::LayoutLabel( 
       
   191                 iTextLine1, 
       
   192                 rect, 
       
   193                 BubbleLayout2::popup_call2_audio_in_call_text_1(6) );
       
   194             
       
   195             // Text line 2
       
   196             BubbleUtils::LayoutLabel( 
       
   197                 iTextLine2, 
       
   198                 rect, 
       
   199                 BubbleLayout2::popup_call2_audio_in_call_text_2(6) );
       
   200 
       
   201             // Smaller rect for text if brand image exists
       
   202             if ( iBrandImage )
       
   203                 {
       
   204                 // Text line 3
       
   205                 BubbleUtils::LayoutLabel(
       
   206                     iTextLine3,
       
   207                     rect,
       
   208                     BubbleLayout2::popup_call2_audio_in_call_text_3(4) );
       
   209 
       
   210                 //Brand image
       
   211                 BubbleUtils::LayoutCustomElement(
       
   212             	    iBrandImage,
       
   213                     rect,
       
   214                     BubbleLayout2::popup_call2_audio_in_brand_image(2) );
       
   215                 }
       
   216             else
       
   217                 {
       
   218                 // Text line 3
       
   219                 BubbleUtils::LayoutLabel(
       
   220                     iTextLine3,
       
   221                     rect,
       
   222                     BubbleLayout2::popup_call2_audio_in_call_text_3(2) );
       
   223                 }
       
   224                 
       
   225             // Create call object bitmaps
       
   226             iBubble->SetRect( bubbleRect.Rect() );                
       
   227 
       
   228             BubbleUtils::PrepareBubbleImageL( 
       
   229                 iFrameId,
       
   230                 outerRect,
       
   231                 innerRect,
       
   232                 iBubble );
       
   233                 
       
   234             break;
       
   235             }
       
   236             
       
   237         case CBubbleManager::EActive:
       
   238         case CBubbleManager::EOnHold:
       
   239         case CBubbleManager::EDisconnected:
       
   240             {
       
   241             ///////////////////////////////////////////////////////////////////
       
   242             // First call layout. Three lines of text. Two calls.  
       
   243             ///////////////////////////////////////////////////////////////////
       
   244 
       
   245             TAknLayoutRect bubbleRect;
       
   246             bubbleRect.LayoutRect( 
       
   247                 rect, 
       
   248                 BubbleLayout2::popup_call2_audio_first_call_background(21) );
       
   249             
       
   250             TRect frameRect( TPoint(0,0), bubbleRect.Rect().Size() );
       
   251             TRect outerRect;
       
   252             TRect innerRect;
       
   253             BubbleLayout2::BubbleFrameInnerOuterRects( frameRect, 
       
   254                                                        outerRect, 
       
   255                                                        innerRect);
       
   256         
       
   257             TAknsItemID coMaskFrameId;
       
   258             if ( callState == CBubbleManager::EOnHold )
       
   259                 {
       
   260                 iFrameId = KAknsIIDQsnFrCall2Bubble;
       
   261                 coMaskFrameId = KAknsIIDQsnFrCall2BubbleCoMask;    
       
   262                 }
       
   263             else if ( callState == CBubbleManager::EDisconnected )
       
   264                 {
       
   265                 iFrameId = KAknsIIDQsnFrCall2BubbleFirstDisconn;
       
   266                 coMaskFrameId = KAknsIIDQsnFrCall2BubbleFirstCoMask;            
       
   267                 }
       
   268             else
       
   269                 {
       
   270                 iFrameId = KAknsIIDQsnFrCall2BubbleFirst;
       
   271                 coMaskFrameId = KAknsIIDQsnFrCall2BubbleFirstCoMask;                
       
   272                 }                
       
   273             
       
   274             // for possible frame draw
       
   275             iOuterRect = outerRect;
       
   276             iOuterRect.Move( Rect().iTl );
       
   277             iInnerRect = innerRect;
       
   278             iInnerRect.Move( Rect().iTl );
       
   279 
       
   280             // Call icon
       
   281             BubbleUtils::LayoutCustomElement( 
       
   282                 iSmallCallIndication, 
       
   283                 rect,
       
   284                 BubbleLayout2::popup_call2_audio_first_call_status_icon(20) );
       
   285                 
       
   286             // Ciphering off
       
   287             BubbleUtils::LayoutControl( 
       
   288                 iCyphOffImage, 
       
   289                 rect,
       
   290                 BubbleLayout2::popup_call2_audio_first_call_window_ciphering_icon(17) );
       
   291             
       
   292             // Call type pane
       
   293             BubbleUtils::LayoutCallTypeIndicators(
       
   294                 rect,
       
   295                 BubbleLayout2::popup_call2_audio_first_call_type_icon(17),
       
   296                 iTypeIndication1,   // Data/Fax
       
   297                 iTypeIndication2 ); // ALS line 2               
       
   298 
       
   299             // Text line 1
       
   300             BubbleUtils::LayoutLabel( 
       
   301                 iTextLine1, 
       
   302                 rect, 
       
   303                 BubbleLayout2::popup_call2_audio_first_call_cli_text(23) );
       
   304             
       
   305             // Text line 2 - phone number
       
   306             BubbleUtils::LayoutLabel( 
       
   307                 iTextLine2, 
       
   308                 rect, 
       
   309                 BubbleLayout2::popup_call2_audio_first_call_number_text(19) );
       
   310             
       
   311             // Text line 2 - call state
       
   312             BubbleUtils::LayoutLabel( 
       
   313                 iTextLine3, 
       
   314                 rect, 
       
   315                 BubbleLayout2::popup_call2_audio_first_call_state_text(19) );
       
   316             
       
   317             // Text line 2 - call timer
       
   318             BubbleUtils::LayoutLabel( 
       
   319                 iTimerCost, 
       
   320                 rect, 
       
   321                 BubbleLayout2::popup_call2_audio_first_call_state_text(21) );
       
   322                 
       
   323             // Build call object bubble
       
   324             iBubble->SetRect( bubbleRect.Rect() );                                
       
   325 
       
   326             BubbleUtils::PrepareBubbleImageL( 
       
   327                 iFrameId,
       
   328                 outerRect,
       
   329                 innerRect,
       
   330                 iBubble );
       
   331                            
       
   332             if ( iHeader->CallObjectImage() )
       
   333                 {
       
   334                 BubbleUtils::PrepareCallObjectImageL(
       
   335                     *iHeader,
       
   336                     iBubbleManager.CallObjectImageIncallSize() );
       
   337                 
       
   338                 TAknLayoutRect cliRect;
       
   339                 cliRect.LayoutRect( 
       
   340                     frameRect, 
       
   341                     BubbleLayout2::popup_call2_bubble_pane_graphics_cli() );
       
   342                     
       
   343                 // Combine image to bubble image
       
   344                 BubbleUtils::PrepareCallObjectToBubbleImageL(
       
   345                     iHeader->CallObjectImage(),
       
   346                     iHeader->CallObjectImageMask(),
       
   347                     cliRect.Rect(),
       
   348                     coMaskFrameId, // gradient image mask
       
   349                     outerRect,
       
   350                     innerRect,
       
   351                     iBubble );
       
   352                 }
       
   353                 
       
   354             break;
       
   355             }
       
   356             
       
   357         default:
       
   358             break;
       
   359         }
       
   360     }
       
   361 
       
   362 // ---------------------------------------------------------------------------
       
   363 // CBubbleOutlookMiddleCnap::GetCall1BubbleBitmaps
       
   364 // ---------------------------------------------------------------------------
       
   365 //    
       
   366 void CBubbleOutlookMiddleCnap::GetCall1BubbleBitmaps()
       
   367     {
       
   368     CBubbleManager::TPhoneCallState callState = iHeader->CallState();
       
   369     
       
   370     TInt bubblePicture = KErrNotFound;
       
   371     TInt bubblePictureMask = KErrNotFound;
       
   372     
       
   373     switch ( callState )
       
   374         {
       
   375         case CBubbleManager::EWaiting:
       
   376         case CBubbleManager::EIncoming:
       
   377             bubblePicture = EQgn_graf_call_rec_big_left;
       
   378             bubblePictureMask = EQgn_graf_call_rec_big_left_mask;
       
   379             break;
       
   380         case CBubbleManager::EActive:
       
   381             bubblePicture = EQgn_graf_call_two_active_emergency;
       
   382             bubblePictureMask = EQgn_graf_call_two_active_emergency_mask; 
       
   383             break;
       
   384         case CBubbleManager::EAlertToDisconnected:
       
   385         case CBubbleManager::EOnHold:
       
   386         case CBubbleManager::EDisconnected:
       
   387         case CBubbleManager::ENone:
       
   388         default:        
       
   389             bubblePicture = KErrNotFound;
       
   390             bubblePictureMask = KErrNotFound;
       
   391             break;
       
   392         }
       
   393 
       
   394     if ( bubblePicture != KErrNotFound )
       
   395         {
       
   396         if ( bubblePictureMask == KErrNotFound )
       
   397             {
       
   398             iBubbleManager.ImageManager().SetBitmapToImage( 
       
   399                 iBubble, (TBMIcons) bubblePicture );
       
   400             }
       
   401         else
       
   402             {
       
   403             iBubbleManager.ImageManager().SetBitmapToImage( 
       
   404                 iBubble, 
       
   405                 (TBMIcons) bubblePicture , 
       
   406                 (TBMIcons) bubblePictureMask);
       
   407             }
       
   408         }
       
   409         
       
   410     }
       
   411 
       
   412 //  End of File