23 #include <kaboutdata.h> 24 #include <kstandarddirs.h> 26 #include <tqtextstream.h> 31 return TQString::fromUtf8(mName);
40 return TQString::null;
46 return TQString::fromUtf8(mEmailAddress);
53 return TQString::fromUtf8(mWebAddress);
74 class KAboutDataPrivate
78 : translatorName(
"_: NAME OF TRANSLATORS\nYour names")
79 , translatorEmail(
"_: EMAIL OF TRANSLATORS\nYour emails")
82 , customAuthorTextEnabled(
false)
83 , mTranslatedProgramName( 0 )
88 delete[] mTranslatedProgramName;
90 const char *translatorName;
91 const char *translatorEmail;
92 const char *productName;
94 TQString customAuthorPlainText, customAuthorRichText;
95 bool customAuthorTextEnabled;
96 const char *mTranslatedProgramName;
99 const char *KAboutData::defaultBugTracker =
"http://bugs.trinitydesktop.org";
102 const char *programName,
104 const char *shortDescription,
106 const char *copyrightStatement,
108 const char *homePageAddress,
109 const char *bugsEmailAddress
111 mProgramName( programName ),
113 mShortDescription( shortDescription ),
114 mLicenseKey( licenseType ),
115 mCopyrightStatement( copyrightStatement ),
117 mHomepageAddress( homePageAddress ),
118 mBugEmailAddress( (bugsEmailAddress!=0)?bugsEmailAddress:defaultBugTracker ),
121 d =
new KAboutDataPrivate;
124 const char *p = strrchr(appName,
'/');
133 KAboutData::~KAboutData()
135 if (mLicenseKey == License_File)
136 delete [] mLicenseText;
142 const char *emailAddress,
const char *webAddress )
144 mAuthorList.append(
KAboutPerson(name,task,emailAddress,webAddress));
149 const char *emailAddress,
const char *webAddress )
151 mCreditList.append(
KAboutPerson(name,task,emailAddress,webAddress));
157 d->translatorName=name;
158 d->translatorEmail=emailAddress;
164 mLicenseText = licenseText;
165 mLicenseKey = License_Custom;
171 mLicenseText = qstrdup(TQFile::encodeName(file));
172 mLicenseKey = License_File;
185 translateInternalProgramName();
203 mLicenseKey = licenseKey;
246 return d->productName;
254 if (mProgramName && *mProgramName)
255 return i18n(mProgramName);
257 return TQString::null;
261 KAboutData::internalProgramName()
const 263 if (d->mTranslatedProgramName)
264 return d->mTranslatedProgramName;
273 KAboutData::translateInternalProgramName()
const 275 delete[] d->mTranslatedProgramName;
276 d->mTranslatedProgramName = 0;
278 d->mTranslatedProgramName = qstrdup(
programName().utf8());
284 return d->programLogo ? (*d->programLogo) : TQImage();
291 d->programLogo =
new TQImage( image );
293 *d->programLogo = image;
299 return TQString::fromLatin1(mVersion);
305 if (mShortDescription && *mShortDescription)
306 return i18n(mShortDescription);
308 return TQString::null;
314 return TQString::fromLatin1(mHomepageAddress);
320 return TQString::fromLatin1(mBugEmailAddress);
323 const TQValueList<KAboutPerson>
329 const TQValueList<KAboutPerson>
335 const TQValueList<KAboutTranslator>
338 TQValueList<KAboutTranslator> personList;
340 if(d->translatorName == 0)
343 TQStringList nameList;
344 TQStringList emailList;
346 TQString names = i18n(d->translatorName);
347 if(names != TQString::fromUtf8(d->translatorName))
349 nameList = TQStringList::split(
',',names);
353 if(d->translatorEmail)
355 TQString emails = i18n(d->translatorEmail);
357 if(emails != TQString::fromUtf8(d->translatorEmail))
359 emailList = TQStringList::split(
',',emails,
true);
364 TQStringList::Iterator nit;
365 TQStringList::Iterator eit=emailList.begin();
367 for(nit = nameList.begin(); nit != nameList.end(); ++nit)
370 if(eit != emailList.end())
378 personList.append(
KAboutTranslator(name.stripWhiteSpace(), email.stripWhiteSpace()));
387 return i18n(
"replace this with information about your translation team",
388 "<p>KDE is translated into many languages thanks to the work " 389 "of the translation teams all over the world.</p>" 390 "<p>For more information on KDE internationalization " 391 "visit <a href=\"http://l10n.kde.org\">http://l10n.kde.org</a></p>" 398 if (mOtherText && *mOtherText)
399 return i18n(mOtherText);
401 return TQString::null;
414 switch ( mLicenseKey )
417 f = TQFile::decodeName(mLicenseText);
421 f = locate(
"data",
"LICENSES/GPL_V2");
423 case License_LGPL_V2:
425 f = locate(
"data",
"LICENSES/LGPL_V2");
429 f = locate(
"data",
"LICENSES/GPL_V3");
431 case License_LGPL_V3:
433 f = locate(
"data",
"LICENSES/LGPL_V3");
437 f = locate(
"data",
"LICENSES/BSD");
439 case License_Artistic:
440 l =
"Artistic License";
441 f = locate(
"data",
"LICENSES/ARTISTIC");
443 case License_QPL_V1_0:
445 f = locate(
"data",
"LICENSES/QPL_V1.0");
448 if (mLicenseText && *mLicenseText)
449 return( i18n(mLicenseText) );
452 result += i18n(
"No licensing terms for this program have been specified.\n" 453 "Please check the documentation or the source for any\n" 454 "licensing terms.\n");
459 result += i18n(
"This program is distributed under the terms of the %1.").arg( l );
464 if (file.open(IO_ReadOnly))
468 TQTextStream str(&file);
469 result += str.read();
479 if (mCopyrightStatement && *mCopyrightStatement)
480 return i18n(mCopyrightStatement);
482 return TQString::null;
488 return d->customAuthorPlainText;
494 return d->customAuthorRichText;
500 return d->customAuthorTextEnabled;
506 d->customAuthorPlainText = plainText;
507 d->customAuthorRichText = richText;
509 d->customAuthorTextEnabled =
true;
515 d->customAuthorPlainText = TQString::null;
516 d->customAuthorRichText = TQString::null;
518 d->customAuthorTextEnabled =
false;
void setProgramLogo(const TQImage &image)
Defines the program logo.
static KLocale * locale()
Returns the global locale object.
TQString otherText() const
Returns a translated, free form text.
TQString homepage() const
Returns the application homepage.
void addCredit(const char *name, const char *task=0, const char *emailAddress=0, const char *webAddress=0)
Defines a person that deserves credit.
const TQValueList< KAboutPerson > authors() const
Returns a list of authors.
void setLicenseText(const char *license)
Defines a license text.
void setLicenseTextFile(const TQString &file)
Defines a license text.
const TQValueList< KAboutTranslator > translators() const
Returns a list of translators.
void setAppName(const char *appName)
Defines the program name used internally.
void setCopyrightStatement(const char *copyrightStatement)
Defines the copyright statement to show when displaying the license.
void unsetCustomAuthorText()
Clears any custom text displayed around the list of authors and falls back to the default message tel...
void setOtherText(const char *otherText)
Defines the additional text to show in the about dialog.
TQString name() const
The translator's name.
bool customAuthorTextEnabled() const
Returns whether custom text should be displayed around the list of authors.
TQString emailAddress() const
The person's email address.
TQString webAddress() const
The home page or a relevant link.
const TQValueList< KAboutPerson > credits() const
Returns a list of persons who contributed.
This structure is used to store information about a translator.
void setCustomAuthorText(const TQString &plainText, const TQString &richText)
Sets the custom text displayed around the list of authors instead of the default message telling user...
TQString name() const
The person's name.
void setTranslator(const char *name, const char *emailAddress)
Sets the name of the translator of the gui.
KAboutData(const char *appName, const char *programName, const char *version, const char *shortDescription=0, int licenseType=License_Unknown, const char *copyrightStatement=0, const char *text=0, const char *homePageAddress=0, const char *bugsEmailAddress=0)
Constructor.
TQImage programLogo() const
Returns the program logo image.
void setVersion(const char *version)
Defines the program version string.
void addAuthor(const char *name, const char *task=0, const char *emailAddress=0, const char *webAddress=0)
Defines an author.
This structure is used to store information about a person or developer.
const char * productName() const
Returns the application's product name, which will be used in KBugReport dialog.
TQString bugAddress() const
Returns the email address for bugs.
TQString programName() const
Returns the translated program name.
TQString emailAddress() const
The translator's email.
KAboutTranslator(const TQString &name=TQString::null, const TQString &emailAddress=TQString::null)
Convenience constructor.
TQString shortDescription() const
Returns a short, translated description.
void setProductName(const char *name)
Defines the product name wich will be used in the KBugReport dialog.
void setShortDescription(const char *shortDescription)
Defines a short description of what the program does.
void setProgramName(const char *programName)
Defines the displayable program name string.
void setBugAddress(const char *bugAddress)
Defines the address where bug reports should be sent.
TQString version() const
Returns the program's version.
TQString task() const
The person's task.
TQString license() const
Returns the license.
TQString customAuthorPlainText() const
Returns the plain text displayed around the list of authors instead of the default message telling us...
LicenseKey
Descibes the license of the software.
static TQString aboutTranslationTeam()
Returns a message about the translation team.
TQString copyrightStatement() const
Returns the copyright statement.
void setLicense(LicenseKey licenseKey)
Defines the license identifier.
const char * appName() const
Returns the application's internal name.
void setHomepage(const char *homepage)
Defines the program homepage.
TQString customAuthorRichText() const
Returns the rich text displayed around the list of authors instead of the default message telling use...