https://bugs.kde.org/show_bug.cgi?id=393168
Bug ID: 393168 Summary: [Patch] Fix working week in 5.x/master Product: kmymoney Version: git (master) Platform: Other OS: All Status: UNCONFIRMED Severity: normal Priority: NOR Component: general Assignee: kmymoney-devel@kde.org Reporter: learne...@gmail.com Target Milestone: --- Created attachment 112047 --> https://bugs.kde.org/attachment.cgi?id=112047&action=edit Working week patch Hello developers, First of all, thank you all for this great piece of software! (I've been mostly a user of KMyMoney, and just started to learn about coding recently. It's my first time submitting a bug report (and a proposed patch), so kindly please bear with me if there's any infelicities in my expression) There's a feature in scheduled transactions which allow them to move backwards/forwards in case a scheduled entry falls on a non-processing day, e.g. a weekend. However, I've noticed that that seems to have stopped working in 5.x/master. That's working in 4.8. Out of curiosity I tried to find out what's changed. It turns out there seems to be an 'overlooked' word in the porting of 'working week' to kf5, namely that: - // TODO: port kf5 - int weekStart = 1;//KLocale::global()->workingWeekStartDay(); - int weekEnd = 7;//KLocale::global()->workingWeekEndDay(); + QLocale locale; + int weekStart = locale.firstDayOfWeek(); + int weekEnd = weekStart-1; + if (weekEnd < Qt::Monday) { + weekEnd = Qt::Sunday; + } well in fact, weekStart and weekEnd would be referring to the workingWeek, so in most cultures that'll actually be 1 and 5 (i.e. Monday to Friday). In searching for alternatives (in porting away from KLocale in its wake), I found from my Google searches QLocale::weekdays() (as opposed to weekends) which seems to be a good replacement -- from the QT docs: Returns a list of days that are considered weekdays according to the current locale. So in the proposed patch attached I've set m_processingDays accordingly from QLocale::weekdays(). I've also moved down the #ifdef in KMyMoneyApp::isProcessingDate so that it could always check against weekdays/ends even without KF5Holidays. Sorry for the lengthy description (And don't be mistaken, there's not a scant of criticism at all. To the contrary I appreciate all the developers' efforts all along, and the KF5 port must have been a little bit tedious) And actually I'm very green at coding. Very much appreciated if interested developer(s) could help review the proposed patch --- and feel free to amend / enhance it in any way you like. * * * Some related past commits below for your reference: 2017-09-13 Ported start of week handing to KF5 (https://cgit.kde.org/kmymoney.git/commit/?id=e3aafecfbd096f048dcd53ae80f43f10e935c40e) 2016-06-16 Remove kdelibs4support, disbaled some code which will need to be ported. (https://cgit.kde.org/kmymoney.git/commit/?id=fcfe5beca1656092d6f45495816e1b604427279c) The feature (and the m_processingDays bitArray) was first introduced some 8 years ago: 2010-01-17 Added patch provided by Ian Neal (https://cgit.kde.org/kmymoney.git/commit/?id=406cd4845f3b4685194142746a93a2720293c0be) For reference, the related discussion about the implementation could be found in FEATURE: 221800 (https://bugs.kde.org/show_bug.cgi?id=221800) -- You are receiving this mail because: You are the assignee for the bug.