|
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 <MenuSatInterface.h> |
|
22 |
|
23 #include <e32property.h> |
|
24 |
|
25 #include "../../cenrep/menu2privatecrkeys.h" |
|
26 |
|
27 // CONSTANTS |
|
28 const TInt KMaxFolderNameLength = 248; |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // CMenuSATInterface::CMenuSATInterface |
|
32 // C++ default constructor can NOT contain any code, that |
|
33 // might leave. |
|
34 // ----------------------------------------------------------------------------- |
|
35 // |
|
36 EXPORT_C CMenuSATInterface::CMenuSATInterface() |
|
37 { |
|
38 RProperty::Define( KCRUidMenu, KMenuShowSatUI, RProperty::EInt ); |
|
39 RProperty::Define( KCRUidMenu, KMenuSatUIName, RProperty::EText ); |
|
40 RProperty::Define( KCRUidMenu, KMenuSatUIIconId, RProperty::EInt ); |
|
41 |
|
42 } |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // CMenuSATInterface::MakeSatUiVisible |
|
46 // Change visibility and name properties in central repository. |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 EXPORT_C TInt CMenuSATInterface::MakeSatUiVisible( TBool aVisible, |
|
50 const TDesC& aName ) |
|
51 { |
|
52 return SetSatUiVisibilityData( aVisible, aName, -1 ); |
|
53 } |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // CMenuSATInterface::MakeSatUiVisible |
|
57 // Change visibility, name and icon properties in central repository. |
|
58 // ----------------------------------------------------------------------------- |
|
59 EXPORT_C TInt CMenuSATInterface::MakeSatUiVisible( TBool aVisible, |
|
60 const TDesC& aName, |
|
61 TUint8 aIconInfoId ) |
|
62 { |
|
63 return SetSatUiVisibilityData( aVisible, aName, (TInt)aIconInfoId ); |
|
64 } |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // CMenuSATInterface::SetSatUiVisibilityData |
|
68 // Do the actual hard work of setting visibility, name and icon properties |
|
69 // in central repository. |
|
70 // ----------------------------------------------------------------------------- |
|
71 TInt CMenuSATInterface::SetSatUiVisibilityData( TBool aVisible, |
|
72 const TDesC& aName, |
|
73 TInt8 aIconInfoId ) |
|
74 { |
|
75 |
|
76 // Append only the KMaxFolderNameLength leftmost characters |
|
77 TBuf<KMaxFolderNameLength> satName; |
|
78 satName.Append( aName.Left( KMaxFolderNameLength ) ); |
|
79 |
|
80 // Passes the make sat ui command to AppShell using the central repository |
|
81 |
|
82 // Visibility |
|
83 TInt err = RProperty::Set( KCRUidMenu, KMenuShowSatUI, aVisible );; |
|
84 |
|
85 // Name |
|
86 if( aName.Length() ) |
|
87 { |
|
88 err |= RProperty::Set( KCRUidMenu, KMenuSatUIName, satName ); |
|
89 } |
|
90 |
|
91 // Icon id |
|
92 if( aIconInfoId != -1 ) |
|
93 { |
|
94 // set the Sat UI icon ID |
|
95 err |= RProperty::Set( KCRUidMenu, KMenuSatUIIconId, aIconInfoId ); |
|
96 } |
|
97 |
|
98 return err; |
|
99 } |
|
100 |
|
101 // End of file |