phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/src/ccappstatuscontrol.cpp
changeset 0 e686773b3f54
child 3 04ab22b956c2
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2009-2009 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: UI status control
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "ccappstatuscontrol.h"
       
    20 #include "MVPbkContactLink.h"
       
    21 #include "TPbk2IconId.h"
       
    22 #include <eikimage.h>
       
    23 #include <eiklabel.h>
       
    24 #include <AknIconUtils.h>
       
    25 #include <aknutils.h>
       
    26 #include <avkon.mbg>
       
    27 #include <gulicon.h>
       
    28 #include <stringloader.h>
       
    29 #include <aknsframebackgroundcontrolcontext.h>
       
    30 #include <aknlayoutscalable_avkon.cdl.h>
       
    31 #include <AknsUtils.h>
       
    32 #include <AknsDrawUtils.h>
       
    33 #include <touchfeedback.h>
       
    34 #include <aknlayoutscalable_apps.cdl.h>
       
    35 #include <Pbk2PresentationUtils.h>
       
    36 
       
    37 namespace {
       
    38 /// Amount of child UI components
       
    39 const TInt KControlCount = 3; // image & label x 2
       
    40 /// Max amount of lines used to show status text. Rest will be clipped
       
    41 const TInt KStatusTextLines = 2;
       
    42 const TText KGraphicReplaceCharacter    = ' ';
       
    43 
       
    44 inline CGulIcon* CreateEmptyIconL()
       
    45     {               
       
    46     CFbsBitmap* image = NULL;
       
    47     CFbsBitmap* mask = NULL;
       
    48     AknIconUtils::CreateIconL( image, mask, 
       
    49             AknIconUtils::AvkonIconFileName(),
       
    50             EMbmAvkonQgn_prop_empty, 
       
    51             EMbmAvkonQgn_prop_empty_mask );                             
       
    52     return CGulIcon::NewL( image, mask );
       
    53     } 
       
    54 
       
    55 inline void ReSizeIcon( CGulIcon* aIcon, const TSize& aSize )
       
    56     {
       
    57     if( aIcon )
       
    58         {
       
    59         CFbsBitmap* bitmap = aIcon->Bitmap();
       
    60         CFbsBitmap* mask = aIcon->Mask();
       
    61         if( bitmap )
       
    62             {
       
    63             AknIconUtils::SetSize( bitmap, aSize, EAspectRatioPreservedAndUnusedSpaceRemoved );
       
    64             }
       
    65         if( mask )
       
    66             {
       
    67             AknIconUtils::SetSize( mask, aSize, EAspectRatioPreservedAndUnusedSpaceRemoved );
       
    68             }
       
    69         }
       
    70     }
       
    71 
       
    72 }   // namespace
       
    73 
       
    74 // ---------------------------------------------------------------------------
       
    75 // CCCAppStatusControl::NewL
       
    76 // ---------------------------------------------------------------------------
       
    77 //                            
       
    78 EXPORT_C CCCAppStatusControl* CCCAppStatusControl::NewL( 
       
    79     CSpbContentProvider& aContentProvider, MCCAStatusControlObserver& aObserver )
       
    80     {
       
    81     CCCAppStatusControl* self= new(ELeave) CCCAppStatusControl( aContentProvider, aObserver );
       
    82     CleanupStack::PushL(self);
       
    83     self->ConstructL();
       
    84     CleanupStack::Pop(self);
       
    85     return self;
       
    86     }
       
    87 
       
    88 // ---------------------------------------------------------------------------
       
    89 // CCCAppStatusControl::CCCAppStatusControl
       
    90 // ---------------------------------------------------------------------------
       
    91 //
       
    92 CCCAppStatusControl::CCCAppStatusControl( 
       
    93     CSpbContentProvider& aContentProvider, MCCAStatusControlObserver& aObserver ) : 
       
    94     iContentProvider( aContentProvider ),
       
    95     iObserver( aObserver ),
       
    96     iDefaultResource( KErrNotFound )
       
    97     {		
       
    98     } 
       
    99 
       
   100 // ---------------------------------------------------------------------------
       
   101 // CCCAppStatusControl::ConstructL
       
   102 // ---------------------------------------------------------------------------
       
   103 //
       
   104 void CCCAppStatusControl::ConstructL() 	
       
   105     {            	
       
   106 	// Create status icon image
       
   107     iStatusImage = new( ELeave ) CEikImage;		
       
   108     iStatusImage->SetAlignment( EHCenterVCenter );
       
   109     iStatusImage->SetPictureOwnedExternally( ETrue );    	
       
   110     iStatusImage->SetBrushStyle( CGraphicsContext::ENullBrush ); // transparent
       
   111     iStatusImage->MakeVisible( EFalse );
       
   112 	
       
   113 	// Create status text label
       
   114 	iStatusLabel1 = new( ELeave ) CEikLabel;
       
   115 	iStatusLabel1->SetAlignment( EHLeftVCenter );
       
   116 	iStatusLabel1->SetTextL( KNullDesC() ); // CEikLabel will panic without text
       
   117     iStatusLabel1->MakeVisible( EFalse );
       
   118 
       
   119     iStatusLabel2 = new( ELeave ) CEikLabel;
       
   120     iStatusLabel2->SetAlignment( EHLeftVCenter );
       
   121     iStatusLabel2->SetTextL( KNullDesC() ); // CEikLabel will panic without text
       
   122     iStatusLabel2->MakeVisible( EFalse );
       
   123     
       
   124 	iStatusText = KNullDesC().AllocL();
       
   125 		
       
   126 	iContentProvider.AddObserverL( *this );
       
   127 	
       
   128     iBgContext = CAknsFrameBackgroundControlContext::NewL(
       
   129         KAknsIIDNone, TRect(), TRect(), EFalse );	
       
   130     
       
   131     // normal state by default
       
   132     iBgContext->SetFrame( KAknsIIDQsnFrButtonNormal );
       
   133     iBgContext->SetCenter( KAknsIIDQsnFrButtonCenterNormal );
       
   134     
       
   135     // stylus feedback support
       
   136     iTouchFeedBack = MTouchFeedback::Instance();
       
   137     }
       
   138 
       
   139 // ---------------------------------------------------------------------------
       
   140 // CCCAppStatusControl::~CCCAppStatusControl
       
   141 // ---------------------------------------------------------------------------
       
   142 //
       
   143 CCCAppStatusControl::~CCCAppStatusControl()
       
   144     {	
       
   145     if( iTouchFeedBack )
       
   146         {
       
   147         iTouchFeedBack->RemoveFeedbackForControl( this );
       
   148         }
       
   149 	iContentProvider.RemoveObserver( *this );
       
   150 	
       
   151     delete iStatusImage;
       
   152     delete iStatusIcon;
       
   153     delete iStatusLabel1;    
       
   154     delete iStatusLabel2;    
       
   155     delete iStatusText;    
       
   156 	delete iDefaultIcon;
       
   157     delete iBgContext; 
       
   158     delete iLink;
       
   159     }
       
   160 
       
   161 // ---------------------------------------------------------------------------
       
   162 // CCCAppStatusControl::SetPressed
       
   163 // ---------------------------------------------------------------------------
       
   164 //
       
   165 void CCCAppStatusControl::SetPressed( TBool aPressed )
       
   166     {
       
   167     if( iPressed != aPressed )
       
   168         {
       
   169         iPressed = aPressed;
       
   170         if( iPressed )
       
   171             {
       
   172             // pressed
       
   173             iBgContext->SetFrame( KAknsIIDQsnFrButtonPressed );
       
   174             iBgContext->SetCenter( KAknsIIDQsnFrButtonCenterPressed );
       
   175             DrawNow(); // respond quickly to user event
       
   176             }
       
   177         else
       
   178             {
       
   179             // normal
       
   180             iBgContext->SetFrame( KAknsIIDQsnFrButtonNormal );
       
   181             iBgContext->SetCenter( KAknsIIDQsnFrButtonCenterNormal );
       
   182             DrawDeferred();
       
   183             }
       
   184         }
       
   185     }
       
   186 
       
   187 // ---------------------------------------------------------------------------
       
   188 // CCCAppStatusControl::IsPressed
       
   189 // ---------------------------------------------------------------------------
       
   190 //
       
   191 TBool CCCAppStatusControl::IsPressed()
       
   192     {
       
   193     return iPressed;
       
   194     }
       
   195 
       
   196 // ---------------------------------------------------------------------------
       
   197 // CCCAppStatusControl::CountComponentControls
       
   198 // ---------------------------------------------------------------------------
       
   199 //
       
   200 EXPORT_C void CCCAppStatusControl::SetContactLinkL( MVPbkContactLink& aLink )
       
   201 	{
       
   202 	delete iLink;
       
   203 	iLink = NULL;
       
   204 	iLink = aLink.CloneLC();
       
   205 	CleanupStack::Pop(); // iLink
       
   206 	
       
   207 	delete iStatusText;
       
   208 	iStatusText = NULL;
       
   209 	TPbk2IconId iconId;
       
   210     CSpbContentProvider::TSpbContentType type = CSpbContentProvider::ETypeNone; 
       
   211 	iContentProvider.GetContentL( *iLink, iStatusText, iconId, type );			
       
   212 	}
       
   213 
       
   214 // ---------------------------------------------------------------------------
       
   215 // CCCAppStatusControl::SetDefaultStatusL
       
   216 // ---------------------------------------------------------------------------
       
   217 //
       
   218 EXPORT_C void CCCAppStatusControl::SetDefaultStatusL( TInt aDefaultResource, 
       
   219 		CGulIcon* aDefaultStatusIcon )
       
   220 	{
       
   221 	iDefaultResource = aDefaultResource;
       
   222 	delete iDefaultIcon;	
       
   223 	iDefaultIcon = aDefaultStatusIcon;					
       
   224 	}
       
   225 
       
   226 // ---------------------------------------------------------------------------
       
   227 // CCCAppStatusControl::CountComponentControls
       
   228 // ---------------------------------------------------------------------------
       
   229 //
       
   230 TInt CCCAppStatusControl::CountComponentControls() const
       
   231     {
       
   232     return KControlCount;
       
   233     }
       
   234 
       
   235 // ---------------------------------------------------------------------------
       
   236 // CCCAppStatusControl::ComponentControl
       
   237 // ---------------------------------------------------------------------------
       
   238 //
       
   239 CCoeControl* CCCAppStatusControl::ComponentControl( TInt aIndex )  const
       
   240     {
       
   241     switch( aIndex )
       
   242         {
       
   243         case 0:
       
   244             {
       
   245             return  iStatusImage;
       
   246             }
       
   247         case 1:
       
   248             {
       
   249             return iStatusLabel1;
       
   250             }        
       
   251         case 2:
       
   252             {
       
   253             return iStatusLabel2;
       
   254             }        
       
   255         }
       
   256     return NULL;
       
   257     }
       
   258 
       
   259 // ---------------------------------------------------------------------------
       
   260 // CCCAppStatusControl::SetVariableLayouts
       
   261 // ---------------------------------------------------------------------------
       
   262 //
       
   263 void CCCAppStatusControl::SetVariableLayouts( TInt aOption )
       
   264     {
       
   265     const TRect rect(Rect());
       
   266     // set background graphics layout
       
   267     TAknWindowComponentLayout innerLayout(
       
   268             AknLayoutScalable_Apps::bg_button_pane_cp033( aOption ) );
       
   269     
       
   270     TAknLayoutRect innerLayoutRect;
       
   271     innerLayoutRect.LayoutRect( rect, innerLayout.LayoutLine() );
       
   272     TRect innerRect( innerLayoutRect.Rect() );
       
   273     iBgContext->SetFrameRects( rect, innerRect );      
       
   274                        
       
   275     // status icon
       
   276     TAknWindowComponentLayout statusIconLayout( 
       
   277             AknLayoutScalable_Apps::phob2_cc_button_pane_g1( aOption ) );
       
   278     
       
   279     TAknLayoutRect statusIconLayoutRect;
       
   280     statusIconLayoutRect.LayoutRect( Rect(), statusIconLayout.LayoutLine() );
       
   281     TRect statusIconRect( statusIconLayoutRect.Rect() );
       
   282     iStatusIconSize = statusIconRect.Size();
       
   283     iStatusImage->SetRect( statusIconRect );
       
   284       
       
   285     // status label 1
       
   286     AknLayoutUtils::LayoutLabel( 
       
   287             iStatusLabel1, 
       
   288             rect, 
       
   289             AknLayoutScalable_Apps::phob2_cc_button_pane_t1( aOption ) ); 
       
   290 
       
   291     // resize images for new resolution
       
   292     ReSizeIcon( iStatusIcon, iStatusIconSize );
       
   293     }
       
   294 
       
   295 // ---------------------------------------------------------------------------
       
   296 // CCCAppStatusControl::SizeChanged
       
   297 // ---------------------------------------------------------------------------
       
   298 //
       
   299 void CCCAppStatusControl::SizeChanged()
       
   300     {
       
   301     const TRect rect( Rect() );
       
   302     
       
   303     // update stylus feedback
       
   304     if( iTouchFeedBack )
       
   305         {
       
   306         iTouchFeedBack->ChangeFeedbackArea( this, 0, rect );
       
   307         }
       
   308 
       
   309     // status label 2
       
   310     AknLayoutUtils::LayoutLabel( 
       
   311             iStatusLabel2, 
       
   312             rect, 
       
   313             AknLayoutScalable_Apps::phob2_cc_button_pane_t2( 0 ) );
       
   314     
       
   315     TInt count(0);
       
   316     // If this leaves, it means we're out of memory. Nothing we can do.
       
   317     TRAP_IGNORE( count = RewrapStatusTextL() ); 
       
   318     
       
   319     TInt option( 1 );
       
   320     if( count > 1 )
       
   321         {
       
   322         option = 0;
       
   323         }
       
   324     
       
   325     SetVariableLayouts( option );
       
   326     }
       
   327 
       
   328 // ---------------------------------------------------------------------------
       
   329 // CCCAppStatusControl::HandlePointerEventL
       
   330 // ---------------------------------------------------------------------------
       
   331 //
       
   332 void CCCAppStatusControl::HandlePointerEventL(
       
   333     const TPointerEvent& aPointerEvent)
       
   334     {
       
   335     CCoeControl::HandlePointerEventL( aPointerEvent );
       
   336     
       
   337     if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
       
   338     	{
       
   339         SetPressed( ETrue );
       
   340     	}
       
   341     else if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
       
   342         {
       
   343         SetPressed( EFalse );
       
   344         if( Rect().Contains( aPointerEvent.iPosition ) )
       
   345             {
       
   346             // stylus released inside the button area
       
   347             iObserver.StatusClickedL();
       
   348             }
       
   349         }
       
   350     else if( aPointerEvent.iType == TPointerEvent::EDrag )
       
   351         {
       
   352         if( Rect().Contains( aPointerEvent.iPosition ) )
       
   353             {
       
   354             // stylus moved inside the button area
       
   355             SetPressed( ETrue );
       
   356             }
       
   357         else
       
   358             {
       
   359             // stylus moved outside the button area
       
   360             SetPressed( EFalse );
       
   361             }
       
   362         }    
       
   363   	}
       
   364 
       
   365 // ---------------------------------------------------------------------------
       
   366 // CCCAppStatusControl::SetContainerWindowL
       
   367 // ---------------------------------------------------------------------------
       
   368 //
       
   369 void CCCAppStatusControl::SetContainerWindowL( 
       
   370     const CCoeControl& aContainer )
       
   371     {
       
   372     CCoeControl::SetContainerWindowL( aContainer );
       
   373 
       
   374     // Assign window for child controls too
       
   375     TInt childCount = CountComponentControls();
       
   376     for( TInt i = 0; i < childCount; ++i )
       
   377         {
       
   378         ComponentControl( i )->SetContainerWindowL( *this );
       
   379         }
       
   380     
       
   381     // stylus feedback can be set only after we have parent control (window owning)
       
   382     if( iTouchFeedBack )
       
   383         {
       
   384         CFeedbackSpec* spec = CFeedbackSpec::New();
       
   385         if( spec )
       
   386             {
       
   387             spec->AddFeedback( ETouchEventStylusDown, ETouchFeedbackBasicButton );
       
   388             iTouchFeedBack->SetFeedbackArea( this, 0, Rect(), spec );
       
   389             delete spec;
       
   390             }
       
   391         }    
       
   392     }
       
   393 
       
   394 // ---------------------------------------------------------------------------
       
   395 // CCCAppStatusControl::ContentUpdated
       
   396 // ---------------------------------------------------------------------------
       
   397 //
       
   398 void CCCAppStatusControl::ContentUpdated( MVPbkContactLink& aLink,
       
   399 	MSpbContentProviderObserver::TSpbContentEvent aEvent )
       
   400 	{
       
   401 	TRAP_IGNORE( DoStatusUpdateL( aLink, aEvent ) );
       
   402 	}
       
   403 
       
   404 // ---------------------------------------------------------------------------
       
   405 // CCCAppStatusControl::DoStatusUpdateL
       
   406 // ---------------------------------------------------------------------------
       
   407 //
       
   408 void CCCAppStatusControl::DoStatusUpdateL( MVPbkContactLink& aLink,
       
   409     MSpbContentProviderObserver::TSpbContentEvent aEvent )
       
   410     {
       
   411     if( aEvent == EContentNotAvailable )
       
   412         {
       
   413         DefaultStatusL();
       
   414         return;
       
   415         }
       
   416     
       
   417     if( iLink && iLink->IsSame( aLink ) )
       
   418         {
       
   419         delete iStatusText;
       
   420         iStatusText = NULL;
       
   421         
       
   422         TPbk2IconId iconId;
       
   423         CSpbContentProvider::TSpbContentType type = CSpbContentProvider::ETypeNone; 
       
   424         iContentProvider.GetContentL( aLink, iStatusText, iconId, type );
       
   425         
       
   426         TInt count( RewrapStatusTextL() );
       
   427         TInt option( 1 );
       
   428         if( count > 1 )
       
   429             {
       
   430             option = 0;
       
   431             }
       
   432         SetVariableLayouts( option );
       
   433               
       
   434         CGulIcon* icon = NULL;
       
   435         TRAP_IGNORE( 
       
   436                 {
       
   437                 icon = iContentProvider.CreateServiceIconLC( iconId );
       
   438                 CleanupStack::Pop( icon );
       
   439                 } );
       
   440         if( !icon )
       
   441             {
       
   442             icon = CreateEmptyIconL();
       
   443             }
       
   444         
       
   445         delete iStatusIcon;
       
   446         // iStatusIcon owns bitmaps 
       
   447         iStatusIcon = icon;
       
   448         ReSizeIcon( iStatusIcon, iStatusIconSize );
       
   449         
       
   450         iStatusImage->SetPicture( iStatusIcon->Bitmap(), iStatusIcon->Mask() );
       
   451         iStatusImage->MakeVisible( ETrue );
       
   452         DrawDeferred();
       
   453         }
       
   454     }
       
   455 
       
   456 // ---------------------------------------------------------------------------
       
   457 // CCCAppStatusControl::RewrapStatusTextToArrayL
       
   458 // ---------------------------------------------------------------------------
       
   459 //
       
   460 inline void CCCAppStatusControl::RewrapStatusTextToArrayL( 
       
   461         TDes& aStatusText, 
       
   462         CArrayFix<TPtrC>& aTxtArray )
       
   463     {
       
   464     // generate array of line lengths 
       
   465     CArrayFixFlat<TInt>* array = 
       
   466         new(ELeave) CArrayFixFlat<TInt>( KStatusTextLines );
       
   467     CleanupStack::PushL( array );
       
   468     
       
   469     // check width and font from label 2, because label 2 layout is 
       
   470     // set before this function is called
       
   471     const TInt width( iStatusLabel2->Size().iWidth );
       
   472     array->AppendL( width );
       
   473     array->AppendL( width );
       
   474     
       
   475     const CFont* font = iStatusLabel2->Font();
       
   476    
       
   477     // wrap text
       
   478     AknTextUtils::WrapToArrayAndClipL( 
       
   479             aStatusText,             
       
   480             *array, 
       
   481             *font,                     
       
   482             aTxtArray );
       
   483     
       
   484     CleanupStack::PopAndDestroy( array );
       
   485     }
       
   486 
       
   487 // ---------------------------------------------------------------------------
       
   488 // CCCAppStatusControl::RewrapStatusTextL
       
   489 // ---------------------------------------------------------------------------
       
   490 //
       
   491 TInt CCCAppStatusControl::RewrapStatusTextL()
       
   492     {
       
   493     TInt txtCount(0);
       
   494     if( iStatusText )
       
   495         {
       
   496         HBufC* statusTxtBuffer = iStatusText->AllocLC();
       
   497         TPtr statusTxt( statusTxtBuffer->Des() );
       
   498     
       
   499         // replace non-allowed characters with ' '
       
   500         Pbk2PresentationUtils::ReplaceNonGraphicCharacters(
       
   501                 statusTxt, KGraphicReplaceCharacter );
       
   502         AknTextUtils::ReplaceCharacters(
       
   503                 statusTxt, 
       
   504                 KAknCommonWhiteSpaceCharacters, 
       
   505                 KGraphicReplaceCharacter );
       
   506     
       
   507         // generate array of line lengths 
       
   508         CArrayFixFlat<TPtrC>* txtArray = 
       
   509                 new (ELeave) CArrayFixFlat<TPtrC>(KStatusTextLines);
       
   510         CleanupStack::PushL( txtArray );
       
   511         RewrapStatusTextToArrayL( statusTxt, *txtArray );
       
   512         
       
   513         // assign new text
       
   514         TPtrC label1(KNullDesC);
       
   515         TPtrC label2(KNullDesC);
       
   516         
       
   517         txtCount = txtArray->Count();
       
   518         switch (txtCount)
       
   519             {
       
   520             case 1:
       
   521                 {
       
   522                 label1.Set( txtArray->At(0) );
       
   523                 iStatusLabel1->MakeVisible( ETrue );
       
   524                 iStatusLabel2->MakeVisible( EFalse );
       
   525                 break;
       
   526                 }
       
   527             case 2:
       
   528                 {
       
   529                 label1.Set( txtArray->At(0) );
       
   530                 label2.Set( txtArray->At(1) );
       
   531                 iStatusLabel1->MakeVisible( ETrue );
       
   532                 iStatusLabel2->MakeVisible( ETrue );
       
   533                 break;
       
   534                 }
       
   535             default:
       
   536                 {
       
   537                 }
       
   538             }
       
   539         
       
   540         iStatusLabel1->SetTextL( label1 );
       
   541         iStatusLabel2->SetTextL( label2 );
       
   542         CleanupStack::PopAndDestroy( 2, statusTxtBuffer ); // txtArray
       
   543         DrawDeferred();
       
   544         }
       
   545     return txtCount;
       
   546     }
       
   547 
       
   548 // ---------------------------------------------------------------------------
       
   549 // CCCAppStatusControl::Draw
       
   550 // ---------------------------------------------------------------------------
       
   551 //
       
   552 void CCCAppStatusControl::Draw( const TRect& /*aRect*/ ) const
       
   553     {
       
   554     TRect rect( Rect() );
       
   555     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   556     CWindowGc& gc = SystemGc();
       
   557     
       
   558     // draw skinned background
       
   559     if( !AknsDrawUtils::Background( skin, iBgContext, NULL, 
       
   560             gc, rect, KAknsDrawParamNoClearUnderImage ) )
       
   561         {
       
   562         // if skin fails then draw solid colors
       
   563         gc.SetBrushColor( iPressed ? KRgbDarkGray : KRgbGray );
       
   564         gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
   565         gc.DrawRect( rect );
       
   566         }    
       
   567     }
       
   568 
       
   569 // ---------------------------------------------------------------------------
       
   570 // CCCAppStatusControl::DefaultStatusL
       
   571 // ---------------------------------------------------------------------------
       
   572 //
       
   573 void CCCAppStatusControl::DefaultStatusL()
       
   574 	{
       
   575 	if( iDefaultResource != KErrNotFound )
       
   576 		{
       
   577 		delete iStatusText;
       
   578 		iStatusText = NULL;
       
   579 		iStatusText = StringLoader::LoadL( iDefaultResource );
       
   580         
       
   581 		const TInt count( RewrapStatusTextL() );
       
   582         TInt option( 1 );
       
   583         if( count > 1 )
       
   584             {
       
   585             option = 0;
       
   586             }
       
   587         SetVariableLayouts( option );
       
   588 		}
       
   589 	
       
   590 	if( iDefaultIcon )
       
   591 		{
       
   592         delete iStatusIcon;
       
   593         iStatusIcon = NULL;
       
   594         iStatusIcon = CGulIcon::NewL( iDefaultIcon->Bitmap(), iDefaultIcon->Mask() );
       
   595         iStatusIcon->SetBitmapsOwnedExternally( ETrue ); // iDefaultIcon owns bitmaps
       
   596         ReSizeIcon( iStatusIcon, iStatusIconSize );
       
   597 
       
   598         iStatusImage->SetPicture( iDefaultIcon->Bitmap(), iDefaultIcon->Mask() );
       
   599         iStatusImage->MakeVisible( ETrue );
       
   600         DrawDeferred();
       
   601 		}
       
   602 	}
       
   603 
       
   604 // End of file