Commit Graph

17924 Commits

Author SHA1 Message Date
John Ralls
6e84ccac75 Move GncSqlColumnTypeHandler functions into GncSqlColumnTableEntry.
Unfortunately a rather massive change. Gets rid of GncSqlColumnTypeHandler
and its hideous run-time registry by making the handler functions members
of GncSqlColumnTableEntry. GncSqlColumnTableEntry becomes an abstract super-
class with a templatized subclass GncSqlColumnTableEntryImpl whose template
parameter is the GncSqlObjectType that's also the GncSqlColumnTableEntryImpl's
m_col_type member. That member is a candidate for future removal as it's not
necessary. An explicit specialization is provided for each GncSqlObjectType and
that's a candidate for future code-shrinkage as there's still a fair amount
of duplication in spite of adding several helper template functions to absorb
most of the meat. The abstract GncSqlColumnTableEntry class is motivated by
the need to have an iterable container which in turn requires runtime
polymorphism. This can probably be replaced with a variadic-template
pseudo-container.

The two major benefits of this change are that it gets rid of one more set
of macro functions and provides vtable dispatch that has only one level
of indirection instead of the cumbersome string-hash-table-lookup to
find the handler followed by invoking the handler's function.

The two header files are removed because they exposed only the initialization
function which in turn only registered the respective GncSqlColumnTypeHandler.
2016-10-28 10:33:50 -07:00
John Ralls
e20c17b642 Change the object type string defines to an enum.
Because doing unnecessary string compares is dumb.
2016-10-28 10:33:49 -07:00
John Ralls
a716636e00 Convert GncSqlStatement to a virtual class.
Implemented by GncDbiSqlStatement. Use class function semantics.
2016-10-28 10:33:49 -07:00
John Ralls
0d548da223 Create a new set_parameter template function to reduce repetition. 2016-10-28 10:33:49 -07:00
John Ralls
a0ae59a96a Reimplement row retrieval as an iterator on GncSqlResults.
Replaces a much-copied and longish while loop with a simple range-for loop
that's guaranteed not to iterate if the result-set is empty.
2016-10-28 10:33:49 -07:00
John Ralls
576bc8ae7d Don't override an already-set QofBackend error. 2016-10-28 10:33:49 -07:00
John Ralls
8078c41a35 Make GncSqlRow a class and replace GValues with typed transfer functions. 2016-10-28 10:33:49 -07:00
John Ralls
2f0b5ec8fe Remove tabs from gnc-backend-sql*. 2016-10-28 10:33:49 -07:00
John Ralls
7e3ba421d7 Fix potential dereference error.
Thanks Geert Janssens.
2016-10-28 10:33:49 -07:00
John Ralls
7d4ca43fd0 Combine add_colname_to_list and add_gvalue_to_slist into single function add_value_to_vec.
The two lists were always used together so replace them with a single
vector of std::pair<std::string, std::string>; this also gets rid of the
intermediate GValue which was used to convert the returned value to a string.
operator<<() can do that for us more transparently.

Also template most of the add_value_to_vec functions.
2016-10-28 10:33:49 -07:00
John Ralls
96a8a7b99f Make GncSqlColumnTableEntry arrays into std::vectors.
Allows use of range for.
2016-10-28 10:33:48 -07:00
John Ralls
be1a5f56d6 Replace heap-allocate GncSqlColumnInfo GList with on-stack std::vector.
Faster, more concise, can't leak.
2016-10-28 10:33:48 -07:00
John Ralls
72ac25d755 Change GncSqlColumnInfo::m_null_allowed to m_not_null and invert logic.
The COL_NNUL flag is "not null", the SQL table column qualifier is NOT NULL,
and bitwise AND is clearer code than bitwise XOR.
2016-10-28 10:33:48 -07:00
John Ralls
611f210a07 Provide constructors for GncSqlColumnInfo, change variable names to m_ prefix. 2016-10-28 10:33:48 -07:00
John Ralls
049b905d86 Replace qof_object_foo_backend with c++ native containers.
Since C++ provides find and for_each on native containers there's no need
for a hand-rolled version in libqof.
2016-10-28 10:33:48 -07:00
John Ralls
a808525d05 Fix free of non-malloced memory crash in SQL save slots. 2016-10-27 16:25:56 -07:00
John Ralls
1e5f245900 Merge convert GUID from inheriting boost::guid to composition. 2016-10-25 11:49:48 -07:00
lmat
85770afb8e Replaced inheritance from boost uuid with composition
Rather than extending boost::uuids::uuid, we add a boost::uuids::uuid
member to handle the implementation of equality checking, uuid
generation, etc.
2016-10-25 12:36:53 -04:00
John Ralls
5fcdfba69c Bug 769124 - Australian (GMT-10) OFX transactions imported have previous
day's date. Previous efforts didn't work on Windows and shouldn't have
elsewhere because gnc_localtime and gnc_mktime are inverse functions;
in particular gnc_mktime doesn't adjust the time based on the value
of tm_isdst, though some implementations of STDC mktime do.

Rather than being too clever about trying to find the DST offset this
implementation just uses 1 hour.
2016-10-24 11:21:12 +11:00
lmat
0a5a0ab7ab Separate C guid from C++ guid 2016-10-21 17:19:58 -04:00
John Ralls
6695ef9585 Bug 769124 - Australian (GMT-10) OFX transactions imported have previous days date.
Fix on Windows, where the test failed to build.
2016-10-20 10:40:18 -07:00
lmat
e1e85cee16 Added forward declaration for struct GncGUID
I also removed the guid.hpp include where I could.
2016-10-19 17:05:48 -04:00
Rob.Gowin
c68452a497 Remove configuration of HAVE_PUTENV.
The Python includes files for Windows define HAVE_PUTENV to be
empty. GnuCash under MINGW (only) defines it to be 1. This causes
redefinition errors when building the Python bindings on Windows.
HAVE_PUTENV is not used in the GnuCash code base, so the best
solution seems to be to just get rid of it.
2016-10-14 14:17:04 -05:00
Geert Janssens
3877c03ee7 Merge branch 'maint' 2016-10-10 13:55:35 +02:00
Geert Janssens
38e6d7f7ce Bug 771617 - Build fails because test test-report-utilities is sensitive to time of day/timezone
Previous commit was working with years and monts potentially outside the supported range.
2016-10-10 12:28:49 +02:00
Geert Janssens
c5414e336a Merge branch 'maint' 2016-10-10 11:57:03 +02:00
Geert Janssens
6bdac283fa Bug 771617 - Build fails because test test-report-utilities is sensitive to time of day/timezone
Use the date-time functions in gnc-date instead of the guile ones for more consistent behaviour.
Do the same for test test-cash-flow, which was also time-of-day sensitive
2016-10-10 11:49:10 +02:00
John Ralls
20c0271e98 Fix CSV importer to handle GMT + 13 Timezone (New Zealand Daylight Time).
Also remove special time calculations and use gnc_dmy2timespec_neutral()
for consistency with rest of GnuCash.
2016-10-09 10:52:55 +02:00
John Ralls
b00694fde4 Bug 772382 - Date off-by-one after DST change
The time needs to be 10:59, not 11:00: 13 hours after 11:00 is 24:00,
which is really 00:00 the next day.
2016-10-09 10:52:55 +02:00
Christian Stimming
6e132d83fd Get cutecash to compile/link again.
To my surprise the C++/Qt executable still compiles, links, and run.
2016-10-05 22:19:29 +02:00
John Ralls
901c89dffa Fix CSV importer to handle GMT + 13 Timezone (New Zealand Daylight Time).
Also remove special time calculations and use gnc_dmy2timespec_neutral()
for consistency with rest of GnuCash.
2016-10-04 20:01:10 +02:00
John Ralls
5a7c791c96 Bug 772382 - Date off-by-one after DST change
The time needs to be 10:59, not 11:00: 13 hours after 11:00 is 24:00,
which is really 00:00 the next day.
2016-10-04 20:01:10 +02:00
Geert Janssens
87ed53b347 Merge branch 'maint' 2016-10-03 19:55:07 +02:00
Ralf Habacker
cd8182fc6f Fix broken german account template 'Kontenrahmen für Wohnungswirtschaft'.
The root node was not used as parent in any other account.

This issue has been detected on updating account templates
into kmymoney sources.
2016-10-03 19:48:45 +02:00
Geert Janssens
c605e4415f Bug 771617 - Build fails because test test-report-utilities is sensitive to time of day/timezone
This commit makes the test work in all timezones from -11 to +10. Timezone +11 still fails, but that's the compromise we have made in the rest of gnucash as well.
2016-10-03 17:41:11 +02:00
Geert Janssens
127adb4a7c Bug 772313 - Invalid DOCTYPE in report generation 2016-10-02 12:08:34 +02:00
Robert Fewell
921b5a9f3f Change all key accelerators to use <primary>
Change from using <control> to <primary> for part of key accelerator
definitions. This will map the accelerator to Command on OSX and to
Control for anything else
2016-09-27 21:16:32 +02:00
Robert Fewell
1615fe5bc0 Add find account to register2 to keep in sync 2016-09-27 21:16:32 +02:00
Robert Fewell
a1f45958b3 Hide the radio buttons when searching full tree
When the dialogue is started from the menu bar, all accounts will be
searchable and so hide the 'Search from' radio buttons. These are only
displayed when the started from the context menu.
2016-09-27 21:16:32 +02:00
Robert Fewell
08c7140b12 Change from using icon-name to stock-id
Changed from using icon images as they are not installed on Windows.
2016-09-27 21:16:32 +02:00
Robert Fewell
fa33f5d4d0 Change Find Account menu item to the Edit Menu 2016-09-27 21:16:32 +02:00
Robert Fewell
1a5f01290b Make sure the parent accounts are overridden
When the account is overridden, all the parents also need to be
overridden to allow the tree-model filter to show the tree-model leaf.
2016-09-27 21:16:32 +02:00
Robert Fewell
760e30f136 Change from using toggle cell renderer to pixbuf 2016-09-27 21:16:32 +02:00
Robert Fewell
3af55b0d8c Add columns for account not used and zero balances
For completeness add columns to indicate that accounts are not used or
have zero balances which may of been filtered.
2016-09-27 21:16:32 +02:00
Robert Fewell
7890970f29 Update to use the account tree filter override.
These changes allow the account to be selected in the account tree as
the filter is temporarily overridden.
2016-09-27 21:16:32 +02:00
Robert Fewell
5f6f0231ce Add account tree filter override
With this addition it is possible to jump to an account that would not
normally be shown in the tree. This is only valid for the session.
2016-09-27 21:16:32 +02:00
Robert Fewell
a8770a4d26 Add option to find an account in list of accounts
This update adds the option to search for an account in an account list
and once selected it will jump to that account in the Account Treeview
or if it is a hidden account the account editor will open.
2016-09-27 21:16:32 +02:00
Rob Gowin
c599bf3c0b Use default PKG_CHECK_MODULES for CMake version > 3.4 2016-09-27 11:24:36 -05:00
John Ralls
ba002bbec4 Fix test failure when in Spain.
It turns out that some timezones use local time for pre-1900 dates in
the 32bit timezone file, too.
2016-09-27 15:19:08 +02:00
John Ralls
fd37051865 gnc-timezone: Enable POSIX-style timezone strings on Unix systems.
E.g. CEST01CEDT,M4.1.0,M10.1.0.

Also reorder priority of finding TZ information: Passed-in timezone string
is tried first; if that's empty or fails, try the TZ variable, then
/etc/localtime, and finally give up and use UTC. Exceptions never leave
GncTimeZoneProvider and *some* timezone is always returned.

Provide a new test for posix timezones and invert the exception test.
2016-09-27 15:17:39 +02:00