|
1 /* |
|
2 * Copyright (c) 2002-2008 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: CCFPublishContextAction class declaration. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include "cfpublishcontextaction.h" |
|
21 #include "cfextendedcontextinterface.h" |
|
22 #include "cfbasicoptrace.h" |
|
23 |
|
24 #include <cfoperationservices.h> |
|
25 #include <cfcontextobject.h> |
|
26 |
|
27 // ============================ MEMBER FUNCTIONS =============================== |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // CCFPublishContextAction::CCFPublishContextAction |
|
31 // C++ default constructor can NOT contain any code, that might leave. |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 CCFPublishContextAction::CCFPublishContextAction( MCFOperationServices& aServices, |
|
35 MCFExtendedContextInterface& aCF, |
|
36 CCFContextObject* aContextObject, |
|
37 TBool aAutoDefine ): CCFScriptAction( aServices, CCFScriptAction::EPublishContext ), |
|
38 iCF( aCF ), |
|
39 iContextObject( aContextObject ), |
|
40 iAutoDefine( aAutoDefine ) |
|
41 { |
|
42 FUNC_LOG; |
|
43 } |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // CCFPublishContextAction::ConstructL |
|
47 // Symbian 2nd phase constructor can leave. |
|
48 // ----------------------------------------------------------------------------- |
|
49 // |
|
50 void CCFPublishContextAction::ConstructL() |
|
51 { |
|
52 FUNC_LOG; |
|
53 } |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // CCFPublishContextAction::NewL |
|
57 // Two-phased constructor. |
|
58 // ----------------------------------------------------------------------------- |
|
59 // |
|
60 CCFPublishContextAction* CCFPublishContextAction::NewL( |
|
61 MCFOperationServices& aServices, |
|
62 CCFContextObject* aContextObject, |
|
63 TBool aAutoDefine ) |
|
64 { |
|
65 FUNC_LOG; |
|
66 |
|
67 CCFPublishContextAction* self = CCFPublishContextAction::NewLC( |
|
68 aServices, aContextObject, aAutoDefine ); |
|
69 CleanupStack::Pop( self ); |
|
70 return self; |
|
71 } |
|
72 |
|
73 // ----------------------------------------------------------------------------- |
|
74 // CCFPublishContextAction::NewLC |
|
75 // Two-phased constructor. |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 CCFPublishContextAction* CCFPublishContextAction::NewLC( |
|
79 MCFOperationServices& aServices, |
|
80 CCFContextObject* aContextObject, |
|
81 TBool aAutoDefine ) |
|
82 { |
|
83 FUNC_LOG; |
|
84 |
|
85 CCFPublishContextAction* self = new( ELeave ) CCFPublishContextAction( |
|
86 aServices, |
|
87 ( MCFExtendedContextInterface& ) aServices.ContextInterface(), |
|
88 aContextObject, |
|
89 aAutoDefine ); |
|
90 CleanupStack::PushL( self ); |
|
91 self->ConstructL(); |
|
92 return self; |
|
93 } |
|
94 |
|
95 // Destructor |
|
96 CCFPublishContextAction::~CCFPublishContextAction() |
|
97 { |
|
98 FUNC_LOG; |
|
99 |
|
100 delete iContextObject; |
|
101 } |
|
102 |
|
103 |
|
104 // ----------------------------------------------------------------------------- |
|
105 // CCFPublishContextAction::ActL |
|
106 // ----------------------------------------------------------------------------- |
|
107 // |
|
108 void CCFPublishContextAction::ActL() |
|
109 { |
|
110 FUNC_LOG; |
|
111 |
|
112 TInt err = iCF.PublishContextFromAction( *iContextObject, iAutoDefine ); |
|
113 ERROR_2( err, "Failed to publish context as script action: %S, %S", |
|
114 &iContextObject->Type(), |
|
115 &iContextObject->Value() ); |
|
116 } |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 // CCFPublishContextAction::GetSecurityPolicy |
|
120 // ----------------------------------------------------------------------------- |
|
121 // |
|
122 TInt CCFPublishContextAction::GetSecurityPolicy( TSecurityPolicy& aPolicy ) |
|
123 { |
|
124 FUNC_LOG; |
|
125 |
|
126 return iCF.GetSecurityPolicy( iContextObject->Source(), |
|
127 iContextObject->Type(), |
|
128 aPolicy ); |
|
129 } |