|
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 #include "ResourceHandler.h" |
|
18 |
|
19 void CResourceAppUi::ConstructL() |
|
20 { |
|
21 BaseConstructL(); |
|
22 iListBoxView = CResourceView::NewL(ClientRect(), this); |
|
23 //construct a default view |
|
24 HandleCommandL(EResourceMenu1Item0); |
|
25 } |
|
26 |
|
27 CResourceAppUi::~CResourceAppUi() |
|
28 { |
|
29 delete iListBoxView; |
|
30 } |
|
31 |
|
32 void CResourceAppUi::HandleCommandL(TInt aCommand) |
|
33 { |
|
34 // Increase this threads priority for a proper snapshot |
|
35 RThread thisThread; |
|
36 thisThread.SetPriority(EPriorityAbsoluteHigh); |
|
37 thisThread.Close(); |
|
38 |
|
39 TObjectsViewed aObjectViewed = EObjectNone; |
|
40 |
|
41 switch (aCommand) |
|
42 { |
|
43 |
|
44 // Menu 1 |
|
45 |
|
46 case EResourceMenu1Item0: |
|
47 aObjectViewed = EObjectProcess; |
|
48 break; |
|
49 |
|
50 case EResourceMenu1Item1: |
|
51 aObjectViewed = EObjectThread; |
|
52 break; |
|
53 |
|
54 case EResourceMenu1Item2: |
|
55 aObjectViewed = EObjectChunk; |
|
56 break; |
|
57 |
|
58 case EResourceMenu1Item3: |
|
59 aObjectViewed = EObjectLibrary; |
|
60 break; |
|
61 |
|
62 case EResourceMenu1Item4: |
|
63 aObjectViewed = EObjectServer; |
|
64 break; |
|
65 |
|
66 case EResourceMenu1Item5: |
|
67 aObjectViewed = EObjectSemaphore; |
|
68 break; |
|
69 |
|
70 case EResourceMenu1Item6: |
|
71 aObjectViewed = EObjectMutex; |
|
72 break; |
|
73 |
|
74 case EResourceMenu1Item7: |
|
75 aObjectViewed = EObjectLogicalDevice; |
|
76 break; |
|
77 |
|
78 case EResourceMenu1Item8: |
|
79 aObjectViewed = EObjectPhysicalDevice; |
|
80 break; |
|
81 |
|
82 case EResourceMenu1Item9: |
|
83 aObjectViewed = EObjectLogicalChannel; |
|
84 break; |
|
85 |
|
86 // Menu 2 |
|
87 |
|
88 case EResourceMenu2Item0: |
|
89 aObjectViewed = EObjectWindow; |
|
90 break; |
|
91 |
|
92 case EResourceMenu2Item1: |
|
93 aObjectViewed = EObjectDrive; |
|
94 break; |
|
95 |
|
96 case EResourceMenu2Item2: |
|
97 aObjectViewed = EObjectHal; |
|
98 break; |
|
99 |
|
100 // Menu 3 |
|
101 case EResourceMenu3Item0: |
|
102 SetDebug(); |
|
103 break; |
|
104 case EResourceMenu3Item1: |
|
105 SetThread(); |
|
106 break; |
|
107 case EResourceMenu3Item2: |
|
108 SetProcess(); |
|
109 break; |
|
110 case EResourceMenu3Item3: |
|
111 SetRam(); |
|
112 break; |
|
113 case EResourceMenu3Item4: |
|
114 SetDrive(); |
|
115 break; |
|
116 case EEikCmdExit: // necessary for uninstalling |
|
117 Exit(); |
|
118 break; |
|
119 default: |
|
120 break; |
|
121 } |
|
122 |
|
123 // Set view data |
|
124 if (aObjectViewed != EObjectNone) |
|
125 { |
|
126 iListBoxView->SetCurrentObjects(aObjectViewed); |
|
127 iListBoxView->UpdateView(); |
|
128 } |
|
129 |
|
130 // ResetPriority |
|
131 RThread thisThread2; |
|
132 thisThread2.SetPriority(EPriorityNormal); |
|
133 thisThread2.Close(); |
|
134 |
|
135 } |
|
136 |
|
137 void CResourceAppUi::SetProcess() |
|
138 { |
|
139 CProcessNumberDialog* dialog = new(ELeave) CProcessNumberDialog(); |
|
140 |
|
141 dialog->ExecuteLD(R_PROCESS_NUMBER_DIALOG); |
|
142 |
|
143 } |
|
144 |
|
145 void CResourceAppUi::SetThread() |
|
146 { |
|
147 CThreadNumberDialog* dialog = new(ELeave) CThreadNumberDialog(); |
|
148 |
|
149 dialog->ExecuteLD(R_THREAD_DIALOG); |
|
150 |
|
151 } |
|
152 |
|
153 void CResourceAppUi::SetDebug() |
|
154 { |
|
155 CDebugDialog* dialog = new(ELeave) CDebugDialog(); |
|
156 |
|
157 dialog->ExecuteLD(R_DEBUG_DIALOG); |
|
158 |
|
159 } |
|
160 |
|
161 void CResourceAppUi::SetRam() |
|
162 { |
|
163 CRamDialog* dialog = new(ELeave) CRamDialog(); |
|
164 |
|
165 dialog->ExecuteLD(R_RAM_DIALOG); |
|
166 |
|
167 } |
|
168 |
|
169 void CResourceAppUi::SetDrive() |
|
170 { |
|
171 CDriveDialog* dialog = new(ELeave) CDriveDialog(); |
|
172 |
|
173 dialog->ExecuteLD(R_DRIVE_DIALOG); |
|
174 |
|
175 } |
|
176 |
|
177 void CResourceAppUi::AppendDesc(TDes& root, TDes& add) |
|
178 { |
|
179 add.Trim(); |
|
180 root.Append(add); |
|
181 root.Append(_L(", ")); |
|
182 } |
|
183 |
|
184 |