Incubation Request: Kiview

Sven Brauch mail at svenbrauch.de
Mon Apr 29 23:30:59 BST 2024


Hi,

On 28.04.24 12:22, Méven wrote:
> Here is an email for incubating a new KDE project: Kiview.
> Kiview is a simple file previewer written in C++/Qml, from its README:

looking through the code there are unfortunately a lot of things one 
trips over.

First and foremost, as others have mentioned, there is way too much 
system() / shell stuff going on. This kind of code tends to be hard to 
get working reliably and easily creates security vulnerabilities.

Instead, I would approach the whole problem differently, by trying to 
leverage the tools KDE Frameworks already offers and uses. Why do you 
need to execute /usr/bin/unzip when KArchive offers this functionality? 
Why use WebEngine when there are already solutions in KDE for rendering 
PDF files? All this could be done in-process without involving 
filesystem operations or shell commands (and probably in a fraction of 
the computation time).

Do you know about the KParts interface? Have a look at that. I think 
it's pretty close to what you want already. E.g. Ark already has a very 
simple document previewer based on that.

Architectural concerns aside, here is a short list of things I noticed 
which should be improved:

  - Don't inherit QThread. Instead, use a more modern task interface 
such as QtConcurrent::run() or std::launch.

  - You do not need threads to asynchronously handle a QProcess. It has 
signals for that.

  - Numbers which have a fixed meaning should be an enum{}.

  - Don't write to files with a fixed name in /tmp. Multiple instances 
of your program will clash and you might overwrite user data. Tools like 
QTemporaryDir exist which avoid these problems.

  - What is going on with the clipboard stuff in dolphinbridge.cpp...? 
That looks like an abuse of the clipboard.

  - Prepending magic prefixes like !isDir! to paths isn't a proper 
solution for anything.

Hope this helps with the next iteration of this program.

Greetings,
Sven
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0xA4AAD0019BE03F15.asc
Type: application/pgp-keys
Size: 3147 bytes
Desc: OpenPGP public key
URL: <http://mail.kde.org/pipermail/kde-devel/attachments/20240430/1a9581b3/attachment-0001.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://mail.kde.org/pipermail/kde-devel/attachments/20240430/1a9581b3/attachment-0001.sig>


More information about the kde-devel mailing list