mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Rename gnc-csv-trans-settings.* to gnc-csv-import-settings.*
Change the name of the import settings files as they do not just deal with transactions and all associated required changes.
This commit is contained in:
parent
644a0aa06f
commit
71bf7d01fd
@ -17,7 +17,7 @@ SET(csv_import_SOURCES
|
|||||||
gnc-csv-account-map.c
|
gnc-csv-account-map.c
|
||||||
gnc-csv-gnumeric-popup.c
|
gnc-csv-gnumeric-popup.c
|
||||||
gnc-csv-tokenizer.cpp
|
gnc-csv-tokenizer.cpp
|
||||||
gnc-csv-trans-settings.cpp
|
gnc-csv-import-settings.cpp
|
||||||
gnc-dummy-tokenizer.cpp
|
gnc-dummy-tokenizer.cpp
|
||||||
gnc-fw-tokenizer.cpp
|
gnc-fw-tokenizer.cpp
|
||||||
gnc-price-import.cpp
|
gnc-price-import.cpp
|
||||||
@ -45,7 +45,7 @@ SET(csv_import_noinst_HEADERS
|
|||||||
gnc-csv-account-map.h
|
gnc-csv-account-map.h
|
||||||
gnc-csv-gnumeric-popup.h
|
gnc-csv-gnumeric-popup.h
|
||||||
gnc-csv-tokenizer.hpp
|
gnc-csv-tokenizer.hpp
|
||||||
gnc-csv-trans-settings.hpp
|
gnc-csv-import-settings.hpp
|
||||||
gnc-dummy-tokenizer.hpp
|
gnc-dummy-tokenizer.hpp
|
||||||
gnc-fw-tokenizer.hpp
|
gnc-fw-tokenizer.hpp
|
||||||
gnc-price-import.hpp
|
gnc-price-import.hpp
|
||||||
|
@ -19,7 +19,7 @@ libgncmod_csv_import_la_SOURCES = \
|
|||||||
gnc-tokenizer.cpp \
|
gnc-tokenizer.cpp \
|
||||||
gnc-tx-import.cpp \
|
gnc-tx-import.cpp \
|
||||||
gnc-trans-props.cpp \
|
gnc-trans-props.cpp \
|
||||||
gnc-csv-trans-settings.cpp
|
gnc-csv-import-settings.cpp
|
||||||
|
|
||||||
noinst_HEADERS = \
|
noinst_HEADERS = \
|
||||||
assistant-csv-account-import.h \
|
assistant-csv-account-import.h \
|
||||||
@ -37,7 +37,7 @@ noinst_HEADERS = \
|
|||||||
gnc-tokenizer.hpp \
|
gnc-tokenizer.hpp \
|
||||||
gnc-tx-import.hpp \
|
gnc-tx-import.hpp \
|
||||||
gnc-trans-props.hpp \
|
gnc-trans-props.hpp \
|
||||||
gnc-csv-trans-settings.hpp
|
gnc-csv-import-settings.hpp
|
||||||
|
|
||||||
libgncmod_csv_import_la_LDFLAGS = -avoid-version
|
libgncmod_csv_import_la_LDFLAGS = -avoid-version
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ extern "C"
|
|||||||
#include "go-charmap-sel.h"
|
#include "go-charmap-sel.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "gnc-csv-trans-settings.hpp"
|
#include "gnc-csv-import-settings.hpp"
|
||||||
#include "gnc-price-import.hpp"
|
#include "gnc-price-import.hpp"
|
||||||
#include "gnc-fw-tokenizer.hpp"
|
#include "gnc-fw-tokenizer.hpp"
|
||||||
#include "gnc-csv-tokenizer.hpp"
|
#include "gnc-csv-tokenizer.hpp"
|
||||||
@ -738,7 +738,7 @@ void CsvImpPriceAssist::preview_populate_settings_combo()
|
|||||||
gtk_list_store_clear (GTK_LIST_STORE(model));
|
gtk_list_store_clear (GTK_LIST_STORE(model));
|
||||||
|
|
||||||
// Append the default entry
|
// Append the default entry
|
||||||
auto presets = get_trans_presets (settings_type);
|
auto presets = get_import_presets (settings_type);
|
||||||
for (auto preset : presets)
|
for (auto preset : presets)
|
||||||
{
|
{
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
@ -766,11 +766,11 @@ void CsvImpPriceAssist::preview_handle_save_del_sensitivity (GtkComboBox* combo)
|
|||||||
/* Handle sensitivity of the delete and save button */
|
/* Handle sensitivity of the delete and save button */
|
||||||
if (gtk_combo_box_get_active_iter (combo, &iter))
|
if (gtk_combo_box_get_active_iter (combo, &iter))
|
||||||
{
|
{
|
||||||
CsvTransSettings *preset;
|
CsvImportSettings *preset;
|
||||||
GtkTreeModel *model = gtk_combo_box_get_model (combo);
|
GtkTreeModel *model = gtk_combo_box_get_model (combo);
|
||||||
gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1);
|
gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1);
|
||||||
|
|
||||||
if (preset && !trans_preset_is_reserved_name (preset->m_name))
|
if (preset && !preset_is_reserved_name (preset->m_name))
|
||||||
{
|
{
|
||||||
/* Current preset is not read_only, so buttons can be enabled */
|
/* Current preset is not read_only, so buttons can be enabled */
|
||||||
can_delete = true;
|
can_delete = true;
|
||||||
@ -778,7 +778,7 @@ void CsvImpPriceAssist::preview_handle_save_del_sensitivity (GtkComboBox* combo)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (entry_text && (strlen (entry_text) > 0) &&
|
else if (entry_text && (strlen (entry_text) > 0) &&
|
||||||
!trans_preset_is_reserved_name (std::string(entry_text)))
|
!preset_is_reserved_name (std::string(entry_text)))
|
||||||
can_save = true;
|
can_save = true;
|
||||||
|
|
||||||
gtk_widget_set_sensitive (save_button, can_save);
|
gtk_widget_set_sensitive (save_button, can_save);
|
||||||
@ -807,7 +807,7 @@ CsvImpPriceAssist::preview_settings_load ()
|
|||||||
if (!gtk_combo_box_get_active_iter (settings_combo, &iter))
|
if (!gtk_combo_box_get_active_iter (settings_combo, &iter))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CsvTransSettings *preset = nullptr;
|
CsvImportSettings *preset = nullptr;
|
||||||
auto model = gtk_combo_box_get_model (settings_combo);
|
auto model = gtk_combo_box_get_model (settings_combo);
|
||||||
gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1);
|
gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1);
|
||||||
|
|
||||||
@ -834,7 +834,7 @@ CsvImpPriceAssist::preview_settings_delete ()
|
|||||||
if (!gtk_combo_box_get_active_iter (settings_combo, &iter))
|
if (!gtk_combo_box_get_active_iter (settings_combo, &iter))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CsvTransSettings *preset = nullptr;
|
CsvImportSettings *preset = nullptr;
|
||||||
auto model = gtk_combo_box_get_model (settings_combo);
|
auto model = gtk_combo_box_get_model (settings_combo);
|
||||||
gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1);
|
gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1);
|
||||||
|
|
||||||
@ -868,7 +868,7 @@ CsvImpPriceAssist::preview_settings_save ()
|
|||||||
while (valid)
|
while (valid)
|
||||||
{
|
{
|
||||||
// Walk through the list, reading each row
|
// Walk through the list, reading each row
|
||||||
CsvTransSettings *preset;
|
CsvImportSettings *preset;
|
||||||
gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1);
|
gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1);
|
||||||
|
|
||||||
if (preset && (preset->m_name == std::string(new_name)))
|
if (preset && (preset->m_name == std::string(new_name)))
|
||||||
|
@ -58,7 +58,7 @@ extern "C"
|
|||||||
#include "go-charmap-sel.h"
|
#include "go-charmap-sel.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "gnc-csv-trans-settings.hpp"
|
#include "gnc-csv-import-settings.hpp"
|
||||||
#include "gnc-tx-import.hpp"
|
#include "gnc-tx-import.hpp"
|
||||||
#include "gnc-fw-tokenizer.hpp"
|
#include "gnc-fw-tokenizer.hpp"
|
||||||
#include "gnc-csv-tokenizer.hpp"
|
#include "gnc-csv-tokenizer.hpp"
|
||||||
@ -679,7 +679,7 @@ void CsvImpTransAssist::preview_populate_settings_combo()
|
|||||||
|
|
||||||
// Append the default entry
|
// Append the default entry
|
||||||
|
|
||||||
auto presets = get_trans_presets (settings_type);
|
auto presets = get_import_presets (settings_type);
|
||||||
for (auto preset : presets)
|
for (auto preset : presets)
|
||||||
{
|
{
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
@ -707,11 +707,11 @@ void CsvImpTransAssist::preview_handle_save_del_sensitivity (GtkComboBox* combo)
|
|||||||
/* Handle sensitivity of the delete and save button */
|
/* Handle sensitivity of the delete and save button */
|
||||||
if (gtk_combo_box_get_active_iter (combo, &iter))
|
if (gtk_combo_box_get_active_iter (combo, &iter))
|
||||||
{
|
{
|
||||||
CsvTransSettings *preset;
|
CsvImportSettings *preset;
|
||||||
GtkTreeModel *model = gtk_combo_box_get_model (combo);
|
GtkTreeModel *model = gtk_combo_box_get_model (combo);
|
||||||
gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1);
|
gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1);
|
||||||
|
|
||||||
if (preset && !trans_preset_is_reserved_name (preset->m_name))
|
if (preset && !preset_is_reserved_name (preset->m_name))
|
||||||
{
|
{
|
||||||
/* Current preset is not read_only, so buttons can be enabled */
|
/* Current preset is not read_only, so buttons can be enabled */
|
||||||
can_delete = true;
|
can_delete = true;
|
||||||
@ -719,7 +719,7 @@ void CsvImpTransAssist::preview_handle_save_del_sensitivity (GtkComboBox* combo)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (entry_text && (strlen (entry_text) > 0) &&
|
else if (entry_text && (strlen (entry_text) > 0) &&
|
||||||
!trans_preset_is_reserved_name (std::string(entry_text)))
|
!preset_is_reserved_name (std::string(entry_text)))
|
||||||
can_save = true;
|
can_save = true;
|
||||||
|
|
||||||
gtk_widget_set_sensitive (save_button, can_save);
|
gtk_widget_set_sensitive (save_button, can_save);
|
||||||
@ -752,7 +752,7 @@ CsvImpTransAssist::preview_settings_load ()
|
|||||||
if (!gtk_combo_box_get_active_iter (settings_combo, &iter))
|
if (!gtk_combo_box_get_active_iter (settings_combo, &iter))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CsvTransSettings *preset = nullptr;
|
CsvImportSettings *preset = nullptr;
|
||||||
auto model = gtk_combo_box_get_model (settings_combo);
|
auto model = gtk_combo_box_get_model (settings_combo);
|
||||||
gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1);
|
gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1);
|
||||||
|
|
||||||
@ -779,7 +779,7 @@ CsvImpTransAssist::preview_settings_delete ()
|
|||||||
if (!gtk_combo_box_get_active_iter (settings_combo, &iter))
|
if (!gtk_combo_box_get_active_iter (settings_combo, &iter))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CsvTransSettings *preset = nullptr;
|
CsvImportSettings *preset = nullptr;
|
||||||
auto model = gtk_combo_box_get_model (settings_combo);
|
auto model = gtk_combo_box_get_model (settings_combo);
|
||||||
gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1);
|
gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1);
|
||||||
|
|
||||||
@ -812,7 +812,7 @@ CsvImpTransAssist::preview_settings_save ()
|
|||||||
while (valid)
|
while (valid)
|
||||||
{
|
{
|
||||||
// Walk through the list, reading each row
|
// Walk through the list, reading each row
|
||||||
CsvTransSettings *preset;
|
CsvImportSettings *preset;
|
||||||
gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1);
|
gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1);
|
||||||
|
|
||||||
if (preset && (preset->m_name == std::string(new_name)))
|
if (preset && (preset->m_name == std::string(new_name)))
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*******************************************************************\
|
/*******************************************************************\
|
||||||
* gnc-csv-trans-settings.c -- Save and Load CSV Import Settings *
|
* gnc-csv-import-settings.c -- Save and Load CSV Import Settings *
|
||||||
* *
|
* *
|
||||||
* Copyright (C) 2014 Robert Fewell *
|
* Copyright (C) 2014 Robert Fewell *
|
||||||
* *
|
* *
|
||||||
@ -20,13 +20,13 @@
|
|||||||
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
|
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
|
||||||
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
/** @file gnc-csv-trans-settings.c
|
/** @file gnc-csv-import-settings.c
|
||||||
@brief CSV Import Settings
|
@brief CSV Import Settings
|
||||||
@author Copyright (c) 2014 Robert Fewell
|
@author Copyright (c) 2014 Robert Fewell
|
||||||
@author Copyright (c) 2016 Geert Janssens
|
@author Copyright (c) 2016 Geert Janssens
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "gnc-csv-trans-settings.hpp"
|
#include "gnc-csv-import-settings.hpp"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
@ -70,18 +70,18 @@ G_GNUC_UNUSED static QofLogModule log_module = GNC_MOD_IMPORT;
|
|||||||
|
|
||||||
preset_vec presets;
|
preset_vec presets;
|
||||||
|
|
||||||
static std::shared_ptr<CsvTransSettings> create_int_no_preset(const std::string& set_type)
|
static std::shared_ptr<CsvImportSettings> create_int_no_preset(const std::string& set_type)
|
||||||
{
|
{
|
||||||
auto preset = std::make_shared<CsvTransSettings>();
|
auto preset = std::make_shared<CsvImportSettings>();
|
||||||
preset->m_name = no_settings;
|
preset->m_name = no_settings;
|
||||||
preset->m_settings_type = set_type;
|
preset->m_settings_type = set_type;
|
||||||
|
|
||||||
return preset;
|
return preset;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::shared_ptr<CsvTransSettings> create_int_gnc_exp_preset(void)
|
static std::shared_ptr<CsvImportSettings> create_int_gnc_exp_preset(void)
|
||||||
{
|
{
|
||||||
auto preset = std::make_shared<CsvTransSettings>();
|
auto preset = std::make_shared<CsvImportSettings>();
|
||||||
preset->m_name = gnc_exp;
|
preset->m_name = gnc_exp;
|
||||||
preset->m_skip_start_lines = 1;
|
preset->m_skip_start_lines = 1;
|
||||||
preset->m_multi_split = true;
|
preset->m_multi_split = true;
|
||||||
@ -119,7 +119,7 @@ static std::shared_ptr<CsvTransSettings> create_int_gnc_exp_preset(void)
|
|||||||
* find all settings entries in the state key file
|
* find all settings entries in the state key file
|
||||||
* based on settings type.
|
* based on settings type.
|
||||||
**************************************************/
|
**************************************************/
|
||||||
const preset_vec& get_trans_presets (const std::string& set_type)
|
const preset_vec& get_import_presets (const std::string& set_type)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Search all Groups in the state key file for ones starting with prefix
|
// Search all Groups in the state key file for ones starting with prefix
|
||||||
@ -157,7 +157,7 @@ const preset_vec& get_trans_presets (const std::string& set_type)
|
|||||||
/* Then add all the ones we found in the state file */
|
/* Then add all the ones we found in the state file */
|
||||||
for (auto preset_name : preset_names)
|
for (auto preset_name : preset_names)
|
||||||
{
|
{
|
||||||
auto preset = std::make_shared<CsvTransSettings>();
|
auto preset = std::make_shared<CsvImportSettings>();
|
||||||
preset->m_settings_type = set_type;
|
preset->m_settings_type = set_type;
|
||||||
preset->m_name = preset_name;
|
preset->m_name = preset_name;
|
||||||
preset->load();
|
preset->load();
|
||||||
@ -166,7 +166,7 @@ const preset_vec& get_trans_presets (const std::string& set_type)
|
|||||||
return presets;
|
return presets;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool trans_preset_is_reserved_name (const std::string& name)
|
bool preset_is_reserved_name (const std::string& name)
|
||||||
{
|
{
|
||||||
return ((name == no_settings) ||
|
return ((name == no_settings) ||
|
||||||
(name == _(no_settings.c_str())) ||
|
(name == _(no_settings.c_str())) ||
|
||||||
@ -205,9 +205,9 @@ handle_load_error (GError **key_error, const std::string& group)
|
|||||||
* load the settings from a state key file
|
* load the settings from a state key file
|
||||||
**************************************************/
|
**************************************************/
|
||||||
bool
|
bool
|
||||||
CsvTransSettings::load (void)
|
CsvImportSettings::load (void)
|
||||||
{
|
{
|
||||||
if (trans_preset_is_reserved_name (m_name))
|
if (preset_is_reserved_name (m_name))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
GError *key_error = nullptr;
|
GError *key_error = nullptr;
|
||||||
@ -355,9 +355,9 @@ CsvTransSettings::load (void)
|
|||||||
* save settings to a key file
|
* save settings to a key file
|
||||||
**************************************************/
|
**************************************************/
|
||||||
bool
|
bool
|
||||||
CsvTransSettings::save (void)
|
CsvImportSettings::save (void)
|
||||||
{
|
{
|
||||||
if (trans_preset_is_reserved_name (m_name))
|
if (preset_is_reserved_name (m_name))
|
||||||
{
|
{
|
||||||
PWARN ("Ignoring attempt to save to reserved name '%s'", m_name.c_str());
|
PWARN ("Ignoring attempt to save to reserved name '%s'", m_name.c_str());
|
||||||
return true;
|
return true;
|
||||||
@ -471,9 +471,9 @@ CsvTransSettings::save (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CsvTransSettings::remove (void)
|
CsvImportSettings::remove (void)
|
||||||
{
|
{
|
||||||
if (trans_preset_is_reserved_name (m_name))
|
if (preset_is_reserved_name (m_name))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto keyfile = gnc_state_get_current ();
|
auto keyfile = gnc_state_get_current ();
|
||||||
@ -483,7 +483,7 @@ CsvTransSettings::remove (void)
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CsvTransSettings::read_only (void)
|
CsvImportSettings::read_only (void)
|
||||||
{
|
{
|
||||||
return ((m_name == no_settings) ||
|
return ((m_name == no_settings) ||
|
||||||
(m_name == _(no_settings.c_str())) ||
|
(m_name == _(no_settings.c_str())) ||
|
@ -1,5 +1,5 @@
|
|||||||
/*******************************************************************\
|
/*******************************************************************\
|
||||||
* gnc-csv-trans-settings.h -- Save and Load CSV Import Settings *
|
* gnc-csv-import-settings.h -- Save and Load CSV Import Settings *
|
||||||
* *
|
* *
|
||||||
* Copyright (C) 2014 Robert Fewell *
|
* Copyright (C) 2014 Robert Fewell *
|
||||||
* *
|
* *
|
||||||
@ -20,13 +20,13 @@
|
|||||||
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
|
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
|
||||||
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
/** @file gnc-csv-trans-settings.h
|
/** @file gnc-csv-import-settings.h
|
||||||
@brief CSV Import Settings
|
@brief CSV Import Settings
|
||||||
@author Copyright (c) 2014 Robert Fewell
|
@author Copyright (c) 2014 Robert Fewell
|
||||||
@author Copyright (c) 2016 Geert Janssens
|
@author Copyright (c) 2016 Geert Janssens
|
||||||
*/
|
*/
|
||||||
#ifndef GNC_CSV_TRANS_SETTINGS_H
|
#ifndef GNC_CSV_IMPORT_SETTINGS_H
|
||||||
#define GNC_CSV_TRANS_SETTINGS_H
|
#define GNC_CSV_IMPORT_SETTINGS_H
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@ -49,9 +49,9 @@ enum SEP_BUTTON_TYPES {SEP_SPACE, SEP_TAB, SEP_COMMA, SEP_COLON, SEP_SEMICOLON,
|
|||||||
/** Enumeration for the settings combo's */
|
/** Enumeration for the settings combo's */
|
||||||
enum SETTINGS_COL {SET_GROUP, SET_NAME};
|
enum SETTINGS_COL {SET_GROUP, SET_NAME};
|
||||||
|
|
||||||
struct CsvTransSettings
|
struct CsvImportSettings
|
||||||
{
|
{
|
||||||
CsvTransSettings() : m_file_format (GncImpFileFormat::CSV), m_encoding {"UTF-8"},
|
CsvImportSettings() : m_file_format (GncImpFileFormat::CSV), m_encoding {"UTF-8"},
|
||||||
m_multi_split (false), m_date_format {0}, m_currency_format {0},
|
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_skip_start_lines{0}, m_skip_end_lines{0}, m_skip_alt_lines (false),
|
||||||
m_separators {","}, m_load_error {false}, m_base_account {nullptr},
|
m_separators {","}, m_load_error {false}, m_base_account {nullptr},
|
||||||
@ -107,8 +107,8 @@ gnc_commodity *m_to_currency; // Price To Currency
|
|||||||
std::vector<GncPricePropType> m_column_types_price; // The Price Column types in order
|
std::vector<GncPricePropType> m_column_types_price; // The Price Column types in order
|
||||||
};
|
};
|
||||||
|
|
||||||
using preset_vec = std::vector<std::shared_ptr<CsvTransSettings>>;
|
using preset_vec = std::vector<std::shared_ptr<CsvImportSettings>>;
|
||||||
/** Creates a vector of CsvTransSettings which combines
|
/** Creates a vector of CsvImportSettings which combines
|
||||||
* - one or more internally defined presets
|
* - one or more internally defined presets
|
||||||
* - all preset found in the state key file.
|
* - all preset found in the state key file.
|
||||||
*
|
*
|
||||||
@ -117,12 +117,12 @@ using preset_vec = std::vector<std::shared_ptr<CsvTransSettings>>;
|
|||||||
*
|
*
|
||||||
* @return a reference to the populated vector.
|
* @return a reference to the populated vector.
|
||||||
*/
|
*/
|
||||||
const preset_vec& get_trans_presets (const std::string& set_type);
|
const preset_vec& get_import_presets (const std::string& set_type);
|
||||||
|
|
||||||
/** Check whether name can be used as a preset name.
|
/** Check whether name can be used as a preset name.
|
||||||
* The names of the internal presets are considered reserved.
|
* The names of the internal presets are considered reserved.
|
||||||
* A preset with such a name should not be saved or deleted.
|
* A preset with such a name should not be saved or deleted.
|
||||||
*/
|
*/
|
||||||
bool trans_preset_is_reserved_name (const std::string& name);
|
bool preset_is_reserved_name (const std::string& name);
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -42,7 +42,7 @@ extern "C" {
|
|||||||
#include "gnc-price-props.hpp"
|
#include "gnc-price-props.hpp"
|
||||||
#include "gnc-csv-tokenizer.hpp"
|
#include "gnc-csv-tokenizer.hpp"
|
||||||
#include "gnc-fw-tokenizer.hpp"
|
#include "gnc-fw-tokenizer.hpp"
|
||||||
#include "gnc-csv-trans-settings.hpp"
|
#include "gnc-csv-import-settings.hpp"
|
||||||
|
|
||||||
G_GNUC_UNUSED static QofLogModule log_module = GNC_MOD_IMPORT;
|
G_GNUC_UNUSED static QofLogModule log_module = GNC_MOD_IMPORT;
|
||||||
|
|
||||||
@ -281,7 +281,7 @@ void GncPriceImport::separators (std::string separators)
|
|||||||
}
|
}
|
||||||
std::string GncPriceImport::separators () { return m_settings.m_separators; }
|
std::string GncPriceImport::separators () { return m_settings.m_separators; }
|
||||||
|
|
||||||
void GncPriceImport::settings (const CsvTransSettings& settings)
|
void GncPriceImport::settings (const CsvImportSettings& settings)
|
||||||
{
|
{
|
||||||
/* First apply file format as this may recreate the tokenizer */
|
/* First apply file format as this may recreate the tokenizer */
|
||||||
file_format (settings.m_file_format);
|
file_format (settings.m_file_format);
|
||||||
@ -315,7 +315,7 @@ void GncPriceImport::settings (const CsvTransSettings& settings)
|
|||||||
|
|
||||||
bool GncPriceImport::save_settings ()
|
bool GncPriceImport::save_settings ()
|
||||||
{
|
{
|
||||||
if (trans_preset_is_reserved_name (m_settings.m_name))
|
if (preset_is_reserved_name (m_settings.m_name))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* separators are already copied to m_settings in the separators
|
/* separators are already copied to m_settings in the separators
|
||||||
|
@ -42,7 +42,7 @@ extern "C" {
|
|||||||
|
|
||||||
#include "gnc-tokenizer.hpp"
|
#include "gnc-tokenizer.hpp"
|
||||||
#include "gnc-price-props.hpp"
|
#include "gnc-price-props.hpp"
|
||||||
#include "gnc-csv-trans-settings.hpp"
|
#include "gnc-csv-import-settings.hpp"
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
|
|
||||||
/* A set of currency formats that the user sees. */
|
/* A set of currency formats that the user sees. */
|
||||||
@ -110,7 +110,7 @@ public:
|
|||||||
void separators (std::string separators);
|
void separators (std::string separators);
|
||||||
std::string separators ();
|
std::string separators ();
|
||||||
|
|
||||||
void settings (const CsvTransSettings& settings);
|
void settings (const CsvImportSettings& settings);
|
||||||
bool save_settings ();
|
bool save_settings ();
|
||||||
|
|
||||||
void settings_name (std::string name);
|
void settings_name (std::string name);
|
||||||
@ -157,7 +157,7 @@ private:
|
|||||||
void update_price_props (uint32_t row, uint32_t col, GncPricePropType prop_type);
|
void update_price_props (uint32_t row, uint32_t col, GncPricePropType prop_type);
|
||||||
|
|
||||||
struct CsvTranSettings;
|
struct CsvTranSettings;
|
||||||
CsvTransSettings m_settings;
|
CsvImportSettings m_settings;
|
||||||
bool m_skip_errors;
|
bool m_skip_errors;
|
||||||
bool m_over_write;
|
bool m_over_write;
|
||||||
};
|
};
|
||||||
|
@ -39,7 +39,7 @@ extern "C" {
|
|||||||
#include "gnc-trans-props.hpp"
|
#include "gnc-trans-props.hpp"
|
||||||
#include "gnc-csv-tokenizer.hpp"
|
#include "gnc-csv-tokenizer.hpp"
|
||||||
#include "gnc-fw-tokenizer.hpp"
|
#include "gnc-fw-tokenizer.hpp"
|
||||||
#include "gnc-csv-trans-settings.hpp"
|
#include "gnc-csv-import-settings.hpp"
|
||||||
|
|
||||||
G_GNUC_UNUSED static QofLogModule log_module = GNC_MOD_IMPORT;
|
G_GNUC_UNUSED static QofLogModule log_module = GNC_MOD_IMPORT;
|
||||||
|
|
||||||
@ -293,7 +293,7 @@ void GncTxImport::separators (std::string separators)
|
|||||||
}
|
}
|
||||||
std::string GncTxImport::separators () { return m_settings.m_separators; }
|
std::string GncTxImport::separators () { return m_settings.m_separators; }
|
||||||
|
|
||||||
void GncTxImport::settings (const CsvTransSettings& settings)
|
void GncTxImport::settings (const CsvImportSettings& settings)
|
||||||
{
|
{
|
||||||
/* First apply file format as this may recreate the tokenizer */
|
/* First apply file format as this may recreate the tokenizer */
|
||||||
file_format (settings.m_file_format);
|
file_format (settings.m_file_format);
|
||||||
@ -329,7 +329,7 @@ void GncTxImport::settings (const CsvTransSettings& settings)
|
|||||||
bool GncTxImport::save_settings ()
|
bool GncTxImport::save_settings ()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (trans_preset_is_reserved_name (m_settings.m_name))
|
if (preset_is_reserved_name (m_settings.m_name))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* separators are already copied to m_settings in the separators
|
/* separators are already copied to m_settings in the separators
|
||||||
|
@ -43,7 +43,7 @@ extern "C" {
|
|||||||
|
|
||||||
#include "gnc-tokenizer.hpp"
|
#include "gnc-tokenizer.hpp"
|
||||||
#include "gnc-trans-props.hpp"
|
#include "gnc-trans-props.hpp"
|
||||||
#include "gnc-csv-trans-settings.hpp"
|
#include "gnc-csv-import-settings.hpp"
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
|
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ public:
|
|||||||
void separators (std::string separators);
|
void separators (std::string separators);
|
||||||
std::string separators ();
|
std::string separators ();
|
||||||
|
|
||||||
void settings (const CsvTransSettings& settings);
|
void settings (const CsvImportSettings& settings);
|
||||||
bool save_settings ();
|
bool save_settings ();
|
||||||
|
|
||||||
void settings_name (std::string name);
|
void settings_name (std::string name);
|
||||||
@ -190,7 +190,7 @@ private:
|
|||||||
void update_pre_split_props (uint32_t row, uint32_t col, GncTransPropType prop_type);
|
void update_pre_split_props (uint32_t row, uint32_t col, GncTransPropType prop_type);
|
||||||
|
|
||||||
struct CsvTranSettings;
|
struct CsvTranSettings;
|
||||||
CsvTransSettings m_settings;
|
CsvImportSettings m_settings;
|
||||||
bool m_skip_errors;
|
bool m_skip_errors;
|
||||||
bool m_req_mapped_accts;
|
bool m_req_mapped_accts;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user