KCoreAddons

kaboutdata.cpp
1 /*
2  This file is part of the KDE Libraries
3 
4  SPDX-FileCopyrightText: 2000 Espen Sand <[email protected]>
5  SPDX-FileCopyrightText: 2006 Nicolas GOUTTE <[email protected]>
6  SPDX-FileCopyrightText: 2008 Friedrich W. H. Kossebau <[email protected]>
7  SPDX-FileCopyrightText: 2010 Teo Mrnjavac <[email protected]>
8  SPDX-FileCopyrightText: 2017 Harald Sitter <[email protected]>
9 
10  SPDX-License-Identifier: LGPL-2.0-or-later
11 */
12 
13 #include "kaboutdata.h"
14 #include "kpluginmetadata.h"
15 
16 #include <QCoreApplication>
17 #include <QStandardPaths>
18 #include <QFile>
19 #include <QTextStream>
20 #include <QSharedData>
21 #include <QList>
22 #include <QUrl>
23 #include <QHash>
24 #include <QCommandLineParser>
25 #include <QCommandLineOption>
26 #include <QJsonObject>
27 #include <QLoggingCategory>
28 
29 #include <algorithm>
30 
31 
32 Q_DECLARE_LOGGING_CATEGORY(KABOUTDATA)
33 // logging category for this framework, default: log stuff >= warning
34 Q_LOGGING_CATEGORY(KABOUTDATA, "kf.coreaddons.kaboutdata", QtWarningMsg)
35 
36 
37 class Q_DECL_HIDDEN KAboutPerson::Private
38 {
39 public:
40  QString _name;
41  QString _task;
42  QString _emailAddress;
43  QString _webAddress;
44  QString _ocsUsername;
45 };
46 
48  const QString &_task,
49  const QString &_emailAddress,
50  const QString &_webAddress,
51  const QString &_ocsUsername)
52  : d(new Private)
53 {
54  d->_name = _name;
55  d->_task = _task;
56  d->_emailAddress = _emailAddress;
57  d->_webAddress = _webAddress;
58  d->_ocsUsername = _ocsUsername;
59 }
60 
61 KAboutPerson::KAboutPerson(const QString &_name, const QString &_email, bool)
62  : d(new Private)
63 {
64  d->_name = _name;
65  d->_emailAddress = _email;
66 }
67 
68 KAboutPerson::KAboutPerson(const KAboutPerson &other): d(new Private)
69 {
70  *d = *other.d;
71 }
72 
73 KAboutPerson::~KAboutPerson()
74 {
75  delete d;
76 }
77 
79 {
80  return d->_name;
81 }
82 
84 {
85  return d->_task;
86 }
87 
89 {
90  return d->_emailAddress;
91 }
92 
94 {
95  return d->_webAddress;
96 }
97 
99 {
100  return d->_ocsUsername;
101 }
102 
104 {
105  *d = *other.d;
106  return *this;
107 }
108 
110 {
111  const QString name = KPluginMetaData::readTranslatedString(obj, QStringLiteral("Name"));
112  const QString task = KPluginMetaData::readTranslatedString(obj, QStringLiteral("Task"));
113  const QString email = obj[QStringLiteral("Email")].toString();
114  const QString website = obj[QStringLiteral("Website")].toString();
115  const QString userName = obj[QStringLiteral("UserName")].toString();
116  return KAboutPerson(name, task, email, website, userName);
117 }
118 
119 
120 class Q_DECL_HIDDEN KAboutLicense::Private : public QSharedData
121 {
122 public:
123  Private(LicenseKey licenseType,
124  VersionRestriction versionRestriction,
125  const KAboutData *aboutData);
126  Private(const Private &other);
127 
128  QString spdxID() const;
129 
130  LicenseKey _licenseKey;
131  QString _licenseText;
132  QString _pathToLicenseTextFile;
133  VersionRestriction _versionRestriction;
134  // needed for access to the possibly changing copyrightStatement()
135  const KAboutData *_aboutData;
136 };
137 
138 KAboutLicense::Private::Private(LicenseKey licenseType,
139  VersionRestriction versionRestriction,
140  const KAboutData *aboutData)
141  : QSharedData(),
142  _licenseKey(licenseType),
143  _versionRestriction(versionRestriction),
144  _aboutData(aboutData)
145 {
146 }
147 
148 KAboutLicense::Private::Private(const KAboutLicense::Private &other)
149  : QSharedData(other),
150  _licenseKey(other._licenseKey),
151  _licenseText(other._licenseText),
152  _pathToLicenseTextFile(other._pathToLicenseTextFile),
153  _versionRestriction(other._versionRestriction),
154  _aboutData(other._aboutData)
155 {}
156 
157 QString KAboutLicense::Private::spdxID() const
158 {
159  switch (_licenseKey) {
160  case KAboutLicense::GPL_V2:
161  return QStringLiteral("GPL-2.0");
162  case KAboutLicense::LGPL_V2:
163  return QStringLiteral("LGPL-2.0");
164  case KAboutLicense::BSDL:
165  return QStringLiteral("BSD-2-Clause");
166  case KAboutLicense::Artistic:
167  return QStringLiteral("Artistic-1.0");
168  case KAboutLicense::QPL_V1_0:
169  return QStringLiteral("QPL-1.0");
170  case KAboutLicense::GPL_V3:
171  return QStringLiteral("GPL-3.0");
172  case KAboutLicense::LGPL_V3:
173  return QStringLiteral("LGPL-3.0");
175  return QStringLiteral("LGPL-2.1");
176  case KAboutLicense::Custom:
177  case KAboutLicense::File:
178  case KAboutLicense::Unknown:
179  return QString();
180  }
181  return QString();
182 }
183 
185  : d(new Private(Unknown, {}, nullptr))
186 {}
187 
188 
190  VersionRestriction versionRestriction,
191  const KAboutData *aboutData)
192  : d(new Private(licenseType, versionRestriction, aboutData))
193 {
194 
195 }
196 
197 KAboutLicense::KAboutLicense(LicenseKey licenseType, const KAboutData *aboutData)
198  : d(new Private(licenseType, OnlyThisVersion, aboutData))
199 {
200 }
201 
203  : d(new Private(Unknown, OnlyThisVersion, aboutData))
204 {
205 }
206 
208  : d(other.d)
209 {
210 }
211 
212 KAboutLicense::~KAboutLicense()
213 {}
214 
215 void KAboutLicense::setLicenseFromPath(const QString &pathToFile)
216 {
217  d->_licenseKey = KAboutLicense::File;
218  d->_pathToLicenseTextFile = pathToFile;
219 }
220 
221 void KAboutLicense::setLicenseFromText(const QString &licenseText)
222 {
223  d->_licenseKey = KAboutLicense::Custom;
224  d->_licenseText = licenseText;
225 }
226 
228 {
229  QString result;
230 
231  const QString lineFeed = QStringLiteral("\n\n");
232 
233  if (d->_aboutData && !d->_aboutData->copyrightStatement().isEmpty()) {
234  result = d->_aboutData->copyrightStatement() + lineFeed;
235  }
236 
237  bool knownLicense = false;
238  QString pathToFile; // rel path if known license
239  switch (d->_licenseKey) {
240  case KAboutLicense::File:
241  pathToFile = d->_pathToLicenseTextFile;
242  break;
243  case KAboutLicense::GPL_V2:
244  knownLicense = true;
245  pathToFile = QStringLiteral("GPL_V2");
246  break;
247  case KAboutLicense::LGPL_V2:
248  knownLicense = true;
249  pathToFile = QStringLiteral("LGPL_V2");
250  break;
251  case KAboutLicense::BSDL:
252  knownLicense = true;
253  pathToFile = QStringLiteral("BSD");
254  break;
255  case KAboutLicense::Artistic:
256  knownLicense = true;
257  pathToFile = QStringLiteral("ARTISTIC");
258  break;
259  case KAboutLicense::QPL_V1_0:
260  knownLicense = true;
261  pathToFile = QStringLiteral("QPL_V1.0");
262  break;
263  case KAboutLicense::GPL_V3:
264  knownLicense = true;
265  pathToFile = QStringLiteral("GPL_V3");
266  break;
267  case KAboutLicense::LGPL_V3:
268  knownLicense = true;
269  pathToFile = QStringLiteral("LGPL_V3");
270  break;
272  knownLicense = true;
273  pathToFile = QStringLiteral("LGPL_V21");
274  break;
275  case KAboutLicense::Custom:
276  if (!d->_licenseText.isEmpty()) {
277  result = d->_licenseText;
278  break;
279  }
280  Q_FALLTHROUGH();
281  // fall through
282  default:
283  result += QCoreApplication::translate(
284  "KAboutLicense",
285  "No licensing terms for this program have been specified.\n"
286  "Please check the documentation or the source for any\n"
287  "licensing terms.\n");
288  }
289 
290  if (knownLicense) {
292  QLatin1String("kf5/licenses/") + pathToFile);
293  result += QCoreApplication::translate(
294  "KAboutLicense",
295  "This program is distributed under the terms of the %1.").arg(name(KAboutLicense::ShortName));
296  if (!pathToFile.isEmpty()) {
297  result += lineFeed;
298  }
299  }
300 
301  if (!pathToFile.isEmpty()) {
302  QFile file(pathToFile);
303  if (file.open(QIODevice::ReadOnly)) {
304  QTextStream str(&file);
305  result += str.readAll();
306  }
307  }
308 
309  return result;
310 }
311 
313 {
314  // SPDX licenses are comprised of an identifier (e.g. GPL-2.0), an optional + to denote 'or
315  // later versions' and optional ' WITH $exception' to denote standardized exceptions from the
316  // core license. As we do not offer exceptions we effectively only return GPL-2.0 or GPL-2.0+,
317  // this may change in the future. To that end the documentation makes no assertations about the
318  // actual content of the SPDX license expression we return.
319  // Expressions can in theory also contain AND, OR and () to build constructs involving more than
320  // one license. As this is outside the scope of a single license object we'll ignore this here
321  // for now.
322  // The expecation is that the return value is only run through spec-compliant parsers, so this
323  // can potentially be changed.
324 
325  auto id = d->spdxID();
326  if (id.isNull()) { // Guard against potential future changes which would allow 'Foo+' as input.
327  return id;
328  }
329  return d->_versionRestriction == OrLaterVersions ? id.append(QLatin1Char('+')) : id;
330 }
331 
332 QString KAboutLicense::name(KAboutLicense::NameFormat formatName) const
333 {
334  QString licenseShort;
335  QString licenseFull;
336 
337  switch (d->_licenseKey) {
338  case KAboutLicense::GPL_V2:
339  licenseShort = QCoreApplication::translate("KAboutLicense", "GPL v2", "@item license (short name)");
340  licenseFull = QCoreApplication::translate("KAboutLicense", "GNU General Public License Version 2", "@item license");
341  break;
342  case KAboutLicense::LGPL_V2:
343  licenseShort = QCoreApplication::translate("KAboutLicense", "LGPL v2", "@item license (short name)");
344  licenseFull = QCoreApplication::translate("KAboutLicense", "GNU Lesser General Public License Version 2", "@item license");
345  break;
346  case KAboutLicense::BSDL:
347  licenseShort = QCoreApplication::translate("KAboutLicense", "BSD License", "@item license (short name)");
348  licenseFull = QCoreApplication::translate("KAboutLicense", "BSD License", "@item license");
349  break;
350  case KAboutLicense::Artistic:
351  licenseShort = QCoreApplication::translate("KAboutLicense", "Artistic License", "@item license (short name)");
352  licenseFull = QCoreApplication::translate("KAboutLicense", "Artistic License", "@item license");
353  break;
354  case KAboutLicense::QPL_V1_0:
355  licenseShort = QCoreApplication::translate("KAboutLicense", "QPL v1.0", "@item license (short name)");
356  licenseFull = QCoreApplication::translate("KAboutLicense", "Q Public License", "@item license");
357  break;
358  case KAboutLicense::GPL_V3:
359  licenseShort = QCoreApplication::translate("KAboutLicense", "GPL v3", "@item license (short name)");
360  licenseFull = QCoreApplication::translate("KAboutLicense", "GNU General Public License Version 3", "@item license");
361  break;
362  case KAboutLicense::LGPL_V3:
363  licenseShort = QCoreApplication::translate("KAboutLicense", "LGPL v3", "@item license (short name)");
364  licenseFull = QCoreApplication::translate("KAboutLicense", "GNU Lesser General Public License Version 3", "@item license");
365  break;
367  licenseShort = QCoreApplication::translate("KAboutLicense", "LGPL v2.1", "@item license (short name)");
368  licenseFull = QCoreApplication::translate("KAboutLicense", "GNU Lesser General Public License Version 2.1", "@item license");
369  break;
370  case KAboutLicense::Custom:
371  case KAboutLicense::File:
372  licenseShort = licenseFull = QCoreApplication::translate("KAboutLicense", "Custom", "@item license");
373  break;
374  default:
375  licenseShort = licenseFull = QCoreApplication::translate("KAboutLicense", "Not specified", "@item license");
376  }
377 
378  const QString result =
379  (formatName == KAboutLicense::ShortName) ? licenseShort :
380  (formatName == KAboutLicense::FullName) ? licenseFull :
381  QString();
382 
383  return result;
384 }
385 
387 {
388  d = other.d;
389  return *this;
390 }
391 
393 {
394  return d->_licenseKey;
395 }
396 
398 {
399  // Setup keyword->enum dictionary on first call.
400  // Use normalized keywords, by the algorithm below.
401  static const QHash<QByteArray, KAboutLicense::LicenseKey> licenseDict {
402  { "gpl", KAboutLicense::GPL },
403  { "gplv2", KAboutLicense::GPL_V2 },
404  { "gplv2+", KAboutLicense::GPL_V2 },
405  { "gpl20", KAboutLicense::GPL_V2 },
406  { "gpl20+", KAboutLicense::GPL_V2 },
407  { "lgpl", KAboutLicense::LGPL },
408  { "lgplv2", KAboutLicense::LGPL_V2 },
409  { "lgplv2+", KAboutLicense::LGPL_V2 },
410  { "lgpl20", KAboutLicense::LGPL_V2 },
411  { "lgpl20+", KAboutLicense::LGPL_V2 },
412  { "bsd", KAboutLicense::BSDL },
413  { "bsd2clause", KAboutLicense::BSDL },
414  { "artistic", KAboutLicense::Artistic },
415  { "artistic10", KAboutLicense::Artistic },
416  { "qpl", KAboutLicense::QPL },
417  { "qplv1", KAboutLicense::QPL_V1_0 },
418  { "qplv10", KAboutLicense::QPL_V1_0 },
419  { "qpl10", KAboutLicense::QPL_V1_0 },
420  { "gplv3", KAboutLicense::GPL_V3 },
421  { "gplv3+", KAboutLicense::GPL_V3 },
422  { "gpl30", KAboutLicense::GPL_V3 },
423  { "gpl30+", KAboutLicense::GPL_V3 },
424  { "lgplv3", KAboutLicense::LGPL_V3 },
425  { "lgplv3+", KAboutLicense::LGPL_V3 },
426  { "lgpl30", KAboutLicense::LGPL_V3 },
427  { "lgpl30+", KAboutLicense::LGPL_V3 },
428  { "lgplv21", KAboutLicense::LGPL_V2_1 },
429  { "lgplv21+", KAboutLicense::LGPL_V2_1 },
430  { "lgpl21", KAboutLicense::LGPL_V2_1 },
431  { "lgpl21+", KAboutLicense::LGPL_V2_1 },
432  };
433 
434  // Normalize keyword.
435  QString keyword = rawKeyword;
436  keyword = keyword.toLower();
437  keyword.remove(QLatin1Char(' '));
438  keyword.remove(QLatin1Char('.'));
439  keyword.remove(QLatin1Char('-'));
440 
441  LicenseKey license = licenseDict.value(keyword.toLatin1(),
442  KAboutLicense::Custom);
443  auto restriction = keyword.endsWith(QLatin1Char('+')) ? OrLaterVersions : OnlyThisVersion;
444  return KAboutLicense(license, restriction, nullptr);
445 }
446 
447 class Q_DECL_HIDDEN KAboutData::Private
448 {
449 public:
450  Private()
451  : customAuthorTextEnabled(false)
452  {}
453  QString _componentName;
454  QString _displayName;
455  QString _shortDescription;
456  QString _copyrightStatement;
457  QString _otherText;
458  QString _homepageAddress;
459  QList<KAboutPerson> _authorList;
460  QList<KAboutPerson> _creditList;
461  QList<KAboutPerson> _translatorList;
462  QList<KAboutLicense> _licenseList;
463  QString productName;
464 #if KCOREADDONS_BUILD_DEPRECATED_SINCE(5, 2)
465  QString programIconName;
466 #endif
467  QVariant programLogo;
468  QString customAuthorPlainText, customAuthorRichText;
469  bool customAuthorTextEnabled;
470 
471  QString organizationDomain;
472  QString _ocsProviderUrl;
473  QString desktopFileName;
474 
475  // Everything dr.konqi needs, we store as utf-8, so we
476  // can just give it a pointer, w/o any allocations.
477  QByteArray _internalProgramName;
478  QByteArray _version;
479  QByteArray _bugAddress;
480 
481  static QList<KAboutPerson> parseTranslators(const QString &translatorName, const QString &translatorEmail);
482 
483 };
484 
485 KAboutData::KAboutData(const QString &_componentName,
486  const QString &_displayName,
487  const QString &_version,
488  const QString &_shortDescription,
489  enum KAboutLicense::LicenseKey licenseType,
490  const QString &_copyrightStatement,
491  const QString &text,
492  const QString &homePageAddress,
493  const QString &bugAddress
494  )
495  : d(new Private)
496 {
497  d->_componentName = _componentName;
498  int p = d->_componentName.indexOf(QLatin1Char('/'));
499  if (p >= 0) {
500  d->_componentName = d->_componentName.mid(p + 1);
501  }
502 
503  d->_displayName = _displayName;
504  if (!d->_displayName.isEmpty()) { // KComponentData("klauncher") gives empty program name
505  d->_internalProgramName = _displayName.toUtf8();
506  }
507  d->_version = _version.toUtf8();
508  d->_shortDescription = _shortDescription;
509  d->_licenseList.append(KAboutLicense(licenseType, this));
510  d->_copyrightStatement = _copyrightStatement;
511  d->_otherText = text;
512  d->_homepageAddress = homePageAddress;
513  d->_bugAddress = bugAddress.toUtf8();
514 
515  QUrl homePageUrl(homePageAddress);
516  if (!homePageUrl.isValid() || homePageUrl.scheme().isEmpty()) {
517  // Default domain if nothing else is better
518  homePageUrl.setUrl(QStringLiteral("https://kde.org/"));
519  }
520 
521  const QChar dotChar(QLatin1Char('.'));
522  QStringList hostComponents = homePageUrl.host().split(dotChar);
523 
524  // Remove leading component unless 2 (or less) components are present
525  if (hostComponents.size() > 2) {
526  hostComponents.removeFirst();
527  }
528 
529  d->organizationDomain = hostComponents.join(dotChar);
530 
531  // KF6: do not set a default desktopFileName value here, but remove this code and leave it empty
532  // see KAboutData::desktopFileName() for details
533 
534  // desktop file name is reverse domain name
535  std::reverse(hostComponents.begin(), hostComponents.end());
536  hostComponents.append(_componentName);
537 
538  d->desktopFileName = hostComponents.join(dotChar);
539 }
540 
541 KAboutData::KAboutData(const QString &_componentName,
542  const QString &_displayName,
543  const QString &_version
544  )
545  : d(new Private)
546 {
547  d->_componentName = _componentName;
548  int p = d->_componentName.indexOf(QLatin1Char('/'));
549  if (p >= 0) {
550  d->_componentName = d->_componentName.mid(p + 1);
551  }
552 
553  d->_displayName = _displayName;
554  if (!d->_displayName.isEmpty()) { // KComponentData("klauncher") gives empty program name
555  d->_internalProgramName = _displayName.toUtf8();
556  }
557  d->_version = _version.toUtf8();
558 
559  // match behaviour of other constructors
560  d->_licenseList.append(KAboutLicense(KAboutLicense::Unknown, this));
561  d->_bugAddress = "[email protected]";
562  d->organizationDomain = QStringLiteral("kde.org");
563  // KF6: do not set a default desktopFileName value here, but remove this code and leave it empty
564  // see KAboutData::desktopFileName() for details
565  d->desktopFileName = QLatin1String("org.kde.") + d->_componentName;
566 }
567 
568 KAboutData::~KAboutData()
569 {
570  delete d;
571 }
572 
573 KAboutData::KAboutData(const KAboutData &other): d(new Private)
574 {
575  *d = *other.d;
576  QList<KAboutLicense>::iterator it = d->_licenseList.begin(), itEnd = d->_licenseList.end();
577  for (; it != itEnd; ++it) {
578  KAboutLicense &al = *it;
579  al.d.detach();
580  al.d->_aboutData = this;
581  }
582 }
583 
584 KAboutData &KAboutData::operator=(const KAboutData &other)
585 {
586  if (this != &other) {
587  *d = *other.d;
588  QList<KAboutLicense>::iterator it = d->_licenseList.begin(), itEnd = d->_licenseList.end();
589  for (; it != itEnd; ++it) {
590  KAboutLicense &al = *it;
591  al.d.detach();
592  al.d->_aboutData = this;
593  }
594  }
595  return *this;
596 }
597 
598 #if KCOREADDONS_BUILD_DEPRECATED_SINCE(5, 65)
600 {
601  KAboutData ret(plugin.pluginId(), plugin.name(), plugin.version(), plugin.description(),
602  KAboutLicense::byKeyword(plugin.license()).key(), plugin.copyrightText(),
603  plugin.extraInformation(), plugin.website());
604 #if KCOREADDONS_BUILD_DEPRECATED_SINCE(5, 2)
605  ret.d->programIconName = plugin.iconName();
606 #endif
607  ret.d->_authorList = plugin.authors();
608  ret.d->_translatorList = plugin.translators();
609  ret.d->_creditList = plugin.otherContributors();
610  return ret;
611 }
612 #endif
613 
614 
615 KAboutData &KAboutData::addAuthor(const QString &name,
616  const QString &task,
617  const QString &emailAddress,
618  const QString &webAddress,
619  const QString &ocsUsername)
620 {
621  d->_authorList.append(KAboutPerson(name, task, emailAddress, webAddress, ocsUsername));
622  return *this;
623 }
624 
625 KAboutData &KAboutData::addCredit(const QString &name,
626  const QString &task,
627  const QString &emailAddress,
628  const QString &webAddress,
629  const QString &ocsUsername)
630 {
631  d->_creditList.append(KAboutPerson(name, task, emailAddress, webAddress, ocsUsername));
632  return *this;
633 }
634 
635 KAboutData &KAboutData::setTranslator(const QString &name,
636  const QString &emailAddress)
637 {
638  d->_translatorList = Private::parseTranslators(name, emailAddress);
639  return *this;
640 }
641 
642 KAboutData &KAboutData::setLicenseText(const QString &licenseText)
643 {
644  d->_licenseList[0] = KAboutLicense(this);
645  d->_licenseList[0].setLicenseFromText(licenseText);
646  return *this;
647 }
648 
649 KAboutData &KAboutData::addLicenseText(const QString &licenseText)
650 {
651  // if the default license is unknown, overwrite instead of append
652  KAboutLicense &firstLicense = d->_licenseList[0];
653  KAboutLicense newLicense(this);
654  newLicense.setLicenseFromText(licenseText);
655  if (d->_licenseList.count() == 1 && firstLicense.d->_licenseKey == KAboutLicense::Unknown) {
656  firstLicense = newLicense;
657  } else {
658  d->_licenseList.append(newLicense);
659  }
660 
661  return *this;
662 }
663 
664 KAboutData &KAboutData::setLicenseTextFile(const QString &pathToFile)
665 {
666  d->_licenseList[0] = KAboutLicense(this);
667  d->_licenseList[0].setLicenseFromPath(pathToFile);
668  return *this;
669 }
670 
671 KAboutData &KAboutData::addLicenseTextFile(const QString &pathToFile)
672 {
673  // if the default license is unknown, overwrite instead of append
674  KAboutLicense &firstLicense = d->_licenseList[0];
675  KAboutLicense newLicense(this);
676  newLicense.setLicenseFromPath(pathToFile);
677  if (d->_licenseList.count() == 1 && firstLicense.d->_licenseKey == KAboutLicense::Unknown) {
678  firstLicense = newLicense;
679  } else {
680  d->_licenseList.append(newLicense);
681  }
682  return *this;
683 }
684 
686 {
687  d->_componentName = componentName;
688  return *this;
689 }
690 
691 KAboutData &KAboutData::setDisplayName(const QString &_displayName)
692 {
693  d->_displayName = _displayName;
694  d->_internalProgramName = _displayName.toUtf8();
695  return *this;
696 }
697 
698 KAboutData &KAboutData::setOcsProvider(const QString &_ocsProviderUrl)
699 {
700  d->_ocsProviderUrl = _ocsProviderUrl;
701  return *this;
702 }
703 
704 KAboutData &KAboutData::setVersion(const QByteArray &_version)
705 {
706  d->_version = _version;
707  return *this;
708 }
709 
710 KAboutData &KAboutData::setShortDescription(const QString &_shortDescription)
711 {
712  d->_shortDescription = _shortDescription;
713  return *this;
714 }
715 
717 {
718  return setLicense(licenseKey, KAboutLicense::OnlyThisVersion);
719 }
720 
722  KAboutLicense::VersionRestriction versionRestriction)
723 {
724  d->_licenseList[0] = KAboutLicense(licenseKey, versionRestriction, this);
725  return *this;
726 }
727 
729 {
730  return addLicense(licenseKey, KAboutLicense::OnlyThisVersion);
731 }
732 
734  KAboutLicense::VersionRestriction versionRestriction)
735 {
736  // if the default license is unknown, overwrite instead of append
737  KAboutLicense &firstLicense = d->_licenseList[0];
738  if (d->_licenseList.count() == 1 && firstLicense.d->_licenseKey == KAboutLicense::Unknown) {
739  firstLicense = KAboutLicense(licenseKey, versionRestriction, this);
740  } else {
741  d->_licenseList.append(KAboutLicense(licenseKey, versionRestriction, this));
742  }
743  return *this;
744 }
745 
746 KAboutData &KAboutData::setCopyrightStatement(const QString &_copyrightStatement)
747 {
748  d->_copyrightStatement = _copyrightStatement;
749  return *this;
750 }
751 
752 KAboutData &KAboutData::setOtherText(const QString &_otherText)
753 {
754  d->_otherText = _otherText;
755  return *this;
756 }
757 
759 {
760  d->_homepageAddress = homepage;
761  return *this;
762 }
763 
764 KAboutData &KAboutData::setBugAddress(const QByteArray &_bugAddress)
765 {
766  d->_bugAddress = _bugAddress;
767  return *this;
768 }
769 
771 {
772  d->organizationDomain = QString::fromLatin1(domain.data());
773  return *this;
774 }
775 
776 KAboutData &KAboutData::setProductName(const QByteArray &_productName)
777 {
778  d->productName = QString::fromUtf8(_productName.data());
779  return *this;
780 }
781 
783 {
784  return d->_componentName;
785 }
786 
788 {
789  if (!d->productName.isEmpty()) {
790  return d->productName;
791  }
792  return componentName();
793 }
794 
796 {
797  if (!d->_displayName.isEmpty()) {
798  return d->_displayName;
799  }
800  return componentName();
801 }
802 
807 {
808  return d->_internalProgramName.constData();
809 }
810 
811 #if KCOREADDONS_BUILD_DEPRECATED_SINCE(5, 2)
813 {
814  return d->programIconName.isEmpty() ? componentName() : d->programIconName;
815 }
816 
817 KAboutData &KAboutData::setProgramIconName(const QString &iconName)
818 {
819  d->programIconName = iconName;
820  return *this;
821 }
822 #endif
823 
825 {
826  return d->programLogo;
827 }
828 
829 KAboutData &KAboutData::setProgramLogo(const QVariant &image)
830 {
831  d->programLogo = image;
832  return *this;
833 }
834 
836 {
837  return d->_ocsProviderUrl;
838 }
839 
841 {
842  return QString::fromUtf8(d->_version.data());
843 }
844 
848 const char *KAboutData::internalVersion() const
849 {
850  return d->_version.constData();
851 }
852 
854 {
855  return d->_shortDescription;
856 }
857 
859 {
860  return d->_homepageAddress;
861 }
862 
864 {
865  return QString::fromUtf8(d->_bugAddress.constData());
866 }
867 
869 {
870  return d->organizationDomain;
871 }
872 
877 {
878  if (d->_bugAddress.isEmpty()) {
879  return nullptr;
880  }
881  return d->_bugAddress.constData();
882 }
883 
885 {
886  return d->_authorList;
887 }
888 
890 {
891  return d->_creditList;
892 }
893 
894 QList<KAboutPerson> KAboutData::Private::parseTranslators(const QString &translatorName, const QString &translatorEmail)
895 {
896  QList<KAboutPerson> personList;
897  if (translatorName.isEmpty() || translatorName == QLatin1String("Your names")) {
898  return personList;
899  }
900 
901  const QStringList nameList(translatorName.split(QLatin1Char(',')));
902 
903  QStringList emailList;
904  if (!translatorEmail.isEmpty() && translatorEmail != QLatin1String("Your emails")) {
905 #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
906  emailList = translatorEmail.split(QLatin1Char(','), QString::KeepEmptyParts);
907 #else
908  emailList = translatorEmail.split(QLatin1Char(','), Qt::KeepEmptyParts);
909 #endif
910  }
911 
913  QStringList::const_iterator eit = emailList.constBegin();
914 
915  for (nit = nameList.constBegin(); nit != nameList.constEnd(); ++nit) {
916  QString email;
917  if (eit != emailList.constEnd()) {
918  email = *eit;
919  ++eit;
920  }
921 
922  personList.append(KAboutPerson((*nit).trimmed(), email.trimmed(), true));
923  }
924 
925  return personList;
926 }
927 
929 {
930  return d->_translatorList;
931 }
932 
933 
935 {
937  "KAboutData",
938  "<p>KDE is translated into many languages thanks to the work "
939  "of the translation teams all over the world.</p>"
940  "<p>For more information on KDE internationalization "
941  "visit <a href=\"https://l10n.kde.org\">https://l10n.kde.org</a></p>",
942  "replace this with information about your translation team"
943  );
944 }
945 
947 {
948  return d->_otherText;
949 }
950 
952 {
953  return d->_licenseList;
954 }
955 
957 {
958  return d->_copyrightStatement;
959 }
960 
962 {
963  return d->customAuthorPlainText;
964 }
965 
967 {
968  return d->customAuthorRichText;
969 }
970 
972 {
973  return d->customAuthorTextEnabled;
974 }
975 
976 KAboutData &KAboutData::setCustomAuthorText(const QString &plainText,
977  const QString &richText)
978 {
979  d->customAuthorPlainText = plainText;
980  d->customAuthorRichText = richText;
981 
982  d->customAuthorTextEnabled = true;
983 
984  return *this;
985 }
986 
988 {
989  d->customAuthorPlainText = QString();
990  d->customAuthorRichText = QString();
991 
992  d->customAuthorTextEnabled = false;
993 
994  return *this;
995 }
996 
998 {
999  d->desktopFileName = desktopFileName;
1000 
1001  return *this;
1002 }
1003 
1005 {
1006  return d->desktopFileName;
1007  // KF6: switch to this code and adapt API dox
1008 #if 0
1009  // if desktopFileName has been explicitly set, use that value
1010  if (!d->desktopFileName.isEmpty()) {
1011  return d->desktopFileName;
1012  }
1013 
1014  // return a string calculated on-the-fly from the current org domain & component name
1015  const QChar dotChar(QLatin1Char('.'));
1016  QStringList hostComponents = d->organizationDomain.split(dotChar);
1017 
1018  // desktop file name is reverse domain name
1019  std::reverse(hostComponents.begin(), hostComponents.end());
1020  hostComponents.append(componentName());
1021 
1022  return hostComponents.join(dotChar);
1023 #endif
1024 }
1025 
1026 class KAboutDataRegistry
1027 {
1028 public:
1029  KAboutDataRegistry() : m_appData(nullptr) {}
1030  ~KAboutDataRegistry()
1031  {
1032  delete m_appData;
1033  qDeleteAll(m_pluginData);
1034  }
1035  KAboutDataRegistry(const KAboutDataRegistry &) = delete;
1036  KAboutDataRegistry &operator=(const KAboutDataRegistry &) = delete;
1037 
1038  KAboutData *m_appData;
1039  QHash<QString, KAboutData *> m_pluginData;
1040 };
1041 
1042 Q_GLOBAL_STATIC(KAboutDataRegistry, s_registry)
1043 
1044 namespace {
1045 
1046 void warnIfOutOfSync(const char *aboutDataString, const QString &aboutDataValue,
1047  const char *appDataString, const QString &appDataValue)
1048 {
1049  if (aboutDataValue != appDataValue) {
1050  qCWarning(KABOUTDATA) << appDataString <<appDataValue << "is out-of-sync with" << aboutDataString << aboutDataValue;
1051  }
1052 }
1053 
1054 }
1055 
1057 {
1059 
1060  KAboutData *aboutData = s_registry->m_appData;
1061 
1062  // not yet existing
1063  if (!aboutData) {
1064  // init from current Q*Application data
1066  QString(),
1067  QString());
1068  // For applicationDisplayName & desktopFileName, which are only properties of QGuiApplication,
1069  // we have to try to get them via the property system, as the static getter methods are
1070  // part of QtGui only. Disadvantage: requires an app instance.
1071  // Either get all or none of the properties & warn about it
1072  if (app) {
1074  aboutData->setVersion(QCoreApplication::applicationVersion().toUtf8());
1075  aboutData->setDisplayName(app->property("applicationDisplayName").toString());
1076  aboutData->setDesktopFileName(app->property("desktopFileName").toString());
1077  } else {
1078  qCWarning(KABOUTDATA) << "Could not initialize the properties of KAboutData::applicationData by the equivalent properties from Q*Application: no app instance (yet) existing.";
1079  }
1080 
1081  s_registry->m_appData = aboutData;
1082  } else {
1083  // check if in-sync with Q*Application metadata, as their setters could have been called
1084  // after the last KAboutData::setApplicationData, with different values
1085  warnIfOutOfSync("KAboutData::applicationData().componentName", aboutData->componentName(),
1086  "QCoreApplication::applicationName", QCoreApplication::applicationName());
1087  warnIfOutOfSync("KAboutData::applicationData().version", aboutData->version(),
1088  "QCoreApplication::applicationVersion", QCoreApplication::applicationVersion());
1089  warnIfOutOfSync("KAboutData::applicationData().organizationDomain", aboutData->organizationDomain(),
1090  "QCoreApplication::organizationDomain", QCoreApplication::organizationDomain());
1091  if (app) {
1092  warnIfOutOfSync("KAboutData::applicationData().displayName", aboutData->displayName(),
1093  "QGuiApplication::applicationDisplayName", app->property("applicationDisplayName").toString());
1094  warnIfOutOfSync("KAboutData::applicationData().desktopFileName", aboutData->desktopFileName(),
1095  "QGuiApplication::desktopFileName", app->property("desktopFileName").toString());
1096  }
1097  }
1098 
1099  return *aboutData;
1100 }
1101 
1102 void KAboutData::setApplicationData(const KAboutData &aboutData)
1103 {
1104  if (s_registry->m_appData) {
1105  *s_registry->m_appData = aboutData;
1106  } else {
1107  s_registry->m_appData = new KAboutData(aboutData);
1108  }
1109 
1110  // For applicationDisplayName & desktopFileName, which are only properties of QGuiApplication,
1111  // we have to try to set them via the property system, as the static getter methods are
1112  // part of QtGui only. Disadvantage: requires an app instance.
1113  // So set either all or none of the properties & warn about it
1115  if (app) {
1116  app->setApplicationVersion(aboutData.version());
1117  app->setApplicationName(aboutData.componentName());
1118  app->setOrganizationDomain(aboutData.organizationDomain());
1119  app->setProperty("applicationDisplayName", aboutData.displayName());
1120  app->setProperty("desktopFileName", aboutData.desktopFileName());
1121  } else {
1122  qCWarning(KABOUTDATA) << "Could not initialize the equivalent properties of Q*Application: no instance (yet) existing.";
1123  }
1124 
1125  // KF6: Rethink the current relation between KAboutData::applicationData and the Q*Application metadata
1126  // Always overwriting the Q*Application metadata here, but not updating back the KAboutData
1127  // in applicationData() is unbalanced and can result in out-of-sync data if the Q*Application
1128  // setters have been called meanwhile
1129  // Options are to remove the overlapping properties of KAboutData for cleancode, or making the
1130  // overlapping properties official shadow properties of their Q*Application countparts, though
1131  // that increases behavioural complexity a little.
1132 }
1133 
1134 void KAboutData::registerPluginData(const KAboutData &aboutData)
1135 {
1136  s_registry->m_pluginData.insert(aboutData.componentName(), new KAboutData(aboutData));
1137 }
1138 
1140 {
1141  KAboutData *ad = s_registry->m_pluginData.value(componentName);
1142  return ad;
1143 }
1144 
1145 // only for KCrash (no memory allocation allowed)
1146 const KAboutData *KAboutData::applicationDataPointer()
1147 {
1148  if (s_registry.exists()) {
1149  return s_registry->m_appData;
1150  }
1151  return nullptr;
1152 }
1153 
1155 {
1156  if (!d->_shortDescription.isEmpty()) {
1157  parser->setApplicationDescription(d->_shortDescription);
1158  }
1159 
1160  parser->addHelpOption();
1161 
1163  if (app && !app->applicationVersion().isEmpty()) {
1164  parser->addVersionOption();
1165  }
1166 
1167  return parser->addOption(QCommandLineOption(QStringLiteral("author"), QCoreApplication::translate("KAboutData CLI", "Show author information.")))
1168  && parser->addOption(QCommandLineOption(QStringLiteral("license"), QCoreApplication::translate("KAboutData CLI", "Show license information.")))
1169  && parser->addOption(QCommandLineOption(QStringLiteral("desktopfile"),
1170  QCoreApplication::translate("KAboutData CLI", "The base file name of the desktop entry for this application."),
1171  QCoreApplication::translate("KAboutData CLI", "file name")));
1172 }
1173 
1175 {
1176  bool foundArgument = false;
1177  if (parser->isSet(QStringLiteral("author"))) {
1178  foundArgument = true;
1179  if (d->_authorList.isEmpty()) {
1180  printf("%s\n", qPrintable(QCoreApplication::translate("KAboutData CLI", "This application was written by somebody who wants to remain anonymous.")));
1181  } else {
1182  printf("%s\n", qPrintable(QCoreApplication::translate("KAboutData CLI", "%1 was written by:").arg(qAppName())));
1183  for (const KAboutPerson &person : qAsConst(d->_authorList)) {
1184  QString authorData = QLatin1String(" ") + person.name();
1185  if (!person.emailAddress().isEmpty()) {
1186  authorData.append(QLatin1String(" <") + person.emailAddress() + QLatin1Char('>'));
1187  }
1188  printf("%s\n", qPrintable(authorData));
1189  }
1190  }
1191  if (!customAuthorTextEnabled()) {
1192  if (bugAddress() == QLatin1String("[email protected]") ) {
1193  printf("%s\n", qPrintable(QCoreApplication::translate("KAboutData CLI", "Please use https://bugs.kde.org to report bugs.")));
1194  } else if (!bugAddress().isEmpty()) {
1195  printf("%s\n", qPrintable(QCoreApplication::translate("KAboutData CLI", "Please report bugs to %1.").arg(bugAddress())));
1196  }
1197  } else {
1198  printf("%s\n", qPrintable(customAuthorPlainText()));
1199  }
1200  } else if (parser->isSet(QStringLiteral("license"))) {
1201  foundArgument = true;
1202  for (const KAboutLicense &license : qAsConst(d->_licenseList)) {
1203  printf("%s\n", qPrintable(license.text()));
1204  }
1205  }
1206 
1207  const QString desktopFileName = parser->value(QStringLiteral("desktopfile"));
1208  if (!desktopFileName.isEmpty()) {
1209  d->desktopFileName = desktopFileName;
1210  }
1211 
1212  if (foundArgument) {
1213  ::exit(EXIT_SUCCESS);
1214  }
1215 }
1216 
1217 template <class T>
1218 QVariantList listToVariant(const QList<T>& values)
1219 {
1220  QVariantList ret;
1221  ret.reserve(values.count());
1222  for(const auto &license: values) {
1223  ret << QVariant::fromValue(license);
1224  }
1225  return ret;
1226 }
1227 
1228 QVariantList KAboutData::licensesVariant() const
1229 {
1230  return listToVariant(d->_licenseList);
1231 }
1232 
1233 QVariantList KAboutData::authorsVariant() const
1234 {
1235  return listToVariant(d->_authorList);
1236 }
1237 
1238 QVariantList KAboutData::creditsVariant() const
1239 {
1240  return listToVariant(d->_creditList);
1241 }
1242 
1243 QVariantList KAboutData::translatorsVariant() const
1244 {
1245  return listToVariant(d->_translatorList);
1246 }
This class is used to store information about a license.
Definition: kaboutdata.h:172
KAboutData & setCopyrightStatement(const QString &copyrightStatement)
Defines the copyright statement to show when displaying the license.
Definition: kaboutdata.cpp:746
const char * internalVersion() const
Definition: kaboutdata.cpp:848
QString homepage() const
Returns the application homepage.
KAboutData & setBugAddress(const QByteArray &bugAddress)
Defines the address where bug reports should be sent.
Definition: kaboutdata.cpp:764
QString & append(QChar ch)
QString organizationDomain() const
Returns the domain name of the organization that wrote this application.
Definition: kaboutdata.cpp:868
KAboutLicense::LicenseKey key() const
Returns the license key.
void processCommandLine(QCommandLineParser *parser)
Reads the processed parser and sees if any of the arguments are the ones set up from setupCommandLine...
QString componentName() const
Returns the application&#39;s internal name.
static KAboutData applicationData()
Returns the KAboutData for the application.
KAboutData & setLicense(KAboutLicense::LicenseKey licenseKey)
Defines the license identifier.
Definition: kaboutdata.cpp:716
QString task() const
The person&#39;s task.
QString spdx() const
Returns the SPDX license expression of this license.
KAboutData & setOtherText(const QString &otherText)
Defines the additional text to show in the about dialog.
Definition: kaboutdata.cpp:752
void removeFirst()
QString otherText() const
Returns a translated, free form text.
QString translate(const char *context, const char *sourceText, const char *disambiguation, int n)
QString host(QUrl::ComponentFormattingOptions options) const const
KAboutData & setDesktopFileName(const QString &desktopFileName)
Sets the base name of the desktop entry for this application.
Definition: kaboutdata.cpp:997
QString ocsProviderUrl() const
Returns the chosen Open Collaboration Services provider URL.
Definition: kaboutdata.cpp:835
KAboutData & setDisplayName(const QString &displayName)
Defines the displayable component name string.
Definition: kaboutdata.cpp:691
const char * internalBugAddress() const
Definition: kaboutdata.cpp:876
QCommandLineOption addVersionOption()
QList< KAboutPerson > translators() const
Returns a list of translators.
KAboutData & setHomepage(const QString &homepage)
Defines the program homepage.
Definition: kaboutdata.cpp:758
QString desktopFileName() const
KAboutLicense & operator=(const KAboutLicense &other)
Assignment operator.
Definition: kaboutdata.cpp:386
QString organizationDomain()
QString join(const QString &separator) const const
QString & remove(int position, int n)
static KAboutData * pluginData(const QString &componentName)
Return the KAboutData for the given plugin identified by componentName.
KAboutData & addAuthor(const QString &name, const QString &task=QString(), const QString &emailAddress=QString(), const QString &webAddress=QString(), const QString &ocsUsername=QString())
Defines an author.
Definition: kaboutdata.cpp:615
int size() const const
KAboutData & setVersion(const QByteArray &version)
Defines the program version string.
Definition: kaboutdata.cpp:704
QString bugAddress() const
Returns the email address or URL for bugs.
KAboutData & setLicenseText(const QString &license)
Defines a license text, which is translated.
Definition: kaboutdata.cpp:642
KAboutData & setOcsProvider(const QString &providerUrl)
Specifies an Open Collaboration Services provider by URL.
Definition: kaboutdata.cpp:698
QList< KAboutPerson > authors() const
Returns a list of authors.
static void registerPluginData(const KAboutData &aboutData)
Register the KAboutData information for a plugin.
KAboutPerson & operator=(const KAboutPerson &other)
Assignment operator.
Definition: kaboutdata.cpp:103
QVector< V > values(const QMultiHash< K, V > &c)
KAboutData & setCustomAuthorText(const QString &plainText, const QString &richText)
Sets the custom text displayed around the list of authors instead of the default message telling user...
Definition: kaboutdata.cpp:976
bool customAuthorTextEnabled() const
Returns whether custom text should be displayed around the list of authors.
Definition: kaboutdata.cpp:971
QList< KAboutLicense > licenses() const
Returns a list of licenses.
QString emailAddress() const
The person&#39;s email address.
int count(const T &value) const const
QString applicationVersion()
void append(const T &value)
QString fromUtf8(const char *str, int size)
QVariant property(const char *name) const const
KAboutData & addLicenseTextFile(const QString &file)
Adds a license text by pointing to a file where it resides.
Definition: kaboutdata.cpp:671
KAboutData & addCredit(const QString &name, const QString &task=QString(), const QString &emailAddress=QString(), const QString &webAddress=QString(), const QString &ocsUsername=QString())
Defines a person that deserves credit.
Definition: kaboutdata.cpp:625
void setUrl(const QString &url, QUrl::ParsingMode parsingMode)
static QString readTranslatedString(const QJsonObject &jo, const QString &key, const QString &defaultValue=QString())
bool isEmpty() const const
QString trimmed() const const
QStringList split(const QString &sep, QString::SplitBehavior behavior, Qt::CaseSensitivity cs) const const
QCommandLineOption addHelpOption()
QString text() const
Returns the full license text.
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const const
This class is used to store information about a program or plugin.
Definition: kaboutdata.h:394
void setApplicationDescription(const QString &description)
QCoreApplication * instance()
KAboutData & setProductName(const QByteArray &name)
Defines the product name which will be used in the KBugReport dialog.
Definition: kaboutdata.cpp:776
KAboutData & addLicense(KAboutLicense::LicenseKey licenseKey)
Adds a license identifier.
Definition: kaboutdata.cpp:728
KAboutData & setShortDescription(const QString &shortDescription)
Defines a short description of what the program does.
Definition: kaboutdata.cpp:710
bool isSet(const QString &name) const const
virtual bool open(QIODevice::OpenMode mode) override
QString scheme() const const
QVariant programLogo() const
Returns the program logo image.
LicenseKey
Describes the license of the software.
Definition: kaboutdata.h:185
QList::iterator end()
QString toLower() const const
QList< KAboutPerson > credits() const
Returns a list of persons who contributed.
static void setApplicationData(const KAboutData &aboutData)
Sets the application data for this application.
KeepEmptyParts
KAboutData & setOrganizationDomain(const QByteArray &domain)
Defines the domain of the organization that wrote this application.
Definition: kaboutdata.cpp:770
QVariant fromValue(const T &value)
This class is used to store information about a person or developer.
Definition: kaboutdata.h:55
static KAboutData fromPluginMetaData(const KPluginMetaData &plugin)
Creates a KAboutData from the given plugin metadata.
Definition: kaboutdata.cpp:599
static KAboutPerson fromJSON(const QJsonObject &obj)
Creates a KAboutPerson from a JSON object with the following structure:
Definition: kaboutdata.cpp:109
QString ocsUsername() const
The person&#39;s Open Collaboration Services username.
KAboutData & addLicenseText(const QString &license)
Adds a license text, which is translated.
Definition: kaboutdata.cpp:649
QString customAuthorPlainText() const
Returns the plain text displayed around the list of authors instead of the default message telling us...
Definition: kaboutdata.cpp:961
bool isValid() const const
QString displayName() const
Returns the translated program name.
QByteArray toLatin1() const const
QString productName() const
Returns the application&#39;s product name, which will be used in KBugReport dialog.
KAboutData & unsetCustomAuthorText()
Clears any custom text displayed around the list of authors and falls back to the default message tel...
Definition: kaboutdata.cpp:987
bool setupCommandLine(QCommandLineParser *parser)
Configures the parser command line parser to provide an authors entry with information about the deve...
NameFormat
Format of the license name.
Definition: kaboutdata.h:206
KAboutData & setLicenseTextFile(const QString &file)
Defines a license text by pointing to a file where it resides.
Definition: kaboutdata.cpp:664
static KAboutLicense byKeyword(const QString &keyword)
Fetch a known license by a keyword/spdx ID.
Definition: kaboutdata.cpp:397
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
static QString aboutTranslationTeam()
Returns a message about the translation team.
Definition: kaboutdata.cpp:934
This class allows easily accessing some standardized values from the JSON metadata that can be embedd...
KAboutPerson(const QString &name=QString(), const QString &task=QString(), const QString &emailAddress=QString(), const QString &webAddress=QString(), const QString &ocsUsername=QString())
Convenience constructor.
Definition: kaboutdata.cpp:47
QString copyrightStatement() const
Returns the copyright statement.
KAboutData & setComponentName(const QString &componentName)
Defines the component name used internally.
Definition: kaboutdata.cpp:685
QString webAddress() const
The home page or a relevant link.
bool addOption(const QCommandLineOption &option)
char * data()
KAboutData & setProgramLogo(const QVariant &image)
Defines the program logo.
Definition: kaboutdata.cpp:829
QString fromLatin1(const char *str, int size)
const char * internalProgramName() const
Definition: kaboutdata.cpp:806
KAboutData & setProgramIconName(const QString &iconName)
Obsolete method.
Definition: kaboutdata.cpp:817
QString version() const
Returns the program&#39;s version.
bool setProperty(const char *name, const QVariant &value)
KAboutData & operator=(const KAboutData &other)
Assignment operator.
Definition: kaboutdata.cpp:584
KAboutData(const QString &componentName, const QString &displayName, const QString &version, const QString &shortDescription, enum KAboutLicense::LicenseKey licenseType, const QString &copyrightStatement=QString(), const QString &otherText=QString(), const QString &homePageAddress=QString(), const QString &bugAddress=QStringLiteral("[email protected]"))
Constructor.
Definition: kaboutdata.cpp:485
QString customAuthorRichText() const
Returns the rich text displayed around the list of authors instead of the default message telling use...
Definition: kaboutdata.cpp:966
QString programIconName() const
Returns the program&#39;s icon name.
Definition: kaboutdata.cpp:812
QString readAll()
QString toString() const const
QString value(const QString &optionName) const const
QString shortDescription() const
Returns a short, translated description.
QString name() const
The person&#39;s name.
QList::iterator begin()
QString applicationName()
VersionRestriction
Whether later versions of the license are allowed.
Definition: kaboutdata.h:215
QString locate(QStandardPaths::StandardLocation type, const QString &fileName, QStandardPaths::LocateOptions options)
KAboutData & setTranslator(const QString &name, const QString &emailAddress)
Sets the name(s) of the translator(s) of the GUI.
Definition: kaboutdata.cpp:635
QByteArray toUtf8() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Sep 23 2020 23:02:50 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.