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


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

The following commit has been merged in the master branch:
commit 2c69253f6860a83cebfec3dcdf72d6a5530cc12d
Author: George Goldberg <grundleborg at googlemail.com>
Date:   Mon Aug 10 13:48:51 2009 +0000

    Add a widget for the optional server-related parameters.
    
    svn path=/trunk/playground/network/telepathy-accounts-kcm-plugins/; revision=1009623
---
 gabble/CMakeLists.txt                              |   2 +
 gabble/gabble-account-ui.cpp                       |   8 +
 gabble/server-settings-widget.cpp                  | 252 +++++++++++++++++++++
 ...arameters-widget.h => server-settings-widget.h} |  12 +-
 gabble/server-settings-widget.ui                   | 132 +++++++++++
 5 files changed, 400 insertions(+), 6 deletions(-)

diff --git a/gabble/CMakeLists.txt b/gabble/CMakeLists.txt
index 8d341cb..1274d2d 100644
--- a/gabble/CMakeLists.txt
+++ b/gabble/CMakeLists.txt
@@ -8,10 +8,12 @@ set (kcmtelepathyaccounts_plugin_gabble_SRCS
      gabble-account-ui-plugin.cpp
      gabble-account-ui.cpp
      mandatory-parameters-widget.cpp
+     server-settings-widget.cpp
 )
 
 kde4_add_ui_files (kcmtelepathyaccounts_plugin_gabble_SRCS
                    mandatory-parameters-widget.ui
+                   server-settings-widget.ui
 )
 
 kde4_add_plugin (kcmtelepathyaccounts_plugin_gabble
diff --git a/gabble/gabble-account-ui.cpp b/gabble/gabble-account-ui.cpp
index 351e5ee..42eb447 100644
--- a/gabble/gabble-account-ui.cpp
+++ b/gabble/gabble-account-ui.cpp
@@ -44,6 +44,14 @@ GabbleAccountUi::GabbleAccountUi(QObject *parent)
     // Register supported parameters
     registerSupportedMandatoryParameter("account", QVariant::String);
     registerSupportedMandatoryParameter("password", QVariant::String);
+
+    registerSupportedOptionalParameter("port", QVariant::UInt);
+    registerSupportedOptionalParameter("server", QVariant::String);
+    registerSupportedOptionalParameter("require-encryption", QVariant::Bool);
+    registerSupportedOptionalParameter("old-ssl", QVariant::Bool);
+    registerSupportedOptionalParameter("low-bandwidth", QVariant::Bool);
+    registerSupportedOptionalParameter("ignore-ssl-errors", QVariant::Bool);
+    registerSupportedOptionalParameter("keepalive-interval", QVariant::UInt);
 }
 
 GabbleAccountUi::~GabbleAccountUi()
diff --git a/gabble/server-settings-widget.cpp b/gabble/server-settings-widget.cpp
new file mode 100644
index 0000000..27e9cdf
--- /dev/null
+++ b/gabble/server-settings-widget.cpp
@@ -0,0 +1,252 @@
+/*
+ * This file is part of telepathy-accounts-kcm
+ *
+ * Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "server-settings-widget.h"
+
+#include "ui_server-settings-widget.h"
+
+#include <KDebug>
+#include <KMessageBox>
+
+class ServerSettingsWidget::Private
+{
+public:
+    Private()
+            : serverParameter(0),
+              portParameter(0),
+              keepaliveIntervalParameter(0),
+              lowBandwidthParameter(0),
+              requireEncryptionParameter(0),
+              ignoreSslErrorsParameter(0),
+              oldSslParameter(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;
+
+    Ui::ServerSettingsWidget *ui;
+};
+
+ServerSettingsWidget::ServerSettingsWidget(Tp::ProtocolParameterList parameters,
+                                                     const QVariantMap &values,
+                                                     QWidget *parent)
+ : AbstractAccountParametersWidget(parameters, values, parent),
+   d(new Private)
+{
+    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;
+            }
+        }
+    }
+
+    // Set up the UI.
+    d->ui = new Ui::ServerSettingsWidget;
+    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->portParameter) {
+        if (values.contains(d->portParameter->name())) {
+            d->ui->portLineEdit->setValue(values.value(d->portParameter->name()).toUInt());
+        }
+    }
+
+    if (d->keepaliveIntervalParameter) {
+        if (values.contains(d->keepaliveIntervalParameter->name())) {
+            d->ui->keepaliveIntervalLineEdit->setValue(values.value(
+                    d->keepaliveIntervalParameter->name()).toUInt());
+        }
+    }
+
+    if (d->lowBandwidthParameter) {
+        if (values.contains(d->lowBandwidthParameter->name())) {
+            d->ui->lowBandwidthCheckBox->setChecked(values.value(
+                    d->lowBandwidthParameter->name()).toBool());
+        }
+    }
+
+    if (d->requireEncryptionParameter) {
+        if (values.contains(d->requireEncryptionParameter->name())) {
+            d->ui->requireEncryptionCheckBox->setChecked(values.value(
+                    d->requireEncryptionParameter->name()).toBool());
+        }
+    }
+
+    if (d->ignoreSslErrorsParameter) {
+        if (values.contains(d->ignoreSslErrorsParameter->name())) {
+            d->ui->ignoreSslErrorsCheckBox->setChecked(values.value(
+                    d->ignoreSslErrorsParameter->name()).toBool());
+        }
+    }
+
+    if (d->oldSslParameter) {
+        if (values.contains(d->oldSslParameter->name())) {
+            d->ui->oldSslCheckBox->setChecked(values.value(d->oldSslParameter->name()).toBool());
+        }
+    }
+
+    // Hide any elements we don't have the parameters passed to show.
+    if (!d->serverParameter) {
+        d->ui->serverLabel->hide();
+        d->ui->serverLineEdit->hide();
+    }
+
+    if (!d->portParameter) {
+        d->ui->portLabel->hide();
+        d->ui->portLineEdit->hide();
+    }
+
+    if (!d->keepaliveIntervalParameter) {
+        d->ui->keepaliveIntervalLabel->hide();
+        d->ui->keepaliveIntervalLineEdit->hide();
+    }
+
+    if (!d->lowBandwidthParameter) {
+        d->ui->lowBandwidthCheckBox->hide();
+    }
+
+    if (!d->requireEncryptionParameter) {
+        d->ui->requireEncryptionCheckBox->hide();
+    }
+
+    if (!d->ignoreSslErrorsParameter) {
+        d->ui->ignoreSslErrorsCheckBox->hide();
+    }
+
+    if (!d->oldSslParameter) {
+        d->ui->oldSslCheckBox->hide();
+    }
+
+    // Hide the group boxes if they are empty.
+    if ((!d->serverParameter) && (!d->portParameter)) {
+        d->ui->serverGroupBox->hide();
+    }
+
+    if ((!d->keepaliveIntervalParameter) && (!d->lowBandwidthParameter)) {
+        d->ui->connectionGroupBox->hide();
+    }
+
+    if ((!d->requireEncryptionParameter) &&
+        (!d->ignoreSslErrorsParameter) &&
+        (!d->oldSslParameter)) {
+        d->ui->securityGroupBox->hide();
+    }
+}
+
+ServerSettingsWidget::~ServerSettingsWidget()
+{
+    kDebug();
+
+    delete d;
+}
+
+QMap<Tp::ProtocolParameter*, QVariant> ServerSettingsWidget::parameterValues() const
+{
+    kDebug();
+
+    QMap<Tp::ProtocolParameter*, QVariant> 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->portParameter) {
+        parameters.insert(d->portParameter, d->ui->portLineEdit->value());
+    }
+
+    if (d->keepaliveIntervalParameter) {
+        parameters.insert(d->keepaliveIntervalParameter, d->ui->keepaliveIntervalLineEdit->value());
+    }
+
+    if (d->lowBandwidthParameter) {
+        parameters.insert(d->lowBandwidthParameter, d->ui->lowBandwidthCheckBox->isChecked());
+    }
+
+    if (d->requireEncryptionParameter) {
+        parameters.insert(d->requireEncryptionParameter,
+                          d->ui->requireEncryptionCheckBox->isChecked());
+    }
+
+    if (d->ignoreSslErrorsParameter) {
+        parameters.insert(d->ignoreSslErrorsParameter, d->ui->ignoreSslErrorsCheckBox->isChecked());
+    }
+
+    if (d->oldSslParameter) {
+        parameters.insert(d->oldSslParameter, d->ui->oldSslCheckBox->isChecked());
+    }
+
+    return parameters;
+}
+
+bool ServerSettingsWidget::validateParameterValues()
+{
+    return true;
+}
+
+
+#include "server-settings-widget.moc"
+
diff --git a/gabble/mandatory-parameters-widget.h b/gabble/server-settings-widget.h
similarity index 77%
copy from gabble/mandatory-parameters-widget.h
copy to gabble/server-settings-widget.h
index 321fe9f..19d414e 100644
--- a/gabble/mandatory-parameters-widget.h
+++ b/gabble/server-settings-widget.h
@@ -18,26 +18,26 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef KCMTELEPATHYACCOUNTS_PLUGIN_GABBLE_ACCOUNT_PARAMETERS_WIDGET_H
-#define KCMTELEPATHYACCOUNTS_PLUGIN_GABBLE_ACCOUNT_PARAMETERS_WIDGET_H
+#ifndef KCMTELEPATHYACCOUNTS_PLUGIN_GABBLE_SERVER_SETTINGS_WIDGET_H
+#define KCMTELEPATHYACCOUNTS_PLUGIN_GABBLE_SERVER_SETTINGS_WIDGET_H
 
 #include <KCMTelepathyAccounts/AbstractAccountParametersWidget>
 
-class MandatoryParametersWidget : public AbstractAccountParametersWidget
+class ServerSettingsWidget : public AbstractAccountParametersWidget
 {
     Q_OBJECT
 
 public:
-    explicit MandatoryParametersWidget(Tp::ProtocolParameterList parameters,
+    explicit ServerSettingsWidget(Tp::ProtocolParameterList parameters,
                                        const QVariantMap &values = QVariantMap(),
                                        QWidget *parent = 0);
-    virtual ~MandatoryParametersWidget();
+    virtual ~ServerSettingsWidget();
 
     virtual QMap<Tp::ProtocolParameter*, QVariant> parameterValues() const;
     virtual bool validateParameterValues();
 
 private:
-    Q_DISABLE_COPY(MandatoryParametersWidget);
+    Q_DISABLE_COPY(ServerSettingsWidget);
 
     class Private;
     Private * const d;
diff --git a/gabble/server-settings-widget.ui b/gabble/server-settings-widget.ui
new file mode 100644
index 0000000..caff0b3
--- /dev/null
+++ b/gabble/server-settings-widget.ui
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ServerSettingsWidget</class>
+ <widget class="QWidget" name="ServerSettingsWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>431</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_4">
+   <item>
+    <widget class="QGroupBox" name="serverGroupBox">
+     <property name="title">
+      <string>Server Settings</string>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_3">
+        <item>
+         <widget class="QLabel" name="serverLabel">
+          <property name="text">
+           <string>Server Address:</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="KLineEdit" name="serverLineEdit"/>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_2">
+        <item>
+         <widget class="QLabel" name="portLabel">
+          <property name="text">
+           <string>Server Port:</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="UnsignedIntegerEdit" name="portLineEdit"/>
+        </item>
+       </layout>
+      </item>
+     </layout>
+     <zorder></zorder>
+     <zorder></zorder>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="connectionGroupBox">
+     <property name="title">
+      <string>Connection Settings</string>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout_2">
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout">
+        <item>
+         <widget class="QLabel" name="keepaliveIntervalLabel">
+          <property name="text">
+           <string>Keep Alive Interval:</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="UnsignedIntegerEdit" name="keepaliveIntervalLineEdit"/>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <widget class="QCheckBox" name="lowBandwidthCheckBox">
+        <property name="text">
+         <string>Use Low Bandwidth Mode.</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="securityGroupBox">
+     <property name="title">
+      <string>Security Settings</string>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout_3">
+      <item>
+       <widget class="QCheckBox" name="requireEncryptionCheckBox">
+        <property name="text">
+         <string>Require Encrypted Connection.</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QCheckBox" name="ignoreSslErrorsCheckBox">
+        <property name="text">
+         <string>Ignore SSL Errors.</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QCheckBox" name="oldSslCheckBox">
+        <property name="text">
+         <string>Use Old-Style SSL.</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>KLineEdit</class>
+   <extends>QLineEdit</extends>
+   <header>klineedit.h</header>
+  </customwidget>
+  <customwidget>
+   <class>UnsignedIntegerEdit</class>
+   <extends>QLineEdit</extends>
+   <header location="global">KCMTelepathyAccounts/UnsignedIntegerEdit</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>

-- 
ktp-accounts-kcm packaging



More information about the pkg-kde-commits mailing list