mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Made changes to preset column types to align with other changes
These changes are to align with the changes to column types and also the basic setup of the new commodity from and currency to combo's. More changes will follow to make the saving and loading work properly.
This commit is contained in:
parent
bf0c3853ac
commit
cd4b5a3100
@ -63,6 +63,8 @@ const std::string gnc_exp{N_("GnuCash Export Format")};
|
||||
#define CSV_COL_TYPES "ColumnTypes"
|
||||
#define CSV_COL_WIDTHS "ColumnWidths"
|
||||
#define CSV_ACCOUNT "BaseAccount"
|
||||
#define CSV_TO_CURR "PriceToCurrency"
|
||||
#define CSV_FROM_COMM "PriceFromCommodity"
|
||||
|
||||
G_GNUC_UNUSED static QofLogModule log_module = GNC_MOD_IMPORT;
|
||||
|
||||
@ -111,9 +113,8 @@ static std::shared_ptr<CsvTransSettings> create_int_gnc_exp_preset(void)
|
||||
preset->m_column_types_price = {
|
||||
GncPricePropType::DATE,
|
||||
GncPricePropType::AMOUNT,
|
||||
GncPricePropType::CURRENCY_FROM,
|
||||
GncPricePropType::CURRENCY_TO,
|
||||
GncPricePropType::SYMBOL_FROM
|
||||
GncPricePropType::FROM_COMMODITY,
|
||||
GncPricePropType::TO_CURRENCY,
|
||||
};
|
||||
|
||||
return preset;
|
||||
@ -266,6 +267,22 @@ CsvTransSettings::load (void)
|
||||
if (key_char)
|
||||
g_free (key_char);
|
||||
|
||||
key_char = g_key_file_get_string (keyfile, group.c_str(), CSV_TO_CURR, &key_error);
|
||||
if (key_char && *key_char != '\0')
|
||||
//FIXME m_to_currency = gnc_account_lookup_by_full_name (gnc_get_current_root_account(), key_char);
|
||||
m_to_currency = nullptr;
|
||||
m_load_error |= handle_load_error (&key_error, group);
|
||||
if (key_char)
|
||||
g_free (key_char);
|
||||
|
||||
key_char = g_key_file_get_string (keyfile, group.c_str(), CSV_FROM_COMM, &key_error);
|
||||
if (key_char && *key_char != '\0')
|
||||
//FIXME m_from_commodity = gnc_account_lookup_by_full_name (gnc_get_current_root_account(), key_char);
|
||||
m_from_commodity = nullptr;
|
||||
m_load_error |= handle_load_error (&key_error, group);
|
||||
if (key_char)
|
||||
g_free (key_char);
|
||||
|
||||
m_column_types.clear();
|
||||
gsize list_len;
|
||||
gchar** col_types_str = g_key_file_get_string_list (keyfile, group.c_str(), CSV_COL_TYPES,
|
||||
@ -361,6 +378,12 @@ CsvTransSettings::save (void)
|
||||
if (m_base_account)
|
||||
g_key_file_set_string (keyfile, group.c_str(), CSV_ACCOUNT, gnc_account_get_full_name(m_base_account));
|
||||
|
||||
if (m_to_currency)
|
||||
g_key_file_set_string (keyfile, group.c_str(), CSV_TO_CURR, gnc_commodity_get_fullname(m_to_currency));
|
||||
|
||||
if (m_from_commodity)
|
||||
g_key_file_set_string (keyfile, group.c_str(), CSV_FROM_COMM, gnc_commodity_get_fullname(m_from_commodity));
|
||||
|
||||
std::vector<const char*> col_types_str;
|
||||
for (auto col_type : m_column_types)
|
||||
col_types_str.push_back(gnc_csv_col_type_strs[col_type]);
|
||||
|
@ -31,6 +31,7 @@
|
||||
extern "C" {
|
||||
#include <config.h>
|
||||
#include "Account.h"
|
||||
#include "gnc-commodity.h"
|
||||
}
|
||||
|
||||
#include <string>
|
||||
@ -53,8 +54,8 @@ struct CsvTransSettings
|
||||
CsvTransSettings() : m_file_format (GncImpFileFormat::CSV), m_encoding {"UTF-8"},
|
||||
m_multi_split (false), m_date_format {0}, m_currency_format {0},
|
||||
m_skip_start_lines{0}, m_skip_end_lines{0}, m_skip_alt_lines (false),
|
||||
m_separators {","}, m_base_account {nullptr},
|
||||
m_load_error {false} { }
|
||||
m_separators {","}, m_base_account {nullptr}, m_to_currency {nullptr},
|
||||
m_from_commodity {nullptr}, m_load_error {false} { }
|
||||
|
||||
/** Save the gathered widget properties to a key File.
|
||||
*
|
||||
@ -97,6 +98,9 @@ std::vector<GncTransPropType> m_column_types; // The Column types in order
|
||||
std::vector<GncPricePropType> m_column_types_price; // The Column Price types in order
|
||||
std::vector<uint32_t> m_column_widths; // The Column widths
|
||||
|
||||
gnc_commodity *m_to_currency; // Price To Currency
|
||||
gnc_commodity *m_from_commodity; // Price From Commodity
|
||||
|
||||
bool m_load_error; // Was there an error while parsing the state file ?
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user