[baloo-widgets] Apply condensed date to file metadata properties
ClosedPublic

Authored by iasensio on Aug 26 2019, 8:39 PM.

Details

Summary

In the dolphin information panel, the condensed date format was not being applied to metadata file properties (i.e EXIF), only to those related to file itself (modified/accessed/..)

BEFORE:


AFTER:

BUG: 406832

Test Plan
  • Open dolphin information panel and hover an image with EXIF info
  • Condensed date option works on all the properties

Diff Detail

Repository
R824 Baloo Widgets
Branch
condensed_date
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 15676
Build 15694: arc lint + arc unit
iasensio created this revision.Aug 26 2019, 8:39 PM
Restricted Application added a project: Baloo. Β· View Herald TranscriptAug 26 2019, 8:39 PM
Restricted Application added a subscriber: Baloo. Β· View Herald Transcript
iasensio requested review of this revision.Aug 26 2019, 8:39 PM
iasensio edited the summary of this revision. (Show Details)Aug 26 2019, 8:41 PM
iasensio added reviewers: Dolphin, elvisangelaccio.
iasensio added a project: Dolphin.
ngraham added subscribers: bruns, ngraham.

Looks great, thanks!

@elvisangelaccio and/or @bruns, does this look good to you too?

meven added a subscriber: meven.Aug 29 2019, 9:05 AM
meven added inline comments.
src/widgetfactory.cpp
148

It seems to me extending toString function to support DateTime and Date QVariant type and use formatDateTime there, would allow to make the code leaner, instead of extending here if/else cascade here.

I think it would be preferable to do this in KFM::PropertyInfo

src/widgetfactory.cpp
160

no need for this to be a member function.

175

no QString::null please!

iasensio updated this revision to Diff 64962.Aug 29 2019, 6:39 PM
iasensio marked 2 inline comments as done.
  • Making formatDateTime a non-member function
  • Simplify

I agree with you both, but I found some problems on that path.

The main issue is that KFileMatada returns a function pointer which relies on a static funtion, with the date format harcoded to LongFormat. I tried to inject the user chosen m_dateFormat but it required adding a new member variable in it, breaking some of its internal logic, and overloading the static function to accept the dateFormat parameter. And in the end, the dates provided by KFM (which go through the second branch) and the ones on the last branch would follow a different path.

Anyway, I've tried to simplify the code reducing the if-chain, and moving the particular datetime formatting away. It works ok for the "file" properties which have a type of QVariant::DateTime. But for the KFM propertys, altough pi.type() is QVariant::DateTime, the value itself is QVariant::String, so it doesn't behave well with the type selector in toString(), and I need to keep the condition.

iasensio updated this revision to Diff 64964.Aug 29 2019, 7:11 PM
iasensio marked an inline comment as done.
  • Add also QVariant::Date
meven requested changes to this revision.Sep 3 2019, 1:00 PM
meven added inline comments.
src/widgetfactory.cpp
81

Could you make formatDateTime and toString private member function to avoid passing around dateFormat but instead use m_dateFormat directly ?

This revision now requires changes to proceed.Sep 3 2019, 1:00 PM
meven accepted this revision.Sep 3 2019, 1:03 PM

On the other hand, @bruns asked you not to add a member function before.

It is already nice.
Please wait for @elvisangelaccio review before merging, I am not the maintainer.

This revision is now accepted and ready to land.Sep 3 2019, 1:03 PM

Please wait for @elvisangelaccio review before merging, I am not the maintainer.

Neither am I. :-)

@bruns Does it look good to you now?

Small ping on this small diff πŸ˜ƒ

ngraham accepted this revision.Sep 26 2019, 2:02 PM

LGTM too. @bruns any final comments before we land this?

@bruns are you good with this now?

This revision was automatically updated to reflect the committed changes.