[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:43 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-accounts-kcm.git;a=commitdiff;h=5a4f2ca
The following commit has been merged in the master branch:
commit 5a4f2ca0a62f9576931f66e6df771356adc6b0e2
Author: Dominik Schmidt <dev at dominik-schmidt.de>
Date: Tue Jan 11 23:44:17 2011 +0100
Port the ICQ plugin to the new convenience methods
---
haze/CMakeLists.txt | 2 +-
haze/haze-account-ui-plugin.cpp | 2 +-
haze/haze-icq-account-ui.cpp | 21 ++++++---
haze/icq-advanced-options-widget.cpp | 86 ------------------------------------
haze/icq-advanced-options-widget.h | 47 --------------------
haze/icq-main-options-widget.cpp | 66 ++++++---------------------
haze/icq-main-options-widget.h | 10 ++++-
7 files changed, 38 insertions(+), 196 deletions(-)
diff --git a/haze/CMakeLists.txt b/haze/CMakeLists.txt
index 920898f..b7a7a99 100644
--- a/haze/CMakeLists.txt
+++ b/haze/CMakeLists.txt
@@ -8,7 +8,7 @@ set (kcmtelepathyaccounts_plugin_haze_SRCS
haze-account-ui-plugin.cpp
haze-icq-account-ui.cpp
icq-main-options-widget.cpp
- icq-advanced-options-widget.cpp
+
icq-server-settings-widget.cpp
)
diff --git a/haze/haze-account-ui-plugin.cpp b/haze/haze-account-ui-plugin.cpp
index c1969a0..db4b209 100644
--- a/haze/haze-account-ui-plugin.cpp
+++ b/haze/haze-account-ui-plugin.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
diff --git a/haze/haze-icq-account-ui.cpp b/haze/haze-icq-account-ui.cpp
index cb5fe34..546b25a 100644
--- a/haze/haze-icq-account-ui.cpp
+++ b/haze/haze-icq-account-ui.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
@@ -18,14 +18,18 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "haze-icq-account-ui.h"
+#include <KDebug>
-#include "icq-main-options-widget.h"
-#include "icq-advanced-options-widget.h"
#include <KCMTelepathyAccounts/AbstractAccountParametersWidget>
+#include <KCMTelepathyAccounts/GenericAdvancedOptionsWidget>
+
+#include "icq-main-options-widget.h"
+#include "icq-server-settings-widget.h"
+
+#include "haze-icq-account-ui.h"
+
-#include <KDebug>
class HazeIcqAccountUi::Private
{
@@ -46,7 +50,7 @@ HazeIcqAccountUi::HazeIcqAccountUi(QObject *parent)
registerSupportedParameter("account", QVariant::String);
registerSupportedParameter("password", QVariant::String);
- //registerSupportedParameter("port", QVariant::UInt);
+ registerSupportedParameter("port", QVariant::Int);
registerSupportedParameter("server", QVariant::String);
registerSupportedParameter("use-ssl", QVariant::Bool);
@@ -85,7 +89,10 @@ AbstractAccountParametersWidget *HazeIcqAccountUi::advancedOptionsWidget(
{
kDebug();
- return new IcqAdvancedOptionsWidget(parameters, values, parent);
+ GenericAdvancedOptionsWidget *advancedOptionsWidget = new GenericAdvancedOptionsWidget(parameters, values, parent);
+ AbstractAccountParametersWidget *icqServerSettingsWidget = new IcqServerSettingsWidget(parameters, values, 0);
+ advancedOptionsWidget->addTab(icqServerSettingsWidget, "Server");
+ return advancedOptionsWidget;
}
diff --git a/haze/icq-advanced-options-widget.cpp b/haze/icq-advanced-options-widget.cpp
deleted file mode 100644
index ffceabc..0000000
--- a/haze/icq-advanced-options-widget.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * This file is part of telepathy-accounts-kcm
- *
- * Copyright (C) 2010 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 "icq-advanced-options-widget.h"
-#include "icq-server-settings-widget.h"
-
-#include <KCMTelepathyAccounts/ProtocolParameterValue>
-
-#include <KDebug>
-#include <KTabWidget>
-#include <KLocale>
-
-#include <QHBoxLayout>
-
-
-class IcqAdvancedOptionsWidget::Private
-{
-public:
- Private()
- : serverSettings(0)
- {
- kDebug();
- }
- IcqServerSettingsWidget *serverSettings;
-};
-
-IcqAdvancedOptionsWidget::IcqAdvancedOptionsWidget(Tp::ProtocolParameterList parameters,
- const QVariantMap &values,
- QWidget *parent)
- : AbstractAccountParametersWidget(parameters, values, parent),
- d(new Private)
-{
- // add a layout to the main widget
- QHBoxLayout *layout = new QHBoxLayout(this);
- d->serverSettings = new IcqServerSettingsWidget(parameters, values, 0);
- layout->addWidget(d->serverSettings);
-}
-
-IcqAdvancedOptionsWidget::~IcqAdvancedOptionsWidget()
-{
- kDebug();
-
- delete d;
-}
-
-QList<ProtocolParameterValue> IcqAdvancedOptionsWidget::parameterValues() const
-{
- kDebug();
-
- // the server parameter values
- QList<ProtocolParameterValue> parameters;
- parameters.append(d->serverSettings->parameterValues());
-
- return parameters;
-}
-
-bool IcqAdvancedOptionsWidget::validateParameterValues()
-{
- kDebug();
-
- // validate one tab at a time so that the user is not flooded with dialogs
- if (!d->serverSettings->validateParameterValues())
- return false;
-
- return true;
-}
-
-#include "icq-advanced-options-widget.moc"
-
diff --git a/haze/icq-advanced-options-widget.h b/haze/icq-advanced-options-widget.h
deleted file mode 100644
index 2a6b52a..0000000
--- a/haze/icq-advanced-options-widget.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * This file is part of telepathy-accounts-kcm
- *
- * Copyright (C) 2010 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
- */
-
-#ifndef KCMTELEPATHYACCOUNTS_PLUGIN_HAZE_ICQ_ADVANCED_PARAMETERS_WIDGET_H
-#define KCMTELEPATHYACCOUNTS_PLUGIN_HAZE_ICQ_ADVANCED_PARAMETERS_WIDGET_H
-
-#include <KCMTelepathyAccounts/AbstractAccountParametersWidget>
-
-class IcqAdvancedOptionsWidget : public AbstractAccountParametersWidget
-{
- Q_OBJECT
-
-public:
- explicit IcqAdvancedOptionsWidget(Tp::ProtocolParameterList parameters,
- const QVariantMap &values = QVariantMap(),
- QWidget *parent = 0);
- virtual ~IcqAdvancedOptionsWidget();
-
- virtual QList<ProtocolParameterValue> parameterValues() const;
- virtual bool validateParameterValues();
-
-private:
- Q_DISABLE_COPY(IcqAdvancedOptionsWidget);
-
- class Private;
- Private * const d;
-};
-
-#endif // header guard
-
diff --git a/haze/icq-main-options-widget.cpp b/haze/icq-main-options-widget.cpp
index 6d2dbd1..56613c7 100644
--- a/haze/icq-main-options-widget.cpp
+++ b/haze/icq-main-options-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
@@ -26,10 +26,15 @@
#include <KDebug>
#include <KMessageBox>
+#include <QVariant>
+#include <QCheckBox>
+#include <QComboBox>
+typedef QMap<Tp::ProtocolParameter, QWidget*> ParametersWidgetsMap;
class IcqMainOptionsWidget::Private
{
+
public:
Private()
: ui(0)
@@ -37,6 +42,8 @@ public:
kDebug();
}
+ ParametersWidgetsMap parameters;
+
Tp::ProtocolParameter accountParameter;
Tp::ProtocolParameter passwordParameter;
@@ -51,46 +58,15 @@ IcqMainOptionsWidget::IcqMainOptionsWidget(Tp::ProtocolParameterList parameters,
{
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::IcqMainOptionsWidget;
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());
- }
- }
+ handleParameter(parameters, "account", QVariant::String, d->ui->accountLineEdit, d->ui->accountLabel);
+ handleParameter(parameters, "password", QVariant::String, d->ui->passwordLineEdit, d->ui->passwordLabel);
- // 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();
- }
+ // Prefill UI elements if appropriate.
+ prefillUI(values);
}
IcqMainOptionsWidget::~IcqMainOptionsWidget()
@@ -100,22 +76,9 @@ IcqMainOptionsWidget::~IcqMainOptionsWidget()
delete d;
}
-QList<ProtocolParameterValue> IcqMainOptionsWidget::parameterValues() const
+ParametersWidgetsMap* IcqMainOptionsWidget::internalParametersWidgetsMap() 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;
+ return &(d->parameters);
}
bool IcqMainOptionsWidget::validateParameterValues()
@@ -134,6 +97,5 @@ bool IcqMainOptionsWidget::validateParameterValues()
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 ea3898b..96c14f0 100644
--- a/haze/icq-main-options-widget.h
+++ b/haze/icq-main-options-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
@@ -23,6 +23,8 @@
#include <KCMTelepathyAccounts/AbstractAccountParametersWidget>
+#include <QString>
+
class IcqMainOptionsWidget : public AbstractAccountParametersWidget
{
Q_OBJECT
@@ -33,9 +35,11 @@ public:
QWidget *parent = 0);
virtual ~IcqMainOptionsWidget();
- virtual QList<ProtocolParameterValue> parameterValues() const;
virtual bool validateParameterValues();
+protected:
+ virtual ParametersWidgetsMap* internalParametersWidgetsMap() const;
+
private:
Q_DISABLE_COPY(IcqMainOptionsWidget);
@@ -43,5 +47,7 @@ private:
Private * const d;
};
+uint qHash(const Tp::ProtocolParameter&);
+
#endif // header guard
--
ktp-accounts-kcm packaging
More information about the pkg-kde-commits
mailing list