Use compact format when saving runcommand commands

Review Request #130018 - Created March 16, 2017 and submitted

Information
Kiril Vladimiroff
kdeconnect-kde
master
Reviewers
kdeconnect

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\"}})"

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\"}})"
Aleix Pol Gonzalez
Kiril Vladimiroff
Review request changed

Status: Closed (submitted)

Change Summary:

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