Add warnings to the "Jump" operation instead of doing nothing

pull/1657/head
Simon Arlott 3 years ago
parent 76b2575848
commit bdf7c36d7d
No known key found for this signature in database
GPG Key ID: DF001BFD83E75990

@ -4897,6 +4897,10 @@ jump_multiple_splits_by_single_account (Account *account, Split *split)
other_split = s;
}
// Jump to the same account so that the right warning is triggered
if (!other_split)
other_split = split;
return other_split;
}
@ -4938,6 +4942,10 @@ jump_multiple_splits_by_value (Account *account, Split *split, gboolean largest)
other_split = s;
}
// Jump to the same account so that the right warning is triggered
if (!other_split)
other_split = split;
return other_split;
}
@ -5039,6 +5047,20 @@ gnc_plugin_page_register_cmd_jump (GSimpleAction *simple,
}
if (other_split == NULL)
{
GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW(window),
(GtkDialogFlags)(GTK_DIALOG_MODAL
| GTK_DIALOG_DESTROY_WITH_PARENT),
GTK_MESSAGE_ERROR,
GTK_BUTTONS_NONE,
"%s",
_("Unable to jump to other account"));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG(dialog),
"%s", _("This transaction involves more than one other account. Select a specific split to jump to that account."));
gtk_dialog_add_button (GTK_DIALOG(dialog), _("_OK"), GTK_RESPONSE_OK);
gnc_dialog_run (GTK_DIALOG(dialog), GNC_PREF_WARN_REG_TRANS_JUMP_MULTIPLE_SPLITS);
gtk_widget_destroy (dialog);
LEAVE ("no split (2)");
return;
}
@ -5054,6 +5076,20 @@ gnc_plugin_page_register_cmd_jump (GSimpleAction *simple,
if (account == leader)
{
GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW(window),
(GtkDialogFlags)(GTK_DIALOG_MODAL
| GTK_DIALOG_DESTROY_WITH_PARENT),
GTK_MESSAGE_ERROR,
GTK_BUTTONS_NONE,
"%s",
_("Unable to jump to other account"));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG(dialog),
"%s", _("This transaction only involves the current account so there is no other account to jump to."));
gtk_dialog_add_button (GTK_DIALOG(dialog), _("_OK"), GTK_RESPONSE_OK);
gnc_dialog_run (GTK_DIALOG(dialog), GNC_PREF_WARN_REG_TRANS_JUMP_SINGLE_ACCOUNT);
gtk_widget_destroy (dialog);
LEAVE ("register open for account");
return;
}

@ -124,6 +124,16 @@
<summary>Commit changes to a transaction</summary>
<description>This dialog is presented when you attempt to move out of a modified transaction. The changed data must be either saved or discarded.</description>
</key>
<key name="reg-trans-jump-multiple-splits" type="i">
<default>0</default>
<summary>Jump when there are multiple other accounts</summary>
<description>This dialog is presented when you are unable to jump on a transaction because it has splits for multiple other accounts. A specific split must be selected to jump to the other account.</description>
</key>
<key name="reg-trans-jump-single-account" type="i">
<default>0</default>
<summary>Jump when there are no other accounts</summary>
<description>This dialog is presented when you are unable to jump on a transaction because it only has splits for the current account.</description>
</key>
</schema>
<schema id="org.gnucash.GnuCash.warnings.temporary" path="/org/gnucash/GnuCash/warnings/temporary/">
@ -247,5 +257,15 @@
<summary>Commit changes to a transaction</summary>
<description>This dialog is presented when you attempt to move out of a modified transaction. The changed data must be either saved or discarded.</description>
</key>
<key name="reg-trans-jump-multiple-splits" type="i">
<default>0</default>
<summary>Jump when there are multiple other accounts</summary>
<description>This dialog is presented when you are unable to jump on a transaction because it has splits for multiple other accounts. A specific split must be selected to jump to the other account.</description>
</key>
<key name="reg-trans-jump-single-account" type="i">
<default>0</default>
<summary>Jump when there are no other accounts</summary>
<description>This dialog is presented when you are unable to jump on a transaction because it only has splits for the current account.</description>
</key>
</schema>
</schemalist>

Loading…
Cancel
Save