#include <kaboutdata.h>

Public Types

enum  LicenseKey {
  Custom = -2, File = -1, Unknown = 0, GPL = 1,
  GPL_V2 = 1, LGPL = 2, LGPL_V2 = 2, BSDL = 3,
  Artistic = 4, QPL = 5, QPL_V1_0 = 5, GPL_V3 = 6,
  LGPL_V3 = 7, LGPL_V2_1 = 8
enum  NameFormat { ShortName, FullName }
enum  VersionRestriction { OnlyThisVersion, OrLaterVersions }


KAboutLicense::LicenseKey key
QString name
QString spdx
QString text

Public Member Functions

 KAboutLicense ()
 KAboutLicense (const KAboutLicense &other)
KAboutLicense::LicenseKey key () const
QString name (KAboutLicense::NameFormat formatName=ShortName) const
KAboutLicenseoperator= (const KAboutLicense &other)
QString spdx () const
QString text () const

Static Public Member Functions

static KAboutLicense 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 KAboutData class. Explicitly creating a KAboutLicense object is not possible. If the license is wanted for a KDE component having KAboutData object, use KAboutData::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 KAboutLicense::byKeyword().

Definition at line 172 of file kaboutdata.h.

Member Enumeration Documentation

Describes the license of the software.


Definition at line 185 of file kaboutdata.h.

Format of the license name.

Definition at line 206 of file kaboutdata.h.

Whether later versions of the license are allowed.

Definition at line 215 of file kaboutdata.h.

Constructor & Destructor Documentation

KAboutLicense::KAboutLicense ( )

Definition at line 184 of file kaboutdata.cpp.

KAboutLicense::KAboutLicense ( const KAboutLicense other)

Copy constructor.

Performs a deep copy.

otherobject to copy

Definition at line 207 of file kaboutdata.cpp.

Member Function Documentation

KAboutLicense KAboutLicense::byKeyword ( const QString keyword)

Fetch a known license by a keyword/spdx ID.

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 KAboutLicense 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 KAboutLicense::LicenseKey enumeration, e.g. any of "LGPLV3", "LGPLv3", "LGPL v3" would match KAboutLicense::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 KAboutLicense::Custom.

keywordThe license keyword.
The license object.
See also

Definition at line 397 of file kaboutdata.cpp.

KAboutLicense::LicenseKey KAboutLicense::key ( ) const

Returns the license key.

The license key as element of KAboutLicense::LicenseKey enum.
QString KAboutLicense::name ( KAboutLicense::NameFormat  formatName = ShortName) const

Returns the license name.

Default argument

The license name as a string.

Definition at line 332 of file kaboutdata.cpp.

KAboutLicense & KAboutLicense::operator= ( const KAboutLicense other)

Assignment operator.

Performs a deep copy.

otherobject to copy

Definition at line 386 of file kaboutdata.cpp.

QString KAboutLicense::spdx ( ) const

Returns the SPDX license expression of this license.

If the underlying license cannot be expressed as a SPDX expression a null string is returned.

SPDX expression are expansive constructs. If you parse the return value, do it in a SPDX specification compliant manner by splitting on whitespaces to discard unwanted information or by using a complete SPDX license expression parser.
SPDX identifiers are case-insensitive. Do not use case-sensitive checks on the return value.
See also
SPDX license expression or QString() if the license has no identifier. Compliant with SPDX 2.1.
QString KAboutLicense::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.

The license text.

The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Nov 27 2020 23:03:56 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.