[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=946b222
The following commit has been merged in the master branch:
commit 946b222118b2c81336137af22a10224e499a43d2
Author: George Goldberg <grundleborg at googlemail.com>
Date: Wed Jul 29 15:59:44 2009 +0000
Support showing a custom UI for the mandatory parameters too.
svn path=/trunk/playground/network/telepathy-accounts-kcm/; revision=1004217
---
src/add-account-assistant.cpp | 68 +++++++++++++++++++++++++++++++++----------
1 file changed, 52 insertions(+), 16 deletions(-)
diff --git a/src/add-account-assistant.cpp b/src/add-account-assistant.cpp
index 7ab3115..3d29bbc 100644
--- a/src/add-account-assistant.cpp
+++ b/src/add-account-assistant.cpp
@@ -56,7 +56,7 @@ public:
Tp::AccountManagerPtr accountManager;
ProtocolSelectWidget *protocolSelectWidget;
KTabWidget *tabWidget;
- ParameterEditWidget *mandatoryParametersWidget;
+ QWidget *mandatoryParametersWidget;
QList<QWidget*> optionalParametersWidgets;
KPageWidgetItem *pageOne;
KPageWidgetItem *pageTwo;
@@ -114,6 +114,19 @@ void AddAccountAssistant::next()
// Set up the next page.
ProtocolItem *item = d->protocolSelectWidget->selectedProtocol();
+ ConnectionManagerItem *cmItem = qobject_cast<ConnectionManagerItem*>(item->parent());
+ if (!cmItem) {
+ kWarning() << "cmItem is invalid.";
+ }
+
+ QString connectionManager = cmItem->connectionManager()->name();
+ QString protocol = item->protocol();
+
+ // Get the AccountsUi for the plugin, and get the optional parameter widgets for it.
+ AbstractAccountUi *ui = PluginManager::instance()->accountUiForProtocol(connectionManager,
+ protocol);
+
+
// Delete the widgets for the next page if they already exist
if (d->mandatoryParametersWidget) {
d->mandatoryParametersWidget->deleteLater();
@@ -127,24 +140,35 @@ void AddAccountAssistant::next()
}
d->optionalParametersWidgets.clear();
- d->mandatoryParametersWidget = new ParameterEditWidget(d->tabWidget);
- d->mandatoryParametersWidget->setParameters(item->mandatoryParameters());
- d->tabWidget->addTab(d->mandatoryParametersWidget, i18n("Mandatory Parameters"));
+ // Set up the Mandatory Parameters page
+ Tp::ProtocolParameterList mandatoryParameters = item->mandatoryParameters();
- // Get the list of parameters
- Tp::ProtocolParameterList optionalParameters = item->optionalParameters();
+ // Create the custom UI or generic UI depending on available parameters.
+ if (ui) {
+ // UI does exist, set it up.
+ AbstractAccountParametersWidget *widget = ui->mandatoryParametersWidget(mandatoryParameters);
+ foreach(Tp::ProtocolParameter *parameter, widget->parameters()) {
+ mandatoryParameters.removeAll(parameter);
+ }
- // 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.";
+ if (mandatoryParameters.isEmpty()) {
+ d->mandatoryParametersWidget = widget;
+ } else {
+ widget->deleteLater();
+ widget = 0;
+ }
}
- QString connectionManager = cmItem->connectionManager()->name();
- QString protocol = item->protocol();
+ if (!d->mandatoryParametersWidget) {
+ ParameterEditWidget *paramEditWidget = new ParameterEditWidget(d->tabWidget);
+ d->mandatoryParametersWidget = paramEditWidget;
+ paramEditWidget->setParameters(item->mandatoryParameters());
+ }
- AbstractAccountUi *ui = PluginManager::instance()->accountUiForProtocol(connectionManager,
- protocol);
+ d->tabWidget->addTab(d->mandatoryParametersWidget, i18n("Mandatory Parameters"));
+
+ // Get the list of parameters
+ Tp::ProtocolParameterList optionalParameters = item->optionalParameters();
// Check if the AbstractAccountUi exists. If not then we use the autogenerated UI for
// everything.
@@ -188,8 +212,20 @@ void AddAccountAssistant::accept()
}
// Get the mandatory properties.
- QMap<Tp::ProtocolParameter*, QVariant> mandatoryParameterValues =
- d->mandatoryParametersWidget->parameterValues();
+ QMap<Tp::ProtocolParameter*, QVariant> mandatoryParameterValues;
+
+ AbstractAccountParametersWidget *aapw = qobject_cast<AbstractAccountParametersWidget*>(d->mandatoryParametersWidget);
+ if (aapw) {
+ mandatoryParameterValues = aapw->parameterValues();
+ } else {
+ ParameterEditWidget *pew = qobject_cast<ParameterEditWidget*>(d->mandatoryParametersWidget);
+ if (pew) {
+ mandatoryParameterValues = pew->parameterValues();
+ } else {
+ kWarning() << "d->mandatoryParametersWidget has unrecognised type :(.";
+ return;
+ }
+ }
foreach (const QVariant &value, mandatoryParameterValues.values()) {
if (value.toString().isEmpty()) {
--
ktp-accounts-kcm packaging
More information about the pkg-kde-commits
mailing list