idlefw/tsrc/devicestatusplugin/mt_devstaplg/LogoTools.h
branchRCL_3
changeset 111 053c6c7c14f3
equal deleted inserted replaced
110:2c7f27287390 111:053c6c7c14f3
       
     1 /*
       
     2 * Copyright (c) 2004 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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef LOGOTOOLS_H
       
    20 #define LOGOTOOLS_H
       
    21 
       
    22 #include <rphcltserver.h>
       
    23 //#include <phcltext.h>
       
    24 /*#include <CPhCltImageHandler.h>
       
    25 #include <CPhCltImageParams.h>
       
    26 #include <cphcltextbaseimageparams.h>*/
       
    27 #include <cphcltimagehandler.h>
       
    28 #include <cphcltimageparams.h>
       
    29 #include <cphcltbaseimageparams.h>
       
    30 #include <fbs.h>
       
    31 
       
    32 // Name of the Phone Client extension library.
       
    33 _LIT( KActiveIdlePhCltExtLibrary, "PhoneClientExt.dll" );
       
    34 
       
    35 // Ordinal of Phone Client extension factory method.
       
    36 const TInt KActiveIdlePhCltExtFactoryOrdinal = 1;
       
    37 
       
    38 
       
    39 
       
    40 LOCAL_C void StoreOTALogoL( TInt aMCC, TInt aMNC )
       
    41     {
       
    42     RPhCltServer server;
       
    43     User::LeaveIfError( server.Connect() );
       
    44     CleanupClosePushL( server );
       
    45 
       
    46     RLibrary phCltExtLib;
       
    47     User::LeaveIfError( phCltExtLib.Load( KActiveIdlePhCltExtLibrary ) );
       
    48     CleanupClosePushL( phCltExtLib );
       
    49 
       
    50     CPhCltImageHandler* imageHandler = CPhCltImageHandler::NewL();
       
    51     CleanupStack::PushL( imageHandler );
       
    52 
       
    53     CPhCltImageParams* params =
       
    54         imageHandler->CPhCltBaseImageParamsL( EPhCltTypeOperatorLogo );
       
    55     CleanupStack::PushL( params );
       
    56 
       
    57     // opLogoParams not owned.
       
    58     CPhCltExtOperatorLogoParams* opLogoParams =
       
    59         static_cast<CPhCltExtOperatorLogoParams*>( params );
       
    60 
       
    61     CFbsBitmap* bitmap = new( ELeave )CFbsBitmap;
       
    62     CleanupStack::PushL( bitmap );
       
    63     User::LeaveIfError( bitmap->Create( TSize( 97, 25 ), EColor256 ) );
       
    64 
       
    65     opLogoParams->SetCodesL( aMCC, aMNC, EPhCltLogoTypeOTA );
       
    66     opLogoParams->AddImageL( bitmap->Handle() );
       
    67 
       
    68     User::LeaveIfError( imageHandler->SaveImages( *params ) );
       
    69 
       
    70 
       
    71     CleanupStack::PopAndDestroy( bitmap );
       
    72 
       
    73     CleanupStack::PopAndDestroy( params );
       
    74     CleanupStack::PopAndDestroy( imageHandler );
       
    75     CleanupStack::PopAndDestroy(); // CleanupClosePushL
       
    76     CleanupStack::PopAndDestroy(); // CleanupClosePushL
       
    77     }
       
    78 LOCAL_C void DeleteOTALogoL( TInt aMCC, TInt aMNC )
       
    79     {
       
    80     RPhCltServer server;
       
    81     User::LeaveIfError( server.Connect() );
       
    82     CleanupClosePushL( server );
       
    83 
       
    84     RLibrary phCltExtLib;
       
    85     User::LeaveIfError( phCltExtLib.Load( KActiveIdlePhCltExtLibrary ) );
       
    86     CleanupClosePushL( phCltExtLib );
       
    87 
       
    88     CPhCltImageHandler* imageHandler = CPhCltImageHandler::NewL();
       
    89     CleanupStack::PushL( imageHandler );
       
    90 
       
    91     CPhCltImageParams* params =
       
    92         imageHandler->CPhCltBaseImageParamsL( EPhCltTypeOperatorLogo );
       
    93     CleanupStack::PushL( params );
       
    94 
       
    95     // opLogoParams not owned.
       
    96     CPhCltExtOperatorLogoParams* opLogoParams =
       
    97         static_cast<CPhCltExtOperatorLogoParams*>( params );
       
    98 
       
    99     opLogoParams->SetCodesL( aMCC, aMNC, EPhCltLogoTypeOTA );
       
   100     opLogoParams->AddImageL( KPhCltDeleteOperatorLogo );
       
   101 
       
   102     User::LeaveIfError( imageHandler->SaveImages( *params ) );
       
   103 
       
   104     CleanupStack::PopAndDestroy( params );
       
   105     CleanupStack::PopAndDestroy( imageHandler );
       
   106     CleanupStack::PopAndDestroy(); // CleanupClosePushL
       
   107     CleanupStack::PopAndDestroy(); // CleanupClosePushL
       
   108     }
       
   109 
       
   110 
       
   111 
       
   112 
       
   113 #endif      //  LOGOTOOLS_H
       
   114 
       
   115 // End of file