File indexing completed on 2024-10-06 09:35:47
0001 /* 0002 * This file is part of the KDE Libraries 0003 * Copyright (C) 2000 Espen Sand (espen@kde.org) 0004 * Copyright (C) 2008 Friedrich W. H. Kossebau <kossebau@kde.org> 0005 * Copyright (C) 2010 Teo Mrnjavac <teo@kde.org> 0006 * 0007 * This library is free software; you can redistribute it and/or 0008 * modify it under the terms of the GNU Library General Public 0009 * License as published by the Free Software Foundation; either 0010 * version 2 of the License, or (at your option) any later version. 0011 * 0012 * This library is distributed in the hope that it will be useful, 0013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0015 * Library General Public License for more details. 0016 * 0017 * You should have received a copy of the GNU Library General Public License 0018 * along with this library; see the file COPYING.LIB. If not, write to 0019 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0020 * Boston, MA 02110-1301, USA. 0021 * 0022 */ 0023 0024 #ifndef K4ABOUTDATA_H 0025 #define K4ABOUTDATA_H 0026 0027 #include <kdelibs4support_export.h> 0028 0029 #ifdef KDELIBS4SUPPORT_NO_DEPRECATED_NOISE 0030 #warning "This file is deprecated." 0031 #endif 0032 0033 #include <klocalizedstring.h> 0034 // Qt 0035 #include <QString> 0036 #include <QSharedDataPointer> 0037 0038 template <class T> class QList; 0039 class QVariant; 0040 class KAboutData; 0041 class K4AboutData; 0042 0043 /** 0044 * This class is used to store information about a person or developer. 0045 * It can store the person's name, a task, an email address and a 0046 * link to a home page. This class is intended for use in the 0047 * K4AboutData class, but it can be used elsewhere as well. 0048 * Normally you should at least define the person's name. 0049 * Creating a K4AboutPerson object by yourself is relatively useless, 0050 * but the K4AboutData methods K4AboutData::authors() and K4AboutData::credits() 0051 * return lists of K4AboutPerson data objects which you can examine. 0052 * 0053 * Example usage within a main(), retrieving the list of people involved 0054 * with a program and re-using data from one of them: 0055 * 0056 * @code 0057 * K4AboutData about("khello", "khello", ki18n("KHello"), "0.1", 0058 * ki18n("A KDE version of Hello, world!"), 0059 * K4AboutData::License_LGPL, 0060 * ki18n("Copyright (C) 2003 Developer")); 0061 * 0062 * about.addAuthor(ki18n("Joe Developer"), ki18n("developer"), "joe@host.com", 0); 0063 * QList<K4AboutPerson> people = about.authors(); 0064 * about.addCredit(people[0].name(), people[0].task()); 0065 * @endcode 0066 * 0067 * @note Instead of the more usual i18n calls, for translatable text the ki18n 0068 * calls are used to produce KLocalizedStrings, which can delay the translation 0069 * lookup. This is necessary because the translation catalogs are usually not 0070 * yet initialized at the point where K4AboutData is constructed. 0071 * 0072 * @bc KDE4 0073 * 0074 * @deprecated Instead, use KAboutData in KCoreAddons 0075 */ 0076 class KDELIBS4SUPPORT_DEPRECATED_EXPORT_NOISE K4AboutPerson 0077 { 0078 friend class K4AboutData; 0079 public: 0080 /** 0081 * Convenience constructor 0082 * 0083 * @param name The name of the person. 0084 * 0085 * @param task The task of this person. 0086 * 0087 * @param emailAddress The email address of the person. 0088 * 0089 * @param webAddress Home page of the person. 0090 */ 0091 KDELIBS4SUPPORT_DEPRECATED explicit K4AboutPerson(const KLocalizedString &name, 0092 const KLocalizedString &task = KLocalizedString(), 0093 const QByteArray &emailAddress = QByteArray(), 0094 const QByteArray &webAddress = QByteArray()); 0095 0096 /** 0097 * Convenience constructor with Open Collaboration Services data 0098 * 0099 * @param name The name of the person. 0100 * 0101 * @param task The task of this person. 0102 * 0103 * @param emailAddress The email address of the person. 0104 * 0105 * @param webAddress Home page of the person. 0106 * 0107 * @param ocsUsername Open Collaboration Services username of the person. 0108 */ 0109 KDELIBS4SUPPORT_DEPRECATED explicit K4AboutPerson(const KLocalizedString &name, 0110 const KLocalizedString &task, 0111 const QByteArray &emailAddress, 0112 const QByteArray &webAddress, 0113 const QByteArray &ocsUsername); //KDE5: merge into main ctor 0114 0115 /** 0116 * Copy constructor. Performs a deep copy. 0117 * @param other object to copy 0118 */ 0119 K4AboutPerson(const K4AboutPerson &other); 0120 0121 ~K4AboutPerson(); 0122 0123 /** 0124 * Assignment operator. Performs a deep copy. 0125 * @param other object to copy 0126 */ 0127 K4AboutPerson &operator=(const K4AboutPerson &other); 0128 0129 /** 0130 * The person's name 0131 * @return the person's name (can be QString(), if it has been 0132 * constructed with an empty name) 0133 */ 0134 QString name() const; 0135 0136 /** 0137 * The person's task 0138 * @return the person's task (can be QString(), if it has been 0139 * constructed with an empty task) 0140 */ 0141 QString task() const; 0142 0143 /** 0144 * The person's email address 0145 * @return the person's email address (can be QString(), if it has been 0146 * constructed with an empty email) 0147 */ 0148 QString emailAddress() const; 0149 0150 /** 0151 * The home page or a relevant link 0152 * @return the persons home page (can be QString(), if it has been 0153 * constructed with an empty home page) 0154 */ 0155 QString webAddress() const; 0156 0157 /** 0158 * The person's Open Collaboration Services username 0159 * @return the persons OCS username (can be QString(), if it has been 0160 * constructed with an empty username) 0161 */ 0162 QString ocsUsername() const; 0163 0164 private: 0165 /** 0166 * @internal Used by K4AboutData to construct translator data. 0167 */ 0168 KDELIBS4SUPPORT_DEPRECATED explicit K4AboutPerson(const QString &name, const QString &email); 0169 0170 class Private; 0171 Private *const d; 0172 }; 0173 0174 class K4AboutLicense; 0175 0176 // KDE5: refactor together with KComponentData. 0177 // Like changing all property names which contain Program or App. 0178 0179 /** 0180 * This class is used to store information about a program. It can store 0181 * such values as version number, program name, home page, email address 0182 * for bug reporting, multiple authors and contributors 0183 * (using K4AboutPerson), license and copyright information. 0184 * 0185 * Currently, the values set here are shown by the "About" box 0186 * (see K4AboutDialog), used by the bug report dialog (see KBugReport), 0187 * and by the help shown on command line (see KCmdLineArgs). 0188 * They are also used for the icon and the name of the program's windows. 0189 * 0190 * @note Instead of the more usual i18n calls, for translatable text the ki18n 0191 * calls are used to produce KLocalizedStrings, which can delay the translation 0192 * lookup. This is necessary because the translation catalogs are usually not 0193 * yet initialized at the point where K4AboutData is constructed. 0194 * 0195 * @short Holds information needed by the "About" box and other 0196 * classes. 0197 * @author Espen Sand (espen@kde.org), David Faure (faure@kde.org) 0198 */ 0199 class KDELIBS4SUPPORT_DEPRECATED_EXPORT_NOISE K4AboutData 0200 { 0201 public: 0202 /** 0203 * Describes the license of the software. 0204 */ 0205 enum LicenseKey { // KDE5: move to K4AboutLicense, cut License_ prefix 0206 License_Custom = -2, 0207 License_File = -1, 0208 License_Unknown = 0, 0209 License_GPL = 1, 0210 License_GPL_V2 = 1, 0211 License_LGPL = 2, 0212 License_LGPL_V2 = 2, 0213 License_BSD = 3, 0214 License_Artistic = 4, 0215 License_QPL = 5, 0216 License_QPL_V1_0 = 5, 0217 License_GPL_V3 = 6, 0218 License_LGPL_V3 = 7 0219 }; 0220 0221 /** 0222 * Format of the license name. 0223 */ 0224 enum NameFormat { // KDE5: move to K4AboutLicense 0225 ShortName, 0226 FullName 0227 }; 0228 0229 public: 0230 /** 0231 * Constructor. 0232 * 0233 * @param appName The program name used internally. Example: "kedit" 0234 * 0235 * @param catalogName The translation catalog name; if null or empty, the 0236 * @p appName will be used. You may want the catalog name to 0237 * differ from program name, for example, when you want to group 0238 * translations of several smaller utilities under the same catalog. 0239 * 0240 * @param programName A displayable program name string. This string 0241 * should be marked for translation. Example: ki18n("KEdit") 0242 * 0243 * @param version The program version string. 0244 * 0245 * @param shortDescription A short description of what the program does. 0246 * This string should be marked for translation. 0247 * Example: ki18n("A simple text editor.") 0248 * 0249 * @param licenseType The license identifier. Use setLicenseText or 0250 setLicenseTextFile if you use a license not predefined here. 0251 * 0252 * @param copyrightStatement A copyright statement, that can look like this: 0253 * ki18n("Copyright (C) 1999-2000 Name"). The string specified here is 0254 * taken verbatim; the author information from addAuthor is not used. 0255 * 0256 * @param otherText Some free form text, that can contain any kind of 0257 * information. The text can contain newlines. This string 0258 * should be marked for translation. 0259 * 0260 * @param homePageAddress The program homepage string. 0261 * Start the address with "http://". "http://some.domain" is 0262 * is correct, "some.domain" is not. 0263 * IMPORTANT: if you set a home page address, this will change the "organization domain" 0264 * of the application, which is used for automatic D-Bus registration. 0265 * @see setOrganizationDomain 0266 * 0267 * @param bugsEmailAddress The bug report email address string. 0268 * This defaults to the kde.org bug system. 0269 * 0270 */ 0271 K4AboutData(const QByteArray &appName, 0272 const QByteArray &catalogName, 0273 const KLocalizedString &programName, 0274 const QByteArray &version, 0275 const KLocalizedString &shortDescription = KLocalizedString(), 0276 enum LicenseKey licenseType = License_Unknown, 0277 const KLocalizedString ©rightStatement = KLocalizedString(), 0278 const KLocalizedString &otherText = KLocalizedString(), 0279 const QByteArray &homePageAddress = QByteArray(), 0280 const QByteArray &bugsEmailAddress = "submit@bugs.kde.org" 0281 ); 0282 0283 /** 0284 * Copy constructor. Performs a deep copy. 0285 * @param other object to copy 0286 */ 0287 K4AboutData(const K4AboutData &other); 0288 0289 /** 0290 * Assignment operator. Performs a deep copy. 0291 * @param other object to copy 0292 */ 0293 K4AboutData &operator=(const K4AboutData &other); 0294 0295 ~K4AboutData(); 0296 0297 operator KAboutData() const; 0298 0299 /** 0300 * Defines an author. 0301 * 0302 * You can call this function as many times as you need. Each entry is 0303 * appended to a list. The person in the first entry is assumed to be 0304 * the leader of the project. 0305 * 0306 * @param name The developer's name. It should be marked for translation 0307 * like this: ki18n("Developer Name") 0308 * 0309 * @param task What the person is responsible for. This text can contain 0310 * newlines. It should be marked for translation like this: 0311 * ki18n("Task description..."). Can be left empty. 0312 * 0313 * @param emailAddress An Email address where the person can be reached. 0314 * Can be left empty. 0315 * 0316 * @param webAddress The person's homepage or a relevant link. 0317 * Start the address with "http://". "http://some.domain" is 0318 * correct, "some.domain" is not. Can be left empty. 0319 * 0320 */ 0321 K4AboutData &addAuthor(const KLocalizedString &name, 0322 const KLocalizedString &task = KLocalizedString(), 0323 const QByteArray &emailAddress = QByteArray(), 0324 const QByteArray &webAddress = QByteArray()); 0325 0326 /** 0327 * Defines an author. 0328 * 0329 * You can call this function as many times as you need. Each entry is 0330 * appended to a list. The person in the first entry is assumed to be 0331 * the leader of the project. 0332 * 0333 * @param name The developer's name. It should be marked for translation 0334 * like this: ki18n("Developer Name") 0335 * 0336 * @param task What the person is responsible for. This text can contain 0337 * newlines. It should be marked for translation like this: 0338 * ki18n("Task description..."). Can be left empty. 0339 * 0340 * @param emailAddress An Email address where the person can be reached. 0341 * Can be left empty. 0342 * 0343 * @param webAddress The person's homepage or a relevant link. 0344 * Start the address with "http://". "http://some.domain" is 0345 * correct, "some.domain" is not. Can be left empty. 0346 * 0347 * @param ocsUsername The person's Open Collaboration Services username. 0348 * The provider can be optionally specified with @see setOcsProvider. 0349 * 0350 */ 0351 K4AboutData &addAuthor(const KLocalizedString &name, 0352 const KLocalizedString &task, 0353 const QByteArray &emailAddress, 0354 const QByteArray &webAddress, 0355 const QByteArray &ocsUsername); //KDE5: merge with addAuthor 0356 0357 /** 0358 * Defines a person that deserves credit. 0359 * 0360 * You can call this function as many times as you need. Each entry 0361 * is appended to a list. 0362 * 0363 * @param name The person's name. It should be marked for translation 0364 * like this: ki18n("Contributor Name") 0365 * 0366 * @param task What the person has done to deserve the honor. The 0367 * text can contain newlines. It should be marked for 0368 * translation like this: ki18n("Task description...") 0369 * Can be left empty. 0370 * 0371 * @param emailAddress An email address when the person can be reached. 0372 * Can be left empty. 0373 * 0374 * @param webAddress The person's homepage or a relevant link. 0375 * Start the address with "http://". "http://some.domain" is 0376 * is correct, "some.domain" is not. Can be left empty. 0377 * 0378 */ 0379 K4AboutData &addCredit(const KLocalizedString &name, 0380 const KLocalizedString &task = KLocalizedString(), 0381 const QByteArray &emailAddress = QByteArray(), 0382 const QByteArray &webAddress = QByteArray()); 0383 0384 /** 0385 * Defines a person that deserves credit. 0386 * 0387 * You can call this function as many times as you need. Each entry 0388 * is appended to a list. 0389 * 0390 * @param name The person's name. It should be marked for translation 0391 * like this: ki18n("Contributor Name") 0392 * 0393 * @param task What the person has done to deserve the honor. The 0394 * text can contain newlines. It should be marked for 0395 * translation like this: ki18n("Task description...") 0396 * Can be left empty. 0397 * 0398 * @param emailAddress An email address when the person can be reached. 0399 * Can be left empty. 0400 * 0401 * @param webAddress The person's homepage or a relevant link. 0402 * Start the address with "http://". "http://some.domain" is 0403 * is correct, "some.domain" is not. Can be left empty. 0404 * 0405 * @param ocsUsername The person's Open Collaboration Services username. 0406 * The provider can be optionally specified with @see setOcsProvider. 0407 * 0408 */ 0409 K4AboutData &addCredit(const KLocalizedString &name, 0410 const KLocalizedString &task, 0411 const QByteArray &emailAddress, 0412 const QByteArray &webAddress, 0413 const QByteArray &ocsUsername); //KDE5: merge with addCredit 0414 0415 /** 0416 * @brief Sets the name(s) of the translator(s) of the GUI. 0417 * 0418 * Since this depends on the language, just use a dummy text marked for 0419 * translation. 0420 * 0421 * The canonical use is: 0422 * 0423 * \code 0424 * setTranslator(ki18nc("NAME OF TRANSLATORS", "Your names"), 0425 * ki18nc("EMAIL OF TRANSLATORS", "Your emails")); 0426 * \endcode 0427 * 0428 * The translator can then translate this dummy text with his name 0429 * or with a list of names separated with ",". 0430 * If there is no translation or the application is used with the 0431 * default language, this function call is ignored. 0432 * 0433 * @param name the name(s) of the translator(s) 0434 * @param emailAddress the email address(es) of the translator(s) 0435 * @see K4AboutTranslator 0436 */ 0437 K4AboutData &setTranslator(const KLocalizedString &name, 0438 const KLocalizedString &emailAddress); 0439 0440 /** 0441 * Defines a license text, which is marked for translation. 0442 * 0443 * Example: 0444 * \code 0445 * setLicenseText( ki18n("This is my license") ); 0446 * \endcode 0447 * 0448 * @param license The license text. 0449 */ 0450 K4AboutData &setLicenseText(const KLocalizedString &license); 0451 0452 /** 0453 * Adds a license text, which is marked for translation. 0454 * 0455 * If there is only one unknown license set, e.g. by using the default 0456 * parameter in the constructor, that one is replaced. 0457 * 0458 * Example: 0459 * \code 0460 * addLicenseText( ki18n("This is my license") ); 0461 * \endcode 0462 * 0463 * @param license The license text. 0464 * @see setLicenseText, addLicense, addLicenseTextFile 0465 * @since 4.1 0466 */ 0467 K4AboutData &addLicenseText(const KLocalizedString &license); 0468 0469 /** 0470 * Defines a license text by pointing to a file where it resides. 0471 * The file format has to be plain text in an encoding compatible to the locale. 0472 * 0473 * @param file Path to the file in the local filesystem containing the license text. 0474 */ 0475 K4AboutData &setLicenseTextFile(const QString &file); 0476 0477 /** 0478 * Adds a license text by pointing to a file where it resides. 0479 * The file format has to be plain text in an encoding compatible to the locale. 0480 * 0481 * If there is only one unknown license set, e.g. by using the default 0482 * parameter in the constructor, that one is replaced. 0483 * 0484 * @param file Path to the file in the local filesystem containing the license text. 0485 * @see addLicenseText, addLicense, setLicenseTextFile 0486 * @since 4.1 0487 */ 0488 K4AboutData &addLicenseTextFile(const QString &file); 0489 0490 /** 0491 * Defines the program name used internally. 0492 * 0493 * @param appName The application name. Example: "kate". 0494 */ 0495 K4AboutData &setAppName(const QByteArray &appName); 0496 0497 /** 0498 * Defines the displayable program name string. 0499 * 0500 * @param programName The program name. This string should be 0501 * marked for translation. 0502 * Example: ki18n("Advanced Text Editor"). 0503 */ 0504 K4AboutData &setProgramName(const KLocalizedString &programName); 0505 0506 /** 0507 * Defines the program icon. 0508 * 0509 * Use this if you need to have an application icon 0510 * whose name is different than the application name. 0511 * 0512 * @param iconName name of the icon. Example: "accessories-text-editor" 0513 * @see programIconName() 0514 * @since 4.1 0515 */ 0516 K4AboutData &setProgramIconName(const QString &iconName); 0517 0518 /** 0519 * Defines the program logo. 0520 * 0521 * Use this if you need to have an application logo 0522 * in AboutData other than the application icon. 0523 * 0524 * Because K4AboutData is in kdecore it cannot use QImage directly, 0525 * so this is a QVariant that should contain a QImage. 0526 * 0527 * @param image logo image. 0528 * @see programLogo() 0529 */ 0530 K4AboutData &setProgramLogo(const QVariant &image); 0531 0532 /** 0533 * Specifies an Open Collaboration Services provider by URL. 0534 * A provider file must be available for the chosen provider. 0535 * 0536 * Use this if you need to override the default provider. 0537 * 0538 * If this method is not used, all the K4AboutPerson OCS usernames 0539 * will be used with the openDesktop.org entry from the default 0540 * provider file. 0541 * 0542 * @param providerUrl The provider URL as defined in the provider file. 0543 */ 0544 K4AboutData &setOcsProvider(const QByteArray &providerUrl); 0545 0546 /** 0547 * Defines the program version string. 0548 * 0549 * @param version The program version. 0550 */ 0551 K4AboutData &setVersion(const QByteArray &version); 0552 0553 /** 0554 * Defines a short description of what the program does. 0555 * 0556 * @param shortDescription The program description. This string should 0557 * be marked for translation. Example: ki18n("An advanced text 0558 * editor with syntax highlighting support."). 0559 */ 0560 K4AboutData &setShortDescription(const KLocalizedString &shortDescription); 0561 0562 /** 0563 * Defines the translation catalog that the program uses. 0564 * 0565 * @param catalogName The translation catalog name. 0566 */ 0567 K4AboutData &setCatalogName(const QByteArray &catalogName); 0568 0569 /** 0570 * Defines the license identifier. 0571 * 0572 * @param licenseKey The license identifier. 0573 * @see addLicenseText, setLicenseText, setLicenseTextFile 0574 */ 0575 K4AboutData &setLicense(LicenseKey licenseKey); 0576 0577 /** 0578 * Adds a license identifier. 0579 * 0580 * If there is only one unknown license set, e.g. by using the default 0581 * parameter in the constructor, that one is replaced. 0582 * 0583 * @param licenseKey The license identifier. 0584 * @see setLicenseText, addLicenseText, addLicenseTextFile 0585 * @since 4.1 0586 */ 0587 K4AboutData &addLicense(LicenseKey licenseKey); 0588 0589 /** 0590 * Defines the copyright statement to show when displaying the license. 0591 * 0592 * @param copyrightStatement A copyright statement, that can look like 0593 * this: ki18n("Copyright (C) 1999-2000 Name"). The string specified here is 0594 * taken verbatim; the author information from addAuthor is not used. 0595 */ 0596 K4AboutData &setCopyrightStatement(const KLocalizedString ©rightStatement); 0597 0598 /** 0599 * Defines the additional text to show in the about dialog. 0600 * 0601 * @param otherText Some free form text, that can contain any kind of 0602 * information. The text can contain newlines. This string 0603 * should be marked for translation. 0604 */ 0605 K4AboutData &setOtherText(const KLocalizedString &otherText); 0606 0607 /** 0608 * Defines the program homepage. 0609 * 0610 * @param homepage The program homepage string. 0611 * Start the address with "http://". "http://kate.kde.org" 0612 * is correct but "kate.kde.org" is not. 0613 */ 0614 K4AboutData &setHomepage(const QByteArray &homepage); 0615 0616 /** 0617 * Defines the address where bug reports should be sent. 0618 * 0619 * @param bugAddress The bug report email address string. 0620 * This defaults to the kde.org bug system. 0621 */ 0622 K4AboutData &setBugAddress(const QByteArray &bugAddress); 0623 0624 /** 0625 * Defines the Internet domain of the organization that wrote this application. 0626 * The domain is set to kde.org by default, or the domain of the homePageAddress constructor argument, 0627 * if set. 0628 * 0629 * Make sure to call setOrganizationDomain if your product is developed out of the 0630 * kde.org version-control system. 0631 * 0632 * Used by the automatic registration to D-Bus done by KApplication and KUniqueApplication. 0633 * 0634 * IMPORTANT: if the organization domain is set, the .desktop file that describes your 0635 * application should have an entry like X-DBUS-ServiceName=reversed_domain.kmyapp 0636 * For instance kwrite passes "http://www.kate-editor.org" as the homePageAddress so it needs 0637 * X-DBUS-ServiceName=org.kate-editor.kwrite in its kwrite.desktop file. 0638 * 0639 * @param domain the domain name, for instance kde.org, koffice.org, kdevelop.org, etc. 0640 */ 0641 K4AboutData &setOrganizationDomain(const QByteArray &domain); 0642 0643 /** 0644 * Defines the product name which will be used in the KBugReport dialog. 0645 * By default it's the appName, but you can overwrite it here to provide 0646 * support for special components e.g. in the form 'product/component', 0647 * such as 'kontact/summary'. 0648 * 0649 * @param name The name of product 0650 */ 0651 K4AboutData &setProductName(const QByteArray &name); 0652 0653 /** 0654 * Returns the application's internal name. 0655 * @return the internal program name. 0656 */ 0657 QString appName() const; 0658 0659 /** 0660 * Returns the application's product name, which will be used in KBugReport 0661 * dialog. By default it returns appName(), otherwise the one which is set 0662 * with setProductName() 0663 * 0664 * @return the product name. 0665 */ 0666 QString productName() const; 0667 0668 /** 0669 * Returns the translated program name. 0670 * @return the program name (translated). 0671 */ 0672 QString programName() const; 0673 0674 /** 0675 * Returns the domain name of the organization that wrote this application. 0676 * 0677 * Used by the automatic registration to D-Bus done by KApplication and KUniqueApplication. 0678 */ 0679 QString organizationDomain() const; 0680 0681 /** 0682 * @internal 0683 * Provided for use by KCrash 0684 */ 0685 const char *internalProgramName() const; 0686 0687 /** 0688 * @internal 0689 * Provided for use by KCrash 0690 */ 0691 void translateInternalProgramName() const; 0692 0693 /** 0694 * Returns the program's icon name. 0695 * 0696 * The default value is appName(). 0697 * Use setProgramIconName() if you need to have an icon 0698 * whose name is different from the internal application name. 0699 * 0700 * @return the program's icon name. 0701 * @see setProgramIconName() 0702 * @since 4.1 0703 */ 0704 QString programIconName() const; 0705 0706 /** 0707 * Returns the program logo image. 0708 * 0709 * Because K4AboutData is in kdecore it cannot use QImage directly, 0710 * so this is a QVariant containing a QImage. 0711 * 0712 * @return the program logo data, or a null image if there is 0713 * no custom application logo defined. 0714 */ 0715 QVariant programLogo() const; 0716 0717 /** 0718 * Returns the chosen Open Collaboration Services provider URL. 0719 * @return the provider URL. 0720 */ 0721 QString ocsProviderUrl() const; 0722 0723 /** 0724 * Returns the program's version. 0725 * @return the version string. 0726 */ 0727 QString version() const; 0728 0729 /** 0730 * @internal 0731 * Provided for use by KCrash 0732 */ 0733 const char *internalVersion() const; 0734 0735 /** 0736 * Returns a short, translated description. 0737 * @return the short description (translated). Can be 0738 * QString() if not set. 0739 */ 0740 QString shortDescription() const; 0741 0742 /** 0743 * Returns the program's translation catalog name. 0744 * @return the catalog name. 0745 */ 0746 QString catalogName() const; 0747 0748 /** 0749 * Returns the application homepage. 0750 * @return the application homepage URL. Can be QString() if 0751 * not set. 0752 */ 0753 QString homepage() const; 0754 0755 /** 0756 * Returns the email address for bugs. 0757 * @return the email address where to report bugs. 0758 */ 0759 QString bugAddress() const; 0760 0761 /** 0762 * @internal 0763 * Provided for use by KCrash 0764 */ 0765 const char *internalBugAddress() const; 0766 0767 /** 0768 * Returns a list of authors. 0769 * @return author information (list of persons). 0770 */ 0771 QList<K4AboutPerson> authors() const; 0772 0773 /** 0774 * Returns a list of persons who contributed. 0775 * @return credit information (list of persons). 0776 */ 0777 QList<K4AboutPerson> credits() const; 0778 0779 /** 0780 * Returns a list of translators. 0781 * @return translators information (list of persons) 0782 */ 0783 QList<K4AboutPerson> translators() const; 0784 0785 /** 0786 * Returns a message about the translation team. 0787 * @return a message about the translation team 0788 */ 0789 static QString aboutTranslationTeam(); 0790 0791 /** 0792 * Returns a translated, free form text. 0793 * @return the free form text (translated). Can be QString() if not set. 0794 */ 0795 QString otherText() const; 0796 0797 /** 0798 * Returns the license. If the licenseType argument of the constructor has been 0799 * used, any text defined by setLicenseText is ignored, 0800 * and the standard text for the chosen license will be returned. 0801 * 0802 * @return The license text. 0803 * 0804 * @deprecated There could be multiple licenses, use licenses() instead. 0805 */ 0806 QString license() const; 0807 0808 /** 0809 * Returns the license name. 0810 * 0811 * @return The license name as a string. 0812 * 0813 * @deprecated There could be multiple licenses, use licenses() instead. 0814 */ 0815 QString licenseName(NameFormat formatName) const; 0816 0817 /** 0818 * Returns a list of licenses. 0819 * 0820 * @return licenses information (list of licenses) 0821 * @since 4.1 0822 */ 0823 QList<K4AboutLicense> licenses() const; 0824 0825 /** 0826 * Returns the copyright statement. 0827 * @return the copyright statement. Can be QString() if not set. 0828 */ 0829 QString copyrightStatement() const; 0830 0831 /** 0832 * Returns the plain text displayed around the list of authors instead 0833 * of the default message telling users to send bug reports to bugAddress(). 0834 * 0835 * @return the plain text displayed around the list of authors instead 0836 * of the default message. Can be QString(). 0837 */ 0838 QString customAuthorPlainText() const; 0839 0840 /** 0841 * Returns the rich text displayed around the list of authors instead 0842 * of the default message telling users to send bug reports to bugAddress(). 0843 * 0844 * @return the rich text displayed around the list of authors instead 0845 * of the default message. Can be QString(). 0846 */ 0847 QString customAuthorRichText() const; 0848 0849 /** 0850 * Returns whether custom text should be displayed around the list of 0851 * authors. 0852 * 0853 * @return whether custom text should be displayed around the list of 0854 * authors. 0855 */ 0856 bool customAuthorTextEnabled() const; 0857 0858 /** 0859 * Sets the custom text displayed around the list of authors instead 0860 * of the default message telling users to send bug reports to bugAddress(). 0861 * 0862 * @param plainText The plain text. 0863 * @param richText The rich text. 0864 * 0865 * Setting both to parameters to KLocalizedString() will cause no message to be 0866 * displayed at all. Call unsetCustomAuthorText() to revert to the default 0867 * message. 0868 */ 0869 K4AboutData &setCustomAuthorText(const KLocalizedString &plainText, 0870 const KLocalizedString &richText); 0871 0872 /** 0873 * Clears any custom text displayed around the list of authors and falls 0874 * back to the default message telling users to send bug reports to 0875 * bugAddress(). 0876 */ 0877 K4AboutData &unsetCustomAuthorText(); 0878 0879 private: 0880 0881 class Private; 0882 Private *const d; 0883 }; 0884 0885 /** 0886 * This class is used to store information about a license. 0887 * The license can be one of some predefined, one given as text or one 0888 * that can be loaded from a file. This class is used in the K4AboutData class. 0889 * Explicitly creating a K4AboutLicense object is not possible. 0890 * If the license is wanted for a KDE component having K4AboutData object, 0891 * use K4AboutData::licenses() to get the licenses for that component. 0892 * If the license is for a non-code resource and given by a keyword 0893 * (e.g. in .desktop files), try using K4AboutLicense::byKeyword(). 0894 * 0895 * @note Instead of the more usual i18n calls, for translatable text the ki18n 0896 * calls are used to produce KLocalizedStrings, which can delay the translation 0897 * lookup. This is necessary because the translation catalogs are usually not 0898 * yet initialized at the point where K4AboutData is constructed. 0899 */ 0900 class KDELIBS4SUPPORT_DEPRECATED_EXPORT_NOISE K4AboutLicense 0901 { 0902 friend class K4AboutData; 0903 public: 0904 /** 0905 * Copy constructor. Performs a deep copy. 0906 * @param other object to copy 0907 */ 0908 K4AboutLicense(const K4AboutLicense &other); 0909 0910 ~K4AboutLicense(); 0911 0912 /** 0913 * Assignment operator. Performs a deep copy. 0914 * @param other object to copy 0915 */ 0916 K4AboutLicense &operator=(const K4AboutLicense &other); 0917 0918 /** 0919 * Returns the full license text. If the licenseType argument of the 0920 * constructor has been used, any text defined by setLicenseText is ignored, 0921 * and the standard text for the chosen license will be returned. 0922 * 0923 * @return The license text. 0924 */ 0925 QString text() const; 0926 0927 /** 0928 * Returns the license name. 0929 * 0930 * @return The license name as a string. 0931 */ 0932 QString name(K4AboutData::NameFormat formatName) const; 0933 0934 /** 0935 * Returns the license key. 0936 * 0937 * @return The license key as element of K4AboutData::LicenseKey enum. 0938 * @since 4.1 0939 */ 0940 K4AboutData::LicenseKey key() const; 0941 0942 /** 0943 * Fetch a known license by a keyword. 0944 * 0945 * Frequently the license data is provided by a terse keyword-like string, 0946 * e.g. by a field in a .desktop file. Using this method, an application 0947 * can get hold of a proper K4AboutLicense object, providing that the 0948 * license is one of the several known to KDE, and use it to present 0949 * more human-readable information to the user. 0950 * 0951 * Keywords are matched by stripping all whitespace and lowercasing. 0952 * The known keywords correspond to the K4AboutData::LicenseKey enumeration, 0953 * e.g. any of "LGPLV3", "LGPLv3", "LGPL v3" would match License_LGPL_V3. 0954 * If there is no match for the keyword, a valid license object is still 0955 * returned, with its name and text informing about a custom license, 0956 * and its key equal to K4AboutData::License_Custom. 0957 * 0958 * @param keyword The license keyword. 0959 * @return The license object. 0960 * 0961 * @see K4AboutData::LicenseKey 0962 * @since 4.1 0963 */ 0964 static K4AboutLicense byKeyword(const QString &keyword); 0965 0966 private: 0967 /** 0968 * @internal Used by K4AboutData to construct a predefined license. 0969 */ 0970 KDELIBS4SUPPORT_DEPRECATED explicit K4AboutLicense(enum K4AboutData::LicenseKey licenseType, const K4AboutData *aboutData); 0971 /** 0972 * @internal Used by K4AboutData to construct license by given text 0973 */ 0974 KDELIBS4SUPPORT_DEPRECATED explicit K4AboutLicense(const QString &pathToFile, const K4AboutData *aboutData); 0975 /** 0976 * @internal Used by K4AboutData to construct license by given text 0977 */ 0978 KDELIBS4SUPPORT_DEPRECATED explicit K4AboutLicense(const KLocalizedString &licenseText, const K4AboutData *aboutData); 0979 0980 class Private; 0981 QSharedDataPointer<Private> d; 0982 }; 0983 0984 #endif 0985