[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:57:42 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-accounts-kcm.git;a=commitdiff;h=1fab08c
The following commit has been merged in the master branch:
commit 1fab08c74a5b3cd9824c031371fe5f14946e52d8
Author: George Goldberg <grundleborg at googlemail.com>
Date: Wed Jul 29 15:59:16 2009 +0000
Add support for more than one widget displaying optional parameters.
svn path=/trunk/playground/network/telepathy-accounts-kcm/; revision=1004214
---
src/add-account-assistant.cpp | 62 ++++++++++++++++++++++++++++++++++++-------
1 file changed, 52 insertions(+), 10 deletions(-)
diff --git a/src/add-account-assistant.cpp b/src/add-account-assistant.cpp
index 2afd16e..0877b97 100644
--- a/src/add-account-assistant.cpp
+++ b/src/add-account-assistant.cpp
@@ -25,12 +25,16 @@
#include "protocol-item.h"
#include "protocol-select-widget.h"
+#include "libkcmtelepathyaccounts/abstract-account-parameters-widget.h"
+
#include <KDebug>
#include <KLocale>
#include <KMessageBox>
#include <KPageWidgetItem>
#include <KTabWidget>
+#include <QtCore/QList>
+
#include <TelepathyQt4/PendingAccount>
#include <TelepathyQt4/PendingOperation>
@@ -41,7 +45,6 @@ public:
: protocolSelectWidget(0),
tabWidget(0),
mandatoryParametersWidget(0),
- optionalParametersWidget(0),
pageOne(0),
pageTwo(0)
{
@@ -52,7 +55,7 @@ public:
ProtocolSelectWidget *protocolSelectWidget;
KTabWidget *tabWidget;
ParameterEditWidget *mandatoryParametersWidget;
- ParameterEditWidget *optionalParametersWidget;
+ QList<QWidget*> optionalParametersWidgets;
KPageWidgetItem *pageOne;
KPageWidgetItem *pageTwo;
};
@@ -115,18 +118,21 @@ void AddAccountAssistant::next()
d->mandatoryParametersWidget = 0;
}
- if (d->optionalParametersWidget) {
- d->optionalParametersWidget->deleteLater();
- d->optionalParametersWidget = 0;
+ foreach (QWidget *w, d->optionalParametersWidgets) {
+ if (w) {
+ w->deleteLater();
+ }
}
+ d->optionalParametersWidgets.clear();
d->mandatoryParametersWidget = new ParameterEditWidget(d->tabWidget);
d->mandatoryParametersWidget->setParameters(item->mandatoryParameters());
d->tabWidget->addTab(d->mandatoryParametersWidget, i18n("Mandatory Parameters"));
- d->optionalParametersWidget = new ParameterEditWidget(d->tabWidget);
- d->optionalParametersWidget->setParameters(item->optionalParameters());
- d->tabWidget->addTab(d->optionalParametersWidget, i18n("Optional Parameters"));
+ ParameterEditWidget *pew = new ParameterEditWidget(d->tabWidget);
+ d->optionalParametersWidgets.append(pew);
+ pew->setParameters(item->optionalParameters());
+ d->tabWidget->addTab(pew, i18n("Optional Parameters"));
KAssistantDialog::next();
}
@@ -154,9 +160,45 @@ void AddAccountAssistant::accept()
}
}
+
// Get the optional properties
- QMap<Tp::ProtocolParameter*, QVariant> optionalParameterValues =
- d->optionalParametersWidget->parameterValues();
+ QMap<Tp::ProtocolParameter*, QVariant> optionalParameterValues;
+
+ foreach (QWidget *w, d->optionalParametersWidgets) {
+ ParameterEditWidget *pew = qobject_cast<ParameterEditWidget*>(w);
+ if (pew) {
+ QMap<Tp::ProtocolParameter*, QVariant> parameters = pew->parameterValues();
+ QMap<Tp::ProtocolParameter*, QVariant>::const_iterator i = parameters.constBegin();
+ while (i != parameters.constEnd()) {
+ if (!optionalParameterValues.contains(i.key())) {
+ optionalParameterValues.insert(i.key(), i.value());
+ } else {
+ kWarning() << "Parameter:" << i.key()->name() << "is already in the map.";
+ }
+
+ ++i;
+ }
+ continue;
+ }
+
+ AbstractAccountParametersWidget *aapw = qobject_cast<AbstractAccountParametersWidget*>(w);
+ if (aapw) {
+ QMap<Tp::ProtocolParameter*, QVariant> parameters = aapw->parameterValues();
+ QMap<Tp::ProtocolParameter*, QVariant>::const_iterator i = parameters.constBegin();
+ while (i != parameters.constEnd()) {
+ if (!optionalParameterValues.contains(i.key())) {
+ optionalParameterValues.insert(i.key(), i.value());
+ } else {
+ kWarning() << "Parameter:" << i.key()->name() << "is already in the map.";
+ }
+
+ ++i;
+ }
+ continue;
+ }
+
+ kWarning() << "Widget type not recognised :(";
+ }
// Get the ProtocolItem that was selected and the corresponding ConnectionManagerItem.
ProtocolItem *protocolItem = d->protocolSelectWidget->selectedProtocol();
--
ktp-accounts-kcm packaging
More information about the pkg-kde-commits
mailing list