|
1 /* |
|
2 * Copyright (c) 2007-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: Folder UI extension plugin |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <liwcommon.h> |
|
21 |
|
22 #include "mmpluginsharedresources.h" |
|
23 #include "menudebug.h" |
|
24 #include "mmfolderuiextplugin.h" |
|
25 #include "mmfolderuiextpluginconstants.h" |
|
26 #include "mmfoldercommand.h" |
|
27 #include "hnglobals.h" |
|
28 #include "mmguiconstants.h" |
|
29 #include <apgwgnam.h> |
|
30 #include <w32std.h> |
|
31 #include <apgtask.h> |
|
32 #include <AknQueryDialog.h> |
|
33 |
|
34 // ============================ MEMBER FUNCTIONS ============================= |
|
35 // --------------------------------------------------------------------------- |
|
36 // Symbian factory function. |
|
37 // --------------------------------------------------------------------------- |
|
38 // |
|
39 CMmFolderUiExtPlugin* CMmFolderUiExtPlugin::NewL( |
|
40 MMmActionRequest& aActionRequest ) |
|
41 { |
|
42 CMmFolderUiExtPlugin* self = |
|
43 new( ELeave ) CMmFolderUiExtPlugin( aActionRequest ); |
|
44 CleanupStack::PushL( self ); |
|
45 self->ConstructL(); |
|
46 CleanupStack::Pop( self ); |
|
47 return self; |
|
48 } |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 // Symbian second phase constructor. |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 void CMmFolderUiExtPlugin::ConstructL() |
|
55 { |
|
56 iSharedResources = NULL; |
|
57 } |
|
58 |
|
59 // --------------------------------------------------------------------------- |
|
60 // Destructor. |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 CMmFolderUiExtPlugin::~CMmFolderUiExtPlugin() |
|
64 { |
|
65 delete iCommand; |
|
66 iCommand = NULL; |
|
67 delete iSharedResources; |
|
68 iSharedResources = NULL; |
|
69 } |
|
70 |
|
71 |
|
72 // --------------------------------------------------------------------------- |
|
73 // Default C++ constructor. |
|
74 // --------------------------------------------------------------------------- |
|
75 // |
|
76 CMmFolderUiExtPlugin::CMmFolderUiExtPlugin( MMmActionRequest& aActionRequest ): |
|
77 iActionRequest( aActionRequest ) |
|
78 { |
|
79 } |
|
80 |
|
81 // --------------------------------------------------------------------------- |
|
82 // |
|
83 // --------------------------------------------------------------------------- |
|
84 // |
|
85 TInt CMmFolderUiExtPlugin::ExecuteActionL( const TDesC& aCommand, |
|
86 CLiwGenericParamList* aEventParamList ) |
|
87 { |
|
88 TInt err = KErrNone; |
|
89 DEBUG16( ( "\t_MM_: CMmFolderUiExtPlugin::ExecuteActionL(): %S", |
|
90 &aCommand ) ); |
|
91 |
|
92 if( !aCommand.Compare( KCommandDeleteDialog ) && iCommand ) |
|
93 { |
|
94 iCommand->RemoveDialogL(); |
|
95 } |
|
96 else if( IsMatrixInForegroundL() ) |
|
97 { |
|
98 // Resources lazy initialization |
|
99 if (!iSharedResources) |
|
100 { |
|
101 iSharedResources = CMmPluginSharedResources::NewL(); |
|
102 } |
|
103 |
|
104 delete iCommand; |
|
105 iCommand = NULL; |
|
106 iCommand = CMmFolderCommand::FactoryL( aCommand ); |
|
107 if( iCommand ) |
|
108 { |
|
109 iCommand->SetRequestInterface( &iActionRequest ); |
|
110 iCommand->SetSharedResources( iSharedResources ); |
|
111 iCommand->ExecuteActionL( aEventParamList ); |
|
112 } |
|
113 else |
|
114 { |
|
115 DEBUG16( ( "\t_MM_: Unsupported command: %S", &aCommand ) ); |
|
116 err = KErrNotSupported; |
|
117 } |
|
118 } |
|
119 |
|
120 return err; |
|
121 } |
|
122 |
|
123 // --------------------------------------------------------------------------- |
|
124 // |
|
125 // --------------------------------------------------------------------------- |
|
126 // |
|
127 TBool CMmFolderUiExtPlugin::IsMatrixInForegroundL() |
|
128 { |
|
129 TBool res( EFalse ); |
|
130 RWsSession wsSession; |
|
131 User::LeaveIfError( wsSession.Connect() ); |
|
132 CleanupClosePushL( wsSession ); |
|
133 TApaTaskList taskList = TApaTaskList( wsSession ); |
|
134 TApaTask foregroundTask = taskList.FindByPos( 0 ); |
|
135 CApaWindowGroupName* wgName = |
|
136 CApaWindowGroupName::NewLC( wsSession, foregroundTask.WgId() ); |
|
137 if( wgName->AppUid() == KUidMatrixMenuApp ) |
|
138 { |
|
139 res = ETrue; |
|
140 } |
|
141 CleanupStack::PopAndDestroy( wgName ); |
|
142 CleanupStack::PopAndDestroy( &wsSession ); |
|
143 return res; |
|
144 } |
|
145 |
|
146 |
|
147 // end of file |
|
148 |