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