|
1 /* |
|
2 * Copyright (c) 2006 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: MPX Avkon view plugin definition. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <aknViewAppUi.h> |
|
22 #include <aknview.h> |
|
23 #include <mpxcustomcommandobserver.h> |
|
24 #include <mpxviewutilitycommanddef.h> |
|
25 |
|
26 #include "mpxaknviewplugin.h" |
|
27 |
|
28 // ======== MEMBER FUNCTIONS ======== |
|
29 |
|
30 // --------------------------------------------------------------------------- |
|
31 // Destructor |
|
32 // --------------------------------------------------------------------------- |
|
33 // |
|
34 EXPORT_C CMPXAknViewPlugin::~CMPXAknViewPlugin() |
|
35 { |
|
36 // do nothing |
|
37 } |
|
38 |
|
39 // --------------------------------------------------------------------------- |
|
40 // From CMPXViewPlugin |
|
41 // Interface method to create view. |
|
42 // --------------------------------------------------------------------------- |
|
43 // |
|
44 EXPORT_C void CMPXAknViewPlugin::CreateViewL() |
|
45 { |
|
46 // no need to create again if view already exist |
|
47 if ( !iView ) |
|
48 { |
|
49 CAknView* view = ConstructViewLC(); |
|
50 iAvkonViewAppUi->AddViewL( view ); |
|
51 CleanupStack::Pop( view ); // ownership transferred |
|
52 iView = view; |
|
53 } |
|
54 } |
|
55 |
|
56 // --------------------------------------------------------------------------- |
|
57 // From CMPXViewPlugin |
|
58 // Interface method to destroy view. |
|
59 // --------------------------------------------------------------------------- |
|
60 // |
|
61 EXPORT_C void CMPXAknViewPlugin::DestroyView() |
|
62 { |
|
63 ASSERT( iView ); |
|
64 } |
|
65 |
|
66 // --------------------------------------------------------------------------- |
|
67 // From CMPXViewPlugin |
|
68 // Interface method to activate view. |
|
69 // --------------------------------------------------------------------------- |
|
70 // |
|
71 EXPORT_C void CMPXAknViewPlugin::ActivateViewL( |
|
72 const TDesC* aParam ) |
|
73 { |
|
74 if ( !iView ) |
|
75 { |
|
76 CreateViewL(); |
|
77 } |
|
78 |
|
79 if ( !aParam ) |
|
80 { |
|
81 iAvkonViewAppUi->ActivateLocalViewL( iView->Id() ); |
|
82 } |
|
83 else |
|
84 { |
|
85 // Create a narrow heap descriptor from a unicode descriptor |
|
86 HBufC8* des8 = HBufC8::NewLC( aParam->Length() ); |
|
87 des8->Des().Copy( *aParam ); |
|
88 |
|
89 iAvkonViewAppUi->ActivateLocalViewL( iView->Id(), KNullUid, *des8 ); |
|
90 |
|
91 CleanupStack::PopAndDestroy( des8 ); |
|
92 } |
|
93 } |
|
94 |
|
95 // --------------------------------------------------------------------------- |
|
96 // From CMPXViewPlugin |
|
97 // Interface method to activate as default view, will not bring to foreground |
|
98 // --------------------------------------------------------------------------- |
|
99 // |
|
100 EXPORT_C void CMPXAknViewPlugin::SetAsDefaultViewL() |
|
101 { |
|
102 if ( !iView ) |
|
103 { |
|
104 CreateViewL(); |
|
105 } |
|
106 iAvkonViewAppUi->SetDefaultViewL( *iView ); |
|
107 } |
|
108 |
|
109 // --------------------------------------------------------------------------- |
|
110 // From CMPXViewPlugin |
|
111 // Interface method to deactivate view. |
|
112 // --------------------------------------------------------------------------- |
|
113 // |
|
114 EXPORT_C void CMPXAknViewPlugin::DeactivateView() |
|
115 { |
|
116 if ( iCommandObserver ) |
|
117 { |
|
118 TPckgC<TInt> selfPtr( reinterpret_cast<TInt>( this ) ); |
|
119 iCommandObserver->HandleCustomCommand( |
|
120 TUid::Uid( KMPXViewUtilityCustomCommand ), |
|
121 EMPXViewUtilCmdViewDeActivated, |
|
122 selfPtr ); |
|
123 } |
|
124 } |
|
125 |
|
126 // End of File |