[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/network/telepathy-accounts-kcm/src
From:       George Goldberg <grundleborg () googlemail ! com>
Date:       2009-08-11 12:28:01
Message-ID: 1249993681.038954.4253.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1010009 by gberg:

Fix bug where accounts were added with parameters that had not been changed from the default.

 M  +22 -4     add-account-assistant.cpp  


--- trunk/playground/network/telepathy-accounts-kcm/src/add-account-assistant.cpp #1010008:1010009
@@ -286,8 +286,16 @@
     foreach (Tp::ProtocolParameter *pp, mandatoryParameterValues.keys()) {
         QVariant value = mandatoryParameterValues.value(pp);
 
-        // Don't try and add empty parameters.
-        if (!value.isNull()) {
+        // Don't try and add empty parameters or ones where the default value is still set.
+        if ((!value.isNull()) && (value != pp->defaultValue())) {
+
+            // Check for params where they are empty and the default is null.
+            if (pp->type() == QVariant::String) {
+                if ((pp->defaultValue() == QVariant()) && (value.toString().isEmpty())) {
+                    continue;
+                }
+            }
+
             parameters.insert(pp->name(), value);
         }
     }
@@ -295,12 +303,22 @@
     foreach (Tp::ProtocolParameter *pp, optionalParameterValues.keys()) {
         QVariant value = optionalParameterValues.value(pp);
 
-        // Don't try and add empty parameters.
-        if (!value.isNull()) {
+        // Don't try and add empty parameters or ones where the default value is still set.
+        if ((!value.isNull()) && (value != pp->defaultValue())) {
+
+            // Check for params where they are empty and the default is null.
+            if (pp->type() == QVariant::String) {
+                if ((pp->defaultValue() == QVariant()) && (value.toString().isEmpty())) {
+                    continue;
+                }
+            }
+
             parameters.insert(pp->name(), value);
         }
     }
 
+    // kDebug() << "Parameters to add with:" << parameters;
+
     // FIXME: Ask the user to submit a Display Name
     Tp::PendingAccount *pa = d->accountManager->createAccount(connectionManagerItem->connectionManager()->name(),
                                                               protocolItem->protocol(),
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic