appsview.cpp

来自「演示如何使用的symbian v9服务器应用框架」· C++ 代码 · 共 79 行

CPP
79
字号
// Copyright (c) 2006 Murray Read, All rights reserved

#include "AppsView.h"
#include <SvexInfo.h>
#include "ServiceExplorerApp.hrh"
#include <ServiceExplorerApp.rsg>
#include "AppServiceList.h"
#include "SvexService.hrh"
#include <SvexUtil.h>


CAppsView* CAppsView::NewLC(const CSvexInfo& aInfo)
	{
	CAppsView* self = new(ELeave) CAppsView(aInfo);
	CleanupStack::PushL(self);
	self->ConstructMainPaneL();
	return self;
	}

CAppsView::CAppsView(const CSvexInfo& aInfo)
: iInfo(aInfo)
	{
	}

CAppsView::~CAppsView()
	{
	// remove the sub-view if it exists.
	delete iSubView;
	}

CEikTextListBox* CAppsView::NewListBoxL() const
	{
	return new (ELeave) CAknSingleStyleListBox();
	}

TInt CAppsView::Count() const
	{
	return iInfo.AppUids().Count();
	}

void CAppsView::GetText(TInt aIndex, TBuf<KMaxListText>& aText) const
	{
	TUid uid = iInfo.AppUids()[aIndex];
	const CSvexAppInfo& app = iInfo.AppInfo(uid);
	const TApaAppCaption& caption = app.AppCaption();
	_LIT(KFormat, "\t%S\t\t");
	aText.Format(KFormat, &caption);
	}

void CAppsView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
	{
	CSvexListView::DynInitMenuPaneL(aResourceId, aMenuPane);
	if (aResourceId == R_SERVICEEXPLORERAPP_MENU)
        aMenuPane->SetItemDimmed(KSvexCmdIdOpen, Count() == 0);
	}

void CAppsView::OpenL()
	{
	// An app has been selected. Get the app UID...
	TInt index = iListBox->CurrentItemIndex();
	TInt count = iInfo.AppUids().Count();
	if (index < 0 || count <= index)
		return;
	
	TUid uid = iInfo.AppUids()[index];

	// Then launch the sub-view.
	delete iSubView;
	iSubView = 0;
	iSubView = new(ELeave) CAppServiceListDialog(iInfo, uid);
	iSubView->ConstructL(R_SERVICEEXPLORERAPP_APPSERVICE_MENUBAR);
	iSubView->ExecuteLD(R_SERVICEEXPLORERAPP_APPSERVICE_DIALOG);
	iSubView = 0;

	_LIT(KTitle, "Apps");
	SetTitlePaneL(KTitle);
	}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?