[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/network/telepathy-accounts-kcm-plugins/gabble
From: George Goldberg <grundleborg () googlemail ! com>
Date: 2009-08-03 13:18:56
Message-ID: 1249305536.105341.18685.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1006313 by gberg:
Show a custom widget for the mandatory parameters for adding gabble/jabber accounts.
M +1 -0 CMakeLists.txt
M +4 -0 gabble-account-ui.cpp
M +54 -2 mandatory-parameters-widget.cpp
A mandatory-parameters-widget.ui
--- trunk/playground/network/telepathy-accounts-kcm-plugins/gabble/CMakeLists.txt \
#1006312:1006313 @@ -11,6 +11,7 @@
)
kde4_add_ui_files (kcmtelepathyaccounts_plugin_gabble_SRCS
+ mandatory-parameters-widget.ui
)
kde4_add_plugin (kcmtelepathyaccounts_plugin_gabble
--- trunk/playground/network/telepathy-accounts-kcm-plugins/gabble/gabble-account-ui.cpp \
#1006312:1006313 @@ -40,6 +40,10 @@
d(new Private)
{
kDebug();
+
+ // Register supported parameters
+ registerSupportedMandatoryParameter("account", QVariant::String);
+ registerSupportedMandatoryParameter("password", QVariant::String);
}
GabbleAccountUi::~GabbleAccountUi()
--- trunk/playground/network/telepathy-accounts-kcm-plugins/gabble/mandatory-parameters-widget.cpp \
#1006312:1006313 @@ -20,15 +20,26 @@
#include "mandatory-parameters-widget.h"
+#include "ui_mandatory-parameters-widget.h"
+
#include <KDebug>
class MandatoryParametersWidget::Private
{
public:
Private()
+ : accountParameter(0),
+ passwordParameter(0),
+ ui(0)
{
kDebug();
}
+
+ Tp::ProtocolParameterList parameters;
+ Tp::ProtocolParameter *accountParameter;
+ Tp::ProtocolParameter *passwordParameter;
+
+ Ui::MandatoryParametersWidget *ui;
};
MandatoryParametersWidget::MandatoryParametersWidget(Tp::ProtocolParameterList \
parameters, @@ -37,6 +48,37 @@
d(new Private)
{
kDebug();
+
+ // Save the parameters.
+ d->parameters = parameters;
+
+ // Store the parameters this widget supports
+ foreach (Tp::ProtocolParameter *parameter, d->parameters) {
+ if ((parameter->name() == "account") && (parameter->type() == \
QVariant::String)) { + if (!d->accountParameter) {
+ d->accountParameter = parameter;
+ }
+ } else if ((parameter->name() == "password") && (parameter->type() == \
QVariant::String)) { + if (!d->passwordParameter) {
+ d->passwordParameter = parameter;
+ }
+ }
+ }
+
+ // Set up the UI.
+ d->ui = new Ui::MandatoryParametersWidget;
+ d->ui->setupUi(this);
+
+ // Hide any elements we don't have the parameters passed to show.
+ if (!d->accountParameter) {
+ d->ui->accountLabel->hide();
+ d->ui->accountLineEdit->hide();
+ }
+
+ if (!d->passwordParameter) {
+ d->ui->passwordLabel->hide();
+ d->ui->passwordLineEdit->hide();
+ }
}
MandatoryParametersWidget::~MandatoryParametersWidget()
@@ -50,8 +92,18 @@
{
kDebug();
- // TODO: Implement me!
- return QMap<Tp::ProtocolParameter*, QVariant>();
+ QMap<Tp::ProtocolParameter*, QVariant> parameters;
+
+ // Populate the map of parameters and their values with all the parameters this \
widget contains. + if (d->accountParameter) {
+ parameters.insert(d->accountParameter, d->ui->accountLineEdit->text());
+ }
+
+ if (d->passwordParameter) {
+ parameters.insert(d->passwordParameter, d->ui->passwordLineEdit->text());
+ }
+
+ return parameters;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic