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

📄 cpgpdiskchooserimpwin32.cpp

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

        $Id: CPGPdiskChooserImpWin32.cpp,v 1.12 2002/08/06 20:09:23 dallen Exp $
____________________________________________________________________________*/

#include "pgpClassesConfig.h"

#include "COpenFileDialog.h"
#include "CPath.h"
#include "CWindow.h"

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

#include "CPGPdiskChooserImpWin32.h"
#include "SClaimedCommand.h"
#include "PGPdiskUIPriv.h"

_USING_PGP

// Class CPGPdiskChooserImpWin32 member functions

void 
CPGPdiskChooserImpWin32::AskChoose(
	const CPGPdiskContext&	context, 
	CString&				path, 
	const char				*defaultPath, 
	const char				*title, 
	void					*parentWnd)
{
	// Need valid parent window.
	HWND	hwndParent	= static_cast<HWND>(parentWnd);

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

	SClaimedCommand	command(CCommandClaimer::kChooseDisk);

	// Need a decent title.
	CString	cTitle;

	if (IsntNull(title))
		cTitle = title;

	if (cTitle.IsEmpty())
		cTitle = UCommonStrings::Get(UCommonStrings::kChoosePGPdiskDlgTitle);

	// Make sure directory part is valid.
	CPath	cDefaultPath;
	
	if (IsntNull(defaultPath))
		cDefaultPath = defaultPath;

	CPath	dir;
	cDefaultPath.GetDirPart(dir);

	CPath	fileName;
	cDefaultPath.GetFileNamePart(fileName);

	CPGPclPrefs	prefs(context.PGPclPrefs());

	// If default path not specified, look in PGP prefs.
	if (dir.IsEmpty())
		prefs.GetString(kPGPPrefDiskLastOpenDir, dir);

	if (!dir.IsValidDirectory())
	{
		PGPclGetPath(kPGPclDefaultOpenFolder, 
			dir.GetBuffer(kPGPdiskMaxPathLength), kPGPdiskMaxPathLength);
		dir.ReleaseBuffer();
	}

	// Recombine.
	cDefaultPath = dir;
	cDefaultPath.EndInSlash();

	cDefaultPath += fileName;

	// Show the dialog.
	COpenFileDialog	openDialog;
	CPath			cPath(path);

	openDialog.Choose(hwndParent, cPath, cDefaultPath, cTitle, 
		PGPdiskUIPriv::kDiskFileFilter, kPGPdiskFileExtension);
	path = cPath;

	// Remember directory used.
	cPath.GetDirPart(dir);

	prefs.Open();	// refresh prefref
	prefs.SetString(kPGPPrefDiskLastOpenDir, dir);
}

⌨️ 快捷键说明

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