File: man-desktoptojson.8.docbook

package info (click to toggle)
kservice 5.116.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 24,332 kB
  • sloc: cpp: 15,664; lex: 170; yacc: 144; xml: 87; sh: 21; makefile: 7
file content (140 lines) | stat: -rw-r--r-- 4,294 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?xml version="1.0" ?>
<!DOCTYPE refentry PUBLIC "-//KDE//DTD DocBook XML V4.5-Based Variant V1.1//EN" "dtd/kdedbx45.dtd" [
  <!ENTITY % English "INCLUDE"><!-- change language only here -->
]>

<refentry lang="&language;">

<refentryinfo>
<title>&kde-frameworks;: KService</title>
<author>
<firstname>Scarlett</firstname>
<surname>Clark</surname>
<contrib>Wrote the original documentation.</contrib>
<affiliation>
<address><email>scarlett@scarlettgatelyclark.com</email></address>
</affiliation>
</author>
<author>
<firstname>Alex</firstname>
<surname>Merry</surname>
<contrib>Edited the documentation.</contrib>
<affiliation>
<address><email>alexmerry@kde.org</email></address>
</affiliation>
</author>

<date>2014-04-02</date>
<releaseinfo>Frameworks 5.0</releaseinfo>
<productname>KDE Frameworks</productname>

</refentryinfo>


<refmeta>
<refentrytitle><command>desktoptojson</command></refentrytitle>
<manvolnum>8</manvolnum>
</refmeta>

<refnamediv>
<refname><command>desktoptojson</command></refname>
<refpurpose>Converts a <filename class="extension">.desktop</filename> file to a <filename class="extension">.json</filename> file.</refpurpose>
</refnamediv>

<refsynopsisdiv>
<title>Synopsis</title>

<cmdsynopsis>
<command>desktoptojson</command>
<arg choice="plain">--input <replaceable>DESKTOP-FILE</replaceable></arg>
<arg choice="plain">--output <replaceable>JSON-FILE</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>desktoptojson</command>
<group choice="req">
<arg choice="plain">--version</arg>
<arg choice="plain">--help</arg>
</group>
</cmdsynopsis>

</refsynopsisdiv>




<refsect1>
<title>Description</title>

<para>The KService framework uses information contained in <filename class="extension">.desktop</filename> files to locate services, including plugins for Qt5-based applications and libraries. The Qt5 plugin system, however, uses &JSON; data embedded in the plugin itself. <command>desktoptojson</command> allows the information contained in a <filename class="extension">.desktop</filename> file to also be used as the embedded data for a Qt5 plugin by converting the <filename class="extension">.desktop</filename> file entries into &JSON; data.</para>

<para>The generated &JSON; data is a &JSON; object that maps the entries from the <literal>[Desktop Entry]</literal> group of the <filename class="extension">.desktop</filename> file. Any other groups are ignored. Most entries are just converted to &JSON; strings, but certain entries (such as <literal>Hidden</literal> and <literal>X-KDE-PluginInfo-EnabledByDefault</literal>) are known to be boolean values and converted as such, and similarly some (such as <literal>X-KDE-ServiceTypes</literal> and <literal>X-KDE-PluginInfo-Depends</literal>) are always converted to arrays of strings.</para>
</refsect1>



<refsect1>
<title>Options</title>
<variablelist>

<varlistentry>
  <term><option>--input <replaceable>DESKTOP-FILE</replaceable></option></term>
<listitem>
<para>The <filename class="extension">.desktop</filename> file to convert.</para>
</listitem>
</varlistentry>

<varlistentry>
<term><option>--output <replaceable>JSON-FILE</replaceable></option></term>
<listitem>
<para>The file to write the generated &JSON; data to.</para>
</listitem>
</varlistentry>

<varlistentry>
<term><option>--help</option></term>
<listitem>
<para>Show a brief help text.</para>
</listitem>
</varlistentry>

<varlistentry>
<term><option>--version</option></term>
<listitem>
<para>Show version information.</para>
</listitem>
</varlistentry>

</variablelist>
</refsect1>



<refsect1>
<title>Usage</title>
<para>
Most users of this utility will use the &cmake; macro
<function>kservice_desktop_to_json</function> as part of the process of building
a plugin.
<programlisting language="cmake">
<![CDATA[
add_library(myplugin MODULE ${myplugin_SRCS})
kservice_desktop_to_json(myplugin myplugin.desktop)
]]>
</programlisting>
This will produce the &JSON; file <filename>myplugin.json</filename>, which can be
referenced from the <function>K_PLUGIN_FACTORY_WITH_JSON</function> or
<function>Q_PLUGIN_METADATA</function> macros.
</para>
</refsect1>



<refsect1>
<title>Bugs</title>
<para>Please use <ulink url="https://bugs.kde.org">&kde;'s bugtracker</ulink> to report bugs.</para>
</refsect1>

</refentry>