]> code.citadel.org Git - citadel.git/commitdiff
Started ConnectOnStartup flag, not quite right yet, though.
authorArt Cancro <ajc@citadel.org>
Sun, 25 Apr 1999 16:34:49 +0000 (16:34 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 25 Apr 1999 16:34:49 +0000 (16:34 +0000)
daphne/includes.hpp
daphne/main.cpp
daphne/prefs.cpp

index 911d2feba70d577a9cc878cd72c52ab0c2246f54..02fc9caf7b8f6ff463d894bb5fb0fce6744bc5e4 100644 (file)
@@ -145,6 +145,7 @@ private:
        CitClient *citsock;
        wxMDIParentFrame *citMyMDI;
        wxTextCtrl *server_host, *server_port;
+       wxCheckBox *server_autoconnect;
        DECLARE_EVENT_TABLE()
 };
 
index 863aec3b5f70a68ee7c45f98776aba4953d22b9d..4c176fa4c907bd85e23dc9562fab7a912e42a3a7 100644 (file)
@@ -172,6 +172,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
                -1,
                title, pos, size, wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL
                ) {
+       wxString buf;
 
        TheWholist = NULL;
 
@@ -218,12 +219,17 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
        // ... and attach this menu bar to the frame
        SetMenuBar(menuBar);
 
-       // create a status bar just for fun (by default with 1 pane only)
+       // Create the status bar
        CreateStatusBar(3);
        SetStatusText("Not connected", 0);
 
         Show(TRUE);
-        
+
+       ini->Read("/Citadel Server/ConnectOnStartup", &buf, "no");
+       if (!buf.CmpNoCase("yes")) {
+               wxCommandEvent cjunk;
+               OnConnect(cjunk);
+       }
 }
 
 
index 9ccf27affc0dc60b7c38fc0498857294dcfe9f77..289b6045c852909adcc4346b31a40d52f4b06855 100644 (file)
@@ -129,12 +129,25 @@ Preferences::Preferences( CitClient *sock,
        c7->height.AsIs();
        server_port->SetConstraints(c7);
 
+       server_autoconnect = new wxCheckBox(this, -1,
+               "Automatically connect at startup");
+
+       wxLayoutConstraints *c8 = new wxLayoutConstraints;
+       c8->centreY.SameAs(server_port, wxCentreY);
+       c8->left.RightOf(server_port, 5);
+       c8->width.AsIs(); c8->height.AsIs();
+       server_autoconnect->SetConstraints(c8);
+
        ini->Read("/Citadel Server/Host", &buf, DEFAULT_HOST);
        server_host->SetValue(buf);
 
        ini->Read("/Citadel Server/Port", &buf, DEFAULT_PORT);
        server_port->SetValue(buf);
 
+       ini->Read("/Citadel Server/ConnectOnStartup", &buf, "no");
+       server_autoconnect->SetValue(
+               ((!buf.CmpNoCase("yes")) ? TRUE : FALSE));
+
        SetAutoLayout(TRUE);
        Show(TRUE);
         Layout();
@@ -148,6 +161,8 @@ void Preferences::OnButtonPressed(wxCommandEvent& whichbutton) {
        } else if (whichbutton.GetId() == BUTTON_SAVE) {
                ini->Write("/Citadel Server/Host", server_host->GetValue());
                ini->Write("/Citadel Server/Port", server_port->GetValue());
+               ini->Write("/Citadel Server/ConnectOnStartup",
+                   ((server_autoconnect->GetValue()==TRUE) ? "yes" : "no"));
                ini->Flush();
                delete this;
        }