⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pgpdiskdeletehook.cpp

📁 PGP8.0源码 请认真阅读您的文件包然后写出其具体功能
💻 CPP
字号:
/*____________________________________________________________________________
		Copyright (C) 2002 PGP Corporation
        All rights reserved.

        $Id: PGPdiskDeleteHook.cpp,v 1.10 2002/08/06 20:09:24 dallen Exp $
____________________________________________________________________________*/

#include "pgpClassesConfig.h"

#include "CButton.h"
#include "CDialog.h"
#include "CIcon.h"
#include "CPath.h"
#include "CStatic.h"
#include "CWindow.h"

#include "pgpDiskUI.h"
#include "CPGPclPrefs.h"
#include "CPGPdiskEngine.h"
#include "UCommonStrings.h"

#include "SClaimedCommand.h"
#include "Resource.h"

_USING_PGP

// Class CDeleteWarnDialog

class CDeleteWarnDialog : public CDialog
{
public:
	CDeleteWarnDialog::CDeleteWarnDialog() { }
	CDeleteWarnDialog::~CDeleteWarnDialog() { }

	PGPUInt16	GetDialogId() const
	{
		return IDD_WARNDEL_DLG;
	}

	void	Display(const char *fileName, HWND parentWnd, 
		PGPBoolean& noShowValue, PGPBoolean& choseYes);

private:
	CButton	mNoButton;
	CButton	mNoShowCheck;
	CButton	mYesButton;
	CIcon	mIcon;
	CStatic	mIconStatic;
	CStatic	mMessageStatic;

	CPath		mFileName;
	PGPBoolean	mNoShowValue;
	PGPBoolean	mChoseYes;

	BOOL	OnCommand(PGPUInt16 notifyCode, PGPUInt16 itemId, HWND ctrl);
	BOOL	OnInitDialog(HWND focusCtrl);
};


// Class CDeleteWarnDialog member functions

void 
CDeleteWarnDialog::Display(
	const char	*fileName, 
	HWND		parentWnd, 
	PGPBoolean&	noShowValue, 
	PGPBoolean&	choseYes)
{
	pgpAssert(IsWindow(parentWnd));

	mFileName = fileName;

	CreateModal(parentWnd);

	noShowValue = mNoShowValue;
	choseYes = mChoseYes;
}

BOOL 
CDeleteWarnDialog::OnCommand(
	PGPUInt16	notifyCode, 
	PGPUInt16	itemId, 
	HWND		ctrl)
{
	switch (itemId)
	{
	case IDYES:
		mNoShowValue = (mNoShowCheck.GetCheck() == BST_CHECKED);
		mChoseYes = TRUE;

		CDialog::OnOk();
		return TRUE;

	case IDNO:
		mNoShowValue = (mNoShowCheck.GetCheck() == BST_CHECKED);
		mChoseYes = FALSE;

		CDialog::OnOk();
		return TRUE;
	}

	return CDialog::OnCommand(notifyCode, itemId, ctrl);
}

BOOL 
CDeleteWarnDialog::OnInitDialog(HWND focusCtrl)
{
	CDialog::OnInitDialog(focusCtrl);

	mNoButton.Subclass(GetDlgItem(IDNO));
	mNoShowCheck.Subclass(GetDlgItem(IDC_NOSHOW_CHECK));
	mYesButton.Subclass(GetDlgItem(IDYES));
	mIconStatic.Subclass(GetDlgItem(IDC_ICON_STATIC));
	mMessageStatic.Subclass(GetDlgItem(IDC_MESSAGE));

	mIcon.Load(NULL, MAKEINTRESOURCE(OIC_WARNING), TRUE);
	mIconStatic.SetIcon(mIcon);

	mNoButton.SetFocus();

	CString	message;
	
	message.Format(UCommonStrings::Get(
		UCommonStrings::kWarnDelDialogMessage), mFileName);
	mMessageStatic.SetWindowText(message);

	Center();
	SetForegroundWindow();

	return FALSE;
}
/*
// PGPdisk delete hook functions

PGPError 
PGPdiskUIExport 
PGPdiskUIDiskDeleteHook(
	PGPdiskContextRef	context, 
	const char			*path, 
	void				*parentWnd, 
	PGPBoolean			*pProceedWithDelete)
{
	PGPError	error	= kPGPError_NoErr;

	try
	{
		// Need valid parentWnd window.
		HWND	hwndParent	= static_cast<HWND>(parentWnd);

		if (IsNull(hwndParent))
			hwndParent = CWindow::GetDesktopWindow();

		// Check uniqueness of current command.
		SClaimedCommand	command(CCommandClaimer::kInvokeDeleteHook);

		CPGPdiskContext	diskContext(context);
		CPGPclPrefs		prefs(diskContext.PGPclPrefs());

		if (prefs.GetBoolean(kPGPPrefDiskWarnOnDeletion))
		{
			CPath	cpath(path);
			CPath	fileName;

			cpath.GetFileNamePart(fileName);
			
			CDeleteWarnDialog	deleteWarnDlg;
			PGPBoolean			noShow;

			deleteWarnDlg.Display(fileName, hwndParent, noShow, 
				*pProceedWithDelete);

			prefs.SetBoolean(kPGPPrefDiskWarnOnDeletion, !noShow);
		}
	}
	catch (CComboError& caughtErr)
	{
		error = caughtErr.pgpErr;
	}

	return error;
}
*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -