00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "StdAfx.h"
00023 #include "Shareaza.h"
00024 #include "Settings.h"
00025 #include "DlgDonkeyImport.h"
00026
00027 #ifdef _DEBUG
00028 #define new DEBUG_NEW
00029 #undef THIS_FILE
00030 static char THIS_FILE[] = __FILE__;
00031 #endif
00032
00033 BEGIN_MESSAGE_MAP(CDonkeyImportDlg, CSkinDialog)
00034
00035 ON_BN_CLICKED(IDC_IMPORT, OnImport)
00036 ON_WM_TIMER()
00037 ON_BN_CLICKED(IDC_CLOSE, OnClose)
00038
00039 END_MESSAGE_MAP()
00040
00041
00043
00044
00045 CDonkeyImportDlg::CDonkeyImportDlg(CWnd* pParent )
00046 : CSkinDialog(CDonkeyImportDlg::IDD, pParent)
00047 {
00048
00049
00050 }
00051
00052 void CDonkeyImportDlg::DoDataExchange(CDataExchange* pDX)
00053 {
00054 CSkinDialog::DoDataExchange(pDX);
00055
00056 DDX_Control(pDX, IDC_CLOSE, m_wndClose);
00057 DDX_Control(pDX, IDCANCEL, m_wndCancel);
00058 DDX_Control(pDX, IDC_IMPORT, m_wndImport);
00059 DDX_Control(pDX, IDC_LOG, m_wndLog);
00060
00061 }
00062
00064
00065
00066 BOOL CDonkeyImportDlg::OnInitDialog()
00067 {
00068 CSkinDialog::OnInitDialog();
00069
00070 SkinMe( _T("CDonkeyImportDlg"), IDR_MAINFRAME );
00071
00072 CString str;
00073 m_wndCancel.GetWindowText( str );
00074 int nPos = str.Find( '|' );
00075 if ( nPos > 0 )
00076 {
00077 m_sCancel = str.Mid( nPos + 1 );
00078 m_wndCancel.SetWindowText( str.Left( nPos ) );
00079 }
00080
00081 return TRUE;
00082 }
00083
00084 void CDonkeyImportDlg::OnImport()
00085 {
00086 m_wndImport.EnableWindow( FALSE );
00087 m_wndCancel.SetWindowText( m_sCancel );
00088 m_pImporter.Start( &m_wndLog );
00089 SetTimer( 1, 1000, NULL );
00090 }
00091
00092 void CDonkeyImportDlg::OnCancel()
00093 {
00094 m_pImporter.Stop();
00095 CSkinDialog::OnCancel();
00096 }
00097
00098 void CDonkeyImportDlg::OnTimer(UINT nIDEvent)
00099 {
00100 if ( ! m_pImporter.IsRunning() )
00101 {
00102 KillTimer( 1 );
00103 m_wndCancel.EnableWindow( FALSE );
00104 m_wndClose.ModifyStyle( 0, BS_DEFPUSHBUTTON );
00105 m_wndClose.ShowWindow( SW_SHOW );
00106 m_wndClose.SetFocus();
00107 }
00108 }
00109
00110 void CDonkeyImportDlg::OnClose()
00111 {
00112 EndDialog( IDOK );
00113 }