コード例 #1
0
LRESULT FolderTree::OnUnChecked(HTREEITEM hItem, BOOL& /*bHandled*/)
{
	FolderTreeItemInfo* pItem = (FolderTreeItemInfo*) GetItemData(hItem);

	HTREEITEM hSharedParent = HasSharedParent(hItem);
	// if no parent is checked remove this root folder from share
	if(hSharedParent == NULL) {
		string path = Text::fromT(pItem->m_sFQPath);
		if( path[ path.length() -1 ] != PATH_SEPARATOR )
			path += PATH_SEPARATOR;

		sp->removeExcludeFolder(path);
		auto confirmOption = ShareDirectories::CONFIRM_ASK;
		sp->removeDir(path, sp->parent->getCurProfile(), confirmOption);
		UpdateParentItems(hItem);
	} else if(GetChecked(GetParentItem(hItem))) {
		// if the parent is checked add this folder to excludes
		string path = Text::fromT(pItem->m_sFQPath);
		if(	path[ path.length() -1 ] != PATH_SEPARATOR )
			path += PATH_SEPARATOR;
		sp->addExcludeFolder(path);
	}
	
	UpdateChildItems(hItem, false);

	return 0;
}
コード例 #2
0
LRESULT FolderTree::OnChecked(HTREEITEM hItem, BOOL &bHandled)
{
	FolderTreeItemInfo* pItem = (FolderTreeItemInfo*) GetItemData(hItem);
	if(!isPathValid(pItem->m_sFQPath))
	{
		// no checking myComp or network
		bHandled = TRUE;
		return 1;
	}
	
	HTREEITEM hSharedParent = HasSharedParent(hItem);
	// if a parent is checked then this folder should be removed from the ex list
	if(hSharedParent != NULL)
	{
		ShareParentButNotSiblings(hItem);
	}
	else
	{
        // if no parent folder is checked then this is a new root dir
		tstring path = pItem->m_sFQPath;
		if (!sp->addDirectory(path)) {
			bHandled = TRUE;
			return 1;
		}

		UpdateParentItems(hItem);
	}
	
	UpdateChildItems(hItem, true);
	
	return 0;
}
コード例 #3
0
void FolderTree::UpdateParentItems(HTREEITEM hItem)
{
	HTREEITEM hParent = GetParentItem(hItem);
	if(hParent != NULL && HasSharedParent(hParent) == NULL)
	{
		SetHasSharedChildren(hParent);
		UpdateParentItems(hParent);
	}
}
コード例 #4
0
void FolderTree::UpdateParentItems(HTREEITEM hItem)
{
	HTREEITEM hParent = GetParentItem(hItem);
	if(hParent != NULL && HasSharedParent(hParent) == NULL)
	{
		SetHasSharedChildren(hParent, sp->getViewItems(sp->curProfile));
		UpdateParentItems(hParent);
	}
}
コード例 #5
0
void CDirectoryTreeCtrl::CheckChanged(HTREEITEM hItem, bool bChecked)
{
	CString strDir = GetFullPath(hItem);
	if (bChecked)
		AddShare(strDir);
	else
		DelShare(strDir);

	UpdateParentItems(hItem);
	GetParent()->SendMessage(WM_COMMAND, USRMSG_ITEMSTATECHANGED, (long)m_hWnd);
}
コード例 #6
0
LRESULT FolderTree::OnChecked(HTREEITEM hItem, BOOL &bHandled)
{
	FolderTreeItemInfo* pItem = (FolderTreeItemInfo*) GetItemData(hItem);
	if(!Util::validatePath(Text::fromT(pItem->m_sFQPath)))
	{
		// no checking myComp or network
		bHandled = TRUE;
		return 1;
	}
	
	HTREEITEM hSharedParent = HasSharedParent(hItem);
	// if a parent is checked then this folder should be removed from the ex list
	if(hSharedParent != NULL)
	{
		ShareParentButNotSiblings(hItem);
	}
	else
	{
        // if no parent folder is checked then this is a new root dir
		LineDlg virt;
		virt.title = TSTRING(VIRTUAL_NAME);
		virt.description = TSTRING(VIRTUAL_NAME_LONG);

		tstring path = pItem->m_sFQPath;
		if( path[ path.length() -1 ] != '\\' )
			path += '\\';

		if (!sp->addDirectory(path))
			return 1;

		UpdateParentItems(hItem);
	}
	
	UpdateChildItems(hItem, true);
	
	return 0;
}