Back to index

lightning-sunbird  0.9+nobinonly
UrlDialog.cpp
Go to the documentation of this file.
00001 // UrlDialog.cpp : implementation file
00002 //
00003 
00004 #include "stdafx.h"
00005 #include "Testembed.h"
00006 #include "UrlDialog.h"
00007 #include "QaUtils.h"
00008 
00009 #ifdef _DEBUG
00010 #define new DEBUG_NEW
00011 #undef THIS_FILE
00012 static char THIS_FILE[] = __FILE__;
00013 #endif
00014 
00016 // CUrlDialog dialog
00017 
00018 
00019 CUrlDialog::CUrlDialog(CWnd* pParent /*=NULL*/)
00020        : CDialog(CUrlDialog::IDD, pParent)
00021 {
00022        //{{AFX_DATA_INIT(CUrlDialog)
00023        m_urlfield = _T("");
00024        m_flagvalue = 0;
00025        m_flagIndex = -1;
00026        m_chkValue = FALSE;
00027        //}}AFX_DATA_INIT
00028 }
00029 
00030 
00031 void CUrlDialog::DoDataExchange(CDataExchange* pDX)
00032 {
00033        CDialog::DoDataExchange(pDX);
00034        //{{AFX_DATA_MAP(CUrlDialog)
00035        DDX_Control(pDX, IDC_CHKURLFLAG, m_chkFlags);
00036        DDX_Control(pDX, IDC_COMBO1, m_urlflags);
00037        DDX_Text(pDX, IDC_URLFIELD, m_urlfield);
00038        DDX_CBIndex(pDX, IDC_COMBO1, m_flagIndex);
00039        DDX_Check(pDX, IDC_CHKURLFLAG, m_chkValue);
00040        DDX_Control(pDX, IDC_COMBO2, m_protocol);
00041        //}}AFX_DATA_MAP
00042 }
00043 
00044 
00045 BEGIN_MESSAGE_MAP(CUrlDialog, CDialog)
00046        //{{AFX_MSG_MAP(CUrlDialog)
00047        ON_EN_CHANGE(IDC_URLFIELD, OnChangeUrlfield)
00048        ON_BN_CLICKED(IDC_CHKURLFLAG, OnChkurlflag)
00049        ON_EN_CHANGE(IDC_COMBO1, OnChangeUrlfield)
00050        ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
00051        ON_CBN_SELCHANGE(IDC_COMBO2, OnSelchangeCombo2)
00052        //}}AFX_MSG_MAP
00053 END_MESSAGE_MAP()
00054 
00056 // CUrlDialog message handlers
00057 
00058 void CUrlDialog::OnChangeUrlfield() 
00059 {
00060        // TODO: If this is a RICHEDIT control, the control will not
00061        // send this notification unless you override the CDialog::OnInitDialog()
00062        // function and call CRichEditCtrl().SetEventMask()
00063        // with the ENM_CHANGE flag ORed into the mask.
00064        
00065        // TODO: Add your control notification handler code here
00066 
00067 }
00068 
00069 void CUrlDialog::OnChkurlflag() 
00070 {
00071        m_chkValue = ! m_chkValue ;
00072        m_urlflags.EnableWindow(m_chkValue);
00073 }
00074 
00075 BOOL CUrlDialog::OnInitDialog() 
00076 {
00077        CDialog::OnInitDialog();
00078        
00079        m_flagIndex = 0;
00080        m_urlflags.SetCurSel(m_flagIndex);
00081        m_urlflags.EnableWindow(m_chkValue);
00082 
00083        
00084        return TRUE;  // return TRUE unless you set the focus to a control
00085                      // EXCEPTION: OCX Property Pages should return FALSE
00086 }
00087 
00088 void CUrlDialog::OnSelchangeCombo1() 
00089 {
00090    CString flagvalue;
00091 // m_urlflags.GetLBText(m_flagIndex,flagvalue);
00092    m_flagIndex = m_urlflags.GetCurSel();
00093 
00094 //   if (flagvalue == "NONE") {
00095    if (m_flagIndex == 0) {
00096           QAOutput("Selected NONE flag.", 1);
00097           m_flagvalue = nsIWebNavigation::LOAD_FLAGS_NONE;
00098    }
00099    else if (m_flagIndex == 1) {
00100               QAOutput("Selected MASK flag.", 1);
00101               m_flagvalue = nsIWebNavigation::LOAD_FLAGS_MASK;
00102    }
00103    else if (m_flagIndex == 2) {
00104               QAOutput("Selected IS_LINK flag.", 1);
00105               m_flagvalue = nsIWebNavigation::LOAD_FLAGS_IS_LINK;
00106    }
00107    else if (m_flagIndex == 3) {
00108               QAOutput("Selected BYPASS_HISTORY flag.", 1);
00109               m_flagvalue = nsIWebNavigation::LOAD_FLAGS_BYPASS_HISTORY;
00110    }
00111    else if (m_flagIndex == 4) {
00112               QAOutput("Selected REPLACE_HISTORY flag.", 1);
00113               m_flagvalue = nsIWebNavigation::LOAD_FLAGS_REPLACE_HISTORY;
00114    }
00115    else if (m_flagIndex == 5) {
00116               QAOutput("Selected BYPASS_CACHE flag.", 1);
00117               m_flagvalue = nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE;
00118    }
00119    else if (m_flagIndex == 6) {
00120               QAOutput("Selected BYPASS_PROXY flag.", 1);
00121               m_flagvalue = nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY;
00122    }
00123    else if (m_flagIndex == 7) {
00124               QAOutput("Selected CHARSET_CHANGE flag.", 1);
00125               m_flagvalue = nsIWebNavigation::LOAD_FLAGS_CHARSET_CHANGE;     
00126    }
00127    else if (m_flagIndex == 8) {
00128               QAOutput("Selected REFRESH flag.", 1);
00129               m_flagvalue = nsIWebNavigation::LOAD_FLAGS_IS_REFRESH;  
00130    }
00131    else
00132               QAOutput("NO FLAG!!!.", 1);
00133 }
00134 
00135 void CUrlDialog::OnSelchangeCombo2() 
00136 {
00137    m_protocolIndex = m_protocol.GetCurSel();
00138 
00139    if (m_protocolIndex == 0) {
00140               QAOutput("Selected http protocol.", 1);
00141               m_protocolvalue = "http";
00142    }
00143    else if (m_protocolIndex == 1) {
00144               QAOutput("Selected https protocol.", 1);
00145               m_protocolvalue = "https";
00146    }
00147    else if (m_protocolIndex == 2) {
00148               QAOutput("Selected ftp protocol.", 1);
00149               m_protocolvalue = "ftp";
00150    }
00151    else if (m_protocolIndex == 3) {
00152               QAOutput("Selected file protocol.", 1);
00153               m_protocolvalue = "file";
00154    }
00155    else if (m_protocolIndex == 4) {
00156               QAOutput("Selected javascript protocol.", 1);
00157               m_protocolvalue = "javascript";
00158    }
00159    else if (m_protocolIndex == 5) {
00160               QAOutput("Selected about protocol.", 1);
00161               m_protocolvalue = "about";
00162    }
00163    else if (m_protocolIndex == 6) {
00164               QAOutput("Selected data protocol.", 1);
00165               m_protocolvalue = "data";
00166    }
00167    else if (m_protocolIndex == 7) {
00168               QAOutput("Selected mailto protocol.", 1);
00169               m_protocolvalue = "mailto"; 
00170    }
00171    else if (m_protocolIndex == 8) {
00172               QAOutput("Selected imap protocol.", 1);
00173               m_protocolvalue = "imap";   
00174    }
00175    else
00176               QAOutput("NO PROTOCOL SELECTED!!!.", 1);
00177 }