Better error message when extracting files

The file extraction dialog allows you to select file parts, so you
can choose to exclude resource forks or just extract disk images.  If
you don't choose any parts, nothing will extract, and you get a
confusingly generic message about nothing matching the criteria.

This adds a specific error message for the case where no parts are
selected.
This commit is contained in:
Andy McFadden 2014-12-17 13:31:50 -08:00
parent 3ab2e95867
commit 7b70767a1f
4 changed files with 21 additions and 7 deletions

View File

@ -64,7 +64,7 @@ void ChooseAddTargetDialog::DoDataExchange(CDataExchange* pDX)
HTREEITEM selected;
selected = pTree->GetSelectedItem();
if (selected == NULL) {
errMsg = "Please select a disk or subdirectory to add files to.";
errMsg = L"Please select a disk or subdirectory to add files to.";
MessageBox(errMsg, appName, MB_OK);
pDX->Fail();
return;
@ -73,7 +73,7 @@ void ChooseAddTargetDialog::DoDataExchange(CDataExchange* pDX)
DiskFSTree::TargetData* pTargetData;
pTargetData = (DiskFSTree::TargetData*) pTree->GetItemData(selected);
if (!pTargetData->selectable) {
errMsg = "You can't add files there.";
errMsg = L"You can't add files there.";
MessageBox(errMsg, appName, MB_OK);
pDX->Fail();
return;

View File

@ -2110,6 +2110,7 @@ BEGIN
IDS_VALID_VOLNAME_HFS "Valid HFS volume names are 1-27 characters long, and may not contain a colon (:)."
IDS_VALID_FILENAME_HFS "Valid HFS filenames are 1-31 characters long, and do not contain colons (':')."
IDS_PASTE_SPECIAL_COUNT "%d files in clipboard"
IDS_NO_FORKS_SPECIFIED "You must select at least one item in ""Parts to extract""."
END
STRINGTABLE

View File

@ -45,6 +45,7 @@ BOOL ExtractOptionsDialog::OnInitDialog(void)
selStr.Format((LPCWSTR) countFmt, fSelectedCount);
pWnd->SetWindowText(selStr);
// disable "extract selection" when nothing is selected
if (fSelectedCount == 0)
pWnd->EnableWindow(FALSE);
}
@ -65,10 +66,8 @@ BOOL ExtractOptionsDialog::OnInitDialog(void)
void ExtractOptionsDialog::DoDataExchange(CDataExchange* pDX)
{
/*
* Should probably verify that fFilesToExtract is not set to kExtractSelection
* when fSelectedCount is zero.
*/
CDialog::DoDataExchange(pDX);
DDX_Text(pDX, IDC_EXT_PATH, fExtractPath);
DDX_Radio(pDX, IDC_EXT_SELECTED, fFilesToExtract);
@ -88,6 +87,19 @@ void ExtractOptionsDialog::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_EXT_CONVHIGHASCII, fConvHighASCII);
DDX_Check(pDX, IDC_EXT_OVERWRITE_EXIST, fOverwriteExisting);
if (pDX->m_bSaveAndValidate) {
if (!fIncludeDataForks && !fIncludeRsrcForks && !fIncludeDiskImages) {
CString appName, errMsg;
CheckedLoadString(&appName, IDS_MB_APP_NAME);
CheckedLoadString(&errMsg, IDS_NO_FORKS_SPECIFIED);
MessageBox(errMsg, appName, MB_OK);
pDX->Fail();
return;
}
}
}
void ExtractOptionsDialog::OnConfigPreserve(void)

View File

@ -1,5 +1,5 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Microsoft Visual C++ generated include file.
// Used by CiderPress.rc
//
#define IDR_MAINFRAME 102
@ -498,6 +498,7 @@
#define IDS_VALID_VOLNAME_HFS 2152
#define IDS_VALID_FILENAME_HFS 2153
#define IDS_PASTE_SPECIAL_COUNT 2154
#define IDS_NO_FORKS_SPECIFIED 2155
#define IDM_FILE_NEW_ARCHIVE 40001
#define IDM_FILE_OPEN 40002
#define IDM_FILE_CLOSE 40003