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

Maximiliano Curia maxy at moszumanska.debian.org
Fri May 27 23:57:33 UTC 2016


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

The following commit has been merged in the master branch:
commit 07afb85c71ad06eb2eec18b31d89f9163e7941a6
Author: George Goldberg <grundleborg at googlemail.com>
Date:   Mon Jul 27 13:43:06 2009 +0000

    Display translated parameter names if possible in the autogenerated Parameter Edit UI.
    
    svn path=/trunk/playground/network/telepathy-accounts-kcm/; revision=1003004
---
 src/parameter-edit-delegate.cpp |  2 +-
 src/parameter-edit-model.cpp    |  3 +++
 src/parameter-edit-model.h      |  1 +
 src/parameter-item.cpp          | 17 ++++++++++++++---
 src/parameter-item.h            |  2 ++
 5 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/parameter-edit-delegate.cpp b/src/parameter-edit-delegate.cpp
index 82b450c..54828fa 100644
--- a/src/parameter-edit-delegate.cpp
+++ b/src/parameter-edit-delegate.cpp
@@ -82,7 +82,7 @@ void ParameterEditDelegate::updateItemWidgets(const QList<QWidget*> widgets,
     // Draw the label showing the name of the parameter
     QLabel *nameLabel = qobject_cast<QLabel*>(widgets.at(0));
 
-    nameLabel->setText(index.model()->data(index, ParameterEditModel::NameRole).toString());
+    nameLabel->setText(index.model()->data(index, ParameterEditModel::LocalizedNameRole).toString());
     nameLabel->move(margin, 0);
     nameLabel->resize(QSize(((right - (4 * margin)) / 2), option.rect.height()));
 
diff --git a/src/parameter-edit-model.cpp b/src/parameter-edit-model.cpp
index 1ba2823..acf9013 100644
--- a/src/parameter-edit-model.cpp
+++ b/src/parameter-edit-model.cpp
@@ -64,6 +64,9 @@ QVariant ParameterEditModel::data(const QModelIndex &index, int role) const
     case ParameterEditModel::NameRole:
         data = QVariant(m_items.at(index.row())->name());
         break;
+    case ParameterEditModel::LocalizedNameRole:
+        data = QVariant(m_items.at(index.row())->localizedName());
+        break;
     case ParameterEditModel::TypeRole:
         data = QVariant(m_items.at(index.row())->type());
         break;
diff --git a/src/parameter-edit-model.h b/src/parameter-edit-model.h
index bfe1e55..870527f 100644
--- a/src/parameter-edit-model.h
+++ b/src/parameter-edit-model.h
@@ -37,6 +37,7 @@ class ParameterEditModel : public QAbstractListModel
 public:
     enum Roles {
         NameRole = Qt::UserRole + 1,
+        LocalizedNameRole,
         TypeRole,
         ValueRole,
         SecretRole,
diff --git a/src/parameter-item.cpp b/src/parameter-item.cpp
index f70b9fc..740973e 100644
--- a/src/parameter-item.cpp
+++ b/src/parameter-item.cpp
@@ -20,6 +20,8 @@
 
 #include "parameter-item.h"
 
+#include "dictionary.h"
+
 #include <KDebug>
 
 ParameterItem::ParameterItem(Tp::ProtocolParameter *parameter,
@@ -33,6 +35,13 @@ ParameterItem::ParameterItem(Tp::ProtocolParameter *parameter,
 
     // To begin with, the current value is the original value.
     m_currentValue = m_originalValue;
+
+    // Set the localized name with the value from the dictionary if possible.
+    m_localizedName = Dictionary::instance()->string(parameter->name());
+
+    if (m_localizedName.isEmpty()) {
+        m_localizedName = parameter->name();
+    }
 }
 
 ParameterItem::~ParameterItem()
@@ -42,12 +51,14 @@ ParameterItem::~ParameterItem()
 
 QString ParameterItem::name() const
 {
-    // TODO: Try and translate common parameter names. Can we have a singleton registry where we can
-    // get the translation of common parameters from (which will allow i18n of that registries
-    // contents?
     return m_parameter->name();
 }
 
+QString ParameterItem::localizedName() const
+{
+    return m_localizedName;
+}
+
 QVariant::Type ParameterItem::type() const
 {
     return m_parameter->type();
diff --git a/src/parameter-item.h b/src/parameter-item.h
index a41b7e6..f47bb6c 100644
--- a/src/parameter-item.h
+++ b/src/parameter-item.h
@@ -38,6 +38,7 @@ public:
     virtual ~ParameterItem();
 
     QString name() const;
+    QString localizedName() const;
     QVariant::Type type() const;
     QVariant value() const;
     bool isSecret() const;
@@ -51,6 +52,7 @@ private:
     Tp::ProtocolParameter *m_parameter;
     const QVariant m_originalValue;
     QVariant m_currentValue;
+    QString m_localizedName;
 };
 
 

-- 
ktp-accounts-kcm packaging



More information about the pkg-kde-commits mailing list