[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:52 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-accounts-kcm.git;a=commitdiff;h=1a34f24

The following commit has been merged in the master branch:
commit 1a34f24dc4afe770a1b8cb8c36ade0e8d5c8e813
Author: George Goldberg <grundleborg at googlemail.com>
Date:   Mon Aug 3 13:18:54 2009 +0000

    Show a custom widget for the mandatory parameters for adding gabble/jabber accounts.
    
    svn path=/trunk/playground/network/telepathy-accounts-kcm-plugins/; revision=1006313
---
 gabble/CMakeLists.txt                  |  1 +
 gabble/gabble-account-ui.cpp           |  4 ++
 gabble/mandatory-parameters-widget.cpp | 56 +++++++++++++++++++++-
 gabble/mandatory-parameters-widget.ui  | 86 ++++++++++++++++++++++++++++++++++
 4 files changed, 145 insertions(+), 2 deletions(-)

diff --git a/gabble/CMakeLists.txt b/gabble/CMakeLists.txt
index ef39f22..8d341cb 100644
--- a/gabble/CMakeLists.txt
+++ b/gabble/CMakeLists.txt
@@ -11,6 +11,7 @@ set (kcmtelepathyaccounts_plugin_gabble_SRCS
 )
 
 kde4_add_ui_files (kcmtelepathyaccounts_plugin_gabble_SRCS
+                   mandatory-parameters-widget.ui
 )
 
 kde4_add_plugin (kcmtelepathyaccounts_plugin_gabble
diff --git a/gabble/gabble-account-ui.cpp b/gabble/gabble-account-ui.cpp
index 271374e..d290996 100644
--- a/gabble/gabble-account-ui.cpp
+++ b/gabble/gabble-account-ui.cpp
@@ -40,6 +40,10 @@ GabbleAccountUi::GabbleAccountUi(QObject *parent)
    d(new Private)
 {
     kDebug();
+
+    // Register supported parameters
+    registerSupportedMandatoryParameter("account", QVariant::String);
+    registerSupportedMandatoryParameter("password", QVariant::String);
 }
 
 GabbleAccountUi::~GabbleAccountUi()
diff --git a/gabble/mandatory-parameters-widget.cpp b/gabble/mandatory-parameters-widget.cpp
index 74b7a2d..96b8688 100644
--- a/gabble/mandatory-parameters-widget.cpp
+++ b/gabble/mandatory-parameters-widget.cpp
@@ -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 @@ MandatoryParametersWidget::MandatoryParametersWidget(Tp::ProtocolParameterList p
    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 @@ QMap<Tp::ProtocolParameter*, QVariant> MandatoryParametersWidget::parameterValue
 {
     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;
 }
 
 
diff --git a/gabble/mandatory-parameters-widget.ui b/gabble/mandatory-parameters-widget.ui
new file mode 100644
index 0000000..619d043
--- /dev/null
+++ b/gabble/mandatory-parameters-widget.ui
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MandatoryParametersWidget</class>
+ <widget class="QWidget" name="MandatoryParametersWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_2">
+   <item>
+    <layout class="QVBoxLayout" name="verticalLayout">
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout">
+       <item>
+        <widget class="QLabel" name="accountLabel">
+         <property name="text">
+          <string>Jabber ID:</string>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="KLineEdit" name="accountLineEdit"/>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout_2">
+       <item>
+        <widget class="QLabel" name="passwordLabel">
+         <property name="text">
+          <string>Password:</string>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="KLineEdit" name="passwordLineEdit">
+         <property name="echoMode">
+          <enum>QLineEdit::Password</enum>
+         </property>
+         <property name="passwordMode">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>219</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>KLineEdit</class>
+   <extends>QLineEdit</extends>
+   <header>klineedit.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>

-- 
ktp-accounts-kcm packaging



More information about the pkg-kde-commits mailing list