D28761: T6446 Fix order of the GnuPG options

Daniel Vrátil noreply at phabricator.kde.org
Mon Apr 20 15:04:09 BST 2020


dvratil requested changes to this revision.
dvratil added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> cryptoconfigmodule.cpp:236
> +    // 2. other components sorted alphabetically
> +    const QStringList order = {
> +        QStringLiteral("gpg"),

Make it `static`, there's no need to initialize this every time. It could also be something more efficient than `QStringList`, like `std::array` (since we know the size of the list beforehand).

> cryptoconfigmodule.cpp:263
> +    // add the rest of components with sorting
> +    QStringList others = (input_set - order_set).values();
> +    others.sort();

You could just resolve the `others` list using another `for` loop and `!result.contains()` and get rid of all the `QSet`s completely. The `order` list as well as the `components` list will always be short enough so that the two QSets (and the cost of constructing and subtracting them) will not be measurably faster than two `for` loops and a linear check.

REPOSITORY
  R90 PIM: Kleo Library

REVISION DETAIL
  https://phabricator.kde.org/D28761

To: andreylegayev, mlaurent, dvratil
Cc: dvratil, kde-pim, andreylegayev, fbampaloukas, dcaliste, dvasin, rodsevich, ach, winterz, vkrause, mlaurent, knauss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20200420/7727a2f3/attachment.html>


More information about the kde-pim mailing list