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


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

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

    Add a widget for proxy/stun/conference server settings.
    
    svn path=/trunk/playground/network/telepathy-accounts-kcm-plugins/; revision=1009626
---
 gabble/CMakeLists.txt                              |   2 +
 gabble/gabble-account-ui.cpp                       |  11 +
 gabble/proxy-settings-widget.cpp                   | 296 +++++++++++++++++++++
 ...r-settings-widget.h => proxy-settings-widget.h} |  16 +-
 gabble/proxy-settings-widget.ui                    | 182 +++++++++++++
 5 files changed, 499 insertions(+), 8 deletions(-)

diff --git a/gabble/CMakeLists.txt b/gabble/CMakeLists.txt
index 1274d2d..e480980 100644
--- a/gabble/CMakeLists.txt
+++ b/gabble/CMakeLists.txt
@@ -9,11 +9,13 @@ set (kcmtelepathyaccounts_plugin_gabble_SRCS
      gabble-account-ui.cpp
      mandatory-parameters-widget.cpp
      server-settings-widget.cpp
+     proxy-settings-widget.cpp
 )
 
 kde4_add_ui_files (kcmtelepathyaccounts_plugin_gabble_SRCS
                    mandatory-parameters-widget.ui
                    server-settings-widget.ui
+                   proxy-settings-widget.ui
 )
 
 kde4_add_plugin (kcmtelepathyaccounts_plugin_gabble
diff --git a/gabble/gabble-account-ui.cpp b/gabble/gabble-account-ui.cpp
index 390fe1f..64bdd8a 100644
--- a/gabble/gabble-account-ui.cpp
+++ b/gabble/gabble-account-ui.cpp
@@ -21,6 +21,7 @@
 #include "gabble-account-ui.h"
 
 #include "mandatory-parameters-widget.h"
+#include "proxy-settings-widget.h"
 #include "server-settings-widget.h"
 
 #include <KCMTelepathyAccounts/AbstractAccountParametersWidget>
@@ -53,6 +54,15 @@ GabbleAccountUi::GabbleAccountUi(QObject *parent)
     registerSupportedOptionalParameter("low-bandwidth", QVariant::Bool);
     registerSupportedOptionalParameter("ignore-ssl-errors", QVariant::Bool);
     registerSupportedOptionalParameter("keepalive-interval", QVariant::UInt);
+
+    registerSupportedOptionalParameter("stun-server", QVariant::String);
+    registerSupportedOptionalParameter("stun-port", QVariant::UInt);
+    registerSupportedOptionalParameter("fallback-stun-server", QVariant::String);
+    registerSupportedOptionalParameter("fallback-stun-port", QVariant::UInt);
+    registerSupportedOptionalParameter("https-proxy-server", QVariant::String);
+    registerSupportedOptionalParameter("https-proxy-port", QVariant::UInt);
+    registerSupportedOptionalParameter("fallback-socks5-proxies", QVariant::StringList);
+    registerSupportedOptionalParameter("fallback-conference-server", QVariant::String);
 }
 
 GabbleAccountUi::~GabbleAccountUi()
@@ -81,6 +91,7 @@ QList<AbstractAccountParametersWidget*> GabbleAccountUi::optionalParametersWidge
 
     // Add each of the optional parameter widgets.
     widgets.append(new ServerSettingsWidget(parameters, values));
+    widgets.append(new ProxySettingsWidget(parameters, values));
 
     return widgets;
 }
diff --git a/gabble/proxy-settings-widget.cpp b/gabble/proxy-settings-widget.cpp
new file mode 100644
index 0000000..959c86e
--- /dev/null
+++ b/gabble/proxy-settings-widget.cpp
@@ -0,0 +1,296 @@
+/*
+ * 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 "proxy-settings-widget.h"
+
+#include "ui_proxy-settings-widget.h"
+
+#include <KDebug>
+#include <KMessageBox>
+
+class ProxySettingsWidget::Private
+{
+public:
+    Private()
+            : stunServerParameter(0),
+              stunPortParameter(0),
+              fallbackStunServerParameter(0),
+              fallbackStunPortParameter(0),
+              httpsProxyServerParameter(0),
+              httpsProxyPortParameter(0),
+              fallbackSocks5ProxiesParameter(0),
+              fallbackConferenceServerParameter(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;
+
+    Ui::ProxySettingsWidget *ui;
+};
+
+ProxySettingsWidget::ProxySettingsWidget(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() == "stun-server") && (parameter->type() == QVariant::String)) {
+            if (!d->stunServerParameter) {
+                d->stunServerParameter = parameter;
+            }
+        } else if ((parameter->name() == "stun-port") && (parameter->type() == QVariant::UInt)) {
+            if (!d->stunPortParameter) {
+                d->stunPortParameter = parameter;
+            }
+        } else if ((parameter->name() == "fallback-stun-server") &&
+                   (parameter->type() == QVariant::String)) {
+            if (!d->fallbackStunServerParameter) {
+                d->fallbackStunServerParameter = parameter;
+            }
+        } else if ((parameter->name() == "fallback-stun-port") &&
+                   (parameter->type() == QVariant::UInt)) {
+            if (!d->fallbackStunPortParameter) {
+                d->fallbackStunPortParameter = parameter;
+            }
+        } else if ((parameter->name() == "https-proxy-server") &&
+                   (parameter->type() == QVariant::String)) {
+            if (!d->httpsProxyServerParameter) {
+                d->httpsProxyServerParameter = parameter;
+            }
+        } else if ((parameter->name() == "https-proxy-port") &&
+                   (parameter->type() == QVariant::UInt)) {
+            if (!d->httpsProxyPortParameter) {
+                d->httpsProxyPortParameter = parameter;
+            }
+        } else if ((parameter->name() == "fallback-socks5-proxies") &&
+                   (parameter->type() == QVariant::StringList)) {
+            if (!d->fallbackSocks5ProxiesParameter) {
+                d->fallbackSocks5ProxiesParameter = parameter;
+            }
+        } else if ((parameter->name() == "fallback-conference-server") &&
+                   (parameter->type() == QVariant::String)) {
+            if (!d->fallbackConferenceServerParameter) {
+                d->fallbackConferenceServerParameter = parameter;
+            }
+        }
+    }
+
+    // Set up the UI.
+    d->ui = new Ui::ProxySettingsWidget;
+    d->ui->setupUi(this);
+
+    // Prefill UI elements if appropriate.
+    if (d->stunServerParameter) {
+        if (values.contains(d->stunServerParameter->name())) {
+            d->ui->stunServerLineEdit->setText(values.value(
+                    d->stunServerParameter->name()).toString());
+        }
+    }
+
+    if (d->stunPortParameter) {
+        if (values.contains(d->stunPortParameter->name())) {
+            d->ui->stunPortLineEdit->setValue(values.value(d->stunPortParameter->name()).toUInt());
+        }
+    }
+
+    if (d->fallbackStunServerParameter) {
+        if (values.contains(d->fallbackStunServerParameter->name())) {
+            d->ui->fallbackStunServerLineEdit->setText(values.value(
+                    d->fallbackStunServerParameter->name()).toString());
+        }
+    }
+
+    if (d->fallbackStunPortParameter) {
+        if (values.contains(d->fallbackStunPortParameter->name())) {
+            d->ui->fallbackStunPortLineEdit->setValue(values.value(
+                    d->fallbackStunPortParameter->name()).toUInt());
+        }
+    }
+
+    if (d->httpsProxyServerParameter) {
+        if (values.contains(d->httpsProxyServerParameter->name())) {
+            d->ui->httpsProxyServerLineEdit->setText(values.value(
+                    d->httpsProxyServerParameter->name()).toString());
+        }
+    }
+
+    if (d->httpsProxyPortParameter) {
+        if (values.contains(d->httpsProxyPortParameter->name())) {
+            d->ui->httpsProxyPortLineEdit->setValue(values.value(
+                    d->httpsProxyPortParameter->name()).toUInt());
+        }
+    }
+
+    if (d->fallbackSocks5ProxiesParameter) {
+        if (values.contains(d->fallbackSocks5ProxiesParameter->name())) {
+            foreach (const QString &line,
+                     values.value(d->fallbackSocks5ProxiesParameter->name()).toStringList()) {
+                d->ui->fallbackSocks5ProxiesTextEdit->append(line);
+            }
+        }
+    }
+
+    if (d->fallbackConferenceServerParameter) {
+        if (values.contains(d->fallbackConferenceServerParameter->name())) {
+            d->ui->fallbackConferenceServerLineEdit->setText(values.value(
+                    d->fallbackConferenceServerParameter->name()).toString());
+        }
+    }
+
+    // Hide any elements we don't have the parameters passed to show.
+    if (!d->stunServerParameter) {
+        d->ui->stunServerLabel->hide();
+        d->ui->stunServerLineEdit->hide();
+    }
+
+    if (!d->stunPortParameter) {
+        d->ui->stunPortLabel->hide();
+        d->ui->stunPortLineEdit->hide();
+    }
+
+    if (!d->fallbackStunServerParameter) {
+        d->ui->fallbackStunServerLabel->hide();
+        d->ui->fallbackStunServerLineEdit->hide();
+    }
+
+    if (!d->fallbackStunPortParameter) {
+        d->ui->fallbackStunPortLabel->hide();
+        d->ui->fallbackStunPortLineEdit->hide();
+    }
+
+    if (!d->httpsProxyServerParameter) {
+        d->ui->httpsProxyServerLabel->hide();
+        d->ui->httpsProxyServerLineEdit->hide();
+    }
+
+    if (!d->httpsProxyPortParameter) {
+        d->ui->httpsProxyPortLabel->hide();
+        d->ui->httpsProxyPortLineEdit->hide();
+    }
+
+    if (!d->fallbackSocks5ProxiesParameter) {
+        d->ui->fallbackSocks5ProxiesLabel->hide();
+        d->ui->fallbackSocks5ProxiesTextEdit->hide();
+    }
+
+    if (!d->fallbackConferenceServerParameter) {
+        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)) {
+        d->ui->stunGroupBox->hide();
+    }
+
+    if ((!d->httpsProxyServerParameter) &&
+        (!d->httpsProxyPortParameter) &&
+        (!d->fallbackSocks5ProxiesParameter)) {
+        d->ui->proxyGroupBox->hide();
+    }
+
+    if (!d->fallbackConferenceServerParameter) {
+        d->ui->conferenceGroupBox->hide();
+    }
+}
+
+ProxySettingsWidget::~ProxySettingsWidget()
+{
+    kDebug();
+
+    delete d;
+}
+
+QMap<Tp::ProtocolParameter*, QVariant> ProxySettingsWidget::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->stunServerParameter) {
+        parameters.insert(d->stunServerParameter, d->ui->stunServerLineEdit->text());
+    }
+
+    if (d->stunPortParameter) {
+        parameters.insert(d->stunPortParameter, d->ui->stunPortLineEdit->value());
+    }
+
+    if (d->fallbackStunServerParameter) {
+        parameters.insert(d->fallbackStunServerParameter,
+                          d->ui->fallbackStunServerLineEdit->text());
+    }
+
+    if (d->fallbackStunPortParameter) {
+        parameters.insert(d->fallbackStunPortParameter, d->ui->fallbackStunPortLineEdit->value());
+    }
+
+    if (d->httpsProxyServerParameter) {
+        parameters.insert(d->httpsProxyServerParameter, d->ui->httpsProxyServerLineEdit->text());
+    }
+
+    if (d->httpsProxyPortParameter) {
+        parameters.insert(d->httpsProxyPortParameter, d->ui->httpsProxyPortLineEdit->value());
+    }
+
+    if (d->fallbackSocks5ProxiesParameter) {
+        QString text = d->ui->fallbackSocks5ProxiesTextEdit->toPlainText();
+        QStringList value = text.split("
", QString::SkipEmptyParts);
+        parameters.insert(d->fallbackSocks5ProxiesParameter, value);
+    }
+
+    if (d->fallbackConferenceServerParameter) {
+        parameters.insert(d->fallbackConferenceServerParameter,
+                          d->ui->fallbackConferenceServerLineEdit->text());
+    }
+
+    return parameters;
+}
+
+bool ProxySettingsWidget::validateParameterValues()
+{
+    kDebug();
+
+    return true;
+}
+
+
+#include "proxy-settings-widget.moc"
+
diff --git a/gabble/server-settings-widget.h b/gabble/proxy-settings-widget.h
similarity index 69%
copy from gabble/server-settings-widget.h
copy to gabble/proxy-settings-widget.h
index 19d414e..ef064ed 100644
--- a/gabble/server-settings-widget.h
+++ b/gabble/proxy-settings-widget.h
@@ -18,26 +18,26 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef KCMTELEPATHYACCOUNTS_PLUGIN_GABBLE_SERVER_SETTINGS_WIDGET_H
-#define KCMTELEPATHYACCOUNTS_PLUGIN_GABBLE_SERVER_SETTINGS_WIDGET_H
+#ifndef KCMTELEPATHYACCOUNTS_PLUGIN_GABBLE_PROXY_SETTINGS_WIDGET_H
+#define KCMTELEPATHYACCOUNTS_PLUGIN_GABBLE_PROXY_SETTINGS_WIDGET_H
 
 #include <KCMTelepathyAccounts/AbstractAccountParametersWidget>
 
-class ServerSettingsWidget : public AbstractAccountParametersWidget
+class ProxySettingsWidget : public AbstractAccountParametersWidget
 {
     Q_OBJECT
 
 public:
-    explicit ServerSettingsWidget(Tp::ProtocolParameterList parameters,
-                                       const QVariantMap &values = QVariantMap(),
-                                       QWidget *parent = 0);
-    virtual ~ServerSettingsWidget();
+    explicit ProxySettingsWidget(Tp::ProtocolParameterList parameters,
+                                 const QVariantMap &values = QVariantMap(),
+                                 QWidget *parent = 0);
+    virtual ~ProxySettingsWidget();
 
     virtual QMap<Tp::ProtocolParameter*, QVariant> parameterValues() const;
     virtual bool validateParameterValues();
 
 private:
-    Q_DISABLE_COPY(ServerSettingsWidget);
+    Q_DISABLE_COPY(ProxySettingsWidget);
 
     class Private;
     Private * const d;
diff --git a/gabble/proxy-settings-widget.ui b/gabble/proxy-settings-widget.ui
new file mode 100644
index 0000000..f756d37
--- /dev/null
+++ b/gabble/proxy-settings-widget.ui
@@ -0,0 +1,182 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ProxySettingsWidget</class>
+ <widget class="QWidget" name="ProxySettingsWidget">
+  <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="stunGroupBox">
+     <property name="title">
+      <string>STUN Server Settings</string>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_3">
+        <item>
+         <widget class="QLabel" name="stunServerLabel">
+          <property name="text">
+           <string>STUN Server:</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="KLineEdit" name="stunServerLineEdit"/>
+        </item>
+        <item>
+         <widget class="QLabel" name="stunPortLabel">
+          <property name="text">
+           <string>Port:</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="UnsignedIntegerEdit" name="stunPortLineEdit">
+          <property name="maximumSize">
+           <size>
+            <width>60</width>
+            <height>16777215</height>
+           </size>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_2">
+        <item>
+         <widget class="QLabel" name="fallbackStunServerLabel">
+          <property name="text">
+           <string>Fallback STUN Server:</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="KLineEdit" name="fallbackStunServerLineEdit"/>
+        </item>
+        <item>
+         <widget class="QLabel" name="fallbackStunPortLabel">
+          <property name="text">
+           <string>Port:</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="UnsignedIntegerEdit" name="fallbackStunPortLineEdit">
+          <property name="maximumSize">
+           <size>
+            <width>60</width>
+            <height>16777215</height>
+           </size>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="proxyGroupBox">
+     <property name="title">
+      <string>Proxy Settings</string>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout_2">
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_4">
+        <item>
+         <widget class="QLabel" name="httpsProxyServerLabel">
+          <property name="text">
+           <string>HTTPS Proxy Server:</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="KLineEdit" name="httpsProxyServerLineEdit"/>
+        </item>
+        <item>
+         <widget class="QLabel" name="httpsProxyPortLabel">
+          <property name="text">
+           <string>Port:</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="UnsignedIntegerEdit" name="httpsProxyPortLineEdit">
+          <property name="maximumSize">
+           <size>
+            <width>60</width>
+            <height>16777215</height>
+           </size>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <widget class="QLabel" name="fallbackSocks5ProxiesLabel">
+        <property name="text">
+         <string>Fallback SOCKS 5 Proxy Servers:</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="KTextEdit" name="fallbackSocks5ProxiesTextEdit"/>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="conferenceGroupBox">
+     <property name="title">
+      <string>Conference Server Settings</string>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout_3">
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout">
+        <item>
+         <widget class="QLabel" name="fallbackConferenceServerLabel">
+          <property name="text">
+           <string>Fallback Conference Server:</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="KLineEdit" name="fallbackConferenceServerLineEdit"/>
+        </item>
+       </layout>
+      </item>
+     </layout>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>KLineEdit</class>
+   <extends>QLineEdit</extends>
+   <header>klineedit.h</header>
+  </customwidget>
+  <customwidget>
+   <class>KTextEdit</class>
+   <extends>QTextEdit</extends>
+   <header>ktextedit.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