mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-16 18:25:11 -06:00
[options] Enable registering an absolute date option.
This commit is contained in:
parent
cf2870b71a
commit
0213787a2f
@ -929,10 +929,14 @@ gnc_register_date_option(GncOptionDB* db,
|
||||
RelativeDatePeriodVec& period_set,
|
||||
bool both)
|
||||
{
|
||||
auto is_absolute = period_set.size() == 1 &&
|
||||
period_set.front() == RelativeDatePeriod::ABSOLUTE;
|
||||
auto ui_type = both ? GncOptionUIType::DATE_BOTH :
|
||||
GncOptionUIType::DATE_RELATIVE;
|
||||
is_absolute ? GncOptionUIType::DATE_ABSOLUTE : GncOptionUIType::DATE_RELATIVE;
|
||||
GncOption option{GncOptionDateValue(section, name, key, doc_string,
|
||||
ui_type, period_set)};
|
||||
if (is_absolute)
|
||||
option.set_default_value(gnc_time(nullptr));
|
||||
db->register_option(section, std::move(option));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user