Add the edit contact dialog
Ctrl+Y from the entry window, or Enter on a row in the log, opens the whole contact in one dialog. It reaches the fields the log has no column for: QSX frequency, name, QTH, comment, grid, power, radio number, run position, and the country and WPX prefixes. Previous and Next walk the log without closing and offer to save first. The dialog checks values through the same QsoEditor the log columns use, so a zone the contest will not take is refused the same way in both places. QsoEdit now names the field that was refused, so the dialog can put the cursor back in the right box, and QsoEditor.ApplyAll changes several fields at once. Points and the multiplier flags are shown but not editable. They are worked out from the rules every time the log changes, so a typed value would be lost on the next edit. N1MM lets you type them; we do not, rather than offering a box that does nothing. A contact's own country prefix now wins over the country file when scoring. Without this, correcting the country in the dialog would change what the log shows and what Cabrillo says, but not the score. LoggingSession.Update now broadcasts the change like Edit does, so a contact saved from the dialog reaches the other stations. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -176,6 +176,16 @@ public sealed partial class EntryWindow
|
||||
|
||||
private void OnExit(object? sender, RoutedEventArgs e) => Close();
|
||||
|
||||
private async void OnEditLastContact(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (Logging is null || Logging.Log.Qsos.Count == 0)
|
||||
{
|
||||
Status("there is nothing in the log yet");
|
||||
return;
|
||||
}
|
||||
await new EditContactDialog(Logging, Logging.Log.Qsos[^1].Id).ShowDialog(this);
|
||||
}
|
||||
|
||||
private void OnShowLog(object? sender, RoutedEventArgs e) => Show(() => new LogWindow(session));
|
||||
|
||||
private void OnShowCheck(object? sender, RoutedEventArgs e) => Show(() => new CheckWindow(session, () => Logging?.Entry.Call ?? ""));
|
||||
|
||||
@@ -39,6 +39,9 @@
|
||||
<Separator />
|
||||
<MenuItem Header="E_xit" Click="OnExit" />
|
||||
</MenuItem>
|
||||
<MenuItem Header="_Edit">
|
||||
<MenuItem Header="Edit _Last Contact…" Click="OnEditLastContact" InputGesture="Ctrl+Y" />
|
||||
</MenuItem>
|
||||
<MenuItem Header="_View">
|
||||
<MenuItem Header="_Log" Click="OnShowLog" />
|
||||
<MenuItem Header="_Check" Click="OnShowCheck" />
|
||||
|
||||
@@ -179,6 +179,10 @@ public sealed partial class EntryWindow : Window
|
||||
e.Handled = true;
|
||||
MoveFocus(forward: !e.KeyModifiers.HasFlag(KeyModifiers.Shift));
|
||||
break;
|
||||
case Key.Y when e.KeyModifiers.HasFlag(KeyModifiers.Control):
|
||||
e.Handled = true;
|
||||
OnEditLastContact(this, new RoutedEventArgs());
|
||||
break;
|
||||
case Key.OemQuestion when e.KeyModifiers.HasFlag(KeyModifiers.Control):
|
||||
e.Handled = true;
|
||||
ToggleRun();
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
FontSize="12" FontFamily="monospace">
|
||||
<DataGrid.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="Edit contact…" Click="OnEditContact" InputGesture="Enter" />
|
||||
<MenuItem Header="Delete contact" Click="OnDelete" InputGesture="Delete" />
|
||||
</ContextMenu>
|
||||
</DataGrid.ContextMenu>
|
||||
|
||||
@@ -112,11 +112,30 @@ public sealed partial class LogWindow : RefreshableWindow
|
||||
|
||||
private void OnKeyDown(object? sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Delete && e.Source is not TextBox)
|
||||
if (e.Source is TextBox)
|
||||
{
|
||||
OnDelete(sender, new RoutedEventArgs());
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
switch (e.Key)
|
||||
{
|
||||
case Key.Delete:
|
||||
e.Handled = true;
|
||||
OnDelete(sender, new RoutedEventArgs());
|
||||
break;
|
||||
case Key.Enter:
|
||||
e.Handled = true;
|
||||
OnEditContact(sender, new RoutedEventArgs());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private async void OnEditContact(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (session.Logging is null || Rows.SelectedItem is not LogRow row)
|
||||
{
|
||||
return;
|
||||
}
|
||||
await new EditContactDialog(session.Logging, row.Qso.Id).ShowDialog(this);
|
||||
}
|
||||
|
||||
private async void OnDelete(object? sender, RoutedEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user