📄 createchannelpage4.cpp
字号:
// CreateChannelPage4.cpp : implementation file
//
#include "stdafx.h"
#include "BeeReader.h"
#include "CreateChannelPage4.h"
#include "CreateChannelSheet.h"
#include "Clipboard.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCreateChannelPage4 property page
IMPLEMENT_DYNCREATE(CCreateChannelPage4, CPropertyPage)
CCreateChannelPage4::CCreateChannelPage4() : CPropertyPage(CCreateChannelPage4::IDD)
{
//{{AFX_DATA_INIT(CCreateChannelPage4)
m_szURI = _T("");
//}}AFX_DATA_INIT
}
CCreateChannelPage4::~CCreateChannelPage4()
{
}
void CCreateChannelPage4::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCreateChannelPage4)
DDX_Control(pDX, IDC_STATIC_STATUS, m_Status);
DDX_Control(pDX, IDC_EDIT_RSSPATH, m_URI);
DDX_Text(pDX, IDC_EDIT_RSSPATH, m_szURI);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCreateChannelPage4, CPropertyPage)
//{{AFX_MSG_MAP(CCreateChannelPage4)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCreateChannelPage4 message handlers
void CCreateChannelPage4::OnButton1()
{
// TODO: Add your control notification handler code here
char szFilters[] = "OPML格式文件 (*.opml)|*.opml|所有文件 (*.*)|*.*||";
CFileDialog fileDlg (TRUE, "opml", "*.opml",
OFN_FILEMUSTEXIST, szFilters, this);
if( fileDlg.DoModal() == IDOK )
{
m_szURI = _T("file:///")+fileDlg.GetPathName();
UpdateData(FALSE);
}
}
BOOL CCreateChannelPage4::OnInitDialog()
{
CPropertyPage::OnInitDialog();
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CCreateChannelPage4::OnSetActive()
{
// TODO: Add your specialized code here and/or call the base class
CCreateChannelSheet* pSheet = (CCreateChannelSheet*)GetParent();
pSheet->SetWizardButtons( PSWIZB_BACK | PSWIZB_NEXT );
m_Status.ShowWindow(SW_HIDE);
CString szText;
if( CClipboard::GetText( szText ) )
{
if( szText.GetLength() > 6 )
{
CString szLeft = szText.Left(5);
BOOL bOK = FALSE;
if( szLeft.CompareNoCase("http:")==0 )
{
bOK = TRUE;
}
else
{
szLeft = szText.Left(6);
if( szLeft.CompareNoCase("https:")==0 || szLeft.CompareNoCase("files:")==0 )
bOK = TRUE;
}
if( bOK )
{
m_szURI = szText;
UpdateData(FALSE);
}
}
}
return CPropertyPage::OnSetActive();
}
LRESULT CCreateChannelPage4::OnWizardNext()
{
// TODO: Add your specialized code here and/or call the base class
UpdateData(TRUE);
m_szURI.TrimLeft();
m_szURI.TrimRight();
if( m_szURI.IsEmpty() )
{
MessageBox(_T("产生错误的原因可能是未提供有效OPML文件路径"),_T("错误提示"),MB_ICONERROR|MB_OK);
m_URI.SetSel(0,-1,TRUE);
m_URI.SetFocus();
return -1;
}
else
{
CCreateChannelSheet* pSheet = (CCreateChannelSheet*)GetParent();
pSheet->szOPMLURI = m_szURI ;
pSheet->iError = 0;
m_Status.ShowWindow(SW_SHOW);
m_Status.UpdateWindow();
CWaitCursor wait;
pSheet->iError = pSheet->opml.ReadOPML(m_szURI);
if( pSheet->iError < -1 )
{
MessageBox(_T("获取或解析OPML文件出错,请重新提供OPML文件全路径。"), _T("错误提示"),MB_ICONERROR|MB_OK);
m_URI.SetSel(0,-1,TRUE);
m_URI.SetFocus();
m_Status.ShowWindow(SW_HIDE);
m_Status.UpdateWindow();
wait.Restore();
return -1;
}
wait.Restore();
}
return CPropertyPage::OnWizardNext();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -