server->iSetStorePwd(chkStorePwd->GetValue());
server->iSetRestore(chkRestore->GetValue());
server->iSetDbRestriction(txtDbRestriction->GetValue().Trim());
- server->iSetColour(txtColour->GetValue());
+ if (txtColour->GetValue().Trim() == wxEmptyString)
+ server->iSetColour(wxEmptyString);
+ else
+ server->iSetColour(wxColour(txtColour->GetValue().Trim()).GetAsString(wxC2S_HTML_SYNTAX));
mainForm->execSelChange(server->GetId(), true);
mainForm->GetBrowser()->SetItemText(item, server->GetFullName());
chkStorePwd->SetValue(server->GetStorePwd());
chkRestore->SetValue(server->GetRestore());
txtDbRestriction->SetValue(server->GetDbRestriction());
- txtColour->SetValue(server->GetColour().GetAsString(wxC2S_HTML_SYNTAX));
+ txtColour->SetValue(server->GetColour());
stPassword->Disable();
txtPassword->Disable();
|| chkStorePwd->GetValue() != server->GetStorePwd()
|| chkRestore->GetValue() != server->GetRestore()
|| txtDbRestriction->GetValue() != server->GetDbRestriction()
- || txtColour->GetValue() != server->GetColour().GetAsString(wxC2S_HTML_SYNTAX);
+ || txtColour->GetValue() != wxColour(server->GetColour()).GetAsString(wxC2S_HTML_SYNTAX);
}
settings->Write(key + wxT("LastDatabase"), server->GetLastDatabase());
settings->Write(key + wxT("LastSchema"), server->GetLastSchema());
settings->Write(key + wxT("DbRestriction"), server->GetDbRestriction());
- settings->Write(key + wxT("Colour"), server->GetColour().GetAsString(wxC2S_HTML_SYNTAX));
+ settings->Write(key + wxT("Colour"), server->GetColour());
settings->Write(key + wxT("SSL"), server->GetSSL());
pgCollection *coll=browser->FindCollection(databaseFactory, server->GetId());
class pgServer : public pgObject
{
public:
- pgServer(const wxString& newServer = wxT(""), const wxString& newDescription = wxT(""), const wxString& newDatabase = wxT(""), const wxString& newUsername = wxT(""), int newPort = 5432, bool storePwd=false, bool restore=true, int sslMode=0, const wxString &colour = wxT("#ffffff"));
+ pgServer(const wxString& newServer = wxT(""), const wxString& newDescription = wxT(""), const wxString& newDatabase = wxT(""), const wxString& newUsername = wxT(""), int newPort = 5432, bool storePwd=false, bool restore=true, int sslMode=0, const wxString &colour = wxEmptyString);
~pgServer();
int GetIconId();
bool SetPassword(const wxString& newVal);
wxDateTime GetUpSince() { return upSince; }
void iSetUpSince(const wxDateTime &d) { upSince = d; }
- void iSetColour(const wxString &s) { colour = s.Length() == 0 ? wxColour(wxT("#ffffff")) : wxColour(s); }
- wxColour GetColour() { return colour; }
+ void iSetColour(const wxString &s) { colour = s; }
+ wxString GetColour() { return colour; }
bool HasPrivilege(const wxString &objTyp, const wxString &objName, const wxString &priv) { return conn->HasPrivilege(objTyp, objName, priv); }
bool ExecuteVoid(const wxString& sql) { return conn->ExecuteVoid(sql); }
OID dbOid;
wxString versionNum;
wxString dbRestriction;
- wxColour colour;
+ wxString colour;
#ifdef WIN32
SC_HANDLE scmHandle;
username = newUsername;
port = newPort;
ssl=_ssl;
- colour = _colour.IsEmpty() ? wxT("#FFFFFF") : wxColour(_colour);
+ colour = _colour;
serverIndex=0;
connected = false;
settings->Read(key + wxT("LastDatabase"), &lastDatabase, wxEmptyString);
settings->Read(key + wxT("LastSchema"), &lastSchema, wxEmptyString);
settings->Read(key + wxT("DbRestriction"), &dbRestriction, wxEmptyString);
- settings->Read(key + wxT("Colour"), &colour, wxT("#FFFFFF"));
+ settings->Read(key + wxT("Colour"), &colour, wxEmptyString);
+
+ // Sanitize the colour
+ if (!colour.IsEmpty())
+ colour = wxColour(colour.Trim()).GetAsString(wxC2S_HTML_SYNTAX);
// SSL mode
#ifdef SSL
server->iSetServerIndex(loop);
wxTreeItemId itm = browser->AppendItem(obj->GetId(), server->GetFullName(), server->GetIconId(), -1, server);
browser->SortChildren(obj->GetId());
- browser->SetItemBackgroundColour(itm, server->GetColour());
+ if (!server->GetColour().IsEmpty())
+ browser->SetItemBackgroundColour(itm, wxColour(server->GetColour()));
// Note if we're reloading a discovered server
if (!discoveryID.IsEmpty())