K4AboutLicense
#include <k4aboutdata.h>
Public Member Functions | |
K4AboutLicense (const K4AboutLicense &other) | |
K4AboutData::LicenseKey | key () const |
QString | name (K4AboutData::NameFormat formatName) const |
K4AboutLicense & | operator= (const K4AboutLicense &other) |
QString | text () const |
Static Public Member Functions | |
static K4AboutLicense | byKeyword (const QString &keyword) |
Detailed Description
This class is used to store information about a license.
The license can be one of some predefined, one given as text or one that can be loaded from a file. This class is used in the K4AboutData class. Explicitly creating a K4AboutLicense object is not possible. If the license is wanted for a KDE component having K4AboutData object, use K4AboutData::licenses() to get the licenses for that component. If the license is for a non-code resource and given by a keyword (e.g. in .desktop files), try using K4AboutLicense::byKeyword().
- Note
- Instead of the more usual i18n calls, for translatable text the ki18n calls are used to produce KLocalizedStrings, which can delay the translation lookup. This is necessary because the translation catalogs are usually not yet initialized at the point where K4AboutData is constructed.
Definition at line 900 of file k4aboutdata.h.
Constructor & Destructor Documentation
K4AboutLicense::K4AboutLicense | ( | const K4AboutLicense & | other | ) |
Copy constructor.
Performs a deep copy.
- Parameters
-
other object to copy
Definition at line 208 of file k4aboutdata.cpp.
Member Function Documentation
|
static |
Fetch a known license by a keyword.
Frequently the license data is provided by a terse keyword-like string, e.g. by a field in a .desktop file. Using this method, an application can get hold of a proper K4AboutLicense object, providing that the license is one of the several known to KDE, and use it to present more human-readable information to the user.
Keywords are matched by stripping all whitespace and lowercasing. The known keywords correspond to the K4AboutData::LicenseKey enumeration, e.g. any of "LGPLV3", "LGPLv3", "LGPL v3" would match License_LGPL_V3. If there is no match for the keyword, a valid license object is still returned, with its name and text informing about a custom license, and its key equal to K4AboutData::License_Custom.
- Parameters
-
keyword The license keyword.
- Returns
- The license object.
- See also
- K4AboutData::LicenseKey
- Since
- 4.1
Definition at line 351 of file k4aboutdata.cpp.
K4AboutData::LicenseKey K4AboutLicense::key | ( | ) | const |
Returns the license key.
- Returns
- The license key as element of K4AboutData::LicenseKey enum.
- Since
- 4.1
Definition at line 346 of file k4aboutdata.cpp.
QString K4AboutLicense::name | ( | K4AboutData::NameFormat | formatName | ) | const |
Returns the license name.
- Returns
- The license name as a string.
Definition at line 290 of file k4aboutdata.cpp.
K4AboutLicense & K4AboutLicense::operator= | ( | const K4AboutLicense & | other | ) |
Assignment operator.
Performs a deep copy.
- Parameters
-
other object to copy
Definition at line 340 of file k4aboutdata.cpp.
QString K4AboutLicense::text | ( | ) | const |
Returns the full license text.
If the licenseType argument of the constructor has been used, any text defined by setLicenseText is ignored, and the standard text for the chosen license will be returned.
- Returns
- The license text.
Definition at line 216 of file k4aboutdata.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2021 The KDE developers.
Generated on Wed Jan 27 2021 22:57:49 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.