Review Request 130018: Use compact format when saving runcommand commands

Kiril Vladimiroff kiril at vladimiroff.org
Fri Mar 17 11:28:47 UTC 2017


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/130018/
-----------------------------------------------------------

(Updated March 17, 2017, 11:28 a.m.)


Status
------

This change has been marked as submitted.


Review request for kdeconnect.


Changes
-------

Submitted with commit 71f8357e0042e147d80caf68202a9b147a63464f by Albert Vaca on behalf of Kiril Vladimiroff to branch master.


Repository: kdeconnect-kde


Description
-------

The default value of `format` in `JSonDocument.toJson` is
`QJsonDocument::Indented`, which causes new lines and spaces for
indentation to be saved in `kdeconnect_runcommand`'s config. For
instance:

    --> cat ~/.config/kdeconnect/<device-id>/kdeconnect_runcommand/config
    [General]
    commands="@ByteArray({\n    \"{ac4ff155-1990-4f27-a5b8-52d2667c708f}\": {\n        \"command\": \"konsole\",\n        \"name\": \"Konsole\"\n    },\n    \"{fa66896c-6ffc-48e9-a242-8b32bf6588bd}\": {\n        \"command\": \"dolphin\",\n        \"name\": \"Dolphin\"\n    }\n}\n)"

The result with passed ``QJsonDocument::Compact`` is a bit nicer:

    --> cat ~/.config/kdeconnect/<device-id>/kdeconnect_runcommand/config
    [General]
    commands="@ByteArray({\"{ac4ff155-1990-4f27-a5b8-52d2667c708f}\":{\"command\":\"konsole\",\"name\":\"Konsole\"},\"{fa66896c-6ffc-48e9-a242-8b32bf6588bd}\":{\"command\":\"dolphin\",\"name\":\"Dolphin\"}})"


Diffs
-----

  plugins/runcommand/runcommand_config.cpp 722fa94 

Diff: https://git.reviewboard.kde.org/r/130018/diff/


Testing
-------

Observed compact JSON document in the config file:

    --> cat ~/.config/kdeconnect/<device-id>/kdeconnect_runcommand/config
    [General]
    commands="@ByteArray({\"{ac4ff155-1990-4f27-a5b8-52d2667c708f}\":{\"command\":\"konsole\",\"name\":\"Konsole\"},\"{fa66896c-6ffc-48e9-a242-8b32bf6588bd}\":{\"command\":\"dolphin\",\"name\":\"Dolphin\"}})"


Thanks,

Kiril Vladimiroff

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdeconnect/attachments/20170317/a9bf6388/attachment.html>


More information about the KDEConnect mailing list