[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: [PATCH] Add select encoding in Control Center (for CVS HEAD)
From:       Toshitaka Fujioka <toshitaka () kde ! gr ! jp>
Date:       2001-09-30 11:47:50
[Download RAW message or body]

On Saturday 29 September 2001 02:06, Ilya Konstantinov wrote:
> On Sat, Sep 29, 2001 at 01:22:28AM +0900, Toshitaka Fujioka wrote:
> > I remade a patch. Please review.
>
> You still compare the encoding names in loadCurrentEncoding() with
> contains(). How about the way I proposed in my previous message?
>
> I meant something like:
>
> QTextCodec *currentCodec = QTextCodec::codecForName(encoding);
> int count = 0;
> QStringList encodings = KGlobal::charsets()->availableEncodingNames();
> QStringList::Iterator it;
> for( it = encodings.begin(); it != encodings.end(); ++it ) {
>    QTextCodec *codec = KGlobal::charsets()->codecForName(*it);
>    if (qstrcmp(codec->name(), currentCodec->name()) == 0)
>      return count;
>    count++;
> }

Hmm... Sorry. This does not work correctly.
I tried this:
 QTextCodec *currentCodec = QTextCodec::codecForName(encoding.latin1());
 int count = 0;
 QStringList encodings = KGlobal::charsets()->descriptiveEncodingNames();
 QStringList::Iterator it;
 for( it = encodings.begin(); it != encodings.end(); ++it ) {
    QTextCodec *codec = KGlobal::charsets()->codecForName(KGlobal::charsets()->encodingForName(*it));
    if (qstrcmp(codec->name(), currentCodec->name()) == 0)
      return count;
    count++;
 }

But, this does not work correctly, too.
Because, when iso 8859-6, ibm852, pt 154 and utf16,  iso 8859-1 returned.

Thank you.
-- 
Toshitaka Fujioka
http://www.kde.org                The K Desktop Environment Project
                                                    fujioka@kde.org
http://www.kde.gr.jp               Japan KDE User's Group
                                                    toshitaka@kde.gr.jp

-- We offer the best Desktop Environment to you.  (This is my goal. ;-)) --     

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic