ciderpress/app/ConfirmOverwriteDialog.h
Andy McFadden d8223dbcfd Relocate method comments
This moves method comments from the .cpp file to the .h file,
where users of the methods can find them.  This also makes it
possible for the IDE to show the comments when you mouse-hover over
the method name, though Visual Studio is a bit weak in this regard.

Also, added "override" keywords on overridden methods.  Reasonably
current versions of popular compilers seem to support this.

Also, don't have the return type on a separate line in the .cpp file.
The motivation for the practice -- quickly finding a method definition
with "^name" -- is less useful in C++ than C, and modern IDEs provide
more convenient ways to do the same thing.

Also, do some more conversion from unsigned types to uintXX_t.

This commit is primarily for the "app" directory.
2014-11-21 22:33:39 -08:00

96 lines
2.7 KiB
C++

/*
* CiderPress
* Copyright (C) 2007 by faddenSoft, LLC. All Rights Reserved.
* See the file LICENSE for distribution terms.
*/
/*
* Ask for confirmation before overwriting a file.
*/
#ifndef APP_CONFIRMOVERWRITEDIALOG_H
#define APP_CONFIRMOVERWRITEDIALOG_H
#include "resource.h"
/*
* Accept or reject overwriting an existing file or archive record.
*/
class ConfirmOverwriteDialog : public CDialog {
public:
ConfirmOverwriteDialog(CWnd* pParentWnd = NULL) :
CDialog(IDD_CONFIRM_OVERWRITE, pParentWnd)
{
fResultOverwrite = false;
fResultApplyToAll = false;
fResultRename = false;
fAllowRename = true;
fNewFileModWhen = -1;
fExistingFileModWhen = -1;
}
~ConfirmOverwriteDialog(void) {}
// name of file in archive (during extraction) or disk (for add)
CString fNewFileSource;
time_t fNewFileModWhen;
// full path of file being extracted onto (or record name for add)
CString fExistingFile;
time_t fExistingFileModWhen;
// result flags: yes/no/yes-all/no-all
bool fResultOverwrite;
bool fResultApplyToAll;
// if this flag is set, try again with updated "fExistingFile" value
bool fResultRename;
// set this to enable the "Rename" button
bool fAllowRename;
private:
virtual BOOL OnInitDialog(void) override;
afx_msg void OnYes(void);
afx_msg void OnYesToAll(void);
afx_msg void OnNo(void);
afx_msg void OnNoToAll(void);
afx_msg void OnRename(void);
// Handle a click on the question-mark button.
afx_msg BOOL OnHelpInfo(HELPINFO* lpHelpInfo);
DECLARE_MESSAGE_MAP()
};
/*
* Allow the user to rename a file being added or extracted, rather than
* overwriting an existing file. ConfirmOverwriteDialog creates one of these
* when the "rename" button is clicked on.
*
* The names of the fields here correspond directly to those in
* ConfirmOverwriteDialog.
*/
class RenameOverwriteDialog : public CDialog {
public:
RenameOverwriteDialog(CWnd* pParentWnd = NULL) :
CDialog(IDD_RENAME_OVERWRITE, pParentWnd)
{}
~RenameOverwriteDialog(void) {}
// name of file on source medium
CString fNewFileSource;
// converted name, which already exists in destination medium
CString fExistingFile;
// result: what the user has renamed it to
CString fNewName;
private:
virtual BOOL OnInitDialog(void) override;
virtual void DoDataExchange(CDataExchange* pDX) override;
afx_msg BOOL OnHelpInfo(HELPINFO* lpHelpInfo);
DECLARE_MESSAGE_MAP()
};
#endif /*APP_CONFIRMOVERWRITEDIALOG_H*/