libraries/qr3/src/serverlistboxdata.cpp
changeset 0 7f656887cf89
equal deleted inserted replaced
-1:000000000000 0:7f656887cf89
       
     1 // serverlistboxdata.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/qr3dll.h>
       
    17 #include "QResources3.hrh"
       
    18 
       
    19 CServerListBoxData::CServerListBoxData(CKernListBoxModel* aModel)
       
    20 	: CKernListBoxData(aModel)
       
    21 	{
       
    22 	}
       
    23 
       
    24 void CServerListBoxData::DoFormatL(TObjectKernelInfo* aInfo, RBuf& name, RBuf& more, TInt& /*itemId*/)
       
    25 	{
       
    26 	TServerKernelInfo& info = *(TServerKernelInfo*)aInfo;
       
    27 	name.Copy(info.iFullName);
       
    28 	PrettyName(iType, name);
       
    29 
       
    30 	more.Format(_L("%d sessions"), info.iSessionQ.iCount);
       
    31 	}
       
    32 
       
    33 void CServerListBoxData::DumpToCloggerL(RClogger& clogger, TInt i, TInt /*count*/)
       
    34 	{
       
    35 	TServerKernelInfo& info = *(TServerKernelInfo*)iInfo;
       
    36 	_LIT8(KServerDesc,"Server;FullName;SessionCount;OwnerThreadId");
       
    37 	_LIT8(KServerFmt,"Server;%S;%i;%u");
       
    38 	
       
    39 	if (i == 0) clogger.Log(KServerDesc);
       
    40 	clogger.Log(KServerFmt, &info.iFullName, info.iSessionQ.iCount, info.iOwningThreadId);
       
    41 	}
       
    42 
       
    43 void CServerListBoxData::DoInfoForDialogL(RBuf& aTitle, RBuf& inf, TDes* aTemp)
       
    44 	{
       
    45 	TServerKernelInfo& info = *(TServerKernelInfo*)iInfo;
       
    46 	_LIT(KInfo, "Server info");
       
    47 	aTitle.Copy(KInfo);
       
    48 
       
    49 	inf.Copy(iInfo->iFullName);
       
    50 	inf.Append(Klflf);
       
    51 	
       
    52 	inf.AppendFormat(_L("Server thread: %u"), info.iOwningThreadId);
       
    53 	RThread owner;
       
    54 	TInt err = Model().MemAccess().RThreadForceOpen(owner, info.iOwningThreadId);
       
    55 	if (!err)
       
    56 		{
       
    57 		*aTemp = owner.FullName();
       
    58 		inf.AppendFormat(_L(" (%S)"), aTemp);
       
    59 		owner.Close();
       
    60 		}
       
    61 	inf.AppendFormat(_L("\n%d sessions"), info.iSessionQ.iCount);
       
    62 	}
       
    63 
       
    64 TBool CServerListBoxData::SupportsCommand(TInt /*aCommand*/)
       
    65 	{
       
    66 	return EFalse;
       
    67 	}