Exemplo n.º 1
0
bool ContentNode::hasItemNodes()
{
	int nContentNodes = getNContentNodes();
	for (int n=0; n<nContentNodes; n++) {
		ContentNode *cnode = getContentNode(n);
		if (cnode->isItemNode() == true)
			return true;
	}
	return false;
}
void UpdateItemList(int dirNum)
{
	ListView_DeleteAllItems(ghItemListWindow);

	MediaServer *mserver = gMediaGate->getMediaServer();
	Directory *dir = mserver->getContentDirectory(dirNum);
	if (dir == NULL)
		return;

	LVITEM item = {0};
	item.mask = 0;
	item.mask = LVIF_TEXT;
    TCHAR buf[512] = { 0 } ;
	int itemCnt = dir->getNContentNodes();
	for (int n=0 ; n<itemCnt ; n++) {
		ContentNode *conNode = dir->getContentNode(n);
		if (conNode->isItemNode() == false)
			continue;
		
		ItemNode *itemNode = (ItemNode *)conNode;

        FTL::CFConversion conv;
		item.pszText = (LPTSTR)conv.MBCS_TO_TCHAR(itemNode->getTitle());
		item.iItem = n;
		item.iSubItem = 0;
		ListView_InsertItem(ghItemListWindow , &item);

		item.pszText = (LPTSTR)conv.MBCS_TO_TCHAR(itemNode->getCreator());
		item.iSubItem = 1;
		ListView_SetItem(ghItemListWindow , &item);

		item.pszText = (LPTSTR)conv.MBCS_TO_TCHAR(itemNode->getDate());
		item.iSubItem = 2;
		ListView_SetItem(ghItemListWindow , &item);

		_stprintf(buf, TEXT("%ld"), itemNode->getStorageUsed());
		item.pszText = buf;
		item.iSubItem = 3;
		ListView_SetItem(ghItemListWindow , &item);
	}
}