2007-03-27 17:47:10 +00:00
|
|
|
/*
|
|
|
|
* CiderPress
|
|
|
|
* Copyright (C) 2007 by faddenSoft, LLC. All Rights Reserved.
|
|
|
|
* See the file LICENSE for distribution terms.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Implementation of CreateSubdirDialog.
|
|
|
|
*
|
|
|
|
* Gets the name from the user, validates it against the supplied
|
|
|
|
* GenericArchive, and returns.
|
|
|
|
*/
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "CreateSubdirDialog.h"
|
|
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CreateSubdirDialog, CDialog)
|
2014-11-04 00:26:53 +00:00
|
|
|
ON_WM_HELPINFO()
|
2007-03-27 17:47:10 +00:00
|
|
|
END_MESSAGE_MAP()
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
BOOL CreateSubdirDialog::OnInitDialog(void)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
/* do the DoDataExchange stuff */
|
|
|
|
CDialog::OnInitDialog();
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
/* select the default text and set the focus */
|
|
|
|
CEdit* pEdit = (CEdit*) GetDlgItem(IDC_CREATESUBDIR_NEW);
|
2014-11-18 05:13:13 +00:00
|
|
|
ASSERT(pEdit != NULL);
|
2014-11-04 00:26:53 +00:00
|
|
|
pEdit->SetSel(0, -1);
|
|
|
|
pEdit->SetFocus();
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
return FALSE; // we set the focus
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-21 21:18:20 +00:00
|
|
|
void CreateSubdirDialog::DoDataExchange(CDataExchange* pDX)
|
2007-03-27 17:47:10 +00:00
|
|
|
{
|
2014-11-04 00:26:53 +00:00
|
|
|
CString msg, failed;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-12-16 19:04:31 +00:00
|
|
|
CheckedLoadString(&failed, IDS_MB_APP_NAME);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
/* put fNewName last so it gets the focus after failure */
|
|
|
|
DDX_Text(pDX, IDC_CREATESUBDIR_BASE, fBasePath);
|
|
|
|
DDX_Text(pDX, IDC_CREATESUBDIR_NEW, fNewName);
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
/* validate the path field */
|
|
|
|
if (pDX->m_bSaveAndValidate) {
|
|
|
|
if (fNewName.IsEmpty()) {
|
2014-12-16 19:04:31 +00:00
|
|
|
msg = L"You must specify a new name.";
|
2014-11-04 00:26:53 +00:00
|
|
|
goto fail;
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
msg = fpArchive->TestPathName(fpParentEntry, fBasePath, fNewName,
|
|
|
|
'\0');
|
|
|
|
if (!msg.IsEmpty())
|
|
|
|
goto fail;
|
|
|
|
}
|
2007-03-27 17:47:10 +00:00
|
|
|
|
2014-11-04 00:26:53 +00:00
|
|
|
return;
|
2007-03-27 17:47:10 +00:00
|
|
|
|
|
|
|
fail:
|
2014-11-04 00:26:53 +00:00
|
|
|
ASSERT(!msg.IsEmpty());
|
|
|
|
MessageBox(msg, failed, MB_OK);
|
|
|
|
pDX->Fail();
|
|
|
|
return;
|
2007-03-27 17:47:10 +00:00
|
|
|
}
|