[SCM] ktp-accounts-kcm packaging branch, master, updated. debian/15.12.1-1-1157-gc4589c5

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:04:26 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-accounts-kcm.git;a=commitdiff;h=f2625e2

The following commit has been merged in the master branch:
commit f2625e2540e7c7cee2a692078da2e074973d9459
Author: Dan Vrátil <dvratil at redhat.com>
Date:   Mon Jun 10 21:42:07 2013 +0200

    Use KCharsets instead of manually listing all supported encodings
    
    Less translations for the i18n team and less code for us to maintain
    
    Thanks to Pino Toscano for showing KCharsets to me
---
 plugins/haze/icq-server-settings-widget.cpp | 78 ++++-------------------------
 plugins/haze/icq-server-settings-widget.h   |  1 -
 2 files changed, 9 insertions(+), 70 deletions(-)

diff --git a/plugins/haze/icq-server-settings-widget.cpp b/plugins/haze/icq-server-settings-widget.cpp
index bbf6c57..f3b199a 100644
--- a/plugins/haze/icq-server-settings-widget.cpp
+++ b/plugins/haze/icq-server-settings-widget.cpp
@@ -21,6 +21,8 @@
 #include "icq-server-settings-widget.h"
 
 #include <KDE/KLocale>
+#include <KDE/KGlobal>
+#include <KDE/KCharsets>
 
 #include <KCMTelepathyAccounts/ParameterEditModel>
 
@@ -39,19 +41,14 @@ IcqServerSettingsWidget::IcqServerSettingsWidget(ParameterEditModel *model,
     handleParameter(QLatin1String("always-use-rv-proxy"), QVariant::Bool, m_ui->alwaysUseRvProxyCheckBox, 0);
 
     // update combo box for charset parameter
-    initEncodings();
+    Q_FOREACH (const QString &name, KGlobal::charsets()->descriptiveEncodingNames()) {
+        m_ui->charsetComboBox->addItem(name);
+    }
+
     const QString encName = parameterModel()->data(
         parameterModel()->indexForParameter(parameterModel()->parameter(QLatin1String("charset"))),
         ParameterEditModel::ValueRole).toString();
-    QTextCodec *codec = QTextCodec::codecForName(encName.toLatin1());
-    int mib = 106; // UTF-8
-    if (!codec) {
-        codec = KGlobal::locale()->codecForEncoding();
-    }
-    if (codec) {
-        mib = codec->mibEnum();
-    }
-    m_ui->charsetComboBox->setCurrentIndex(m_ui->charsetComboBox->findData(mib));
+    m_ui->charsetComboBox->setCurrentItem(KGlobal::charsets()->descriptionForEncoding(encName));
 }
 
 IcqServerSettingsWidget::~IcqServerSettingsWidget()
@@ -63,67 +60,10 @@ void IcqServerSettingsWidget::submit()
 {
     AbstractAccountParametersWidget::submit();
 
-    QTextCodec *codec = QTextCodec::codecForMib(m_ui->charsetComboBox->itemData(
-        m_ui->charsetComboBox->currentIndex()).toInt());
-    if (!codec) {
-        codec = QTextCodec::codecForMib(106); // UTF-8
-    }
-
+    const QString name = KGlobal::charsets()->encodingForName(m_ui->charsetComboBox->currentText());
     parameterModel()->setData(
         parameterModel()->indexForParameter(parameterModel()->parameter(QLatin1String("charset"))),
-        codec->name(), ParameterEditModel::ValueRole);
-}
-
-
-void IcqServerSettingsWidget::initEncodings()
-{
-    m_ui->charsetComboBox->addItem(i18n("Big5"), 2026);
-    m_ui->charsetComboBox->addItem(i18n("Big5-HKSCS"), 2101);
-    m_ui->charsetComboBox->addItem(i18n("euc-JP Japanese"), 18);
-    m_ui->charsetComboBox->addItem(i18n("euc-KR Korean"), 38);
-    m_ui->charsetComboBox->addItem(i18n("GB-2312 Chinese"), 57);
-    m_ui->charsetComboBox->addItem(i18n("GBK Chinese"), 113);
-    m_ui->charsetComboBox->addItem(i18n("GB18030 Chinese"), 114);
-
-    m_ui->charsetComboBox->addItem(i18n("JIS Japanese"), 16);
-    m_ui->charsetComboBox->addItem(i18n("Shift-JIS Japanese"), 17);
-
-    m_ui->charsetComboBox->addItem(i18n("KOI8-R Russian"), 2084);
-    m_ui->charsetComboBox->addItem(i18n("KOI8-U Ukrainian"), 2088);
-
-    m_ui->charsetComboBox->addItem(i18n("ISO-8859-1 Western"), 4);
-    m_ui->charsetComboBox->addItem(i18n("ISO-8859-2 Central European"), 5);
-    m_ui->charsetComboBox->addItem(i18n("ISO-8859-3 Central European"), 6);
-    m_ui->charsetComboBox->addItem(i18n("ISO-8859-4 Baltic"), 7);
-    m_ui->charsetComboBox->addItem(i18n("ISO-8859-5 Cyrillic"), 8);
-    m_ui->charsetComboBox->addItem(i18n("ISO-8859-6 Arabic"), 9);
-    m_ui->charsetComboBox->addItem(i18n("ISO-8859-7 Greek") ,10);
-    m_ui->charsetComboBox->addItem(i18n("ISO-8859-8 Hebrew, visually ordered"), 11 );
-    m_ui->charsetComboBox->addItem(i18n("ISO-8859-8-I Hebrew, logically ordered"), 85);
-    m_ui->charsetComboBox->addItem(i18n("ISO-8859-9 Turkish"), 12);
-    m_ui->charsetComboBox->addItem(i18n("ISO-8859-10"), 13);
-    m_ui->charsetComboBox->addItem(i18n("ISO-8859-13"), 109);
-    m_ui->charsetComboBox->addItem(i18n("ISO-8859-14"), 110);
-    m_ui->charsetComboBox->addItem(i18n("ISO-8859-15 Western"), 111);
-
-    m_ui->charsetComboBox->addItem(i18n("Windows-1250 Central European"), 2250);
-    m_ui->charsetComboBox->addItem(i18n("Windows-1251 Cyrillic"), 2251);
-    m_ui->charsetComboBox->addItem(i18n("Windows-1252 Western"), 2252);
-    m_ui->charsetComboBox->addItem(i18n("Windows-1253 Greek"), 2253);
-    m_ui->charsetComboBox->addItem(i18n("Windows-1254 Turkish"), 2254);
-    m_ui->charsetComboBox->addItem(i18n("Windows-1255 Hebrew"), 2255);
-    m_ui->charsetComboBox->addItem(i18n("Windows-1256 Arabic"), 2256);
-    m_ui->charsetComboBox->addItem(i18n("Windows-1257 Baltic"), 2257);
-    m_ui->charsetComboBox->addItem(i18n("Windows-1258 Viet Nam"), 2258);
-
-    m_ui->charsetComboBox->addItem(i18n("IBM 850"), 2009);
-    m_ui->charsetComboBox->addItem(i18n("IBM 866"), 2085);
-
-    m_ui->charsetComboBox->addItem(i18n("TIS-620 Thai"), 2259);
-
-    m_ui->charsetComboBox->addItem(i18n("UTF-8 Unicode"), 106);
-    m_ui->charsetComboBox->addItem(i18n("UTF-16 Unicode"), 1015);
+        name, ParameterEditModel::ValueRole);
 }
 
-
 #include "icq-server-settings-widget.moc"
diff --git a/plugins/haze/icq-server-settings-widget.h b/plugins/haze/icq-server-settings-widget.h
index 916c742..70dedc1 100644
--- a/plugins/haze/icq-server-settings-widget.h
+++ b/plugins/haze/icq-server-settings-widget.h
@@ -36,7 +36,6 @@ public:
 
     virtual void submit();
 private:
-    void initEncodings();
 
     Q_DISABLE_COPY(IcqServerSettingsWidget);
     Ui::IcqServerSettingsWidget *m_ui;

-- 
ktp-accounts-kcm packaging



More information about the pkg-kde-commits mailing list