diff --git a/pgadmin/ctl/timespin.cpp b/pgadmin/ctl/timespin.cpp index 7ae9e38..d406a64 100644 --- a/pgadmin/ctl/timespin.cpp +++ b/pgadmin/ctl/timespin.cpp @@ -24,6 +24,7 @@ BEGIN_EVENT_TABLE(wxTimeSpinCtrl, wxControl) EVT_NAVIGATION_KEY(wxTimeSpinCtrl::OnNavigate) EVT_SPIN_UP(CTRLID_SPN, wxTimeSpinCtrl::OnSpinUp) EVT_SPIN_DOWN(CTRLID_SPN, wxTimeSpinCtrl::OnSpinDown) + EVT_SPIN(CTRLID_SPN, wxTimeSpinCtrl::OnSpin) EVT_SET_FOCUS(wxTimeSpinCtrl::OnSetFocus) EVT_SIZE(wxTimeSpinCtrl::OnSize) END_EVENT_TABLE() @@ -236,6 +237,13 @@ void wxTimeSpinCtrl::OnSpinDown(wxSpinEvent &ev) DoSpin(-1); } + +void wxTimeSpinCtrl::OnSpin(wxSpinEvent &ev) +{ + wxCommandEvent parentSpinEvt(ev.GetEventType(), this->GetId()); + this->GetEventHandler()->AddPendingEvent(parentSpinEvt); +} + void wxTimeSpinCtrl::DoSpin(int diff) { int tp = GetTimePart(); diff --git a/pgadmin/dlg/dlgRole.cpp b/pgadmin/dlg/dlgRole.cpp index 059e979..8368a90 100644 --- a/pgadmin/dlg/dlgRole.cpp +++ b/pgadmin/dlg/dlgRole.cpp @@ -65,6 +65,7 @@ BEGIN_EVENT_TABLE(dlgRole, dlgProperty) EVT_CALENDAR_SEL_CHANGED(XRCID("datValidUntil"), dlgRole::OnChangeCal) EVT_DATE_CHANGED(XRCID("datValidUntil"), dlgRole::OnChangeDate) EVT_SPIN(XRCID("timValidUntil"), dlgRole::OnChangeSpin) + EVT_TEXT(XRCID("timValidUntil"), dlgRole::OnChange) EVT_LISTBOX_DCLICK(XRCID("lbRolesNotIn"), dlgRole::OnRoleAdd) EVT_LISTBOX_DCLICK(XRCID("lbRolesIn"), dlgRole::OnRoleRemove) @@ -133,6 +134,17 @@ void dlgRole::OnChangeSize(wxSizeEvent &ev) int dlgRole::Go(bool modal) { + +// In wxMac, the text deletion of "calenderBox" is not raising the EVT_CALENDAR_SEL_CHANGED, EVT_DATE_CHANGED events properly. +// Hence, raising these events with wxEVT_CHILD_FOCUS events. +// +#ifdef __WXMAC__ + + datValidUntil->Connect(wxEVT_CHILD_FOCUS, wxCommandEventHandler(dlgRole::OnChange), NULL, this); + timValidUntil->Connect(wxEVT_CHILD_FOCUS, wxCommandEventHandler(dlgRole::OnChange), NULL, this); + +#endif + if (connection->BackendMinimumVersion(9, 0)) { cbVarDbname->Append(wxT("")); @@ -215,6 +227,11 @@ int dlgRole::Go(bool modal) datValidUntil->SetValue(role->GetAccountExpires().GetDateOnly()); timValidUntil->SetTime(role->GetAccountExpires()); } + else + { + wxDateTime empty; + datValidUntil->SetValue(empty); + } txtConnectionLimit->SetValue(NumToStr(role->GetConnectionLimit())); txtComment->SetValue(role->GetComment()); @@ -654,7 +671,7 @@ wxString dlgRole::GetSql() { if (datValidUntil->GetValue().IsValid()) options += wxT("\n VALID UNTIL ") + qtDbString(DateToAnsiStr(datValidUntil->GetValue() + timValidUntil->GetValue())); - else + else if (!role->GetIsValidInfinity() && role->GetAccountExpires().GetValue() != -1) options += wxT("\n VALID UNTIL 'infinity'"); } diff --git a/pgadmin/include/ctl/timespin.h b/pgadmin/include/ctl/timespin.h index ff3e554..14b65b5 100644 --- a/pgadmin/include/ctl/timespin.h +++ b/pgadmin/include/ctl/timespin.h @@ -48,6 +48,7 @@ private: void OnSpinUp(wxSpinEvent &ev); void OnSpinDown(wxSpinEvent &ev); + void OnSpin(wxSpinEvent &ev); void OnText(wxCommandEvent &ev); void OnSetFocus(wxFocusEvent &ev); void OnKillFocus(wxFocusEvent &ev); diff --git a/pgadmin/include/schema/pgRole.h b/pgadmin/include/schema/pgRole.h index b80be79..4c9518d 100644 --- a/pgadmin/include/schema/pgRole.h +++ b/pgadmin/include/schema/pgRole.h @@ -147,6 +147,10 @@ public: { connectionLimit = newVal; } + void iSetIsValidInfinity(const bool b) + { + isValidInfinity = b; + } wxArrayString &GetRolesIn() { return rolesIn; @@ -179,11 +183,15 @@ public: { return true; } + bool GetIsValidInfinity() + { + return isValidInfinity; + } private: wxString password; wxString rolqueuename; wxDateTime accountExpires; - bool superuser, createDatabase, createRole, updateCatalog, inherits, canLogin, replication; + bool superuser, createDatabase, createRole, updateCatalog, inherits, canLogin, replication, isValidInfinity; long connectionLimit; wxArrayString rolesIn; wxArrayString variables; diff --git a/pgadmin/schema/pgRole.cpp b/pgadmin/schema/pgRole.cpp index 188a986..9c02fc9 100644 --- a/pgadmin/schema/pgRole.cpp +++ b/pgadmin/schema/pgRole.cpp @@ -643,6 +643,7 @@ pgObject *pgRoleBaseFactory::CreateObjects(pgCollection *collection, ctlTree *br role->iSetSuperuser(roles->GetBool(wxT("rolsuper"))); role->iSetUpdateCatalog(roles->GetBool(wxT("rolcatupdate"))); role->iSetAccountExpires(roles->GetDateTime(wxT("rolvaliduntil"))); + role->iSetIsValidInfinity(roles->GetVal(wxT("rolvaliduntil"))==wxT("infinity") ? true : false); role->iSetPassword(roles->GetVal(wxT("rolpassword"))); role->iSetComment(roles->GetVal(wxT("description"))); role->iSetConnectionLimit(roles->GetLong(wxT("rolconnlimit")));