|
1 // wglistboxdata.cpp |
|
2 // |
|
3 // Copyright (c) 2010 Accenture. All rights reserved. |
|
4 // This component and the accompanying materials are made available |
|
5 // under the terms of the "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 // Accenture - Initial contribution |
|
11 // |
|
12 #include "KernLbxModel.h" |
|
13 #include "Utils.h" |
|
14 #include <fshell/clogger.h> |
|
15 #include <fshell/memoryaccess.h> |
|
16 #include <fshell/common.mmh> |
|
17 |
|
18 |
|
19 #ifdef FSHELL_APPARC_SUPPORT |
|
20 #include <apgcli.h> |
|
21 #include <APGWGNAM.H> |
|
22 #include <APMREC.H> |
|
23 #endif |
|
24 #ifndef FSHELL_WSERV_SUPPPORT |
|
25 #include <W32STD.H> |
|
26 #endif |
|
27 |
|
28 CWindowGroupListBoxData::CWindowGroupListBoxData(CKernListBoxModel* aModel) |
|
29 : CKernListBoxData(aModel) |
|
30 { |
|
31 } |
|
32 |
|
33 void CWindowGroupListBoxData::DoFormatL(TObjectKernelInfo* aInfo, RBuf& name, RBuf& more, TInt& /*itemId*/) |
|
34 { |
|
35 SWgInfo& info = *reinterpret_cast<SWgInfo*>(aInfo); |
|
36 CApaWindowGroupName* wgName = info.iName; |
|
37 name.Copy(wgName->Caption()); |
|
38 _LIT(KUnnamed, "<Untitled window group>"); |
|
39 if (name.Length() == 0) name.Copy(KUnnamed); |
|
40 |
|
41 TThreadId tid; |
|
42 TInt res = info.iSession->GetWindowGroupClientThreadId(info.iHandle, tid); |
|
43 if (res == KErrNone) |
|
44 { |
|
45 res = tid; |
|
46 } |
|
47 more.Format(_L("Busy=%i System=%i Tid=%i"), wgName->IsBusy(), wgName->IsSystem(), res); |
|
48 } |
|
49 |
|
50 void CWindowGroupListBoxData::DumpToCloggerL(RClogger& clogger, TInt i, TInt /*count*/) |
|
51 { |
|
52 _LIT(KWgDesc,"WindowGroup;RawName;OwnerThreadId;System;Busy;Hidden"); |
|
53 _LIT(KWgFmt,"WindowGroup;%S;%i;%i;%i;%i"); |
|
54 |
|
55 if (i == 0) clogger.Log(KWgDesc); |
|
56 SWgInfo& info = *reinterpret_cast<SWgInfo*>(iInfo); |
|
57 CApaWindowGroupName* wg = info.iName; |
|
58 TPtrC name = wg->WindowGroupName(); |
|
59 TBuf<256> temp = name; |
|
60 PrettyName(EListWindowGroups, temp); |
|
61 RBuf val; |
|
62 val.CreateL(256); |
|
63 TThreadId tid; |
|
64 TInt res = info.iSession->GetWindowGroupClientThreadId(info.iHandle, tid); |
|
65 if (res == KErrNone) |
|
66 { |
|
67 res = tid; |
|
68 } |
|
69 |
|
70 clogger.Log(KWgFmt, &temp, res, wg->IsSystem(), wg->IsBusy(), wg->Hidden()); |
|
71 val.Close(); |
|
72 } |
|
73 |
|
74 void CWindowGroupListBoxData::DoInfoForDialogL(RBuf& aTitle, RBuf& inf, TDes* name) |
|
75 { |
|
76 SWgInfo& info = *reinterpret_cast<SWgInfo*>(iInfo); |
|
77 _LIT(KInfo, "Window group info"); |
|
78 aTitle.Copy(KInfo); |
|
79 CApaWindowGroupName* wg = info.iName; |
|
80 *name = wg->WindowGroupName(); |
|
81 PrettyName(EListWindowGroups, *name); |
|
82 |
|
83 inf.Append(*name); |
|
84 TThreadId tid; |
|
85 TInt res = info.iSession->GetWindowGroupClientThreadId(info.iHandle, tid); |
|
86 inf.AppendFormat(_L("\n\nOwner thread: %i"), res == KErrNone ? (TInt)tid : res); |
|
87 RThread thread; |
|
88 if (res == KErrNone) |
|
89 { |
|
90 res = thread.Open(tid); |
|
91 } |
|
92 if (res == KErrNone) |
|
93 { |
|
94 *name = thread.FullName(); |
|
95 PrettyName(EListThread, *name); |
|
96 inf.AppendFormat(_L(" (%S)"), name); |
|
97 } |
|
98 inf.AppendFormat(_L("\nBusy=%i System=%i Hidden=%i"), wg->IsBusy(), wg->IsSystem(), wg->Hidden()); |
|
99 } |
|
100 |
|
101 CWindowGroupListBoxData::~CWindowGroupListBoxData() |
|
102 { |
|
103 if (iInfo) |
|
104 { |
|
105 delete reinterpret_cast<SWgInfo*>(iInfo)->iName; |
|
106 } |
|
107 } |