added wxDialUpManager::IsAlwaysConnected() and GetISPNames(), also Dial()
is now smart enough to propose to choose from available ISPs and tries to find out the username and password on its own git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3859 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -80,6 +80,7 @@ public:
|
||||
void OnAbout(wxCommandEvent& event);
|
||||
void OnHangUp(wxCommandEvent& event);
|
||||
void OnDial(wxCommandEvent& event);
|
||||
void OnEnumISPs(wxCommandEvent& event);
|
||||
|
||||
void OnUpdateUI(wxUpdateUIEvent& event);
|
||||
|
||||
@@ -101,7 +102,9 @@ enum
|
||||
NetTest_Quit = 1,
|
||||
NetTest_About,
|
||||
NetTest_HangUp,
|
||||
NetTest_Dial
|
||||
NetTest_Dial,
|
||||
NetTest_EnumISP,
|
||||
NetTest_Max
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -121,6 +124,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU(NetTest_About, MyFrame::OnAbout)
|
||||
EVT_MENU(NetTest_HangUp, MyFrame::OnHangUp)
|
||||
EVT_MENU(NetTest_Dial, MyFrame::OnDial)
|
||||
EVT_MENU(NetTest_EnumISP, MyFrame::OnEnumISPs)
|
||||
|
||||
EVT_UPDATE_UI(NetTest_Dial, MyFrame::OnUpdateUI)
|
||||
|
||||
@@ -168,6 +172,8 @@ bool MyApp::OnInit()
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
frame->SetStatusText(GetDialer()->IsAlwaysOnline() ? "LAN" : "No LAN", 2);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -195,9 +201,7 @@ void MyApp::OnConnected(wxDialUpEvent& event)
|
||||
: "Disconnected";
|
||||
}
|
||||
|
||||
wxMessageBox(msg, "Dial Up Manager Notification",
|
||||
wxOK | wxICON_INFORMATION,
|
||||
GetTopWindow());
|
||||
wxLogMessage(msg);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -214,6 +218,8 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
menuFile->Append(NetTest_Dial, "&Dial\tCtrl-D", "Dial default ISP");
|
||||
menuFile->Append(NetTest_HangUp, "&HangUp\tCtrl-H", "Hang up modem");
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append(NetTest_EnumISP, "&Enumerate ISPs...\tCtrl-E");
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append(NetTest_About, "&About...\tCtrl-A", "Show about dialog");
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append(NetTest_Quit, "E&xit\tAlt-X", "Quit this program");
|
||||
@@ -225,7 +231,10 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
|
||||
CreateStatusBar(2);
|
||||
// create status bar and fill the LAN field
|
||||
CreateStatusBar(3);
|
||||
static const int widths[3] = { -1, 100, 60 };
|
||||
SetStatusWidths(3, widths);
|
||||
}
|
||||
|
||||
|
||||
@@ -264,7 +273,7 @@ void MyFrame::OnDial(wxCommandEvent& WXUNUSED(event))
|
||||
wxYield();
|
||||
wxBeginBusyCursor();
|
||||
|
||||
if ( wxGetApp().GetDialer()->Dial("Free", "zeitlin", "") )
|
||||
if ( wxGetApp().GetDialer()->Dial() )
|
||||
{
|
||||
wxLogStatus(this, "Dialing...");
|
||||
}
|
||||
@@ -276,6 +285,26 @@ void MyFrame::OnDial(wxCommandEvent& WXUNUSED(event))
|
||||
wxEndBusyCursor();
|
||||
}
|
||||
|
||||
void MyFrame::OnEnumISPs(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxArrayString names;
|
||||
size_t nCount = wxGetApp().GetDialer()->GetISPNames(names);
|
||||
if ( nCount == 0 )
|
||||
{
|
||||
wxLogWarning("No ISPs found.");
|
||||
}
|
||||
else
|
||||
{
|
||||
wxString msg = "Known ISPs:\n";
|
||||
for ( size_t n = 0; n < nCount; n++ )
|
||||
{
|
||||
msg << names[n] << '\n';
|
||||
}
|
||||
|
||||
wxLogMessage(msg);
|
||||
}
|
||||
}
|
||||
|
||||
void MyFrame::OnUpdateUI(wxUpdateUIEvent& event)
|
||||
{
|
||||
// disable this item while dialing
|
||||
|
Reference in New Issue
Block a user