[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:43 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-accounts-kcm.git;a=commitdiff;h=50154c7
The following commit has been merged in the master branch:
commit 50154c7ff0d1ca0f41b65f708b834a3b152ce094
Author: George Goldberg <grundleborg at googlemail.com>
Date: Wed Jul 29 15:59:36 2009 +0000
Show the autogenerated UI only when there are parameters not handled by any custom UIs in place in the Add Account Wizard.
svn path=/trunk/playground/network/telepathy-accounts-kcm/; revision=1004216
---
src/add-account-assistant.cpp | 46 +++++++++++++++++++++++++++++++++++++++----
1 file changed, 42 insertions(+), 4 deletions(-)
diff --git a/src/add-account-assistant.cpp b/src/add-account-assistant.cpp
index 0877b97..7ab3115 100644
--- a/src/add-account-assistant.cpp
+++ b/src/add-account-assistant.cpp
@@ -22,10 +22,12 @@
#include "connection-manager-item.h"
#include "parameter-edit-widget.h"
+#include "plugin-manager.h"
#include "protocol-item.h"
#include "protocol-select-widget.h"
#include "libkcmtelepathyaccounts/abstract-account-parameters-widget.h"
+#include "libkcmtelepathyaccounts/abstract-account-ui.h"
#include <KDebug>
#include <KLocale>
@@ -129,10 +131,46 @@ void AddAccountAssistant::next()
d->mandatoryParametersWidget->setParameters(item->mandatoryParameters());
d->tabWidget->addTab(d->mandatoryParametersWidget, i18n("Mandatory Parameters"));
- ParameterEditWidget *pew = new ParameterEditWidget(d->tabWidget);
- d->optionalParametersWidgets.append(pew);
- pew->setParameters(item->optionalParameters());
- d->tabWidget->addTab(pew, i18n("Optional Parameters"));
+ // Get the list of parameters
+ Tp::ProtocolParameterList optionalParameters = item->optionalParameters();
+
+ // Get the AccountsUi for the plugin, and get the optional parameter widgets for it.
+ ConnectionManagerItem *cmItem = qobject_cast<ConnectionManagerItem*>(item->parent());
+ if (!cmItem) {
+ kWarning() << "cmItem is invalid.";
+ }
+
+ QString connectionManager = cmItem->connectionManager()->name();
+ QString protocol = item->protocol();
+
+ AbstractAccountUi *ui = PluginManager::instance()->accountUiForProtocol(connectionManager,
+ protocol);
+
+ // Check if the AbstractAccountUi exists. If not then we use the autogenerated UI for
+ // everything.
+
+ if (ui) {
+ // UI Does exist, set it up.
+ QList<AbstractAccountParametersWidget*> widgets = ui->optionalParametersWidgets(optionalParameters);
+
+ // Remove all handled parameters from the optionalParameters list.
+ foreach (AbstractAccountParametersWidget *widget, widgets) {
+ foreach (Tp::ProtocolParameter *parameter, widget->parameters()) {
+ optionalParameters.removeAll(parameter);
+ }
+
+ d->optionalParametersWidgets.append(widget);
+ d->tabWidget->addTab(widget, i18n("Optional Parameters"));
+ }
+ }
+
+ // Show the generic UI if optionalParameters is not empty.
+ if (optionalParameters.size() > 0) {
+ ParameterEditWidget *pew = new ParameterEditWidget(d->tabWidget);
+ d->optionalParametersWidgets.append(pew);
+ pew->setParameters(optionalParameters);
+ d->tabWidget->addTab(pew, i18n("Optional Parameters"));
+ }
KAssistantDialog::next();
}
--
ktp-accounts-kcm packaging
More information about the pkg-kde-commits
mailing list