|
1 /* |
|
2 * Copyright (c) 2007-2007 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: Encapsulates information about application and its views. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "cfapplicationstatesettings.h" |
|
20 |
|
21 // ======== MEMBER FUNCTIONS ======== |
|
22 |
|
23 CCFApplicationStateSettings::CCFApplicationStateSettings() |
|
24 { |
|
25 } |
|
26 |
|
27 void CCFApplicationStateSettings::ConstructL( const TUid& aUid, |
|
28 const TDesC& aName ) |
|
29 { |
|
30 iApplicationInfo = CCFUidNamePair::NewL( aUid, aName ); |
|
31 } |
|
32 |
|
33 CCFApplicationStateSettings* CCFApplicationStateSettings::NewL( |
|
34 const TUid& aUid, |
|
35 const TDesC& aName ) |
|
36 { |
|
37 CCFApplicationStateSettings* self |
|
38 = CCFApplicationStateSettings::NewLC( aUid, aName ); |
|
39 CleanupStack::Pop( self ); |
|
40 |
|
41 return self; |
|
42 } |
|
43 |
|
44 CCFApplicationStateSettings* CCFApplicationStateSettings::NewLC( |
|
45 const TUid& aUid, |
|
46 const TDesC& aName ) |
|
47 { |
|
48 CCFApplicationStateSettings* self |
|
49 = new( ELeave ) CCFApplicationStateSettings(); |
|
50 CleanupStack::PushL( self ); |
|
51 self->ConstructL( aUid, aName ); |
|
52 |
|
53 return self; |
|
54 } |
|
55 |
|
56 CCFApplicationStateSettings::~CCFApplicationStateSettings() |
|
57 { |
|
58 delete iApplicationInfo; |
|
59 iViewInfo.ResetAndDestroy(); |
|
60 } |
|
61 |
|
62 |
|
63 //----------------------------------------------------------------------------- |
|
64 // CCFApplicationStateSettings::Uid |
|
65 //----------------------------------------------------------------------------- |
|
66 // |
|
67 const TUid& CCFApplicationStateSettings::Uid() const |
|
68 { |
|
69 return iApplicationInfo->Uid(); |
|
70 } |
|
71 |
|
72 //----------------------------------------------------------------------------- |
|
73 // CCFApplicationStateSettings::Name |
|
74 //----------------------------------------------------------------------------- |
|
75 // |
|
76 const TDesC& CCFApplicationStateSettings::Name() const |
|
77 { |
|
78 if( !iApplicationInfo ) |
|
79 { |
|
80 return KNullDesC; |
|
81 } |
|
82 else |
|
83 { |
|
84 return iApplicationInfo->Name(); |
|
85 } |
|
86 } |
|
87 |
|
88 //----------------------------------------------------------------------------- |
|
89 // CCFApplicationStateSettings::AddViewSettingsL |
|
90 //----------------------------------------------------------------------------- |
|
91 // |
|
92 void CCFApplicationStateSettings::AddViewSettingsL( |
|
93 CCFUidNamePair* aViewSettings ) |
|
94 { |
|
95 iViewInfo.AppendL( aViewSettings ); |
|
96 } |
|
97 |
|
98 //----------------------------------------------------------------------------- |
|
99 // CCFApplicationStateSettings::AddViewSettingsL |
|
100 //----------------------------------------------------------------------------- |
|
101 // |
|
102 void CCFApplicationStateSettings::GetViewName( const TUid& aUid, |
|
103 TPtrC& aName ) const |
|
104 { |
|
105 for ( TInt i = 0; i < iViewInfo.Count(); ++i ) |
|
106 { |
|
107 if ( aUid == iViewInfo[ i ]->Uid() ) |
|
108 { |
|
109 aName.Set( iViewInfo[ i ]->Name() ); |
|
110 break; |
|
111 } |
|
112 } |
|
113 } |