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


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

The following commit has been merged in the master branch:
commit d2db0909193bd84036d5a2200bc3ac45494059c2
Author: Dominik Schmidt <dev at dominik-schmidt.de>
Date:   Thu Jan 13 23:26:38 2011 +0100

    Port haze(-icq) plugin to the new plugin api.
---
 haze/CMakeLists.txt                 |   2 -
 haze/haze-account-ui-plugin.h       |   2 +-
 haze/haze-icq-account-ui.cpp        |  13 +--
 haze/haze-icq-account-ui.h          |   8 +-
 haze/icq-main-options-widget.cpp    |  38 +------
 haze/icq-main-options-widget.h      |   8 +-
 haze/icq-server-settings-widget.cpp | 193 ++----------------------------------
 haze/icq-server-settings-widget.h   |   8 +-
 8 files changed, 25 insertions(+), 247 deletions(-)

diff --git a/haze/CMakeLists.txt b/haze/CMakeLists.txt
index b7a7a99..da6e2ba 100644
--- a/haze/CMakeLists.txt
+++ b/haze/CMakeLists.txt
@@ -8,9 +8,7 @@ set (kcmtelepathyaccounts_plugin_haze_SRCS
      haze-account-ui-plugin.cpp
      haze-icq-account-ui.cpp
      icq-main-options-widget.cpp
-    
      icq-server-settings-widget.cpp
-    
 )
 
 kde4_add_ui_files (kcmtelepathyaccounts_plugin_haze_SRCS
diff --git a/haze/haze-account-ui-plugin.h b/haze/haze-account-ui-plugin.h
index 61430cb..b208d7a 100644
--- a/haze/haze-account-ui-plugin.h
+++ b/haze/haze-account-ui-plugin.h
@@ -1,7 +1,7 @@
 /*
  * This file is part of telepathy-accounts-kcm
  *
- * Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright (C) 2011 Dominik Schmidt <kde at dominik-schmidt.de>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
diff --git a/haze/haze-icq-account-ui.cpp b/haze/haze-icq-account-ui.cpp
index 546b25a..98f3ce3 100644
--- a/haze/haze-icq-account-ui.cpp
+++ b/haze/haze-icq-account-ui.cpp
@@ -57,7 +57,6 @@ HazeIcqAccountUi::HazeIcqAccountUi(QObject *parent)
     registerSupportedParameter("always-use-rv-proxy", QVariant::Bool);
     registerSupportedParameter("allow-multiple-logins", QVariant::Bool);
     registerSupportedParameter("charset", QVariant::String);
-    
 }
 
 HazeIcqAccountUi::~HazeIcqAccountUi()
@@ -68,13 +67,12 @@ HazeIcqAccountUi::~HazeIcqAccountUi()
 }
 
 AbstractAccountParametersWidget *HazeIcqAccountUi::mainOptionsWidget(
-        Tp::ProtocolParameterList parameters,
-        const QVariantMap &values,
+        ParameterEditModel *model,
         QWidget *parent) const
 {
     kDebug();
 
-    return new IcqMainOptionsWidget(parameters, values, parent);
+    return new IcqMainOptionsWidget(model, parent);
 }
 
 bool HazeIcqAccountUi::hasAdvancedOptionsWidget() const
@@ -83,14 +81,13 @@ bool HazeIcqAccountUi::hasAdvancedOptionsWidget() const
 }
 
 AbstractAccountParametersWidget *HazeIcqAccountUi::advancedOptionsWidget(
-        Tp::ProtocolParameterList parameters,
-        const QVariantMap &values,
+        ParameterEditModel *model,
         QWidget *parent) const
 {
     kDebug();
 
-    GenericAdvancedOptionsWidget *advancedOptionsWidget = new GenericAdvancedOptionsWidget(parameters, values, parent);
-    AbstractAccountParametersWidget *icqServerSettingsWidget = new IcqServerSettingsWidget(parameters, values, 0);
+    GenericAdvancedOptionsWidget *advancedOptionsWidget = new GenericAdvancedOptionsWidget(model, parent);
+    AbstractAccountParametersWidget *icqServerSettingsWidget = new IcqServerSettingsWidget(model, parent);
     advancedOptionsWidget->addTab(icqServerSettingsWidget, "Server");
     return advancedOptionsWidget;
 }
diff --git a/haze/haze-icq-account-ui.h b/haze/haze-icq-account-ui.h
index 2c8fba3..bff28a4 100644
--- a/haze/haze-icq-account-ui.h
+++ b/haze/haze-icq-account-ui.h
@@ -1,7 +1,7 @@
 /*
  * This file is part of telepathy-accounts-kcm
  *
- * Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright (C) 2011 Dominik Schmidt <kde at dominik-schmidt.de>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -32,13 +32,11 @@ public:
     virtual ~HazeIcqAccountUi();
 
     virtual AbstractAccountParametersWidget
-              *mainOptionsWidget(Tp::ProtocolParameterList parameters,
-                                 const QVariantMap &values = QVariantMap(),
+              *mainOptionsWidget(ParameterEditModel *model,
                                  QWidget *parent = 0) const;
     virtual bool hasAdvancedOptionsWidget() const;
     virtual AbstractAccountParametersWidget
-              *advancedOptionsWidget(Tp::ProtocolParameterList parameters,
-                                     const QVariantMap &values = QVariantMap(),
+              *advancedOptionsWidget(ParameterEditModel *model,
                                      QWidget *parent = 0) const;
 
 private:
diff --git a/haze/icq-main-options-widget.cpp b/haze/icq-main-options-widget.cpp
index 56613c7..fe933d2 100644
--- a/haze/icq-main-options-widget.cpp
+++ b/haze/icq-main-options-widget.cpp
@@ -42,18 +42,12 @@ public:
         kDebug();
     }
 
-    ParametersWidgetsMap parameters;
-    
-    Tp::ProtocolParameter accountParameter;
-    Tp::ProtocolParameter passwordParameter;
-
     Ui::IcqMainOptionsWidget *ui;
 };
 
-IcqMainOptionsWidget::IcqMainOptionsWidget(Tp::ProtocolParameterList parameters,
-                                     const QVariantMap &values,
+IcqMainOptionsWidget::IcqMainOptionsWidget(ParameterEditModel *model,
                                      QWidget *parent)
- : AbstractAccountParametersWidget(parameters, values, parent),
+ : AbstractAccountParametersWidget(model, parent),
    d(new Private)
 {
     kDebug();
@@ -62,11 +56,8 @@ IcqMainOptionsWidget::IcqMainOptionsWidget(Tp::ProtocolParameterList parameters,
     d->ui = new Ui::IcqMainOptionsWidget;
     d->ui->setupUi(this);
 
-    handleParameter(parameters, "account", QVariant::String, d->ui->accountLineEdit, d->ui->accountLabel);
-    handleParameter(parameters, "password", QVariant::String, d->ui->passwordLineEdit, d->ui->passwordLabel);
-
-    // Prefill UI elements if appropriate.
-    prefillUI(values);
+    handleParameter("account", QVariant::String, d->ui->accountLineEdit, d->ui->accountLabel);
+    handleParameter("password", QVariant::String, d->ui->passwordLineEdit, d->ui->passwordLabel);
 }
 
 IcqMainOptionsWidget::~IcqMainOptionsWidget()
@@ -76,26 +67,5 @@ IcqMainOptionsWidget::~IcqMainOptionsWidget()
     delete d;
 }
 
-ParametersWidgetsMap* IcqMainOptionsWidget::internalParametersWidgetsMap() const
-{
-    return &(d->parameters);
-}
-
-bool IcqMainOptionsWidget::validateParameterValues()
-{
-    kDebug();
-
-    // Username is currently the only required parameter
-    if (d->ui->accountLineEdit->text().isEmpty()) {
-        kDebug() << "Returning false and alerting the user.";
-
-        KMessageBox::error(this, i18n("Please enter an ICQ UIN."));
-
-        return false;
-    }
-
-    return true;
-}
-
 #include "icq-main-options-widget.moc"
 
diff --git a/haze/icq-main-options-widget.h b/haze/icq-main-options-widget.h
index 96c14f0..ea62316 100644
--- a/haze/icq-main-options-widget.h
+++ b/haze/icq-main-options-widget.h
@@ -30,16 +30,10 @@ class IcqMainOptionsWidget : public AbstractAccountParametersWidget
     Q_OBJECT
 
 public:
-    explicit IcqMainOptionsWidget(Tp::ProtocolParameterList parameters,
-                               const QVariantMap &values = QVariantMap(),
+    explicit IcqMainOptionsWidget(ParameterEditModel *model,
                                QWidget *parent = 0);
     virtual ~IcqMainOptionsWidget();
 
-    virtual bool validateParameterValues();
-
-protected:
-    virtual ParametersWidgetsMap* internalParametersWidgetsMap() const;
-
 private:
     Q_DISABLE_COPY(IcqMainOptionsWidget);
 
diff --git a/haze/icq-server-settings-widget.cpp b/haze/icq-server-settings-widget.cpp
index 00407bc..9e69ad2 100644
--- a/haze/icq-server-settings-widget.cpp
+++ b/haze/icq-server-settings-widget.cpp
@@ -1,7 +1,7 @@
 /*
  * This file is part of telepathy-accounts-kcm
  *
- * Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright (C) 2011 Dominik Schmidt <kde at dominik-schmidt.de>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -37,157 +37,26 @@ public:
         kDebug();
     }
 
-    Tp::ProtocolParameter serverParameter;
-    Tp::ProtocolParameter portParameter;
-    Tp::ProtocolParameter useSslParameter;
-    Tp::ProtocolParameter alwaysUseRvProxyParameter;
-    Tp::ProtocolParameter allowMultipleLoginsParameter;
-    Tp::ProtocolParameter charsetParameter;
-
     Ui::IcqServerSettingsWidget *ui;
 };
 
-IcqServerSettingsWidget::IcqServerSettingsWidget(Tp::ProtocolParameterList parameters,
-                                                     const QVariantMap &values,
+IcqServerSettingsWidget::IcqServerSettingsWidget(ParameterEditModel *model,
                                                      QWidget *parent)
- : AbstractAccountParametersWidget(parameters, values, parent),
+ : AbstractAccountParametersWidget(model, parent),
    d(new Private)
 {
     kDebug();
 
-    // Store the parameters this widget supports
-    foreach (const Tp::ProtocolParameter &parameter, parameters) {
-
-        kDebug() << parameter.name() << parameter.type();
-        
-        if ((parameter.name() == "server") && (parameter.type() == QVariant::String)) {
-            d->serverParameter = parameter;
-        } else if ((parameter.name() == "port") && (parameter.type() == QVariant::Int)) {
-            d->portParameter = parameter;
-        } else if ((parameter.name() == "use-ssl") && (parameter.type() == QVariant::Bool)) {
-            d->useSslParameter = parameter;
-        } else if ((parameter.name() == "always-use-rv-proxy") && (parameter.type() == QVariant::Bool)) {
-            d->alwaysUseRvProxyParameter = parameter;
-        } else if ((parameter.name() == "allow-multiple-logins") && (parameter.type() == QVariant::Bool)) {
-            d->allowMultipleLoginsParameter = parameter;
-        } else if ((parameter.name() == "charset") && (parameter.type() == QVariant::String)) {
-            d->charsetParameter = parameter;
-        }
-    }
-
     // Set up the UI.
     d->ui = new Ui::IcqServerSettingsWidget;
     d->ui->setupUi(this);
 
-    /*
-     * First subformular
-     */
-
-    // Prefill UI elements if appropriate.
-    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());
-        }
-    }
-
-    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());
-        }
-    }
-
-    // Hide any elements we don't have the parameters passed to show.
-    if (!d->serverParameter.isValid()) {
-        d->ui->serverLabel->hide();
-        d->ui->serverLineEdit->hide();
-    }
-
-    if (!d->portParameter.isValid()) {
-        d->ui->portLabel->hide();
-        d->ui->portSpinBox->hide();
-    }
-
-    // Hide the headline if they are empty.
-    if ((!d->serverParameter.isValid()) && (!d->portParameter.isValid())) {
-        d->ui->serverHeadlineLabel->hide();
-    }
-
-    /*
-     * Second subformular
-     */
-    if (d->useSslParameter.isValid()) {
-        if (values.contains(d->useSslParameter.name())) {
-            d->ui->useSslCheckBox->setChecked(values.value(d->useSslParameter.name()).toBool());
-        } else {
-            d->ui->useSslCheckBox->setChecked(d->useSslParameter.defaultValue().toBool());
-        }
-    }
-
-    if (d->allowMultipleLoginsParameter.isValid()) {
-        if (values.contains(d->allowMultipleLoginsParameter.name())) {
-            d->ui->allowMultipleLoginsCheckBox->setChecked(values.value(d->allowMultipleLoginsParameter.name()).toBool());
-        } else {
-            d->ui->allowMultipleLoginsCheckBox->setChecked(d->allowMultipleLoginsParameter.defaultValue().toBool());
-        }
-    }
-
-    // Hide any elements we don't have the parameters passed to show.
-    if (!d->useSslParameter.isValid()) {
-        d->ui->useSslCheckBox->hide();
-        // It's a checkbox, so no extra label here
-    }
-
-    if (!d->allowMultipleLoginsParameter.isValid()) {
-        d->ui->allowMultipleLoginsCheckBox->hide();
-        // It's a checkbox, so no extra label here
-    }
-    
-    // Hide the headline if they are empty.
-    if ((!d->useSslParameter.isValid()) && (!d->allowMultipleLoginsParameter.isValid())) {
-        d->ui->securityHeadlineLabel->hide();
-    }
-
-    /*
-     * Third subformular
-     */
-
-    // Prefill UI elements if appropriate.
-    if (d->charsetParameter.isValid()) {
-        if (values.contains(d->charsetParameter.name())) {
-            d->ui->charsetComboBox->setEditText(values.value(d->charsetParameter.name()).toString());
-        } else {
-            d->ui->charsetComboBox->setEditText(d->charsetParameter.defaultValue().toString());
-        }
-    }
-
-    if (d->alwaysUseRvProxyParameter.isValid()) {
-        if (values.contains(d->alwaysUseRvProxyParameter.name())) {
-            d->ui->alwaysUseRvProxyCheckBox->setChecked(values.value(d->alwaysUseRvProxyParameter.name()).toBool());
-        } else {
-            d->ui->alwaysUseRvProxyCheckBox->setChecked(d->alwaysUseRvProxyParameter.defaultValue().toBool());
-        }
-    }
-
-    // Hide any elements we don't have the parameters passed to show.
-    if (!d->charsetParameter.isValid()) {
-        d->ui->charsetComboBox->hide();
-        // It's a checkbox, so no extra label here
-    }
-
-    if (!d->alwaysUseRvProxyParameter.isValid()) {
-        d->ui->alwaysUseRvProxyCheckBox->hide();
-        // It's a checkbox, so no extra label here
-    }
-
-    // Hide the headline if they are empty.
-    if ((!d->charsetParameter.isValid()) && (!d->alwaysUseRvProxyParameter.isValid())) {
-        d->ui->otherHeadlineLabel->hide();
-    }
-    
+    handleParameter("server", QVariant::String, d->ui->serverLineEdit, d->ui->serverLabel);
+    handleParameter("port", QVariant::Int, d->ui->portSpinBox, d->ui->portLabel);
+    handleParameter("use-ssl", QVariant::Bool, d->ui->useSslCheckBox, 0);
+    handleParameter("allow-multiple-logins", QVariant::Bool, d->ui->allowMultipleLoginsCheckBox, 0);
+    handleParameter("always-use-rv-proxy", QVariant::Bool, d->ui->alwaysUseRvProxyCheckBox, 0);
+    handleParameter("charset", QVariant::String, d->ui->charsetComboBox, d->ui->charsetLabel);
 }
 
 IcqServerSettingsWidget::~IcqServerSettingsWidget()
@@ -197,49 +66,5 @@ IcqServerSettingsWidget::~IcqServerSettingsWidget()
     delete d;
 }
 
-QList<ProtocolParameterValue> IcqServerSettingsWidget::parameterValues() const
-{
-    kDebug();
-
-    QList<ProtocolParameterValue> parameters;
-
-    // Populate the map of parameters and their values with all the parameters this widget contains.
-    if (d->serverParameter.isValid()) {
-        parameters.append(ProtocolParameterValue(d->serverParameter, d->ui->serverLineEdit->text()));
-    }
-
-    if (d->portParameter.isValid()) {
-        parameters.append(ProtocolParameterValue(d->portParameter, d->ui->portSpinBox->value()));
-    }
-
-    if (d->useSslParameter.isValid()) {
-        parameters.append(ProtocolParameterValue(d->useSslParameter, d->ui->useSslCheckBox->isChecked()));
-    }
-
-    if (d->allowMultipleLoginsParameter.isValid()) {
-        parameters.append(ProtocolParameterValue(d->allowMultipleLoginsParameter, d->ui->allowMultipleLoginsCheckBox->isChecked()));
-    }
-
-    if (d->alwaysUseRvProxyParameter.isValid()) {
-        parameters.append(ProtocolParameterValue(d->alwaysUseRvProxyParameter, d->ui->alwaysUseRvProxyCheckBox->isChecked()));
-    }
-
-    if (d->charsetParameter.isValid()) {
-        parameters.append(ProtocolParameterValue(d->charsetParameter, d->ui->charsetComboBox->currentText()));
-    }
-
-    return parameters;
-}
-
-bool IcqServerSettingsWidget::validateParameterValues()
-{
-    kDebug();
-
-    //TODO: check which parameters need validation
-
-    return true;
-}
-
-
 #include "icq-server-settings-widget.moc"
 
diff --git a/haze/icq-server-settings-widget.h b/haze/icq-server-settings-widget.h
index 261b9b5..6353269 100644
--- a/haze/icq-server-settings-widget.h
+++ b/haze/icq-server-settings-widget.h
@@ -1,7 +1,7 @@
 /*
  * This file is part of telepathy-accounts-kcm
  *
- * Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright (C) 2011 Dominik Schmidt <kde at dominik-schmidt.de>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -28,14 +28,10 @@ class IcqServerSettingsWidget : public AbstractAccountParametersWidget
     Q_OBJECT
 
 public:
-    explicit IcqServerSettingsWidget(Tp::ProtocolParameterList parameters,
-                                       const QVariantMap &values = QVariantMap(),
+    explicit IcqServerSettingsWidget(ParameterEditModel *model,
                                        QWidget *parent = 0);
     virtual ~IcqServerSettingsWidget();
 
-    virtual QList<ProtocolParameterValue> parameterValues() const;
-    virtual bool validateParameterValues();
-
 private:
     Q_DISABLE_COPY(IcqServerSettingsWidget);
 

-- 
ktp-accounts-kcm packaging



More information about the pkg-kde-commits mailing list