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


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

The following commit has been merged in the master branch:
commit ed8a9809829c480856f006f0052603fdcff724d5
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Sun Jan 2 18:14:14 2011 +0000

    Compile against Telepathy-Qt4 0.5
    Change to returning a QVariantMap of parameters as changed in telepathy-
    
    Don't pass pointers to ProtocolParameter objects as they have a fast
    copy constructor.
---
 butterfly/main-options-widget.cpp  |  60 +++++------
 butterfly/main-options-widget.h    |   2 +-
 gabble/advanced-options-widget.cpp |  15 +--
 gabble/advanced-options-widget.h   |   2 +-
 gabble/main-options-widget.cpp     |  54 ++++------
 gabble/main-options-widget.h       |   2 +-
 gabble/proxy-settings-widget.cpp   | 208 ++++++++++++++++---------------------
 gabble/proxy-settings-widget.h     |   2 +-
 gabble/server-settings-widget.cpp  | 183 ++++++++++++++------------------
 gabble/server-settings-widget.h    |   2 +-
 10 files changed, 224 insertions(+), 306 deletions(-)

diff --git a/butterfly/main-options-widget.cpp b/butterfly/main-options-widget.cpp
index 56813c0..b91075c 100644
--- a/butterfly/main-options-widget.cpp
+++ b/butterfly/main-options-widget.cpp
@@ -29,16 +29,13 @@ class MainOptionsWidget::Private
 {
 public:
     Private()
-            : accountParameter(0),
-              passwordParameter(0),
-              ui(0)
+            : ui(0)
     {
         kDebug();
     }
 
-    Tp::ProtocolParameterList parameters;
-    Tp::ProtocolParameter *accountParameter;
-    Tp::ProtocolParameter *passwordParameter;
+    Tp::ProtocolParameter accountParameter;
+    Tp::ProtocolParameter passwordParameter;
 
     Ui::MainOptionsWidget *ui;
 };
@@ -51,23 +48,16 @@ MainOptionsWidget::MainOptionsWidget(Tp::ProtocolParameterList parameters,
 {
     kDebug();
 
-    // Save the parameters.
-    d->parameters = parameters;
-
     // Store the parameters this widget supports
-    foreach (Tp::ProtocolParameter *parameter, d->parameters) {
+    foreach (Tp::ProtocolParameter parameter, parameters) {
       
-        qDebug() << parameter->name();
+        qDebug() << parameter.name();
       
       
-        if ((parameter->name() == "account") && (parameter->type() == QVariant::String)) {
-            if (!d->accountParameter) {
-                d->accountParameter = parameter;
-            }
-        } else if ((parameter->name() == "password") && (parameter->type() == QVariant::String)) {
-            if (!d->passwordParameter) {
-                d->passwordParameter = parameter;
-            }
+        if ((parameter.name() == "account") && (parameter.type() == QVariant::String)) {
+           d->accountParameter = parameter;
+        } else if ((parameter.name() == "password") && (parameter.type() == QVariant::String)) {
+           d->passwordParameter = parameter;
         }
     }
 
@@ -76,29 +66,29 @@ MainOptionsWidget::MainOptionsWidget(Tp::ProtocolParameterList parameters,
     d->ui->setupUi(this);
 
    // Prefill UI elements if appropriate.
-   if (d->accountParameter) {
-       if (values.contains(d->accountParameter->name())) {
-           d->ui->accountLineEdit->setText(values.value(d->accountParameter->name()).toString());
+   if (d->accountParameter.isValid()) {
+       if (values.contains(d->accountParameter.name())) {
+           d->ui->accountLineEdit->setText(values.value(d->accountParameter.name()).toString());
        } else {
-           d->ui->accountLineEdit->setText(d->accountParameter->defaultValue().toString());
+           d->ui->accountLineEdit->setText(d->accountParameter.defaultValue().toString());
        }
    }
 
-   if (d->passwordParameter) {
-       if (values.contains(d->passwordParameter->name())) {
-           d->ui->passwordLineEdit->setText(values.value(d->passwordParameter->name()).toString());
+   if (d->passwordParameter.isValid()) {
+       if (values.contains(d->passwordParameter.name())) {
+           d->ui->passwordLineEdit->setText(values.value(d->passwordParameter.name()).toString());
        } else {
-           d->ui->passwordLineEdit->setText(d->passwordParameter->defaultValue().toString());
+           d->ui->passwordLineEdit->setText(d->passwordParameter.defaultValue().toString());
        }
    }
 
 //    Hide any elements we don't have the parameters passed to show.
-   if (!d->accountParameter) {
+   if (!d->accountParameter.isValid()) {
        d->ui->accountLabel->hide();
        d->ui->accountLineEdit->hide();
    }
 
-   if (!d->passwordParameter) {
+   if (!d->passwordParameter.isValid()) {
        d->ui->passwordLabel->hide();
        d->ui->passwordLineEdit->hide();
    }
@@ -111,19 +101,19 @@ MainOptionsWidget::~MainOptionsWidget()
     delete d;
 }
 
-QMap<Tp::ProtocolParameter*, QVariant> MainOptionsWidget::parameterValues() const
+QVariantMap MainOptionsWidget::parameterValues() const
 {
     kDebug();
 
-    QMap<Tp::ProtocolParameter*, QVariant> parameters;
+    QVariantMap parameters;
 
    // Populate the map of parameters and their values with all the parameters this widget contains.
-   if (d->accountParameter) {
-       parameters.insert(d->accountParameter, d->ui->accountLineEdit->text());
+   if (d->accountParameter.isValid()) {
+       parameters.insert(d->accountParameter.name(), d->ui->accountLineEdit->text());
    }
 
-   if (d->passwordParameter) {
-       parameters.insert(d->passwordParameter, d->ui->passwordLineEdit->text());
+   if (d->passwordParameter.isValid()) {
+       parameters.insert(d->passwordParameter.name(), d->ui->passwordLineEdit->text());
    }
 
    return parameters;
diff --git a/butterfly/main-options-widget.h b/butterfly/main-options-widget.h
index fb2d2f6..cb5f679 100644
--- a/butterfly/main-options-widget.h
+++ b/butterfly/main-options-widget.h
@@ -33,7 +33,7 @@ public:
                                QWidget *parent = 0);
     virtual ~MainOptionsWidget();
 
-    virtual QMap<Tp::ProtocolParameter*, QVariant> parameterValues() const;
+    virtual QVariantMap parameterValues() const;
     virtual bool validateParameterValues();
 
 private:
diff --git a/gabble/advanced-options-widget.cpp b/gabble/advanced-options-widget.cpp
index fe69fd5..ec164a0 100644
--- a/gabble/advanced-options-widget.cpp
+++ b/gabble/advanced-options-widget.cpp
@@ -68,23 +68,14 @@ AdvancedOptionsWidget::~AdvancedOptionsWidget()
     delete d;
 }
 
-QMap<Tp::ProtocolParameter*, QVariant> AdvancedOptionsWidget::parameterValues() const
+QVariantMap AdvancedOptionsWidget::parameterValues() const
 {
     kDebug();
 
     // the server parameter values
-    QMap<Tp::ProtocolParameter*, QVariant> parameters;
+    QVariantMap parameters;
     parameters = d->serverSettings->parameterValues();
-
-    // append the proxy parameter values
-    QMap<Tp::ProtocolParameter*, QVariant> proxyParameters;
-    proxyParameters = d->proxySettings->parameterValues();
-    QMap<Tp::ProtocolParameter*, QVariant>::const_iterator paramIter;
-    paramIter = proxyParameters.constBegin();
-    while (paramIter != proxyParameters.constEnd()) {
-        parameters.insert(paramIter.key(), paramIter.value());
-        paramIter++;
-    }
+    parameters.unite(d->proxySettings->parameterValues());
 
     return parameters;
 }
diff --git a/gabble/advanced-options-widget.h b/gabble/advanced-options-widget.h
index 2c6ce63..0e96374 100644
--- a/gabble/advanced-options-widget.h
+++ b/gabble/advanced-options-widget.h
@@ -33,7 +33,7 @@ public:
                                    QWidget *parent = 0);
     virtual ~AdvancedOptionsWidget();
 
-    virtual QMap<Tp::ProtocolParameter*, QVariant> parameterValues() const;
+    virtual QVariantMap parameterValues() const;
     virtual bool validateParameterValues();
 
 private:
diff --git a/gabble/main-options-widget.cpp b/gabble/main-options-widget.cpp
index 97fe5aa..dce68de 100644
--- a/gabble/main-options-widget.cpp
+++ b/gabble/main-options-widget.cpp
@@ -29,16 +29,13 @@ class MainOptionsWidget::Private
 {
 public:
     Private()
-            : accountParameter(0),
-              passwordParameter(0),
-              ui(0)
+            : ui(0)
     {
         kDebug();
     }
 
-    Tp::ProtocolParameterList parameters;
-    Tp::ProtocolParameter *accountParameter;
-    Tp::ProtocolParameter *passwordParameter;
+    Tp::ProtocolParameter accountParameter;
+    Tp::ProtocolParameter passwordParameter;
 
     Ui::MainOptionsWidget *ui;
 };
@@ -51,19 +48,12 @@ MainOptionsWidget::MainOptionsWidget(Tp::ProtocolParameterList parameters,
 {
     kDebug();
 
-    // Save the parameters.
-    d->parameters = parameters;
-
     // Store the parameters this widget supports
-    foreach (Tp::ProtocolParameter *parameter, d->parameters) {
-        if ((parameter->name() == "account") && (parameter->type() == QVariant::String)) {
-            if (!d->accountParameter) {
+    foreach (Tp::ProtocolParameter parameter, parameters) {
+        if ((parameter.name() == "account") && (parameter.type() == QVariant::String)) {
                 d->accountParameter = parameter;
-            }
-        } else if ((parameter->name() == "password") && (parameter->type() == QVariant::String)) {
-            if (!d->passwordParameter) {
+        } else if ((parameter.name() == "password") && (parameter.type() == QVariant::String)) {
                 d->passwordParameter = parameter;
-            }
         }
     }
 
@@ -72,29 +62,29 @@ MainOptionsWidget::MainOptionsWidget(Tp::ProtocolParameterList parameters,
     d->ui->setupUi(this);
 
     // Prefill UI elements if appropriate.
-    if (d->accountParameter) {
-        if (values.contains(d->accountParameter->name())) {
-            d->ui->accountLineEdit->setText(values.value(d->accountParameter->name()).toString());
+    if (d->accountParameter.isValid()) {
+        if (values.contains(d->accountParameter.name())) {
+            d->ui->accountLineEdit->setText(values.value(d->accountParameter.name()).toString());
         } else {
-            d->ui->accountLineEdit->setText(d->accountParameter->defaultValue().toString());
+            d->ui->accountLineEdit->setText(d->accountParameter.defaultValue().toString());
         }
     }
 
-    if (d->passwordParameter) {
-        if (values.contains(d->passwordParameter->name())) {
-            d->ui->passwordLineEdit->setText(values.value(d->passwordParameter->name()).toString());
+    if (d->passwordParameter.isValid()) {
+        if (values.contains(d->passwordParameter.name())) {
+            d->ui->passwordLineEdit->setText(values.value(d->passwordParameter.name()).toString());
         } else {
-            d->ui->passwordLineEdit->setText(d->passwordParameter->defaultValue().toString());
+            d->ui->passwordLineEdit->setText(d->passwordParameter.defaultValue().toString());
         }
     }
 
     // Hide any elements we don't have the parameters passed to show.
-    if (!d->accountParameter) {
+    if (!d->accountParameter.isValid()) {
         d->ui->accountLabel->hide();
         d->ui->accountLineEdit->hide();
     }
 
-    if (!d->passwordParameter) {
+    if (!d->passwordParameter.isValid()) {
         d->ui->passwordLabel->hide();
         d->ui->passwordLineEdit->hide();
     }
@@ -107,19 +97,19 @@ MainOptionsWidget::~MainOptionsWidget()
     delete d;
 }
 
-QMap<Tp::ProtocolParameter*, QVariant> MainOptionsWidget::parameterValues() const
+QVariantMap MainOptionsWidget::parameterValues() const
 {
     kDebug();
 
-    QMap<Tp::ProtocolParameter*, QVariant> parameters;
+    QVariantMap parameters;
 
     // Populate the map of parameters and their values with all the parameters this widget contains.
-    if (d->accountParameter) {
-        parameters.insert(d->accountParameter, d->ui->accountLineEdit->text());
+    if (d->accountParameter.isValid()) {
+        parameters.insert(d->accountParameter.name(), d->ui->accountLineEdit->text());
     }
 
-    if (d->passwordParameter) {
-        parameters.insert(d->passwordParameter, d->ui->passwordLineEdit->text());
+    if (d->passwordParameter.isValid()) {
+        parameters.insert(d->passwordParameter.name(), d->ui->passwordLineEdit->text());
     }
 
     return parameters;
diff --git a/gabble/main-options-widget.h b/gabble/main-options-widget.h
index d66725d..da468ca 100644
--- a/gabble/main-options-widget.h
+++ b/gabble/main-options-widget.h
@@ -33,7 +33,7 @@ public:
                                QWidget *parent = 0);
     virtual ~MainOptionsWidget();
 
-    virtual QMap<Tp::ProtocolParameter*, QVariant> parameterValues() const;
+    virtual QVariantMap parameterValues() const;
     virtual bool validateParameterValues();
 
 private:
diff --git a/gabble/proxy-settings-widget.cpp b/gabble/proxy-settings-widget.cpp
index fb4302f..48eadd7 100644
--- a/gabble/proxy-settings-widget.cpp
+++ b/gabble/proxy-settings-widget.cpp
@@ -29,28 +29,19 @@ class ProxySettingsWidget::Private
 {
 public:
     Private()
-            : stunServerParameter(0),
-              stunPortParameter(0),
-              fallbackStunServerParameter(0),
-              fallbackStunPortParameter(0),
-              httpsProxyServerParameter(0),
-              httpsProxyPortParameter(0),
-              fallbackSocks5ProxiesParameter(0),
-              fallbackConferenceServerParameter(0),
-              ui(0)
+            : ui(0)
     {
         kDebug();
     }
 
-    Tp::ProtocolParameterList parameters;
-    Tp::ProtocolParameter *stunServerParameter;
-    Tp::ProtocolParameter *stunPortParameter;
-    Tp::ProtocolParameter *fallbackStunServerParameter;
-    Tp::ProtocolParameter *fallbackStunPortParameter;
-    Tp::ProtocolParameter *httpsProxyServerParameter;
-    Tp::ProtocolParameter *httpsProxyPortParameter;
-    Tp::ProtocolParameter *fallbackSocks5ProxiesParameter;
-    Tp::ProtocolParameter *fallbackConferenceServerParameter;
+    Tp::ProtocolParameter stunServerParameter;
+    Tp::ProtocolParameter stunPortParameter;
+    Tp::ProtocolParameter fallbackStunServerParameter;
+    Tp::ProtocolParameter fallbackStunPortParameter;
+    Tp::ProtocolParameter httpsProxyServerParameter;
+    Tp::ProtocolParameter httpsProxyPortParameter;
+    Tp::ProtocolParameter fallbackSocks5ProxiesParameter;
+    Tp::ProtocolParameter fallbackConferenceServerParameter;
 
     Ui::ProxySettingsWidget *ui;
 };
@@ -63,49 +54,30 @@ ProxySettingsWidget::ProxySettingsWidget(Tp::ProtocolParameterList parameters,
 {
     kDebug();
 
-    // Save the parameters.
-    d->parameters = parameters;
-
     // Store the parameters this widget supports
-    foreach (Tp::ProtocolParameter *parameter, d->parameters) {
-        if ((parameter->name() == "stun-server") && (parameter->type() == QVariant::String)) {
-            if (!d->stunServerParameter) {
+    foreach (Tp::ProtocolParameter parameter, parameters) {
+        if ((parameter.name() == "stun-server") && (parameter.type() == QVariant::String)) {
                 d->stunServerParameter = parameter;
-            }
-        } else if ((parameter->name() == "stun-port") && (parameter->type() == QVariant::UInt)) {
-            if (!d->stunPortParameter) {
+        } else if ((parameter.name() == "stun-port") && (parameter.type() == QVariant::UInt)) {
                 d->stunPortParameter = parameter;
-            }
-        } else if ((parameter->name() == "fallback-stun-server") &&
-                   (parameter->type() == QVariant::String)) {
-            if (!d->fallbackStunServerParameter) {
+        } else if ((parameter.name() == "fallback-stun-server") &&
+                   (parameter.type() == QVariant::String)) {
                 d->fallbackStunServerParameter = parameter;
-            }
-        } else if ((parameter->name() == "fallback-stun-port") &&
-                   (parameter->type() == QVariant::UInt)) {
-            if (!d->fallbackStunPortParameter) {
+        } else if ((parameter.name() == "fallback-stun-port") &&
+                   (parameter.type() == QVariant::UInt)) {
                 d->fallbackStunPortParameter = parameter;
-            }
-        } else if ((parameter->name() == "https-proxy-server") &&
-                   (parameter->type() == QVariant::String)) {
-            if (!d->httpsProxyServerParameter) {
+        } else if ((parameter.name() == "https-proxy-server") &&
+                   (parameter.type() == QVariant::String)) {
                 d->httpsProxyServerParameter = parameter;
-            }
-        } else if ((parameter->name() == "https-proxy-port") &&
-                   (parameter->type() == QVariant::UInt)) {
-            if (!d->httpsProxyPortParameter) {
+        } else if ((parameter.name() == "https-proxy-port") &&
+                   (parameter.type() == QVariant::UInt)) {
                 d->httpsProxyPortParameter = parameter;
-            }
-        } else if ((parameter->name() == "fallback-socks5-proxies") &&
-                   (parameter->type() == QVariant::StringList)) {
-            if (!d->fallbackSocks5ProxiesParameter) {
+        } else if ((parameter.name() == "fallback-socks5-proxies") &&
+                   (parameter.type() == QVariant::StringList)) {
                 d->fallbackSocks5ProxiesParameter = parameter;
-            }
-        } else if ((parameter->name() == "fallback-conference-server") &&
-                   (parameter->type() == QVariant::String)) {
-            if (!d->fallbackConferenceServerParameter) {
+        } else if ((parameter.name() == "fallback-conference-server") &&
+                   (parameter.type() == QVariant::String)) {
                 d->fallbackConferenceServerParameter = parameter;
-            }
         }
     }
 
@@ -114,143 +86,143 @@ ProxySettingsWidget::ProxySettingsWidget(Tp::ProtocolParameterList parameters,
     d->ui->setupUi(this);
 
     // Prefill UI elements if appropriate.
-    if (d->stunServerParameter) {
-        if (values.contains(d->stunServerParameter->name())) {
+    if (d->stunServerParameter.isValid()) {
+        if (values.contains(d->stunServerParameter.name())) {
             d->ui->stunServerLineEdit->setText(values.value(
-                    d->stunServerParameter->name()).toString());
+                    d->stunServerParameter.name()).toString());
         } else {
-            d->ui->stunServerLineEdit->setText(d->stunServerParameter->defaultValue().toString());
+            d->ui->stunServerLineEdit->setText(d->stunServerParameter.defaultValue().toString());
         }
     }
 
-    if (d->stunPortParameter) {
-        if (values.contains(d->stunPortParameter->name())) {
-            d->ui->stunPortSpinBox->setValue(values.value(d->stunPortParameter->name()).toUInt());
+    if (d->stunPortParameter.isValid()) {
+        if (values.contains(d->stunPortParameter.name())) {
+            d->ui->stunPortSpinBox->setValue(values.value(d->stunPortParameter.name()).toUInt());
         } else {
-            d->ui->stunPortSpinBox->setValue(d->stunPortParameter->defaultValue().toUInt());
+            d->ui->stunPortSpinBox->setValue(d->stunPortParameter.defaultValue().toUInt());
         }
     }
 
-    if (d->fallbackStunServerParameter) {
-        if (values.contains(d->fallbackStunServerParameter->name())) {
+    if (d->fallbackStunServerParameter.isValid()) {
+        if (values.contains(d->fallbackStunServerParameter.name())) {
             d->ui->fallbackStunServerLineEdit->setText(values.value(
-                    d->fallbackStunServerParameter->name()).toString());
+                    d->fallbackStunServerParameter.name()).toString());
         } else {
             d->ui->fallbackStunServerLineEdit->setText(
-                    d->fallbackStunServerParameter->defaultValue().toString());
+                    d->fallbackStunServerParameter.defaultValue().toString());
         }
     }
 
-    if (d->fallbackStunPortParameter) {
-        if (values.contains(d->fallbackStunPortParameter->name())) {
+    if (d->fallbackStunPortParameter.isValid()) {
+        if (values.contains(d->fallbackStunPortParameter.name())) {
             d->ui->fallbackStunPortSpinBox->setValue(values.value(
-                    d->fallbackStunPortParameter->name()).toUInt());
+                    d->fallbackStunPortParameter.name()).toUInt());
         } else {
             d->ui->fallbackStunPortSpinBox->setValue(
-                    d->fallbackStunPortParameter->defaultValue().toUInt());
+                    d->fallbackStunPortParameter.defaultValue().toUInt());
         }
     }
 
-    if (d->httpsProxyServerParameter) {
-        if (values.contains(d->httpsProxyServerParameter->name())) {
+    if (d->httpsProxyServerParameter.isValid()) {
+        if (values.contains(d->httpsProxyServerParameter.name())) {
             d->ui->httpsProxyServerLineEdit->setText(values.value(
-                    d->httpsProxyServerParameter->name()).toString());
+                    d->httpsProxyServerParameter.name()).toString());
         } else {
             d->ui->httpsProxyServerLineEdit->setText(
-                    d->httpsProxyServerParameter->defaultValue().toString());
+                    d->httpsProxyServerParameter.defaultValue().toString());
         }
     }
 
-    if (d->httpsProxyPortParameter) {
-        if (values.contains(d->httpsProxyPortParameter->name())) {
+    if (d->httpsProxyPortParameter.isValid()) {
+        if (values.contains(d->httpsProxyPortParameter.name())) {
             d->ui->httpsProxyPortSpinBox->setValue(values.value(
-                    d->httpsProxyPortParameter->name()).toUInt());
+                    d->httpsProxyPortParameter.name()).toUInt());
         } else {
             d->ui->httpsProxyPortSpinBox->setValue(
-                    d->httpsProxyPortParameter->defaultValue().toUInt());
+                    d->httpsProxyPortParameter.defaultValue().toUInt());
         }
     }
 
-    if (d->fallbackSocks5ProxiesParameter) {
-        if (values.contains(d->fallbackSocks5ProxiesParameter->name())) {
+    if (d->fallbackSocks5ProxiesParameter.isValid()) {
+        if (values.contains(d->fallbackSocks5ProxiesParameter.name())) {
             foreach (const QString &line,
-                     values.value(d->fallbackSocks5ProxiesParameter->name()).toStringList()) {
+                     values.value(d->fallbackSocks5ProxiesParameter.name()).toStringList()) {
                 d->ui->fallbackSocks5ProxiesTextEdit->append(line);
             }
         } else {
             foreach (const QString &line,
-                     d->fallbackSocks5ProxiesParameter->defaultValue().toStringList()) {
+                     d->fallbackSocks5ProxiesParameter.defaultValue().toStringList()) {
                 d->ui->fallbackSocks5ProxiesTextEdit->append(line);
             }
         }
     }
 
-    if (d->fallbackConferenceServerParameter) {
-        if (values.contains(d->fallbackConferenceServerParameter->name())) {
+    if (d->fallbackConferenceServerParameter.isValid()) {
+        if (values.contains(d->fallbackConferenceServerParameter.name())) {
             d->ui->fallbackConferenceServerLineEdit->setText(values.value(
-                    d->fallbackConferenceServerParameter->name()).toString());
+                    d->fallbackConferenceServerParameter.name()).toString());
         } else {
             d->ui->fallbackConferenceServerLineEdit->setText(
-                    d->fallbackConferenceServerParameter->defaultValue().toString());
+                    d->fallbackConferenceServerParameter.defaultValue().toString());
         }
     }
 
     // Hide any elements we don't have the parameters passed to show.
-    if (!d->stunServerParameter) {
+    if (!d->stunServerParameter.isValid()) {
         d->ui->stunServerLabel->hide();
         d->ui->stunServerLineEdit->hide();
     }
 
-    if (!d->stunPortParameter) {
+    if (!d->stunPortParameter.isValid()) {
         d->ui->stunPortLabel->hide();
         d->ui->stunPortSpinBox->hide();
     }
 
-    if (!d->fallbackStunServerParameter) {
+    if (!d->fallbackStunServerParameter.isValid()) {
         d->ui->fallbackStunServerLabel->hide();
         d->ui->fallbackStunServerLineEdit->hide();
     }
 
-    if (!d->fallbackStunPortParameter) {
+    if (!d->fallbackStunPortParameter.isValid()) {
         d->ui->fallbackStunPortLabel->hide();
         d->ui->fallbackStunPortSpinBox->hide();
     }
 
-    if (!d->httpsProxyServerParameter) {
+    if (!d->httpsProxyServerParameter.isValid()) {
         d->ui->httpsProxyServerLabel->hide();
         d->ui->httpsProxyServerLineEdit->hide();
     }
 
-    if (!d->httpsProxyPortParameter) {
+    if (!d->httpsProxyPortParameter.isValid()) {
         d->ui->httpsProxyPortLabel->hide();
         d->ui->httpsProxyPortSpinBox->hide();
     }
 
-    if (!d->fallbackSocks5ProxiesParameter) {
+    if (!d->fallbackSocks5ProxiesParameter.isValid()) {
         d->ui->fallbackSocks5ProxiesLabel->hide();
         d->ui->fallbackSocks5ProxiesTextEdit->hide();
     }
 
-    if (!d->fallbackConferenceServerParameter) {
+    if (!d->fallbackConferenceServerParameter.isValid()) {
         d->ui->fallbackConferenceServerLabel->hide();
         d->ui->fallbackConferenceServerLineEdit->hide();
     }
 
     // Hide the group boxes if they are empty.
-    if ((!d->stunServerParameter) &&
-        (!d->stunPortParameter) &&
-        (!d->fallbackStunServerParameter) &&
-        (!d->fallbackStunPortParameter)) {
+    if ((!d->stunServerParameter.isValid()) &&
+        (!d->stunPortParameter.isValid()) &&
+        (!d->fallbackStunServerParameter.isValid()) &&
+        (!d->fallbackStunPortParameter.isValid())) {
         d->ui->stunGroupBox->hide();
     }
 
-    if ((!d->httpsProxyServerParameter) &&
-        (!d->httpsProxyPortParameter) &&
-        (!d->fallbackSocks5ProxiesParameter)) {
+    if ((!d->httpsProxyServerParameter.isValid()) &&
+        (!d->httpsProxyPortParameter.isValid()) &&
+        (!d->fallbackSocks5ProxiesParameter.isValid())) {
         d->ui->proxyGroupBox->hide();
     }
 
-    if (!d->fallbackConferenceServerParameter) {
+    if (!d->fallbackConferenceServerParameter.isValid()) {
         d->ui->conferenceGroupBox->hide();
     }
 }
@@ -262,46 +234,46 @@ ProxySettingsWidget::~ProxySettingsWidget()
     delete d;
 }
 
-QMap<Tp::ProtocolParameter*, QVariant> ProxySettingsWidget::parameterValues() const
+QVariantMap ProxySettingsWidget::parameterValues() const
 {
     kDebug();
 
-    QMap<Tp::ProtocolParameter*, QVariant> parameters;
+    QVariantMap parameters;
 
     // Populate the map of parameters and their values with all the parameters this widget contains.
-    if (d->stunServerParameter) {
-        parameters.insert(d->stunServerParameter, d->ui->stunServerLineEdit->text());
+    if (d->stunServerParameter.isValid()) {
+        parameters.insert(d->stunServerParameter.name(), d->ui->stunServerLineEdit->text());
     }
 
-    if (d->stunPortParameter) {
-        parameters.insert(d->stunPortParameter, d->ui->stunPortSpinBox->value());
+    if (d->stunPortParameter.isValid()) {
+        parameters.insert(d->stunPortParameter.name(), d->ui->stunPortSpinBox->value());
     }
 
-    if (d->fallbackStunServerParameter) {
-        parameters.insert(d->fallbackStunServerParameter,
+    if (d->fallbackStunServerParameter.isValid()) {
+        parameters.insert(d->fallbackStunServerParameter.name(),
                           d->ui->fallbackStunServerLineEdit->text());
     }
 
-    if (d->fallbackStunPortParameter) {
-        parameters.insert(d->fallbackStunPortParameter, d->ui->fallbackStunPortSpinBox->value());
+    if (d->fallbackStunPortParameter.isValid()) {
+        parameters.insert(d->fallbackStunPortParameter.name(), d->ui->fallbackStunPortSpinBox->value());
     }
 
-    if (d->httpsProxyServerParameter) {
-        parameters.insert(d->httpsProxyServerParameter, d->ui->httpsProxyServerLineEdit->text());
+    if (d->httpsProxyServerParameter.isValid()) {
+        parameters.insert(d->httpsProxyServerParameter.name(), d->ui->httpsProxyServerLineEdit->text());
     }
 
-    if (d->httpsProxyPortParameter) {
-        parameters.insert(d->httpsProxyPortParameter, d->ui->httpsProxyPortSpinBox->value());
+    if (d->httpsProxyPortParameter.isValid()) {
+        parameters.insert(d->httpsProxyPortParameter.name(), d->ui->httpsProxyPortSpinBox->value());
     }
 
-    if (d->fallbackSocks5ProxiesParameter) {
+    if (d->fallbackSocks5ProxiesParameter.isValid()) {
         QString text = d->ui->fallbackSocks5ProxiesTextEdit->toPlainText();
         QStringList value = text.split("
", QString::SkipEmptyParts);
-        parameters.insert(d->fallbackSocks5ProxiesParameter, value);
+        parameters.insert(d->fallbackSocks5ProxiesParameter.name(), value);
     }
 
-    if (d->fallbackConferenceServerParameter) {
-        parameters.insert(d->fallbackConferenceServerParameter,
+    if (d->fallbackConferenceServerParameter.isValid()) {
+        parameters.insert(d->fallbackConferenceServerParameter.name(),
                           d->ui->fallbackConferenceServerLineEdit->text());
     }
 
diff --git a/gabble/proxy-settings-widget.h b/gabble/proxy-settings-widget.h
index ef064ed..596d23f 100644
--- a/gabble/proxy-settings-widget.h
+++ b/gabble/proxy-settings-widget.h
@@ -33,7 +33,7 @@ public:
                                  QWidget *parent = 0);
     virtual ~ProxySettingsWidget();
 
-    virtual QMap<Tp::ProtocolParameter*, QVariant> parameterValues() const;
+    virtual QVariantMap parameterValues() const;
     virtual bool validateParameterValues();
 
 private:
diff --git a/gabble/server-settings-widget.cpp b/gabble/server-settings-widget.cpp
index d484ca3..b58b95a 100644
--- a/gabble/server-settings-widget.cpp
+++ b/gabble/server-settings-widget.cpp
@@ -29,26 +29,18 @@ class ServerSettingsWidget::Private
 {
 public:
     Private()
-            : serverParameter(0),
-              portParameter(0),
-              keepaliveIntervalParameter(0),
-              lowBandwidthParameter(0),
-              requireEncryptionParameter(0),
-              ignoreSslErrorsParameter(0),
-              oldSslParameter(0),
-              ui(0)
+            : ui(0)
     {
         kDebug();
     }
 
-    Tp::ProtocolParameterList parameters;
-    Tp::ProtocolParameter *serverParameter;
-    Tp::ProtocolParameter *portParameter;
-    Tp::ProtocolParameter *keepaliveIntervalParameter;
-    Tp::ProtocolParameter *lowBandwidthParameter;
-    Tp::ProtocolParameter *requireEncryptionParameter;
-    Tp::ProtocolParameter *ignoreSslErrorsParameter;
-    Tp::ProtocolParameter *oldSslParameter;
+    Tp::ProtocolParameter serverParameter;
+    Tp::ProtocolParameter portParameter;
+    Tp::ProtocolParameter keepaliveIntervalParameter;
+    Tp::ProtocolParameter lowBandwidthParameter;
+    Tp::ProtocolParameter requireEncryptionParameter;
+    Tp::ProtocolParameter ignoreSslErrorsParameter;
+    Tp::ProtocolParameter oldSslParameter;
 
     Ui::ServerSettingsWidget *ui;
 };
@@ -61,39 +53,22 @@ ServerSettingsWidget::ServerSettingsWidget(Tp::ProtocolParameterList parameters,
 {
     kDebug();
 
-    // Save the parameters.
-    d->parameters = parameters;
-
     // Store the parameters this widget supports
-    foreach (Tp::ProtocolParameter *parameter, d->parameters) {
-        if ((parameter->name() == "server") && (parameter->type() == QVariant::String)) {
-            if (!d->serverParameter) {
-                d->serverParameter = parameter;
-            }
-        } else if ((parameter->name() == "port") && (parameter->type() == QVariant::UInt)) {
-            if (!d->portParameter) {
-                d->portParameter = parameter;
-            }
-        } else if ((parameter->name() == "keepalive-interval") && (parameter->type() == QVariant::UInt)) {
-            if (!d->keepaliveIntervalParameter) {
-                d->keepaliveIntervalParameter = parameter;
-            }
-        } else if ((parameter->name() == "low-bandwidth") && (parameter->type() == QVariant::Bool)) {
-            if (!d->lowBandwidthParameter) {
-                d->lowBandwidthParameter = parameter;
-            }
-        } else if ((parameter->name() == "require-encryption") && (parameter->type() == QVariant::Bool)) {
-            if (!d->requireEncryptionParameter) {
-                d->requireEncryptionParameter = parameter;
-            }
-        } else if ((parameter->name() == "ignore-ssl-errors") && (parameter->type() == QVariant::Bool)) {
-            if (!d->ignoreSslErrorsParameter) {
-                d->ignoreSslErrorsParameter = parameter;
-            }
-        } else if ((parameter->name() == "old-ssl") && (parameter->type() == QVariant::Bool)) {
-            if (!d->oldSslParameter) {
-                d->oldSslParameter = parameter;
-            }
+    foreach (Tp::ProtocolParameter parameter, parameters) {
+        if ((parameter.name() == "server") && (parameter.type() == QVariant::String)) {
+            d->serverParameter = parameter;
+        } else if ((parameter.name() == "port") && (parameter.type() == QVariant::UInt)) {
+            d->portParameter = parameter;
+        } else if ((parameter.name() == "keepalive-interval") && (parameter.type() == QVariant::UInt)) {
+            d->keepaliveIntervalParameter = parameter;
+        } else if ((parameter.name() == "low-bandwidth") && (parameter.type() == QVariant::Bool)) {
+            d->lowBandwidthParameter = parameter;
+        } else if ((parameter.name() == "require-encryption") && (parameter.type() == QVariant::Bool)) {
+            d->requireEncryptionParameter = parameter;
+        } else if ((parameter.name() == "ignore-ssl-errors") && (parameter.type() == QVariant::Bool)) {
+            d->ignoreSslErrorsParameter = parameter;
+        } else if ((parameter.name() == "old-ssl") && (parameter.type() == QVariant::Bool)) {
+            d->oldSslParameter = parameter;
         }
     }
 
@@ -102,114 +77,114 @@ ServerSettingsWidget::ServerSettingsWidget(Tp::ProtocolParameterList parameters,
     d->ui->setupUi(this);
 
     // Prefill UI elements if appropriate.
-    if (d->serverParameter) {
-        if (values.contains(d->serverParameter->name())) {
-            d->ui->serverLineEdit->setText(values.value(d->serverParameter->name()).toString());
+    if (d->serverParameter.isValid()) {
+        if (values.contains(d->serverParameter.name())) {
+            d->ui->serverLineEdit->setText(values.value(d->serverParameter.name()).toString());
         } else {
-            d->ui->serverLineEdit->setText(d->serverParameter->defaultValue().toString());
+            d->ui->serverLineEdit->setText(d->serverParameter.defaultValue().toString());
         }
     }
 
-    if (d->portParameter) {
-        if (values.contains(d->portParameter->name())) {
-            d->ui->portSpinBox->setValue(values.value(d->portParameter->name()).toUInt());
+    if (d->portParameter.isValid()) {
+        if (values.contains(d->portParameter.name())) {
+            d->ui->portSpinBox->setValue(values.value(d->portParameter.name()).toUInt());
         } else {
-            d->ui->portSpinBox->setValue(d->portParameter->defaultValue().toUInt());
+            d->ui->portSpinBox->setValue(d->portParameter.defaultValue().toUInt());
         }
     }
 
-    if (d->keepaliveIntervalParameter) {
-        if (values.contains(d->keepaliveIntervalParameter->name())) {
+    if (d->keepaliveIntervalParameter.isValid()) {
+        if (values.contains(d->keepaliveIntervalParameter.name())) {
             d->ui->keepaliveIntervalSpinBox->setValue(values.value(
-                    d->keepaliveIntervalParameter->name()).toUInt());
+                    d->keepaliveIntervalParameter.name()).toUInt());
         } else {
             d->ui->keepaliveIntervalSpinBox->setValue(
-                    d->keepaliveIntervalParameter->defaultValue().toUInt());
+                    d->keepaliveIntervalParameter.defaultValue().toUInt());
         }
     }
 
-    if (d->lowBandwidthParameter) {
-        if (values.contains(d->lowBandwidthParameter->name())) {
+    if (d->lowBandwidthParameter.isValid()) {
+        if (values.contains(d->lowBandwidthParameter.name())) {
             d->ui->lowBandwidthCheckBox->setChecked(values.value(
-                    d->lowBandwidthParameter->name()).toBool());
+                    d->lowBandwidthParameter.name()).toBool());
         } else {
             d->ui->lowBandwidthCheckBox->setChecked(
-                    d->lowBandwidthParameter->defaultValue().toBool());
+                    d->lowBandwidthParameter.defaultValue().toBool());
         }
     }
 
-    if (d->requireEncryptionParameter) {
-        if (values.contains(d->requireEncryptionParameter->name())) {
+    if (d->requireEncryptionParameter.isValid()) {
+        if (values.contains(d->requireEncryptionParameter.name())) {
             d->ui->requireEncryptionCheckBox->setChecked(values.value(
-                    d->requireEncryptionParameter->name()).toBool());
+                    d->requireEncryptionParameter.name()).toBool());
         } else {
             d->ui->requireEncryptionCheckBox->setChecked(
-                    d->requireEncryptionParameter->defaultValue().toBool());
+                    d->requireEncryptionParameter.defaultValue().toBool());
         }
     }
 
-    if (d->ignoreSslErrorsParameter) {
-        if (values.contains(d->ignoreSslErrorsParameter->name())) {
+    if (d->ignoreSslErrorsParameter.isValid()) {
+        if (values.contains(d->ignoreSslErrorsParameter.name())) {
             d->ui->ignoreSslErrorsCheckBox->setChecked(values.value(
-                    d->ignoreSslErrorsParameter->name()).toBool());
+                    d->ignoreSslErrorsParameter.name()).toBool());
         } else {
             d->ui->ignoreSslErrorsCheckBox->setChecked(
-                    d->ignoreSslErrorsParameter->defaultValue().toBool());
+                    d->ignoreSslErrorsParameter.defaultValue().toBool());
         }
     }
 
-    if (d->oldSslParameter) {
-        if (values.contains(d->oldSslParameter->name())) {
-            d->ui->oldSslCheckBox->setChecked(values.value(d->oldSslParameter->name()).toBool());
+    if (d->oldSslParameter.isValid()) {
+        if (values.contains(d->oldSslParameter.name())) {
+            d->ui->oldSslCheckBox->setChecked(values.value(d->oldSslParameter.name()).toBool());
         } else {
-            d->ui->oldSslCheckBox->setChecked(d->oldSslParameter->defaultValue().toBool());
+            d->ui->oldSslCheckBox->setChecked(d->oldSslParameter.defaultValue().toBool());
         }
     }
 
     // Hide any elements we don't have the parameters passed to show.
-    if (!d->serverParameter) {
+    if (!d->serverParameter.isValid()) {
         d->ui->serverLabel->hide();
         d->ui->serverLineEdit->hide();
     }
 
-    if (!d->portParameter) {
+    if (!d->portParameter.isValid()) {
         d->ui->portLabel->hide();
         d->ui->portSpinBox->hide();
     }
 
-    if (!d->keepaliveIntervalParameter) {
+    if (!d->keepaliveIntervalParameter.isValid()) {
         d->ui->keepaliveIntervalLabel->hide();
         d->ui->keepaliveIntervalSpinBox->hide();
     }
 
-    if (!d->lowBandwidthParameter) {
+    if (!d->lowBandwidthParameter.isValid()) {
         d->ui->lowBandwidthCheckBox->hide();
     }
 
-    if (!d->requireEncryptionParameter) {
+    if (!d->requireEncryptionParameter.isValid()) {
         d->ui->requireEncryptionCheckBox->hide();
     }
 
-    if (!d->ignoreSslErrorsParameter) {
+    if (!d->ignoreSslErrorsParameter.isValid()) {
         d->ui->ignoreSslErrorsCheckBox->hide();
     }
 
-    if (!d->oldSslParameter) {
+    if (!d->oldSslParameter.isValid()) {
         d->ui->oldSslCheckBox->hide();
     }
 
     // Hide the group boxes if they are empty.
-    if ((!d->serverParameter) && (!d->portParameter)) {
+    if ((!d->serverParameter.isValid()) && (!d->portParameter.isValid())) {
         d->ui->serverGroupBox->hide();
     }
 
-    if ((!d->keepaliveIntervalParameter) && (!d->lowBandwidthParameter)) {
+    if ((!d->keepaliveIntervalParameter.isValid()) && (!d->lowBandwidthParameter.isValid())) {
         d->ui->connectionGroupBox->hide();
     }
 
-    if ((!d->requireEncryptionParameter) &&
-        (!d->ignoreSslErrorsParameter) &&
-        (!d->oldSslParameter)) {
+    if ((!d->requireEncryptionParameter.isValid()) &&
+        (!d->ignoreSslErrorsParameter.isValid()) &&
+        (!d->oldSslParameter.isValid())) {
         d->ui->securityGroupBox->hide();
     }
 }
@@ -221,40 +196,40 @@ ServerSettingsWidget::~ServerSettingsWidget()
     delete d;
 }
 
-QMap<Tp::ProtocolParameter*, QVariant> ServerSettingsWidget::parameterValues() const
+QVariantMap ServerSettingsWidget::parameterValues() const
 {
     kDebug();
 
-    QMap<Tp::ProtocolParameter*, QVariant> parameters;
+    QVariantMap parameters;
 
     // Populate the map of parameters and their values with all the parameters this widget contains.
-    if (d->serverParameter) {
-        parameters.insert(d->serverParameter, d->ui->serverLineEdit->text());
+    if (d->serverParameter.isValid()) {
+        parameters.insert(d->serverParameter.name(), d->ui->serverLineEdit->text());
     }
 
-    if (d->portParameter) {
-        parameters.insert(d->portParameter, d->ui->portSpinBox->value());
+    if (d->portParameter.isValid()) {
+        parameters.insert(d->portParameter.name(), d->ui->portSpinBox->value());
     }
 
-    if (d->keepaliveIntervalParameter) {
-        parameters.insert(d->keepaliveIntervalParameter, d->ui->keepaliveIntervalSpinBox->value());
+    if (d->keepaliveIntervalParameter.isValid()) {
+        parameters.insert(d->keepaliveIntervalParameter.name(), d->ui->keepaliveIntervalSpinBox->value());
     }
 
-    if (d->lowBandwidthParameter) {
-        parameters.insert(d->lowBandwidthParameter, d->ui->lowBandwidthCheckBox->isChecked());
+    if (d->lowBandwidthParameter.isValid()) {
+        parameters.insert(d->lowBandwidthParameter.name(), d->ui->lowBandwidthCheckBox->isChecked());
     }
 
-    if (d->requireEncryptionParameter) {
-        parameters.insert(d->requireEncryptionParameter,
+    if (d->requireEncryptionParameter.isValid()) {
+        parameters.insert(d->requireEncryptionParameter.name(),
                           d->ui->requireEncryptionCheckBox->isChecked());
     }
 
-    if (d->ignoreSslErrorsParameter) {
-        parameters.insert(d->ignoreSslErrorsParameter, d->ui->ignoreSslErrorsCheckBox->isChecked());
+    if (d->ignoreSslErrorsParameter.isValid()) {
+        parameters.insert(d->ignoreSslErrorsParameter.name(), d->ui->ignoreSslErrorsCheckBox->isChecked());
     }
 
-    if (d->oldSslParameter) {
-        parameters.insert(d->oldSslParameter, d->ui->oldSslCheckBox->isChecked());
+    if (d->oldSslParameter.isValid()) {
+        parameters.insert(d->oldSslParameter.name(), d->ui->oldSslCheckBox->isChecked());
     }
 
     return parameters;
diff --git a/gabble/server-settings-widget.h b/gabble/server-settings-widget.h
index 19d414e..813f3f4 100644
--- a/gabble/server-settings-widget.h
+++ b/gabble/server-settings-widget.h
@@ -33,7 +33,7 @@ public:
                                        QWidget *parent = 0);
     virtual ~ServerSettingsWidget();
 
-    virtual QMap<Tp::ProtocolParameter*, QVariant> parameterValues() const;
+    virtual QVariantMap parameterValues() const;
     virtual bool validateParameterValues();
 
 private:

-- 
ktp-accounts-kcm packaging



More information about the pkg-kde-commits mailing list