AUDIT: r17654 - gnucash/trunk/src/register/ledger-core - Bug #128774: Try to fix "edit exchange rate" context menu disfunctionality

Christian Stimming cstim at cvs.gnucash.org
Sat Oct 25 16:05:21 EDT 2008


Author: cstim
Date: 2008-10-25 16:05:20 -0400 (Sat, 25 Oct 2008)
New Revision: 17654
Trac: http://svn.gnucash.org/trac/changeset/17654

Modified:
   gnucash/trunk/src/register/ledger-core/split-register-control.c
Log:
Bug #128774: Try to fix "edit exchange rate" context menu disfunctionality

Patch by andi5: The logic to determine whether there is an exchange rate
dialog to be showed is complex and should not run when you user traverses
her register. This patch adds a bit more information for the user where
this logic previously silently returned without action.

Comment from i18n maintainer (cstim): The bug in question is severe enough to
justify new strings here. Just go ahead and add more explanatory messages
as needed.
BP

Modified: gnucash/trunk/src/register/ledger-core/split-register-control.c
===================================================================
--- gnucash/trunk/src/register/ledger-core/split-register-control.c	2008-10-25 19:58:52 UTC (rev 17653)
+++ gnucash/trunk/src/register/ledger-core/split-register-control.c	2008-10-25 20:05:20 UTC (rev 17654)
@@ -1154,6 +1154,11 @@
   /* Make sure we NEED this for this type of register */
   if (!gnc_split_reg_has_rate_cell (reg->type))
   {
+    if (force_dialog)
+    {
+      message = _("This register does not support editing exchange rates.");
+      gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
+    }
     LEAVE("No rate cell.");
     return FALSE;
   }
@@ -1162,6 +1167,11 @@
       reg->table->layout, RATE_CELL);
   if (!rate_cell)
   {
+    if (force_dialog)
+    {
+      message = _("This register does not support editing exchange rates.");
+      gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
+    }
     LEAVE("Null rate cell.");
     return FALSE;
   }
@@ -1181,6 +1191,12 @@
   /* If we're expanded AND a transaction cursor, there is nothing to do */
   if (expanded && cursor_class == CURSOR_CLASS_TRANS)
   {
+    if (force_dialog)
+    {
+      message = _("You need to select a split in order to modify its exchange "
+                  "rate.");
+      gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
+    }
     LEAVE("Expanded with transaction cursor. Nothing to do.");
     return FALSE;
   }
@@ -1189,11 +1205,10 @@
   xfer_acc = gnc_split_register_get_account_always(
       reg, expanded ? XFRM_CELL : MXFRM_CELL);
 
-  message =
-    _("You need to expand the transaction in order to modify its exchange rates.");
-
   /* If this is an un-expanded, multi-split transaction, then warn the user */
   if (force_dialog && !expanded && !xfer_acc) {
+    message = _("You need to expand the transaction in order to modify its "
+                "exchange rates.");
     gnc_error_dialog (gnc_split_register_get_parent (reg), "%s", message);
     LEAVE("%s", message);
     return TRUE;
@@ -1202,6 +1217,11 @@
   /* No account -- don't run the dialog */
   if (!xfer_acc)
   {
+    if (force_dialog)
+    {
+      message = _("The entered account could not be found.");
+      gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
+    }
     LEAVE("No xfer account.");
     return FALSE;
   }
@@ -1233,17 +1253,21 @@
     /* Only proceed with two-split, basic, non-expanded registers */
     if (expanded || osplit == NULL)
     {
+      message = _("The two currencies involved equal each other.");
+      gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
       LEAVE("Register is expanded, or osplit == NULL. Not forcing dialog.");
       return FALSE;
     }
 
     /* If we're forcing, then compare the current account
-     * commodity to the transaction commodity.
+     * commodity to the transaction currency.
      */
     xfer_acc = reg_acc;
     xfer_com = reg_com;
     if (gnc_commodity_equal (txn_cur, xfer_com))
     {
+      message = _("The two currencies involved equal each other.");
+      gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
       LEAVE("Register commodity == txn commodity. Not forcing dialog.");
       return FALSE;
     }
@@ -1256,7 +1280,12 @@
   if (!expanded && osplit &&
       gnc_split_register_split_needs_amount (reg, split) &&
       gnc_split_register_split_needs_amount (reg, osplit)) {
-    gnc_error_dialog (gnc_split_register_get_parent (reg), "%s", message);
+    if (force_dialog)
+    {
+      message = _("You need to expand the transaction in order to modify its "
+                  "exchange rates.");
+      gnc_error_dialog (gnc_split_register_get_parent (reg), "%s", message);
+    }
     LEAVE("%s", message);
     return TRUE;
   }
@@ -1284,6 +1313,11 @@
    */
   if (gnc_numeric_zero_p (amount))
   {
+    if (force_dialog)
+    {
+      message = _("The split's amount is zero, so no exchange rate is needed.");
+      gnc_error_dialog(gnc_split_register_get_parent(reg), "%s", message);
+    }
     LEAVE("Amount is zero. No exchange rate needed.");
     return FALSE;
   }



More information about the gnucash-changes mailing list