diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2019-06-13 11:26:25 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2019-06-13 11:26:25 +0900 |
commit | 7fcf24fa4e39937864ac36683a0bffeaa05c9628 (patch) | |
tree | b72c063ba3a6507c1a1a2c48de6a2ba42175d763 /tdecore/kcharsets.cpp | |
parent | eb7df4e162398f9996079d7f8f22f9ef40062a43 (diff) | |
download | tdelibs-7fcf24fa4e39937864ac36683a0bffeaa05c9628.tar.gz tdelibs-7fcf24fa4e39937864ac36683a0bffeaa05c9628.zip |
Extended kcharset API with new utility function.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'tdecore/kcharsets.cpp')
-rw-r--r-- | tdecore/kcharsets.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tdecore/kcharsets.cpp b/tdecore/kcharsets.cpp index 23786c53e..3483039a7 100644 --- a/tdecore/kcharsets.cpp +++ b/tdecore/kcharsets.cpp @@ -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 |