breakdeps/MCSSatHandler/mcssathandler.cpp
author Tom Pritchard <tomp@symbian.org>
Wed, 03 Nov 2010 16:17:59 +0000
changeset 109 fddd8ce1f29d
child 110 3aa4235c5e9b
permissions -rw-r--r--
Add a version of the MCS SAT Handler ready for stemming
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
109
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     1
/*
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     2
* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     3
* All rights reserved.
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     8
*
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     9
* Initial Contributors:
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    11
*
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    12
* Contributors:
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    13
*
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    14
* Description:  Used for receive SIM Application name, icon or 
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    15
*                visibility information.
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    16
*
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    17
*/
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    18
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    19
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    20
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    21
// INCLUDE FILES
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    22
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    23
#include <e32property.h>
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    24
// From SatClient
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    25
#include "mcsdef.h"
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    26
#include <bitdev.h>
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    27
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    28
#include "mcssathandler.h"
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    29
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    30
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    31
// ============================ MEMBER FUNCTIONS ===============================
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    32
// -----------------------------------------------------------------------------
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    33
// CMcsSatHandler::NewL
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    34
// Two-phased constructor.
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    35
// -----------------------------------------------------------------------------
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    36
//
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    37
EXPORT_C CMcsSatHandler* CMcsSatHandler::NewL()
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    38
    {
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    39
    CMcsSatHandler* self = new( ELeave ) CMcsSatHandler( );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    40
    CleanupStack::PushL( self );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    41
    self->ConstructL();
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    42
    CleanupStack::Pop( self );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    43
    return self;
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    44
    }
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    45
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    46
// -----------------------------------------------------------------------------    
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    47
// Destructor
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    48
// -----------------------------------------------------------------------------
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    49
CMcsSatHandler::~CMcsSatHandler()
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    50
    {
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    51
    iSatIcon.Close(); 
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    52
    iSatSession.Close();
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    53
    }
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    54
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    55
// -----------------------------------------------------------------------------    
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    56
// Destructor
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    57
// -----------------------------------------------------------------------------
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    58
EXPORT_C CAknIcon* CMcsSatHandler::LoadIconL()
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    59
    {
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    60
    TInt iconId( KErrNone );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    61
    User::LeaveIfError( RProperty::Get( KCRUidMenu, KMenuSatUIIconId, iconId ) );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    62
    CAknIcon* icon = CAknIcon::NewL(); 
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    63
    CleanupStack::PushL(icon);
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    64
    if( iconId != KErrNone )
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    65
        {
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    66
        RIconEf iIconEf;
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    67
        iSatIcon.GetIconInfoL( TUint8( iconId ), iIconEf ); 
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    68
        CleanupClosePushL( iIconEf );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    69
        CFbsBitmap* bitmap = GetBitmapL( iIconEf );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    70
            if( !bitmap )
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    71
                {
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    72
                CFbsBitmap* mask( NULL );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    73
                CleanupStack::PushL( mask );    
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    74
                
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    75
                icon->SetBitmap( bitmap );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    76
                // create and set mask
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    77
                User::LeaveIfError( mask->Create( bitmap->SizeInPixels(), EGray256 ) );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    78
                
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    79
                CFbsBitmapDevice* maskDevice = CFbsBitmapDevice::NewL( mask );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    80
                CleanupStack::PushL( maskDevice ); 
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    81
                CFbsBitGc* maskGc;
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    82
                User::LeaveIfError( maskDevice->CreateContext( maskGc ) );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    83
                CleanupStack::PushL( maskGc );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    84
                maskGc->SetBrushStyle( CGraphicsContext::ESolidBrush );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    85
                maskGc->SetDrawMode( CGraphicsContext::EDrawModePEN );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    86
                maskGc->SetBrushColor( KRgbBlack );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    87
                maskGc->Clear();            
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    88
                maskGc->SetBrushColor( KRgbWhite );             
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    89
                maskGc->DrawRect( TRect( TPoint( ), bitmap->SizeInPixels() ) );                
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    90
                icon->SetMask( mask );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    91
                
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    92
                CleanupStack::PopAndDestroy( maskGc );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    93
                CleanupStack::PopAndDestroy( maskDevice );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    94
                CleanupStack::Pop( mask );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    95
                }
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    96
        CleanupStack::PopAndDestroy( &iIconEf ); // iIconEf
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    97
        CleanupStack::Pop( icon );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    98
        }
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    99
    else
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   100
        {
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   101
        CleanupStack::PopAndDestroy( icon );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   102
        icon = NULL;
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   103
        }
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   104
    return icon;    
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   105
    }
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   106
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   107
// ---------------------------------------------------------------------------
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   108
// CMenuSATHandler::GetName
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   109
// ---------------------------------------------------------------------------
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   110
//    
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   111
EXPORT_C TInt CMcsSatHandler::GetName( TDes& aName )
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   112
    {
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   113
    return RProperty::Get( KCRUidMenu, KMenuSatUIName, aName );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   114
    }
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   115
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   116
// ---------------------------------------------------------------------------
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   117
// CMenuSATHandler::GetVisibility
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   118
// ---------------------------------------------------------------------------
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   119
//        
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   120
EXPORT_C TBool CMcsSatHandler::CheckVisibility() 
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   121
    {
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   122
    TInt visibility( KErrNone );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   123
    TInt err = RProperty::Get( KCRUidMenu, KMenuShowSatUI, visibility );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   124
    if( err == KErrNone && visibility )
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   125
        return ETrue;
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   126
    else
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   127
        return EFalse;
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   128
    }
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   129
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   130
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   131
// -----------------------------------------------------------------------------
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   132
// CMcsSatHandler::CMcsSatHandler
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   133
// C++ default constructor can NOT contain any code, that
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   134
// might leave.
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   135
// -----------------------------------------------------------------------------
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   136
//
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   137
CMcsSatHandler::CMcsSatHandler()
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   138
    {
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   139
    }
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   140
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   141
// -----------------------------------------------------------------------------
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   142
// CMcsSatHandler::ConstructL
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   143
// Symbian 2nd phase constructor can leave.
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   144
// -----------------------------------------------------------------------------
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   145
//
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   146
void CMcsSatHandler::ConstructL()
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   147
    {
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   148
    iSatSession.ConnectL();
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   149
    iSatIcon.OpenL( iSatSession ); 
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   150
    }
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   151
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   152
// ---------------------------------------------------------------------------
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   153
// CMenuSATHandler::GetVisibility
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   154
// ---------------------------------------------------------------------------
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   155
// 
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   156
CFbsBitmap* CMcsSatHandler::GetBitmapL( const RIconEf& aIconEF )
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   157
    {
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   158
    TInt selectedIconIndex( KErrNotFound );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   159
    TSize selectedIconSize( 0, 0 );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   160
    CFbsBitmap* bitmap( NULL );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   161
    for ( TInt i = 0; i < aIconEF.Count(); ++i )
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   162
        {
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   163
        if( ( aIconEF[i].IconSize().iHeight * aIconEF[i].IconSize().iWidth ) >= 
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   164
            ( selectedIconSize.iHeight * selectedIconSize.iWidth ) )
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   165
            if( bitmap )
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   166
                {
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   167
                delete bitmap;
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   168
                bitmap = NULL;
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   169
                }
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   170
            // test and select index of iIcon which is not too big
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   171
            TRAPD( bitmapErr, bitmap = iSatIcon.GetIconL( aIconEF[ i ] ) );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   172
            if( !bitmapErr && bitmap ) //!iBitmap if iIcon is too big
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   173
                {
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   174
                selectedIconSize = aIconEF[i].IconSize();
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   175
                selectedIconIndex = i;
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   176
                }
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   177
            else if( bitmapErr )
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   178
                {
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   179
                User::Leave( bitmapErr );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   180
                }
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   181
            }
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   182
    if( selectedIconIndex != KErrNotFound )
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   183
        {
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   184
        if( bitmap )
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   185
            {
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   186
            delete bitmap;
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   187
            bitmap = NULL;
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   188
            }
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   189
        TRAPD( bitmapErr, bitmap = iSatIcon.GetIconL( aIconEF[ selectedIconIndex ] ) );
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   190
        User::LeaveIfError( bitmapErr );    
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   191
        return bitmap;
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   192
        }
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   193
    else 
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   194
        {
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   195
        return NULL;
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   196
        }    
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   197
    }    
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   198
    
fddd8ce1f29d Add a version of the MCS SAT Handler ready for stemming
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   199
//  End of File