SVN Commit by andreas: r4454 - in trunk/pgadmin3/src: base dlg frm include include/base - Mailing list pgadmin-hackers
From | svn@pgadmin.org |
---|---|
Subject | SVN Commit by andreas: r4454 - in trunk/pgadmin3/src: base dlg frm include include/base |
Date | |
Msg-id | 200509182052.j8IKqkmX000365@developer.pgadmin.org Whole thread Raw |
List | pgadmin-hackers |
Author: andreas Date: 2005-09-18 21:52:46 +0100 (Sun, 18 Sep 2005) New Revision: 4454 Modified: trunk/pgadmin3/src/base/pgConnBase.cpp trunk/pgadmin3/src/dlg/dlgSelectConnection.cpp trunk/pgadmin3/src/frm/frmQuery.cpp trunk/pgadmin3/src/include/base/pgConnBase.h trunk/pgadmin3/src/include/dlgSelectConnection.h Log: more fixes Modified: trunk/pgadmin3/src/base/pgConnBase.cpp =================================================================== --- trunk/pgadmin3/src/base/pgConnBase.cpp 2005-09-18 18:49:33 UTC (rev 4453) +++ trunk/pgadmin3/src/base/pgConnBase.cpp 2005-09-18 20:52:46 UTC (rev 4454) @@ -250,6 +250,16 @@ } +wxString pgConnBase::GetName() const +{ + wxString str; + if (dbHost.IsEmpty()) + str.Printf(_("%s on <localpipe>"), dbname.c_str()); + else + str.Printf(_("%s on %s:%d"), dbname.c_str(), dbHost.c_str(), GetPort()); + return str; +} + #ifdef SSL // we don't define USE_SSL so we don't get ssl.h included extern "C" Modified: trunk/pgadmin3/src/dlg/dlgSelectConnection.cpp =================================================================== --- trunk/pgadmin3/src/dlg/dlgSelectConnection.cpp 2005-09-18 18:49:33 UTC (rev 4453) +++ trunk/pgadmin3/src/dlg/dlgSelectConnection.cpp 2005-09-18 20:52:46 UTC (rev 4454) @@ -124,14 +124,21 @@ } -int dlgSelectConnection::Go() +int dlgSelectConnection::Go(pgConn *conn) { treeObjectIterator servers(mainForm->GetBrowser(), mainForm->GetServerCollection()); pgServer *s; while ((s=(pgServer*)servers.GetNextObject()) != 0) + { cbServer->Append(s->GetIdentifier(), (void*)s); - + if (s->GetConnected() && s->GetConnection()->GetHost() == conn->GetHost() && s->GetConnection()->GetPort() == conn->GetPort()) + { + cbServer->SetSelection(cbServer->GetCount()-1); + wxCommandEvent ev; + OnChangeServer(ev); + } + } cbServer->SetFocus(); btnOK->Disable(); return ShowModal(); Modified: trunk/pgadmin3/src/frm/frmQuery.cpp =================================================================== --- trunk/pgadmin3/src/frm/frmQuery.cpp 2005-09-18 18:49:33 UTC (rev 4453) +++ trunk/pgadmin3/src/frm/frmQuery.cpp 2005-09-18 20:52:46 UTC (rev 4454) @@ -195,9 +195,8 @@ toolBar->AddTool(MNU_FIND, _("Find"), wxBitmap(edit_find_xpm), _("Find text"), wxITEM_NORMAL); toolBar->AddSeparator(); - cbConnection = new wxComboBox(toolBar, CTRLID_CONNECTION, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, 0, wxCB_READONLY|wxCB_DROPDOWN); - cbConnection->Append(wxString::Format( - _("%s on %s:%d"), conn->GetDbname().c_str(), conn->GetHost().c_str(), conn->GetPort()), (void*)conn); + cbConnection = new wxComboBox(toolBar, CTRLID_CONNECTION, wxEmptyString, wxDefaultPosition, wxSize(GetCharWidth()*30,-1), 0, 0, wxCB_READONLY|wxCB_DROPDOWN); + cbConnection->Append(conn->GetName(), (void*)conn); cbConnection->Append(_("<new connection>"), (void*)0); toolBar->AddControl(cbConnection); toolBar->AddTool(MNU_EXECUTE, _("Execute"), wxBitmap(query_execute_xpm), _("Execute query"), wxITEM_NORMAL); @@ -391,14 +390,13 @@ { // new Connection dlgSelectConnection dlg(this, mainForm); - int rc=dlg.Go(); + int rc=dlg.Go(conn); if (rc == wxID_OK) { conn = dlg.GetServer()->CreateConn(dlg.GetDatabase()); if (conn) { - cbConnection->Insert(wxString::Format(_("%s on %s:%d"), conn->GetDbname().c_str(), - conn->GetHost().c_str(), conn->GetPort()), sel, (void*)conn); + cbConnection->Insert(conn->GetName(), sel, (void*)conn); cbConnection->SetSelection(sel); } else Modified: trunk/pgadmin3/src/include/base/pgConnBase.h =================================================================== --- trunk/pgadmin3/src/include/base/pgConnBase.h 2005-09-18 18:49:33 UTC (rev 4453) +++ trunk/pgadmin3/src/include/base/pgConnBase.h 2005-09-18 20:52:46 UTC (rev 4454) @@ -70,6 +70,7 @@ wxString GetPassword() const { return wxString(PQpass(conn), *conv); } wxString GetHost() const { return dbHost; } wxString GetDbname() const { return dbname; } + wxString GetName() const; int GetPort() const { return atoi(PQport(conn)); }; wxString GetTTY() const { return wxString(PQtty(conn), *conv); } wxString GetOptions() const { return wxString(PQoptions(conn), *conv); } Modified: trunk/pgadmin3/src/include/dlgSelectConnection.h =================================================================== --- trunk/pgadmin3/src/include/dlgSelectConnection.h 2005-09-18 18:49:33 UTC (rev 4453) +++ trunk/pgadmin3/src/include/dlgSelectConnection.h 2005-09-18 20:52:46 UTC (rev 4454) @@ -25,7 +25,7 @@ pgServer *GetServer() { return remoteServer; } wxString GetDatabase(); - int Go(); + int Go(pgConn *conn); private: void OnChangeServer(wxCommandEvent& ev);
pgadmin-hackers by date: