📄 sharingpropsdlg.cpp
字号:
//////////////////////////////////////////////////////////////////////
// FileFury
// Copyright (c) 2000 Tenebril Incorporated
// All rights reserved.
//
// This source code is governed by the Tenebril open source
// license (http://www.tenebril.com/developers/opensource/license.html)
//
// For more information on this and other open source applications,
// visit the Tenebril OpenSource page:
// http://www.tenebril.com/developers/opensource
//
//////////////////////////////////////////////////////////////////////
// SharingPropsDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Oscar.h"
#include "SharingPropsDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSharingPropsDlg dialog
CSharingPropsDlg::CSharingPropsDlg(CWnd* pParent, LPCTSTR czDir)
: CDialog(CSharingPropsDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CSharingPropsDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_cszDirectory = czDir;
m_bHasSetProps = FALSE;
}
void CSharingPropsDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSharingPropsDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSharingPropsDlg, CDialog)
//{{AFX_MSG_MAP(CSharingPropsDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSharingPropsDlg message handlers
BOOL CSharingPropsDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Get the security filter.
COscarApp *pApp = (COscarApp *)AfxGetApp();
ASSERT(pApp);
m_pSecFilter = pApp->GetArchive()->m_pSecurityFilter;
ASSERT(m_pSecFilter);
// Find out whether this directory is shared.
m_bShared = m_pSecFilter->IsShared(m_cszDirectory);
// Update the radio buttons accordingly.
if(m_bShared)
CheckRadioButton( IDC_PRIVATE, IDC_SHARED, IDC_SHARED );
else
CheckRadioButton( IDC_PRIVATE, IDC_SHARED, IDC_PRIVATE );
// Check to see whether this directory can be shared.
m_bCanShare = m_pSecFilter->CanShare(m_cszDirectory);
// Check to see whether this directory is directly shared.
m_bDirectlyShared = m_pSecFilter->IsDirectlyShared(m_cszDirectory);
// Update the radio buttons and comment accordingly.
m_bCanChangeProps = (m_bCanShare && !(m_bShared && !m_bDirectlyShared));
if(!m_bCanChangeProps)
{
if(!m_bCanShare)
{
ASSERT(!m_bShared);
// Just in case...
CheckRadioButton( IDC_PRIVATE, IDC_SHARED, IDC_PRIVATE );
}
// Disable the radio buttons.
CWnd *pWnd = GetDlgItem(IDC_PRIVATE);
ASSERT(pWnd);
pWnd->EnableWindow(FALSE);
pWnd = GetDlgItem(IDC_SHARED);
ASSERT(pWnd);
pWnd->EnableWindow(FALSE);
if(!m_bCanShare)
{
SetDlgItemText(IDC_COMMENTS,
_T("This directory cannot be shared. System and root directories "
"are not shareable for security reasons."));
}
else
{
SetDlgItemText(IDC_COMMENTS,
_T("An ancestor directory of this one is shared; you must change "
"its properties directly."));
}
}
// Set the directory name.
SetDlgItemText(IDC_DIRECTORY, m_cszDirectory);
// Set the icon.
CStatic *pGuider;
CRect crGuider;
pGuider = (CStatic *)GetDlgItem(IDC_LOGOGUIDER);
pGuider->GetWindowRect(&crGuider);
ScreenToClient(&crGuider);
m_cLogoBox.Create(WS_VISIBLE | WS_CHILD | WS_DISABLED,
crGuider, this, IDC_LOGOBOX, IDB_FOLDER,
CSize(52, 40), RGB(191, 191, 191));
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CSharingPropsDlg::OnOK()
{
if(IsDlgButtonChecked(IDC_SHARED))
m_bFutureShare = TRUE;
else
m_bFutureShare = FALSE;
m_bHasSetProps = TRUE;
CDialog::OnOK();
}
BOOL CSharingPropsDlg::FutureSharing(BOOL &bShare)
{
bShare = m_bFutureShare;
return (m_bCanChangeProps && m_bHasSetProps);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -