void CDlgCreateFlvDownloads::OnOK() 
{
	if (FALSE == CCreateDownloadDlg::_CheckFolderName (this, IDC_OUTFOLDER))
		return;
	GetDlgItemText (IDC_OUTFOLDER, m_strDstFolder);

	fsPathToGoodPath ((LPTSTR)(LPCTSTR)m_strDstFolder);
	if (m_strDstFolder.GetLength () == 0)
	{
		MessageBox (LS (L_ENTERFLRNAME), LS (L_INPERR), MB_ICONEXCLAMATION);
		GetDlgItem (IDC_OUTFOLDER)->SetFocus ();
		return;
	}
	_LastFlashVideoDstFolders.AddRecord (m_strDstFolder);

	if (m_strDstFolder [m_strDstFolder.GetLength () - 1] != '\\' && 
			m_strDstFolder [m_strDstFolder.GetLength () - 1] != '/')
		m_strDstFolder += '\\';

	m_bUseAutoConvert = IsDlgButtonChecked (IDC_USE_AUTO_CONVERT) == BST_CHECKED;
	
	CDialog::OnOK();
}
Esempio n. 2
0
void CGroupDlg::OnOK() 
{
	CString strName, strFolder, strExts;
	GetDlgItemText (IDC_GRPNAME, strName);
	GetDlgItemText (IDC_GRPFOLDER, strFolder);
	GetDlgItemText (IDC_GRPEXTS, strExts);
	if (strName.GetLength () == 0)
	{
		MessageBox (LS (L_ENTERGRPNAME), LS (L_INPERR), MB_ICONEXCLAMATION);
		GetDlgItem (IDC_GRPNAME)->SetFocus ();
		return;
	}

	if (-1 != strName.FindOneOf ("/\\"))
	{
		MessageBox (LS (L_INVALIDGROUPNAME), LS (L_INPERR), MB_ICONEXCLAMATION);
		GetDlgItem (IDC_GRPNAME)->SetFocus ();
		return;
	}

	if (FALSE == CCreateDownloadDlg::_CheckFolderName (this, IDC_GRPFOLDER))
		return;

	if (strFolder.GetLength () == 0)
	{
		MessageBox (LS (L_ENTERFLRNAME), LS (L_INPERR), MB_ICONEXCLAMATION);
		GetDlgItem (IDC_GRPFOLDER)->SetFocus ();
		return;
	}

	bool bNewGroup = m_pGroup == NULL;

	if (bNewGroup)
	{
		m_pGroup.CreateInstance ();
		m_pParentGroup = m_wndGroups.GetSelectedGroup ();
		_DldsGrps.Add (m_pGroup, m_pParentGroup);
	}

	m_pGroup->strName = strName;
	m_pGroup->strOutFolder = strFolder;
	m_pGroup->strExts = strExts;

	if (m_pGroup->strOutFolder [m_pGroup->strOutFolder.GetLength () - 1] != '\\' &&
			m_pGroup->strOutFolder [m_pGroup->strOutFolder.GetLength () - 1] != '/')
	{
		m_pGroup->strOutFolder += '\\';
	}

	fsPathToGoodPath (m_pGroup->strOutFolder);

	_LastFolders.AddRecord (m_pGroup->strOutFolder);

	if (bNewGroup)
		_pwndDownloads->OnNewGroupCreated (m_pGroup);
	else
		_pwndDownloads->OnGroupNameChanged (m_pGroup);

	_DldsGrps.SaveToDisk ();
	
	CDialog::OnOK();
}
Esempio n. 3
0
void CSpiderAddPageDlg::OnOK() 
{
	

	fsWPDSettings *wpds = m_wpd->GetWDPS ();

	GetDlgItemText (IDC_URL, m_strUrl);

	if (FALSE == WriteAuthorization ())
		return;

	BOOL bAddSlash;
	if (FALSE == IsOkUrl (m_strUrl, m_wpd->GetWDPS ()->strHTMLExts, &bAddSlash))
	{
		WrongURL ();
		return;
	}

	if (bAddSlash)
		m_strUrl += '/';

	CString strOutFolder;

	GetDlgItemText (IDC_OUTFOLDER, strOutFolder);

	if (FALSE == CCreateDownloadDlg::_CheckFolderName (this, IDC_OUTFOLDER))
		return;

	fsPathToGoodPath ((LPSTR)(LPCSTR)strOutFolder);

	if (strOutFolder.GetLength () == 0)
	{
		MessageBox (LS (L_ENTERFLRNAME), LS (L_INPERR), MB_ICONEXCLAMATION);
		GetDlgItem (IDC_OUTFOLDER)->SetFocus ();
		return;
	}

	_LastFolders.AddRecord (strOutFolder);
	_LastUrlFiles.AddRecord (m_strUrl);

	if (strOutFolder [strOutFolder.GetLength () - 1] != '\\' && 
		strOutFolder [strOutFolder.GetLength () - 1] != '/')
		strOutFolder += '\\';

        if (_App.NewGrp_SelectWay () == NGSW_USE_ALWAYS_SAME_GROUP_WITH_OUTFOLDER_AUTO_UPDATE)
	{
		vmsDownloadsGroupSmartPtr pGrp = _DldsGrps.FindGroup (_App.NewDL_GroupId ());
		if (pGrp != NULL)
			pGrp->strOutFolder = strOutFolder;
	}  

	wpds->pDLGroup = m_wndGroups.GetSelectedGroup ();

	wpds->strFolderSaveTo = strOutFolder;

	wpds->iDepth = GetDlgItemInt (IDC_DEPTH);

	wpds->dwFlags = 0;

	if (IsDlgButtonChecked (IDC_KEEP) == BST_CHECKED)
		wpds->dwFlags |= WPDF_KEEPFOLDERSTRUCTURE;

	if (IsDlgButtonChecked (IDC_DONTSTOREPAGES) == BST_CHECKED)
	{
		wpds->bDownloadStyles = FALSE;
		wpds->dwFlags |= WPDF_DONTSTOREPAGES;
	}

	if (IsDlgButtonChecked (IDC_DELCOMPLETED) == BST_CHECKED)
		wpds->dwFlags |= WPDF_DELCOMPLETEDDLDS;

	_App.Spider_Flags (wpds->dwFlags);

	m_wndGroups.RememberSelectedGroup ();
	_App.Last_Autostart (m_iAutostart);  

	if (wpds->strUserName.GetLength () != 0)
	{
		fsURL url;
		url.Crack (m_strUrl);
		fsSiteInfo* site = CCreateDownloadDlg::_SavePassword (url.GetHostName (), 
			fsSchemeToNP (url.GetInternetScheme ()), wpds->strUserName, wpds->strPassword);
		if (site) 
		{
			site->pGroup = wpds->pDLGroup;
			_SitesMgr.SiteUpdated (site);
		}
	}

	_App.OnDlHasBeenCreatedByUser ();
	
	CDialog::OnOK();
}
void CCreateDownloadFromTorrentFileDlg::OnOK() 
{
	vmsBtDownloadManager *pMgr = m_dld->pMgr->GetBtDownloadMgr ();

	if (IsDlgButtonChecked (IDC_USELOGIN) == BST_CHECKED)
	{
		CString strUser, strPwd;
		GetDlgItemText (IDC_USER, strUser);
		GetDlgItemText (IDC_PASSWORD, strPwd);
		pMgr->set_TrackerLogin (strUser, strPwd);		
	}

	CString strOutFolder;
	GetDlgItemText (IDC_OUTFOLDER, strOutFolder);
	fsPathToGoodPath ((LPTSTR)(LPCTSTR)strOutFolder);

	if (FALSE == CCreateDownloadDlg::_CheckFolderName (this, IDC_OUTFOLDER))
		return;

	if (strOutFolder.GetLength () == 0)
	{
		MessageBox (LS (L_ENTERFLRNAME), LS (L_INPERR), MB_ICONEXCLAMATION);
		GetDlgItem (IDC_OUTFOLDER)->SetFocus ();
		return;
	}

	_LastFolders.AddRecord (strOutFolder);

	if (strOutFolder [strOutFolder.GetLength () - 1] != '\\' && 
			strOutFolder [strOutFolder.GetLength () - 1] != '/')
		strOutFolder += '\\';

    if (_App.NewGrp_SelectWay () == NGSW_USE_ALWAYS_SAME_GROUP_WITH_OUTFOLDER_AUTO_UPDATE)
	{
		vmsDownloadsGroupSmartPtr pGrp = _DldsGrps.FindGroup (_App.NewDL_GroupId ());
		if (pGrp != NULL) {
			pGrp->strOutFolder = strOutFolder;
			pGrp->setDirty();
			
			
			
		}
	}

	pMgr->setOutputPath (strOutFolder);

	m_dld->pGroup = m_wndGroups.GetSelectedGroup ();
	
	GetDlgItemText (IDC_COMMENT, m_dld->strComment);
	
	m_bScheduled = IsDlgButtonChecked (IDC_STARTSCHEDULE) == BST_CHECKED;
	m_dld->bAutoStart = IsDlgButtonChecked (IDC_STARTNOW) == BST_CHECKED;

	m_bPlaceToTop = IsDlgButtonChecked (IDC_PLACEATTOP) == BST_CHECKED;

	m_wndGroups.RememberSelectedGroup ();
	if (m_dld->bAutoStart)
		_App.Last_Autostart (0);
	else
		_App.Last_Autostart (m_bScheduled ? 2 : 1);

	CDialog::OnOK();
}
Esempio n. 5
0
void CCreateBatchDownload::OnOK() 
{
	if (FALSE == ReadAuth ())
		return;

	if (FALSE == BuildBatchList ())
		return;

	CString strSaveAs;
	if (IsDlgButtonChecked (IDC_FILEAUTO) == BST_UNCHECKED)
	{
		GetDlgItemText (IDC_SAVEAS, strSaveAs);
	}

	if (strSaveAs != "")
	{
		CString strNumbers;
		GetDlgItemText (IDC_NUMBERS, strNumbers);

		m_blSaveAs.Create (strSaveAs, strNumbers, (char)('A' + m_iAlphaFrom), 
			(char)('A' + m_iAlphaTo));

		if (m_bl.get_ResultCount () != m_blSaveAs.get_ResultCount ())
		{
			MessageBox (LS (L_INVALID_SAVE_AS_TEMPLATE), LS (L_INPERR), MB_ICONERROR);
			GetDlgItem (IDC_SAVEAS)->SetFocus ();
			return;
		}

		if (strcspn (m_blSaveAs.get_Result (0), "\\/:*?\"<>|") != strlen (m_blSaveAs.get_Result (0)))
		{
			MessageBox (LS (L_INVFILENAME), LS (L_INPERR), MB_ICONEXCLAMATION);
			GetDlgItem (IDC_SAVEAS)->SetFocus ();
			return;
		}
	}
	else {
		m_blSaveAs.Clear ();
	}

	BOOL bUseZipPreview = _App.NewDL_UseZIPPreview ();

	if (bUseZipPreview)
		m_dld->pMgr->GetDownloadMgr ()->GetDP ()->dwFlags |= DPF_USEZIPPREVIEW;
	else
		m_dld->pMgr->GetDownloadMgr ()->GetDP ()->dwFlags &= ~DPF_USEZIPPREVIEW;

	CString strOutFolder;

	if (FALSE == CCreateDownloadDlg::_CheckFolderName (this, IDC_OUTFOLDER))
		return;

	GetDlgItemText (IDC_OUTFOLDER, strOutFolder);

	fsPathToGoodPath ((LPSTR)(LPCSTR)strOutFolder);

	if (strOutFolder.GetLength () == 0)
	{
		MessageBox (LS (L_ENTERFLRNAME), LS (L_INPERR), MB_ICONEXCLAMATION);
		GetDlgItem (IDC_OUTFOLDER)->SetFocus ();
		return;
	}

	_LastFolders.AddRecord (strOutFolder);
	_LastBatchUrls.AddRecord (m_strUrl);

	if (strOutFolder [strOutFolder.GetLength () - 1] != '\\' && 
		strOutFolder [strOutFolder.GetLength () - 1] != '/')
		strOutFolder += '\\';

        if (_App.NewGrp_SelectWay () == NGSW_USE_ALWAYS_SAME_GROUP_WITH_OUTFOLDER_AUTO_UPDATE)
	{
		vmsDownloadsGroupSmartPtr pGrp = _DldsGrps.FindGroup (_App.NewDL_GroupId ());
		if (pGrp != NULL) {
			pGrp->strOutFolder = strOutFolder;
			pGrp->setDirty();
			
			
			
		}
	}

	fsnew (m_dld->pMgr->GetDownloadMgr ()->GetDP ()->pszFileName, CHAR, strOutFolder.GetLength () + 1);
	strcpy (m_dld->pMgr->GetDownloadMgr ()->GetDP ()->pszFileName, strOutFolder);

	m_dld->pGroup = m_wndGroups.GetSelectedGroup ();

	m_wndGroups.RememberSelectedGroup ();
	
	_App.Last_Autostart (m_iAutostart);

	GenerateAndAddDownloads ();	

	
	_App.CreateBD_LastAtoZ (MAKELPARAM (m_wndA.GetCurSel (), m_wndZ.GetCurSel ()));
	CString str;
	GetDlgItemText (IDC_NUMBERS, str);
	_App.CreateBD_LastNumbers (str);
	_App.CreateBD_SaveAs_Template (strSaveAs);

	if (m_dld->pMgr->GetDownloadMgr ()->GetDNP ()->pszUserName && *m_dld->pMgr->GetDownloadMgr ()->GetDNP ()->pszUserName)
	{
		fsURL url;
		url.Crack (m_strUrl);
		LPCSTR pszServer = url.GetHostName ();
		if (strstr (pszServer, "(*)") == NULL &&
			strstr (pszServer, "(*a)") == NULL &&
			strstr (pszServer, "(*A)") == NULL)
		{
			CCreateDownloadDlg::_SavePassword (pszServer, fsSchemeToNP (url.GetInternetScheme ()),
				m_dld->pMgr->GetDownloadMgr ()->GetDNP ()->pszUserName, m_dld->pMgr->GetDownloadMgr ()->GetDNP ()->pszPassword);
		}
	}

	_App.OnDlHasBeenCreatedByUser ();

	CDialog::OnOK();
}
void CCreateTPDownloadDlg::OnOk()
{
	if (IR_SUCCESS != Crack(m_strUrl))
		return WrongURL ();

	GetDlgItemText (IDC_SAVEAS, m_strFileName);

	int nDldType = m_wndDldType.GetCurSel ();

	if (nDldType == 1)	
	{
		char sz [MY_MAX_PATH];
		GetTempPath (sizeof (sz), sz);
		m_strOutFolder = sz;
	}
	else
	{
		if (FALSE == _CheckFolderName (this, IDC_OUTFOLDER))
			return;
		GetDlgItemText (IDC_OUTFOLDER, m_strOutFolder);
	
		if (IsDlgButtonChecked (IDC_FILEAUTO) == BST_UNCHECKED)
		{
			if (m_strFileName == "")
			{
				MessageBox (LS (L_EMPTY), LS (L_INPERR), MB_ICONEXCLAMATION);
				GetDlgItem (IDC_SAVEAS)->SetFocus ();
				return;
			}
			if (FALSE == _CheckFileName (this, IDC_SAVEAS))
				return;
			_App.NewDL_GenerateNameAutomatically (FALSE);
		}
		else
			_App.NewDL_GenerateNameAutomatically (TRUE);
	}

	fsPathToGoodPath ((LPSTR)(LPCSTR)m_strOutFolder);
	fsPathToGoodPath ((LPSTR)(LPCSTR)m_strFileName);

	if (m_strOutFolder.GetLength () == 0)
	{
		MessageBox (LS (L_ENTERFLRNAME), LS (L_INPERR), MB_ICONEXCLAMATION);
		GetDlgItem (IDC_OUTFOLDER)->SetFocus ();
		return;
	}

	if (nDldType != 1)
		_LastFolders.AddRecord (m_strOutFolder);
	_LastUrlFiles.AddRecord (m_strUrl);

	if (m_strOutFolder [m_strOutFolder.GetLength () - 1] != '\\' && 
		m_strOutFolder [m_strOutFolder.GetLength () - 1] != '/')
		m_strOutFolder += '\\';

	if (_App.NewGrp_SelectWay () == NGSW_USE_ALWAYS_SAME_GROUP_WITH_OUTFOLDER_AUTO_UPDATE)
	{
		vmsDownloadsGroupSmartPtr pGrp = _DldsGrps.FindGroup (_App.NewDL_GroupId ());
		if (pGrp != NULL) {
			pGrp->strOutFolder = m_strOutFolder;
			pGrp->setDirty();
		}
	}
	
	if (_App.CheckIfDownloadWithSameUrlExists ())
	{
		int ret = _CheckDownloadAlrExists (m_dld);
		if (ret)
		{
			if (ret == 1)
				EndDialog (ID_DLNOTADDED);
			return;
		}
	}

	m_dld->pGroup = m_wndGroups.GetSelectedGroup ();

	GetDlgItemText (IDC_COMMENT, m_dld->strComment);

	BOOL bUseZipPreview = _App.NewDL_UseZIPPreview ();
	_App.UseZipPreview (bUseZipPreview);

	if (nDldType == 1)
	{
		m_dld->dwFlags |= DLD_DELETEWHENDONE | DLD_DELETEFILEATRESTART;
	}
	else if (nDldType == 2)
		m_dld->dwFlags |= DPF_STARTWHENDONE;

	m_wndGroups.RememberSelectedGroup ();

	m_nStreamingSpeed = GetDlgItemInt (IDC_STRSPEED);

	if (m_bThread)
	{
		m_bNeedExit = TRUE;
		while (m_bThread);
	}

	_App.OnDlHasBeenCreatedByUser ();

	m_bPlaceAtTop = IsDlgButtonChecked (IDC_PLACEATTOP) == BST_CHECKED;

	CDialog::OnOK();
}