File indexing completed on 2024-05-12 11:48:08
0001 /* 0002 This file is part of the KDE Libraries 0003 0004 SPDX-FileCopyrightText: 2000 Espen Sand <espen@kde.org> 0005 SPDX-FileCopyrightText: 2008 Friedrich W. H. Kossebau <kossebau@kde.org> 0006 SPDX-FileCopyrightText: 2010 Teo Mrnjavac <teo@kde.org> 0007 SPDX-FileCopyrightText: 2013 David Faure <faure+bluesystems@kde.org> 0008 SPDX-FileCopyrightText: 2017 Harald Sitter <sitter@kde.org> 0009 SPDX-FileCopyrightText: 2021 Julius Künzel <jk.kdedev@smartlab.uber.space> 0010 0011 SPDX-License-Identifier: LGPL-2.0-or-later 0012 */ 0013 0014 #ifndef KABOUTDATA_H 0015 #define KABOUTDATA_H 0016 0017 #include <QSharedDataPointer> 0018 #include <QString> 0019 #include <QVariant> 0020 #include <kcoreaddons_export.h> 0021 #include <memory> 0022 #include <qcontainerfwd.h> 0023 0024 class QCommandLineParser; 0025 class QJsonObject; 0026 class KAboutData; 0027 class KPluginMetaData; 0028 namespace KCrash 0029 { 0030 #ifdef KCOREADDONS_STATIC 0031 void defaultCrashHandler(int sig); 0032 #else 0033 Q_DECL_IMPORT void defaultCrashHandler(int sig); 0034 #endif 0035 } 0036 0037 /** 0038 * This class is used to store information about a person or developer. 0039 * It can store the person's name, a task, an email address and a 0040 * link to a home page. This class is intended for use in the 0041 * KAboutData class, but it can be used elsewhere as well. 0042 * Normally you should at least define the person's name. 0043 * Creating a KAboutPerson object by yourself is relatively useless, 0044 * but the KAboutData methods KAboutData::authors() and KAboutData::credits() 0045 * return lists of KAboutPerson data objects which you can examine. 0046 * 0047 * Example usage within a main(), retrieving the list of people involved 0048 * with a program and re-using data from one of them: 0049 * 0050 * @code 0051 * KAboutData about("khello", i18n("KHello"), "0.1", 0052 * i18n("A KDE version of Hello, world!"), 0053 * KAboutLicense::LGPL, 0054 * i18n("Copyright (C) 2014 Developer")); 0055 * 0056 * about.addAuthor(i18n("Joe Developer"), i18n("developer"), "joe@host.com", 0); 0057 * QList<KAboutPerson> people = about.authors(); 0058 * about.addCredit(people[0].name(), people[0].task()); 0059 * @endcode 0060 */ 0061 class KCOREADDONS_EXPORT KAboutPerson 0062 { 0063 Q_GADGET 0064 Q_PROPERTY(QString name READ name CONSTANT) 0065 Q_PROPERTY(QString task READ task CONSTANT) 0066 Q_PROPERTY(QString emailAddress READ emailAddress CONSTANT) 0067 Q_PROPERTY(QString webAddress READ webAddress CONSTANT) 0068 Q_PROPERTY(QString ocsUsername READ ocsUsername CONSTANT) 0069 friend class KAboutData; 0070 friend class KAboutDataPrivate; 0071 0072 public: 0073 /** 0074 * Convenience constructor 0075 * 0076 * @param name The name of the person. 0077 * 0078 * @param task The task of this person. 0079 * 0080 * @param emailAddress The email address of the person. 0081 * 0082 * @param webAddress Home page of the person. 0083 * 0084 * @param ocsUsername Open Collaboration Services username of the person. 0085 * 0086 * @p name default argument @since 5.53 0087 */ 0088 explicit KAboutPerson(const QString &name = QString(), 0089 const QString &task = QString(), 0090 const QString &emailAddress = QString(), 0091 const QString &webAddress = QString(), 0092 const QString &ocsUsername = QString()); 0093 0094 /** 0095 * Copy constructor. Performs a deep copy. 0096 * @param other object to copy 0097 */ 0098 KAboutPerson(const KAboutPerson &other); 0099 0100 ~KAboutPerson(); 0101 0102 /** 0103 * Assignment operator. Performs a deep copy. 0104 * @param other object to copy 0105 */ 0106 KAboutPerson &operator=(const KAboutPerson &other); 0107 0108 /** 0109 * The person's name 0110 * @return the person's name (can be QString(), if it has been 0111 * constructed with an empty name) 0112 */ 0113 QString name() const; 0114 0115 /** 0116 * The person's task 0117 * @return the person's task (can be QString(), if it has been 0118 * constructed with an empty task) 0119 */ 0120 QString task() const; 0121 0122 /** 0123 * The person's email address 0124 * @return the person's email address (can be QString(), if it has been 0125 * constructed with an empty email) 0126 */ 0127 QString emailAddress() const; 0128 0129 /** 0130 * The home page or a relevant link 0131 * @return the persons home page (can be QString(), if it has been 0132 * constructed with an empty home page) 0133 */ 0134 QString webAddress() const; 0135 0136 /** 0137 * The person's Open Collaboration Services username 0138 * @return the persons OCS username (can be QString(), if it has been 0139 * constructed with an empty username) 0140 */ 0141 QString ocsUsername() const; 0142 0143 /** 0144 * Creates a @c KAboutPerson from a JSON object with the following structure: 0145 * 0146 * Key | Accessor 0147 * -----------| ---------------------------- 0148 * Name | name() 0149 * Email | emailAddress() 0150 * Task | task() 0151 * Website | webAddress() 0152 * UserName | ocsUsername() 0153 * 0154 * The @c Name and @c Task key are translatable (by using e.g. a "Task[de_DE]" key) 0155 * 0156 * @since 5.18 0157 */ 0158 static KAboutPerson fromJSON(const QJsonObject &obj); 0159 0160 private: 0161 /** 0162 * @internal Used by KAboutData to construct translator data. 0163 */ 0164 KCOREADDONS_NO_EXPORT explicit KAboutPerson(const QString &name, const QString &email, bool disambiguation); 0165 0166 private: 0167 QSharedDataPointer<class KAboutPersonPrivate> d; 0168 }; 0169 0170 /** 0171 * This class is used to store information about a license. 0172 * The license can be one of some predefined, one given as text or one 0173 * that can be loaded from a file. This class is used in the KAboutData class. 0174 * Explicitly creating a KAboutLicense object is not possible. 0175 * If the license is wanted for a KDE component having KAboutData object, 0176 * use KAboutData::licenses() to get the licenses for that component. 0177 * If the license is for a non-code resource and given by a keyword 0178 * (e.g. in .desktop files), try using KAboutLicense::byKeyword(). 0179 */ 0180 class KCOREADDONS_EXPORT KAboutLicense 0181 { 0182 Q_GADGET 0183 Q_PROPERTY(QString name READ name CONSTANT) 0184 Q_PROPERTY(QString text READ text CONSTANT) 0185 Q_PROPERTY(KAboutLicense::LicenseKey key READ key CONSTANT) 0186 Q_PROPERTY(QString spdx READ spdx CONSTANT) 0187 friend class KAboutData; 0188 friend class KAboutComponent; 0189 0190 public: 0191 /** 0192 * Describes the license of the software; for more information see: https://spdx.org/licenses/ 0193 */ 0194 enum LicenseKey { 0195 Custom = -2, ///< Custom license 0196 File = -1, ///< License set from text file, see setLicenseFromPath() 0197 Unknown = 0, ///< Unknown license 0198 GPL = 1, ///< GPL 0199 GPL_V2 = GPL, ///< GPL_V2, this has the same value as LicenseKey::GPL, see https://spdx.org/licenses/GPL-2.0.html 0200 LGPL = 2, ///< LGPL 0201 LGPL_V2 = LGPL, ///< LGPL_V2, this has the same value as LicenseKey::LGPL, see https://spdx.org/licenses/LGPL-2.0-only.html 0202 BSDL = 3, ///< BSDL, see https://spdx.org/licenses/BSD-2-Clause.html 0203 Artistic = 4, ///< Artistic, see https://spdx.org/licenses/Artistic-2.0.html 0204 QPL = 5, ///< QPL 0205 QPL_V1_0 = QPL, ///< QPL_V1_0, this has the same value as LicenseKey::QPL, see https://spdx.org/licenses/QPL-1.0.html 0206 GPL_V3 = 6, ///< GPL_V3, see https://spdx.org/licenses/GPL-3.0.html 0207 LGPL_V3 = 7, ///< LGPL_V3, see https://spdx.org/licenses/LGPL-3.0-only.html 0208 LGPL_V2_1 = 8, ///< LGPL_V2_1 @since 5.25, see https://spdx.org/licenses/LGPL-2.1-only.html 0209 }; 0210 Q_ENUM(LicenseKey) 0211 0212 /** 0213 * Format of the license name. 0214 */ 0215 enum NameFormat { 0216 ShortName, 0217 FullName, 0218 }; 0219 Q_ENUM(NameFormat) 0220 0221 /** 0222 * Whether later versions of the license are allowed. 0223 */ 0224 enum VersionRestriction { 0225 OnlyThisVersion, 0226 OrLaterVersions, 0227 }; 0228 Q_ENUM(VersionRestriction) 0229 0230 /** 0231 * @since 5.53 0232 */ 0233 explicit KAboutLicense(); 0234 0235 /** 0236 * Copy constructor. Performs a deep copy. 0237 * @param other object to copy 0238 */ 0239 KAboutLicense(const KAboutLicense &other); 0240 0241 ~KAboutLicense(); 0242 0243 /** 0244 * Assignment operator. Performs a deep copy. 0245 * @param other object to copy 0246 */ 0247 KAboutLicense &operator=(const KAboutLicense &other); 0248 0249 /** 0250 * Returns the full license text. If the licenseType argument of the 0251 * constructor has been used, any text defined by setLicenseText is ignored, 0252 * and the standard text for the chosen license will be returned. 0253 * 0254 * @return The license text. 0255 */ 0256 QString text() const; 0257 0258 /** 0259 * Returns the license name. 0260 * 0261 * Default argument @since 5.53 0262 * 0263 * @return The license name as a string. 0264 */ 0265 QString name(KAboutLicense::NameFormat formatName = ShortName) const; 0266 0267 /** 0268 * Returns the license key. 0269 * 0270 * @return The license key as element of KAboutLicense::LicenseKey enum. 0271 */ 0272 KAboutLicense::LicenseKey key() const; 0273 0274 /** 0275 * Returns the SPDX license expression of this license. 0276 * If the underlying license cannot be expressed as a SPDX expression a null string is returned. 0277 * 0278 * @note SPDX expression are expansive constructs. If you parse the return value, do it in a 0279 * SPDX specification compliant manner by splitting on whitespaces to discard unwanted 0280 * information or by using a complete SPDX license expression parser. 0281 * @note SPDX identifiers are case-insensitive. Do not use case-sensitive checks on the return 0282 * value. 0283 * @see https://spdx.org/licenses 0284 * @return SPDX license expression or QString() if the license has no identifier. Compliant 0285 * with SPDX 2.1. 0286 * 0287 * @since 5.37 0288 */ 0289 QString spdx() const; 0290 0291 /** 0292 * Fetch a known license by a keyword/spdx ID 0293 * 0294 * Frequently the license data is provided by a terse keyword-like string, 0295 * e.g. by a field in a .desktop file. Using this method, an application 0296 * can get hold of a proper KAboutLicense object, providing that the 0297 * license is one of the several known to KDE, and use it to present 0298 * more human-readable information to the user. 0299 * 0300 * Keywords are matched by stripping all whitespace and lowercasing. 0301 * The known keywords correspond to the KAboutLicense::LicenseKey enumeration, 0302 * e.g. any of "LGPLV3", "LGPLv3", "LGPL v3" would match KAboutLicense::LGPL_V3. 0303 * If there is no match for the keyword, a valid license object is still 0304 * returned, with its name and text informing about a custom license, 0305 * and its key equal to KAboutLicense::Custom. 0306 * 0307 * @param keyword The license keyword. 0308 * @return The license object. 0309 * 0310 * @see KAboutLicense::LicenseKey 0311 */ 0312 static KAboutLicense byKeyword(const QString &keyword); 0313 0314 private: 0315 /** 0316 * @internal Used by KAboutData to construct a predefined license. 0317 */ 0318 KCOREADDONS_NO_EXPORT explicit KAboutLicense(enum KAboutLicense::LicenseKey licenseType, 0319 enum KAboutLicense::VersionRestriction versionRestriction, 0320 const KAboutData *aboutData); 0321 /** 0322 * @internal Used by KAboutData to construct a predefined license. 0323 */ 0324 KCOREADDONS_NO_EXPORT explicit KAboutLicense(enum KAboutLicense::LicenseKey licenseType, const KAboutData *aboutData); 0325 /** 0326 * @internal Used by KAboutData to construct a KAboutLicense 0327 */ 0328 KCOREADDONS_NO_EXPORT explicit KAboutLicense(const KAboutData *aboutData); 0329 /** 0330 * @internal Used by KAboutData to construct license by given text 0331 */ 0332 KCOREADDONS_NO_EXPORT void setLicenseFromPath(const QString &pathToFile); 0333 /** 0334 * @internal Used by KAboutData to construct license by given text 0335 */ 0336 KCOREADDONS_NO_EXPORT void setLicenseFromText(const QString &licenseText); 0337 0338 private: 0339 QSharedDataPointer<class KAboutLicensePrivate> d; 0340 }; 0341 0342 /** 0343 * This class is used to store information about a third party component. 0344 * It can store the component's name, a description, a link to a website 0345 * and the license of the libary. This class is intended for use in the 0346 * KAboutData class, but it can be used elsewhere as well. 0347 * Normally you should at least define the libary's name. 0348 * Creating a KAboutComponent object by yourself is relatively useless, 0349 * but the KAboutData method KAboutData::libaries() return lists of 0350 * KAboutComponent data objects which you can examine. 0351 * 0352 * Example usage within a main(), retrieving the list of components used 0353 * by a program and re-using data from one of them: 0354 * 0355 * @code 0356 * KAboutData about("khello", i18n("KHello"), "0.1", 0357 * i18n("A KDE version of Hello, world!"), 0358 * KAboutLicense::LGPL, 0359 * i18n("Copyright (C) 2014 Developer")); 0360 * 0361 * about.addComponent(i18n("Awsom Lib"), 0362 * i18n("Does awesom stuff. Copyright (C) 2014"), 0363 * i18n("1.02.3"), 0364 * "http://example.com", 0365 * KAboutLicense::LGPL); 0366 * QList<KAboutComponent> components = about.components(); 0367 * @endcode 0368 * 0369 * @since 5.84 0370 */ 0371 class KCOREADDONS_EXPORT KAboutComponent 0372 { 0373 Q_GADGET 0374 Q_PROPERTY(QString name READ name CONSTANT) 0375 Q_PROPERTY(QString description READ description CONSTANT) 0376 Q_PROPERTY(QString webAddress READ webAddress CONSTANT) 0377 Q_PROPERTY(KAboutLicense licenses READ license CONSTANT) 0378 Q_PROPERTY(QString version READ version CONSTANT) 0379 friend class KAboutData; 0380 friend class KAboutDataPrivate; 0381 0382 public: 0383 /** 0384 * Convenience constructor 0385 * 0386 * @param name The name of the component. 0387 * 0388 * @param description The description of this component. 0389 * 0390 * @param version The version of this component. 0391 * 0392 * @param webAddress Website of the component. 0393 * 0394 * @param licenseType The license identifier of the component. 0395 * 0396 * @p name default argument 0397 */ 0398 explicit KAboutComponent(const QString &name = QString(), 0399 const QString &description = QString(), 0400 const QString &version = QString(), 0401 const QString &webAddress = QString(), 0402 enum KAboutLicense::LicenseKey licenseType = KAboutLicense::Unknown); 0403 0404 /** 0405 * Convenience constructor 0406 * 0407 * @param name The name of the component. 0408 * 0409 * @param description The description of this component. 0410 * 0411 * @param version The version of this component. 0412 * 0413 * @param webAddress Website of the component. 0414 * 0415 * @param pathToLicenseFile Path to the file in the local filesystem containing the license text. 0416 * The file format has to be plain text in an encoding compatible to the local. 0417 * 0418 * @p name default argument 0419 */ 0420 explicit KAboutComponent(const QString &name, 0421 const QString &description, 0422 const QString &version, 0423 const QString &webAddress, 0424 const QString &pathToLicenseFile); 0425 0426 /** 0427 * Copy constructor. Performs a deep copy. 0428 * @param other object to copy 0429 */ 0430 KAboutComponent(const KAboutComponent &other); 0431 0432 ~KAboutComponent(); 0433 0434 /** 0435 * Assignment operator. Performs a deep copy. 0436 * @param other object to copy 0437 */ 0438 KAboutComponent &operator=(const KAboutComponent &other); 0439 0440 /** 0441 * The component's name 0442 * @return the component's name (can be QString(), if it has been 0443 * constructed with an empty name) 0444 */ 0445 QString name() const; 0446 0447 /** 0448 * The component's description 0449 * @return the component's description (can be empty) 0450 */ 0451 QString description() const; 0452 0453 /** 0454 * The component's version 0455 * @return the component's task (can be empty) 0456 */ 0457 QString version() const; 0458 0459 /** 0460 * The website or a relevant link 0461 * @return the component's website (can be empty) 0462 */ 0463 QString webAddress() const; 0464 0465 /** 0466 * The component's license 0467 * @return the component's KAboutLicense 0468 */ 0469 KAboutLicense license() const; 0470 0471 private: 0472 QSharedDataPointer<class KAboutComponentPrivate> d; 0473 }; 0474 0475 /** 0476 * @class KAboutData kaboutdata.h KAboutData 0477 * 0478 * This class is used to store information about a program or plugin. 0479 * It can store such values as version number, program name, home page, address 0480 * for bug reporting, multiple authors and contributors 0481 * (using KAboutPerson), license and copyright information. 0482 * 0483 * Currently, the values set here are shown by the "About" box 0484 * (see KAboutDialog), used by the bug report dialog (see KBugReport), 0485 * and by the help shown on command line (see KAboutData::setupCommandLine()). 0486 * 0487 * Porting Notes: Since KDE Frameworks 5.0, the translation catalog mechanism 0488 * must be provided by your translation framework to load the correct catalog 0489 * instead (eg: KLocalizedString::setApplicationDomain() for KI18n, or 0490 * QCoreApplication::installTranslator() for Qt's translation system). This 0491 * applies to the old setCatalogName() and catalogName() members. But see also 0492 * K4AboutData in kde4support as a compatibility class. 0493 * 0494 * Example: 0495 * Setting the metadata of an application using KAboutData in code also relying 0496 * on the KDE Framework modules KI18n and KDBusAddons: 0497 * @code 0498 * // create QApplication instance 0499 * QApplication app(argc, argv); 0500 * // setup translation string domain for the i18n calls 0501 * KLocalizedString::setApplicationDomain("foo"); 0502 * // create a KAboutData object to use for setting the application metadata 0503 * KAboutData aboutData("foo", i18n("Foo"), "0.1", 0504 * i18n("To Foo or not To Foo"), 0505 * KAboutLicense::LGPL, 0506 * i18n("Copyright 2017 Bar Foundation"), QString(), 0507 * "https://www.foo-the-app.net"); 0508 * // overwrite default-generated values of organizationDomain & desktopFileName 0509 * aboutData.setOrganizationDomain("barfoundation.org"); 0510 * aboutData.setDesktopFileName("org.barfoundation.foo"); 0511 * 0512 * // set the application metadata 0513 * KAboutData::setApplicationData(aboutData); 0514 * // in GUI apps set the window icon manually, not covered by KAboutData 0515 * // needed for environments where the icon name is not extracted from 0516 * // the information in the application's desktop file 0517 * QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("foo"))); 0518 * 0519 * // integrate with commandline argument handling 0520 * QCommandLineParser parser; 0521 * aboutData.setupCommandLine(&parser); 0522 * // setup of app specific commandline args 0523 * [...] 0524 * parser.process(app); 0525 * aboutData.processCommandLine(&parser); 0526 * 0527 * // with the application metadata set, register to the D-Bus session 0528 * KDBusService programDBusService(KDBusService::Multiple | KDBusService::NoExitOnFailure); 0529 * @endcode 0530 * 0531 * @short Holds information needed by the "About" box and other 0532 * classes. 0533 * @author Espen Sand (espen@kde.org), David Faure (faure@kde.org) 0534 * 0535 */ 0536 class KCOREADDONS_EXPORT KAboutData 0537 { 0538 Q_GADGET 0539 Q_PROPERTY(QString displayName READ displayName CONSTANT) 0540 Q_PROPERTY(QString productName READ productName CONSTANT) 0541 Q_PROPERTY(QString componentName READ componentName CONSTANT) 0542 Q_PROPERTY(QVariant programLogo READ programLogo CONSTANT) 0543 Q_PROPERTY(QString shortDescription READ shortDescription CONSTANT) 0544 Q_PROPERTY(QString homepage READ homepage CONSTANT) 0545 Q_PROPERTY(QString bugAddress READ bugAddress CONSTANT) 0546 Q_PROPERTY(QString version READ version CONSTANT) 0547 Q_PROPERTY(QString otherText READ otherText CONSTANT) 0548 Q_PROPERTY(QVariantList authors READ authorsVariant CONSTANT) // constant in practice as addAuthor is not exposed to Q_GADGET 0549 Q_PROPERTY(QVariantList credits READ creditsVariant CONSTANT) 0550 Q_PROPERTY(QVariantList translators READ translatorsVariant CONSTANT) 0551 Q_PROPERTY(QVariantList components READ componentsVariant CONSTANT) 0552 Q_PROPERTY(QVariantList licenses READ licensesVariant CONSTANT) 0553 Q_PROPERTY(QString copyrightStatement READ copyrightStatement CONSTANT) 0554 Q_PROPERTY(QString desktopFileName READ desktopFileName CONSTANT) 0555 public: 0556 /** 0557 * Returns the KAboutData for the application. 0558 * 0559 * This contains information such as authors, license, etc., 0560 * provided that setApplicationData has been called before. 0561 * If not called before, the returned KAboutData will be initialized from the 0562 * equivalent properties of QCoreApplication (and its subclasses), 0563 * if an instance of that already exists. 0564 * For the list of such properties see setApplicationData 0565 * (before 5.22: limited to QCoreApplication::applicationName). 0566 * @see setApplicationData 0567 */ 0568 static KAboutData applicationData(); 0569 0570 /** 0571 * Sets the application data for this application. 0572 * 0573 * In addition to changing the result of applicationData(), this initializes 0574 * the equivalent properties of QCoreApplication (and its subclasses) with 0575 * information from @p aboutData, if an instance of that already exists. 0576 * Those properties are: 0577 <ul> 0578 <li>QCoreApplication::applicationName</li> 0579 <li>QCoreApplication::applicationVersion</li> 0580 <li>QCoreApplication::organizationDomain</li> 0581 <li>QGuiApplication::applicationDisplayName</li> 0582 <li>QGuiApplication::desktopFileName (since 5.16)</li> 0583 </ul> 0584 * @see applicationData 0585 */ 0586 static void setApplicationData(const KAboutData &aboutData); 0587 0588 // BUILD, not ENABLE, as producers need to support the registry for backward-compat 0589 #if KCOREADDONS_BUILD_DEPRECATED_SINCE(5, 76) 0590 /** 0591 * Register the KAboutData information for a plugin. 0592 * Call this from the constructor of the plugin. 0593 * This will register the plugin's @p aboutData under the component name 0594 * that was set in @p aboutData. 0595 * @deprecated Since 5.76. The central registry is to be removed in the future 0596 * in favour of plugin type specific local registries, using KPluginMetaData. 0597 */ 0598 KCOREADDONS_DEPRECATED_VERSION(5, 76, "See API docs") 0599 static void registerPluginData(const KAboutData &aboutData); 0600 #endif 0601 0602 #if KCOREADDONS_ENABLE_DEPRECATED_SINCE(5, 76) 0603 /** 0604 * Return the KAboutData for the given plugin identified by @p componentName. 0605 * @deprecated Since 5.76. The central registry is to be removed in the future 0606 * in favour of plugin type specific local registries, using KPluginMetaData. 0607 */ 0608 KCOREADDONS_DEPRECATED_VERSION(5, 76, "See API docs") 0609 static KAboutData *pluginData(const QString &componentName); 0610 #endif 0611 0612 #if KCOREADDONS_ENABLE_DEPRECATED_SINCE(5, 65) 0613 /** 0614 * Creates a @c KAboutData from the given @p plugin metadata 0615 * 0616 * @since 5.18 0617 * @deprecated Since 5.65, use KAboutPluginDialog to show info about a plugin 0618 * instead of KAboutApplicationDialog, with the latter having had been the 0619 * only known need for this conversion. 0620 */ 0621 KCOREADDONS_DEPRECATED_VERSION(5, 65, "See API docs") 0622 static KAboutData fromPluginMetaData(const KPluginMetaData &plugin); 0623 #endif 0624 0625 public: 0626 /** 0627 * Constructor. 0628 * 0629 * Porting Note: The @p catalogName parameter present in KDE4 was 0630 * deprecated and removed. See also K4AboutData 0631 * in kde4support if this feature is needed for compatibility purposes, or 0632 * consider using componentName() instead. 0633 * 0634 * @param componentName The program name or plugin name used internally. 0635 * Example: QStringLiteral("kwrite"). This should never be translated. 0636 * 0637 * @param displayName A displayable name for the program or plugin. This string 0638 * should be translated. Example: i18n("KWrite") 0639 * 0640 * @param version The component version string. Example: QStringLiteral("1.0"). 0641 * 0642 * @param shortDescription A short description of what the component does. 0643 * This string should be translated. 0644 * Example: i18n("A simple text editor.") 0645 * 0646 * @param licenseType The license identifier. Use setLicenseText or 0647 setLicenseTextFile if you use a license not predefined here. 0648 * 0649 * @param copyrightStatement A copyright statement, that can look like this: 0650 * i18n("Copyright (C) 1999-2000 Name"). The string specified here is 0651 * taken verbatim; the author information from addAuthor is not used. 0652 * 0653 * @param otherText Some free form text, that can contain any kind of 0654 * information. The text can contain newlines. This string 0655 * should be translated. 0656 * 0657 * @param homePageAddress The URL to the component's homepage, including 0658 * URL scheme. "http://some.domain" is correct, "some.domain" is 0659 * not. Since KDE Frameworks 5.17, https and other valid URL schemes 0660 * are also valid. See also the note below. 0661 * 0662 * @param bugAddress The bug report address string, an email address or a URL. 0663 * This defaults to the kde.org bug system. 0664 * 0665 * @note The @p homePageAddress argument is used to derive a default organization 0666 * domain for the application (which is used to register on the session D-Bus, 0667 * locate the appropriate desktop file, etc.), by taking the host name and dropping 0668 * the first component, unless there are less than three (e.g. "www.kde.org" -> "kde.org"). 0669 * Use both setOrganizationDomain(const QByteArray&) and setDesktopFileName() if their default values 0670 * do not have proper values. 0671 * 0672 * @see setOrganizationDomain(const QByteArray&), setDesktopFileName(const QString&) 0673 */ 0674 // KF6: remove constructor that includes catalogName, and put default 0675 // values back in for shortDescription and licenseType 0676 KAboutData(const QString &componentName, 0677 const QString &displayName, 0678 const QString &version, 0679 const QString &shortDescription, 0680 enum KAboutLicense::LicenseKey licenseType, 0681 const QString ©rightStatement = QString(), 0682 const QString &otherText = QString(), 0683 const QString &homePageAddress = QString(), 0684 const QString &bugAddress = QStringLiteral("submit@bugs.kde.org")); 0685 0686 /** 0687 * Constructor. 0688 * 0689 * @param componentName The program name or plugin name used internally. 0690 * Example: "kwrite". 0691 * 0692 * @param displayName A displayable name for the program or plugin. This string 0693 * should be translated. Example: i18n("KWrite") 0694 * 0695 * @param version The component version string. 0696 * 0697 * Sets the property desktopFileName to "org.kde."+componentName and 0698 * the property organizationDomain to "kde.org". 0699 * 0700 * Default arguments @since 5.53 0701 * 0702 * @see setOrganizationDomain(const QByteArray&), setDesktopFileName(const QString&) 0703 */ 0704 explicit KAboutData(const QString &componentName = {}, const QString &displayName = {}, const QString &version = {}); 0705 0706 /** 0707 * Copy constructor. Performs a deep copy. 0708 * @param other object to copy 0709 */ 0710 KAboutData(const KAboutData &other); 0711 0712 /** 0713 * Assignment operator. Performs a deep copy. 0714 * @param other object to copy 0715 */ 0716 KAboutData &operator=(const KAboutData &other); 0717 0718 ~KAboutData(); 0719 0720 /** 0721 * Defines an author. 0722 * 0723 * You can call this function as many times as you need. Each entry is 0724 * appended to a list. The person in the first entry is assumed to be 0725 * the leader of the project. 0726 * 0727 * @param name The developer's name. It should be translated. 0728 * 0729 * @param task What the person is responsible for. This text can contain 0730 * newlines. It should be translated. 0731 * Can be left empty. 0732 * 0733 * @param emailAddress An Email address where the person can be reached. 0734 * Can be left empty. 0735 * 0736 * @param webAddress The person's homepage or a relevant link. 0737 * Start the address with "http://". "http://some.domain" is 0738 * correct, "some.domain" is not. Can be left empty. 0739 * 0740 * @param ocsUsername The person's Open Collaboration Services username. 0741 * The provider can be optionally specified with @see setOcsProvider. 0742 * 0743 */ 0744 KAboutData &addAuthor(const QString &name, 0745 const QString &task = QString(), 0746 const QString &emailAddress = QString(), 0747 const QString &webAddress = QString(), 0748 const QString &ocsUsername = QString()); 0749 0750 /** 0751 * Defines a person that deserves credit. 0752 * 0753 * You can call this function as many times as you need. Each entry 0754 * is appended to a list. 0755 * 0756 * @param name The person's name. It should be translated. 0757 * 0758 * @param task What the person has done to deserve the honor. The 0759 * text can contain newlines. It should be translated. 0760 * Can be left empty. 0761 * 0762 * @param emailAddress An email address when the person can be reached. 0763 * Can be left empty. 0764 * 0765 * @param webAddress The person's homepage or a relevant link. 0766 * Start the address with "http://". "http://some.domain" is 0767 * is correct, "some.domain" is not. Can be left empty. 0768 * 0769 * @param ocsUsername The person's Open Collaboration Services username. 0770 * The provider can be optionally specified with @see setOcsProvider. 0771 * 0772 */ 0773 KAboutData &addCredit(const QString &name, 0774 const QString &task = QString(), 0775 const QString &emailAddress = QString(), 0776 const QString &webAddress = QString(), 0777 const QString &ocsUsername = QString()); 0778 0779 /** 0780 * @brief Sets the name(s) of the translator(s) of the GUI. 0781 * 0782 * The canonical use with the ki18n framework is: 0783 * 0784 * \code 0785 * setTranslator(i18nc("NAME OF TRANSLATORS", "Your names"), 0786 * i18nc("EMAIL OF TRANSLATORS", "Your emails")); 0787 * \endcode 0788 * 0789 * If you are using a KMainWindow this is done for you automatically. 0790 * 0791 * The name and emailAddress are treated as lists separated with ",". 0792 * 0793 * If the strings are empty or "Your names"/"Your emails" 0794 * respectively they will be ignored. 0795 * 0796 * @param name the name(s) of the translator(s) 0797 * @param emailAddress the email address(es) of the translator(s) 0798 * @see KAboutTranslator 0799 */ 0800 KAboutData &setTranslator(const QString &name, const QString &emailAddress); 0801 0802 /** 0803 * Defines a component that is used by the application. 0804 * 0805 * You can call this function as many times as you need. Each entry is 0806 * appended to a list. 0807 * 0808 * @param name The component's name. It should be translated. 0809 * 0810 * @param description Short description of the component and maybe 0811 * copyright info. This text can contain newlines. It should 0812 * be translated. Can be left empty. 0813 * 0814 * @param version The version of the component. Can be left empty. 0815 * 0816 * @param webAddress The component's homepage or a relevant link. 0817 * Start the address with "http://". "http://some.domain" is 0818 * correct, "some.domain" is not. Can be left empty. 0819 * 0820 * @param licenseKey The component's license identifier. Can be left empty (i.e. KAboutLicense::Unknown) 0821 * 0822 * @since 5.84 0823 */ 0824 KAboutData &addComponent(const QString &name, 0825 const QString &description = QString(), 0826 const QString &version = QString(), 0827 const QString &webAddress = QString(), 0828 KAboutLicense::LicenseKey licenseKey = KAboutLicense::Unknown); 0829 0830 /** 0831 * Defines a component that is used by the application with a custom license text file. 0832 * 0833 * You can call this function as many times as you need. Each entry is 0834 * appended to a list. 0835 * 0836 * @param name The component's name. It should be translated. 0837 * 0838 * @param description Short description of the component and maybe 0839 * copyright info. This text can contain newlines. It should 0840 * be translated. Can be left empty. 0841 * 0842 * @param version The version of the component. Can be left empty. 0843 * 0844 * @param webAddress The component's homepage or a relevant link. 0845 * Start the address with "http://". "http://some.domain" is 0846 * correct, "some.domain" is not. Can be left empty. 0847 * 0848 * @param pathToLicenseFile Path to the file in the local filesystem containing the license text. 0849 * The file format has to be plain text in an encoding compatible to the local. 0850 * 0851 * @since 5.84 0852 */ 0853 KAboutData & 0854 addComponent(const QString &name, const QString &description, const QString &version, const QString &webAddress, const QString &pathToLicenseFile); 0855 0856 /** 0857 * Defines a license text, which is translated. 0858 * 0859 * Example: 0860 * \code 0861 * setLicenseText( i18n("This is my license") ); 0862 * \endcode 0863 * 0864 * @param license The license text. 0865 */ 0866 KAboutData &setLicenseText(const QString &license); 0867 0868 /** 0869 * Adds a license text, which is translated. 0870 * 0871 * If there is only one unknown license set, e.g. by using the default 0872 * parameter in the constructor, that one is replaced. 0873 * 0874 * Example: 0875 * \code 0876 * addLicenseText( i18n("This is my license") ); 0877 * \endcode 0878 * 0879 * @param license The license text. 0880 * @see setLicenseText, addLicense, addLicenseTextFile 0881 */ 0882 KAboutData &addLicenseText(const QString &license); 0883 0884 /** 0885 * Defines a license text by pointing to a file where it resides. 0886 * The file format has to be plain text in an encoding compatible to the locale. 0887 * 0888 * @param file Path to the file in the local filesystem containing the license text. 0889 */ 0890 KAboutData &setLicenseTextFile(const QString &file); 0891 0892 /** 0893 * Adds a license text by pointing to a file where it resides. 0894 * The file format has to be plain text in an encoding compatible to the locale. 0895 * 0896 * If there is only one unknown license set, e.g. by using the default 0897 * parameter in the constructor, that one is replaced. 0898 * 0899 * @param file Path to the file in the local filesystem containing the license text. 0900 * @see addLicenseText, addLicense, setLicenseTextFile 0901 */ 0902 KAboutData &addLicenseTextFile(const QString &file); 0903 0904 /** 0905 * Defines the component name used internally. 0906 * 0907 * @param componentName The application or plugin name. Example: "kate". 0908 */ 0909 KAboutData &setComponentName(const QString &componentName); 0910 0911 /** 0912 * Defines the displayable component name string. 0913 * 0914 * @param displayName The display name. This string should be 0915 * translated. 0916 * Example: i18n("Advanced Text Editor"). 0917 */ 0918 KAboutData &setDisplayName(const QString &displayName); 0919 0920 #if KCOREADDONS_ENABLE_DEPRECATED_SINCE(5, 2) 0921 /** 0922 * Obsolete method 0923 * 0924 * This method used to set the icon name but this is no longer 0925 * possible in KDE Frameworks 5 because KCoreAddons does not 0926 * depend on QtGui. 0927 * 0928 * @param iconName name of the icon. Example: "accessories-text-editor" 0929 * @see programIconName() 0930 * 0931 * @deprecated since 5.2, use QApplication::setWindowIcon(QIcon::fromTheme()) instead. 0932 */ 0933 KCOREADDONS_DEPRECATED_VERSION(5, 2, "Use QApplication::setWindowIcon") 0934 KAboutData &setProgramIconName(const QString &iconName); 0935 #endif 0936 /** 0937 * Defines the program logo. 0938 * 0939 * Use this if you need to have an application logo 0940 * in AboutData other than the application icon. 0941 * 0942 * Because KAboutData is a core class it cannot use QImage/QPixmap/QIcon directly, 0943 * so this is a QVariant that should contain a QImage/QPixmap/QIcon. 0944 * 0945 * QIcon should be preferred, to be able to properly handle HiDPI scaling. 0946 * If a QIcon is provided, it will be used at a typical size of 48x48. 0947 * 0948 * @param image logo image. 0949 * @see programLogo() 0950 */ 0951 KAboutData &setProgramLogo(const QVariant &image); 0952 0953 /** 0954 * Specifies an Open Collaboration Services provider by URL. 0955 * A provider file must be available for the chosen provider. 0956 * 0957 * Use this if you need to override the default provider. 0958 * 0959 * If this method is not used, all the KAboutPerson OCS usernames 0960 * will be used with the openDesktop.org entry from the default 0961 * provider file. 0962 * 0963 * @param providerUrl The provider URL as defined in the provider file. 0964 */ 0965 KAboutData &setOcsProvider(const QString &providerUrl); 0966 0967 /** 0968 * Defines the program version string. 0969 * 0970 * @param version The program version. 0971 */ 0972 KAboutData &setVersion(const QByteArray &version); 0973 0974 /** 0975 * Defines a short description of what the program does. 0976 * 0977 * @param shortDescription The program description. This string should 0978 * be translated. Example: i18n("An advanced text 0979 * editor with syntax highlighting support."). 0980 */ 0981 KAboutData &setShortDescription(const QString &shortDescription); 0982 0983 /** 0984 * Defines the license identifier. 0985 * 0986 * @param licenseKey The license identifier. 0987 * @see addLicenseText, setLicenseText, setLicenseTextFile 0988 */ 0989 KAboutData &setLicense(KAboutLicense::LicenseKey licenseKey); 0990 0991 /** 0992 * Defines the license identifier. 0993 * 0994 * @param licenseKey The license identifier. 0995 * @param versionRestriction Whether later versions of the license are also allowed. 0996 * e.g. licensed under "GPL 2.0 or at your option later versions" would be OrLaterVersions. 0997 * @see addLicenseText, setLicenseText, setLicenseTextFile 0998 * 0999 * @since 5.37 1000 */ 1001 KAboutData &setLicense(KAboutLicense::LicenseKey licenseKey, KAboutLicense::VersionRestriction versionRestriction); 1002 1003 /** 1004 * Adds a license identifier. 1005 * 1006 * If there is only one unknown license set, e.g. by using the default 1007 * parameter in the constructor, that one is replaced. 1008 * 1009 * @param licenseKey The license identifier. 1010 * @see setLicenseText, addLicenseText, addLicenseTextFile 1011 */ 1012 KAboutData &addLicense(KAboutLicense::LicenseKey licenseKey); 1013 1014 /** 1015 * Adds a license identifier. 1016 * 1017 * If there is only one unknown license set, e.g. by using the default 1018 * parameter in the constructor, that one is replaced. 1019 * 1020 * @param licenseKey The license identifier. 1021 * @param versionRestriction Whether later versions of the license are also allowed. 1022 * e.g. licensed under "GPL 2.0 or at your option later versions" would be OrLaterVersions. 1023 * @see setLicenseText, addLicenseText, addLicenseTextFile 1024 * 1025 * @since 5.37 1026 */ 1027 KAboutData &addLicense(KAboutLicense::LicenseKey licenseKey, KAboutLicense::VersionRestriction versionRestriction); 1028 1029 /** 1030 * Defines the copyright statement to show when displaying the license. 1031 * 1032 * @param copyrightStatement A copyright statement, that can look like 1033 * this: i18n("Copyright (C) 1999-2000 Name"). The string specified here is 1034 * taken verbatim; the author information from addAuthor is not used. 1035 */ 1036 KAboutData &setCopyrightStatement(const QString ©rightStatement); 1037 1038 /** 1039 * Defines the additional text to show in the about dialog. 1040 * 1041 * @param otherText Some free form text, that can contain any kind of 1042 * information. The text can contain newlines. This string 1043 * should be translated. 1044 */ 1045 KAboutData &setOtherText(const QString &otherText); 1046 1047 /** 1048 * Defines the program homepage. 1049 * 1050 * @param homepage The program homepage string. 1051 * Start the address with "http://". "http://kate.kde.org" 1052 * is correct but "kate.kde.org" is not. 1053 */ 1054 KAboutData &setHomepage(const QString &homepage); 1055 1056 /** 1057 * Defines the address where bug reports should be sent. 1058 * 1059 * @param bugAddress The bug report email address or URL. 1060 * This defaults to the kde.org bug system. 1061 */ 1062 KAboutData &setBugAddress(const QByteArray &bugAddress); 1063 1064 /** 1065 * Defines the domain of the organization that wrote this application. 1066 * The domain is set to kde.org by default, or the domain of the homePageAddress constructor argument, 1067 * if set. 1068 * 1069 * Make sure to call setOrganizationDomain(const QByteArray&) if your product 1070 * is not developed inside the KDE community. 1071 * 1072 * Used e.g. for the registration to D-Bus done by KDBusService 1073 * from the KDE Frameworks KDBusAddons module. 1074 * 1075 * Calling this method has no effect on the value of the desktopFileName property. 1076 * 1077 * @note If your program should work as a D-Bus activatable service, the base name 1078 * of the D-Bus service description file or of the desktop file you install must match 1079 * the D-Bus "well-known name" for which the program will register. 1080 * For example, KDBusService will use a name created from the reversed organization domain 1081 * with the component name attached, so for an organization domain "bar.org" and a 1082 * component name "foo" the name of an installed D-Bus service file needs to be 1083 * "org.bar.foo.service" or the name of the installed desktop file "org.bar.foo.desktop" 1084 * (and the desktopFileName property accordingly set to "org.bar.foo"). 1085 * For still supporting the deprecated start of services via KToolInvocation, 1086 * the desktop file needs to have an entry with the key "X-DBUS-ServiceName" 1087 * and a value which matches the used D-Bus "well-known name" as just described, 1088 * so with the above used values it needs a line "X-DBUS-ServiceName=org.bar.foo" 1089 * 1090 * @param domain the domain name, for instance kde.org, koffice.org, etc. 1091 * 1092 * @see setDesktopFileName(const QString&) 1093 */ 1094 KAboutData &setOrganizationDomain(const QByteArray &domain); 1095 1096 /** 1097 * Defines the product name which will be used in the KBugReport dialog. 1098 * By default it's the componentName, but you can overwrite it here to provide 1099 * support for special components e.g. in the form 'product/component', 1100 * such as 'kontact/summary'. 1101 * 1102 * @param name The name of product 1103 */ 1104 KAboutData &setProductName(const QByteArray &name); 1105 1106 /** 1107 * Returns the application's internal name. 1108 * @return the internal program name. 1109 */ 1110 QString componentName() const; 1111 1112 /** 1113 * Returns the application's product name, which will be used in KBugReport 1114 * dialog. By default it returns componentName(), otherwise the one which is set 1115 * with setProductName() 1116 * 1117 * @return the product name. 1118 */ 1119 QString productName() const; 1120 1121 /** 1122 * @internal 1123 * Provided for use by KCrash 1124 */ 1125 const char *internalProductName() const; 1126 1127 /** 1128 * Returns the translated program name. 1129 * @return the program name (translated). 1130 */ 1131 QString displayName() const; 1132 1133 /** 1134 * Returns the domain name of the organization that wrote this application. 1135 * 1136 * @see setOrganizationDomain(const QByteArray&) 1137 */ 1138 QString organizationDomain() const; 1139 1140 /** 1141 * @internal 1142 * Provided for use by KCrash 1143 */ 1144 const char *internalProgramName() const; 1145 1146 // Not using KCOREADDONS_ENABLE_DEPRECATED_SINCE because KXmlGui and KConfigWidgets need this, for compat 1147 #if KCOREADDONS_BUILD_DEPRECATED_SINCE(5, 2) 1148 /** 1149 * Returns the program's icon name. 1150 * 1151 * The default value is componentName(). 1152 * @return the program's icon name. 1153 * 1154 * This is mostly for compatibility, given that setProgramIconName is deprecated. 1155 * @deprecated Since 5.2, Use QGuiApplication::windowIcon instead 1156 */ 1157 KCOREADDONS_DEPRECATED_VERSION(5, 2, "Use QGuiApplication::windowIcon instead") 1158 QString programIconName() const; 1159 #endif 1160 1161 /** 1162 * Returns the program logo image. 1163 * 1164 * Because KAboutData is a core class it cannot use QImage/QPixmap/QIcon directly, 1165 * so this is a QVariant containing a QImage/QPixmap/QIcon. 1166 * 1167 * @return the program logo data, or a null image if there is 1168 * no custom application logo defined. 1169 */ 1170 QVariant programLogo() const; 1171 1172 /** 1173 * Returns the chosen Open Collaboration Services provider URL. 1174 * @return the provider URL. 1175 */ 1176 QString ocsProviderUrl() const; 1177 1178 /** 1179 * Returns the program's version. 1180 * @return the version string. 1181 */ 1182 QString version() const; 1183 1184 /** 1185 * @internal 1186 * Provided for use by KCrash 1187 */ 1188 const char *internalVersion() const; 1189 1190 /** 1191 * Returns a short, translated description. 1192 * @return the short description (translated). Can be 1193 * QString() if not set. 1194 */ 1195 QString shortDescription() const; 1196 1197 /** 1198 * Returns the application homepage. 1199 * @return the application homepage URL. Can be QString() if 1200 * not set. 1201 */ 1202 QString homepage() const; 1203 1204 /** 1205 * Returns the email address or URL for bugs. 1206 * @return the address where to report bugs. 1207 */ 1208 QString bugAddress() const; 1209 1210 /** 1211 * @internal 1212 * Provided for use by KCrash 1213 */ 1214 const char *internalBugAddress() const; 1215 1216 /** 1217 * Returns a list of authors. 1218 * @return author information (list of persons). 1219 */ 1220 QList<KAboutPerson> authors() const; 1221 1222 /** 1223 * Returns a list of persons who contributed. 1224 * @return credit information (list of persons). 1225 */ 1226 QList<KAboutPerson> credits() const; 1227 1228 /** 1229 * Returns a list of translators. 1230 * @return translators information (list of persons) 1231 */ 1232 QList<KAboutPerson> translators() const; 1233 1234 /** 1235 * Returns a message about the translation team. 1236 * @return a message about the translation team 1237 */ 1238 static QString aboutTranslationTeam(); 1239 1240 /** 1241 * Returns a list of components. 1242 * @return component information (list of components). 1243 * @since 5.84 1244 */ 1245 QList<KAboutComponent> components() const; 1246 1247 /** 1248 * Returns a translated, free form text. 1249 * @return the free form text (translated). Can be QString() if not set. 1250 */ 1251 QString otherText() const; 1252 1253 /** 1254 * Returns a list of licenses. 1255 * 1256 * @return licenses information (list of licenses) 1257 */ 1258 QList<KAboutLicense> licenses() const; 1259 1260 /** 1261 * Returns the copyright statement. 1262 * @return the copyright statement. Can be QString() if not set. 1263 */ 1264 QString copyrightStatement() const; 1265 1266 /** 1267 * Returns the plain text displayed around the list of authors instead 1268 * of the default message telling users to send bug reports to bugAddress(). 1269 * 1270 * @return the plain text displayed around the list of authors instead 1271 * of the default message. Can be QString(). 1272 */ 1273 QString customAuthorPlainText() const; 1274 1275 /** 1276 * Returns the rich text displayed around the list of authors instead 1277 * of the default message telling users to send bug reports to bugAddress(). 1278 * 1279 * @return the rich text displayed around the list of authors instead 1280 * of the default message. Can be QString(). 1281 */ 1282 QString customAuthorRichText() const; 1283 1284 /** 1285 * Returns whether custom text should be displayed around the list of 1286 * authors. 1287 * 1288 * @return whether custom text should be displayed around the list of 1289 * authors. 1290 */ 1291 bool customAuthorTextEnabled() const; 1292 1293 /** 1294 * Sets the custom text displayed around the list of authors instead 1295 * of the default message telling users to send bug reports to bugAddress(). 1296 * 1297 * @param plainText The plain text. 1298 * @param richText The rich text. 1299 * 1300 * Setting both to parameters to QString() will cause no message to be 1301 * displayed at all. Call unsetCustomAuthorText() to revert to the default 1302 * message. 1303 */ 1304 KAboutData &setCustomAuthorText(const QString &plainText, const QString &richText); 1305 1306 /** 1307 * Clears any custom text displayed around the list of authors and falls 1308 * back to the default message telling users to send bug reports to 1309 * bugAddress(). 1310 */ 1311 KAboutData &unsetCustomAuthorText(); 1312 1313 /** 1314 * Configures the @p parser command line parser to provide an authors entry with 1315 * information about the developers of the application and an entry specifying the license. 1316 * 1317 * Additionally, it will set the description to the command line parser, will add the help 1318 * option and if the QApplication has a version set (e.g. via KAboutData::setApplicationData) 1319 * it will also add the version option. 1320 * 1321 * Since 5.16 it also adds an option to set the desktop file name. 1322 * 1323 * @returns true if adding the options was successful; otherwise returns false. 1324 * 1325 * @sa processCommandLine() 1326 */ 1327 bool setupCommandLine(QCommandLineParser *parser); 1328 1329 /** 1330 * Reads the processed @p parser and sees if any of the arguments are the ones set 1331 * up from setupCommandLine(). 1332 * 1333 * @sa setupCommandLine() 1334 */ 1335 void processCommandLine(QCommandLineParser *parser); 1336 1337 /** 1338 * Sets the base name of the desktop entry for this application. 1339 * 1340 * This is the file name, without the full path and without extension, 1341 * of the desktop entry that represents this application according to 1342 * the freedesktop desktop entry specification (e.g. "org.kde.foo"). 1343 * 1344 * A default desktop file name is constructed when the KAboutData 1345 * object is created, using the reverse domain name of the 1346 * organizationDomain() and the componentName() as they are at the time 1347 * of the KAboutData object creation. 1348 * Call this method to override that default name. Typically this is 1349 * done when also setOrganizationDomain(const QByteArray&) or setComponentName(const QString&) 1350 * need to be called to override the initial values. 1351 * 1352 * The desktop file name can also be passed to the application at runtime through 1353 * the @c desktopfile command line option which is added by setupCommandLine(QCommandLineParser*). 1354 * This is useful if an application supports multiple desktop files with different runtime 1355 * settings. 1356 * 1357 * @param desktopFileName The desktop file name of this application 1358 * 1359 * @sa desktopFileName() 1360 * @sa organizationDomain() 1361 * @sa componentName() 1362 * @sa setupCommandLine(QCommandLineParser*) 1363 * @since 5.16 1364 **/ 1365 KAboutData &setDesktopFileName(const QString &desktopFileName); 1366 1367 /** 1368 * @returns The desktop file name of this application (e.g. "org.kde.foo") 1369 * @sa setDesktopFileName(const QString&) 1370 * @since 5.16 1371 **/ 1372 QString desktopFileName() const; 1373 1374 private: 1375 KCOREADDONS_NO_EXPORT QVariantList licensesVariant() const; 1376 KCOREADDONS_NO_EXPORT QVariantList authorsVariant() const; 1377 KCOREADDONS_NO_EXPORT QVariantList creditsVariant() const; 1378 KCOREADDONS_NO_EXPORT QVariantList translatorsVariant() const; 1379 KCOREADDONS_NO_EXPORT QVariantList componentsVariant() const; 1380 1381 friend void KCrash::defaultCrashHandler(int sig); 1382 // exported for KCrash, no other users intended 1383 static const KAboutData *applicationDataPointer(); 1384 1385 private: 1386 std::unique_ptr<class KAboutDataPrivate> const d; 1387 }; 1388 1389 Q_DECLARE_METATYPE(KAboutData) 1390 Q_DECLARE_METATYPE(KAboutLicense) 1391 Q_DECLARE_METATYPE(KAboutPerson) 1392 Q_DECLARE_METATYPE(KAboutComponent) 1393 1394 #endif