|
1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "MemSpyAppUi.h" |
|
19 |
|
20 // System includes |
|
21 #include <AknQueryDialog.h> |
|
22 #include <aknmessagequerydialog.h> |
|
23 #include <aknradiobuttonsettingpage.h> |
|
24 #include <eikaufty.h> |
|
25 #include <eikmenub.h> |
|
26 #include <avkon.hrh> |
|
27 #include <barsread.h> |
|
28 #include <f32file.h> |
|
29 #include <apgtask.h> |
|
30 #include <memspyui.rsg> |
|
31 |
|
32 // Engine includes |
|
33 #include <memspy/engine/memspyengine.h> |
|
34 #include <memspy/engine/memspyengineoutputsink.h> |
|
35 #include <memspy/engine/memspyengineobjectcontainer.h> |
|
36 #include <memspy/engine/memspyengineobjectprocess.h> |
|
37 #include <memspy/engine/memspyengineobjectthread.h> |
|
38 #include <memspy/engine/memspyengineobjectthreadinfoobjects.h> |
|
39 #include <memspy/engine/memspyenginehelperchunk.h> |
|
40 #include <memspy/engine/memspyenginehelperthread.h> |
|
41 #include <memspy/engine/memspyenginehelperprocess.h> |
|
42 #include <memspy/engine/memspyenginehelperkernelcontainers.h> |
|
43 #include <memspy/engine/memspyenginehelperfbserv.h> |
|
44 #include <memspyengineclientinterface.h> |
|
45 #include <memspy/driver/memspydriverenumerationsshared.h> |
|
46 #include <memspy/engine/memspyenginehelperkernelcontainers.h> |
|
47 //cigasto |
|
48 #include <memspysession.h> |
|
49 |
|
50 // User includes |
|
51 #include "MemSpyContainer.h" |
|
52 #include "MemSpyDocument.h" |
|
53 #include "MemSpySettings.h" |
|
54 #include "MemSpyDeviceWideOperationDialog.h" |
|
55 #include "MemSpyViewRAMInfo.h" // for aknicon config check |
|
56 #include "MemSpyExportBitmapsToMemoryCardDialog.h" |
|
57 #include "MemSpy.hrh" |
|
58 #include "viewcli.h" |
|
59 |
|
60 // Constants |
|
61 const TInt KMemSpyDefaultAutoCaptureTimerPeriod = 60; |
|
62 const TUint32 KMemSpyEikSrvSID = 0x10003a4a; |
|
63 |
|
64 /* |
|
65 CMemSpyAppUi::CMemSpyAppUi( CMemSpyEngine& aEngine ) |
|
66 : iEngine( aEngine ), iAutoCaptureTimerPeriod( KMemSpyDefaultAutoCaptureTimerPeriod ), iAutoCaptureOperationType( CMemSpyDeviceWideOperations::EPerEntityHeapInfo ) |
|
67 { |
|
68 iEngine.SetObserver( this ); |
|
69 } |
|
70 */ |
|
71 CMemSpyAppUi::CMemSpyAppUi( RMemSpySession &aSession ) |
|
72 : iMemSpySession( aSession ), iAutoCaptureTimerPeriod( KMemSpyDefaultAutoCaptureTimerPeriod ), iAutoCaptureOperationType( CMemSpyDeviceWideOperations::EPerEntityHeapInfo ) |
|
73 { |
|
74 //iEngine.SetObserver( this ); |
|
75 } |
|
76 |
|
77 CMemSpyAppUi::~CMemSpyAppUi() |
|
78 { |
|
79 RDebug::Printf( "[MemSpy] MemSpy is now closing." ); |
|
80 // |
|
81 delete iAutoCaptureTimer; |
|
82 // |
|
83 if (iAppContainer) |
|
84 { |
|
85 RemoveFromStack( iAppContainer ); |
|
86 delete iAppContainer; |
|
87 } |
|
88 // |
|
89 //iEngine.SetObserver( NULL ); |
|
90 SetViewServerTimeOutStatus( ETrue ); |
|
91 } |
|
92 |
|
93 |
|
94 void CMemSpyAppUi::ConstructL() |
|
95 { |
|
96 BaseConstructL( EAknEnableSkin ); |
|
97 // |
|
98 //iAppContainer = new (ELeave) CMemSpyContainer( iEngine, *this ); |
|
99 iAppContainer = new (ELeave) CMemSpyContainer( iMemSpySession, *this ); |
|
100 iAppContainer->SetMopParent(this); |
|
101 iAppContainer->ConstructL( ClientRect() ); |
|
102 iAppContainer->SetObserver( this ); |
|
103 iAppContainer->SetFocus( ETrue ); |
|
104 AddToStackL( iAppContainer ); |
|
105 // |
|
106 iAutoCaptureTimer = CPeriodic::NewL( CActive::EPriorityIdle ); |
|
107 // |
|
108 iEikonEnv->SetSystem( ETrue ); |
|
109 // |
|
110 SetViewServerTimeOutStatus( EFalse ); |
|
111 } |
|
112 |
|
113 |
|
114 CMemSpyDocument& CMemSpyAppUi::MemSpyDocument() |
|
115 { |
|
116 CMemSpyDocument* doc = static_cast< CMemSpyDocument* >( Document() ); |
|
117 return *doc; |
|
118 } |
|
119 |
|
120 |
|
121 const CMemSpyDocument& CMemSpyAppUi::MemSpyDocument() const |
|
122 { |
|
123 const CMemSpyDocument* doc = static_cast< const CMemSpyDocument* >( Document() ); |
|
124 return *doc; |
|
125 } |
|
126 |
|
127 |
|
128 void CMemSpyAppUi::HandleStatusPaneSizeChange() |
|
129 { |
|
130 iAppContainer->SetRect( ClientRect() ); |
|
131 } |
|
132 |
|
133 |
|
134 void CMemSpyAppUi::HandleControlEventL( CCoeControl* aControl, TCoeEvent /*aEventType*/ ) |
|
135 { |
|
136 if ( aControl == iAppContainer ) |
|
137 { |
|
138 UpdateCBAL(); |
|
139 } |
|
140 } |
|
141 |
|
142 |
|
143 void CMemSpyAppUi::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) |
|
144 { |
|
145 CMemSpyViewBase& view = iAppContainer->ActiveView(); |
|
146 const TMemSpyViewType viewType = iAppContainer->ActiveViewType(); |
|
147 // |
|
148 const TBool openableView = MemSpyViewTypeUtils::IsOpenableItem( viewType ); |
|
149 const TBool exitable = MemSpyViewTypeUtils::IsExitableView( viewType ); |
|
150 // |
|
151 #ifdef _DEBUG |
|
152 RDebug::Printf( "[MemSpy] CMemSpyAppUi::DynInitMenuPaneL() - START - aResourceId: 0x%08x (%8d), iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d, viewType: %d, openableView: %d, exitable: %d", aResourceId, aResourceId, iAutoCaptureOperationType, iAutoCaptureTimer->IsActive(), viewType, openableView, exitable ); |
|
153 #endif |
|
154 // |
|
155 if ( aResourceId == R_MEMSPY_MENUPANE ) |
|
156 { |
|
157 const TInt count = aMenuPane->NumberOfItemsInPane(); |
|
158 for( TInt i=0; i<count; i++ ) |
|
159 { |
|
160 TBool dimItem = EFalse; |
|
161 CEikMenuPaneItem::SData& menuPaneMetaData = aMenuPane->ItemDataByIndexL( i ); |
|
162 |
|
163 // If the command is inside the view-specific range then we'll hide it |
|
164 // unless the view and command id matches. |
|
165 const TBool isViewSpecific = ( menuPaneMetaData.iCommandId >= KMemSpyMenuCommandViewSpecific ); |
|
166 if ( isViewSpecific ) |
|
167 { |
|
168 // Check whether this view requires this command item. |
|
169 dimItem = ( view.MenuCascadeCommandId() != menuPaneMetaData.iCommandId ); |
|
170 } |
|
171 |
|
172 aMenuPane->SetItemDimmed( menuPaneMetaData.iCommandId, dimItem ); |
|
173 } |
|
174 |
|
175 aMenuPane->SetItemDimmed( EMemSpyCmdOpen, !openableView ); |
|
176 aMenuPane->SetItemDimmed( EAknSoftkeyBack, exitable ); |
|
177 aMenuPane->SetItemDimmed( EAknCmdExit, !exitable ); |
|
178 } |
|
179 else if ( aResourceId == R_MEMSPY_MENUPANE_TOOLS ) |
|
180 { |
|
181 const TBool inOpenFilesView = ( viewType == EMemSpyViewTypeOpenFiles ); |
|
182 aMenuPane->SetItemDimmed( EMemSpyCmdToolsListOpenFiles, !inOpenFilesView ); |
|
183 } |
|
184 else if ( aResourceId == R_MEMSPY_MENUPANE_VIEW ) |
|
185 { |
|
186 // Hide the refresh item when in the thread info container view |
|
187 aMenuPane->SetItemDimmed( EMemSpyCmdViewRefresh, viewType == EMemSpyViewTypeThreadInfoItemList ); |
|
188 aMenuPane->SetItemDimmed( EMemSpyCmdViewOutputToSink, viewType == EMemSpyViewTypeThreadInfoItemList ); |
|
189 } |
|
190 else if ( aResourceId == R_MEMSPY_MENUPANE_OUTPUT ) |
|
191 { |
|
192 TMemSpySinkType currentSink; |
|
193 iMemSpySession.GetOutputSink( currentSink ); |
|
194 aMenuPane->SetItemDimmed( EMemSpyCmdOutputToDebug, currentSink == ESinkTypeDebug ); |
|
195 aMenuPane->SetItemDimmed( EMemSpyCmdOutputToFile, currentSink == ESinkTypeFile ); |
|
196 } |
|
197 else if ( aResourceId == R_MEMSPY_MENUPANE_AUTO_CAPTURE ) |
|
198 { |
|
199 // Change the auto-capture toggle caption appropriately... |
|
200 TInt resId = R_MEMSPY_AUTO_CAPTURE_ENABLE; |
|
201 if ( iAutoCaptureTimer->IsActive() ) |
|
202 { |
|
203 resId = R_MEMSPY_AUTO_CAPTURE_DISABLE; |
|
204 } |
|
205 aMenuPane->SetItemTextL( EMemSpyCmdAutoCaptureToggle, resId ); |
|
206 } |
|
207 |
|
208 #ifdef _DEBUG |
|
209 RDebug::Printf( "[MemSpy] CMemSpyAppUi::DynInitMenuPaneL() - sending to view..." ); |
|
210 #endif |
|
211 |
|
212 view.DynInitMenuPaneL( aResourceId, aMenuPane ); |
|
213 |
|
214 #ifdef _DEBUG |
|
215 RDebug::Printf( "[MemSpy] CMemSpyAppUi::DynInitMenuPaneL() - END - aResourceId: 0x%08x (%8d), iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d, viewType: %d, openableView: %d, exitable: %d", aResourceId, aResourceId, iAutoCaptureOperationType, iAutoCaptureTimer->IsActive(), viewType, openableView, exitable ); |
|
216 #endif |
|
217 } |
|
218 |
|
219 |
|
220 TKeyResponse CMemSpyAppUi::HandleKeyEventL( const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/ ) |
|
221 { |
|
222 return EKeyWasNotConsumed; |
|
223 } |
|
224 |
|
225 |
|
226 void CMemSpyAppUi::HandleCommandL( TInt aCommand ) |
|
227 { |
|
228 #ifdef _DEBUG |
|
229 RDebug::Printf( "[MemSpy] CMemSpyAppUi::HandleCommandL() - START - aCommand: %8d, iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", aCommand, iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() ); |
|
230 #endif |
|
231 |
|
232 switch ( aCommand ) |
|
233 { |
|
234 case EAknSoftkeyBack: |
|
235 OnCmdBackL(); |
|
236 break; |
|
237 |
|
238 case EEikCmdExit: |
|
239 case EAknCmdExit: |
|
240 case EAknSoftkeyExit: |
|
241 OnCmdExitL(); |
|
242 break; |
|
243 |
|
244 case EMemSpyCmdOpen: |
|
245 OnCmdOpenL(); |
|
246 break; |
|
247 |
|
248 case EMemSpyCmdOutputToDebug: |
|
249 OnCmdOutputToDebugL(); |
|
250 break; |
|
251 case EMemSpyCmdOutputToFile: |
|
252 OnCmdOutputToFileL(); |
|
253 break; |
|
254 |
|
255 case EMemSpyCmdToolsAbout: |
|
256 OnCmdAboutL(); |
|
257 break; |
|
258 // |
|
259 case EMemSpyCmdPhoneInfoGeneralSummary: |
|
260 //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityGeneralSummary ); |
|
261 OnCmdPhoneInformationOperationL( OutputPhoneInfo ); |
|
262 break; |
|
263 case EMemSpyCmdPhoneInfoGeneralDetailed: |
|
264 //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityGeneralDetailed ); |
|
265 OnCmdPhoneInformationOperationL( OutputDetailedPhoneInfo ); |
|
266 break; |
|
267 /* |
|
268 case EMemSpyCmdPhoneInfoGeneralHandles: |
|
269 OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityGeneralHandles ); |
|
270 break; |
|
271 case EMemSpyCmdPhoneInfoGeneralKernelContainers: |
|
272 OnCmdPhoneInformationOperationKernelContainersL(); |
|
273 break; |
|
274 // |
|
275 */ |
|
276 case EMemSpyCmdPhoneInfoHeapInfoSummary: |
|
277 //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityHeapInfo ); |
|
278 OnCmdPhoneInformationOperationL (OutputHeapInfo ); |
|
279 break; |
|
280 case EMemSpyCmdPhoneInfoHeapInfoCompact: |
|
281 //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EEntireDeviceHeapInfoCompact ); |
|
282 OnCmdPhoneInformationOperationL( OutputCompactHeapInfo ); |
|
283 break; |
|
284 case EMemSpyCmdPhoneInfoHeapCellListing: |
|
285 //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityHeapCellListing ); |
|
286 OnCmdPhoneInformationOperationL( OutputHeapCellListing ); |
|
287 break; |
|
288 |
|
289 case EMemSpyCmdPhoneInfoHeapDump: |
|
290 //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityHeapData ); |
|
291 OnCmdPhoneInformationOperationL( OutputHeapData ); |
|
292 break; |
|
293 // |
|
294 case EMemSpyCmdPhoneInfoStackInfo: |
|
295 //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityStackInfo ); |
|
296 OnCmdPhoneInformationOperationL( OutputStackInfo ); |
|
297 break; |
|
298 case EMemSpyCmdPhoneInfoStackInfoCompact: |
|
299 //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EEntireDeviceStackInfoCompact ); |
|
300 OnCmdPhoneInformationOperationL( OutputCompactStackInfo ); |
|
301 break; |
|
302 case EMemSpyCmdPhoneInfoStackDumpUser: |
|
303 //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityStackDataUser ); |
|
304 OnCmdPhoneInformationOperationL( OutputUserStackData ); |
|
305 break; |
|
306 case EMemSpyCmdPhoneInfoStackDumpKernel: |
|
307 //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityStackDataKernel ); |
|
308 OnCmdPhoneInformationOperationL( OutputKernelStackData ); |
|
309 break; |
|
310 |
|
311 case EMemSpyCmdAutoCaptureToggle: |
|
312 OnCmdAutoCaptureToggleL(); |
|
313 break; |
|
314 case EMemSpyCmdAutoCaptureRetryTime: |
|
315 OnCmdAutoCaptureRetryTimeL(); |
|
316 break; |
|
317 case EMemSpyCmdAutoCaptureOperationType: |
|
318 OnCmdAutoCaptureOperationTypeL(); |
|
319 break; |
|
320 |
|
321 default: |
|
322 iAppContainer->HandleCommandL( aCommand ); |
|
323 break; |
|
324 } |
|
325 |
|
326 #ifdef _DEBUG |
|
327 RDebug::Printf( "[MemSpy] CMemSpyAppUi::HandleCommandL() - END - aCommand: %8d, iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", aCommand, iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() ); |
|
328 #endif |
|
329 } |
|
330 |
|
331 |
|
332 void CMemSpyAppUi::HandleForegroundEventL( TBool aForeground) |
|
333 { |
|
334 // Refresh the container when coming to the foreground |
|
335 if ( aForeground ) |
|
336 { |
|
337 iAppContainer->OnCmdViewRefreshL(); |
|
338 } |
|
339 } |
|
340 |
|
341 |
|
342 void CMemSpyAppUi::HandleThreadSelectedL( const CMemSpyThread& /*aThread*/ ) |
|
343 { |
|
344 MEikAppUiFactory* appUiFactory = (iEikonEnv)->AppUiFactory(); |
|
345 appUiFactory->MenuBar()->TryDisplayMenuBarL(); |
|
346 } |
|
347 |
|
348 |
|
349 void CMemSpyAppUi::HandleMemSpyEngineEventL( MMemSpyEngineObserver::TEvent aEvent, TAny* aContext ) |
|
350 { |
|
351 if ( aEvent == MMemSpyEngineObserver::EHandleThreadsOrProcessesChanged ) |
|
352 { |
|
353 // Get the original container |
|
354 const CMemSpyEngineObjectContainer& oldContainer = *reinterpret_cast< CMemSpyEngineObjectContainer* >( aContext ); |
|
355 (void) oldContainer; |
|
356 |
|
357 // Refresh the container |
|
358 iAppContainer->OnCmdViewRefreshL(); |
|
359 } |
|
360 else if ( aEvent == MMemSpyEngineObserver::EHandleClientServerOperationRequest ) |
|
361 { |
|
362 const TInt function = reinterpret_cast<TInt>( aContext ); |
|
363 InitiateMemSpyClientServerOperationL( function ); |
|
364 } |
|
365 } |
|
366 |
|
367 |
|
368 void CMemSpyAppUi::DWOperationStarted() |
|
369 { |
|
370 #ifdef _DEBUG |
|
371 RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationStarted() - START - iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() ); |
|
372 #endif |
|
373 |
|
374 iRunningDeviceWideOperation = ETrue; |
|
375 |
|
376 #ifdef _DEBUG |
|
377 RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationStarted() - END - iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() ); |
|
378 #endif |
|
379 } |
|
380 |
|
381 |
|
382 void CMemSpyAppUi::DWOperationCancelled() |
|
383 { |
|
384 #ifdef _DEBUG |
|
385 RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationCancelled() - START - iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() ); |
|
386 #endif |
|
387 |
|
388 iAutoCaptureTimer->Cancel(); |
|
389 |
|
390 #ifdef _DEBUG |
|
391 RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationCancelled() - END - iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() ); |
|
392 #endif |
|
393 } |
|
394 |
|
395 |
|
396 void CMemSpyAppUi::DWOperationCompleted() |
|
397 { |
|
398 #ifdef _DEBUG |
|
399 RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationCompleted() - START - iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() ); |
|
400 #endif |
|
401 |
|
402 iRunningDeviceWideOperation = EFalse; |
|
403 |
|
404 #ifdef _DEBUG |
|
405 RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationCompleted() - END - iAutoCaptureTimer is active: %d", iAutoCaptureTimer->IsActive() ); |
|
406 #endif |
|
407 } |
|
408 |
|
409 |
|
410 void CMemSpyAppUi::UpdateCBAL() |
|
411 { |
|
412 CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); |
|
413 const TMemSpyViewType viewType = iAppContainer->ActiveViewType(); |
|
414 // |
|
415 if ( MemSpyViewTypeUtils::IsExitableView( viewType ) ) |
|
416 { |
|
417 cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_EXIT ); |
|
418 } |
|
419 else |
|
420 { |
|
421 cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK ); |
|
422 } |
|
423 |
|
424 cba->MakeVisible( ETrue ); |
|
425 cba->DrawNow(); |
|
426 } |
|
427 |
|
428 |
|
429 void CMemSpyAppUi::InitiateMemSpyClientServerOperationL( TInt aOpCode ) |
|
430 { |
|
431 #ifdef _DEBUG |
|
432 RDebug::Printf( "[MemSpy] CMemSpyAppUi::InitiateMemSpyClientServerOperationL() - START - aOpCode: %d", aOpCode ); |
|
433 #endif |
|
434 |
|
435 switch( aOpCode ) |
|
436 { |
|
437 case EMemSpyClientServerOpSummaryInfo: |
|
438 HandleCommandL( EMemSpyCmdPhoneInfoGeneralSummary ); |
|
439 break; |
|
440 case EMemSpyClientServerOpSummaryInfoDetailed: |
|
441 HandleCommandL( EMemSpyCmdPhoneInfoGeneralDetailed ); |
|
442 break; |
|
443 // |
|
444 case EMemSpyClientServerOpHeapInfo: |
|
445 HandleCommandL( EMemSpyCmdPhoneInfoHeapInfoSummary ); |
|
446 break; |
|
447 case EMemSpyClientServerOpHeapCellListing: |
|
448 HandleCommandL( EMemSpyCmdPhoneInfoHeapCellListing ); |
|
449 break; |
|
450 case EMemSpyClientServerOpHeapData: |
|
451 HandleCommandL( EMemSpyCmdPhoneInfoHeapDump ); |
|
452 break; |
|
453 // |
|
454 case EMemSpyClientServerOpStackInfo: |
|
455 HandleCommandL( EMemSpyCmdPhoneInfoStackInfo ); |
|
456 break; |
|
457 case EMemSpyClientServerOpStackDataUser: |
|
458 HandleCommandL( EMemSpyCmdPhoneInfoStackDumpUser ); |
|
459 break; |
|
460 case EMemSpyClientServerOpStackDataKernel: |
|
461 HandleCommandL( EMemSpyCmdPhoneInfoStackDumpKernel ); |
|
462 break; |
|
463 // |
|
464 case EMemSpyClientServerOpBitmapsSave: |
|
465 OnCmdToolsBitmapsSaveToMemoryCardL(); |
|
466 break; |
|
467 case EMemSpyClientServerOpSendToBackground: |
|
468 OnCmdToolsSendToBackgroundL(); |
|
469 break; |
|
470 case EMemSpyClientServerOpBringToForeground: |
|
471 OnCmdToolsBringToForegroundL(); |
|
472 break; |
|
473 case EMemSpyClientServerOpExit: |
|
474 OnCmdExitL(); |
|
475 break; |
|
476 // |
|
477 default: |
|
478 User::Leave( KErrNotSupported ); |
|
479 break; |
|
480 } |
|
481 |
|
482 #ifdef _DEBUG |
|
483 RDebug::Printf( "[MemSpy] CMemSpyAppUi::InitiateMemSpyClientServerOperationL() - END - aOpCode: %d", aOpCode ); |
|
484 #endif |
|
485 } |
|
486 |
|
487 |
|
488 void CMemSpyAppUi::SetViewServerTimeOutStatus( TBool aEnabled ) |
|
489 { |
|
490 /* TODO |
|
491 iMemSpySession.SetServerTimeOutStatus( KMemSpyEikSrvSID, aEnabled ); |
|
492 */ |
|
493 /* |
|
494 TRAP_IGNORE( |
|
495 iEngine.HelperProcess().ImpersonateL( KMemSpyEikSrvSID ); |
|
496 // |
|
497 CVwsSessionWrapper* ses = CVwsSessionWrapper::NewLC(); |
|
498 ses->EnableServerEventTimeOut( aEnabled ); |
|
499 CleanupStack::PopAndDestroy( ses ); |
|
500 // |
|
501 iEngine.HelperProcess().ImpersonateL( 0 ); |
|
502 ); |
|
503 */ |
|
504 } |
|
505 |
|
506 |
|
507 void CMemSpyAppUi::OnCmdBackL() |
|
508 { |
|
509 const TMemSpyViewType viewType = iAppContainer->ActiveViewType(); |
|
510 // |
|
511 if ( !MemSpyViewTypeUtils::IsExitableView( viewType ) ) |
|
512 { |
|
513 // Should go back one view |
|
514 iAppContainer->NavigateToParentViewL(); |
|
515 } |
|
516 } |
|
517 |
|
518 |
|
519 void CMemSpyAppUi::OnCmdExitL() |
|
520 { |
|
521 Exit(); |
|
522 } |
|
523 |
|
524 |
|
525 void CMemSpyAppUi::OnCmdOpenL() |
|
526 { |
|
527 const TMemSpyViewType viewType = iAppContainer->ActiveViewType(); |
|
528 // |
|
529 if ( MemSpyViewTypeUtils::IsOpenableItem( viewType ) ) |
|
530 { |
|
531 // Should go back one view |
|
532 iAppContainer->NavigateToChildViewL(); |
|
533 } |
|
534 } |
|
535 |
|
536 |
|
537 void CMemSpyAppUi::OnCmdPhoneInformationOperationL( TDeviceWideOperation aOperation ) |
|
538 { |
|
539 // |
|
540 //CMemSpyDeviceWideOperationDialog::ExecuteLD( iMemSpySession, aOperation ); |
|
541 CMemSpyDwoTracker* tracker = CMemSpyDeviceWideOperationDialog::CreateDeviceWideOperation( iMemSpySession, aOperation ); |
|
542 tracker->Start(); |
|
543 /* |
|
544 #ifdef _DEBUG |
|
545 RDebug::Printf( "[MemSpy] CMemSpyAppUi::OnCmdPhoneInformationOperationL() - START - aOp: %d, iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", aOp, iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() ); |
|
546 #endif |
|
547 |
|
548 if ( !iRunningDeviceWideOperation ) |
|
549 { |
|
550 CMemSpyDeviceWideOperationDialog::ExecuteLD( iMemSpySession, *this, aOp ); |
|
551 } |
|
552 |
|
553 #ifdef _DEBUG |
|
554 RDebug::Printf( "[MemSpy] CMemSpyAppUi::OnCmdPhoneInformationOperationL() - END - aOp: %d, iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", aOp, iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() ); |
|
555 #endif |
|
556 */ |
|
557 } |
|
558 |
|
559 |
|
560 void CMemSpyAppUi::OnCmdPhoneInformationOperationKernelContainersL() |
|
561 { |
|
562 /* TODO |
|
563 iMemSpySession.OutputKernelObjects(); |
|
564 */ |
|
565 /* |
|
566 CMemSpyEngineGenericKernelObjectContainer* list = iEngine.HelperKernelContainers().ObjectsAllL(); |
|
567 CleanupStack::PushL( list ); |
|
568 iEngine.HelperKernelContainers().OutputL( *list ); |
|
569 CleanupStack::PopAndDestroy( list ); |
|
570 */ |
|
571 } |
|
572 |
|
573 |
|
574 |
|
575 |
|
576 |
|
577 |
|
578 |
|
579 |
|
580 |
|
581 |
|
582 |
|
583 |
|
584 |
|
585 |
|
586 |
|
587 |
|
588 |
|
589 |
|
590 |
|
591 |
|
592 |
|
593 |
|
594 void CMemSpyAppUi::OnCmdAutoCaptureToggleL() |
|
595 { |
|
596 #ifdef _DEBUG |
|
597 RDebug::Printf( "[MemSpy] CMemSpyAppUi::OnCmdAutoCaptureToggleL() - START - iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() ); |
|
598 #endif |
|
599 |
|
600 if ( iAutoCaptureTimer->IsActive() ) |
|
601 { |
|
602 iAutoCaptureTimer->Cancel(); |
|
603 } |
|
604 else |
|
605 { |
|
606 iAutoCaptureTimer->Cancel(); |
|
607 // |
|
608 const TTimeIntervalMicroSeconds32 interval( iAutoCaptureTimerPeriod * 1000000 ); |
|
609 iAutoCaptureTimer->Start( 0, interval, TCallBack(AutoCaptureCallBack, this) ); |
|
610 } |
|
611 |
|
612 #ifdef _DEBUG |
|
613 RDebug::Printf( "[MemSpy] CMemSpyAppUi::OnCmdAutoCaptureToggleL() - START - iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() ); |
|
614 #endif |
|
615 } |
|
616 |
|
617 |
|
618 void CMemSpyAppUi::OnCmdAutoCaptureRetryTimeL() |
|
619 { |
|
620 CAknNumberQueryDialog* dialog = new(ELeave) CAknNumberQueryDialog( iAutoCaptureTimerPeriod ); |
|
621 dialog->ExecuteLD( R_MEMSPY_DEVICE_WIDE_SETTINGS ); |
|
622 } |
|
623 |
|
624 |
|
625 void CMemSpyAppUi::OnCmdAutoCaptureOperationTypeL() |
|
626 { |
|
627 CDesCArrayFlat* items = iCoeEnv->ReadDesC16ArrayResourceL( R_MEMSPY_AUTO_CAPTURE_OPERATION_TYPES ); |
|
628 CleanupStack::PushL(items); |
|
629 // |
|
630 TInt currentItem = iAutoCaptureOperationType; |
|
631 // |
|
632 CAknRadioButtonSettingPage* dialog = new(ELeave) CAknRadioButtonSettingPage( R_MEMSPY_AUTO_CAPTURE_OPERATION_TYPES_SETTINGS_PAGE, currentItem, items ); |
|
633 if ( dialog->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) ) |
|
634 { |
|
635 iAutoCaptureOperationType = static_cast< CMemSpyDeviceWideOperations::TOperation >( currentItem ); |
|
636 } |
|
637 // |
|
638 CleanupStack::PopAndDestroy( items ); |
|
639 } |
|
640 |
|
641 |
|
642 TInt CMemSpyAppUi::AutoCaptureCallBack( TAny* aSelf ) |
|
643 { |
|
644 CMemSpyAppUi* self = reinterpret_cast< CMemSpyAppUi* >( aSelf ); |
|
645 TRAPD( err, self->AutoCaptureCallBackL() ); |
|
646 // |
|
647 const TBool callMeBackAgain = ( err == KErrNone ); |
|
648 return callMeBackAgain; |
|
649 } |
|
650 |
|
651 |
|
652 void CMemSpyAppUi::AutoCaptureCallBackL() |
|
653 { |
|
654 #ifdef _DEBUG |
|
655 RDebug::Printf( "[MemSpy] CMemSpyAppUi::AutoCaptureCallBackL() - START - iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() ); |
|
656 #endif |
|
657 |
|
658 // OnCmdPhoneInformationOperationL( iAutoCaptureOperationType ); |
|
659 |
|
660 #ifdef _DEBUG |
|
661 RDebug::Printf( "[MemSpy] CMemSpyAppUi::AutoCaptureCallBackL() - END - iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() ); |
|
662 #endif |
|
663 } |
|
664 |
|
665 |
|
666 |
|
667 |
|
668 |
|
669 |
|
670 |
|
671 |
|
672 |
|
673 |
|
674 |
|
675 |
|
676 |
|
677 |
|
678 |
|
679 |
|
680 |
|
681 |
|
682 |
|
683 |
|
684 |
|
685 void CMemSpyAppUi::OnCmdOutputToDebugL() |
|
686 { |
|
687 iMemSpySession.SwitchOutputSinkL( ESinkTypeDebug ); //set in engine |
|
688 MemSpyDocument().Settings().SetSinkType( ESinkTypeDebug ); //set in settings |
|
689 } |
|
690 |
|
691 |
|
692 void CMemSpyAppUi::OnCmdOutputToFileL() |
|
693 { |
|
694 iMemSpySession.SwitchOutputSinkL( ESinkTypeFile ); //set in engine |
|
695 MemSpyDocument().Settings().SetSinkType( ESinkTypeFile ); //set in settings |
|
696 } |
|
697 |
|
698 |
|
699 |
|
700 |
|
701 |
|
702 |
|
703 |
|
704 |
|
705 |
|
706 |
|
707 |
|
708 void CMemSpyAppUi::OnCmdAboutL() |
|
709 { |
|
710 CAknMessageQueryDialog* dialog = new(ELeave) CAknMessageQueryDialog; |
|
711 dialog->ExecuteLD( R_MEMSPYUI_ABOUT_DIALOG ); |
|
712 } |
|
713 |
|
714 |
|
715 |
|
716 |
|
717 |
|
718 |
|
719 |
|
720 |
|
721 |
|
722 |
|
723 |
|
724 |
|
725 void CMemSpyAppUi::OnCmdToolsBitmapsSaveToMemoryCardL() |
|
726 { |
|
727 /* TODO |
|
728 // Get bitmap handles |
|
729 RArray<TInt> handles; |
|
730 CleanupClosePushL( handles ); |
|
731 iEngine.HelperFbServ().GetArrayOfBitmapHandlesL( handles ); |
|
732 |
|
733 // Build bitmap list |
|
734 CMemSpyEngineFbServBitmapArray* array = CMemSpyEngineFbServBitmapArray::NewL( handles ); |
|
735 CleanupStack::PopAndDestroy( &handles ); |
|
736 CleanupStack::PushL( array ); |
|
737 |
|
738 // Export... |
|
739 CMemSpyExportBitmapsToMemoryCardDialog* dialog = CMemSpyExportBitmapsToMemoryCardDialog::NewL( iCoeEnv->FsSession(), *array ); |
|
740 |
|
741 // All done |
|
742 CleanupStack::PopAndDestroy( array ); |
|
743 */ |
|
744 } |
|
745 |
|
746 |
|
747 void CMemSpyAppUi::OnCmdToolsSendToBackgroundL() |
|
748 { |
|
749 TApaTask task( iCoeEnv->WsSession() ); |
|
750 task.SendToBackground(); |
|
751 } |
|
752 |
|
753 |
|
754 void CMemSpyAppUi::OnCmdToolsBringToForegroundL() |
|
755 { |
|
756 iCoeEnv->BringOwnerToFront(); |
|
757 } |
|
758 |
|
759 |
|
760 |
|
761 |