Index: kaboutdata.cpp =================================================================== RCS file: /home/kde/kdelibs/kdecore/kaboutdata.cpp,v retrieving revision 1.10 diff -u -r1.10 kaboutdata.cpp --- kaboutdata.cpp 2000/08/05 05:30:16 1.10 +++ kaboutdata.cpp 2000/12/26 14:44:53 @@ -29,7 +29,7 @@ QString KAboutPerson::name() const { - return QString::fromLatin1(mName); + return QString::fromUtf8(mName); } QString @@ -44,16 +44,47 @@ QString KAboutPerson::emailAddress() const { - return QString::fromLatin1(mEmailAddress); + return QString::fromUtf8(mEmailAddress); } QString KAboutPerson::webAddress() const { - return QString::fromLatin1(mWebAddress); + return QString::fromUtf8(mWebAddress); } + +KAboutTranslator::KAboutTranslator(const QString name + , const QString emailAddress) +{ + mName=name; + mEmail=emailAddress; +} + +QString KAboutTranslator::KAboutTranslator::name() const +{ + return mName; +} + +QString KAboutTranslator::KAboutTranslator::emailAddress() const +{ + return mEmail; +} + +class KAboutDataPrivate +{ +public: + KAboutDataPrivate() + : translatorName(0) + , translatorEmail(0) + {}; + const char *translatorName; + const char *translatorEmail; +}; + + + KAboutData::KAboutData( const char *appName, const char *programName, const char *version, @@ -73,6 +104,8 @@ mHomepageAddress( homePageAddress ), mBugEmailAddress( bugsEmailAddress ) { + d = new KAboutDataPrivate; + if( appName ) { const char *p = strrchr(appName, '/'); if( p ) @@ -83,6 +116,11 @@ mAppName = 0; } +KAboutData::~KAboutData() +{ + delete d; +} + void KAboutData::addAuthor( const char *name, const char *task, const char *emailAddress, const char *webAddress ) @@ -97,6 +135,13 @@ mCreditList.append(KAboutPerson(name,task,emailAddress,webAddress)); } +void +KAboutData::setTranslator( const char *name, const char *emailAddress) +{ + d->translatorName=name; + d->translatorEmail=emailAddress; +} + void KAboutData::setLicenseText( const char *licenseText ) { @@ -164,6 +209,65 @@ KAboutData::credits() const { return mCreditList; +} + +const QValueList +KAboutData::translators() const +{ + QValueList personList; + + if(d->translatorName == 0) + return personList; + + QStringList nameList; + QStringList emailList; + + QString names = i18n(d->translatorName); + if(names != QString::fromUtf8(d->translatorName)) + { + nameList = QStringList::split(',',names); + } + + + QString emails; + if(d->translatorEmail) + { + emails = i18n(d->translatorEmail); + + if(emails != QString::fromUtf8(d->translatorEmail)) + { + emailList = QStringList::split(',',emails,true); + } + } + + + QStringList::Iterator nit; + QStringList::Iterator eit=emailList.begin(); + + for(nit = nameList.begin(); nit != nameList.end(); ++nit) + { + QString email; + if(eit != emailList.end()) + { + email=*eit; + ++eit; + } + + QString name=*nit; + + personList.append(KAboutTranslator( name, email)); + } + + return personList; +} + +QString +KAboutData::aboutTranslationTeam() +{ + return i18n("replace this with information about your translation team", + "

KDE is translated in many languages thanks to the work " + "of the translation teams all over the world.

" + "

For more information visit http://i18n.kde.org

"); } QString Index: kaboutdata.h =================================================================== RCS file: /home/kde/kdelibs/kdecore/kaboutdata.h,v retrieving revision 1.14 diff -u -r1.14 kaboutdata.h --- kaboutdata.h 2000/12/01 19:45:56 1.14 +++ kaboutdata.h 2000/12/26 14:44:53 @@ -93,6 +93,22 @@ KAboutPersonPrivate *d; }; + +class KAboutTranslator +{ +public: + KAboutTranslator(QString name=QString::null + , QString emailAddress=QString::null); + + QString name() const; + QString emailAddress() const; + +private: + QString mName; + QString mEmail; +}; + + /** * This class is used to store information about a program. It can store * such values a version number, program name, homepage, email address @@ -171,6 +187,8 @@ const char *bugsEmailAddress = "submit@bugs.kde.org" ); + ~KAboutData(); + /** * Defines an author. You can call this function as many times you * need. Each entry is appended to a list. The person in the first entry @@ -217,6 +235,22 @@ const char *webAddress=0 ); /** + * Sets the name of the translator of the gui. Since this depends + * on the language, just use a dummy text marked for translation. + * For example: + * setTranslator(I18N_NOOP("NAME OF THE TRANSLATORS") + * ,I18N_NOOP("EMAIL OF THE TRANSLATORS")); + * + * 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. + * + * @see KAboutTranslator + */ + void setTranslator(const char* name, const char* emailAddress); + + /** * Defines a licence text. * * @param license The license text in utf8 encoding. @@ -279,6 +313,17 @@ const QValueList credits() const; /** + * @return translators information + */ + const QValueList translators() const; + + /** + * @return a message about the translation team + */ + static QString aboutTranslationTeam(); + + + /** * @return the free form text (translated). */ QString otherText() const; @@ -297,6 +342,7 @@ */ QString copyrightStatement() const { return( QString::fromLatin1(mCopyrightStatement )); } + private: const char *mAppName; const char *mProgramName; @@ -313,7 +359,6 @@ KAboutDataPrivate *d; }; - #endif