Don't set the `id` of the duplicated row to the latest new id, but rather just to the `id` of the line we're duplicating from.
Disable the copy menu item when no item is selected in the listview