[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:25 UTC 2016


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

The following commit has been merged in the master branch:
commit d3cfb02c93743d5a941e2f2e3c901ac3e70db281
Author: George Goldberg <grundleborg at googlemail.com>
Date:   Thu Jul 23 12:34:27 2009 +0000

    Populate the EditParameterModel with the parameters.
    
    svn path=/trunk/playground/network/telepathy-accounts-kcm/; revision=1001488
---
 src/parameter-edit-model.cpp  | 19 +++++++++++++++++--
 src/parameter-edit-model.h    | 11 +++++++++++
 src/parameter-edit-widget.cpp |  7 +++++--
 src/parameter-item.cpp        |  5 +++++
 src/parameter-item.h          |  2 ++
 5 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/src/parameter-edit-model.cpp b/src/parameter-edit-model.cpp
index 95cad8e..076b5f0 100644
--- a/src/parameter-edit-model.cpp
+++ b/src/parameter-edit-model.cpp
@@ -20,8 +20,12 @@
 
 #include "parameter-edit-model.h"
 
+#include "parameter-item.h"
+
 #include <KDebug>
 
+#include <TelepathyQt4/ConnectionManager>
+
 ParameterEditModel::ParameterEditModel(QObject *parent)
  : QAbstractListModel(parent)
 {
@@ -41,7 +45,7 @@ int ParameterEditModel::rowCount(const QModelIndex &index) const
 {
     // If the index is the root item, then return the row count.
     if (index == QModelIndex()) {
-  //     return m_protocolItems.size();
+       return m_items.size();
     }
 
     // Otherwise, return 0 (as this is a list model, so all items
@@ -58,7 +62,7 @@ QVariant ParameterEditModel::data(const QModelIndex &index, int role) const
     switch(role)
     {
     case Qt::DisplayRole:
-//        data = QVariant(m_protocolItems.at(index.row())->protocol());
+        data = QVariant(m_items.at(index.row())->name());
         break;
     default:
         break;
@@ -67,6 +71,17 @@ QVariant ParameterEditModel::data(const QModelIndex &index, int role) const
     return data;
 }
 
+void ParameterEditModel::addItem(Tp::ProtocolParameter *parameter, const QVariant &originalValue)
+{
+    kDebug();
+    // FIXME: Check we are not creating duplicate items.
+
+    // Create a new ParameterItem and add it to the list.
+    beginInsertRows(QModelIndex(), m_items.size(), m_items.size());
+    m_items.append(new ParameterItem(parameter, originalValue, this));
+    endInsertRows();
+}
+
 
 #include "parameter-edit-model.moc"
 
diff --git a/src/parameter-edit-model.h b/src/parameter-edit-model.h
index 010a0af..ca3c2b7 100644
--- a/src/parameter-edit-model.h
+++ b/src/parameter-edit-model.h
@@ -23,6 +23,12 @@
 
 #include <QtCore/QAbstractListModel>
 
+class ParameterItem;
+
+namespace Tp {
+    class ProtocolParameter;
+}
+
 class ParameterEditModel : public QAbstractListModel
 {
     Q_OBJECT
@@ -34,6 +40,11 @@ public:
 
     virtual int rowCount(const QModelIndex &index) const;
     virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+
+    void addItem(Tp::ProtocolParameter *parameter, const QVariant &originalValue);
+
+private:
+    QList<ParameterItem*> m_items;
 };
 
 
diff --git a/src/parameter-edit-widget.cpp b/src/parameter-edit-widget.cpp
index d5130a9..ce2e9e1 100644
--- a/src/parameter-edit-widget.cpp
+++ b/src/parameter-edit-widget.cpp
@@ -67,8 +67,11 @@ ParameterEditWidget::~ParameterEditWidget()
 
 void ParameterEditWidget::setParameters(const Tp::ProtocolParameterList &parameters)
 {
-    d->parameters = parameters;
+    kDebug();
 
-    // TODO: Generate the UI
+    // Add the parameters to the model.
+    foreach (Tp::ProtocolParameter *parameter, parameters) {
+        d->model->addItem(parameter, parameter->defaultValue());
+    }
 }
 
diff --git a/src/parameter-item.cpp b/src/parameter-item.cpp
index 29645bb..3d0cdbb 100644
--- a/src/parameter-item.cpp
+++ b/src/parameter-item.cpp
@@ -40,3 +40,8 @@ ParameterItem::~ParameterItem()
     kDebug();
 }
 
+QString ParameterItem::name() const
+{
+    return m_parameter->name();
+}
+
diff --git a/src/parameter-item.h b/src/parameter-item.h
index 253a2a8..efa2118 100644
--- a/src/parameter-item.h
+++ b/src/parameter-item.h
@@ -37,6 +37,8 @@ public:
                   QObject *parent = 0);
     virtual ~ParameterItem();
 
+    QString name() const;
+
 private:
     Tp::ProtocolParameter const *m_parameter;
     const QVariant m_originalValue;

-- 
ktp-accounts-kcm packaging



More information about the pkg-kde-commits mailing list