kdecore: format and indent

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-08-10 20:47:11 +03:00
parent d181c8678c
commit ab05f3c60d
2 changed files with 416 additions and 463 deletions

View file

@ -30,7 +30,6 @@
#include <QtCore/QFile>
#include <QtCore/QTextStream>
#include <QtCore/QSharedData>
#include <QtCore/QVariant>
#include <QtCore/QList>
#include <QHash>
@ -64,10 +63,10 @@ public:
QString _nameNoop;
};
KAboutPerson::KAboutPerson( const KLocalizedString &_name,
KAboutPerson::KAboutPerson(const KLocalizedString &_name,
const KLocalizedString &_task,
const QByteArray &_emailAddress,
const QByteArray &_webAddress )
const QByteArray &_webAddress)
: d(new Private)
{
d->_name = _name;
@ -76,14 +75,15 @@ KAboutPerson::KAboutPerson( const KLocalizedString &_name,
d->_webAddress = QString::fromUtf8(_webAddress);
}
KAboutPerson::KAboutPerson( const QString &_name, const QString &_email )
: d(new Private)
KAboutPerson::KAboutPerson(const QString &_name, const QString &_email)
: d(new Private())
{
d->_nameNoop = _name;
d->_emailAddress = _email;
}
KAboutPerson::KAboutPerson(const KAboutPerson& other): d(new Private)
KAboutPerson::KAboutPerson(const KAboutPerson &other)
: d(new Private())
{
*d = *other.d;
}
@ -95,15 +95,17 @@ KAboutPerson::~KAboutPerson()
QString KAboutPerson::name() const
{
if (!d->_nameNoop.isEmpty())
if (!d->_nameNoop.isEmpty()) {
return d->_nameNoop;
}
return d->_name.toString();
}
QString KAboutPerson::task() const
{
if (!d->_task.isEmpty())
if (!d->_task.isEmpty()) {
return d->_task.toString();
}
return QString();
}
@ -112,13 +114,12 @@ QString KAboutPerson::emailAddress() const
return d->_emailAddress;
}
QString KAboutPerson::webAddress() const
{
return d->_webAddress;
}
KAboutPerson &KAboutPerson::operator=(const KAboutPerson& other)
KAboutPerson &KAboutPerson::operator=(const KAboutPerson &other)
{
*d = *other.d;
return *this;
@ -129,35 +130,34 @@ KAboutPerson &KAboutPerson::operator=(const KAboutPerson& other)
class KAboutLicense::Private : public QSharedData
{
public:
Private( enum KAboutData::LicenseKey licenseType, const KAboutData *aboutData );
Private( const Private& other);
Private(enum KAboutData::LicenseKey licenseType, const KAboutData *aboutData);
Private(const Private &other);
public:
enum KAboutData::LicenseKey _licenseKey;
// needed for access to the possibly changing copyrightStatement()
const KAboutData * _aboutData;
};
KAboutLicense::Private::Private( enum KAboutData::LicenseKey licenseType, const KAboutData *aboutData )
KAboutLicense::Private::Private(enum KAboutData::LicenseKey licenseType, const KAboutData *aboutData)
: QSharedData(),
_licenseKey( licenseType ),
_aboutData( aboutData )
_licenseKey(licenseType),
_aboutData(aboutData)
{
}
KAboutLicense::Private::Private(const KAboutLicense::Private& other)
KAboutLicense::Private::Private(const KAboutLicense::Private &other)
: QSharedData(other),
_licenseKey( other._licenseKey ),
_aboutData( other._aboutData )
_licenseKey(other._licenseKey),
_aboutData(other._aboutData)
{
}
KAboutLicense::KAboutLicense( enum KAboutData::LicenseKey licenseType, const KAboutData *aboutData )
: d(new Private(licenseType,aboutData))
KAboutLicense::KAboutLicense(enum KAboutData::LicenseKey licenseType, const KAboutData *aboutData)
: d(new Private(licenseType, aboutData))
{
}
KAboutLicense::KAboutLicense(const KAboutLicense& other)
KAboutLicense::KAboutLicense(const KAboutLicense &other)
: d(other.d)
{
}
@ -170,7 +170,7 @@ QString KAboutLicense::text() const
{
QString result;
const QString lineFeed = QString::fromLatin1( "\n\n" );
const QString lineFeed = QString::fromLatin1("\n\n");
if (d->_aboutData && !d->_aboutData->copyrightStatement().isEmpty()) {
result = d->_aboutData->copyrightStatement() + lineFeed;
@ -178,38 +178,46 @@ QString KAboutLicense::text() const
bool knownLicense = false;
QString pathToFile;
switch ( d->_licenseKey )
{
case KAboutData::License_GPL_V2:
switch (d->_licenseKey) {
case KAboutData::License_GPL_V2: {
knownLicense = true;
pathToFile = KStandardDirs::locate("data", QString::fromLatin1("LICENSES/GPL_V2"));
break;
case KAboutData::License_LGPL_V2:
}
case KAboutData::License_LGPL_V2: {
knownLicense = true;
pathToFile = KStandardDirs::locate("data", QString::fromLatin1("LICENSES/LGPL_V2"));
break;
case KAboutData::License_BSD:
}
case KAboutData::License_BSD: {
knownLicense = true;
pathToFile = KStandardDirs::locate("data", QString::fromLatin1("LICENSES/BSD"));
break;
case KAboutData::License_Artistic:
}
case KAboutData::License_Artistic: {
knownLicense = true;
pathToFile = KStandardDirs::locate("data", QString::fromLatin1("LICENSES/ARTISTIC"));
break;
case KAboutData::License_GPL_V3:
}
case KAboutData::License_GPL_V3: {
knownLicense = true;
pathToFile = KStandardDirs::locate("data", QString::fromLatin1("LICENSES/GPL_V3"));
break;
case KAboutData::License_LGPL_V3:
}
case KAboutData::License_LGPL_V3: {
knownLicense = true;
pathToFile = KStandardDirs::locate("data", QString::fromLatin1("LICENSES/LGPL_V3"));
break;
default:
result += i18n("No licensing terms for this program have been specified.\n"
}
default: {
result += i18n(
"No licensing terms for this program have been specified.\n"
"Please check the documentation or the source for any\n"
"licensing terms.\n");
"licensing terms.\n"
);
break;
}
}
if (knownLicense) {
result += i18n("This program is distributed under the terms of the %1.", name(KAboutData::ShortName));
@ -236,45 +244,52 @@ QString KAboutLicense::name(KAboutData::NameFormat formatName) const
QString licenseFull;
switch (d->_licenseKey) {
case KAboutData::License_GPL_V2:
case KAboutData::License_GPL_V2: {
licenseShort = i18nc("@item license (short name)","GPL v2");
licenseFull = i18nc("@item license","GNU General Public License Version 2");
licenseFull = i18nc("@item license", "GNU General Public License Version 2");
break;
case KAboutData::License_LGPL_V2:
}
case KAboutData::License_LGPL_V2: {
licenseShort = i18nc("@item license (short name)","LGPL v2");
licenseFull = i18nc("@item license","GNU Lesser General Public License Version 2");
licenseFull = i18nc("@item license", "GNU Lesser General Public License Version 2");
break;
case KAboutData::License_BSD:
}
case KAboutData::License_BSD: {
licenseShort = i18nc("@item license (short name)","BSD License");
licenseFull = i18nc("@item license","BSD License");
licenseFull = i18nc("@item license", "BSD License");
break;
case KAboutData::License_Artistic:
}
case KAboutData::License_Artistic: {
licenseShort = i18nc("@item license (short name)","Artistic License");
licenseFull = i18nc("@item license","Artistic License");
licenseFull = i18nc("@item license", "Artistic License");
break;
case KAboutData::License_GPL_V3:
}
case KAboutData::License_GPL_V3: {
licenseShort = i18nc("@item license (short name)","GPL v3");
licenseFull = i18nc("@item license","GNU General Public License Version 3");
licenseFull = i18nc("@item license", "GNU General Public License Version 3");
break;
case KAboutData::License_LGPL_V3:
}
case KAboutData::License_LGPL_V3: {
licenseShort = i18nc("@item license (short name)","LGPL v3");
licenseFull = i18nc("@item license","GNU Lesser General Public License Version 3");
break;
default:
licenseShort = licenseFull = i18nc("@item license","Not specified");
}
default: {
licenseShort = licenseFull = i18nc("@item license", "Not specified");
break;
}
}
const QString result =
(formatName == KAboutData::ShortName ) ? licenseShort :
(formatName == KAboutData::FullName ) ? licenseFull :
QString();
return result;
if (formatName == KAboutData::ShortName) {
return licenseShort;
} else if (formatName == KAboutData::FullName) {
return licenseFull;
}
return QString();
}
KAboutLicense &KAboutLicense::operator=(const KAboutLicense& other)
KAboutLicense &KAboutLicense::operator=(const KAboutLicense &other)
{
d = other.d;
return *this;
@ -311,9 +326,8 @@ KAboutLicense KAboutLicense::byKeyword(const QString &rawKeyword)
keyword.remove(QLatin1Char(' '));
keyword.remove(QLatin1Char('.'));
KAboutData::LicenseKey license = ldict.value(keyword.toLatin1(),
KAboutData::License_Unknown);
return KAboutLicense(license, 0);
KAboutData::LicenseKey license = ldict.value(keyword.toLatin1(), KAboutData::License_Unknown);
return KAboutLicense(license, nullptr);
}
@ -338,15 +352,14 @@ public:
};
KAboutData::KAboutData( const QByteArray &_appName,
KAboutData::KAboutData(const QByteArray &_appName,
const QByteArray &_catalogName,
const KLocalizedString &_programName,
const QByteArray &_version,
const KLocalizedString &_shortDescription,
enum LicenseKey licenseType,
const KLocalizedString &_copyrightStatement
)
: d(new Private)
const KLocalizedString &_copyrightStatement)
: d(new Private())
{
d->_appName = _appName;
int p = d->_appName.indexOf('/');
@ -358,7 +371,7 @@ KAboutData::KAboutData( const QByteArray &_appName,
d->_programName = _programName;
d->_version = _version;
d->_shortDescription = _shortDescription;
d->_licenseList.append(KAboutLicense(licenseType,this));
d->_licenseList.append(KAboutLicense(licenseType, this));
d->_copyrightStatement = _copyrightStatement;
d->_homepageAddress = QString::fromLatin1(KDE_HOME_URL);
d->_bugEmailAddress = QByteArray(KDE_BUG_REPORT_EMAIL);
@ -370,7 +383,8 @@ KAboutData::~KAboutData()
delete d;
}
KAboutData::KAboutData(const KAboutData& other): d(new Private)
KAboutData::KAboutData(const KAboutData& other)
: d(new Private())
{
*d = *other.d;
QList<KAboutLicense>::iterator it = d->_licenseList.begin(), itEnd = d->_licenseList.end();
@ -395,99 +409,99 @@ KAboutData &KAboutData::operator=(const KAboutData& other)
return *this;
}
KAboutData &KAboutData::addAuthor( const KLocalizedString &name,
KAboutData &KAboutData::addAuthor(const KLocalizedString &name,
const KLocalizedString &task,
const QByteArray &emailAddress,
const QByteArray &webAddress )
const QByteArray &webAddress)
{
d->_authorList.append(KAboutPerson(name,task,emailAddress,webAddress));
d->_authorList.append(KAboutPerson(name, task, emailAddress, webAddress));
return *this;
}
KAboutData &KAboutData::addCredit( const KLocalizedString &name,
KAboutData &KAboutData::addCredit(const KLocalizedString &name,
const KLocalizedString &task,
const QByteArray &emailAddress,
const QByteArray &webAddress )
const QByteArray &webAddress)
{
d->_creditList.append(KAboutPerson(name,task,emailAddress,webAddress));
d->_creditList.append(KAboutPerson(name, task, emailAddress, webAddress));
return *this;
}
KAboutData &KAboutData::setTranslator( const KLocalizedString& name,
const KLocalizedString& emailAddress )
KAboutData &KAboutData::setTranslator( const KLocalizedString &name,
const KLocalizedString &emailAddress)
{
d->translatorName = name;
d->translatorEmail = emailAddress;
return *this;
}
KAboutData &KAboutData::setAppName( const QByteArray &_appName )
KAboutData &KAboutData::setAppName(const QByteArray &_appName)
{
d->_appName = _appName;
return *this;
}
KAboutData &KAboutData::setProgramName( const KLocalizedString &_programName )
KAboutData &KAboutData::setProgramName(const KLocalizedString &_programName)
{
d->_programName = _programName;
return *this;
}
KAboutData &KAboutData::setVersion( const QByteArray &_version )
KAboutData &KAboutData::setVersion(const QByteArray &_version)
{
d->_version = _version;
return *this;
}
KAboutData &KAboutData::setShortDescription( const KLocalizedString &_shortDescription )
KAboutData &KAboutData::setShortDescription(const KLocalizedString &_shortDescription)
{
d->_shortDescription = _shortDescription;
return *this;
}
KAboutData &KAboutData::setCatalogName( const QByteArray &_catalogName )
KAboutData &KAboutData::setCatalogName(const QByteArray &_catalogName)
{
d->_catalogName = _catalogName;
return *this;
}
KAboutData &KAboutData::setLicense( LicenseKey licenseKey)
KAboutData &KAboutData::setLicense(LicenseKey licenseKey)
{
d->_licenseList[0] = KAboutLicense(licenseKey,this);
d->_licenseList[0] = KAboutLicense(licenseKey, this);
return *this;
}
KAboutData &KAboutData::addLicense( LicenseKey licenseKey)
KAboutData &KAboutData::addLicense(LicenseKey licenseKey)
{
// if the default license is unknown, overwrite instead of append
KAboutLicense &firstLicense = d->_licenseList[0];
if (d->_licenseList.count() == 1 && firstLicense.d->_licenseKey == License_Unknown) {
firstLicense = KAboutLicense(licenseKey,this);
} else {
d->_licenseList.append(KAboutLicense(licenseKey,this));
d->_licenseList.append(KAboutLicense(licenseKey, this));
}
return *this;
}
KAboutData &KAboutData::setCopyrightStatement( const KLocalizedString &_copyrightStatement )
KAboutData &KAboutData::setCopyrightStatement(const KLocalizedString &_copyrightStatement)
{
d->_copyrightStatement = _copyrightStatement;
return *this;
}
KAboutData &KAboutData::setHomepage( const QByteArray &_homepage )
KAboutData &KAboutData::setHomepage(const QByteArray &_homepage)
{
d->_homepageAddress = QString::fromLatin1(_homepage);
return *this;
}
KAboutData &KAboutData::setBugAddress( const QByteArray &_bugAddress )
KAboutData &KAboutData::setBugAddress(const QByteArray &_bugAddress)
{
d->_bugEmailAddress = _bugAddress;
return *this;
}
KAboutData &KAboutData::setOrganizationDomain( const QByteArray &domain )
KAboutData &KAboutData::setOrganizationDomain(const QByteArray &domain)
{
d->organizationDomain = QString::fromLatin1(domain);
return *this;
@ -500,8 +514,9 @@ QString KAboutData::appName() const
QString KAboutData::programName() const
{
if (!d->_programName.isEmpty())
if (!d->_programName.isEmpty()) {
return d->_programName.toString();
}
return QString();
}
@ -510,7 +525,7 @@ QString KAboutData::programIconName() const
return d->programIconName.isEmpty() ? appName() : d->programIconName;
}
KAboutData &KAboutData::setProgramIconName( const QString &iconName )
KAboutData &KAboutData::setProgramIconName(const QString &iconName)
{
d->programIconName = iconName;
return *this;
@ -523,15 +538,17 @@ QString KAboutData::version() const
QString KAboutData::shortDescription() const
{
if (!d->_shortDescription.isEmpty())
if (!d->_shortDescription.isEmpty()) {
return d->_shortDescription.toString();
}
return QString();
}
QString KAboutData::catalogName() const
{
if (!d->_catalogName.isEmpty())
if (!d->_catalogName.isEmpty()) {
return QString::fromUtf8(d->_catalogName);
}
// Fallback to appname for catalog name if empty.
return QString::fromUtf8(d->_appName);
}
@ -580,42 +597,37 @@ QList<KAboutPerson> KAboutData::translators() const
QString translatorName;
if (!d->translatorName.isEmpty()) {
translatorName = d->translatorName.toString();
}
else {
} else {
translatorName = ki18nc("NAME OF TRANSLATORS", NAME_OF_TRANSLATORS).toString(tmpLocale);
}
QString translatorEmail;
if (!d->translatorEmail.isEmpty()) {
translatorEmail = d->translatorEmail.toString();
}
else {
} else {
translatorEmail = ki18nc("EMAIL OF TRANSLATORS", EMAIL_OF_TRANSLATORS).toString(tmpLocale);
}
delete tmpLocale;
if ( translatorName.isEmpty() || translatorName == QString::fromUtf8( NAME_OF_TRANSLATORS ) )
if (translatorName.isEmpty() || translatorName == QString::fromUtf8(NAME_OF_TRANSLATORS)) {
return personList;
}
const QStringList nameList(translatorName.split(QString(QLatin1Char(','))));
QStringList emailList;
if( !translatorEmail.isEmpty() && translatorEmail != QString::fromUtf8( EMAIL_OF_TRANSLATORS ) )
{
if (!translatorEmail.isEmpty() && translatorEmail != QString::fromUtf8(EMAIL_OF_TRANSLATORS)) {
emailList = translatorEmail.split(QString(QLatin1Char(',')), QString::KeepEmptyParts);
}
foreach ( const QString &nit, nameList )
{
foreach (const QString &nit, nameList) {
// overkill?
QString email;
foreach (const QString &eit, emailList )
{
foreach (const QString &eit, emailList) {
email = eit;
}
personList.append( KAboutPerson( nit.trimmed(), email.trimmed() ) );
personList.append(KAboutPerson(nit.trimmed(), email.trimmed()));
}
return personList;
@ -637,7 +649,7 @@ QString KAboutData::license() const
return d->_licenseList.at(0).text();
}
QString KAboutData::licenseName( NameFormat formatName ) const
QString KAboutData::licenseName(NameFormat formatName) const
{
return d->_licenseList.at(0).name(formatName);
}
@ -649,7 +661,8 @@ QList<KAboutLicense> KAboutData::licenses() const
QString KAboutData::copyrightStatement() const
{
if (!d->_copyrightStatement.isEmpty())
if (!d->_copyrightStatement.isEmpty()) {
return d->_copyrightStatement.toString();
}
return QString();
}

View file

@ -29,19 +29,17 @@
#include <kglobalsettings.h>
class KAboutData;
class KAboutLicense;
/**
* This class is used to store information about a person or developer.
* It can store the person's name, a task, an email address and a
* link to a home page. This class is intended for use in the
* KAboutData class, but it can be used elsewhere as well.
* Normally you should at least define the person's name.
* Creating a KAboutPerson object by yourself is relatively useless,
* but the KAboutData methods KAboutData::authors() and KAboutData::credits()
* return lists of KAboutPerson data objects which you can examine.
* This class is used to store information about a person or developer. It can store the person's
* name, a task, an email address and a link to a home page. This class is intended for use in the
* KAboutData class, but it can be used elsewhere as well. Normally you should at least define the
* person's name. KAboutData methods KAboutData::authors() and KAboutData::credits() return lists
* of KAboutPerson data objects which you can examine.
*
* Example usage within a main(), retrieving the list of people involved
* with a program and re-using data from one of them:
* Example usage within a main(), retrieving the list of people involved with a program and
* re-using data from one of them:
*
* @code
* KAboutData about("khello", "khello", ki18n("KHello"), "0.1",
@ -58,8 +56,6 @@ class KAboutData;
* 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 KAboutData is constructed.
*
* @bc KDE4
*/
class KDECORE_EXPORT KAboutPerson
{
@ -69,23 +65,20 @@ public:
* Convenience constructor
*
* @param name The name of the person.
*
* @param task The task of this person.
*
* @param emailAddress The email address of the person.
*
* @param webAddress Home page of the person.
*/
explicit KAboutPerson( const KLocalizedString &name,
explicit KAboutPerson(const KLocalizedString &name,
const KLocalizedString &task = KLocalizedString(),
const QByteArray &emailAddress = QByteArray(),
const QByteArray &webAddress = QByteArray() );
const QByteArray &webAddress = QByteArray());
/**
* Copy constructor. Performs a deep copy.
* @param other object to copy
*/
KAboutPerson(const KAboutPerson& other);
KAboutPerson(const KAboutPerson &other);
~KAboutPerson();
@ -93,34 +86,32 @@ public:
* Assignment operator. Performs a deep copy.
* @param other object to copy
*/
KAboutPerson& operator=(const KAboutPerson& other);
KAboutPerson& operator=(const KAboutPerson &other);
/**
* The person's name
* @return the person's name (can be QString(), if it has been
* constructed with an empty name)
* @return the person's name (can be QString(), if it has been constructed with an empty name)
*/
QString name() const;
/**
* The person's task
* @return the person's task (can be QString(), if it has been
* constructed with an empty task)
* @return the person's task (can be QString(), if it has been constructed with an empty task)
*/
QString task() const;
/**
* The person's email address
* @return the person's email address (can be QString(), if it has been
* constructed with an empty email)
* @return the person's email address (can be QString(), if it has been constructed with an
* empty email)
*/
QString emailAddress() const;
/**
* The home page or a relevant link
* @return the persons home page (can be QString(), if it has been
* constructed with an empty home page)
* @return the persons home page (can be QString(), if it has been constructed with an empty
* home page)
*/
QString webAddress() const;
@ -128,43 +119,36 @@ private:
/**
* @internal Used by KAboutData to construct translator data.
*/
explicit KAboutPerson( const QString &name, const QString &email );
explicit KAboutPerson(const QString &name, const QString &email);
class Private;
Private *const d;
};
class KAboutLicense;
// KDE5: refactor together with KComponentData.
// Like changing all property names which contain Program or App.
/**
* This class is used to store information about a program. It can store
* such values as version number, program name, home page, email address
* for bug reporting, multiple authors and contributors
* (using KAboutPerson), license and copyright information.
* This class is used to store information about a program. It can store such values as version
* number, program name, home page, email address for bug reporting, multiple authors and
* contributors (using KAboutPerson), license and copyright information.
*
* Currently, the values set here are shown by the "About" box (see
* KAboutDialog), and by the help shown on command line (see KCmdLineArgs).
* They are also used for the icon and the name of the program's windows.
* Currently, the values set here are shown by the "About" box (see KAboutDialog), and by the help
* shown on command line (see KCmdLineArgs). They are also used for the icon and the name of the
* program's windows.
*
* @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 KAboutData is constructed.
* @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 KAboutData is
* constructed.
*
* @short Holds information needed by the "About" box and other
* classes.
* @short Holds information needed by the "About" box and other classes.
* @author Espen Sand (espen@kde.org), David Faure (faure@kde.org)
*/
class KDECORE_EXPORT KAboutData
{
public:
public:
/**
* Describes the license of the software.
*/
enum LicenseKey // KDE5: move to KAboutLicense, cut License_ prefix
enum LicenseKey // KDE5: move to KAboutLicense
{
License_Unknown = 0,
License_GPL = 1,
@ -186,149 +170,119 @@ class KDECORE_EXPORT KAboutData
FullName
};
public:
/**
* Constructor.
*
* @param appName The program name used internally. Example: "kedit"
*
* @param catalogName The translation catalog name; if null or empty, the
* @p appName will be used. You may want the catalog name to
* differ from program name, for example, when you want to group
* translations of several smaller utilities under the same catalog.
*
* @param programName A displayable program name string. This string
* should be marked for translation. Example: ki18n("KEdit")
*
* @param catalogName The translation catalog name; if null or empty, the @p appName will be
* used. You may want the catalog name to differ from program name, for example, when
* you want to group translations of several smaller utilities under the same catalog.
* @param programName A displayable program name string. This string should be marked for
* translation. Example: ki18n("KEdit")
* @param version The program version string.
*
* @param shortDescription A short description of what the program does.
* This string should be marked for translation.
* Example: ki18n("A simple text editor.")
*
* @param shortDescription A short description of what the program does. This string should be
* marked for translation. Example: ki18n("A simple text editor.")
* @param licenseType The license identifier.
*
* @param copyrightStatement A copyright statement, that can look like this:
* ki18n("Copyright (C) 1999-2000 Name"). The string specified here is
* taken verbatim; the author information from addAuthor is not used.
* ki18n("Copyright (C) 1999-2000 Name"). The string specified here is taken verbatim,
* the author information from addAuthor is not used.
*/
KAboutData( const QByteArray &appName,
KAboutData(const QByteArray &appName,
const QByteArray &catalogName,
const KLocalizedString &programName,
const QByteArray &version,
const KLocalizedString &shortDescription = KLocalizedString(),
enum LicenseKey licenseType = License_Unknown,
const KLocalizedString &copyrightStatement = KLocalizedString()
);
const KLocalizedString &copyrightStatement = KLocalizedString());
/**
* Copy constructor. Performs a deep copy.
* @param other object to copy
*/
KAboutData(const KAboutData& other);
KAboutData(const KAboutData &other);
/**
* Assignment operator. Performs a deep copy.
* @param other object to copy
*/
KAboutData& operator=(const KAboutData& other);
KAboutData& operator=(const KAboutData &other);
~KAboutData();
/**
* Defines an author.
*
* You can call this function as many times as you need. Each entry is
* appended to a list. The person in the first entry is assumed to be
* the leader of the project.
*
* @param name The developer's name. It should be marked for translation
* like this: ki18n("Developer Name")
*
* @param task What the person is responsible for. This text can contain
* newlines. It should be marked for translation like this:
* ki18n("Task description..."). Can be left empty.
*
* @param emailAddress An Email address where the person can be reached.
* Can be left empty.
*
* @param webAddress The person's homepage or a relevant link.
* Start the address with "http://". "http://some.domain" is
* correct, "some.domain" is not. Can be left empty.
* You can call this function as many times as you need. Each entry is appended to a list. The
* person in the first entry is assumed to be the leader of the project.
*
* @param name The developer's name. It should be marked for translation like this:
* ki18n("Developer Name")
* @param task What the person is responsible for. This text can contain newlines. It should be
* marked for translation like this: ki18n("Task description..."). Can be left empty.
* @param emailAddress An Email address where the person can be reached. Can be left empty.
* @param webAddress The person's homepage or a relevant link. Start the address with
* "http://". "http://some.domain" is correct, "some.domain" is not. Can be left empty.
*/
KAboutData &addAuthor( const KLocalizedString &name,
KAboutData& addAuthor(const KLocalizedString &name,
const KLocalizedString &task = KLocalizedString(),
const QByteArray &emailAddress = QByteArray(),
const QByteArray &webAddress = QByteArray() );
const QByteArray &webAddress = QByteArray());
/**
* Defines a person that deserves credit.
*
* You can call this function as many times as you need. Each entry
* is appended to a list.
*
* @param name The person's name. It should be marked for translation
* like this: ki18n("Contributor Name")
*
* @param task What the person has done to deserve the honor. The
* text can contain newlines. It should be marked for
* translation like this: ki18n("Task description...")
* Can be left empty.
*
* @param emailAddress An email address when the person can be reached.
* Can be left empty.
*
* @param webAddress The person's homepage or a relevant link.
* Start the address with "http://". "http://some.domain" is
* is correct, "some.domain" is not. Can be left empty.
* You can call this function as many times as you need. Each entry is appended to a list.
*
* @param name The person's name. It should be marked for translation like this:
* ki18n("Contributor Name")
* @param task What the person has done to deserve the honor. The text can contain newlines.
* It should be marked for translation like this: ki18n("Task description..."). Can be
* left empty.
* @param emailAddress An email address when the person can be reached. Can be left empty.
* @param webAddress The person's homepage or a relevant link. Start the address with
* "http://". "http://some.domain" is correct, "some.domain" is not. Can be left empty.
*/
KAboutData &addCredit( const KLocalizedString &name,
KAboutData& addCredit(const KLocalizedString &name,
const KLocalizedString &task = KLocalizedString(),
const QByteArray &emailAddress = QByteArray(),
const QByteArray &webAddress = QByteArray() );
const QByteArray &webAddress = QByteArray());
/**
* @brief Sets the name(s) of the translator(s) of the GUI.
*
* Since this depends on the language, just use a dummy text marked for
* translation.
*
* The canonical use is:
* Since this depends on the language, just use a dummy text marked for translation. The
* canonical use is:
*
* \code
* setTranslator(ki18nc("NAME OF TRANSLATORS", "Your names"),
* ki18nc("EMAIL OF TRANSLATORS", "Your emails"));
* \endcode
*
* The translator can then translate this dummy text with his name
* or with a list of names separated with ",".
* If there is no translation or the application is used with the
* default language, this function call is ignored.
* The translator can then translate this dummy text with his name or with a list of names
* separated with ",". If there is no translation or the application is used with the default
* language, this function call is ignored.
*
* @param name the name(s) of the translator(s)
* @param emailAddress the email address(es) of the translator(s)
* @see KAboutTranslator
*/
KAboutData &setTranslator( const KLocalizedString& name,
const KLocalizedString& emailAddress );
KAboutData& setTranslator(const KLocalizedString &name,
const KLocalizedString &emailAddress);
/**
* Defines the program name used internally.
*
* @param appName The application name. Example: "kate".
*/
KAboutData &setAppName( const QByteArray &appName );
KAboutData& setAppName(const QByteArray &appName);
/**
* Defines the displayable program name string.
*
* @param programName The program name. This string should be
* marked for translation.
* Example: ki18n("Advanced Text Editor").
* @param programName The program name. This string should be marked for translation. Example:
* ki18n("Advanced Text Editor").
*/
KAboutData &setProgramName( const KLocalizedString &programName );
KAboutData &setProgramName(const KLocalizedString &programName);
/**
* Defines the program icon.
@ -340,30 +294,30 @@ class KDECORE_EXPORT KAboutData
* @see programIconName()
* @since 4.1
*/
KAboutData &setProgramIconName( const QString &iconName );
KAboutData& setProgramIconName(const QString &iconName);
/**
* Defines the program version string.
*
* @param version The program version.
*/
KAboutData &setVersion( const QByteArray &version );
KAboutData& setVersion(const QByteArray &version);
/**
* Defines a short description of what the program does.
*
* @param shortDescription The program description. This string should
* be marked for translation. Example: ki18n("An advanced text
* editor with syntax highlighting support.").
* @param shortDescription The program description. This string should be marked for
* translation. Example: ki18n("An advanced text editor with syntax highlighting
* support.").
*/
KAboutData &setShortDescription( const KLocalizedString &shortDescription );
KAboutData& setShortDescription(const KLocalizedString &shortDescription);
/**
* Defines the translation catalog that the program uses.
*
* @param catalogName The translation catalog name.
*/
KAboutData &setCatalogName( const QByteArray &catalogName );
KAboutData& setCatalogName(const QByteArray &catalogName);
/**
* Defines the license identifier.
@ -371,63 +325,61 @@ class KDECORE_EXPORT KAboutData
* @param licenseKey The license identifier.
* @see addLicense
*/
KAboutData &setLicense( LicenseKey licenseKey );
KAboutData& setLicense(LicenseKey licenseKey);
/**
* Adds a license identifier.
*
* If there is only one unknown license set, e.g. by using the default
* parameter in the constructor, that one is replaced.
* If there is only one unknown license set, e.g. by using the default parameter in the
* constructor, that one is replaced.
*
* @param licenseKey The license identifier.
* @since 4.1
*/
KAboutData &addLicense( LicenseKey licenseKey );
KAboutData& addLicense(LicenseKey licenseKey);
/**
* Defines the copyright statement to show when displaying the license.
*
* @param copyrightStatement A copyright statement, that can look like
* this: ki18n("Copyright (C) 1999-2000 Name"). The string specified here is
* taken verbatim; the author information from addAuthor is not used.
* @param copyrightStatement A copyright statement, that can look like this:
* ki18n("Copyright (C) 1999-2000 Name"). The string specified here is taken verbatim,
* the author information from addAuthor is not used.
*/
KAboutData &setCopyrightStatement( const KLocalizedString &copyrightStatement );
KAboutData& setCopyrightStatement(const KLocalizedString &copyrightStatement);
/**
* Defines the program homepage.
*
* @param homepage The program homepage string.
* Start the address with "http://". "http://kate.kde.org"
* is correct but "kate.kde.org" is not.
* @param homepage The program homepage string. Start the address with "http://".
* "http://kate.kde.org" is correct but "kate.kde.org" is not. This defaults to the KDE
* homepage address.
*/
KAboutData &setHomepage( const QByteArray &homepage );
KAboutData& setHomepage(const QByteArray &homepage);
/**
* Defines the address where bug reports should be sent.
*
* @param bugAddress The bug report email address string.
* This defaults to the kde.org bug system.
* @param bugAddress The bug report email address string. This defaults to the KDE bug system
* address.
*/
KAboutData &setBugAddress( const QByteArray &bugAddress );
KAboutData &setBugAddress(const QByteArray &bugAddress);
/**
* Defines the Internet domain of the organization that wrote this application.
* The domain is set to kde.org by default, or the domain of the homePageAddress constructor argument,
* if set.
* Defines the Internet domain of the organization that wrote this application. The domain is
* set to kde.org by default, or the domain of the homePageAddress constructor argument, if
* set.
*
* Make sure to call setOrganizationDomain if your product is developed out of the
* kde.org version-control system.
* Make sure to call setOrganizationDomain if your product is developed out of the kde.org
* version-control system.
*
* Used by the automatic registration to D-Bus done by KApplication and KUniqueApplication.
*
* IMPORTANT: if the organization domain is set, the .desktop file that describes your
* application should have an entry like X-DBUS-ServiceName=reversed_domain.kmyapp
* For instance kwrite passes "http://www.kate-editor.org" as the homePageAddress so it needs
* X-DBUS-ServiceName=org.kate-editor.kwrite in its kwrite.desktop file.
* application should have an entry like X-DBUS-ServiceName=reversed_domain.kmyapp.
*
* @param domain the domain name, for instance kde.org, koffice.org, kdevelop.org, etc.
*/
KAboutData &setOrganizationDomain( const QByteArray &domain );
KAboutData& setOrganizationDomain(const QByteArray &domain);
/**
* Returns the application's internal name.
@ -451,9 +403,8 @@ class KDECORE_EXPORT KAboutData
/**
* Returns the program's icon name.
*
* The default value is appName().
* Use setProgramIconName() if you need to have an icon
* whose name is different from the internal application name.
* The default value is appName(). Use setProgramIconName() if you need to have an icon whose
* name is different from the internal application name.
*
* @return the program's icon name.
* @see setProgramIconName()
@ -469,8 +420,7 @@ class KDECORE_EXPORT KAboutData
/**
* Returns a short, translated description.
* @return the short description (translated). Can be
* QString() if not set.
* @return the short description (translated). Can be QString() if not set.
*/
QString shortDescription() const;
@ -482,8 +432,7 @@ class KDECORE_EXPORT KAboutData
/**
* Returns the application homepage.
* @return the application homepage URL. Can be QString() if
* not set.
* @return the application homepage URL. Can be QString() if not set.
*/
QString homepage() const;
@ -518,12 +467,11 @@ class KDECORE_EXPORT KAboutData
static QString aboutTranslationTeam();
/**
* Returns the license. 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. 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.
*
* @return The license text.
*
* @deprecated There could be multiple licenses, use licenses() instead.
*/
QString license() const;
@ -532,7 +480,6 @@ class KDECORE_EXPORT KAboutData
* Returns the license name.
*
* @return The license name as a string.
*
* @deprecated There could be multiple licenses, use licenses() instead.
*/
QString licenseName(NameFormat formatName) const;
@ -551,8 +498,7 @@ class KDECORE_EXPORT KAboutData
*/
QString copyrightStatement() const;
private:
private:
class Private;
Private *const d;
};
@ -560,18 +506,17 @@ class KDECORE_EXPORT KAboutData
/**
* 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().
*
* @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 KAboutData is constructed.
* The license can be one of the predefined or unknown. 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().
*
* @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 KAboutData is
* constructed.
*/
class KDECORE_EXPORT KAboutLicense
{
@ -581,7 +526,7 @@ public:
* Copy constructor. Performs a deep copy.
* @param other object to copy
*/
KAboutLicense(const KAboutLicense& other);
KAboutLicense(const KAboutLicense &other);
~KAboutLicense();
@ -589,13 +534,12 @@ public:
* Assignment operator. Performs a deep copy.
* @param other object to copy
*/
KAboutLicense& operator=(const KAboutLicense& other);
KAboutLicense& operator=(const KAboutLicense &other);
/**
* Returns the full license text. If the licenseType argument of the
* constructor has been used and the standard text for the chosen
* license will be returned.
* Returns the full license text. If the licenseType argument of the constructor has been used
* and the standard text for the chosen license will be returned.
*
* @return The license text.
*/
@ -619,21 +563,18 @@ public:
/**
* 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 KAboutLicense object, providing that the
* license is one of the several known to KDE, and use it to present
* 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 KAboutData::LicenseKey enumeration,
* e.g. any of "LGPLV3", "LGPLv3", "LGPL v3" would match License_LGPL_V3.
* If there is no match for the keyword, an invalid license object is
* returned (KAboutData::License_Unknown).
* Keywords are matched by stripping all whitespace and lowercasing. The known keywords
* correspond to the KAboutData::LicenseKey enumeration, e.g. any of "LGPLV3", "LGPLv3",
* "LGPL v3" would match License_LGPL_V3. If there is no match for the keyword, an invalid
* license object is returned (KAboutData::License_Unknown).
*
* @param keyword The license keyword.
* @return The license object.
*
* @see KAboutData::LicenseKey
* @since 4.1
*/
@ -643,11 +584,10 @@ private:
/**
* @internal Used by KAboutData to construct a predefined license.
*/
explicit KAboutLicense( enum KAboutData::LicenseKey licenseType, const KAboutData *aboutData );
explicit KAboutLicense(enum KAboutData::LicenseKey licenseType, const KAboutData *aboutData);
class Private;
QSharedDataPointer<Private> d;
};
#endif
#endif // KABOUTDATA_H