Extended kcharset API with new utility function.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/36/head
Michele Calgaro 6 years ago
parent eb7df4e162
commit 7fcf24fa4e
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -506,6 +506,17 @@ TQString KCharsets::encodingForName( const TQString &descriptiveName )
return name.left(right).stripWhiteSpace();
}
TQString KCharsets::descriptiveNameForEncoding( const TQString &encodingName )
{
for ( const LanguageForEncoding* pos = language_for_encoding; pos->index; ++pos ) {
if ( encodingName == TQString::fromLatin1( pos->index )) {
const TQString description = i18n( language_names[ pos->data ] );
return i18n("Descriptive Encoding Name", "%1 ( %2 )"). arg ( description ). arg( encodingName );
}
}
return TQString::null;
}
TQStringList KCharsets::descriptiveEncodingNames()
{
// As we are sorting, we can directly read the array language_for_encoding

@ -135,6 +135,13 @@ public:
*/
TQString encodingForName( const TQString &descriptiveName );
/**
* Returns the descriptive encoding name for an encoding name.
* @param encodingName the name of the encoding
* @return the descriptive name for the encoding
*/
TQString descriptiveNameForEncoding( const TQString &encodingName );
private:
KCharsetsPrivate *d;
};

Loading…
Cancel
Save