kdecore: remove unused KAboutData methods and redundant constructor arguments

the homepage and the bugs email address shall always be defined in
kglobalsettings header for official Katana applications, libraries, etc.
the option to override them is still a thing

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-08-10 17:22:20 +03:00
parent bd063c8b56
commit fa51ecdfaf
9 changed files with 45 additions and 391 deletions

View file

@ -361,15 +361,11 @@ KAboutLicense KAboutLicense::byKeyword(const QString &rawKeyword)
class KAboutData::Private class KAboutData::Private
{ {
public: public:
Private()
: customAuthorTextEnabled(false)
{}
QByteArray _appName; QByteArray _appName;
KLocalizedString _programName; KLocalizedString _programName;
KLocalizedString _shortDescription; KLocalizedString _shortDescription;
QByteArray _catalogName; QByteArray _catalogName;
KLocalizedString _copyrightStatement; KLocalizedString _copyrightStatement;
KLocalizedString _otherText;
QString _homepageAddress; QString _homepageAddress;
QList<KAboutPerson> _authorList; QList<KAboutPerson> _authorList;
QList<KAboutPerson> _creditList; QList<KAboutPerson> _creditList;
@ -377,12 +373,7 @@ public:
KLocalizedString translatorName; KLocalizedString translatorName;
KLocalizedString translatorEmail; KLocalizedString translatorEmail;
QString programIconName; QString programIconName;
QVariant programLogo;
KLocalizedString customAuthorPlainText, customAuthorRichText;
bool customAuthorTextEnabled;
QString organizationDomain; QString organizationDomain;
QByteArray _version; QByteArray _version;
QByteArray _bugEmailAddress; QByteArray _bugEmailAddress;
}; };
@ -394,10 +385,7 @@ KAboutData::KAboutData( const QByteArray &_appName,
const QByteArray &_version, const QByteArray &_version,
const KLocalizedString &_shortDescription, const KLocalizedString &_shortDescription,
enum LicenseKey licenseType, enum LicenseKey licenseType,
const KLocalizedString &_copyrightStatement, const KLocalizedString &_copyrightStatement
const KLocalizedString &text,
const QByteArray &homePageAddress,
const QByteArray &bugsEmailAddress
) )
: d(new Private) : d(new Private)
{ {
@ -413,26 +401,10 @@ KAboutData::KAboutData( const QByteArray &_appName,
d->_shortDescription = _shortDescription; d->_shortDescription = _shortDescription;
d->_licenseList.append(KAboutLicense(licenseType,this)); d->_licenseList.append(KAboutLicense(licenseType,this));
d->_copyrightStatement = _copyrightStatement; d->_copyrightStatement = _copyrightStatement;
d->_otherText = text; d->_homepageAddress = QString::fromLatin1(KDE_HOME_URL);
d->_homepageAddress = QString::fromLatin1(homePageAddress); d->_bugEmailAddress = QByteArray(KDE_BUG_REPORT_EMAIL);
d->_bugEmailAddress = bugsEmailAddress;
if (d->_homepageAddress.contains(QLatin1String("http://"))) {
const int dot = d->_homepageAddress.indexOf(QLatin1Char('.'));
if (dot >= 0) {
d->organizationDomain = d->_homepageAddress.mid(dot + 1);
const int slash = d->organizationDomain.indexOf(QLatin1Char('/'));
if (slash >= 0)
d->organizationDomain.truncate(slash);
}
else {
d->organizationDomain = QString::fromLatin1("kde.org"); d->organizationDomain = QString::fromLatin1("kde.org");
} }
}
else {
d->organizationDomain = QString::fromLatin1("kde.org");
}
}
KAboutData::~KAboutData() KAboutData::~KAboutData()
{ {
@ -490,42 +462,6 @@ KAboutData &KAboutData::setTranslator( const KLocalizedString& name,
return *this; return *this;
} }
KAboutData &KAboutData::setLicenseText( const KLocalizedString &licenseText )
{
d->_licenseList[0] = KAboutLicense(licenseText,this);
return *this;
}
KAboutData &KAboutData::addLicenseText( const KLocalizedString &licenseText )
{
// 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(licenseText,this);
} else {
d->_licenseList.append(KAboutLicense(licenseText,this));
}
return *this;
}
KAboutData &KAboutData::setLicenseTextFile( const QString &pathToFile )
{
d->_licenseList[0] = KAboutLicense(pathToFile,this);
return *this;
}
KAboutData &KAboutData::addLicenseTextFile( const QString &pathToFile )
{
// 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(pathToFile,this);
} else {
d->_licenseList.append(KAboutLicense(pathToFile,this));
}
return *this;
}
KAboutData &KAboutData::setAppName( const QByteArray &_appName ) KAboutData &KAboutData::setAppName( const QByteArray &_appName )
{ {
d->_appName = _appName; d->_appName = _appName;
@ -580,12 +516,6 @@ KAboutData &KAboutData::setCopyrightStatement( const KLocalizedString &_copyrigh
return *this; return *this;
} }
KAboutData &KAboutData::setOtherText( const KLocalizedString &_otherText )
{
d->_otherText = _otherText;
return *this;
}
KAboutData &KAboutData::setHomepage( const QByteArray &_homepage ) KAboutData &KAboutData::setHomepage( const QByteArray &_homepage )
{ {
d->_homepageAddress = QString::fromLatin1(_homepage); d->_homepageAddress = QString::fromLatin1(_homepage);
@ -627,17 +557,6 @@ KAboutData &KAboutData::setProgramIconName( const QString &iconName )
return *this; return *this;
} }
QVariant KAboutData::programLogo() const
{
return d->programLogo;
}
KAboutData &KAboutData::setProgramLogo(const QVariant& image)
{
d->programLogo = image ;
return *this;
}
QString KAboutData::version() const QString KAboutData::version() const
{ {
return QString::fromUtf8(d->_version); return QString::fromUtf8(d->_version);
@ -754,13 +673,6 @@ QString KAboutData::aboutTranslationTeam()
); );
} }
QString KAboutData::otherText() const
{
if (!d->_otherText.isEmpty())
return d->_otherText.toString();
return QString();
}
QString KAboutData::license() const QString KAboutData::license() const
{ {
return d->_licenseList.at(0).text(); return d->_licenseList.at(0).text();
@ -782,44 +694,3 @@ QString KAboutData::copyrightStatement() const
return d->_copyrightStatement.toString(); return d->_copyrightStatement.toString();
return QString(); return QString();
} }
QString KAboutData::customAuthorPlainText() const
{
if (!d->customAuthorPlainText.isEmpty())
return d->customAuthorPlainText.toString();
return QString();
}
QString KAboutData::customAuthorRichText() const
{
if (!d->customAuthorRichText.isEmpty())
return d->customAuthorRichText.toString();
return QString();
}
bool KAboutData::customAuthorTextEnabled() const
{
return d->customAuthorTextEnabled;
}
KAboutData &KAboutData::setCustomAuthorText( const KLocalizedString &plainText,
const KLocalizedString &richText )
{
d->customAuthorPlainText = plainText;
d->customAuthorRichText = richText;
d->customAuthorTextEnabled = true;
return *this;
}
KAboutData &KAboutData::unsetCustomAuthorText()
{
d->customAuthorPlainText = KLocalizedString();
d->customAuthorRichText = KLocalizedString();
d->customAuthorTextEnabled = false;
return *this;
}

View file

@ -28,8 +28,6 @@
#include <klocale.h> #include <klocale.h>
#include <kglobalsettings.h> #include <kglobalsettings.h>
#include <QVariant>
class KAboutData; class KAboutData;
/** /**
@ -210,27 +208,11 @@ class KDECORE_EXPORT KAboutData
* This string should be marked for translation. * This string should be marked for translation.
* Example: ki18n("A simple text editor.") * Example: ki18n("A simple text editor.")
* *
* @param licenseType The license identifier. Use setLicenseText or * @param licenseType The license identifier.
setLicenseTextFile if you use a license not predefined here.
* *
* @param copyrightStatement A copyright statement, that can look like this: * @param copyrightStatement A copyright statement, that can look like this:
* ki18n("Copyright (C) 1999-2000 Name"). The string specified here is * ki18n("Copyright (C) 1999-2000 Name"). The string specified here is
* taken verbatim; the author information from addAuthor is not used. * taken verbatim; the author information from addAuthor is not used.
*
* @param otherText Some free form text, that can contain any kind of
* information. The text can contain newlines. This string
* should be marked for translation.
*
* @param homePageAddress The program homepage string.
* Start the address with "http://". "http://some.domain" is
* is correct, "some.domain" is not.
* IMPORTANT: if you set a home page address, this will change the "organization domain"
* of the application, which is used for automatic D-Bus registration.
* @see setOrganizationDomain
*
* @param bugsEmailAddress The bug report email address string.
* This defaults to the kde.org bug system.
*
*/ */
KAboutData( const QByteArray &appName, KAboutData( const QByteArray &appName,
const QByteArray &catalogName, const QByteArray &catalogName,
@ -238,10 +220,7 @@ class KDECORE_EXPORT KAboutData
const QByteArray &version, const QByteArray &version,
const KLocalizedString &shortDescription = KLocalizedString(), const KLocalizedString &shortDescription = KLocalizedString(),
enum LicenseKey licenseType = License_Unknown, enum LicenseKey licenseType = License_Unknown,
const KLocalizedString &copyrightStatement = KLocalizedString(), const KLocalizedString &copyrightStatement = KLocalizedString()
const KLocalizedString &otherText = KLocalizedString(),
const QByteArray &homePageAddress = QByteArray(),
const QByteArray &bugsEmailAddress = KDE_BUG_REPORT_EMAIL
); );
/** /**
@ -337,56 +316,6 @@ class KDECORE_EXPORT KAboutData
KAboutData &setTranslator( const KLocalizedString& name, KAboutData &setTranslator( const KLocalizedString& name,
const KLocalizedString& emailAddress ); const KLocalizedString& emailAddress );
/**
* Defines a license text, which is marked for translation.
*
* Example:
* \code
* setLicenseText( ki18n("This is my license") );
* \endcode
*
* @param license The license text.
*/
KAboutData &setLicenseText( const KLocalizedString &license );
/**
* Adds a license text, which is marked for translation.
*
* If there is only one unknown license set, e.g. by using the default
* parameter in the constructor, that one is replaced.
*
* Example:
* \code
* addLicenseText( ki18n("This is my license") );
* \endcode
*
* @param license The license text.
* @see setLicenseText, addLicense, addLicenseTextFile
* @since 4.1
*/
KAboutData &addLicenseText( const KLocalizedString &license );
/**
* Defines a license text by pointing to a file where it resides.
* The file format has to be plain text in an encoding compatible to the locale.
*
* @param file Path to the file in the local filesystem containing the license text.
*/
KAboutData &setLicenseTextFile( const QString &file );
/**
* Adds a license text by pointing to a file where it resides.
* The file format has to be plain text in an encoding compatible to the locale.
*
* If there is only one unknown license set, e.g. by using the default
* parameter in the constructor, that one is replaced.
*
* @param file Path to the file in the local filesystem containing the license text.
* @see addLicenseText, addLicense, setLicenseTextFile
* @since 4.1
*/
KAboutData &addLicenseTextFile( const QString &file );
/** /**
* Defines the program name used internally. * Defines the program name used internally.
* *
@ -415,20 +344,6 @@ class KDECORE_EXPORT KAboutData
*/ */
KAboutData &setProgramIconName( const QString &iconName ); KAboutData &setProgramIconName( const QString &iconName );
/**
* Defines the program logo.
*
* Use this if you need to have an application logo
* in AboutData other than the application icon.
*
* Because KAboutData is in kdecore it cannot use QImage directly,
* so this is a QVariant that should contain a QImage.
*
* @param image logo image.
* @see programLogo()
*/
KAboutData &setProgramLogo(const QVariant& image);
/** /**
* Defines the program version string. * Defines the program version string.
* *
@ -456,7 +371,7 @@ class KDECORE_EXPORT KAboutData
* Defines the license identifier. * Defines the license identifier.
* *
* @param licenseKey The license identifier. * @param licenseKey The license identifier.
* @see addLicenseText, setLicenseText, setLicenseTextFile * @see addLicense
*/ */
KAboutData &setLicense( LicenseKey licenseKey ); KAboutData &setLicense( LicenseKey licenseKey );
@ -467,7 +382,6 @@ class KDECORE_EXPORT KAboutData
* parameter in the constructor, that one is replaced. * parameter in the constructor, that one is replaced.
* *
* @param licenseKey The license identifier. * @param licenseKey The license identifier.
* @see setLicenseText, addLicenseText, addLicenseTextFile
* @since 4.1 * @since 4.1
*/ */
KAboutData &addLicense( LicenseKey licenseKey ); KAboutData &addLicense( LicenseKey licenseKey );
@ -481,15 +395,6 @@ class KDECORE_EXPORT KAboutData
*/ */
KAboutData &setCopyrightStatement( const KLocalizedString &copyrightStatement ); KAboutData &setCopyrightStatement( const KLocalizedString &copyrightStatement );
/**
* Defines the additional text to show in the about dialog.
*
* @param otherText Some free form text, that can contain any kind of
* information. The text can contain newlines. This string
* should be marked for translation.
*/
KAboutData &setOtherText( const KLocalizedString &otherText );
/** /**
* Defines the program homepage. * Defines the program homepage.
* *
@ -558,17 +463,6 @@ class KDECORE_EXPORT KAboutData
*/ */
QString programIconName() const; QString programIconName() const;
/**
* Returns the program logo image.
*
* Because KAboutData is in kdecore it cannot use QImage directly,
* so this is a QVariant containing a QImage.
*
* @return the program logo data, or a null image if there is
* no custom application logo defined.
*/
QVariant programLogo() const;
/** /**
* Returns the program's version. * Returns the program's version.
* @return the version string. * @return the version string.
@ -625,12 +519,6 @@ class KDECORE_EXPORT KAboutData
*/ */
static QString aboutTranslationTeam(); static QString aboutTranslationTeam();
/**
* Returns a translated, free form text.
* @return the free form text (translated). Can be QString() if not set.
*/
QString otherText() const;
/** /**
* Returns the license. If the licenseType argument of the constructor has been * Returns the license. If the licenseType argument of the constructor has been
* used, any text defined by setLicenseText is ignored, * used, any text defined by setLicenseText is ignored,
@ -665,54 +553,6 @@ class KDECORE_EXPORT KAboutData
*/ */
QString copyrightStatement() const; QString copyrightStatement() const;
/**
* Returns the plain text displayed around the list of authors instead
* of the default message telling users to send bug reports to bugAddress().
*
* @return the plain text displayed around the list of authors instead
* of the default message. Can be QString().
*/
QString customAuthorPlainText() const;
/**
* Returns the rich text displayed around the list of authors instead
* of the default message telling users to send bug reports to bugAddress().
*
* @return the rich text displayed around the list of authors instead
* of the default message. Can be QString().
*/
QString customAuthorRichText() const;
/**
* Returns whether custom text should be displayed around the list of
* authors.
*
* @return whether custom text should be displayed around the list of
* authors.
*/
bool customAuthorTextEnabled() const;
/**
* Sets the custom text displayed around the list of authors instead
* of the default message telling users to send bug reports to bugAddress().
*
* @param plainText The plain text.
* @param richText The rich text.
*
* Setting both to parameters to KLocalizedString() will cause no message to be
* displayed at all. Call unsetCustomAuthorText() to revert to the default
* message.
*/
KAboutData &setCustomAuthorText(const KLocalizedString &plainText,
const KLocalizedString &richText);
/**
* Clears any custom text displayed around the list of authors and falls
* back to the default message telling users to send bug reports to
* bugAddress().
*/
KAboutData &unsetCustomAuthorText();
private: private:
class Private; class Private;
@ -756,8 +596,8 @@ public:
/** /**
* Returns the full license text. If the licenseType argument of the * Returns the full license text. If the licenseType argument of the
* constructor has been used, any text defined by setLicenseText is ignored, * constructor has been used and the standard text for the chosen
* and the standard text for the chosen license will be returned. * license will be returned.
* *
* @return The license text. * @return The license text.
*/ */

View file

@ -870,18 +870,9 @@ KCmdLineArgsStatic::parseAllArgs()
s->printQ( i18n("This application was written by somebody who wants to remain anonymous.") ); s->printQ( i18n("This application was written by somebody who wants to remain anonymous.") );
} }
if (s->about) if (s->about)
{
if (!s->about->customAuthorTextEnabled ())
{ {
if (s->about->bugAddress().isEmpty() || s->about->bugAddress() == QLatin1String(KDE_BUG_REPORT_EMAIL)) if (s->about->bugAddress().isEmpty() || s->about->bugAddress() == QLatin1String(KDE_BUG_REPORT_EMAIL))
s->printQ( i18n( "Please use %1.\n", QLatin1String(KDE_BUG_REPORT_URL) ) ); s->printQ( i18n( "Please use %1.\n", QLatin1String(KDE_BUG_REPORT_URL) ) );
else
s->printQ( i18n( "Please report bugs to %1.\n", s->about->bugAddress()) );
}
else
{
s->printQ(s->about->customAuthorPlainText()+QLatin1Char('\n'));
}
} }
exit(0); exit(0);
} else { } else {

View file

@ -35,9 +35,8 @@ static const char ProgramIconName[] = "program-icon";
static const char Version[] = "Version"; static const char Version[] = "Version";
static const char ShortDescription[] = "ShortDescription"; static const char ShortDescription[] = "ShortDescription";
static const char CopyrightStatement[] = "CopyrightStatement"; static const char CopyrightStatement[] = "CopyrightStatement";
static const char Text[] = "Text";
static const char HomePageAddress[] = "http://test.no.where/"; static const char HomePageAddress[] = "http://test.no.where/";
static const char OrganizationDomain[] = "no.where"; static const char OrganizationDomain[] = "kde.org";
static const char BugsEmailAddress[] = "bugs@no.else"; static const char BugsEmailAddress[] = "bugs@no.else";
static const char LicenseText[] = "free to write, reading forbidden"; static const char LicenseText[] = "free to write, reading forbidden";
static const char LicenseFileName[] = "testlicensefile"; static const char LicenseFileName[] = "testlicensefile";
@ -51,16 +50,14 @@ void KAboutDataTest::testConstructorWithDefaults()
QCOMPARE( aboutData.appName(), QLatin1String(AppName) ); QCOMPARE( aboutData.appName(), QLatin1String(AppName) );
QCOMPARE( aboutData.programName(), ki18n(ProgramName).toString() ); QCOMPARE( aboutData.programName(), ki18n(ProgramName).toString() );
QCOMPARE( aboutData.programIconName(), QLatin1String(AppName) ); QCOMPARE( aboutData.programIconName(), QLatin1String(AppName) );
QCOMPARE( aboutData.programLogo(), QVariant() ); QCOMPARE( aboutData.organizationDomain(), QLatin1String(OrganizationDomain) );
QCOMPARE( aboutData.organizationDomain(), QString("kde.org") );
QCOMPARE( aboutData.version(), QString(Version) ); QCOMPARE( aboutData.version(), QString(Version) );
QCOMPARE( aboutData.catalogName(), QString(CatalogName) ); QCOMPARE( aboutData.catalogName(), QString(CatalogName) );
QCOMPARE( aboutData.homepage(), QString() ); QCOMPARE( aboutData.homepage(), QString(KDE_HOME_URL) );
QCOMPARE( aboutData.bugAddress(), QString(KDE_BUG_REPORT_EMAIL) ); QCOMPARE( aboutData.bugAddress(), QString(KDE_BUG_REPORT_EMAIL) );
QVERIFY( aboutData.authors().isEmpty() ); QVERIFY( aboutData.authors().isEmpty() );
QVERIFY( aboutData.credits().isEmpty() ); QVERIFY( aboutData.credits().isEmpty() );
QVERIFY( aboutData.translators().isEmpty() ); QVERIFY( aboutData.translators().isEmpty() );
QCOMPARE( aboutData.otherText(), QString() );
// We don't know the default text, do we? // We don't know the default text, do we?
// QCOMPARE( aboutData.licenseName(KAboutData::ShortName), QString(WarningText) ); // QCOMPARE( aboutData.licenseName(KAboutData::ShortName), QString(WarningText) );
QVERIFY( !aboutData.licenseName(KAboutData::ShortName).isEmpty() ); QVERIFY( !aboutData.licenseName(KAboutData::ShortName).isEmpty() );
@ -78,22 +75,19 @@ void KAboutDataTest::testConstructorWithDefaults()
QVERIFY( !aboutData.licenses().at(0).text().isEmpty() ); QVERIFY( !aboutData.licenses().at(0).text().isEmpty() );
QCOMPARE( aboutData.copyrightStatement(), QString() ); QCOMPARE( aboutData.copyrightStatement(), QString() );
QCOMPARE( aboutData.shortDescription(), QString() ); QCOMPARE( aboutData.shortDescription(), QString() );
QCOMPARE( aboutData.customAuthorPlainText(), QString() );
QCOMPARE( aboutData.customAuthorRichText(), QString() );
QVERIFY( !aboutData.customAuthorTextEnabled() );
} }
void KAboutDataTest::testConstructor() void KAboutDataTest::testConstructor()
{ {
KAboutData aboutData(AppName, CatalogName, ki18n(ProgramName), Version, KAboutData aboutData(AppName, CatalogName, ki18n(ProgramName), Version,
ki18n(ShortDescription), KAboutData::License_Unknown, ki18n(ShortDescription), KAboutData::License_Unknown,
ki18n(CopyrightStatement), ki18n(Text), ki18n(CopyrightStatement));
HomePageAddress, BugsEmailAddress ); aboutData.setHomepage(HomePageAddress);
aboutData.setBugAddress(BugsEmailAddress);
QCOMPARE( aboutData.appName(), QLatin1String(AppName) ); QCOMPARE( aboutData.appName(), QLatin1String(AppName) );
QCOMPARE( aboutData.programName(), ki18n(ProgramName).toString() ); QCOMPARE( aboutData.programName(), ki18n(ProgramName).toString() );
QCOMPARE( aboutData.programIconName(), QLatin1String(AppName) ); QCOMPARE( aboutData.programIconName(), QLatin1String(AppName) );
QCOMPARE( aboutData.programLogo(), QVariant() );
QCOMPARE( aboutData.organizationDomain(), QString(OrganizationDomain) ); QCOMPARE( aboutData.organizationDomain(), QString(OrganizationDomain) );
QCOMPARE( aboutData.version(), QString(Version) ); QCOMPARE( aboutData.version(), QString(Version) );
QCOMPARE( aboutData.catalogName(), QString(CatalogName) ); QCOMPARE( aboutData.catalogName(), QString(CatalogName) );
@ -102,7 +96,6 @@ void KAboutDataTest::testConstructor()
QVERIFY( aboutData.authors().isEmpty() ); QVERIFY( aboutData.authors().isEmpty() );
QVERIFY( aboutData.credits().isEmpty() ); QVERIFY( aboutData.credits().isEmpty() );
QVERIFY( aboutData.translators().isEmpty() ); QVERIFY( aboutData.translators().isEmpty() );
QCOMPARE( aboutData.otherText(), QString(Text) );
// QCOMPARE( aboutData.licenseName(KAboutData::ShortName), QString(WarningText) ); // QCOMPARE( aboutData.licenseName(KAboutData::ShortName), QString(WarningText) );
QVERIFY( !aboutData.licenseName(KAboutData::ShortName).isEmpty() ); QVERIFY( !aboutData.licenseName(KAboutData::ShortName).isEmpty() );
// QCOMPARE( aboutData.licenseName(KAboutData::FullName), QString(WarningText) ); // QCOMPARE( aboutData.licenseName(KAboutData::FullName), QString(WarningText) );
@ -119,9 +112,6 @@ void KAboutDataTest::testConstructor()
QVERIFY( !aboutData.licenses().at(0).text().isEmpty() ); QVERIFY( !aboutData.licenses().at(0).text().isEmpty() );
QCOMPARE( aboutData.copyrightStatement(), ki18n(CopyrightStatement).toString() ); QCOMPARE( aboutData.copyrightStatement(), ki18n(CopyrightStatement).toString() );
QCOMPARE( aboutData.shortDescription(), ki18n(ShortDescription).toString() ); QCOMPARE( aboutData.shortDescription(), ki18n(ShortDescription).toString() );
QCOMPARE( aboutData.customAuthorPlainText(), QString() );
QCOMPARE( aboutData.customAuthorRichText(), QString() );
QVERIFY( !aboutData.customAuthorTextEnabled() );
} }
void KAboutDataTest::testSetAddLicense() void KAboutDataTest::testSetAddLicense()
@ -138,8 +128,9 @@ void KAboutDataTest::testSetAddLicense()
KAboutData aboutData(AppName, CatalogName, ki18n(ProgramName), Version, KAboutData aboutData(AppName, CatalogName, ki18n(ProgramName), Version,
ki18n(ShortDescription), KAboutData::License_Unknown, ki18n(ShortDescription), KAboutData::License_Unknown,
ki18n(CopyrightStatement), ki18n(Text), ki18n(CopyrightStatement));
HomePageAddress, BugsEmailAddress ); aboutData.setHomepage(HomePageAddress);
aboutData.setBugAddress(BugsEmailAddress);
// set to GPL2 // set to GPL2
aboutData.setLicense( KAboutData::License_GPL_V2 ); aboutData.setLicense( KAboutData::License_GPL_V2 );
@ -185,16 +176,14 @@ void KAboutDataTest::testSetAddLicense()
// QCOMPARE( aboutData.licenses().at(0).text(), QString(GPL3Text) ); // QCOMPARE( aboutData.licenses().at(0).text(), QString(GPL3Text) );
QVERIFY( !aboutData.licenses().at(0).text().isEmpty() ); QVERIFY( !aboutData.licenses().at(0).text().isEmpty() );
// add GPL2, Custom and File // add GPL2
aboutData.addLicense( KAboutData::License_GPL_V2 ); aboutData.addLicense( KAboutData::License_GPL_V2 );
aboutData.addLicenseText( ki18n(LicenseText) );
aboutData.addLicenseTextFile( LicenseFileName );
QCOMPARE( aboutData.licenseName(KAboutData::ShortName), QString("GPL v3") ); QCOMPARE( aboutData.licenseName(KAboutData::ShortName), QString("GPL v3") );
QCOMPARE( aboutData.licenseName(KAboutData::FullName), QString("GNU General Public License Version 3") ); QCOMPARE( aboutData.licenseName(KAboutData::FullName), QString("GNU General Public License Version 3") );
// QCOMPARE( aboutData.license(), QString(GPL3Text) ); // QCOMPARE( aboutData.license(), QString(GPL3Text) );
QVERIFY( !aboutData.license().isEmpty() ); QVERIFY( !aboutData.license().isEmpty() );
QCOMPARE( aboutData.licenses().count(), 4 ); QCOMPARE( aboutData.licenses().count(), 2 );
QCOMPARE( aboutData.licenses().at(0).name(KAboutData::ShortName), QString("GPL v3") ); QCOMPARE( aboutData.licenses().at(0).name(KAboutData::ShortName), QString("GPL v3") );
QCOMPARE( aboutData.licenses().at(0).name(KAboutData::FullName), QString("GNU General Public License Version 3") ); QCOMPARE( aboutData.licenses().at(0).name(KAboutData::FullName), QString("GNU General Public License Version 3") );
// QCOMPARE( aboutData.licenses().at(0).text(), QString(GPL3Text) ); // QCOMPARE( aboutData.licenses().at(0).text(), QString(GPL3Text) );
@ -203,12 +192,6 @@ void KAboutDataTest::testSetAddLicense()
QCOMPARE( aboutData.licenses().at(1).name(KAboutData::FullName), QString("GNU General Public License Version 2") ); QCOMPARE( aboutData.licenses().at(1).name(KAboutData::FullName), QString("GNU General Public License Version 2") );
// QCOMPARE( aboutData.licenses().at(1).text(), QString(GPL2Text) ); // QCOMPARE( aboutData.licenses().at(1).text(), QString(GPL2Text) );
QVERIFY( !aboutData.licenses().at(1).text().isEmpty() ); QVERIFY( !aboutData.licenses().at(1).text().isEmpty() );
QCOMPARE( aboutData.licenses().at(2).name(KAboutData::ShortName), QString("Custom") );
QCOMPARE( aboutData.licenses().at(2).name(KAboutData::FullName), QString("Custom") );
QCOMPARE( aboutData.licenses().at(2).text(), ki18n(LicenseText).toString() );
QCOMPARE( aboutData.licenses().at(3).name(KAboutData::ShortName), QString("Custom") );
QCOMPARE( aboutData.licenses().at(3).name(KAboutData::FullName), QString("Custom") );
QCOMPARE( aboutData.licenses().at(3).text(), QString(copyrightStatement.toString()+lineFeed+ki18n(LicenseFileText).toString()) );
} }
void KAboutDataTest::testSetProgramIconName() void KAboutDataTest::testSetProgramIconName()
@ -217,8 +200,7 @@ void KAboutDataTest::testSetProgramIconName()
KAboutData aboutData(AppName, CatalogName, ki18n(ProgramName), Version, KAboutData aboutData(AppName, CatalogName, ki18n(ProgramName), Version,
ki18n(ShortDescription), KAboutData::License_Unknown, ki18n(ShortDescription), KAboutData::License_Unknown,
ki18n(CopyrightStatement), ki18n(Text), ki18n(CopyrightStatement));
HomePageAddress, BugsEmailAddress );
// set different iconname // set different iconname
aboutData.setProgramIconName( programIconName ); aboutData.setProgramIconName( programIconName );

View file

@ -1190,21 +1190,6 @@ void KConfigTest::testReparent()
QCOMPARE(group.entryMap(), originalMap); QCOMPARE(group.entryMap(), originalMap);
} }
void KConfigTest::testKAboutDataOrganizationDomain()
{
KAboutData data( "app", 0, ki18n("program"), "version",
ki18n("description"), KAboutData::License_LGPL,
ki18n("copyright"), ki18n("hello world"),
"http://www.koffice.org" );
QCOMPARE( data.organizationDomain(), QString::fromLatin1( "koffice.org" ) );
KAboutData data2( "app", 0, ki18n("program"), "version",
ki18n("description"), KAboutData::License_LGPL,
ki18n("copyright"), ki18n("hello world"),
"http://edu.kde.org/kig" );
QCOMPARE( data2.organizationDomain(), QString::fromLatin1( "kde.org" ) );
}
static void ageTimeStamp(const QString& path, int nsec) static void ageTimeStamp(const QString& path, int nsec)
{ {
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX

View file

@ -78,9 +78,6 @@ private Q_SLOTS:
void testThreads(); void testThreads();
// unrelated
void testKAboutDataOrganizationDomain();
// should be last // should be last
void testSyncOnExit(); void testSyncOnExit();
private: private:

View file

@ -107,10 +107,6 @@ void KAboutApplicationDialog::Private::init( const KAboutData *ad, Options opt )
windowIcon = qApp->windowIcon(); windowIcon = qApp->windowIcon();
} }
titleWidget->setPixmap(windowIcon.pixmap(64, 64), KTitleWidget::ImageLeft); titleWidget->setPixmap(windowIcon.pixmap(64, 64), KTitleWidget::ImageLeft);
if (aboutData->programLogo().canConvert<QPixmap>())
titleWidget->setPixmap(aboutData->programLogo().value<QPixmap>(), KTitleWidget::ImageLeft);
else if (aboutData->programLogo().canConvert<QImage>())
titleWidget->setPixmap(QPixmap::fromImage(aboutData->programLogo().value<QImage>()), KTitleWidget::ImageLeft);
if ( opt & HideKdeVersion ) if ( opt & HideKdeVersion )
titleWidget->setText(i18n("<html><font size=\"5\">%1</font><br /><b>Version %2</b><br />&nbsp;</html>", titleWidget->setText(i18n("<html><font size=\"5\">%1</font><br /><b>Version %2</b><br />&nbsp;</html>",
@ -127,9 +123,6 @@ void KAboutApplicationDialog::Private::init( const KAboutData *ad, Options opt )
//Set up the first page... //Set up the first page...
QString aboutPageText = aboutData->shortDescription() + '\n'; QString aboutPageText = aboutData->shortDescription() + '\n';
if (!aboutData->otherText().isEmpty())
aboutPageText += '\n' + aboutData->otherText() + '\n';
if (!aboutData->copyrightStatement().isEmpty()) if (!aboutData->copyrightStatement().isEmpty())
aboutPageText += '\n' + aboutData->copyrightStatement() + '\n'; aboutPageText += '\n' + aboutData->copyrightStatement() + '\n';
@ -180,15 +173,13 @@ void KAboutApplicationDialog::Private::init( const KAboutData *ad, Options opt )
QVBoxLayout *authorLayout = new QVBoxLayout( authorWidget ); QVBoxLayout *authorLayout = new QVBoxLayout( authorWidget );
authorLayout->setMargin( 0 ); authorLayout->setMargin( 0 );
if (!aboutData->customAuthorTextEnabled() || !aboutData->customAuthorRichText().isEmpty()) {
QLabel *bugsLabel = new QLabel( authorWidget ); QLabel *bugsLabel = new QLabel( authorWidget );
bugsLabel->setContentsMargins( 4, 2, 0, 4 ); bugsLabel->setContentsMargins( 4, 2, 0, 4 );
bugsLabel->setOpenExternalLinks( true ); bugsLabel->setOpenExternalLinks( true );
if (!aboutData->customAuthorTextEnabled()) { if (aboutData->bugAddress().isEmpty() || aboutData->bugAddress() == QLatin1String(KDE_BUG_REPORT_EMAIL)) {
if (aboutData->bugAddress().isEmpty() || aboutData->bugAddress() == QLatin1String(KDE_BUG_REPORT_EMAIL))
bugsLabel->setText( i18n("Please use <a href=\"%1\">%2</a> to report bugs.\n", bugsLabel->setText( i18n("Please use <a href=\"%1\">%2</a> to report bugs.\n",
QString::fromLatin1(KDE_BUG_REPORT_URL), QString::fromLatin1(KDE_BUG_REPORT_URL)) ); QString::fromLatin1(KDE_BUG_REPORT_URL), QString::fromLatin1(KDE_BUG_REPORT_URL)) );
else { } else {
if( ( aboutData->authors().count() == 1 ) && if( ( aboutData->authors().count() == 1 ) &&
( aboutData->authors().first().emailAddress() == aboutData->bugAddress() ) ) { ( aboutData->authors().first().emailAddress() == aboutData->bugAddress() ) ) {
bugsLabel->setText( i18n("Please report bugs to <a href=\"mailto:%1\">%2</a>.\n", bugsLabel->setText( i18n("Please report bugs to <a href=\"mailto:%1\">%2</a>.\n",
@ -200,12 +191,8 @@ void KAboutApplicationDialog::Private::init( const KAboutData *ad, Options opt )
aboutData->bugAddress(), aboutData->bugAddress())); aboutData->bugAddress(), aboutData->bugAddress()));
} }
} }
}
else
bugsLabel->setText( aboutData->customAuthorRichText() );
bugsLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ); bugsLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum );
authorLayout->addWidget( bugsLabel ); authorLayout->addWidget( bugsLabel );
}
KDEPrivate::KAboutApplicationPersonModel *authorModel = KDEPrivate::KAboutApplicationPersonModel *authorModel =
new KDEPrivate::KAboutApplicationPersonModel( aboutData->authors(), new KDEPrivate::KAboutApplicationPersonModel( aboutData->authors(),

View file

@ -97,7 +97,7 @@ int main( int argc, char **argv ) {
options.add("g <group>", ki18n( "Default widget group name to display in designer" ), "Custom" ); options.add("g <group>", ki18n( "Default widget group name to display in designer" ), "Custom" );
KAboutData about( "makekdewidgets", 0, ki18n( "makekdewidgets" ), version, description, KAboutData::License_GPL, ki18n("(C) 2004-2005 Ian Reinhart Geiser"), KLocalizedString(), 0, "geiseri@kde.org" ); KAboutData about( "makekdewidgets", 0, ki18n( "makekdewidgets" ), version, description, KAboutData::License_GPL, ki18n("(C) 2004-2005 Ian Reinhart Geiser"));
about.addAuthor( ki18n("Ian Reinhart Geiser"), KLocalizedString(), "geiseri@kde.org" ); about.addAuthor( ki18n("Ian Reinhart Geiser"), KLocalizedString(), "geiseri@kde.org" );
about.addAuthor( ki18n("Daniel Molkentin"), KLocalizedString(), "molkentin@kde.org" ); about.addAuthor( ki18n("Daniel Molkentin"), KLocalizedString(), "molkentin@kde.org" );
about.addAuthor( ki18n("Ivalo Monev"), KLocalizedString(), "xakepa10@gmail.com" ); about.addAuthor( ki18n("Ivalo Monev"), KLocalizedString(), "xakepa10@gmail.com" );

View file

@ -747,7 +747,8 @@ void KPluginSelector::Private::PluginDelegate::slotAboutClicked()
const QString version = model->data(index, VersionRole).toString(); const QString version = model->data(index, VersionRole).toString();
const QString license = model->data(index, LicenseRole).toString(); const QString license = model->data(index, LicenseRole).toString();
KAboutData aboutData(name.toUtf8(), name.toUtf8(), ki18n(name.toUtf8()), version.toUtf8(), ki18n(comment.toUtf8()), KAboutLicense::byKeyword(license).key(), ki18n(QByteArray()), ki18n(QByteArray()), website.toLatin1()); KAboutData aboutData(name.toUtf8(), name.toUtf8(), ki18n(name.toUtf8()), version.toUtf8(), ki18n(comment.toUtf8()), KAboutLicense::byKeyword(license).key());
aboutData.setHomepage(website.toLatin1());
aboutData.setProgramIconName(index.model()->data(index, Qt::DecorationRole).toString()); aboutData.setProgramIconName(index.model()->data(index, Qt::DecorationRole).toString());
const QStringList authors = author.split(','); const QStringList authors = author.split(',');
const QStringList emails = email.split(','); const QStringList emails = email.split(',');