Just getting back into the swing of things with the New Connection Window.

I'm going to keep plugging away at this app until such that it needs assistance from the net crew.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7430 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Phil Greenway
2004-05-06 12:45:28 +00:00
parent 6f7e72c0b7
commit 3211ef3088
5 changed files with 52 additions and 24 deletions
+11 -7
View File
@@ -43,18 +43,19 @@ float FormHeightState2 = 282;
BRect windowRect(FormTopDefault,FormLeftDefault,FormLeftDefault+FormWidthDefault,FormTopDefault+FormHeightDefault);
// DUN -- constructor for DUN Class
DUN::DUN() : BApplication (APP_SIGNATURE) {
dunWindow = new DUNWindow(windowRect);
DUN::DUN() : BApplication (APP_SIGNATURE)
{
ptrDUNWindow = new DUNWindow(windowRect);
}
// ------------------------------------------------------------------------------- //
// DUN::MessageReceived -- handles incoming messages
void DUN::MessageReceived (BMessage *message) {
switch(message->what) {
void DUN::MessageReceived (BMessage *message)
{
switch(message->what)
{
default:
BApplication::MessageReceived(message); // pass it along ...
break;
@@ -63,9 +64,12 @@ void DUN::MessageReceived (BMessage *message) {
// ------------------------------------------------------------------------------- //
// DUN Main
int main(void) {
int main(void)
{
DUN theApp;
theApp.Run();
return 0;
}
// end
+1 -1
View File
@@ -22,7 +22,7 @@ public:
DUN();
virtual void MessageReceived(BMessage *message);
private:
DUNWindow* dunWindow;
DUNWindow* ptrDUNWindow;
};
#endif
+23 -5
View File
@@ -2,16 +2,19 @@
DUNWindow - DialUp Networking BWindow
Authors: Sikosis (beos@gravity24hr.com)
Authors: Sikosis (phil@sikosis.com)
Misza ([email protected])
(C) 2002-2003 OpenBeOS under MIT license
(C) 2002-2004 OpenBeOS under MIT license
*/
/*-----WARNING MESSY CODE AHEAD :-)------*/
#include <String.h>
#include "DUNWindow.h"
#include "NewConnectionWindow.h"
// Add these to Constants file
const int DUN_WINDOW_STATE_DEFAULT = 0; // default - closed
const int DUN_WINDOW_STATE_ONE = 1; // 1st only
@@ -28,7 +31,9 @@ float ModemFormHeightDefault = 324;
BRect windowRectModem(ModemFormTopDefault,ModemFormLeftDefault,ModemFormLeftDefault+ModemFormWidthDefault,ModemFormTopDefault+ModemFormHeightDefault);
// DUNWindow -- constructor for DUNWindow Class
DUNWindow::DUNWindow(BRect frame) : BWindow (frame, "OBOS Dial-up Networking", B_TITLED_WINDOW, B_NOT_RESIZABLE |B_NOT_ZOOMABLE, 0) {
DUNWindow::DUNWindow(BRect frame) : BWindow (frame, "OBOS Dial-up Networking", B_TITLED_WINDOW,
B_NOT_RESIZABLE |B_NOT_ZOOMABLE, 0)
{
InitWindow();
Show();
}
@@ -356,7 +361,7 @@ void DUNWindow::MessageReceived (BMessage *message)
errormsg->Go();
}
break;
case BTN_DISCONNECT:
{
disconnectbutton->SetEnabled(false);
@@ -401,22 +406,35 @@ void DUNWindow::MessageReceived (BMessage *message)
case MENU_CON_NEW:
{
// open new connection window
ptrNewConnectionWindow = new NewConnectionWindow(BRect(0,0,260,73));
}
break;
case BTN_MODEM:
{
// open modem window
modemWindow = new ModemWindow(windowRectModem);
}
break;
case BTN_SETTINGS:
{
// open settings window
settingsWindow = new SettingsWindow(BRect(367.0, 268.0, 657.0, 500.0));
}
break;
case ADD_NEW_CONNECTION:
{
// add and set our new connection
BString fConnectionName;
message->FindString("ConnectionName", &fConnectionName);
printf("ConnectionName = %s\n",fConnectionName.String());
// add to dropdown
// set as current item with tick
}
break;
default:
{
BWindow::MessageReceived(message);
+4
View File
@@ -49,6 +49,10 @@ const uint32 MENU_LOC_DELETE_CURRENT = 'MLDl';
const uint32 TEST_BOX_1 = 'Tb1';
const uint32 TEST_BOX_2 = 'Tb2';
const uint32 ADD_NEW_CONNECTION = 'adnc';
//const char *kConnectionName = "ConnectionName";
struct last_active { int x;int y;};
class DUNView;
+13 -11
View File
@@ -2,9 +2,9 @@
NewConnectionWindow - DialUp Networking
Author: Sikosis (beos@gravity24hr.com)
Author: Sikosis (phil@sikosis.com)
(C) 2002 OpenBeOS under MIT license
(C)2002-2004 OpenBeOS under MIT license
*/
@@ -22,6 +22,7 @@ Author: Sikosis ([email protected])
#include <Window.h>
#include <View.h>
#include "DUNWindow.h"
#include "NewConnectionWindow.h"
#include "DUNView.h"
@@ -101,20 +102,21 @@ void NewConnectionWindow::MessageReceived (BMessage *message)
switch(message->what)
{
case BTN_ADD:
char tmp[256];
sprintf(tmp,"%s",txtNewConnection->Text());
(new BAlert("",tmp,"tmp"))->Go();
// need to create a new file called txtNewConnection->Text() and
// place it in the /boot/home/config/settings/DUN/DUNCONNECT directory
{
// Send Messages to DUNWindow to Add New Connectionupdate
BWindow *ptrDUNWindow;
ptrDUNWindow = be_app->WindowAt(0); // its the first window
BMessage msg(ADD_NEW_CONNECTION);
msg.AddString("ConnectionName", txtNewConnection->Text());
BMessenger(ptrDUNWindow).SendMessage(&msg);
// before closing we need to change the main window to state 1
Quit();
}
break;
case BTN_CANCEL:
Quit();
//Hide(); // change later
break;
default:
BWindow::MessageReceived(message);