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


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

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

    Make the code in the Add Account Assistant that decides what parameterwidgets to show actually work correctly with plugins.
    
    svn path=/trunk/playground/network/telepathy-accounts-kcm/; revision=1004523
---
 src/add-account-assistant.cpp | 42 +++++++++++++++++++++++++++++++++---------
 1 file changed, 33 insertions(+), 9 deletions(-)

diff --git a/src/add-account-assistant.cpp b/src/add-account-assistant.cpp
index e88e09b..3f0b2d7 100644
--- a/src/add-account-assistant.cpp
+++ b/src/add-account-assistant.cpp
@@ -91,6 +91,9 @@ AddAccountAssistant::~AddAccountAssistant()
     delete d;
 }
 
+// FIXME: This method *works*, but is really not very elegant. I don't want to waste time tidying it
+// up at the moment, but I'm sure it could have a *lot* less code in it if it were tidied up at some
+// point in the future.
 void AddAccountAssistant::next()
 {
     kDebug();
@@ -135,16 +138,27 @@ void AddAccountAssistant::next()
 
             // Set up the Mandatory Parameters page
             Tp::ProtocolParameterList mandatoryParameters = item->mandatoryParameters();
+            Tp::ProtocolParameterList mandatoryParametersLeft = item->mandatoryParameters();
 
             // Create the custom UI or generic UI depending on available parameters.
             if (ui) {
                 // UI does exist, set it up.
                 AbstractAccountParametersWidget *widget = ui->mandatoryParametersWidget(mandatoryParameters);
-                foreach(Tp::ProtocolParameter *parameter, widget->parameters()) {
-                    mandatoryParameters.removeAll(parameter);
+                QMap<QString, QVariant::Type> manParams = ui->supportedMandatoryParameters();
+                QMap<QString, QVariant::Type>::const_iterator manIter = manParams.constBegin();
+                while(manIter != manParams.constEnd()) {
+                    foreach (Tp::ProtocolParameter *parameter, mandatoryParameters) {
+                        // If the parameter is not
+                        if ((parameter->name() == manIter.key()) &&
+                            (parameter->type() == manIter.value())) {
+                            mandatoryParametersLeft.removeAll(parameter);
+                        }
+                    }
+
+                    ++manIter;
                 }
 
-                if (mandatoryParameters.isEmpty()) {
+                if (mandatoryParametersLeft.isEmpty()) {
                     d->mandatoryParametersWidget = widget;
                 } else {
                     widget->deleteLater();
@@ -162,30 +176,40 @@ void AddAccountAssistant::next()
 
             // Get the list of parameters
             Tp::ProtocolParameterList optionalParameters = item->optionalParameters();
+            Tp::ProtocolParameterList optionalParametersLeft = item->optionalParameters();
 
             // Check if the AbstractAccountUi exists. If not then we use the autogenerated UI for
             // everything.
-
             if (ui) {
                 // UI Does exist, set it up.
                 QList<AbstractAccountParametersWidget*> widgets = ui->optionalParametersWidgets(optionalParameters);
 
                 // Remove all handled parameters from the optionalParameters list.
-                foreach (AbstractAccountParametersWidget *widget, widgets) {
-                    foreach (Tp::ProtocolParameter *parameter, widget->parameters()) {
-                        optionalParameters.removeAll(parameter);
+                QMap<QString, QVariant::Type> opParams = ui->supportedOptionalParameters();
+                QMap<QString, QVariant::Type>::const_iterator opIter = opParams.constBegin();
+                while(opIter != opParams.constEnd()) {
+                    foreach (Tp::ProtocolParameter *parameter, optionalParameters) {
+                        // If the parameter is not
+                        if ((parameter->name() == opIter.key()) &&
+                            (parameter->type() == opIter.value())) {
+                            optionalParametersLeft.removeAll(parameter);
+                        }
                     }
 
+                    ++opIter;
+                }
+
+                foreach (AbstractAccountParametersWidget *widget, widgets) {
                     d->optionalParametersWidgets.append(widget);
                     d->tabWidget->addTab(widget, i18n("Optional Parameters"));
                 }
             }
 
             // Show the generic UI if optionalParameters is not empty.
-            if (optionalParameters.size() > 0) {
+            if (optionalParametersLeft.size() > 0) {
                 ParameterEditWidget *pew = new ParameterEditWidget(d->tabWidget);
                 d->optionalParametersWidgets.append(pew);
-                pew->setParameters(optionalParameters);
+                pew->setParameters(optionalParametersLeft);
                 d->tabWidget->addTab(pew, i18n("Optional Parameters"));
             }
 

-- 
ktp-accounts-kcm packaging



More information about the pkg-kde-commits mailing list