00001 // 00002 // WizardFinishedPage.cpp 00003 // 00004 // Copyright (c) Shareaza Development Team, 2002-2005. 00005 // This file is part of SHAREAZA (www.shareaza.com) 00006 // 00007 // Shareaza is free software; you can redistribute it 00008 // and/or modify it under the terms of the GNU General Public License 00009 // as published by the Free Software Foundation; either version 2 of 00010 // the License, or (at your option) any later version. 00011 // 00012 // Shareaza is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License 00018 // along with Shareaza; if not, write to the Free Software 00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 // 00021 00022 #include "StdAfx.h" 00023 #include "Shareaza.h" 00024 #include "Settings.h" 00025 #include "WizardSheet.h" 00026 #include "WizardFinishedPage.h" 00027 #include "Network.h" 00028 #include "Skin.h" 00029 #include "HostCache.h" 00030 #include "DlgDonkeyServers.h" 00031 00032 #ifdef _DEBUG 00033 #define new DEBUG_NEW 00034 #undef THIS_FILE 00035 static char THIS_FILE[] = __FILE__; 00036 #endif 00037 00038 IMPLEMENT_DYNCREATE(CWizardFinishedPage, CWizardPage) 00039 00040 BEGIN_MESSAGE_MAP(CWizardFinishedPage, CWizardPage) 00041 //{{AFX_MSG_MAP(CWizardFinishedPage) 00042 //}}AFX_MSG_MAP 00043 END_MESSAGE_MAP() 00044 00045 00047 // CWizardFinishedPage property page 00048 00049 CWizardFinishedPage::CWizardFinishedPage() : CWizardPage(CWizardFinishedPage::IDD) 00050 { 00051 //{{AFX_DATA_INIT(CWizardFinishedPage) 00052 m_bAutoConnect = FALSE; 00053 m_bConnect = FALSE; 00054 m_bStartup = FALSE; 00055 //}}AFX_DATA_INIT 00056 } 00057 00058 CWizardFinishedPage::~CWizardFinishedPage() 00059 { 00060 } 00061 00062 void CWizardFinishedPage::DoDataExchange(CDataExchange* pDX) 00063 { 00064 CPropertyPage::DoDataExchange(pDX); 00065 //{{AFX_DATA_MAP(CWizardFinishedPage) 00066 DDX_Check(pDX, IDC_WIZARD_AUTO, m_bAutoConnect); 00067 DDX_Check(pDX, IDC_WIZARD_CONNECT, m_bConnect); 00068 DDX_Check(pDX, IDC_WIZARD_STARTUP, m_bStartup); 00069 //}}AFX_DATA_MAP 00070 } 00071 00073 // CWizardFinishedPage message handlers 00074 00075 BOOL CWizardFinishedPage::OnInitDialog() 00076 { 00077 CPropertyPage::OnInitDialog(); 00078 00079 Skin.Apply( _T("CWizardFinishedPage"), this ); 00080 00081 m_bConnect = TRUE; 00082 m_bAutoConnect = TRUE; 00083 m_bStartup = TRUE; 00084 00085 UpdateData( FALSE ); 00086 00087 return TRUE; 00088 } 00089 00090 BOOL CWizardFinishedPage::OnSetActive() 00091 { 00092 SetWizardButtons( PSWIZB_BACK | PSWIZB_FINISH ); 00093 return CWizardPage::OnSetActive(); 00094 } 00095 00096 BOOL CWizardFinishedPage::OnWizardFinish() 00097 { 00098 UpdateData(); 00099 00100 Settings.Connection.AutoConnect = m_bAutoConnect; 00101 00102 if ( Settings.eDonkey.EnableToday ) 00103 { 00104 if ( HostCache.eDonkey.m_nHosts < 3 ) 00105 { 00106 CDonkeyServersDlg dlg; 00107 dlg.DoModal(); 00108 } 00109 } 00110 00111 if ( m_bConnect ) Network.Connect( TRUE ); 00112 Settings.SetStartup( m_bStartup ); 00113 00114 return CWizardPage::OnWizardFinish(); 00115 }