mirror of
https://github.com/levinsv/pgadmin3.git
synced 2026-05-15 14:15:49 -06:00
Server groups have been added to the connection selection dialog.
Добавлен список групп серверов, для упрощения поиска нужного соединения.
This commit is contained in:
parent
a0fe84b11f
commit
81a8417e77
4 changed files with 41099 additions and 41053 deletions
|
|
@ -27,8 +27,10 @@
|
||||||
#define CTRLID_CBDATABASE 4243
|
#define CTRLID_CBDATABASE 4243
|
||||||
#define CTRLID_CBUSERNAME 4244
|
#define CTRLID_CBUSERNAME 4244
|
||||||
#define CTRLID_CBROLENAME 4245
|
#define CTRLID_CBROLENAME 4245
|
||||||
|
#define CTRLID_CBGROUP 4246
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(dlgSelectConnection, DialogWithHelp)
|
BEGIN_EVENT_TABLE(dlgSelectConnection, DialogWithHelp)
|
||||||
|
EVT_COMBOBOX(CTRLID_CBGROUP, dlgSelectConnection::OnChangeGroup)
|
||||||
EVT_COMBOBOX(CTRLID_CBSERVER, dlgSelectConnection::OnChangeServer)
|
EVT_COMBOBOX(CTRLID_CBSERVER, dlgSelectConnection::OnChangeServer)
|
||||||
EVT_COMBOBOX(CTRLID_CBDATABASE, dlgSelectConnection::OnChangeDatabase)
|
EVT_COMBOBOX(CTRLID_CBDATABASE, dlgSelectConnection::OnChangeDatabase)
|
||||||
EVT_TEXT(CTRLID_CBSERVER, dlgSelectConnection::OnTextChange)
|
EVT_TEXT(CTRLID_CBSERVER, dlgSelectConnection::OnTextChange)
|
||||||
|
|
@ -56,17 +58,31 @@ dlgSelectConnection::dlgSelectConnection(wxWindow *parent, frmMain *form) :
|
||||||
if (form != NULL)
|
if (form != NULL)
|
||||||
style |= wxCB_READONLY;
|
style |= wxCB_READONLY;
|
||||||
|
|
||||||
cbServer = new ctlComboBoxFix(this, CTRLID_CBSERVER, ConvertDialogToPixels(wxPoint(65, 5)), ConvertDialogToPixels(wxSize(135, 12)), style);
|
cbGroup = new wxComboBox(this, CTRLID_CBGROUP, wxEmptyString, ConvertDialogToPixels(wxPoint(70, 5)), ConvertDialogToPixels(wxSize(135, 12)), wxArrayString(), style);
|
||||||
cbDatabase = new wxComboBox(this, CTRLID_CBDATABASE, wxEmptyString, ConvertDialogToPixels(wxPoint(65, 20)), ConvertDialogToPixels(wxSize(135, 12)), wxArrayString(), style);
|
cbServer = new ctlComboBoxFix(this, CTRLID_CBSERVER, ConvertDialogToPixels(wxPoint(70, 20)), ConvertDialogToPixels(wxSize(135, 12)), style);
|
||||||
cbUsername = new wxComboBox(this, CTRLID_CBUSERNAME, wxEmptyString, ConvertDialogToPixels(wxPoint(65, 35)), ConvertDialogToPixels(wxSize(135, 12)), wxArrayString(), style);
|
cbDatabase = new wxComboBox(this, CTRLID_CBDATABASE, wxEmptyString, ConvertDialogToPixels(wxPoint(70, 35)), ConvertDialogToPixels(wxSize(135, 12)), wxArrayString(), style);
|
||||||
cbRolename = new wxComboBox(this, CTRLID_CBROLENAME, wxEmptyString, ConvertDialogToPixels(wxPoint(65, 50)), ConvertDialogToPixels(wxSize(135, 12)), wxArrayString(), style);
|
cbUsername = new wxComboBox(this, CTRLID_CBUSERNAME, wxEmptyString, ConvertDialogToPixels(wxPoint(70, 50)), ConvertDialogToPixels(wxSize(135, 12)), wxArrayString(), style);
|
||||||
|
cbRolename = new wxComboBox(this, CTRLID_CBROLENAME, wxEmptyString, ConvertDialogToPixels(wxPoint(70, 75)), ConvertDialogToPixels(wxSize(135, 12)), wxArrayString(), style);
|
||||||
|
|
||||||
if (form == NULL)
|
if (form == NULL)
|
||||||
{
|
{
|
||||||
cbServer->SetValue(settings->Read(wxT("QuickConnect/server"), wxEmptyString));
|
cbServer->SetValue(settings->Read(wxT("QuickConnect/server"), wxEmptyString));
|
||||||
|
cbGroup->SetValue(settings->Read(wxT("QuickConnect/group"), wxEmptyString));
|
||||||
cbDatabase->SetValue(settings->Read(wxT("QuickConnect/database"), wxEmptyString));
|
cbDatabase->SetValue(settings->Read(wxT("QuickConnect/database"), wxEmptyString));
|
||||||
cbUsername->SetValue(settings->Read(wxT("QuickConnect/username"), wxEmptyString));
|
cbUsername->SetValue(settings->Read(wxT("QuickConnect/username"), wxEmptyString));
|
||||||
cbRolename->SetValue(settings->Read(wxT("QuickConnect/rolename"), wxEmptyString));
|
cbRolename->SetValue(settings->Read(wxT("QuickConnect/rolename"), wxEmptyString));
|
||||||
|
} else {
|
||||||
|
wxTreeItemIdValue foldercookie, servercookie;
|
||||||
|
wxTreeItemId folderitem, serveritem;
|
||||||
|
ctlTree *browser = mainForm->GetBrowser();
|
||||||
|
folderitem = browser->GetFirstChild(browser->GetRootItem(), foldercookie);
|
||||||
|
cbGroup->Append("");
|
||||||
|
while (folderitem)
|
||||||
|
{
|
||||||
|
wxString grp=browser->GetItemText(folderitem);
|
||||||
|
cbGroup->Append(grp);
|
||||||
|
folderitem = browser->GetNextChild(browser->GetRootItem(), foldercookie);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
btnOK->Enable(cbServer->GetValue().Length() > 0 && cbDatabase->GetValue().Length() > 0 && cbUsername->GetValue().Length() > 0);
|
btnOK->Enable(cbServer->GetValue().Length() > 0 && cbDatabase->GetValue().Length() > 0 && cbUsername->GetValue().Length() > 0);
|
||||||
|
|
@ -84,7 +100,16 @@ wxString dlgSelectConnection::GetHelpPage() const
|
||||||
return wxT("connect");
|
return wxT("connect");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dlgSelectConnection::OnChangeGroup(wxCommandEvent &ev)
|
||||||
|
{
|
||||||
|
int sel = cbGroup->GetCurrentSelection();
|
||||||
|
if (sel >= 0)
|
||||||
|
{
|
||||||
|
bool found=BuildServerCombo(currconn);
|
||||||
|
if (!found) cbServer->SetSelection(0);
|
||||||
|
OnChangeServer(ev);
|
||||||
|
}
|
||||||
|
}
|
||||||
void dlgSelectConnection::OnChangeServer(wxCommandEvent &ev)
|
void dlgSelectConnection::OnChangeServer(wxCommandEvent &ev)
|
||||||
{
|
{
|
||||||
int item;
|
int item;
|
||||||
|
|
@ -307,6 +332,7 @@ pgConn *dlgSelectConnection::CreateConn(wxString &server, wxString &dbname, wxSt
|
||||||
if (writeMRU)
|
if (writeMRU)
|
||||||
{
|
{
|
||||||
settings->Write(wxT("QuickConnect/server"), cbServer->GetValue());
|
settings->Write(wxT("QuickConnect/server"), cbServer->GetValue());
|
||||||
|
settings->Write(wxT("QuickConnect/group"), cbGroup->GetValue());
|
||||||
settings->Write(wxT("QuickConnect/database"), cbDatabase->GetValue());
|
settings->Write(wxT("QuickConnect/database"), cbDatabase->GetValue());
|
||||||
settings->Write(wxT("QuickConnect/username"), cbUsername->GetValue());
|
settings->Write(wxT("QuickConnect/username"), cbUsername->GetValue());
|
||||||
settings->Write(wxT("QuickConnect/rolename"), cbRolename->GetValue());
|
settings->Write(wxT("QuickConnect/rolename"), cbRolename->GetValue());
|
||||||
|
|
@ -314,11 +340,8 @@ pgConn *dlgSelectConnection::CreateConn(wxString &server, wxString &dbname, wxSt
|
||||||
}
|
}
|
||||||
return newconn;
|
return newconn;
|
||||||
}
|
}
|
||||||
|
bool dlgSelectConnection::BuildServerCombo(pgConn *conn) {
|
||||||
int dlgSelectConnection::Go(pgConn *conn, wxBitmapComboBox *cb)
|
|
||||||
{
|
|
||||||
bool foundServer = false;
|
bool foundServer = false;
|
||||||
cbConnection = cb;
|
|
||||||
if (mainForm != NULL)
|
if (mainForm != NULL)
|
||||||
{
|
{
|
||||||
ctlTree *browser = mainForm->GetBrowser();
|
ctlTree *browser = mainForm->GetBrowser();
|
||||||
|
|
@ -326,11 +349,18 @@ int dlgSelectConnection::Go(pgConn *conn, wxBitmapComboBox *cb)
|
||||||
wxTreeItemId folderitem, serveritem;
|
wxTreeItemId folderitem, serveritem;
|
||||||
pgObject *object;
|
pgObject *object;
|
||||||
pgServer *server;
|
pgServer *server;
|
||||||
|
wxString grp;
|
||||||
|
cbServer->Clear();
|
||||||
|
if (cbGroup->GetCurrentSelection() != wxNOT_FOUND) {
|
||||||
|
grp=cbGroup->GetValue();
|
||||||
|
}
|
||||||
folderitem = browser->GetFirstChild(browser->GetRootItem(), foldercookie);
|
folderitem = browser->GetFirstChild(browser->GetRootItem(), foldercookie);
|
||||||
while (folderitem)
|
while (folderitem)
|
||||||
{
|
{
|
||||||
if (browser->ItemHasChildren(folderitem))
|
bool isGroup=true;
|
||||||
|
if (grp.Length()>0)
|
||||||
|
if (browser->GetItemText(folderitem)!=grp ) isGroup=false;
|
||||||
|
if (browser->ItemHasChildren(folderitem) && isGroup)
|
||||||
{
|
{
|
||||||
serveritem = browser->GetFirstChild(folderitem, servercookie);
|
serveritem = browser->GetFirstChild(folderitem, servercookie);
|
||||||
while (serveritem)
|
while (serveritem)
|
||||||
|
|
@ -355,7 +385,6 @@ int dlgSelectConnection::Go(pgConn *conn, wxBitmapComboBox *cb)
|
||||||
folderitem = browser->GetNextChild(browser->GetRootItem(), foldercookie);
|
folderitem = browser->GetNextChild(browser->GetRootItem(), foldercookie);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cbServer->SetFocus();
|
cbServer->SetFocus();
|
||||||
|
|
||||||
wxCommandEvent ev;
|
wxCommandEvent ev;
|
||||||
|
|
@ -391,6 +420,15 @@ int dlgSelectConnection::Go(pgConn *conn, wxBitmapComboBox *cb)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return foundServer;
|
||||||
|
}
|
||||||
|
int dlgSelectConnection::Go(pgConn *conn, wxBitmapComboBox *cb)
|
||||||
|
{
|
||||||
|
bool foundServer = false;
|
||||||
|
cbConnection = cb;
|
||||||
|
currconn=conn;
|
||||||
|
foundServer = BuildServerCombo(conn);
|
||||||
|
|
||||||
return ShowModal();
|
return ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,15 +36,17 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnChangeServer(wxCommandEvent &ev);
|
void OnChangeServer(wxCommandEvent &ev);
|
||||||
|
void OnChangeGroup(wxCommandEvent &ev);
|
||||||
void OnChangeDatabase(wxCommandEvent &ev);
|
void OnChangeDatabase(wxCommandEvent &ev);
|
||||||
void OnTextChange(wxCommandEvent &ev);
|
void OnTextChange(wxCommandEvent &ev);
|
||||||
void OnOK(wxCommandEvent &ev);
|
void OnOK(wxCommandEvent &ev);
|
||||||
void OnCancel(wxCommandEvent &ev);
|
void OnCancel(wxCommandEvent &ev);
|
||||||
|
bool BuildServerCombo(pgConn *conn);
|
||||||
pgServer *remoteServer;
|
pgServer *remoteServer;
|
||||||
wxBitmapComboBox *cbConnection;
|
wxBitmapComboBox *cbConnection;
|
||||||
ctlComboBoxFix *cbServer;
|
ctlComboBoxFix *cbServer;
|
||||||
wxComboBox *cbDatabase, *cbUsername, *cbRolename;
|
pgConn *currconn;
|
||||||
|
wxComboBox *cbDatabase, *cbUsername, *cbRolename, *cbGroup;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -2,39 +2,43 @@
|
||||||
<resource>
|
<resource>
|
||||||
<object class="wxDialog" name="dlgSelectConnection">
|
<object class="wxDialog" name="dlgSelectConnection">
|
||||||
<title>Connect to Server</title>
|
<title>Connect to Server</title>
|
||||||
<size>205,98d</size>
|
<size>205,109d</size>
|
||||||
<style>wxDEFAULT_DIALOG_STYLE|wxCAPTION|wxSYSTEM_MENU</style>
|
<style>wxDEFAULT_DIALOG_STYLE|wxCAPTION|wxSYSTEM_MENU</style>
|
||||||
|
<object class="wxStaticText" name="stGroup">
|
||||||
|
<label>Group</label>
|
||||||
|
<pos>5,7d</pos>
|
||||||
|
</object>
|
||||||
<object class="wxStaticText" name="stServer">
|
<object class="wxStaticText" name="stServer">
|
||||||
<label>Server</label>
|
<label>Server</label>
|
||||||
<pos>5,7d</pos>
|
<pos>5,22d</pos>
|
||||||
</object>
|
</object>
|
||||||
<object class="wxStaticText" name="stDatabase">
|
<object class="wxStaticText" name="stDatabase">
|
||||||
<label>Database</label>
|
<label>Database</label>
|
||||||
<pos>5,22d</pos>
|
<pos>5,37d</pos>
|
||||||
</object>
|
</object>
|
||||||
<object class="wxStaticText" name="stUsername">
|
<object class="wxStaticText" name="stUsername">
|
||||||
<label>Username</label>
|
<label>Username</label>
|
||||||
<pos>5,37d</pos>
|
<pos>5,54d</pos>
|
||||||
</object>
|
</object>
|
||||||
<object class="wxStaticText" name="stRolename">
|
<object class="wxStaticText" name="stRolename">
|
||||||
<label>Rolename</label>
|
<label>Rolename</label>
|
||||||
<pos>5,54d</pos>
|
<pos>5,80d</pos>
|
||||||
</object>
|
</object>
|
||||||
<object class="wxButton" name="wxID_HELP">
|
<object class="wxButton" name="wxID_HELP">
|
||||||
<label>&Help</label>
|
<label>&Help</label>
|
||||||
<pos>2,80d</pos>
|
<pos>2,95d</pos>
|
||||||
<style></style>
|
<style></style>
|
||||||
</object>
|
</object>
|
||||||
<object class="wxButton" name="wxID_OK">
|
<object class="wxButton" name="wxID_OK">
|
||||||
<label>&OK</label>
|
<label>&OK</label>
|
||||||
<default>1</default>
|
<default>1</default>
|
||||||
<pos>97,80d</pos>
|
<pos>97,95d</pos>
|
||||||
<style></style>
|
<style></style>
|
||||||
</object>
|
</object>
|
||||||
<object class="wxButton" name="wxID_CANCEL">
|
<object class="wxButton" name="wxID_CANCEL">
|
||||||
<label>&Cancel</label>
|
<label>&Cancel</label>
|
||||||
<default>0</default>
|
<default>0</default>
|
||||||
<pos>150,80d</pos>
|
<pos>150,95d</pos>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
</resource>
|
</resource>
|
||||||
|
|
|
||||||
5440
ui/xrcDialogs.cpp
5440
ui/xrcDialogs.cpp
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue