summaryrefslogtreecommitdiffstats
path: root/kbarcode/encodingcombo.cpp
blob: 3dd8e08328916b0a845cfcec30672ab30176ef4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/***************************************************************************
                          encodingcombo.h  -  description
                             -------------------
    begin                : Fri Dec 23 2005
    copyright            : (C) 2005 by Dominik Seichter
    email                : domseichter@web.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include "encodingcombo.h"

#include <kcharsets.h>
#include <tdeglobal.h>
#include <tdelocale.h>
#include <tqtextcodec.h>

EncodingCombo::EncodingCombo( TQWidget* parent )
    : KComboBox( parent )
{
    TQString sEncoding = TQString( TDEGlobal::locale()->encoding() );
    TQStringList encodings (TDEGlobal::charsets()->availableEncodingNames());

    this->insertStringList( encodings );

    for (int i=0; i < encodings.count(); i++)
    {
        bool found = false;
        TQTextCodec *codecForEnc = TDEGlobal::charsets()->codecForName(encodings[i], found);
        if (found && ( (codecForEnc->name() == sEncoding) || (encodings[i] == sEncoding) ) )
        {
            this->setCurrentItem(i);
            break;
        }
    }
}

EncodingCombo::~EncodingCombo()
{
}

#include "encodingcombo.moc"