Skip to content

Commit

Permalink
Mark future transaction dates as "invalid"
Browse files Browse the repository at this point in the history
MarkAsInvalid() paints a red border around the BTextControl.
We do that now for dates entered by the user that are in the future.
It's not prohibited - maybe someone's workflow has a use for it,
but we point it out subtly.

Future-dates in the transaction list are using gNegativeColor as
text colour to have them stand out similarly.
  • Loading branch information
humdingerb committed Sep 29, 2024
1 parent f4e9d9e commit 93e26e7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/TransactionItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "CBLocale.h"
#include "Database.h"
#include "Preferences.h"
#include "TimeSupport.h"
#include "TransactionData.h"
#include "TransactionLayout.h"

Expand Down Expand Up @@ -122,6 +123,9 @@ TransactionItem::DrawItem(BView* owner, BRect frame, bool complete)
owner->ConstrainClippingRegion(&clip);
locale.DateToString(fDate, string);

if (fDate > GetCurrentDate())
owner->SetHighColor(gNegativeColor);

owner->DrawString(string.String(), BPoint(xpos, ypos - fontFactor));
owner->ConstrainClippingRegion(NULL);

Expand Down

0 comments on commit 93e26e7

Please sign in to comment.