satui/satapp/SATUISrc/CSatUiActionPerformer.cpp
branchRCL_3
changeset 20 987c9837762f
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
       
     1 /*
       
     2 * Copyright (c) 2002-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:  This class handles the communication between server and
       
    15 *                user interface
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include    <aknenv.h>
       
    22 #include    <StringLoader.h>
       
    23 #include    <SatUi.rsg>
       
    24 #include    <e32test.h>
       
    25 
       
    26 #include    <msatuiadapter.h>
       
    27 
       
    28 #include    <AknIconArray.h>                //for itemsicon
       
    29 #include    <gulicon.h>                     //for itemsicon
       
    30 #include    <aknlayout.cdl.h>               //for TAknWindowLineLayout
       
    31 #include    <aknlayoutscalable_avkon.cdl.h> //for scalable layouts
       
    32 #include    <AknUtils.h>
       
    33 #include    <AknIconUtils.h>
       
    34 #include    <aknnotedialog.h>
       
    35 
       
    36 #include    "CSatUiActionPerformer.h"
       
    37 #include    "MSatUiActionImplementer.h"
       
    38 #include    "csatuiiconhandler.h"
       
    39 #include    "tflogger.h"
       
    40 
       
    41 #include    "satui.hrh"
       
    42 
       
    43 #include    <ProfileEngineSDKCRKeys.h>
       
    44 #include    <centralrepository.h>
       
    45 #include    <cenrepnotifyhandler.h>
       
    46 
       
    47 // General Settings Cen Rep Keys.
       
    48 #include    <settingsinternalcrkeys.h>
       
    49 
       
    50 // CONSTANTS
       
    51 
       
    52 const TInt KSatActiveProfileOffline = 5; // value from ProfileEngine
       
    53 
       
    54 // PlayTone durations
       
    55 const TInt64 KSatDur170ms  = 170000;  // 170ms
       
    56 const TInt64 KSatDur200ms  = 200000;  // 200ms
       
    57 const TInt64 KSatDur250ms  = 250000;  // 250ms
       
    58 const TInt64 KSatDur1200ms = 1200000; // 1200ms
       
    59 
       
    60 // play tone tones
       
    61 _LIT8( KNetToneSeqNetBusy, "\x00\x11\x05\x4E\x30\x40\x30\x07\x0B" );
       
    62 
       
    63 _LIT8( KNetToneSeqNetCallWaiting, "\x00\x11\x05\x4E\x14\x40\x3C\x4E\x14\
       
    64 \x40\x64\x40\x64\x40\x64\x4E\x14\x40\x3C\x4E\x14\x40\x64\x40\x64\x40\x64\
       
    65 \x07\x0B" );
       
    66 
       
    67 _LIT8( KNetToneSeqNetCongestion, "\x00\x11\x05\x4E\x14\x40\x14\x07\x0B" );
       
    68 
       
    69 _LIT8( KNetToneSeqNetSpecialInformation, "\x00\x11\x05\x4F\x21\x50\
       
    70 \x21\x51\x21\x40\x64\x07\x0B" );
       
    71 
       
    72 _LIT8( KNetToneSeqDial,"\x00\x11\x05\x4E\xFE\x4E\xFE\x4E\xFE\x4E\xFE\x4E\xFE\
       
    73 \x4E\xFE\x4E\xFE\x4E\xFE\x07\x0B");
       
    74 
       
    75 _LIT8( KNetToneSeqRingGoing, "\x00\x11\x05\x4E\x64\x05\x04\x40\x64\06\x07\x0B" );
       
    76 
       
    77 // General Beep is set for forever duration. Instead of AVKON definition 170ms.
       
    78 _LIT8( KGeneralBeep, "\x00\x11\x0A\x76\x00\x0B" );
       
    79 _LIT8( KErrorTone, "\x00\x11\x0A\x6C\x19\x0B" );
       
    80 _LIT8( KRadioPathNotAvailable, "\x00\x11\x0A\x05\x03\x4E\x14\x40\x14\x06\x0B" );
       
    81 _LIT8( KRadioPathAck, "\x00\x11\x0A\x02\xFC\x0A\x80\x4E\x14\x0A\x7f\x0B" );
       
    82 
       
    83 // ================= MEMBER FUNCTIONS =======================
       
    84 
       
    85 // C++ default constructor can NOT contain any code, that
       
    86 // might leave.
       
    87 //
       
    88 CSatUiActionPerformer::CSatUiActionPerformer():
       
    89     iRefresh( EFalse ),
       
    90     iIconSupport( ETrue ),
       
    91     iClearScreenEvent( EFalse )
       
    92     {
       
    93     }
       
    94 
       
    95 // Symbian OS default constructor can leave.
       
    96 void CSatUiActionPerformer::ConstructL()
       
    97     {
       
    98     TFLOGSTRING( "CSatUiActionPerformer::ConstructL called" )
       
    99 
       
   100     //Register to Server as subsession
       
   101     //If Server is not up, this function call may take time
       
   102     iSatSession.ConnectL();
       
   103 
       
   104     iSat.RegisterL( iSatSession, this );
       
   105     iAdapter = iSat.Adapter();
       
   106     if ( !iAdapter )
       
   107         {
       
   108         User::Leave( KErrNotFound );
       
   109         }
       
   110 
       
   111     // create icon handler
       
   112     iIconHandler = CSatUiIconHandler::NewL();
       
   113 
       
   114     //Item icons
       
   115     iItemIcons = new ( ELeave ) CAknIconArray( 1 );
       
   116     
       
   117     TFLOGSTRING( "CSatUiActionPerformer::ConstructL exit" )
       
   118     }
       
   119 
       
   120 // Two-phased constructor.
       
   121 CSatUiActionPerformer* CSatUiActionPerformer::NewL()
       
   122     {
       
   123     TFLOGSTRING( "CSatUiActionPerformer::NewL() called" )
       
   124     CSatUiActionPerformer* self = new ( ELeave ) CSatUiActionPerformer;
       
   125 
       
   126     CleanupStack::PushL( self );
       
   127     self->ConstructL();
       
   128     CleanupStack::Pop( self );
       
   129     TFLOGSTRING( "CSatUiActionPerformer::NewL() exit" )
       
   130     return self;
       
   131     }
       
   132 
       
   133 // Destructor.
       
   134 CSatUiActionPerformer::~CSatUiActionPerformer()
       
   135     {
       
   136     TFLOGSTRING( "CSatUiActionPerformer::~CSatUiActionPerformer() called" )
       
   137 
       
   138     iSat.Close();
       
   139     iSatSession.Close();
       
   140 
       
   141     if ( iItemIcons )
       
   142         {
       
   143         iItemIcons->ResetAndDestroy();
       
   144         delete iItemIcons;
       
   145         }
       
   146 
       
   147     // delete icon handler
       
   148     delete iIconHandler;
       
   149     iIconHandler = NULL;
       
   150 
       
   151     iActionImplementer = NULL;
       
   152     iAdapter = NULL;
       
   153 
       
   154     TFLOGSTRING( "CSatUiActionPerformer::~CSatUiActionPerformer() exit" )
       
   155     }
       
   156 
       
   157 // ---------------------------------------------------------
       
   158 // CSatUiActionPerformer::SetImplementer
       
   159 // Sets a pointer to CSatUiViewAppUi object.
       
   160 // (other items were commented in a header).
       
   161 // ---------------------------------------------------------
       
   162 //
       
   163 void CSatUiActionPerformer::SetImplementer(
       
   164     MSatUiActionImplementer* aImplementer )
       
   165     {
       
   166     TFLOGSTRING( "CSatUiActionPerformer::SetImplementer calling" )
       
   167     iActionImplementer = aImplementer;
       
   168     TFLOGSTRING( "CSatUiActionPerformer::SetImplementer exiting" )
       
   169     }
       
   170 
       
   171 // ---------------------------------------------------------
       
   172 // CSatUiActionPerformer::Adapter
       
   173 // Returns a pointer to MSatUiAdapter provided by SatCli.
       
   174 // (other items were commented in a header).
       
   175 // ---------------------------------------------------------
       
   176 //
       
   177 MSatUiAdapter* CSatUiActionPerformer::Adapter()
       
   178     {
       
   179     TFLOGSTRING( "CSatUiActionPerformer::Adapter calling-exiting" )
       
   180     return iAdapter;
       
   181     }
       
   182 
       
   183 // ---------------------------------------------------------
       
   184 // CSatUiActionPerformer::DisplayTextL
       
   185 // Checks length of the text and calls method from
       
   186 // the CSatUiViewAppUi class if the length is OK.
       
   187 // (other items were commented in a header).
       
   188 // ---------------------------------------------------------
       
   189 //
       
   190 TSatUiResponse CSatUiActionPerformer::DisplayTextL(
       
   191     const TDesC& aText,
       
   192     const TDesC& aSimApplicationName,
       
   193     const TSatIconId& aIconId,
       
   194     TBool& aRequestedIconDisplayed,
       
   195     const TBool aSustainedText,
       
   196     const TTimeIntervalSeconds aDuration,
       
   197     const TBool aWaitUserToClear )
       
   198     {
       
   199     TFLOGSTRING( "CSatUiActionPerformer::DisplayText called" )
       
   200     TSatUiResponse response( ESatFailure );
       
   201     aRequestedIconDisplayed = ETrue;
       
   202     TBool selfExplanatoryIcon( EFalse );
       
   203 
       
   204     TInt textLength( aText.Length() );
       
   205 
       
   206     if ( ( !textLength ) || ( textLength > RSat::KTextToDisplayMaxSize ) )
       
   207         {
       
   208         TFLOGSTRING( "CSatUiActionPerformer::DisplayText no text" )
       
   209         aRequestedIconDisplayed = EFalse;
       
   210         return response;
       
   211         }
       
   212 
       
   213     CFbsBitmap* iconBitmapDisplayText = NULL;
       
   214     iActionImplementer->SetCommandPending( ETrue );
       
   215 
       
   216     //if icon is available for command
       
   217     if ( ( ( ESatSelfExplanatory == aIconId.iIconQualifier ) ||
       
   218         ( ESatNotSelfExplanatory == aIconId.iIconQualifier ) ) &&
       
   219         ( iIconSupport ) )
       
   220         {
       
   221         TFLOGSTRING( "CSatUiActionPerformer::DisplayText have icon" )
       
   222         iconBitmapDisplayText = FetchIcon( aIconId.iIdentifier,
       
   223                                            EIconDisplayText );
       
   224 
       
   225         if ( ESatSelfExplanatory == aIconId.iIconQualifier )
       
   226             {
       
   227             TFLOGSTRING( "CSatUiActionPerformer::DisplayText self \
       
   228                 explanatory icon" )
       
   229             selfExplanatoryIcon = ETrue;
       
   230             }
       
   231         }
       
   232 
       
   233     //icon not found not shown
       
   234     if ( !iconBitmapDisplayText )
       
   235         {
       
   236         aRequestedIconDisplayed = EFalse;
       
   237         }
       
   238 
       
   239     iActionImplementer->DispatchTimer( iWait );
       
   240 
       
   241     TRAPD( err,
       
   242         response = iActionImplementer->DisplayTextL( aText, aSimApplicationName,
       
   243             iconBitmapDisplayText, selfExplanatoryIcon,
       
   244             aSustainedText, aDuration, aWaitUserToClear );
       
   245         );
       
   246 
       
   247     if ( err != KErrNone )
       
   248         {
       
   249         response = ESatFailure;
       
   250         aRequestedIconDisplayed = EFalse;
       
   251         }
       
   252 
       
   253     if ( iActionImplementer->GetEndKey() )
       
   254         {
       
   255         response = ESatSessionTerminatedByUser;
       
   256         iActionImplementer->SetEndKey( EFalse );
       
   257         }
       
   258 
       
   259     iActionImplementer->SetCommandPending( EFalse );
       
   260 
       
   261     TFLOGSTRING2( "CSatUiActionPerformer::DisplayText exit, return: %d", \
       
   262         response )
       
   263     return response;
       
   264     }
       
   265 
       
   266 // ---------------------------------------------------------
       
   267 // CSatUiActionPerformer::GetInkeyL
       
   268 // Checks type of the input wanted and calls right method
       
   269 // from the CSatUiViewAppUi class.
       
   270 // (other items were commented in a header).
       
   271 // ---------------------------------------------------------
       
   272 //
       
   273 TSatUiResponse CSatUiActionPerformer::GetInkeyL(
       
   274     const TDesC& aText,
       
   275     const TSatCharacterSet aCharacterSet,
       
   276     TChar& aInput,
       
   277     const TBool /*aHelpIsAvailable*/,
       
   278     const TSatIconId& aIconId,
       
   279     TBool& aRequestedIconDisplayed,
       
   280     TUint& aDuration,
       
   281     const TBool aImmediateDigitResponse )
       
   282     {
       
   283     TFLOGSTRING( "CSatUiActionPerformer::GetInkey called" )
       
   284 
       
   285     TSatUiResponse response( ESatSuccess );
       
   286     aRequestedIconDisplayed = EFalse;
       
   287     TBuf<1> input;
       
   288 
       
   289     if ( aInput.IsAssigned() )
       
   290         {
       
   291         input.Fill( aInput, 1 );
       
   292         }
       
   293 
       
   294     if ( ( aCharacterSet == ESatYesNo ) && ( aText.Length() == 0 ) )
       
   295         {
       
   296         TFLOGSTRING( "CSatUiActionPerformer::GetInkey return ESatFailure" )
       
   297         return ESatFailure;
       
   298         }
       
   299 
       
   300     CFbsBitmap* iconBitmapGetInkey = NULL;
       
   301     iActionImplementer->SetCommandPending( ETrue );
       
   302 
       
   303     // If icon is available for command
       
   304     if ( ( ( ESatSelfExplanatory == aIconId.iIconQualifier ) ||
       
   305         ( ESatNotSelfExplanatory == aIconId.iIconQualifier ) ) &&
       
   306         ( iIconSupport ) )
       
   307         {
       
   308         TFLOGSTRING( "CSatUiActionPerformer::GetInkey have icon" )
       
   309         TIconCommand iconCommand ( EIconGetInkey );
       
   310 
       
   311         if ( ESatYesNo == aCharacterSet )
       
   312             {
       
   313             iconCommand = EIconGetYesNo;
       
   314             }
       
   315 
       
   316         iconBitmapGetInkey = FetchIcon( aIconId.iIdentifier,
       
   317                 iconCommand );
       
   318         GetScalableBitmap( iconBitmapGetInkey, iconCommand,
       
   319             aRequestedIconDisplayed );
       
   320         }
       
   321 
       
   322     TBool selfExplanatory( EFalse );
       
   323 
       
   324     // Icon is self-explanatory
       
   325     if ( ESatSelfExplanatory == aIconId.iIconQualifier )
       
   326         {
       
   327         selfExplanatory = ETrue;
       
   328         }
       
   329 
       
   330     iActionImplementer->DispatchTimer( iWait );
       
   331 
       
   332     TRAPD( err,
       
   333 
       
   334         if ( ESatYesNo == aCharacterSet || aImmediateDigitResponse )
       
   335             {
       
   336             TFLOGSTRING( "CSatUiActionPerformer::GetInkey digit response" )
       
   337             response = iActionImplementer->GetYesNoL( aText, aCharacterSet,
       
   338                 aInput, iconBitmapGetInkey, selfExplanatory, aDuration,
       
   339                 aImmediateDigitResponse );
       
   340             }
       
   341         else //ESatCharSmsDefaultAlphabet, ESatCharUcs2Alphabet, ESatDigitOnly
       
   342             {
       
   343             TFLOGSTRING( "CSatUiActionPerformer::GetInkey other conditions" )
       
   344             response = iActionImplementer->GetInputL(
       
   345                 aText, aCharacterSet, input, 1, 1, EFalse, ETrue,
       
   346                 iconBitmapGetInkey, selfExplanatory, aDuration );
       
   347 
       
   348             if ( ESatSuccess == response )
       
   349                 {
       
   350                 if ( input.Length() )
       
   351                     {
       
   352                     aInput = input[0];
       
   353                     }
       
   354                 }
       
   355             }
       
   356         );
       
   357 
       
   358     if ( err != KErrNone )
       
   359         {
       
   360         response = ESatFailure;
       
   361         }
       
   362 
       
   363     if ( iActionImplementer->GetEndKey() )
       
   364         {
       
   365         response = ESatSessionTerminatedByUser;
       
   366         iActionImplementer->SetEndKey( EFalse );
       
   367         }
       
   368     iActionImplementer->SetCommandPending( EFalse );
       
   369 
       
   370     TFLOGSTRING2( "CSatUiActionPerformer::GetInkey exit, return: %d", \
       
   371         response )
       
   372     return response;
       
   373     }
       
   374 
       
   375 // --------------------------------------------------------
       
   376 // CSatUiActionPerformer::GetInputL
       
   377 // Checks type of the input wanted and whether it should be
       
   378 // hidden and calls right method from the CSatUiViewAppUi class.
       
   379 // (other items were commented in a header).
       
   380 // ---------------------------------------------------------
       
   381 //
       
   382 TSatUiResponse CSatUiActionPerformer::GetInputL(
       
   383     const TDesC& aText,
       
   384     const TSatCharacterSet aCharacterSet,
       
   385     TDes& aInput,
       
   386     const TInt aMinLength,
       
   387     const TInt aMaxLength,
       
   388     const TBool aHideInput,
       
   389     const TBool /*aHelpIsAvailable*/,
       
   390     const TSatIconId& aIconId,
       
   391     TBool& aRequestedIconDisplayed )
       
   392     {
       
   393     TFLOGSTRING( "CSatUiActionPerformer::GetInput called" )
       
   394     TSatUiResponse response( ESatSuccess );
       
   395     aRequestedIconDisplayed = EFalse;
       
   396 
       
   397     if ( ( ( aCharacterSet == ESatCharSmsDefaultAlphabet ) ||
       
   398          ( aCharacterSet == ESatCharUcs2Alphabet ) ) &&
       
   399          ( aHideInput ) )
       
   400         {
       
   401         TFLOGSTRING( "CSatUiActionPerformer::GetInput return ESatFailure" )
       
   402         return ESatFailure;
       
   403         }
       
   404 
       
   405     CFbsBitmap* iconBitmapGetInput = NULL;
       
   406     iActionImplementer->SetCommandPending( ETrue );
       
   407 
       
   408     // If icon is available for command
       
   409     if ( ( ( ESatSelfExplanatory == aIconId.iIconQualifier ) ||
       
   410         ( ESatNotSelfExplanatory == aIconId.iIconQualifier ) ) &&
       
   411         ( iIconSupport ) )
       
   412         {
       
   413         iconBitmapGetInput = FetchIcon( aIconId.iIdentifier, EIconGetInput );
       
   414         GetScalableBitmap( iconBitmapGetInput, EIconGetInput,
       
   415             aRequestedIconDisplayed );
       
   416         }
       
   417 
       
   418     TBool selfExplanatory( EFalse );
       
   419 
       
   420     // Icon is self-explanatory
       
   421     if ( ESatSelfExplanatory == aIconId.iIconQualifier )
       
   422         {
       
   423         selfExplanatory = ETrue;
       
   424         }
       
   425 
       
   426     iActionImplementer->DispatchTimer( iWait );
       
   427 
       
   428     TUint duration ( 0 );
       
   429     TRAPD( err,
       
   430         response = iActionImplementer->GetInputL(
       
   431             aText, aCharacterSet, aInput, aMinLength, aMaxLength,
       
   432             aHideInput, EFalse, iconBitmapGetInput, selfExplanatory,
       
   433             duration );
       
   434         );
       
   435 
       
   436     if ( err != KErrNone )
       
   437         {
       
   438         TFLOGSTRING2( "CSatUiActionPerformer::GetInput err:%d", err )
       
   439         response = ESatFailure;
       
   440         aRequestedIconDisplayed = EFalse;
       
   441         }
       
   442 
       
   443     if ( iActionImplementer->GetEndKey() )
       
   444         {
       
   445         response = ESatSessionTerminatedByUser;
       
   446         iActionImplementer->SetEndKey( EFalse );
       
   447         }
       
   448     iActionImplementer->SetCommandPending( EFalse );
       
   449 
       
   450     TFLOGSTRING2( "CSatUiActionPerformer::GetInput response:%d", response )
       
   451     TFLOGSTRING2( "CSatUiActionPerformer::GetInput aRequestedIconDisplayed:%d",
       
   452         aRequestedIconDisplayed )
       
   453     TFLOGSTRING( "CSatUiActionPerformer::GetInput exit" )
       
   454     return response;
       
   455     }
       
   456 
       
   457 // ---------------------------------------------------------
       
   458 // CSatUiActionPerformer::SetUpMenuL
       
   459 // Calls the method from the CSatUiViewAppUi class to show
       
   460 // a SetUpMenu view.
       
   461 // (other items were commented in a header).
       
   462 // ---------------------------------------------------------
       
   463 //
       
   464 TSatUiResponse CSatUiActionPerformer::SetUpMenuL(
       
   465     const TDesC& aText,
       
   466     const MDesCArray& aMenuItems,
       
   467     const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
       
   468     const TBool aHelpIsAvailable,
       
   469     const TSatIconId& aIconId,
       
   470     const CArrayFixFlat<TInt>* aMenuIcons,
       
   471     const enum TSatIconQualifier aIconListQualifier,
       
   472     const enum TSatSelectionPreference /*aSelectionPreference*/ )
       
   473     {
       
   474     TFLOGSTRING( "CSatUiActionPerformer::SetUpMenu called" )
       
   475     TSatUiResponse response( ESatSuccess );
       
   476     TBool selfExplanatoryItems( EFalse );
       
   477     CFbsBitmap* iconTitleBitmap = NULL;
       
   478     iActionImplementer->SetCommandPending( ETrue );
       
   479 
       
   480     if ( !aMenuItems.MdcaCount() ||
       
   481         ( KSatActiveProfileOffline == 
       
   482             iActionImplementer->ProfileState() ) )
       
   483         {
       
   484         iActionImplementer->SetCommandPending( EFalse );
       
   485         iActionImplementer->ShowNotAvailableNoteL();
       
   486         iActionImplementer->CloseSatUI();
       
   487         return response;
       
   488         }
       
   489 
       
   490     //if contextpane icon available for command
       
   491     if ( ( ( ESatSelfExplanatory == aIconId.iIconQualifier ) ||
       
   492         ( ESatNotSelfExplanatory == aIconId.iIconQualifier ) ) &&
       
   493          ( iIconSupport ) )
       
   494         {
       
   495         iconTitleBitmap = FetchIcon( aIconId.iIdentifier,
       
   496                                      EIconSetUpMenuContext );
       
   497         GetScalableBitmap( iconTitleBitmap, EIconSetUpMenuContext );
       
   498         }
       
   499 
       
   500     iItemIcons->ResetAndDestroy();
       
   501     TInt iconCount( 0 );
       
   502 
       
   503     if ( aMenuIcons )
       
   504         {
       
   505         iconCount = aMenuIcons->Count();
       
   506         }
       
   507 
       
   508     //if icons are available for item list
       
   509     if ( ( aMenuItems.MdcaCount() == iconCount ) &&
       
   510         ( ( aIconListQualifier == ESatSelfExplanatory ) ||
       
   511         ( aIconListQualifier == ESatNotSelfExplanatory ) ) &&
       
   512         ( iIconSupport ) )
       
   513         {
       
   514         TFLOGSTRING( "CSatUiActionPerformer::SetUpMenu have icon" )
       
   515         if ( aIconListQualifier == ESatSelfExplanatory )
       
   516             {
       
   517             selfExplanatoryItems = ETrue;
       
   518             }
       
   519 
       
   520         TBool continueLoop( ETrue );
       
   521         TInt count( 0 );      
       
   522         for ( count = 0; ( count < iconCount ) && continueLoop; count++ )
       
   523             {
       
   524             CGulIcon* gulIcon = CGulIcon::NewLC();
       
   525             TUint8 itemIconId( STATIC_CAST( TUint8,
       
   526                 aMenuIcons->operator[]( count ) ) );
       
   527             CFbsBitmap* iconItemBitmap = NULL;
       
   528             iconItemBitmap = FetchIcon( itemIconId, EIconSetUpMenuItems );
       
   529 
       
   530             if ( !iconItemBitmap &&
       
   531                 ( aIconListQualifier == ESatSelfExplanatory ) )
       
   532                 {
       
   533                 TFLOGSTRING( "CSatUiActionPerformer::SetUpMenu \
       
   534                     SelfExplanatory " )
       
   535                 CleanupStack::PopAndDestroy( gulIcon ); // gulIcon
       
   536                 iItemIcons->ResetAndDestroy();
       
   537                 continueLoop = EFalse;
       
   538                 }
       
   539             else
       
   540                 {
       
   541                 if ( !iconItemBitmap &&
       
   542                     ( aIconListQualifier == ESatNotSelfExplanatory ) )
       
   543                     {
       
   544                     TFLOGSTRING( "CSatUiActionPerformer::SetUpMenu \
       
   545                         not SelfExplanatory " )
       
   546                     iconItemBitmap = new( ELeave )CFbsBitmap();
       
   547                     }
       
   548                 else
       
   549                     {
       
   550                     TFLOGSTRING( "CSatUiActionPerformer::SetUpMenu \
       
   551                         other conditions " )
       
   552                     GetScalableBitmap( iconItemBitmap, EIconSetUpMenuItems );
       
   553                     }
       
   554 
       
   555                 gulIcon->SetBitmap( iconItemBitmap );
       
   556                 iItemIcons->AppendL( gulIcon );
       
   557                 CleanupStack::Pop( gulIcon );
       
   558                 }
       
   559             }
       
   560         TFLOGSTRING2( "CSatUiActionPerformer::SetUpMenu count: %d", count )
       
   561         }
       
   562 
       
   563     TRAPD( err,
       
   564         response = iActionImplementer->SetUpMenuL(
       
   565             aText, aMenuItems, aMenuItemNextActions, iconTitleBitmap,
       
   566             iItemIcons, selfExplanatoryItems, aHelpIsAvailable );
       
   567         );
       
   568 
       
   569     if ( KErrNone != err )
       
   570         {
       
   571         response = ESatFailure;
       
   572         }
       
   573 
       
   574     if ( iActionImplementer->GetEndKey() )
       
   575         {
       
   576         response = ESatSessionTerminatedByUser;
       
   577         iActionImplementer->SetEndKey( EFalse );
       
   578         }
       
   579 
       
   580     iActionImplementer->SetCommandPending( EFalse );
       
   581     TFLOGSTRING2( "CSatUiActionPerformer::SetUpMenu exit, \
       
   582         return:%i", response )
       
   583     return response;
       
   584     }
       
   585 
       
   586 // ---------------------------------------------------------
       
   587 // CSatUiActionPerformer::SelectItemL
       
   588 // Calls the method from the CSatUiViewAppUi class to show
       
   589 // a SelectItem view.
       
   590 // (other items were commented in a header).
       
   591 // ---------------------------------------------------------
       
   592 //
       
   593 TSatUiResponse CSatUiActionPerformer::SelectItemL(
       
   594     const TDesC& aText,
       
   595     const MDesCArray& aMenuItems,
       
   596     const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
       
   597     const TInt aDefaultItem,
       
   598     TUint8& aSelection,
       
   599     const TBool aHelpIsAvailable,
       
   600     const TSatIconId& aIconId,
       
   601     const CArrayFixFlat<TInt>* aMenuIcons,
       
   602     const enum TSatIconQualifier aIconListQualifier,
       
   603     TBool& aRequestedIconDisplayed,
       
   604     const enum TSatSelectionPreference /*aSelectionPreference*/ )
       
   605     {
       
   606     TFLOGSTRING( "CSatUiActionPerformer::SelectItem called" )
       
   607     TSatUiResponse response( ESatSuccess );
       
   608     aRequestedIconDisplayed = ETrue;
       
   609     TBool selfExplanatoryItems( EFalse );
       
   610 
       
   611     CFbsBitmap* iconTitleBitmap = NULL;
       
   612     iActionImplementer->SetCommandPending( ETrue );
       
   613 
       
   614     //if contextpane icon available for command
       
   615     if ( ( ( ESatSelfExplanatory == aIconId.iIconQualifier ) ||
       
   616         ( ESatNotSelfExplanatory == aIconId.iIconQualifier ) ) &&
       
   617         ( iIconSupport ) )
       
   618         {
       
   619         TFLOGSTRING( "CSatUiActionPerformer::SelectItem icon available" )
       
   620         iconTitleBitmap = FetchIcon( aIconId.iIdentifier,
       
   621                                      EIconSetUpMenuContext );
       
   622         GetScalableBitmap( iconTitleBitmap, EIconSetUpMenuContext,
       
   623             aRequestedIconDisplayed );
       
   624         }
       
   625 
       
   626     iItemIcons->ResetAndDestroy();
       
   627 
       
   628     TInt iconCount( 0 );
       
   629 
       
   630     if ( aMenuIcons )
       
   631         {
       
   632         iconCount = aMenuIcons->Count();
       
   633         }
       
   634 
       
   635     TFLOGSTRING2( "CSatUiActionPerformer::SelectItem iconCount:%d", iconCount )
       
   636 
       
   637     //if icons are available for item list
       
   638     if ( ( aMenuItems.MdcaCount() == iconCount ) &&
       
   639         ( ( aIconListQualifier == ESatSelfExplanatory ) ||
       
   640         ( aIconListQualifier == ESatNotSelfExplanatory ) ) &&
       
   641         ( iIconSupport ) )
       
   642         {
       
   643         TFLOGSTRING(
       
   644             "CSatUiActionPerformer::SelectItem icon available for item list" )
       
   645 
       
   646         if ( aIconListQualifier == ESatSelfExplanatory )
       
   647             {
       
   648             selfExplanatoryItems = ETrue;
       
   649             }
       
   650 
       
   651         TBool continueLoop( ETrue );
       
   652         TInt count( 0 ); 
       
   653         for ( count = 0; ( count < iconCount ) && continueLoop; count++ )
       
   654             {
       
   655             CGulIcon* gulIcon = CGulIcon::NewLC();
       
   656             TUint8 itemIconId = STATIC_CAST( TUint8,
       
   657                 aMenuIcons->operator[]( count ) );
       
   658             CFbsBitmap* iconItemBitmap = NULL;
       
   659             iconItemBitmap = FetchIcon( itemIconId, EIconSetUpMenuItems );
       
   660 
       
   661             // when icon can't be received and is set to self explanatory, we
       
   662             // iqnore all icons and show only text
       
   663             if ( !iconItemBitmap &&
       
   664                 ( aIconListQualifier == ESatSelfExplanatory ) )
       
   665                 {
       
   666                 TFLOGSTRING( "CSatUiActionPerformer::SelectItem \
       
   667                     SelfExplanatory " )
       
   668                 CleanupStack::PopAndDestroy( gulIcon ); // gulIcon
       
   669                 iItemIcons->ResetAndDestroy();
       
   670                 continueLoop = EFalse;
       
   671                 aRequestedIconDisplayed = EFalse;
       
   672                 }
       
   673             else
       
   674                 {
       
   675                 // when icon can't be received and is set to not self
       
   676                 // explanatory, we replace it with empty icon
       
   677                 if ( !iconItemBitmap &&
       
   678                     ( aIconListQualifier == ESatNotSelfExplanatory ) )
       
   679                     {
       
   680                     TFLOGSTRING( "CSatUiActionPerformer::SelectItem \
       
   681                         not SelfExplanatory " )
       
   682                     iconItemBitmap = new( ELeave )CFbsBitmap();
       
   683                     aRequestedIconDisplayed = EFalse;
       
   684                     }
       
   685                 // when icon was able to receive, we scale it
       
   686                 // if every prior icon is correctly received
       
   687                 else if ( aRequestedIconDisplayed )
       
   688                     {
       
   689                     TFLOGSTRING( "CSatUiActionPerformer::SelectItem \
       
   690                         receive icon " )
       
   691                     GetScalableBitmap( iconItemBitmap, EIconSetUpMenuItems,
       
   692                         aRequestedIconDisplayed );
       
   693                     }
       
   694                 // if aRequestIconDisplayed is false, at least one prior icon
       
   695                 // fetch had problems and thus we must report that by not
       
   696                 // updating aRequestedIconDisplayed
       
   697                 else
       
   698                     {
       
   699                     TFLOGSTRING( "CSatUiActionPerformer::SelectItem \
       
   700                         aRequestIconDisplayed false " )
       
   701                     GetScalableBitmap( iconItemBitmap, EIconSetUpMenuItems );
       
   702                     }
       
   703 
       
   704                 gulIcon->SetBitmap( iconItemBitmap );
       
   705                 iItemIcons->AppendL( gulIcon );
       
   706                 CleanupStack::Pop( gulIcon );
       
   707                 }
       
   708             }
       
   709         TFLOGSTRING2( "CSatUiActionPerformer::SelectItem count: %d", count )
       
   710         }
       
   711 
       
   712     TRAPD( err,
       
   713         response = iActionImplementer->SelectItemL( aText, aMenuItems,
       
   714             aMenuItemNextActions, aDefaultItem, aSelection, iconTitleBitmap,
       
   715             iItemIcons, selfExplanatoryItems, aHelpIsAvailable );
       
   716         );
       
   717 
       
   718     if ( err != KErrNone )
       
   719         {
       
   720         response = ESatFailure;
       
   721         aRequestedIconDisplayed = EFalse;
       
   722         }
       
   723 
       
   724     if ( iActionImplementer->GetEndKey() )
       
   725         {
       
   726         response = ESatSessionTerminatedByUser;
       
   727         iActionImplementer->SetEndKey( EFalse );
       
   728         }
       
   729 
       
   730     iActionImplementer->SetCommandPending( EFalse );
       
   731 
       
   732     TFLOGSTRING2( "CSatUiActionPerformer::SelectItem response:%d", response )
       
   733     TFLOGSTRING( "CSatUiActionPerformer::SelectItem exit" )
       
   734     return response;
       
   735     }
       
   736 
       
   737 // ---------------------------------------------------------
       
   738 // CSatUiActionPerformer::PlayTone
       
   739 // Checks type of the tone wanted and calls right method
       
   740 // from the CSatUiViewAppUi class.
       
   741 // (other items were commented in a header).
       
   742 // ---------------------------------------------------------
       
   743 //
       
   744 TSatUiResponse CSatUiActionPerformer::PlayTone(
       
   745     const TDesC& aText,
       
   746     const TSatTone aTone,
       
   747     const TTimeIntervalMicroSeconds aDuration,
       
   748     const TSatIconId& aIconId,
       
   749     TBool& aRequestedIconDisplayed )
       
   750     {
       
   751     TFLOGSTRING( "CSatUiActionPerformer::PlayTone called" )
       
   752     TFLOGSTRING2( "CSatUiActionPerformer::PlayTone tone is %i", aTone )
       
   753 
       
   754     aRequestedIconDisplayed = EFalse;
       
   755 
       
   756     iSequence.Zero();
       
   757     TTimeIntervalMicroSeconds duration( aDuration.Int64() );
       
   758     iActionImplementer->SetCommandPending( ETrue );
       
   759     // This is used to determine zero length duration.
       
   760     const TTimeIntervalMicroSeconds zeroDuration( static_cast<TInt64>( 0 ) );
       
   761 
       
   762     CFbsBitmap* iconBitmap = NULL;
       
   763     // If icon is available for command
       
   764     if ( ( ( ESatSelfExplanatory == aIconId.iIconQualifier ) ||
       
   765          ( ESatNotSelfExplanatory == aIconId.iIconQualifier ) ) &&
       
   766         ( iIconSupport ) )
       
   767         {
       
   768         iconBitmap = FetchIcon( aIconId.iIdentifier, EIconPlayTone );
       
   769         GetScalableBitmap( iconBitmap, EIconPlayTone,
       
   770             aRequestedIconDisplayed );
       
   771         }
       
   772 
       
   773     TBool selfExplanatory( EFalse );
       
   774 
       
   775     // Icon is self-explanatory
       
   776     if ( ESatSelfExplanatory == aIconId.iIconQualifier )
       
   777         {
       
   778         selfExplanatory = ETrue;
       
   779         }
       
   780 
       
   781     // Check if the current Profile is Meeting
       
   782     TInt errCR( KErrNone );
       
   783     TInt profileId( 0 );
       
   784     
       
   785     CRepository* repository = NULL;
       
   786     TSatTone tone = aTone;
       
   787 
       
   788     // Which UID to monitor.
       
   789     TRAP( errCR, repository = CRepository::NewL( KCRUidProfileEngine ) );
       
   790 
       
   791     if ( !errCR && repository )
       
   792         {
       
   793         errCR = repository->StartTransaction(
       
   794             CRepository::EReadWriteTransaction );
       
   795         errCR = repository->Get( KProEngActiveProfile, profileId );
       
   796         }
       
   797 
       
   798     delete repository;
       
   799 
       
   800     TFLOGSTRING2( "CSatUiActionPerformer::PlayTone(): err = %d", errCR )
       
   801 
       
   802     TFLOGSTRING2( "SCSatUiActionPerformer::PlayTone() profileId: %d",
       
   803         profileId )
       
   804         
       
   805     switch ( tone )
       
   806         {
       
   807         case ESatGeneralBeep:
       
   808         case ESatPositiveTone:
       
   809         case ESatToneNotSet:
       
   810             if ( zeroDuration == duration )
       
   811                 {
       
   812                 duration = KSatDur170ms; // 170ms
       
   813                 }
       
   814             iSequence.Copy( KGeneralBeep );
       
   815             break;
       
   816         case ESatNegativeTone:
       
   817             if ( zeroDuration == duration )
       
   818                 {
       
   819                 duration = KSatDur250ms; // 250ms
       
   820                 }
       
   821             iSequence.Copy( KErrorTone );
       
   822             break;
       
   823         case ESatRadioPathNotAvailableCallDropped:
       
   824             if ( zeroDuration == duration )
       
   825                 {
       
   826                 duration = KSatDur1200ms; // 1200ms
       
   827                 }
       
   828             iSequence.Copy( KRadioPathNotAvailable );
       
   829             break;
       
   830         case ESatRadioPathAcknowledge:
       
   831             if ( zeroDuration == duration )
       
   832                 {
       
   833                 duration = KSatDur200ms; // 200ms
       
   834                 }
       
   835             iSequence.Copy( KRadioPathAck );
       
   836             break;
       
   837         case ESatDialTone:
       
   838             {
       
   839             if ( zeroDuration == duration )
       
   840                 {
       
   841                 TFLOGSTRING( "CSatUiActionPerformer::PlayTone() ESatDialTone" )
       
   842                 return ESatCmdDataNotUnderstood;
       
   843                 }
       
   844             else
       
   845                 {
       
   846                 iSequence.Copy( KNetToneSeqDial );
       
   847                 }
       
   848             }
       
   849             break;
       
   850         case ESatCalledSubscriberBusy:
       
   851             {
       
   852             if ( zeroDuration == duration )
       
   853                 {
       
   854                 return ESatCmdDataNotUnderstood;
       
   855                 }
       
   856             else
       
   857                 {
       
   858                 iSequence.Copy( KNetToneSeqNetBusy );
       
   859                 }
       
   860             }
       
   861             break;
       
   862         case ESatCongestion:
       
   863             {
       
   864             if ( zeroDuration == duration )
       
   865                 {
       
   866                 return ESatCmdDataNotUnderstood;
       
   867                 }
       
   868             else
       
   869                 {
       
   870                 iSequence.Copy( KNetToneSeqNetCongestion );
       
   871                 }
       
   872             }
       
   873             break;
       
   874         case ESatErrorSpecialInfo:
       
   875             {
       
   876             if ( zeroDuration == duration )
       
   877                 {
       
   878                 return ESatCmdDataNotUnderstood;
       
   879                 }
       
   880             else
       
   881                 {
       
   882                 iSequence.Copy( KNetToneSeqNetSpecialInformation );
       
   883                 }
       
   884             }
       
   885             break;
       
   886         case ESatCallWaitingTone:
       
   887             {
       
   888             if ( zeroDuration == duration )
       
   889                 {
       
   890                 return ESatCmdDataNotUnderstood;
       
   891                 }
       
   892             else
       
   893                 {
       
   894                 iSequence.Copy( KNetToneSeqNetCallWaiting );
       
   895                 }
       
   896             }
       
   897             break;
       
   898         case ESatRingingTone:
       
   899             {
       
   900             if ( zeroDuration == duration )
       
   901                 {
       
   902                 return ESatCmdDataNotUnderstood;
       
   903                 }
       
   904             else
       
   905                 {
       
   906                 iSequence.Copy( KNetToneSeqRingGoing );
       
   907                 }
       
   908             }
       
   909             break;
       
   910         case ESatUserSelectedToneIncomingSpeech:
       
   911         case ESatUserSelectedToneIncomingSms:
       
   912             {
       
   913             // These are handled later.
       
   914             }
       
   915             break;
       
   916         default:
       
   917             TFLOGSTRING( "CSatUiActionPerformer::PlayTone Default" )
       
   918             return ESatCmdDataNotUnderstood;
       
   919         }
       
   920 
       
   921     TSatUiResponse response( ESatFailure );
       
   922 
       
   923     iActionImplementer->DispatchTimer( iWait );
       
   924     
       
   925     // ESatSClearScreenEvent doesn't occur,clear displaytext on screen.
       
   926     if ( EFalse == iClearScreenEvent )
       
   927         {
       
   928         // Clear displaytext on the screen.
       
   929         TFLOGSTRING( "CSatUiActionPerformer::PlayTone clear screen" )
       
   930         iActionImplementer->ClearScreen();        
       
   931         }
       
   932     
       
   933     if ( 0 != iSequence.Length() )
       
   934         {
       
   935         TFLOGSTRING2( "CSatUiActionPerformer::PlayTone duration microseconds %d",
       
   936             aDuration.Int64() )
       
   937         TRAPD( err,
       
   938             response = iActionImplementer->PlayStandardToneL(
       
   939                 aText,
       
   940                 iSequence,
       
   941                 duration,
       
   942                 iconBitmap,
       
   943                 selfExplanatory );
       
   944             );
       
   945 
       
   946         if ( KErrNone != err )
       
   947             {
       
   948             response = ESatFailure;
       
   949             TFLOGSTRING2( "CSatUiActionPerformer::PlayTone error %i", err )
       
   950             }
       
   951         TFLOGSTRING( "CSatUiActionPerformer::PlayTone StandardTone exit" )
       
   952         }
       
   953     else
       
   954         {
       
   955         TFLOGSTRING( "CSatUiActionPerformer::PlayTone length of sequence \
       
   956             is zero" )        
       
   957         
       
   958             TRAPD( err,
       
   959             response = iActionImplementer->PlayUserSelectedToneL(
       
   960                 aText,
       
   961                 aDuration.Int64(),
       
   962                 tone,
       
   963                 iconBitmap,
       
   964                 selfExplanatory );
       
   965             );
       
   966 
       
   967             if ( KErrNone != err )
       
   968                 {
       
   969                 response = ESatFailure;
       
   970                 TFLOGSTRING2( "CSatUiActionPerformer::PlayTone error %i", err )
       
   971                 }
       
   972             
       
   973         TFLOGSTRING( "CSatUiActionPerformer::PlayTone UserSelectedTone exit" )
       
   974         }
       
   975 
       
   976     if ( iActionImplementer->GetEndKey() )
       
   977         {
       
   978         response = ESatSessionTerminatedByUser;
       
   979         iActionImplementer->SetEndKey( EFalse );
       
   980         }
       
   981 
       
   982     iActionImplementer->SetCommandPending( EFalse );
       
   983     
       
   984     TFLOGSTRING( "CSatUiActionPerformer::PlayTone iClearScreenEvent false" )
       
   985     iClearScreenEvent = EFalse;
       
   986     
       
   987     TFLOGSTRING2( "CSatUiActionPerformer::PlayTone response: %d", response )
       
   988     TFLOGSTRING( "CSatUiActionPerformer::PlayTone exit" )
       
   989     return response;
       
   990     }
       
   991 
       
   992 // ---------------------------------------------------------
       
   993 // CSatUiActionPerformer::ConfirmCommand
       
   994 // (other items were commented in a header).
       
   995 // ---------------------------------------------------------
       
   996 //
       
   997 void CSatUiActionPerformer::ConfirmCommand(
       
   998     const TSatSQueryCommand aCommandId,
       
   999     const TSatAlphaIdStatus aAlphaIdStatus,
       
  1000     const TDesC& aText,
       
  1001     const TDesC& aAdditionalText,
       
  1002     TBool& aActionAccepted,
       
  1003     const TSatIconId& aIconId,
       
  1004     TBool& aRequestedIconDisplayed,
       
  1005     TBool& aTerminatedByUser )
       
  1006     {
       
  1007     TFLOGSTRING( "CSatUiActionPerformer::ConfirmCommand calling" )
       
  1008     aRequestedIconDisplayed = EFalse;
       
  1009     TInt error( KErrNone );
       
  1010     TBool selfExplanatory( EFalse );
       
  1011 
       
  1012     // Icon is self-explanatory
       
  1013     if ( ESatSelfExplanatory == aIconId.iIconQualifier )
       
  1014         {
       
  1015         selfExplanatory = ETrue;
       
  1016         }
       
  1017 
       
  1018     aActionAccepted = ETrue;
       
  1019 
       
  1020     iActionImplementer->SetCommandPending( ETrue );
       
  1021 
       
  1022     iActionImplementer->StopShowWaitNote();
       
  1023 
       
  1024     CFbsBitmap* iconBitmap = NULL;
       
  1025     // If icon is available for command
       
  1026     if ( ( ( ( ESatSelfExplanatory == aIconId.iIconQualifier ) ||
       
  1027         ( ESatNotSelfExplanatory == aIconId.iIconQualifier ) ) &&
       
  1028         ( ( ESatOpenChannelQuery == aCommandId ) ||
       
  1029         ( ESatSLaunchBrowserQuery == aCommandId ) ||
       
  1030         ( ESatSSetUpCallQuery == aCommandId ) ) ) &&
       
  1031         ( iIconSupport ) )
       
  1032         {
       
  1033         iconBitmap = FetchIcon( aIconId.iIdentifier,
       
  1034             EIconConfirmCommand );
       
  1035         GetScalableBitmap( iconBitmap, EIconConfirmCommand,
       
  1036             aRequestedIconDisplayed );
       
  1037         }
       
  1038     TFLOGSTRING2( "CSatUiActionPerformer::ConfirmCommand aCommandId: %d",
       
  1039                   aCommandId )
       
  1040     // Check quering command
       
  1041     switch ( aCommandId )
       
  1042         {
       
  1043         case ESatOpenChannelQuery:
       
  1044             {
       
  1045             TFLOGSTRING( " Quering OpenChannel" )
       
  1046             TRAP( error, iActionImplementer->ConfirmOpenChannelL(
       
  1047                 aText, aActionAccepted, iconBitmap, selfExplanatory ) );
       
  1048             break;
       
  1049             }
       
  1050 
       
  1051         case ESatSRefreshQuery:
       
  1052             {
       
  1053             TFLOGSTRING( " Quering Refresh" )
       
  1054             TRAP(
       
  1055                 error, iActionImplementer->ConfirmRefreshL( aActionAccepted );
       
  1056                 );
       
  1057             break;
       
  1058             }
       
  1059 
       
  1060         case ESatSLaunchBrowserQuery:
       
  1061             {
       
  1062             TFLOGSTRING( " Quering LaunchBrowser" )
       
  1063             HBufC* textHolder = NULL;
       
  1064 
       
  1065             TRAP( error,
       
  1066             if ( ESatAlphaIdNull != aAlphaIdStatus )
       
  1067                 {
       
  1068                 TFLOGSTRING( " CSatUiActionPerformer::ConfirmCommand AlphaId \
       
  1069                     isn't null" )    
       
  1070                 if ( ESatAlphaIdNotProvided == aAlphaIdStatus )
       
  1071                     {
       
  1072                     TFLOGSTRING( " CSatUiActionPerformer::ConfirmCommand \
       
  1073                         AlphaId not provided" )
       
  1074                     textHolder = StringLoader::LoadLC(
       
  1075                         R_QTN_SAT_CONF_LAUNCH_BROW,
       
  1076                         iActionImplementer->CoeEnv() );
       
  1077                     }
       
  1078                 else
       
  1079                     {
       
  1080                     TFLOGSTRING( " CSatUiActionPerformer::ConfirmCommand \
       
  1081                         AlphaId provided" )
       
  1082                     textHolder = HBufC::NewLC( aText.Length() );
       
  1083                     TPtr ptr = textHolder->Des();
       
  1084                     ptr.Append( aText );
       
  1085                     }
       
  1086 
       
  1087                 iActionImplementer->ConfirmLaunchBrowserL( *textHolder,
       
  1088                     aActionAccepted, iconBitmap, selfExplanatory );
       
  1089                 // Clean textHolder
       
  1090                 CleanupStack::PopAndDestroy( textHolder );
       
  1091                 }
       
  1092 
       
  1093             ); // TRAP
       
  1094             break;
       
  1095             }
       
  1096 
       
  1097         case ESatSSendSmQuery:
       
  1098             {
       
  1099             TFLOGSTRING( " Quering SendSm" )
       
  1100             TRAP( error, iActionImplementer->ConfirmSendL( aText,
       
  1101                   aActionAccepted, ESatUiConfirmSendSms ) );
       
  1102             break;
       
  1103             }
       
  1104 
       
  1105         case ESatSSendSsQuery:
       
  1106             {
       
  1107             TFLOGSTRING( " Quering SendSs" )
       
  1108             TRAP( error, iActionImplementer->ConfirmSendL( aText,
       
  1109                   aActionAccepted, ESatUiConfirmSendSs ) );
       
  1110             break;
       
  1111             }
       
  1112 
       
  1113         case ESatSSendUssdQuery:
       
  1114             {
       
  1115             TFLOGSTRING( " Quering SendUssd" )
       
  1116             TRAP( error, iActionImplementer->ConfirmSendL( aText,
       
  1117                   aActionAccepted, ESatUiConfirmSendUssd ) );
       
  1118             break;
       
  1119             }
       
  1120 
       
  1121         case ESatSSetUpCallQuery:
       
  1122             {
       
  1123             TFLOGSTRING( " Quering SetUpCall" )
       
  1124             TRAP( error, iActionImplementer->ConfirmSetUpCallL(
       
  1125                 aText, aAdditionalText, aActionAccepted, iconBitmap,
       
  1126                 selfExplanatory ) );
       
  1127             break;
       
  1128             }
       
  1129 
       
  1130         default:
       
  1131             {
       
  1132             TFLOGSTRING( " Unknown quering command" )
       
  1133             aActionAccepted = EFalse;
       
  1134             }
       
  1135         }
       
  1136 
       
  1137     if ( KErrNone != error )
       
  1138         {
       
  1139         TFLOGSTRING2( "CSatUiActionPerformer::ConfirmCommand error:%d", error )
       
  1140         aActionAccepted = EFalse;
       
  1141         }
       
  1142     else if ( iActionImplementer->GetEndKey() )
       
  1143         {
       
  1144         TFLOGSTRING( "CSatUiActionPerformer::ConfirmCommand press endkey" )
       
  1145         aTerminatedByUser = ETrue;
       
  1146         aActionAccepted = EFalse;
       
  1147         iActionImplementer->SetEndKey( EFalse );
       
  1148         }
       
  1149     else
       
  1150         {
       
  1151         // Meaningless else
       
  1152         }
       
  1153 
       
  1154     iActionImplementer->SetCommandPending( EFalse );
       
  1155     TFLOGSTRING( "CSatUiActionPerformer::ConfirmCommand exiting" )
       
  1156     }
       
  1157 
       
  1158 // ---------------------------------------------------------
       
  1159 // CSatUiActionPerformer::Notification
       
  1160 // (other items were commented in a header).
       
  1161 // ---------------------------------------------------------
       
  1162 //
       
  1163 TSatUiResponse CSatUiActionPerformer::Notification(
       
  1164     const TSatSNotifyCommand aCommandId,
       
  1165     const TSatAlphaIdStatus aAlphaIdStatus,
       
  1166     const TDesC& aText,
       
  1167     const TSatIconId& aIconId,
       
  1168     TBool& aRequestedIconDisplayed,
       
  1169     const TSatControlResult aControlResult )
       
  1170     {
       
  1171     TFLOGSTRING( "CSatUiActionPerformer::Notification calling" )
       
  1172     TSatUiResponse response = ESatSuccess;
       
  1173     TInt error( KErrNone );
       
  1174     aRequestedIconDisplayed = EFalse;
       
  1175     iActionImplementer->SetCommandPending( ETrue );
       
  1176 
       
  1177     HBufC* textHolder = NULL;
       
  1178 
       
  1179     // In case where command id is SendDtmf and alphaID is not provided,
       
  1180     // DTMF string to be sent is shown in dialog along with default text.
       
  1181     if ( ( ESatSSendDtmfNotify == aCommandId ) &&
       
  1182          ( ESatAlphaIdNotProvided == aAlphaIdStatus ) )
       
  1183         {
       
  1184         TFLOGSTRING( "CSatUiActionPerformer::Notification SendDtmf" )
       
  1185         TRAP( error,
       
  1186             TInt resource = DefaultAlphaIdL( aCommandId, aControlResult );
       
  1187             // Now that resource is defined, get default text
       
  1188             textHolder = StringLoader::LoadL(
       
  1189                 resource, aText )
       
  1190             );
       
  1191         }
       
  1192     // Get default text, if alpha not provided or it is NULL
       
  1193     else if ( aText.Length() == 0 && ESatAlphaIdNotNull != aAlphaIdStatus )
       
  1194         {
       
  1195         TFLOGSTRING( "CSatUiActionPerformer::Notification alpha is null" )
       
  1196         TRAP( error,
       
  1197             TInt resource = DefaultAlphaIdL( aCommandId, aControlResult );
       
  1198             // Now that resource is defined, get default text
       
  1199             textHolder = StringLoader::LoadL(
       
  1200                 resource, iActionImplementer->CoeEnv() )
       
  1201             );
       
  1202         }
       
  1203     // else use given text
       
  1204     else
       
  1205         {
       
  1206         TFLOGSTRING( "CSatUiActionPerformer::Notification alpha is provided" )
       
  1207         TRAP( error,
       
  1208             textHolder = HBufC::NewL( aText.Length() );
       
  1209             TPtr ptr = textHolder->Des();
       
  1210             ptr.Copy( aText );
       
  1211             );
       
  1212         }
       
  1213 
       
  1214     if ( !textHolder )
       
  1215         {
       
  1216         TRAP( error, textHolder = HBufC::NewL( 0 ) );
       
  1217         }
       
  1218 
       
  1219     // No need to add textHolder into CleanupStack, since this is
       
  1220     // not a leaving function
       
  1221 
       
  1222     if ( ( KErrNone == error || KErrArgument == error ) && textHolder )
       
  1223         {
       
  1224         TFLOGSTRING( "CSatUiActionPerformer::Notification none error " )
       
  1225         CFbsBitmap* iconBitmap = NULL;
       
  1226         TBool selfExplanatoryIcon( EFalse );
       
  1227         // Fetch icon
       
  1228         // Icons not supported for sending and receiving data
       
  1229         if ( ( ( ( ESatSelfExplanatory == aIconId.iIconQualifier ) ||
       
  1230             ( ESatNotSelfExplanatory == aIconId.iIconQualifier ) ) &&
       
  1231             ( ( ESatSSendDataNotify != aCommandId ) &&
       
  1232             ( ESatSReceiveDataNotify != aCommandId ) ) ) &&
       
  1233             ( iIconSupport ) )
       
  1234             {
       
  1235             iconBitmap = FetchIcon( aIconId.iIdentifier,
       
  1236                 EIconNotification );
       
  1237             GetScalableBitmap( iconBitmap, EIconNotification,
       
  1238                 aRequestedIconDisplayed );
       
  1239             }
       
  1240 
       
  1241         if ( ESatSelfExplanatory == aIconId.iIconQualifier )
       
  1242             {
       
  1243             selfExplanatoryIcon = ETrue;
       
  1244             }
       
  1245 
       
  1246         // Check notifying command
       
  1247         switch ( aCommandId )
       
  1248             {
       
  1249             case ESatSSendDataNotify:
       
  1250                 {
       
  1251                 TFLOGSTRING( " Notifying SendData" )
       
  1252                 TRAP( error,
       
  1253                     iActionImplementer->ShowBIPNoteL(
       
  1254                         ESendDataIdentier, *textHolder, iconBitmap,
       
  1255                         selfExplanatoryIcon )
       
  1256                     );
       
  1257                 break;
       
  1258                 }
       
  1259             case ESatSReceiveDataNotify:
       
  1260                 {
       
  1261                 TFLOGSTRING( " Notifying ReceiveData" )
       
  1262                 TRAP( error,
       
  1263                     iActionImplementer->ShowBIPNoteL(
       
  1264                         EReceiveDataIdentifier, *textHolder, iconBitmap,
       
  1265                         selfExplanatoryIcon )
       
  1266                     );
       
  1267                 break;
       
  1268                 }
       
  1269             case ESatSCloseChannelNotify:
       
  1270                 {
       
  1271                 TFLOGSTRING( " Notifying CloseChannel" )
       
  1272                 iActionImplementer->StopShowWaitNote();
       
  1273                 TRAP( error,
       
  1274                     iActionImplementer->ShowBIPNoteL(
       
  1275                         ECloseChannelIdentifier, *textHolder, iconBitmap,
       
  1276                         selfExplanatoryIcon )
       
  1277                     );
       
  1278                 break;
       
  1279                 }
       
  1280             case ESatSMoSmControlNotify:
       
  1281                 {
       
  1282                 TFLOGSTRING( " Notifying MoSmControl" )
       
  1283                 TRAP( error,
       
  1284                     iActionImplementer->MoSmControlL(
       
  1285                         *textHolder, aAlphaIdStatus )
       
  1286                     );
       
  1287                 iActionImplementer->SetCommandPending( EFalse );
       
  1288                 break;
       
  1289                 }
       
  1290             case ESatSCallControlNotify:
       
  1291                 {
       
  1292                 TFLOGSTRING( " Notifying CallControl" )
       
  1293                 iActionImplementer->DispatchTimer( iWait );
       
  1294                 TRAP( error,
       
  1295                     iActionImplementer->CallControlL(
       
  1296                         *textHolder, aAlphaIdStatus )
       
  1297                     );
       
  1298                 iActionImplementer->SetCommandPending( EFalse );
       
  1299                 break;
       
  1300                 }
       
  1301             case ESatSSendUssdNotify:   // fall through
       
  1302             case ESatSSendSsNotify:
       
  1303                 {
       
  1304                 TFLOGSTRING( " Notifying SendSs / SendUssd" )
       
  1305                 iActionImplementer->StopShowWaitNote();
       
  1306                 TRAP( error,
       
  1307                     if ( ( ESatAlphaIdNotNull == aAlphaIdStatus ) ||
       
  1308                         ( ESatAlphaIdNotProvided == aAlphaIdStatus ) )
       
  1309                         {
       
  1310                         iActionImplementer->ShowSsWaitNoteL( *textHolder,
       
  1311                             iconBitmap, selfExplanatoryIcon );
       
  1312                         }
       
  1313                     else
       
  1314                         {
       
  1315                         iActionImplementer->ShowWaitNoteWithoutDelayL();
       
  1316                         }
       
  1317                     );
       
  1318                 break;
       
  1319                 }
       
  1320             case ESatSSendDtmfNotify:
       
  1321                 {
       
  1322                 TFLOGSTRING( " Notifying SendDtmf" )
       
  1323                 iActionImplementer->StopShowWaitNote();
       
  1324                 TRAP( error, response = iActionImplementer->ShowDtmfWaitNoteL(
       
  1325                     *textHolder, iconBitmap, selfExplanatoryIcon ) );
       
  1326                 break;
       
  1327                 }
       
  1328             case ESatSSendSmsNotify:
       
  1329                 {
       
  1330                 TFLOGSTRING( " Notifying SendSms" )
       
  1331                 iActionImplementer->StopShowWaitNote();
       
  1332 
       
  1333                 if ( KErrNone == error )
       
  1334                     {
       
  1335                     // Show Sms wait note
       
  1336                     TRAP( error,
       
  1337                         iActionImplementer->ShowSmsWaitNoteL( *textHolder,
       
  1338                             iconBitmap, selfExplanatoryIcon ) );
       
  1339                     }
       
  1340 
       
  1341                 break;
       
  1342                 }
       
  1343             default:
       
  1344                 {
       
  1345                 TFLOGSTRING( " Unkown notification" )
       
  1346                 response = ESatFailure;
       
  1347                 break;
       
  1348                 }
       
  1349             }
       
  1350         }
       
  1351 
       
  1352     delete textHolder;
       
  1353     textHolder = NULL;
       
  1354 
       
  1355     if ( KErrNone != error )
       
  1356         {
       
  1357         TFLOGSTRING2( "CSatUiActionPerformer::Notification error:%d", error )
       
  1358         response = ESatFailure;
       
  1359         }
       
  1360     else if ( iActionImplementer->GetEndKey() )
       
  1361         {
       
  1362         TFLOGSTRING( "CSatUiActionPerformer::Notification terminated by user" )
       
  1363         response = ESatSessionTerminatedByUser;
       
  1364         iActionImplementer->SetEndKey( EFalse );
       
  1365         }
       
  1366     else
       
  1367         {
       
  1368         TFLOGSTRING( "CSatUiActionPerformer::Notification success" )
       
  1369         response = ESatSuccess;
       
  1370         }
       
  1371 
       
  1372 
       
  1373     TFLOGSTRING2( "CSatUiActionPerformer::Notification exiting, return: %d", \
       
  1374         response )
       
  1375     return response;
       
  1376     }
       
  1377 
       
  1378 // -----------------------------------------------------------------------------
       
  1379 // CSatUiActionPerformer::EventNotification
       
  1380 // (other items were commented in a header).
       
  1381 // -----------------------------------------------------------------------------
       
  1382 //
       
  1383 void CSatUiActionPerformer::EventNotification(
       
  1384     const TSatSEvent aEventId,
       
  1385     const TSatSEventStatus /*aEventStatus*/,
       
  1386     const TInt /*aError*/ )
       
  1387     {
       
  1388     TFLOGSTRING( "CSatUiActionPerformer::EventNotification calling" )
       
  1389 
       
  1390     iActionImplementer->SetCommandPending( EFalse );
       
  1391     switch ( aEventId )
       
  1392         {
       
  1393         case ESatSSmEndEvent:
       
  1394             {
       
  1395             TFLOGSTRING( " SmsEnd event" )
       
  1396             iActionImplementer->StopShowWaitNote();
       
  1397             break;
       
  1398             }
       
  1399         case ESatSClearScreenEvent:
       
  1400             {
       
  1401             TFLOGSTRING( " ClearScreen event" )
       
  1402             iClearScreenEvent = ETrue;
       
  1403             iActionImplementer->ClearScreen();
       
  1404             break;
       
  1405             }
       
  1406         case ESatSsEndEvent:
       
  1407             {
       
  1408             TFLOGSTRING( " Ss end event" )
       
  1409             iActionImplementer->StopShowWaitNote();
       
  1410             break;
       
  1411             }
       
  1412         case ESatSsErrorEvent:
       
  1413             {
       
  1414             TFLOGSTRING( " Notifying Ss error" )
       
  1415             // If error occurred (and Alpha ID provided), notify user
       
  1416             TRAPD( err, iActionImplementer->ShowSsErrorNoteL() )
       
  1417             
       
  1418             if ( err )
       
  1419                 {
       
  1420                 TFLOGSTRING( " Error Note could not be created!" )
       
  1421                 }
       
  1422             break;
       
  1423             }
       
  1424         case ESatSDtmfEndEvent:
       
  1425             {
       
  1426             TFLOGSTRING( " DTMF End event" )
       
  1427             iActionImplementer->StopShowWaitNote();
       
  1428             break;
       
  1429             }
       
  1430         case ESatSCloseSatUiAppEvent:
       
  1431             {
       
  1432             TFLOGSTRING( " Close UI event" )
       
  1433             // Handle this similar way when End key is used
       
  1434             if ( KSatActiveProfileOffline == 
       
  1435                     iActionImplementer->ProfileState() )
       
  1436                 {
       
  1437                 iActionImplementer->SetEndKey( ETrue );
       
  1438                 TRAP_IGNORE( iActionImplementer->ShowNotAvailableNoteL() )
       
  1439                 }
       
  1440             iActionImplementer->CloseSatUI();
       
  1441             break;
       
  1442             }
       
  1443         default:
       
  1444             {
       
  1445             TFLOGSTRING2( " Unknown event occured: %i", aEventId )
       
  1446             break;
       
  1447             }
       
  1448         }
       
  1449 
       
  1450     TFLOGSTRING( "CSatUiActionPerformer::EventNotification exiting" )
       
  1451     }
       
  1452 
       
  1453 // ---------------------------------------------------------
       
  1454 // CSatUiActionPerformer::DefaultAlphaIdL
       
  1455 // (other items were commented in a header).
       
  1456 // ---------------------------------------------------------
       
  1457 //
       
  1458 TInt CSatUiActionPerformer::DefaultAlphaIdL(
       
  1459     const TSatSNotifyCommand aCommandId,
       
  1460     const TSatControlResult aControlResult ) const
       
  1461     {
       
  1462     TFLOGSTRING( "CSatUiActionPerformer::DefaultAlphaIdL calling" )
       
  1463     TInt resource( 0 );
       
  1464 
       
  1465     switch ( aCommandId )
       
  1466         {
       
  1467         case ESatSSendDataNotify: // SendData
       
  1468             {
       
  1469             TFLOGSTRING( " SendData default" )
       
  1470             resource = R_QTN_SAT_CONF_SEND_DATA_BIP;
       
  1471             break;
       
  1472             }
       
  1473 
       
  1474         case ESatSReceiveDataNotify: // ReceiveData
       
  1475             {
       
  1476             TFLOGSTRING( " ReceiveData default" )
       
  1477             resource = R_QTN_SAT_CONF_RECEIVE_DATA_BIP;
       
  1478             break;
       
  1479             }
       
  1480 
       
  1481         case ESatSCloseChannelNotify: // CloseChannel
       
  1482             {
       
  1483             TFLOGSTRING( " CloseChannel default" )
       
  1484             resource = R_QTN_SAT_CONF_CLOSE_CHANNEL_BIP;
       
  1485             break;
       
  1486             }
       
  1487 
       
  1488         case ESatSMoSmControlNotify: // MoSmControl
       
  1489             {
       
  1490             if ( ESatNotAllowed == aControlResult )
       
  1491                 {
       
  1492                 TFLOGSTRING( " MoSmcontrol Not allowed default" )
       
  1493                 resource = R_QTN_SAT_MOSM_NOT_ALLOWED;
       
  1494                 }
       
  1495             else if ( ESatAllowedWithModifications == aControlResult )
       
  1496                 {
       
  1497                 TFLOGSTRING( " MoSmcontrol Modified default" )
       
  1498                 resource = R_QTN_SAT_MOSM_MODIFIED;
       
  1499                 }
       
  1500             else
       
  1501                 {
       
  1502                 TFLOGSTRING( " MoSmcontrol No default" )
       
  1503                 resource = 0; // Allowed, default alpha -> no info
       
  1504                 }
       
  1505             break;
       
  1506             }
       
  1507 
       
  1508         case ESatSCallControlNotify: // CallControl
       
  1509             {
       
  1510             if ( ESatNotAllowed == aControlResult )
       
  1511                 {
       
  1512                 TFLOGSTRING( " CallControl Not allowed default" )
       
  1513                 resource = R_QTN_SAT_CC_NOT_ALLOWED;
       
  1514                 }
       
  1515             else if ( ESatAllowedWithModifications == aControlResult )
       
  1516                 {
       
  1517                 TFLOGSTRING( " CallControl Modified default" )
       
  1518                 resource = R_QTN_SAT_CC_MODIFIED;
       
  1519                 }
       
  1520             else
       
  1521                 {
       
  1522                 TFLOGSTRING( " CallControl No default" )
       
  1523                 resource = 0; // Allowed, default alpha -> no info
       
  1524                 }
       
  1525             break;
       
  1526             }
       
  1527 
       
  1528         case ESatSSendSmsNotify: // SendSm
       
  1529             {
       
  1530             TFLOGSTRING( " SendSms default" )
       
  1531             resource = R_QTN_SAT_SENDING_SMS;
       
  1532             break;
       
  1533             }
       
  1534 
       
  1535         case ESatSSendDtmfNotify: // SendDtmf
       
  1536             {
       
  1537             TFLOGSTRING( " SendDTMF default" )
       
  1538             resource = R_QTN_SAT_NOTE_SENDING_DTMF_TEMPLATE;
       
  1539             break;
       
  1540             }
       
  1541 
       
  1542         default:
       
  1543             {
       
  1544             TFLOGSTRING2( " Unknown command id: %i", aCommandId )
       
  1545             User::Leave( KErrArgument );
       
  1546             }
       
  1547         }
       
  1548 
       
  1549     TFLOGSTRING2( "CSatUiActionPerformer::DefaultAlphaIdL exiting, resource: \
       
  1550         %d", resource )
       
  1551     return resource;
       
  1552     }
       
  1553 
       
  1554 // ---------------------------------------------------------
       
  1555 // CSatUiActionPerformer::FetchIcon
       
  1556 // Fetch the icon information.
       
  1557 // (other items were commented in a header).
       
  1558 // ---------------------------------------------------------
       
  1559 //
       
  1560 CFbsBitmap* CSatUiActionPerformer::FetchIcon( const TUint8 aIconId,
       
  1561     const enum TIconCommand aIconCommand )
       
  1562     {
       
  1563     TFLOGSTRING( "CSatUiActionPerformer::FetchIcon called" )
       
  1564     CFbsBitmap* iconBitmap = NULL;
       
  1565 
       
  1566     TSize layoutSize( 0, 0 );
       
  1567 
       
  1568     // Set icon max size according the command
       
  1569     if ( GetPopUpWindowIconSize( layoutSize, aIconCommand ) )
       
  1570         {
       
  1571         TFLOGSTRING( "CSatUiActionPerformer::FetchIcon max size" )
       
  1572         TRAPD( err, iconBitmap = iIconHandler->FetchIconL( iSatSession,
       
  1573             aIconId, layoutSize.iWidth, layoutSize.iHeight, iIconSupport ) );
       
  1574 
       
  1575         if ( err != KErrNone )
       
  1576             {
       
  1577             #if defined _DEBUG
       
  1578             _LIT( KFetchIcon, "CSatUiActionPerformer::FetchIcon" );
       
  1579             User::Panic( KFetchIcon, err );
       
  1580             #endif
       
  1581             }
       
  1582         }
       
  1583     else
       
  1584         {
       
  1585         TFLOGSTRING( "CSatUiActionPerformer::FetchIcon not supported" )
       
  1586         }
       
  1587 
       
  1588     TFLOGSTRING( "CSatUiActionPerformer::FetchIcon exit" )
       
  1589     return iconBitmap;
       
  1590     }
       
  1591 
       
  1592 // ---------------------------------------------------------
       
  1593 // CSatUiActionPerformer::GetPopUpWindowIconSize
       
  1594 // Get size for the icon in popup window.
       
  1595 // (other items were commented in a header).
       
  1596 // ---------------------------------------------------------
       
  1597 //
       
  1598 TBool CSatUiActionPerformer::GetPopUpWindowIconSize( TSize& aSize,
       
  1599     const TIconCommand  aIconCommand )
       
  1600     {
       
  1601     TFLOGSTRING( "CSatUiActionPerformer::GetPopUpWindowIconSize called" )
       
  1602 
       
  1603     TRect rect( TSize( 0, 0 ) );
       
  1604     TBool supported( ETrue );
       
  1605     TAknLayoutRect opLogoLayout;
       
  1606     
       
  1607     TFLOGSTRING2( "CSatUiActionPerformer::GetPopUpWindowIconSize, \
       
  1608         aIconCommand: %i", aIconCommand )
       
  1609     // depending on the command, get correct layout and
       
  1610     // Calculate rectangle based on LAF specification.
       
  1611     switch ( aIconCommand )
       
  1612         {
       
  1613         case EIconSetUpMenuContext:
       
  1614             {
       
  1615             opLogoLayout.LayoutRect( rect,
       
  1616                 AknLayoutScalable_Avkon::context_pane_g1().LayoutLine() );
       
  1617             break;
       
  1618             }
       
  1619         case EIconSetUpMenuItems:
       
  1620             {
       
  1621             opLogoLayout.LayoutRect( rect,
       
  1622                 AknLayout::List_pane_elements__single_graphic__Line_1() );
       
  1623             break;
       
  1624             }
       
  1625         case EIconDisplayText:
       
  1626             {
       
  1627             // layout borrowed from video
       
  1628             opLogoLayout.LayoutRect( rect, AknLayoutScalable_Avkon::
       
  1629                 popup_query_sat_info_window( 0 ).LayoutLine() );
       
  1630             break;
       
  1631             }
       
  1632         case EIconPlayTone:
       
  1633             {
       
  1634             opLogoLayout.LayoutRect( rect, AknLayoutScalable_Avkon::
       
  1635                 popup_note_window_g1( 0 ).LayoutLine() );
       
  1636             break;
       
  1637             }
       
  1638         case EIconConfirmCommand:   // fall through
       
  1639         case EIconGetInput:         // fall through
       
  1640         case EIconGetYesNo:         // fall through
       
  1641         case EIconGetInkey:
       
  1642             {
       
  1643             opLogoLayout.LayoutRect( rect, AknLayout::Icon( 0 ) );
       
  1644             break;
       
  1645             }
       
  1646         case EIconNotification:
       
  1647             {
       
  1648             opLogoLayout.LayoutRect( rect, AknLayout::
       
  1649                 Wait_or_progress_note_pop_up_window_elements_Line_1() );
       
  1650             break;
       
  1651             }
       
  1652         default:
       
  1653             {
       
  1654             TFLOGSTRING(
       
  1655                 "CSatUiActionPerformer::GetPopUpWindowIconSize not supported" )
       
  1656             supported = EFalse;
       
  1657             break;
       
  1658             }
       
  1659         }
       
  1660 
       
  1661     aSize = opLogoLayout.Rect().Size();
       
  1662 
       
  1663     // Layout for title icon gives incorrect width
       
  1664     // but since it is square height can be set to width
       
  1665     if ( EIconSetUpMenuContext == aIconCommand )
       
  1666         {
       
  1667         aSize.iWidth = aSize.iHeight;
       
  1668         }
       
  1669 
       
  1670     TFLOGSTRING3( "CSatUiActionPerformer::GetPopUpWindowIconSize %dx%d exit",
       
  1671         aSize.iWidth, aSize.iHeight )
       
  1672     return supported;
       
  1673     }
       
  1674 
       
  1675 // ---------------------------------------------------------
       
  1676 // CSatUiActionPerformer::GetScalableBitmap
       
  1677 // Creates scalable bitmap
       
  1678 // (other items were commented in a header).
       
  1679 // ---------------------------------------------------------
       
  1680 //
       
  1681 void CSatUiActionPerformer::GetScalableBitmapL(
       
  1682     CFbsBitmap*& aBitMapToConvert,
       
  1683     const TIconCommand  aIconCommand )
       
  1684     {
       
  1685     TFLOGSTRING( "CSatUiActionPerformer::GetScalableBitmap called" )
       
  1686     TSize layoutSize( 0, 0 );
       
  1687     CFbsBitmap* bitmap = NULL;
       
  1688 
       
  1689     // If scalable icon is supported in current layout then
       
  1690     // makes the scalable icon.
       
  1691     if ( GetPopUpWindowIconSize( layoutSize, aIconCommand ) )
       
  1692         {
       
  1693         bitmap = new ( ELeave ) CFbsBitmap;
       
  1694         CleanupStack::PushL( bitmap );
       
  1695         // CAknIcon takes ownership of bitmaps.
       
  1696         CFbsBitmap* dupMain = new ( ELeave ) CFbsBitmap;
       
  1697         CleanupStack::PushL( dupMain );
       
  1698         TFLOGSTRING( "CSatUiActionPerformer::GetScalableBitmap duplicate original" )
       
  1699         User::LeaveIfError(
       
  1700             dupMain->Duplicate( aBitMapToConvert->Handle() ) );
       
  1701 
       
  1702         CAknIcon* bitmapIcon = CAknIcon::NewL();
       
  1703         // Mask is not set because skins are not used.
       
  1704         // Ownership is transferred.
       
  1705         bitmapIcon->SetBitmap( dupMain );
       
  1706         CleanupStack::Pop( dupMain );
       
  1707         CleanupStack::PushL( bitmapIcon );
       
  1708         CAknIcon* scalableIcon = AknIconUtils::CreateIconL( bitmapIcon );
       
  1709         CleanupStack::Pop( bitmapIcon );
       
  1710         CleanupStack::PushL( scalableIcon );
       
  1711 
       
  1712         // fetch the size of icon
       
  1713         TSize iconSize = dupMain->SizeInPixels();
       
  1714 
       
  1715         // At first we assume that width is scaled to layout maximum and
       
  1716         // thus height is set so that the ratio of the image remains correct
       
  1717 
       
  1718         TInt newHeight =
       
  1719             ( layoutSize.iWidth * iconSize.iHeight ) / iconSize.iWidth;
       
  1720 
       
  1721         // If the new height is larger than the height of the layout
       
  1722         // we scale height to maximum and set the width so that the ratio of
       
  1723         // the image remains correct
       
  1724         if ( newHeight > layoutSize.iHeight )
       
  1725             {
       
  1726             TFLOGSTRING( "CSatUiActionPerformer::GetScalableBitmap \
       
  1727                 larger than layout height" )
       
  1728             layoutSize.iWidth =
       
  1729                 ( layoutSize.iHeight * iconSize.iWidth ) / iconSize.iHeight;
       
  1730             }
       
  1731         // If the new height is smaller or the same as the height of the
       
  1732         // layout, the image is scaled according to it
       
  1733         else
       
  1734             {
       
  1735             TFLOGSTRING( "CSatUiActionPerformer::GetScalableBitmap \
       
  1736                 smaller than layout height" )
       
  1737             layoutSize.iHeight = newHeight;
       
  1738             }
       
  1739 
       
  1740         TFLOGSTRING( "CSatUiActionPerformer::GetScalableBitmap resize scaled icon" )
       
  1741         AknIconUtils::SetSize( scalableIcon->Bitmap(), layoutSize );
       
  1742 
       
  1743         TFLOGSTRING( "CSatUiActionPerformer::GetScalableBitmap duplicate scaled" )
       
  1744         User::LeaveIfError( bitmap->Duplicate(
       
  1745             scalableIcon->Bitmap()->Handle() ) );
       
  1746 
       
  1747         CleanupStack::PopAndDestroy( scalableIcon );
       
  1748 
       
  1749         // Uses scaled icon if scalable bitmap is supported.
       
  1750         TFLOGSTRING( "CSatUiActionPerformer::GetScalableBitmap Show Scaled" )
       
  1751         delete aBitMapToConvert;
       
  1752         aBitMapToConvert = bitmap;
       
  1753         CleanupStack::Pop( bitmap );
       
  1754         }
       
  1755 
       
  1756     TFLOGSTRING( "CSatUiActionPerformer::GetScalableBitmap exit" )
       
  1757     }
       
  1758 
       
  1759 // ---------------------------------------------------------
       
  1760 // CSatUiActionPerformer::GetScalableBitmap
       
  1761 // Handles scalable bitmap
       
  1762 // (other items were commented in a header).
       
  1763 // ---------------------------------------------------------
       
  1764 //
       
  1765 void CSatUiActionPerformer::GetScalableBitmap(
       
  1766     CFbsBitmap*& aBitMapToConvert,
       
  1767     const TIconCommand  aIconCommand,
       
  1768     TBool& aRequestedIconDisplayed )
       
  1769     {
       
  1770     TFLOGSTRING( "CSatUiActionPerformer::GetScalableBitmap called" )
       
  1771 
       
  1772     if ( aBitMapToConvert )
       
  1773         {
       
  1774         TFLOGSTRING( "CSatUiActionPerformer::GetScalableBitmap bitmap \
       
  1775             to convert" )
       
  1776         // Scale icon
       
  1777         TRAPD( err, GetScalableBitmapL( aBitMapToConvert, aIconCommand ); );
       
  1778 
       
  1779         if ( KErrNoMemory == err )
       
  1780             {
       
  1781             TFLOGSTRING( "CSatUiActionPerformer::GetScalableBitmap memory \
       
  1782                 low" )
       
  1783             // Memory low, command is done without icon
       
  1784             delete aBitMapToConvert;
       
  1785             aBitMapToConvert = NULL;
       
  1786             aRequestedIconDisplayed = EFalse;
       
  1787             }
       
  1788         else
       
  1789             {
       
  1790             TFLOGSTRING( "CSatUiActionPerformer::GetScalableBitmap have \
       
  1791                 memory" )
       
  1792             aRequestedIconDisplayed = ETrue;
       
  1793             }
       
  1794         }
       
  1795     else
       
  1796         {
       
  1797         TFLOGSTRING( "CSatUiActionPerformer::GetScalableBitmap  no bitmap" )
       
  1798         // Icon not received
       
  1799         aRequestedIconDisplayed = EFalse;
       
  1800         }
       
  1801 
       
  1802     TFLOGSTRING( "CSatUiActionPerformer::GetScalableBitmap exit" )
       
  1803     }
       
  1804 
       
  1805 // ---------------------------------------------------------
       
  1806 // CSatUiActionPerformer::GetScalableBitmap
       
  1807 // Handles scalable bitmap
       
  1808 // (other items were commented in a header).
       
  1809 // ---------------------------------------------------------
       
  1810 //
       
  1811 void CSatUiActionPerformer::GetScalableBitmap(
       
  1812     CFbsBitmap*& aBitMapToConvert,
       
  1813     const TIconCommand  aIconCommand )
       
  1814     {
       
  1815     TFLOGSTRING( "CSatUiActionPerformer::GetScalableBitmap called" )
       
  1816 
       
  1817     if ( aBitMapToConvert )
       
  1818         {
       
  1819         TFLOGSTRING( "CSatUiActionPerformer::GetScalableBitmap bitmap \
       
  1820             to convert" )
       
  1821         // Scale icon
       
  1822         TRAPD( err, GetScalableBitmapL( aBitMapToConvert, aIconCommand ); );
       
  1823 
       
  1824         if ( KErrNoMemory == err )
       
  1825             {
       
  1826              TFLOGSTRING( "CSatUiActionPerformer::GetScalableBitmap memory \
       
  1827                  low" )
       
  1828             // Memory low, command is done without icon
       
  1829             delete aBitMapToConvert;
       
  1830             aBitMapToConvert = NULL;
       
  1831             }
       
  1832         }
       
  1833 
       
  1834     TFLOGSTRING( "CSatUiActionPerformer::GetScalableBitmap exit" )
       
  1835     }
       
  1836 
       
  1837 //  End of File