Commit
Separate the "All noncurrency" convenience category in the commodity selector and the default non-commodity namespace proposed by the QIF importer because they have different functions. Also remove the namespace guessing code from qif-dialog because with only one default non-currency namespace there's nothing to guess.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -724,6 +724,11 @@ | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
(define (qif-dialog:default-namespace qif-symbol qif-type prefs) | ||
|
||
(define (currency_ns? ns) | ||
(or (string=? (GNC-COMMODITY-NS-CURRENCY) ns) | ||
(string=? (GNC-COMMODITY-NS-LEGACY) ns) | ||
(string=? (GNC-COMMODITY-NS-ISO4217) ns))) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jralls
Author
Member
|
||
|
||
;; Guess a namespace based on the symbol alone. | ||
(define (guess-by-symbol s) | ||
(if (string? s) | ||
|
@@ -736,28 +741,19 @@ | |
;; compatible with the QIF type? | ||
(and (string=? s (caddr elt)) | ||
(not (and (string? qif-type) | ||
(string=? GNC_COMMODITY_NS_NONCURRENCY | ||
(cadr elt)) | ||
(not (currency_ns? (cadr elt)) | ||
This comment has been minimized.
Sorry, something went wrong.
christopherlam
Contributor
|
||
(or (string-ci=? qif-type "stock") | ||
(string-ci=? qif-type "etf")))))) | ||
(string-ci=? qif-type "etf") | ||
(string-ci=? qif-type "mutual fund") | ||
(string-ci=? qif-type "index") | ||
))))) | ||
prefs) | ||
#f))) | ||
#f)))) | ||
;; If a preferences match was found, use its namespace. | ||
(if pref-match (cadr pref-match)) | ||
;; There's no symbol. Default to a fund. | ||
GNC_COMMODITY_NS_NONCURRENCY))) | ||
|
||
;; Was a QIF type given? | ||
(if (string? qif-type) | ||
;; Yes. We might be able to definitely determine the namespace. | ||
(if (or | ||
(string-ci=? qif-type "mutual fund") | ||
(string-ci=? qif-type "index")) | ||
GNC_COMMODITY_NS_NONCURRENCY | ||
(guess-by-symbol qif-symbol))) | ||
|
||
;; No QIF type was given, so guess a | ||
;; default namespace by symbol alone. | ||
(if pref-match (cadr pref-match))) | ||
;; There's no symbol. Use the built-in default. | ||
(GNC-COMMODITY-NS-NONCURRENCY))) | ||
|
||
(guess-by-symbol qif-symbol)) | ||
|
||
|
||
|
2 comments
on commit 109efe6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't object to changing the var names to use underscore. If we care about assisting hidden report writers then we could add something like (untested):
(define-syntax-rule GNC_COMMODITY_NS_CURRENCY
(begin
(issue-deprecation-warning "GNC_COMMODITY_NS_CURRENCY is no longer in use. ")
"CURRENCY"))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be a better message to say use (GNC-COMMODITY-NS-CURRENCY) instead
?
guile compiler complains
GNC-COMMODITY-NS-ISO4217
is undefined.