contentstorage/casatinterface/src/MenuSatInterface.cpp
changeset 60 f62f87b200ec
equal deleted inserted replaced
4:1a2a00e78665 60:f62f87b200ec
       
     1 /*
       
     2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Implements application shell SAT interface for external
       
    15 *                applications.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <e32property.h>
       
    22 #include <MenuSatInterface.h>
       
    23 
       
    24 #include "ca2internalCRkeys.h"
       
    25 
       
    26 // CONSTANTS
       
    27 const TInt KMaxFolderNameLength = 248;
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // CMenuSATInterface::CMenuSATInterface
       
    31 // C++ default constructor can NOT contain any code, that
       
    32 // might leave.
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 EXPORT_C CMenuSATInterface::CMenuSATInterface()
       
    36     {
       
    37     RProperty::Define( KCRUidCa, KCaShowSatUI, RProperty::EInt );
       
    38     RProperty::Define( KCRUidCa, KCaSatUIName, RProperty::EText );
       
    39     RProperty::Define( KCRUidCa, KCaSatUIIconId, RProperty::EInt );
       
    40 
       
    41     }
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 // CMenuSATInterface::MakeSatUiVisible
       
    45 // Change visibility and name properties in central repository.
       
    46 // -----------------------------------------------------------------------------
       
    47 //
       
    48 EXPORT_C TInt CMenuSATInterface::MakeSatUiVisible( TBool aVisible,
       
    49                                                   const TDesC& aName )
       
    50     {
       
    51     return SetSatUiVisibilityData( aVisible, aName, -1 );
       
    52     }
       
    53 
       
    54 // -----------------------------------------------------------------------------
       
    55 // CMenuSATInterface::MakeSatUiVisible
       
    56 // Change visibility, name and icon properties in central repository.
       
    57 // -----------------------------------------------------------------------------
       
    58 EXPORT_C TInt CMenuSATInterface::MakeSatUiVisible( TBool aVisible,
       
    59                                                   const TDesC& aName,
       
    60                                                   TUint8 aIconInfoId )
       
    61     {
       
    62     return SetSatUiVisibilityData( aVisible, aName, (TInt)aIconInfoId );
       
    63     }
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 // CMenuSATInterface::SetSatUiVisibilityData
       
    67 // Do the actual hard work of setting visibility, name and icon properties
       
    68 // in central repository.
       
    69 // -----------------------------------------------------------------------------
       
    70 TInt CMenuSATInterface::SetSatUiVisibilityData( TBool aVisible,
       
    71      const TDesC& aName,
       
    72      TInt8 aIconInfoId )
       
    73     {
       
    74 
       
    75     // Append only the KMaxFolderNameLength leftmost characters
       
    76     TBuf<KMaxFolderNameLength> satName;
       
    77     satName.Append( aName.Left( KMaxFolderNameLength ) );
       
    78 
       
    79     // Passes the make sat ui command to AppShell using the central repository
       
    80 
       
    81     // Visibility
       
    82     TInt err = RProperty::Set( KCRUidCa, KCaShowSatUI, aVisible );
       
    83 
       
    84     // Name
       
    85     if( aName.Length() )
       
    86         {
       
    87         err |= RProperty::Set( KCRUidCa, KCaSatUIName, satName );
       
    88         }
       
    89 
       
    90     // Icon id
       
    91     if( aIconInfoId != -1 )
       
    92         {
       
    93         // set the Sat UI icon ID
       
    94         err |= RProperty::Set( KCRUidCa, KCaSatUIIconId, aIconInfoId );
       
    95         }
       
    96 
       
    97     return err;
       
    98     }
       
    99 
       
   100 // End of file