Bug 495821

Summary: No display of the account hierarchy for reports in the app and when printing
Product: [Applications] kmymoney Reporter: Ralf Habacker <ralf.habacker>
Component: reportsAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: git (master)   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.2
Sentry Crash Report:
Attachments: test file
Screenshot from report exported as html (okay)
Screenshot from report displayed in the app (not okay)

Description Ralf Habacker 2024-11-05 08:41:02 UTC
Created attachment 175536 [details]
test file

STEPS TO REPRODUCE
1.  download kmymoney binary snapshot  from https://cdn.kde.org/ci-builds/office/kmymoney/master/
2. start kmymoney
3. open appended file
4. Select tab "Accounts"
5. Inspect the account hierachy below "income"
6. Open report "Income and Expenses By Year (Customised)"
7. Save the report as html file
8. Inspect the generated html file
9. Save the report as pdf file or print it

OBSERVED RESULT
The hierarchy below “income” is visible in topic 5. and 8. but not in 6 and 9.

EXPECTED RESULT
The hierarchy under “Income” should be visible in the displayed report and in the saved PDF file.

SOFTWARE/OS VERSIONS
Linux:  openSUSE_Leap_15.5
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.14
Comment 1 Ralf Habacker 2024-11-05 08:42:58 UTC
Created attachment 175537 [details]
Screenshot from report exported as html (okay)
Comment 2 Ralf Habacker 2024-11-05 08:43:52 UTC
Created attachment 175538 [details]
Screenshot from report displayed in the app (not okay)
Comment 3 Ralf Habacker 2024-11-05 09:17:11 UTC
The logic used to provide the account hierarchy in HTML files (see https://invent.kde.org/office/kmymoney/-/blob/master/kmymoney/plugins/views/reports/core/pivottable.cpp?ref_type=heads#L1879 and other places) no longer works in the display of reports in the application after switching to QTextBrowser.

The css attribute “text-indent” is currently used, which according to the QTextDocument documentation is only supported at the beginning of a text (https://doc.qt.io/qt-5/richtext-html-subset.html)

    text-indent <length>px First line text indentation in pixels
Comment 4 Ralf Habacker 2024-11-05 10:59:08 UTC
(In reply to Ralf Habacker from comment #3)
>     text-indent <length>px First line text indentation in pixels

An investigation showed that this statement applies to the beginning of each paragraph, so that the basic use is given. The actual problem lies in the fact that the unsupported unit “em” is used in the source code for HTML generation for pivot tables (see https://invent.kde.org/office/kmymoney/-/blob/master/kmymoney/plugins/views/reports/core/pivottable.cpp?ref_type=heads#L1827)
Comment 5 Ralf Habacker 2024-11-05 11:21:29 UTC
Git commit 37de9b0a4ac298c374708631b612106e10edc6a8 by Ralf Habacker.
Committed on 05/11/2024 at 11:09.
Pushed by habacker into branch 'master'.

Fix the indentation when displaying reports in the application

The mentioned commit corrected the html export of a report, but not
the display of the report, because the HTML import of QTextDocument,
which is used here, does not support the unit “em” for the css
attribute “text-indent”. To fix this, the unit “px” is always used
in the generated HTML text.

Fixup for commit ffa7449ae

M  +3    -3    kmymoney/plugins/views/reports/core/pivottable.cpp

https://invent.kde.org/office/kmymoney/-/commit/37de9b0a4ac298c374708631b612106e10edc6a8
Comment 6 Ralf Habacker 2024-11-05 11:37:29 UTC
Git commit 581bf742bdccee226d7bd0f84f1797296ba70a23 by Ralf Habacker.
Committed on 05/11/2024 at 11:37.
Pushed by habacker into branch 'master'.

Fix display of reports printig and print preview

After switching to the QTextBrowser class for printing and the print
view of reports, too little space is output between the individual
columns. This is corrected by defining a left margin in front of
each column.
Related: bug 492831
FIXED-IN:5.2

M  +3    -3    kmymoney/misc/kmmtextbrowser.cpp

https://invent.kde.org/office/kmymoney/-/commit/581bf742bdccee226d7bd0f84f1797296ba70a23