1 /* |
|
2 * Copyright (c) 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: Exemplary Action Handler Plugin |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <e32def.h> |
|
21 #include <e32uid.h> |
|
22 #include <LiwVariant.h> |
|
23 |
|
24 #include "ahtestplugin.h" |
|
25 |
|
26 _LIT8( KTitle , "title" ); |
|
27 _LIT8( KMessage, "message" ); |
|
28 |
|
29 // ======== MEMBER FUNCTIONS ======== |
|
30 |
|
31 // ---------------------------------------------------------------------------- |
|
32 // Symbian 2nd phase constructor can leave. |
|
33 // ---------------------------------------------------------------------------- |
|
34 // |
|
35 void CActionHandlerTestPlugin::ConstructL() |
|
36 { |
|
37 } |
|
38 |
|
39 // ---------------------------------------------------------------------------- |
|
40 // Two-phased constructor. |
|
41 // ---------------------------------------------------------------------------- |
|
42 // |
|
43 CActionHandlerTestPlugin* CActionHandlerTestPlugin::NewL() |
|
44 { |
|
45 CActionHandlerTestPlugin* self = CActionHandlerTestPlugin::NewLC(); |
|
46 CleanupStack::Pop( self ); |
|
47 return self; |
|
48 } |
|
49 |
|
50 // ---------------------------------------------------------------------------- |
|
51 // Two-phased constructor. |
|
52 // ---------------------------------------------------------------------------- |
|
53 // |
|
54 CActionHandlerTestPlugin* CActionHandlerTestPlugin::NewLC() |
|
55 { |
|
56 CActionHandlerTestPlugin* self = new( ELeave ) CActionHandlerTestPlugin; |
|
57 CleanupStack::PushL( self ); |
|
58 self->ConstructL(); |
|
59 return self; |
|
60 } |
|
61 |
|
62 |
|
63 // --------------------------------------------------------------------------- |
|
64 // destructor |
|
65 // --------------------------------------------------------------------------- |
|
66 CActionHandlerTestPlugin::~CActionHandlerTestPlugin() |
|
67 { |
|
68 } |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // Executes provided action |
|
72 // --------------------------------------------------------------------------- |
|
73 // |
|
74 TInt CActionHandlerTestPlugin::ExecuteActionL( const CLiwMap* aMap ) |
|
75 { |
|
76 TInt errCode( KErrNotFound ); |
|
77 TLiwVariant variant; |
|
78 variant.PushL(); |
|
79 errCode = ExtractVariantL( aMap, variant, KTitle ); |
|
80 if( errCode == KErrNone ) |
|
81 { |
|
82 errCode = ExtractVariantL( aMap, variant, KMessage ); |
|
83 } |
|
84 CleanupStack::PopAndDestroy( &variant ); |
|
85 return errCode; |
|
86 } |
|
87 |
|
88 |
|
89 // --------------------------------------------------------------------------- |
|
90 // Extract variant |
|
91 // --------------------------------------------------------------------------- |
|
92 // |
|
93 TInt CActionHandlerTestPlugin::ExtractVariantL( const CLiwMap* aMap, |
|
94 TLiwVariant& aVariant, |
|
95 const TDesC8& aMapName ) |
|
96 |
|
97 { |
|
98 TInt errCode( KErrNone ); |
|
99 |
|
100 if ( !aMap->FindL( aMapName, aVariant ) ) |
|
101 { |
|
102 errCode = KErrNotFound; |
|
103 } |
|
104 |
|
105 return errCode; |
|
106 } |
|
107 |
|
108 // End of file |
|