diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-01-17 17:33:35 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-01-17 22:41:38 +0100 |
| commit | 45a932e0756a9e1f708606d9704425c8f5c5aeb5 (patch) | |
| tree | 93cda4d473af9cc71573c1a49815bcb7cabdb3d7 /src | |
| parent | da13c2af9e8f19229061ca1939cbe8bd37c72eba (diff) | |
Cleanup: use stack-allocated Dialogs.
Diffstat (limited to 'src')
| -rw-r--r-- | src/wx/recipients_panel.cc | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/src/wx/recipients_panel.cc b/src/wx/recipients_panel.cc index 58a986ca4..943d55c6c 100644 --- a/src/wx/recipients_panel.cc +++ b/src/wx/recipients_panel.cc @@ -125,14 +125,12 @@ RecipientsPanel::add_recipient (shared_ptr<DKDMRecipient> r) void RecipientsPanel::add_recipient_clicked () { - auto d = new RecipientDialog (GetParent(), _("Add recipient")); - if (d->ShowModal() == wxID_OK) { - auto r = std::make_shared<DKDMRecipient>(d->name(), d->notes(), d->recipient(), d->emails(), d->utc_offset_hour(), d->utc_offset_minute()); + RecipientDialog dialog(GetParent(), _("Add recipient")); + if (dialog.ShowModal() == wxID_OK) { + auto r = std::make_shared<DKDMRecipient>(dialog.name(), dialog.notes(), dialog.recipient(), dialog.emails(), dialog.utc_offset_hour(), dialog.utc_offset_minute()); Config::instance()->add_dkdm_recipient (r); add_recipient (r); } - - d->Destroy (); } @@ -145,21 +143,19 @@ RecipientsPanel::edit_recipient_clicked () auto c = *_selected.begin(); - auto d = new RecipientDialog ( + RecipientDialog dialog( GetParent(), _("Edit recipient"), c.second->name, c.second->notes, c.second->emails, c.second->utc_offset_hour, c.second->utc_offset_minute, c.second->recipient ); - if (d->ShowModal () == wxID_OK) { - c.second->name = d->name (); - c.second->emails = d->emails (); - c.second->notes = d->notes (); - c.second->utc_offset_hour = d->utc_offset_hour (); - c.second->utc_offset_minute = d->utc_offset_minute (); - _targets->SetItemText (c.first, std_to_wx (d->name())); + if (dialog.ShowModal() == wxID_OK) { + c.second->name = dialog.name(); + c.second->emails = dialog.emails(); + c.second->notes = dialog.notes(); + c.second->utc_offset_hour = dialog.utc_offset_hour(); + c.second->utc_offset_minute = dialog.utc_offset_minute(); + _targets->SetItemText(c.first, std_to_wx(dialog.name())); Config::instance()->changed (Config::DKDM_RECIPIENTS); } - - d->Destroy (); } |
