[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:47 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-accounts-kcm.git;a=commitdiff;h=133da8b
The following commit has been merged in the master branch:
commit 133da8b741f5d5f9c98075d2acf11d79b5b2e033
Author: Dominik Schmidt <dev at dominik-schmidt.de>
Date: Thu Jan 13 21:50:14 2011 +0100
Port gabble plugin to the new plugin api.
---
gabble/gabble-account-ui.cpp | 15 +--
gabble/gabble-account-ui.h | 6 +-
gabble/main-options-widget.cpp | 81 +------------
gabble/main-options-widget.h | 6 +-
gabble/proxy-settings-widget.cpp | 243 ++------------------------------------
gabble/proxy-settings-widget.h | 6 +-
gabble/server-settings-widget.cpp | 198 ++-----------------------------
gabble/server-settings-widget.h | 6 +-
8 files changed, 34 insertions(+), 527 deletions(-)
diff --git a/gabble/gabble-account-ui.cpp b/gabble/gabble-account-ui.cpp
index 6297a3e..4a1ea98 100644
--- a/gabble/gabble-account-ui.cpp
+++ b/gabble/gabble-account-ui.cpp
@@ -74,13 +74,11 @@ GabbleAccountUi::~GabbleAccountUi()
}
AbstractAccountParametersWidget *GabbleAccountUi::mainOptionsWidget(
- Tp::ProtocolParameterList parameters,
- const QVariantMap &values,
+ ParameterEditModel *model,
QWidget *parent) const
{
- kDebug();
- return new MainOptionsWidget(parameters, values, parent);
+ return new MainOptionsWidget(model, parent);
}
bool GabbleAccountUi::hasAdvancedOptionsWidget() const
@@ -89,17 +87,16 @@ bool GabbleAccountUi::hasAdvancedOptionsWidget() const
}
AbstractAccountParametersWidget *GabbleAccountUi::advancedOptionsWidget(
- Tp::ProtocolParameterList parameters,
- const QVariantMap &values,
+ ParameterEditModel *model,
QWidget *parent) const
{
kDebug();
- GenericAdvancedOptionsWidget *widget = new GenericAdvancedOptionsWidget(parameters, values, parent);
+ GenericAdvancedOptionsWidget *widget = new GenericAdvancedOptionsWidget(model, parent);
- AbstractAccountParametersWidget* serverSettingsWidget = new ServerSettingsWidget(parameters, values, widget);
+ AbstractAccountParametersWidget* serverSettingsWidget = new ServerSettingsWidget(model, widget);
widget->addTab(serverSettingsWidget, "Server");
- AbstractAccountParametersWidget* proxySettingsWidget = new ProxySettingsWidget(parameters, values, widget);
+ AbstractAccountParametersWidget* proxySettingsWidget = new ProxySettingsWidget(model, widget);
widget->addTab(proxySettingsWidget, "Proxy");
return widget;
diff --git a/gabble/gabble-account-ui.h b/gabble/gabble-account-ui.h
index 73bdbdc..2b828e3 100644
--- a/gabble/gabble-account-ui.h
+++ b/gabble/gabble-account-ui.h
@@ -32,13 +32,11 @@ public:
virtual ~GabbleAccountUi();
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/gabble/main-options-widget.cpp b/gabble/main-options-widget.cpp
index 702fd7d..ce4cf7f 100644
--- a/gabble/main-options-widget.cpp
+++ b/gabble/main-options-widget.cpp
@@ -37,60 +37,22 @@ public:
kDebug();
}
- Tp::ProtocolParameter accountParameter;
- Tp::ProtocolParameter passwordParameter;
-
Ui::MainOptionsWidget *ui;
};
-MainOptionsWidget::MainOptionsWidget(Tp::ProtocolParameterList parameters,
- const QVariantMap &values,
+MainOptionsWidget::MainOptionsWidget(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 ¶meter, parameters) {
- if ((parameter.name() == "account") && (parameter.type() == QVariant::String)) {
- d->accountParameter = parameter;
- } else if ((parameter.name() == "password") && (parameter.type() == QVariant::String)) {
- d->passwordParameter = parameter;
- }
- }
-
// Set up the UI.
d->ui = new Ui::MainOptionsWidget;
d->ui->setupUi(this);
- // Prefill UI elements if appropriate.
- 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());
- }
- }
-
- 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());
- }
- }
-
- // Hide any elements we don't have the parameters passed to show.
- if (!d->accountParameter.isValid()) {
- d->ui->accountLabel->hide();
- d->ui->accountLineEdit->hide();
- }
-
- if (!d->passwordParameter.isValid()) {
- d->ui->passwordLabel->hide();
- d->ui->passwordLineEdit->hide();
- }
+ handleParameter("account", QVariant::String, d->ui->accountLineEdit, d->ui->accountLabel);
+ handleParameter("password", QVariant::String, d->ui->passwordLineEdit, d->ui->passwordLabel);
}
MainOptionsWidget::~MainOptionsWidget()
@@ -100,40 +62,5 @@ MainOptionsWidget::~MainOptionsWidget()
delete d;
}
-QList<ProtocolParameterValue> MainOptionsWidget::parameterValues() const
-{
- kDebug();
-
- QList<ProtocolParameterValue> parameters;
-
- // Populate the map of parameters and their values with all the parameters this widget contains.
- if (d->accountParameter.isValid()) {
- parameters.append(ProtocolParameterValue(d->accountParameter, d->ui->accountLineEdit->text()));
- }
-
- if (d->passwordParameter.isValid()) {
- parameters.append(ProtocolParameterValue(d->passwordParameter, d->ui->passwordLineEdit->text()));
- }
-
- return parameters;
-}
-
-bool MainOptionsWidget::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 a Jabber ID."));
-
- return false;
- }
-
- return true;
-}
-
-
#include "main-options-widget.moc"
diff --git a/gabble/main-options-widget.h b/gabble/main-options-widget.h
index a0ba4f3..7b04473 100644
--- a/gabble/main-options-widget.h
+++ b/gabble/main-options-widget.h
@@ -28,14 +28,10 @@ class MainOptionsWidget : public AbstractAccountParametersWidget
Q_OBJECT
public:
- explicit MainOptionsWidget(Tp::ProtocolParameterList parameters,
- const QVariantMap &values = QVariantMap(),
+ explicit MainOptionsWidget(ParameterEditModel *model,
QWidget *parent = 0);
virtual ~MainOptionsWidget();
- virtual QList<ProtocolParameterValue> parameterValues() const;
- virtual bool validateParameterValues();
-
private:
Q_DISABLE_COPY(MainOptionsWidget);
diff --git a/gabble/proxy-settings-widget.cpp b/gabble/proxy-settings-widget.cpp
index ce9c411..fe39ed5 100644
--- a/gabble/proxy-settings-widget.cpp
+++ b/gabble/proxy-settings-widget.cpp
@@ -37,197 +37,28 @@ public:
kDebug();
}
- 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,
+ProxySettingsWidget::ProxySettingsWidget(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 ¶meter, parameters) {
- if ((parameter.name() == "stun-server") && (parameter.type() == QVariant::String)) {
- d->stunServerParameter = parameter;
- } else if ((parameter.name() == "stun-port") && (parameter.type() == QVariant::UInt)) {
- d->stunPortParameter = parameter;
- } 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)) {
- d->fallbackStunPortParameter = parameter;
- } 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)) {
- d->httpsProxyPortParameter = parameter;
- } 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)) {
- d->fallbackConferenceServerParameter = parameter;
- }
- }
-
// Set up the UI.
d->ui = new Ui::ProxySettingsWidget;
d->ui->setupUi(this);
- // Prefill UI elements if appropriate.
- if (d->stunServerParameter.isValid()) {
- if (values.contains(d->stunServerParameter.name())) {
- d->ui->stunServerLineEdit->setText(values.value(
- d->stunServerParameter.name()).toString());
- } else {
- d->ui->stunServerLineEdit->setText(d->stunServerParameter.defaultValue().toString());
- }
- }
-
- 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());
- }
- }
-
- if (d->fallbackStunServerParameter.isValid()) {
- if (values.contains(d->fallbackStunServerParameter.name())) {
- d->ui->fallbackStunServerLineEdit->setText(values.value(
- d->fallbackStunServerParameter.name()).toString());
- } else {
- d->ui->fallbackStunServerLineEdit->setText(
- d->fallbackStunServerParameter.defaultValue().toString());
- }
- }
-
- if (d->fallbackStunPortParameter.isValid()) {
- if (values.contains(d->fallbackStunPortParameter.name())) {
- d->ui->fallbackStunPortSpinBox->setValue(values.value(
- d->fallbackStunPortParameter.name()).toUInt());
- } else {
- d->ui->fallbackStunPortSpinBox->setValue(
- d->fallbackStunPortParameter.defaultValue().toUInt());
- }
- }
-
- if (d->httpsProxyServerParameter.isValid()) {
- if (values.contains(d->httpsProxyServerParameter.name())) {
- d->ui->httpsProxyServerLineEdit->setText(values.value(
- d->httpsProxyServerParameter.name()).toString());
- } else {
- d->ui->httpsProxyServerLineEdit->setText(
- d->httpsProxyServerParameter.defaultValue().toString());
- }
- }
-
- if (d->httpsProxyPortParameter.isValid()) {
- if (values.contains(d->httpsProxyPortParameter.name())) {
- d->ui->httpsProxyPortSpinBox->setValue(values.value(
- d->httpsProxyPortParameter.name()).toUInt());
- } else {
- d->ui->httpsProxyPortSpinBox->setValue(
- d->httpsProxyPortParameter.defaultValue().toUInt());
- }
- }
-
- if (d->fallbackSocks5ProxiesParameter.isValid()) {
- if (values.contains(d->fallbackSocks5ProxiesParameter.name())) {
- foreach (const QString &line,
- values.value(d->fallbackSocks5ProxiesParameter.name()).toStringList()) {
- d->ui->fallbackSocks5ProxiesTextEdit->append(line);
- }
- } else {
- foreach (const QString &line,
- d->fallbackSocks5ProxiesParameter.defaultValue().toStringList()) {
- d->ui->fallbackSocks5ProxiesTextEdit->append(line);
- }
- }
- }
-
- if (d->fallbackConferenceServerParameter.isValid()) {
- if (values.contains(d->fallbackConferenceServerParameter.name())) {
- d->ui->fallbackConferenceServerLineEdit->setText(values.value(
- d->fallbackConferenceServerParameter.name()).toString());
- } else {
- d->ui->fallbackConferenceServerLineEdit->setText(
- d->fallbackConferenceServerParameter.defaultValue().toString());
- }
- }
-
- // Hide any elements we don't have the parameters passed to show.
- if (!d->stunServerParameter.isValid()) {
- d->ui->stunServerLabel->hide();
- d->ui->stunServerLineEdit->hide();
- }
-
- if (!d->stunPortParameter.isValid()) {
- d->ui->stunPortLabel->hide();
- d->ui->stunPortSpinBox->hide();
- }
-
- if (!d->fallbackStunServerParameter.isValid()) {
- d->ui->fallbackStunServerLabel->hide();
- d->ui->fallbackStunServerLineEdit->hide();
- }
-
- if (!d->fallbackStunPortParameter.isValid()) {
- d->ui->fallbackStunPortLabel->hide();
- d->ui->fallbackStunPortSpinBox->hide();
- }
-
- if (!d->httpsProxyServerParameter.isValid()) {
- d->ui->httpsProxyServerLabel->hide();
- d->ui->httpsProxyServerLineEdit->hide();
- }
-
- if (!d->httpsProxyPortParameter.isValid()) {
- d->ui->httpsProxyPortLabel->hide();
- d->ui->httpsProxyPortSpinBox->hide();
- }
-
- if (!d->fallbackSocks5ProxiesParameter.isValid()) {
- d->ui->fallbackSocks5ProxiesLabel->hide();
- d->ui->fallbackSocks5ProxiesTextEdit->hide();
- }
-
- if (!d->fallbackConferenceServerParameter.isValid()) {
- d->ui->fallbackConferenceServerLabel->hide();
- d->ui->fallbackConferenceServerLineEdit->hide();
- }
-
- // Hide the group boxes if they are empty.
- if ((!d->stunServerParameter.isValid()) &&
- (!d->stunPortParameter.isValid()) &&
- (!d->fallbackStunServerParameter.isValid()) &&
- (!d->fallbackStunPortParameter.isValid())) {
- d->ui->stunGroupBox->hide();
- }
-
- if ((!d->httpsProxyServerParameter.isValid()) &&
- (!d->httpsProxyPortParameter.isValid()) &&
- (!d->fallbackSocks5ProxiesParameter.isValid())) {
- d->ui->proxyGroupBox->hide();
- }
-
- if (!d->fallbackConferenceServerParameter.isValid()) {
- d->ui->conferenceGroupBox->hide();
- }
+ handleParameter("stun-server", QVariant::String, d->ui->stunServerLineEdit, d->ui->stunServerLabel);
+ handleParameter("stun-port", QVariant::UInt, d->ui->stunPortSpinBox, d->ui->stunPortLabel);
+ handleParameter("fallback-stun-server", QVariant::String, d->ui->fallbackStunServerLineEdit, d->ui->fallbackStunServerLabel);
+ handleParameter("fallback-stun-port", QVariant::UInt, d->ui->fallbackStunPortSpinBox, d->ui->fallbackStunPortLabel);
+ handleParameter("https-proxy-server", QVariant::String, d->ui->httpsProxyServerLineEdit, d->ui->httpsProxyServerLabel);
+ handleParameter("https-proxy-port", QVariant::UInt, d->ui->httpsProxyPortSpinBox, d->ui->httpsProxyPortLabel);
+ handleParameter("fallback-socks5-proxies", QVariant::StringList, d->ui->fallbackSocks5ProxiesTextEdit, d->ui->fallbackSocks5ProxiesLabel);
+ handleParameter("fallback-conference-server", QVariant::String, d->ui->fallbackConferenceServerLineEdit, d->ui->fallbackConferenceServerLabel);
}
ProxySettingsWidget::~ProxySettingsWidget()
@@ -237,60 +68,6 @@ ProxySettingsWidget::~ProxySettingsWidget()
delete d;
}
-QList<ProtocolParameterValue> ProxySettingsWidget::parameterValues() const
-{
- kDebug();
-
- QList<ProtocolParameterValue> parameters;
-
- // Populate the map of parameters and their values with all the parameters this widget contains.
- if (d->stunServerParameter.isValid()) {
- parameters.append(ProtocolParameterValue(d->stunServerParameter, d->ui->stunServerLineEdit->text()));
- }
-
- if (d->stunPortParameter.isValid()) {
- parameters.append(ProtocolParameterValue(d->stunPortParameter, d->ui->stunPortSpinBox->value()));
- }
-
- if (d->fallbackStunServerParameter.isValid()) {
- parameters.append(ProtocolParameterValue(d->fallbackStunServerParameter, d->ui->fallbackStunServerLineEdit->text()));
- }
-
- if (d->fallbackStunPortParameter.isValid()) {
- parameters.append(ProtocolParameterValue(d->fallbackStunPortParameter, d->ui->fallbackStunPortSpinBox->value()));
- }
-
- if (d->httpsProxyServerParameter.isValid()) {
- parameters.append(ProtocolParameterValue(d->httpsProxyServerParameter, d->ui->httpsProxyServerLineEdit->text()));
- }
-
- if (d->httpsProxyPortParameter.isValid()) {
- parameters.append(ProtocolParameterValue(d->httpsProxyPortParameter, d->ui->httpsProxyPortSpinBox->value()));
- }
-
- if (d->fallbackSocks5ProxiesParameter.isValid()) {
- QString text = d->ui->fallbackSocks5ProxiesTextEdit->toPlainText();
- QStringList value = text.split("
", QString::SkipEmptyParts);
- parameters.append(ProtocolParameterValue(d->fallbackSocks5ProxiesParameter, value));
- }
-
- if (d->fallbackConferenceServerParameter.isValid()) {
- parameters.append(ProtocolParameterValue(d->fallbackConferenceServerParameter,
- d->ui->fallbackConferenceServerLineEdit->text()));
- }
-
- return parameters;
-}
-
-bool ProxySettingsWidget::validateParameterValues()
-{
- kDebug();
-
- //TODO: check what parameters should be validated
-
- return true;
-}
-
#include "proxy-settings-widget.moc"
diff --git a/gabble/proxy-settings-widget.h b/gabble/proxy-settings-widget.h
index 0add7fd..55777a7 100644
--- a/gabble/proxy-settings-widget.h
+++ b/gabble/proxy-settings-widget.h
@@ -28,14 +28,10 @@ class ProxySettingsWidget : public AbstractAccountParametersWidget
Q_OBJECT
public:
- explicit ProxySettingsWidget(Tp::ProtocolParameterList parameters,
- const QVariantMap &values = QVariantMap(),
+ explicit ProxySettingsWidget(ParameterEditModel *model,
QWidget *parent = 0);
virtual ~ProxySettingsWidget();
- virtual QList<ProtocolParameterValue> parameterValues() const;
- virtual bool validateParameterValues();
-
private:
Q_DISABLE_COPY(ProxySettingsWidget);
diff --git a/gabble/server-settings-widget.cpp b/gabble/server-settings-widget.cpp
index ddd5e2e..a27b4be 100644
--- a/gabble/server-settings-widget.cpp
+++ b/gabble/server-settings-widget.cpp
@@ -37,159 +37,27 @@ public:
kDebug();
}
- 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,
+ServerSettingsWidget::ServerSettingsWidget(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 ¶meter, 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;
- }
- }
-
// Set up the UI.
d->ui = new Ui::ServerSettingsWidget;
d->ui->setupUi(this);
- // 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());
- }
- }
-
- if (d->keepaliveIntervalParameter.isValid()) {
- if (values.contains(d->keepaliveIntervalParameter.name())) {
- d->ui->keepaliveIntervalSpinBox->setValue(values.value(
- d->keepaliveIntervalParameter.name()).toUInt());
- } else {
- d->ui->keepaliveIntervalSpinBox->setValue(
- d->keepaliveIntervalParameter.defaultValue().toUInt());
- }
- }
-
- if (d->lowBandwidthParameter.isValid()) {
- if (values.contains(d->lowBandwidthParameter.name())) {
- d->ui->lowBandwidthCheckBox->setChecked(values.value(
- d->lowBandwidthParameter.name()).toBool());
- } else {
- d->ui->lowBandwidthCheckBox->setChecked(
- d->lowBandwidthParameter.defaultValue().toBool());
- }
- }
-
- if (d->requireEncryptionParameter.isValid()) {
- if (values.contains(d->requireEncryptionParameter.name())) {
- d->ui->requireEncryptionCheckBox->setChecked(values.value(
- d->requireEncryptionParameter.name()).toBool());
- } else {
- d->ui->requireEncryptionCheckBox->setChecked(
- d->requireEncryptionParameter.defaultValue().toBool());
- }
- }
-
- if (d->ignoreSslErrorsParameter.isValid()) {
- if (values.contains(d->ignoreSslErrorsParameter.name())) {
- d->ui->ignoreSslErrorsCheckBox->setChecked(values.value(
- d->ignoreSslErrorsParameter.name()).toBool());
- } else {
- d->ui->ignoreSslErrorsCheckBox->setChecked(
- d->ignoreSslErrorsParameter.defaultValue().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());
- }
- }
-
- // 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();
- }
-
- if (!d->keepaliveIntervalParameter.isValid()) {
- d->ui->keepaliveIntervalLabel->hide();
- d->ui->keepaliveIntervalSpinBox->hide();
- }
-
- if (!d->lowBandwidthParameter.isValid()) {
- d->ui->lowBandwidthCheckBox->hide();
- }
-
- if (!d->requireEncryptionParameter.isValid()) {
- d->ui->requireEncryptionCheckBox->hide();
- }
-
- if (!d->ignoreSslErrorsParameter.isValid()) {
- d->ui->ignoreSslErrorsCheckBox->hide();
- }
-
- if (!d->oldSslParameter.isValid()) {
- d->ui->oldSslCheckBox->hide();
- }
-
- // Hide the group boxes if they are empty.
- if ((!d->serverParameter.isValid()) && (!d->portParameter.isValid())) {
- d->ui->serverGroupBox->hide();
- }
-
- if ((!d->keepaliveIntervalParameter.isValid()) && (!d->lowBandwidthParameter.isValid())) {
- d->ui->connectionGroupBox->hide();
- }
-
- if ((!d->requireEncryptionParameter.isValid()) &&
- (!d->ignoreSslErrorsParameter.isValid()) &&
- (!d->oldSslParameter.isValid())) {
- d->ui->securityGroupBox->hide();
- }
+ handleParameter("server", QVariant::String, d->ui->serverLineEdit, d->ui->serverLabel);
+ handleParameter("port", QVariant::UInt, d->ui->portSpinBox, d->ui->portLabel);
+ handleParameter("keepalive-interval", QVariant::UInt, d->ui->keepaliveIntervalSpinBox, 0);
+ handleParameter("low-bandwith", QVariant::Bool, d->ui->lowBandwidthCheckBox, 0);
+ handleParameter("require-encryption", QVariant::Bool, d->ui->requireEncryptionCheckBox, 0);
+ handleParameter("ignore-ssl-errors", QVariant::Bool, d->ui->ignoreSslErrorsCheckBox, 0);
+ handleParameter("old-ssl", QVariant::Bool, d->ui->oldSslCheckBox, 0);
}
ServerSettingsWidget::~ServerSettingsWidget()
@@ -199,54 +67,6 @@ ServerSettingsWidget::~ServerSettingsWidget()
delete d;
}
-QList<ProtocolParameterValue> ServerSettingsWidget::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->keepaliveIntervalParameter.isValid()) {
- parameters.append(ProtocolParameterValue(d->keepaliveIntervalParameter, d->ui->keepaliveIntervalSpinBox->value()));
- }
-
- if (d->lowBandwidthParameter.isValid()) {
- parameters.append(ProtocolParameterValue(d->lowBandwidthParameter, d->ui->lowBandwidthCheckBox->isChecked()));
- }
-
- if (d->requireEncryptionParameter.isValid()) {
- parameters.append(ProtocolParameterValue(d->requireEncryptionParameter,
- d->ui->requireEncryptionCheckBox->isChecked()));
- }
-
- if (d->ignoreSslErrorsParameter.isValid()) {
- parameters.append(ProtocolParameterValue(d->ignoreSslErrorsParameter, d->ui->ignoreSslErrorsCheckBox->isChecked()));
- }
-
- if (d->oldSslParameter.isValid()) {
- parameters.append(ProtocolParameterValue(d->oldSslParameter, d->ui->oldSslCheckBox->isChecked()));
- }
-
- return parameters;
-}
-
-bool ServerSettingsWidget::validateParameterValues()
-{
- kDebug();
-
- //TODO: check which parameters need validation
-
- return true;
-}
-
#include "server-settings-widget.moc"
diff --git a/gabble/server-settings-widget.h b/gabble/server-settings-widget.h
index 67ec59f..504797e 100644
--- a/gabble/server-settings-widget.h
+++ b/gabble/server-settings-widget.h
@@ -28,14 +28,10 @@ class ServerSettingsWidget : public AbstractAccountParametersWidget
Q_OBJECT
public:
- explicit ServerSettingsWidget(Tp::ProtocolParameterList parameters,
- const QVariantMap &values = QVariantMap(),
+ explicit ServerSettingsWidget(ParameterEditModel *model,
QWidget *parent = 0);
virtual ~ServerSettingsWidget();
- virtual QList<ProtocolParameterValue> parameterValues() const;
- virtual bool validateParameterValues();
-
private:
Q_DISABLE_COPY(ServerSettingsWidget);
--
ktp-accounts-kcm packaging
More information about the pkg-kde-commits
mailing list