diff --git a/kdecore/kernel/kaboutdata.cpp b/kdecore/kernel/kaboutdata.cpp index f200ea09..dc7dc28d 100644 --- a/kdecore/kernel/kaboutdata.cpp +++ b/kdecore/kernel/kaboutdata.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include @@ -56,55 +55,58 @@ class KAboutPerson::Private { public: - KLocalizedString _name; - KLocalizedString _task; - QString _emailAddress; - QString _webAddress; + KLocalizedString _name; + KLocalizedString _task; + QString _emailAddress; + QString _webAddress; - QString _nameNoop; + QString _nameNoop; }; -KAboutPerson::KAboutPerson( const KLocalizedString &_name, - const KLocalizedString &_task, - const QByteArray &_emailAddress, - const QByteArray &_webAddress ) - : d(new Private) +KAboutPerson::KAboutPerson(const KLocalizedString &_name, + const KLocalizedString &_task, + const QByteArray &_emailAddress, + const QByteArray &_webAddress) + : d(new Private) { - d->_name = _name; - d->_task = _task; - d->_emailAddress = QString::fromUtf8(_emailAddress); - d->_webAddress = QString::fromUtf8(_webAddress); + d->_name = _name; + d->_task = _task; + d->_emailAddress = QString::fromUtf8(_emailAddress); + 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; + 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; } KAboutPerson::~KAboutPerson() { - delete d; + delete d; } QString KAboutPerson::name() const { - if (!d->_nameNoop.isEmpty()) - return d->_nameNoop; - return d->_name.toString(); + if (!d->_nameNoop.isEmpty()) { + return d->_nameNoop; + } + return d->_name.toString(); } QString KAboutPerson::task() const { - if (!d->_task.isEmpty()) - return d->_task.toString(); - return QString(); + if (!d->_task.isEmpty()) { + return d->_task.toString(); + } + return QString(); } QString KAboutPerson::emailAddress() const @@ -112,16 +114,15 @@ QString KAboutPerson::emailAddress() const return d->_emailAddress; } - QString KAboutPerson::webAddress() const { - return d->_webAddress; + return d->_webAddress; } -KAboutPerson &KAboutPerson::operator=(const KAboutPerson& other) +KAboutPerson &KAboutPerson::operator=(const KAboutPerson &other) { - *d = *other.d; - return *this; + *d = *other.d; + return *this; } @@ -129,36 +130,35 @@ 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 ) - : QSharedData(), - _licenseKey( licenseType ), - _aboutData( aboutData ) +KAboutLicense::Private::Private(enum KAboutData::LicenseKey licenseType, const KAboutData *aboutData) + : QSharedData(), + _licenseKey(licenseType), + _aboutData(aboutData) { } -KAboutLicense::Private::Private(const KAboutLicense::Private& other) - : QSharedData(other), - _licenseKey( other._licenseKey ), - _aboutData( other._aboutData ) +KAboutLicense::Private::Private(const KAboutLicense::Private &other) + : QSharedData(other), + _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) - : d(other.d) +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,37 +178,45 @@ QString KAboutLicense::text() const bool knownLicense = false; QString pathToFile; - 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: - knownLicense = true; - pathToFile = KStandardDirs::locate("data", QString::fromLatin1("LICENSES/LGPL_V2")); - break; - case KAboutData::License_BSD: - knownLicense = true; - pathToFile = KStandardDirs::locate("data", QString::fromLatin1("LICENSES/BSD")); - break; - case KAboutData::License_Artistic: - knownLicense = true; - pathToFile = KStandardDirs::locate("data", QString::fromLatin1("LICENSES/ARTISTIC")); - break; - case KAboutData::License_GPL_V3: - knownLicense = true; - pathToFile = KStandardDirs::locate("data", QString::fromLatin1("LICENSES/GPL_V3")); - break; - 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" - "Please check the documentation or the source for any\n" - "licensing terms.\n"); - break; + 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: { + knownLicense = true; + pathToFile = KStandardDirs::locate("data", QString::fromLatin1("LICENSES/LGPL_V2")); + break; + } + case KAboutData::License_BSD: { + knownLicense = true; + pathToFile = KStandardDirs::locate("data", QString::fromLatin1("LICENSES/BSD")); + break; + } + case KAboutData::License_Artistic: { + knownLicense = true; + pathToFile = KStandardDirs::locate("data", QString::fromLatin1("LICENSES/ARTISTIC")); + break; + } + case KAboutData::License_GPL_V3: { + knownLicense = true; + pathToFile = KStandardDirs::locate("data", QString::fromLatin1("LICENSES/GPL_V3")); + break; + } + 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" + "Please check the documentation or the source for any\n" + "licensing terms.\n" + ); + break; + } } if (knownLicense) { @@ -236,48 +244,55 @@ QString KAboutLicense::name(KAboutData::NameFormat formatName) const QString licenseFull; switch (d->_licenseKey) { - case KAboutData::License_GPL_V2: - licenseShort = i18nc("@item license (short name)","GPL v2"); - licenseFull = i18nc("@item license","GNU General Public License Version 2"); - break; - case KAboutData::License_LGPL_V2: - licenseShort = i18nc("@item license (short name)","LGPL v2"); - licenseFull = i18nc("@item license","GNU Lesser General Public License Version 2"); - break; - case KAboutData::License_BSD: - licenseShort = i18nc("@item license (short name)","BSD License"); - licenseFull = i18nc("@item license","BSD License"); - break; - case KAboutData::License_Artistic: - licenseShort = i18nc("@item license (short name)","Artistic License"); - licenseFull = i18nc("@item license","Artistic License"); - break; - case KAboutData::License_GPL_V3: - licenseShort = i18nc("@item license (short name)","GPL v3"); - licenseFull = i18nc("@item license","GNU General Public License Version 3"); - break; - 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"); - break; + case KAboutData::License_GPL_V2: { + licenseShort = i18nc("@item license (short name)","GPL v2"); + licenseFull = i18nc("@item license", "GNU General Public License Version 2"); + break; + } + case KAboutData::License_LGPL_V2: { + licenseShort = i18nc("@item license (short name)","LGPL v2"); + licenseFull = i18nc("@item license", "GNU Lesser General Public License Version 2"); + break; + } + case KAboutData::License_BSD: { + licenseShort = i18nc("@item license (short name)","BSD License"); + licenseFull = i18nc("@item license", "BSD License"); + break; + } + case KAboutData::License_Artistic: { + licenseShort = i18nc("@item license (short name)","Artistic License"); + licenseFull = i18nc("@item license", "Artistic License"); + break; + } + case KAboutData::License_GPL_V3: { + licenseShort = i18nc("@item license (short name)","GPL v3"); + licenseFull = i18nc("@item license", "GNU General Public License Version 3"); + break; + } + 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"); + 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; + d = other.d; + return *this; } KAboutData::LicenseKey KAboutLicense::key() const @@ -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, - const QByteArray &_catalogName, - const KLocalizedString &_programName, - const QByteArray &_version, - const KLocalizedString &_shortDescription, - enum LicenseKey licenseType, - const KLocalizedString &_copyrightStatement - ) - : d(new Private) +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()) { 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::iterator it = d->_licenseList.begin(), itEnd = d->_licenseList.end(); @@ -395,114 +409,115 @@ KAboutData &KAboutData::operator=(const KAboutData& other) return *this; } -KAboutData &KAboutData::addAuthor( const KLocalizedString &name, - const KLocalizedString &task, - const QByteArray &emailAddress, - const QByteArray &webAddress ) +KAboutData &KAboutData::addAuthor(const KLocalizedString &name, + const KLocalizedString &task, + const QByteArray &emailAddress, + const QByteArray &webAddress) { - d->_authorList.append(KAboutPerson(name,task,emailAddress,webAddress)); - return *this; -} - -KAboutData &KAboutData::addCredit( const KLocalizedString &name, - const KLocalizedString &task, - const QByteArray &emailAddress, - const QByteArray &webAddress ) -{ - d->_creditList.append(KAboutPerson(name,task,emailAddress,webAddress)); - return *this; -} - -KAboutData &KAboutData::setTranslator( const KLocalizedString& name, - const KLocalizedString& emailAddress ) -{ - d->translatorName = name; - d->translatorEmail = emailAddress; - return *this; -} - -KAboutData &KAboutData::setAppName( const QByteArray &_appName ) -{ - d->_appName = _appName; - return *this; -} - -KAboutData &KAboutData::setProgramName( const KLocalizedString &_programName ) -{ - d->_programName = _programName; - return *this; -} - -KAboutData &KAboutData::setVersion( const QByteArray &_version ) -{ - d->_version = _version; - return *this; -} - -KAboutData &KAboutData::setShortDescription( const KLocalizedString &_shortDescription ) -{ - d->_shortDescription = _shortDescription; - return *this; -} - -KAboutData &KAboutData::setCatalogName( const QByteArray &_catalogName ) -{ - d->_catalogName = _catalogName; - return *this; -} - -KAboutData &KAboutData::setLicense( LicenseKey licenseKey) -{ - d->_licenseList[0] = KAboutLicense(licenseKey,this); + d->_authorList.append(KAboutPerson(name, task, emailAddress, webAddress)); return *this; } -KAboutData &KAboutData::addLicense( LicenseKey licenseKey) +KAboutData &KAboutData::addCredit(const KLocalizedString &name, + const KLocalizedString &task, + const QByteArray &emailAddress, + const QByteArray &webAddress) +{ + d->_creditList.append(KAboutPerson(name, task, emailAddress, webAddress)); + return *this; +} + +KAboutData &KAboutData::setTranslator( const KLocalizedString &name, + const KLocalizedString &emailAddress) +{ + d->translatorName = name; + d->translatorEmail = emailAddress; + return *this; +} + +KAboutData &KAboutData::setAppName(const QByteArray &_appName) +{ + d->_appName = _appName; + return *this; +} + +KAboutData &KAboutData::setProgramName(const KLocalizedString &_programName) +{ + d->_programName = _programName; + return *this; +} + +KAboutData &KAboutData::setVersion(const QByteArray &_version) +{ + d->_version = _version; + return *this; +} + +KAboutData &KAboutData::setShortDescription(const KLocalizedString &_shortDescription) +{ + d->_shortDescription = _shortDescription; + return *this; +} + +KAboutData &KAboutData::setCatalogName(const QByteArray &_catalogName) +{ + d->_catalogName = _catalogName; + return *this; +} + +KAboutData &KAboutData::setLicense(LicenseKey licenseKey) +{ + d->_licenseList[0] = KAboutLicense(licenseKey, this); + return *this; +} + +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; + d->_copyrightStatement = _copyrightStatement; + return *this; } -KAboutData &KAboutData::setHomepage( const QByteArray &_homepage ) +KAboutData &KAboutData::setHomepage(const QByteArray &_homepage) { - d->_homepageAddress = QString::fromLatin1(_homepage); - return *this; + d->_homepageAddress = QString::fromLatin1(_homepage); + return *this; } -KAboutData &KAboutData::setBugAddress( const QByteArray &_bugAddress ) +KAboutData &KAboutData::setBugAddress(const QByteArray &_bugAddress) { - d->_bugEmailAddress = _bugAddress; - return *this; + d->_bugEmailAddress = _bugAddress; + return *this; } -KAboutData &KAboutData::setOrganizationDomain( const QByteArray &domain ) +KAboutData &KAboutData::setOrganizationDomain(const QByteArray &domain) { - d->organizationDomain = QString::fromLatin1(domain); - return *this; + d->organizationDomain = QString::fromLatin1(domain); + return *this; } QString KAboutData::appName() const { - return QString::fromUtf8(d->_appName); + return QString::fromUtf8(d->_appName); } QString KAboutData::programName() const { - if (!d->_programName.isEmpty()) - return d->_programName.toString(); - return QString(); + if (!d->_programName.isEmpty()) { + return d->_programName.toString(); + } + return QString(); } QString KAboutData::programIconName() const @@ -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; @@ -518,32 +533,34 @@ KAboutData &KAboutData::setProgramIconName( const QString &iconName ) QString KAboutData::version() const { - return QString::fromUtf8(d->_version); + return QString::fromUtf8(d->_version); } QString KAboutData::shortDescription() const { - if (!d->_shortDescription.isEmpty()) - return d->_shortDescription.toString(); - return QString(); + if (!d->_shortDescription.isEmpty()) { + return d->_shortDescription.toString(); + } + return QString(); } QString KAboutData::catalogName() const { - if (!d->_catalogName.isEmpty()) - return QString::fromUtf8(d->_catalogName); - // Fallback to appname for catalog name if empty. - return QString::fromUtf8(d->_appName); + if (!d->_catalogName.isEmpty()) { + return QString::fromUtf8(d->_catalogName); + } + // Fallback to appname for catalog name if empty. + return QString::fromUtf8(d->_appName); } QString KAboutData::homepage() const { - return d->_homepageAddress; + return d->_homepageAddress; } QString KAboutData::bugAddress() const { - return QString::fromUtf8(d->_bugEmailAddress); + return QString::fromUtf8(d->_bugEmailAddress); } QString KAboutData::organizationDomain() const @@ -553,12 +570,12 @@ QString KAboutData::organizationDomain() const QList KAboutData::authors() const { - return d->_authorList; + return d->_authorList; } QList KAboutData::credits() const { - return d->_creditList; + return d->_creditList; } #define NAME_OF_TRANSLATORS "Your names" @@ -580,42 +597,37 @@ QList 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 ) ) - { - emailList = translatorEmail.split(QString(QLatin1Char(',')), QString::KeepEmptyParts); + 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 KAboutData::licenses() const QString KAboutData::copyrightStatement() const { - if (!d->_copyrightStatement.isEmpty()) - return d->_copyrightStatement.toString(); - return QString(); + if (!d->_copyrightStatement.isEmpty()) { + return d->_copyrightStatement.toString(); + } + return QString(); } diff --git a/kdecore/kernel/kaboutdata.h b/kdecore/kernel/kaboutdata.h index 189c3fb2..f80ef449 100644 --- a/kdecore/kernel/kaboutdata.h +++ b/kdecore/kernel/kaboutdata.h @@ -29,19 +29,17 @@ #include 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,58 +65,53 @@ 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, - const KLocalizedString &task = KLocalizedString(), - const QByteArray &emailAddress = QByteArray(), - const QByteArray &webAddress = QByteArray() ); + explicit KAboutPerson(const KLocalizedString &name, + const KLocalizedString &task = KLocalizedString(), + const QByteArray &emailAddress = 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(); /** - * Assignment operator. Performs a deep copy. + * 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,207 +119,170 @@ 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: - /** - * Describes the license of the software. - */ - enum LicenseKey // KDE5: move to KAboutLicense, cut License_ prefix +public: + /** + * Describes the license of the software. + */ + enum LicenseKey // KDE5: move to KAboutLicense { - License_Unknown = 0, - License_GPL = 1, - License_GPL_V2 = 1, - License_LGPL = 2, - License_LGPL_V2 = 2, - License_BSD = 3, - License_Artistic = 4, - License_GPL_V3 = 5, - License_LGPL_V3 = 6 + License_Unknown = 0, + License_GPL = 1, + License_GPL_V2 = 1, + License_LGPL = 2, + License_LGPL_V2 = 2, + License_BSD = 3, + License_Artistic = 4, + License_GPL_V3 = 5, + License_LGPL_V3 = 6 }; - /** - * Format of the license name. - */ + /** + * Format of the license name. + */ enum NameFormat // KDE5: move to KAboutLicense { ShortName, 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, - const QByteArray &catalogName, - const KLocalizedString &programName, - const QByteArray &version, - const KLocalizedString &shortDescription = KLocalizedString(), - enum LicenseKey licenseType = License_Unknown, - const KLocalizedString ©rightStatement = KLocalizedString() - ); + KAboutData(const QByteArray &appName, + const QByteArray &catalogName, + const KLocalizedString &programName, + const QByteArray &version, + const KLocalizedString &shortDescription = KLocalizedString(), + enum LicenseKey licenseType = License_Unknown, + const KLocalizedString ©rightStatement = KLocalizedString()); /** - * Copy constructor. Performs a deep copy. + * 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. + * 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, - const KLocalizedString &task = KLocalizedString(), - const QByteArray &emailAddress = QByteArray(), - const QByteArray &webAddress = QByteArray() ); + KAboutData& addAuthor(const KLocalizedString &name, + const KLocalizedString &task = KLocalizedString(), + const QByteArray &emailAddress = 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, - const KLocalizedString &task = KLocalizedString(), - const QByteArray &emailAddress = QByteArray(), - const QByteArray &webAddress = QByteArray() ); + KAboutData& addCredit(const KLocalizedString &name, + const KLocalizedString &task = KLocalizedString(), + const QByteArray &emailAddress = 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 ©rightStatement ); + KAboutData& setCopyrightStatement(const KLocalizedString ©rightStatement); /** * 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 d; }; -#endif - +#endif // KABOUTDATA_H