BOOL CCreateTPDownloadDlg::_SetDownloadOutputFolderAsDefault(CWnd *pwndParent, LPCSTR pszFolder, vmsDownloadsGroupSmartPtr pGroup)
{
	CMyMessageBox dlg (pwndParent);
	dlg.m_hIcon = LoadIcon (NULL, IDI_QUESTION);
	dlg.m_strBtn1Text = LS (L_YES);
	dlg.m_strBtn2Text = LS (L_NO);
	dlg.m_strCheckBoxText = LS (L_SETASDEFFORALLGROUPS);

	dlg.m_strText.Format (LS (L_OKTOSETFOLDERASDEFFORGRP), pGroup->strName);

	dlg.m_strTitle = LS (L_CONFIRMATION);

	dlg.m_bChecked = FALSE != _App.View_SetOutputFolderAsDefForAllGrpsChecked ();

	if (IDC_BTN1 != _DlgMgr.DoModal (&dlg))
		return FALSE;

	_App.View_SetOutputFolderAsDefForAllGrpsChecked (dlg.m_bChecked);

	CString strFolder;
	if (pszFolder [lstrlen (pszFolder) - 1] != '\\' &&
			pszFolder [lstrlen (pszFolder) - 1] != '/')
	{
		strFolder = pszFolder;
		strFolder += '\\';
		pszFolder = strFolder;
	}

	if (dlg.m_bChecked)
	{
		for (size_t i = 0; i < _DldsGrps.GetTotalCount (); i++) {
			_DldsGrps.GetGroup (i)->strOutFolder = pszFolder;
			_DldsGrps.GetGroup (i)->setDirty();
		}
	}
	else
	{
		pGroup->strOutFolder = pszFolder;
		pGroup->setDirty();
	}

	return TRUE;
}
PDLDS_GROUPS_TREE vmsDownloadsGroupsMgr::Add(vmsDownloadsGroupSmartPtr grp, PDLDS_GROUPS_TREE pParentGroup, BOOL bKeepIdAsIs, bool bDontQueryStoringGroupsInformation)
{
	if (pParentGroup == NULL)
		pParentGroup = GetGroupsTree ();

	if (bKeepIdAsIs == FALSE)
		grp->nId = m_nGrpNextId++;
	else
		m_nGrpNextId = max (m_nGrpNextId, grp->nId + 1);

	grp->cDownloads = 0;
	grp->bAboutToBeDeleted = false;

	PDLDS_GROUPS_TREE pGrp = pParentGroup->AddLeaf (grp);
	m_vGroups.push_back (pGrp);

	if (!bDontQueryStoringGroupsInformation) {

		vmsDownloadsGroupSmartPtr pParentPtr = pParentGroup->GetData();
		if ((vmsDownloadsGroup*)pParentPtr != 0) {
			pParentPtr->setDirty();
			pParentPtr->nChildren++;
			pParentPtr->getPersistObjectChildren ()->addPersistObject ((vmsDownloadsGroup*)grp);
		} else {
			getPersistObjectChildren ()->addPersistObject ((vmsDownloadsGroup*)grp);
			setDirty();
		}
		grp->setDirty();
		grp->nChildren = 0;
		

		
		
	}

	return pGrp;
}