Add Open Document thumbnailer
ClosedPublic

Authored by broulik on Sep 18 2018, 3:38 PM.

Details

Summary

Provides thumbnails for ODT, ODS, ODP, ODG, ODF files as well as their template counterparts

FEATURE: 375176
FIXED-IN: 18.12.0

Test Plan

Some code I had written a while ago, not knowing there actually used to be an Open Document thumbnailer for kde4.

Diff Detail

Repository
R320 KIO Extras
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik requested review of this revision.Sep 18 2018, 3:38 PM
broulik created this revision.
ngraham accepted this revision as: VDG.Sep 18 2018, 3:55 PM
ngraham added a subscriber: ngraham.

Wow, that's pretty simple.

ngraham edited the summary of this revision. (Show Details)Sep 18 2018, 3:57 PM

I haven't tested it, therefore I ask: Does this thumbnailer ask for password for password protected files, like in https://bugs.kde.org/show_bug.cgi?id=394284 ?

ngraham requested changes to this revision.EditedSep 18 2018, 5:37 PM

Hmm, yeah, we need to make sure to not even try to generate thumbnails for password-protected files. Good catch, @jtamate

(Also, let's move that sweet MS Office document thumbnailer into kio-extras so everyone can benefit from it! https://bugs.kde.org/show_bug.cgi?id=398813)

This revision now requires changes to proceed.Sep 18 2018, 5:37 PM
ngraham added a subscriber: kossebau.

Hmm, looks like Calligra already has code that does some of this: https://cgit.kde.org/calligra.git/tree/extras/thumbnail/calligracreator.cpp.

Ideally we would have the thumbnailer for these file formats in one place, here in kio-extras.

Adding @kossebau, who appears to have written the Calligra code, for the discussion regarding what should move where or be removed, as applicable.

broulik added a comment.EditedSep 18 2018, 6:25 PM

Does this thumbnailer ask for password for password protected files,

No. I don't know how a password-protected document work but if it's encrypted like a ZIP file the file will just fail to open and generate, like you cannot open an encrypted file in zip:/ KIO, it's the same thing.
I just checked, LibreOffice doesn't even seem to generate a thumbnail picture for password-protected files, which is good.

, looks like Calligra already has code that does some of this

That's actually how I found out that those formats are so similar, there's a Krita thumbnailer in kio-extras already which was split from Calligra.
The Calligra thumnailer you liked actually uses KOffice classes and as such would add a huge dependency and cannot be put in here.

ngraham accepted this revision.Sep 18 2018, 6:32 PM

OK then! :)

This revision is now accepted and ready to land.Sep 18 2018, 6:32 PM
jtamate requested changes to this revision.Sep 18 2018, 6:35 PM

I'm trying to check if it works with password-protected files, but I can't install it.
The patch is missing opendocumentthumbnail.desktop.

I have a question: If you have calligra installed, which thumbnailer will do the work? This on, calligra or both, or depends on the last one being installed? Just for curiosity.

This revision now requires changes to proceed.Sep 18 2018, 6:35 PM
leinir added a subscriber: leinir.Sep 18 2018, 6:41 PM

[...]actually uses KOffice classes

...that doesn't seem likely, that'd be like Plasma using Kicker classes from KDE3 times, which is the last time Calligra was called that ;)

and as such would add a huge dependency and cannot be put in here.

Agreed, it would be entirely nonsensical to do this. The thumbnails in the OpenDocument files are there specifically to make things like creating a thumbnailer like this both easy and (processing-wise) cheap :)
broulik planned changes to this revision.Sep 18 2018, 6:43 PM

...that doesn't seem likely, that'd be like Plasma using Kicker classes from KDE3 times, which is the last time Calligra was called that ;)

I wanted to say Ko classes as that's what they're prefixed with but I didn't expect anyone to understand this, hence KOffice :)

The patch is missing opendocumentthumbnail.desktop.

Aw, crap, just noticed that I forgot to add it, will update the patch tomorrow.

Just FYI, as I was added, I currently have no time reserved for document related code work:

There is such a thumbnailer for OpenDocument Format document which exposes the preview/thumbnail picture from the data since ages on what now is store.kde.org, here my old bookmark:
https://www.opendesktop.org/p/1081271

IIRC it is packaged by a few, at least was for openSUSE.

The Calligra thumbnailer has an advantage over the simple thumbnail extracting one here: it actually understands the content of the file (when it comes to standard ODF) and can render to bigger previews, as much as needed, not just the max isze of the embedded thumbnail (IIRC 128x128 in the ODF specs). Or for OpenDocument Formats files which were generated with no preview/thumbnail added.

Sadly the KDE thumbnail system has no priority system, so more powerful thumbnailer if installed could overrule less powerful ones.

The Krita format spec has a preview picture in the full size IIRC, there scaling is no issue.

broulik updated this revision to Diff 41926.Sep 19 2018, 8:00 AM
broulik added a reviewer: fvogt.
  • Add missing desktop file
jtamate accepted this revision.Sep 19 2018, 10:05 AM

Ok by side. It installs now, and don't ask for passwords.

This revision is now accepted and ready to land.Sep 19 2018, 10:05 AM
Restricted Application added projects: Dolphin, Frameworks. · View Herald TranscriptSep 19 2018, 11:11 AM
Restricted Application added subscribers: kfm-devel, kde-frameworks-devel. · View Herald Transcript
This revision was automatically updated to reflect the committed changes.