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