18 |
18 |
19 // INCLUDE FILES |
19 // INCLUDE FILES |
20 #include <bautils.h> |
20 #include <bautils.h> |
21 #include <coemain.h> |
21 #include <coemain.h> |
22 #include <aknViewAppUi.h> |
22 #include <aknViewAppUi.h> |
|
23 #include <e32property.h> |
|
24 #include <activeidle2domainpskeys.h> |
23 |
25 |
24 #include "wmcommon.h" |
26 #include "wmcommon.h" |
25 #include "widgetmanager.hrh" |
27 #include "widgetmanager.hrh" |
26 #include "wmmaincontainer.h" |
28 #include "wmmaincontainer.h" |
27 #include "wmmaincontainerview.h" |
29 #include "wmmaincontainerview.h" |
47 // CWmPlugin::~CWmPlugin |
49 // CWmPlugin::~CWmPlugin |
48 // --------------------------------------------------------- |
50 // --------------------------------------------------------- |
49 // |
51 // |
50 CWmPlugin::~CWmPlugin() |
52 CWmPlugin::~CWmPlugin() |
51 { |
53 { |
|
54 iPostponedCommand = ENone; |
52 if ( iViewAppUi ) |
55 if ( iViewAppUi ) |
53 { |
56 { |
54 Deactivate(); |
57 if ( iWmMainContainer && IsActive() ) |
55 iViewAppUi->RemoveView( TUid::Uid( EWmMainContainerViewId ) ); |
58 { |
56 } |
59 iWmMainContainer->SetClosingDown( ETrue ); |
57 iWmMainContainer = NULL; |
60 TRAPD( err, iViewAppUi->ActivateLocalViewL( |
|
61 iPreviousViewUid.iViewUid ); ); |
|
62 if ( KErrNone == err ) |
|
63 { |
|
64 iWait->Start(); |
|
65 // remove view from appui |
|
66 iViewAppUi->RemoveView( |
|
67 TUid::Uid( EWmMainContainerViewId ) ); |
|
68 } |
|
69 else |
|
70 { |
|
71 TRAP_IGNORE( iViewAppUi->DeactivateActiveViewL(); ); |
|
72 iViewAppUi->RemoveFromViewStack( |
|
73 *iWmMainView, iWmMainContainer ); |
|
74 delete iWmMainContainer; |
|
75 iWmMainContainer = NULL; |
|
76 } |
|
77 } |
|
78 } |
58 delete iResourceLoader; |
79 delete iResourceLoader; |
59 delete iEffectManager; |
80 delete iEffectManager; |
60 delete iPostponedContent; |
81 delete iPostponedContent; |
|
82 delete iWait; |
61 } |
83 } |
62 |
84 |
63 // --------------------------------------------------------- |
85 // --------------------------------------------------------- |
64 // CWmPlugin::CWmPlugin |
86 // CWmPlugin::CWmPlugin |
65 // --------------------------------------------------------- |
87 // --------------------------------------------------------- |
74 // --------------------------------------------------------- |
96 // --------------------------------------------------------- |
75 // |
97 // |
76 void CWmPlugin::ConstructL() |
98 void CWmPlugin::ConstructL() |
77 { |
99 { |
78 iWmMainContainer = NULL; |
100 iWmMainContainer = NULL; |
|
101 iWmMainView = NULL; |
79 |
102 |
80 // store static view app ui |
103 // store static view app ui |
81 CEikonEnv* eikonEnv = CEikonEnv::Static(); |
104 CEikonEnv* eikonEnv = CEikonEnv::Static(); |
82 if ( !eikonEnv ) User::Leave( KErrUnknown ); |
105 if ( !eikonEnv ) User::Leave( KErrUnknown ); |
83 iViewAppUi = (CAknViewAppUi*)eikonEnv->EikAppUi(); |
106 iViewAppUi = (CAknViewAppUi*)eikonEnv->EikAppUi(); |
85 |
108 |
86 // create resource loader |
109 // create resource loader |
87 iFs = &eikonEnv->FsSession(); |
110 iFs = &eikonEnv->FsSession(); |
88 iResourceLoader = CWmResourceLoader::NewL( *eikonEnv ); |
111 iResourceLoader = CWmResourceLoader::NewL( *eikonEnv ); |
89 iEffectManager = CWmEffectManager::NewL( *eikonEnv ); |
112 iEffectManager = CWmEffectManager::NewL( *eikonEnv ); |
|
113 |
|
114 // wait object |
|
115 iWait = new (ELeave) CActiveSchedulerWait(); |
90 |
116 |
91 // main view |
117 // main view |
92 CWmMainContainerView* mainView = |
118 CWmMainContainerView* mainView = |
93 CWmMainContainerView::NewL( *this ); |
119 CWmMainContainerView::NewL( *this ); |
94 CleanupStack::PushL( mainView ); |
120 CleanupStack::PushL( mainView ); |
95 iViewAppUi->AddViewL( mainView ); |
121 iViewAppUi->AddViewL( mainView ); |
96 CleanupStack::Pop( mainView ); |
122 CleanupStack::Pop( mainView ); |
|
123 iWmMainView = mainView; |
97 } |
124 } |
98 |
125 |
99 // --------------------------------------------------------- |
126 // --------------------------------------------------------- |
100 // CWmPlugin::Activate |
127 // CWmPlugin::Activate |
101 // --------------------------------------------------------- |
128 // --------------------------------------------------------- |
150 { |
177 { |
151 iPreviousViewUid = aViewId; |
178 iPreviousViewUid = aViewId; |
152 iWmMainContainer = aWmMainContainer; |
179 iWmMainContainer = aWmMainContainer; |
153 iEffectManager->UiRendered(); |
180 iEffectManager->UiRendered(); |
154 iWmMainContainer->SetClosingDown( EFalse ); |
181 iWmMainContainer->SetClosingDown( EFalse ); |
|
182 |
|
183 // Don't forward numeric keys to phone |
|
184 ForwardNumericKeysToPhone( EFalse ); |
155 } |
185 } |
156 |
186 |
157 // --------------------------------------------------------- |
187 // --------------------------------------------------------- |
158 // CWmPlugin::MainViewDeactivated |
188 // CWmPlugin::MainViewDeactivated |
159 // --------------------------------------------------------- |
189 // --------------------------------------------------------- |
160 // |
190 // |
161 void CWmPlugin::MainViewDeactivated() |
191 void CWmPlugin::MainViewDeactivated() |
162 { |
192 { |
|
193 // Forward numeric keys to phone |
|
194 ForwardNumericKeysToPhone( ETrue ); |
|
195 |
163 iPreviousViewUid.iViewUid = KNullUid; |
196 iPreviousViewUid.iViewUid = KNullUid; |
164 iWmMainContainer = NULL; |
197 iWmMainContainer = NULL; |
165 iEffectManager->UiRendered(); |
198 if ( iEffectManager && !iWait->IsStarted() ) |
166 |
199 { |
167 TRAP_IGNORE( ExecutePostponedCommandL(); ); |
200 iEffectManager->UiRendered(); |
|
201 } |
|
202 |
|
203 TRAP_IGNORE( ExecuteCommandL(); ); |
|
204 |
|
205 if ( iWait->IsStarted() ) { iWait->AsyncStop(); } |
|
206 } |
|
207 |
|
208 // --------------------------------------------------------- |
|
209 // CWmPlugin::ForwardNumericKeysToPhone |
|
210 // --------------------------------------------------------- |
|
211 // |
|
212 void CWmPlugin::ForwardNumericKeysToPhone( TBool aEnabled ) |
|
213 { |
|
214 TInt value = aEnabled ? |
|
215 EPSAiForwardNumericKeysToPhone : |
|
216 EPSAiDontForwardNumericKeysToPhone; |
|
217 |
|
218 RProperty::Set( |
|
219 KPSUidAiInformation, |
|
220 KActiveIdleForwardNumericKeysToPhone, |
|
221 value ); |
168 } |
222 } |
169 |
223 |
170 // --------------------------------------------------------- |
224 // --------------------------------------------------------- |
171 // CWmPlugin::SetPostponedCommandL |
225 // CWmPlugin::SetPostponedCommandL |
172 // --------------------------------------------------------- |
226 // --------------------------------------------------------- |
179 iPostponedContent = NULL; |
233 iPostponedContent = NULL; |
180 iPostponedContent = aContentInfo.CloneL(); |
234 iPostponedContent = aContentInfo.CloneL(); |
181 } |
235 } |
182 |
236 |
183 // --------------------------------------------------------- |
237 // --------------------------------------------------------- |
184 // CWmPlugin::ExecutePostponedCommandL |
238 // CWmPlugin::ExecuteCommandL |
185 // --------------------------------------------------------- |
239 // --------------------------------------------------------- |
186 // |
240 // |
187 void CWmPlugin::ExecutePostponedCommandL() |
241 void CWmPlugin::ExecuteCommandL() |
188 { |
242 { |
189 if ( iPostponedCommand == EAddToHomescreen ) |
243 if ( iPostponedCommand == EAddToHomescreen ) |
190 { |
244 { |
191 TInt err = ContentController().AddWidgetL( *iPostponedContent ); |
245 TInt err = ContentController().AddWidgetL( *iPostponedContent ); |
192 if ( err == KHsErrorViewFull || |
246 if ( err == KHsErrorViewFull || |
255 // CWmPlugin::NotifyWidgetListChanged |
309 // CWmPlugin::NotifyWidgetListChanged |
256 // --------------------------------------------------------- |
310 // --------------------------------------------------------- |
257 // |
311 // |
258 void CWmPlugin::NotifyWidgetListChanged() |
312 void CWmPlugin::NotifyWidgetListChanged() |
259 { |
313 { |
260 if ( iWmMainContainer ) |
314 if ( iWmMainContainer && !iWmMainContainer->ClosingDown() ) |
261 { |
315 { |
262 iWmMainContainer->HandleWidgetListChanged(); |
316 iWmMainContainer->HandleWidgetListChanged(); |
263 } |
317 } |
264 } |
318 } |
265 |
319 |