24 #include <kconfiggroup.h>
25 #include <kdesktopfile.h>
30 class PackageMetadataPrivate
33 PackageMetadataPrivate()
49 QString requiredVersion;
58 : d(new PackageMetadataPrivate(*other.d))
69 : d(new PackageMetadataPrivate)
81 return ! (d->name.isEmpty() ||
82 d->author.isEmpty() ||
83 d->license.isEmpty() ||
89 KDesktopFile cfg(filename);
90 KConfigGroup config = cfg.desktopGroup();
91 config.writeEntry(
"Encoding",
"UTF-8");
93 config.writeEntry(
"Name", d->name);
94 config.writeEntry(
"Icon", d->icon);
95 config.writeEntry(
"Comment", d->description);
96 config.writeEntry(
"Keywords", d->keywords);
97 config.deleteEntry(
"X-KDE-Keywords");
98 config.writeEntry(
"X-KDE-ServiceTypes", d->serviceType);
99 config.deleteEntry(
"ServiceTypes");
100 config.writeEntry(
"X-KDE-PluginInfo-Name", d->pluginName);
101 config.writeEntry(
"X-KDE-PluginInfo-Author", d->author);
102 config.writeEntry(
"X-KDE-PluginInfo-Email", d->email);
103 config.writeEntry(
"X-KDE-PluginInfo-Version", d->version);
104 config.writeEntry(
"X-KDE-PluginInfo-Website", d->website);
105 config.writeEntry(
"X-KDE-PluginInfo-License", d->license);
106 config.writeEntry(
"X-KDE-PluginInfo-Category", d->category);
107 config.writeEntry(
"X-Plasma-API", d->api);
108 config.writeEntry(
"X-KDE-ParentApp", d->app);
109 config.writeEntry(
"Type", d->type);
110 config.writeEntry(
"X-Plasma-RemoteLocation", d->location);
115 if (filename.isEmpty()) {
119 KDesktopFile cfg(filename);
120 KConfigGroup config = cfg.desktopGroup();
122 d->name = config.readEntry(
"Name", d->name);
123 d->icon = config.readEntry(
"Icon", d->icon);
124 d->description = config.readEntry(
"Comment", d->description);
125 bool hasKeywords = config.hasKey(
"Keywords");
126 bool hasXKdeKeywords = config.hasKey(
"X-KDE-Keywords");
127 if (hasKeywords && hasXKdeKeywords) {
128 d->keywords = config.readEntry(
"Keywords", d->keywords);
129 d->keywords.append(config.readEntry(
"X-KDE-Keywords", d->keywords));
130 }
else if (hasKeywords) {
131 d->keywords = config.readEntry(
"Keywords", d->keywords);
132 }
else if (hasXKdeKeywords) {
133 d->keywords = config.readEntry(
"X-KDE-Keywords", d->keywords);
135 bool hasServiceTypes = config.hasKey(
"ServiceTypes");
136 bool hasXKdeServiceTypes = config.hasKey(
"X-KDE-ServiceTypes");
137 if (hasServiceTypes && hasXKdeServiceTypes) {
138 d->serviceType = config.readEntry(
"ServiceTypes", d->serviceType);
139 d->serviceType.append(
',');
140 d->serviceType.append(config.readEntry(
"X-KDE-ServiceTypes", d->serviceType));
141 }
else if (hasServiceTypes) {
142 d->serviceType = config.readEntry(
"ServiceTypes", d->serviceType);
143 }
else if (hasXKdeServiceTypes) {
144 d->serviceType = config.readEntry(
"X-KDE-ServiceTypes", d->serviceType);
146 d->pluginName = config.readEntry(
"X-KDE-PluginInfo-Name", d->pluginName);
147 d->author = config.readEntry(
"X-KDE-PluginInfo-Author", d->author);
148 d->email = config.readEntry(
"X-KDE-PluginInfo-Email", d->email);
149 d->version = config.readEntry(
"X-KDE-PluginInfo-Version", d->version);
150 d->website = config.readEntry(
"X-KDE-PluginInfo-Website", d->website);
151 d->license = config.readEntry(
"X-KDE-PluginInfo-License", d->license);
152 d->category = config.readEntry(
"X-KDE-PluginInfo-Category", d->category);
153 d->api = config.readEntry(
"X-Plasma-API", d->api);
154 d->app = config.readEntry(
"X-KDE-ParentApp", d->app);
155 d->type = config.readEntry(
"Type", d->type);
156 d->location = config.readEntry(
"X-Plasma-RemoteLocation", d->location);
166 return d->description;
171 return d->serviceType;
231 return d->requiredVersion;
256 return d->pluginName;
321 d->location = location;