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:
Robert Fewell 2017-12-01 12:03:14 +00:00
parent 644a0aa06f
commit 71bf7d01fd
10 changed files with 59 additions and 59 deletions

View File

@ -17,7 +17,7 @@ SET(csv_import_SOURCES
gnc-csv-account-map.c
gnc-csv-gnumeric-popup.c
gnc-csv-tokenizer.cpp
gnc-csv-trans-settings.cpp
gnc-csv-import-settings.cpp
gnc-dummy-tokenizer.cpp
gnc-fw-tokenizer.cpp
gnc-price-import.cpp
@ -45,7 +45,7 @@ SET(csv_import_noinst_HEADERS
gnc-csv-account-map.h
gnc-csv-gnumeric-popup.h
gnc-csv-tokenizer.hpp
gnc-csv-trans-settings.hpp
gnc-csv-import-settings.hpp
gnc-dummy-tokenizer.hpp
gnc-fw-tokenizer.hpp
gnc-price-import.hpp

View File

@ -19,7 +19,7 @@ libgncmod_csv_import_la_SOURCES = \
gnc-tokenizer.cpp \
gnc-tx-import.cpp \
gnc-trans-props.cpp \
gnc-csv-trans-settings.cpp
gnc-csv-import-settings.cpp
noinst_HEADERS = \
assistant-csv-account-import.h \
@ -37,7 +37,7 @@ noinst_HEADERS = \
gnc-tokenizer.hpp \
gnc-tx-import.hpp \
gnc-trans-props.hpp \
gnc-csv-trans-settings.hpp
gnc-csv-import-settings.hpp
libgncmod_csv_import_la_LDFLAGS = -avoid-version

View File

@ -52,7 +52,7 @@ extern "C"
#include "go-charmap-sel.h"
}
#include "gnc-csv-trans-settings.hpp"
#include "gnc-csv-import-settings.hpp"
#include "gnc-price-import.hpp"
#include "gnc-fw-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));
// Append the default entry
auto presets = get_trans_presets (settings_type);
auto presets = get_import_presets (settings_type);
for (auto preset : presets)
{
GtkTreeIter iter;
@ -766,11 +766,11 @@ void CsvImpPriceAssist::preview_handle_save_del_sensitivity (GtkComboBox* combo)
/* Handle sensitivity of the delete and save button */
if (gtk_combo_box_get_active_iter (combo, &iter))
{
CsvTransSettings *preset;
CsvImportSettings *preset;
GtkTreeModel *model = gtk_combo_box_get_model (combo);
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 */
can_delete = true;
@ -778,7 +778,7 @@ void CsvImpPriceAssist::preview_handle_save_del_sensitivity (GtkComboBox* combo)
}
}
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;
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))
return;
CsvTransSettings *preset = nullptr;
CsvImportSettings *preset = nullptr;
auto model = gtk_combo_box_get_model (settings_combo);
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))
return;
CsvTransSettings *preset = nullptr;
CsvImportSettings *preset = nullptr;
auto model = gtk_combo_box_get_model (settings_combo);
gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1);
@ -868,7 +868,7 @@ CsvImpPriceAssist::preview_settings_save ()
while (valid)
{
// Walk through the list, reading each row
CsvTransSettings *preset;
CsvImportSettings *preset;
gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1);
if (preset && (preset->m_name == std::string(new_name)))

View File

@ -58,7 +58,7 @@ extern "C"
#include "go-charmap-sel.h"
}
#include "gnc-csv-trans-settings.hpp"
#include "gnc-csv-import-settings.hpp"
#include "gnc-tx-import.hpp"
#include "gnc-fw-tokenizer.hpp"
#include "gnc-csv-tokenizer.hpp"
@ -679,7 +679,7 @@ void CsvImpTransAssist::preview_populate_settings_combo()
// Append the default entry
auto presets = get_trans_presets (settings_type);
auto presets = get_import_presets (settings_type);
for (auto preset : presets)
{
GtkTreeIter iter;
@ -707,11 +707,11 @@ void CsvImpTransAssist::preview_handle_save_del_sensitivity (GtkComboBox* combo)
/* Handle sensitivity of the delete and save button */
if (gtk_combo_box_get_active_iter (combo, &iter))
{
CsvTransSettings *preset;
CsvImportSettings *preset;
GtkTreeModel *model = gtk_combo_box_get_model (combo);
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 */
can_delete = true;
@ -719,7 +719,7 @@ void CsvImpTransAssist::preview_handle_save_del_sensitivity (GtkComboBox* combo)
}
}
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;
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))
return;
CsvTransSettings *preset = nullptr;
CsvImportSettings *preset = nullptr;
auto model = gtk_combo_box_get_model (settings_combo);
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))
return;
CsvTransSettings *preset = nullptr;
CsvImportSettings *preset = nullptr;
auto model = gtk_combo_box_get_model (settings_combo);
gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1);
@ -812,7 +812,7 @@ CsvImpTransAssist::preview_settings_save ()
while (valid)
{
// Walk through the list, reading each row
CsvTransSettings *preset;
CsvImportSettings *preset;
gtk_tree_model_get (model, &iter, SET_GROUP, &preset, -1);
if (preset && (preset->m_name == std::string(new_name)))

View File

@ -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 *
* *
@ -20,13 +20,13 @@
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
* Boston, MA 02110-1301, USA gnu@gnu.org *
\********************************************************************/
/** @file gnc-csv-trans-settings.c
/** @file gnc-csv-import-settings.c
@brief CSV Import Settings
@author Copyright (c) 2014 Robert Fewell
@author Copyright (c) 2016 Geert Janssens
*/
#include "gnc-csv-trans-settings.hpp"
#include "gnc-csv-import-settings.hpp"
#include <sstream>
extern "C"
@ -70,18 +70,18 @@ G_GNUC_UNUSED static QofLogModule log_module = GNC_MOD_IMPORT;
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_settings_type = set_type;
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_skip_start_lines = 1;
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
* 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
@ -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 */
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_name = preset_name;
preset->load();
@ -166,7 +166,7 @@ const preset_vec& get_trans_presets (const std::string& set_type)
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) ||
(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
**************************************************/
bool
CsvTransSettings::load (void)
CsvImportSettings::load (void)
{
if (trans_preset_is_reserved_name (m_name))
if (preset_is_reserved_name (m_name))
return true;
GError *key_error = nullptr;
@ -355,9 +355,9 @@ CsvTransSettings::load (void)
* save settings to a key file
**************************************************/
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());
return true;
@ -471,9 +471,9 @@ CsvTransSettings::save (void)
}
void
CsvTransSettings::remove (void)
CsvImportSettings::remove (void)
{
if (trans_preset_is_reserved_name (m_name))
if (preset_is_reserved_name (m_name))
return;
auto keyfile = gnc_state_get_current ();
@ -483,7 +483,7 @@ CsvTransSettings::remove (void)
bool
CsvTransSettings::read_only (void)
CsvImportSettings::read_only (void)
{
return ((m_name == no_settings) ||
(m_name == _(no_settings.c_str())) ||

View File

@ -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 *
* *
@ -20,13 +20,13 @@
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
* Boston, MA 02110-1301, USA gnu@gnu.org *
\********************************************************************/
/** @file gnc-csv-trans-settings.h
/** @file gnc-csv-import-settings.h
@brief CSV Import Settings
@author Copyright (c) 2014 Robert Fewell
@author Copyright (c) 2016 Geert Janssens
*/
#ifndef GNC_CSV_TRANS_SETTINGS_H
#define GNC_CSV_TRANS_SETTINGS_H
#ifndef GNC_CSV_IMPORT_SETTINGS_H
#define GNC_CSV_IMPORT_SETTINGS_H
extern "C" {
#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 */
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_skip_start_lines{0}, m_skip_end_lines{0}, m_skip_alt_lines (false),
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
};
using preset_vec = std::vector<std::shared_ptr<CsvTransSettings>>;
/** Creates a vector of CsvTransSettings which combines
using preset_vec = std::vector<std::shared_ptr<CsvImportSettings>>;
/** Creates a vector of CsvImportSettings which combines
* - one or more internally defined presets
* - 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.
*/
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.
* The names of the internal presets are considered reserved.
* 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

View File

@ -42,7 +42,7 @@ extern "C" {
#include "gnc-price-props.hpp"
#include "gnc-csv-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;
@ -281,7 +281,7 @@ void GncPriceImport::separators (std::string 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 */
file_format (settings.m_file_format);
@ -315,7 +315,7 @@ void GncPriceImport::settings (const CsvTransSettings& 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;
/* separators are already copied to m_settings in the separators

View File

@ -42,7 +42,7 @@ extern "C" {
#include "gnc-tokenizer.hpp"
#include "gnc-price-props.hpp"
#include "gnc-csv-trans-settings.hpp"
#include "gnc-csv-import-settings.hpp"
#include <boost/optional.hpp>
/* A set of currency formats that the user sees. */
@ -110,7 +110,7 @@ public:
void separators (std::string separators);
std::string separators ();
void settings (const CsvTransSettings& settings);
void settings (const CsvImportSettings& settings);
bool save_settings ();
void settings_name (std::string name);
@ -157,7 +157,7 @@ private:
void update_price_props (uint32_t row, uint32_t col, GncPricePropType prop_type);
struct CsvTranSettings;
CsvTransSettings m_settings;
CsvImportSettings m_settings;
bool m_skip_errors;
bool m_over_write;
};

View File

@ -39,7 +39,7 @@ extern "C" {
#include "gnc-trans-props.hpp"
#include "gnc-csv-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;
@ -293,7 +293,7 @@ void GncTxImport::separators (std::string 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 */
file_format (settings.m_file_format);
@ -329,7 +329,7 @@ void GncTxImport::settings (const CsvTransSettings& 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;
/* separators are already copied to m_settings in the separators

View File

@ -43,7 +43,7 @@ extern "C" {
#include "gnc-tokenizer.hpp"
#include "gnc-trans-props.hpp"
#include "gnc-csv-trans-settings.hpp"
#include "gnc-csv-import-settings.hpp"
#include <boost/optional.hpp>
@ -136,7 +136,7 @@ public:
void separators (std::string separators);
std::string separators ();
void settings (const CsvTransSettings& settings);
void settings (const CsvImportSettings& settings);
bool save_settings ();
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);
struct CsvTranSettings;
CsvTransSettings m_settings;
CsvImportSettings m_settings;
bool m_skip_errors;
bool m_req_mapped_accts;