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


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

The following commit has been merged in the master branch:
commit 2431a2ae2ca21656da8b3158e845925eef80e9e7
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Tue Sep 7 23:39:15 2010 +0000

    Added very basic butterfly(MSN) config UI plugin.
    
    
    svn path=/trunk/playground/network/telepathy-accounts-kcm-plugins/; revision=1172746
---
 CMakeLists.txt                                     |  1 +
 butterfly/CMakeLists.txt                           | 36 ++++++++++
 .../butterfly-account-ui-plugin.cpp                | 30 ++++----
 .../butterfly-account-ui-plugin.h                  | 12 ++--
 .../butterfly-account-ui.cpp                       | 48 ++++++-------
 .../butterfly-account-ui.h                         | 12 ++--
 .../kcmtelepathyaccounts_plugin_butterfly.desktop  | 14 ++++
 .../mandatory-parameters-widget.cpp                | 82 ++++++++++------------
 .../mandatory-parameters-widget.h                  |  4 +-
 butterfly/mandatory-parameters-widget.ui           | 75 ++++++++++++++++++++
 10 files changed, 216 insertions(+), 98 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3a7a7b1..4a102d9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,4 +21,5 @@ include_directories (${KDE4_INCLUDES}
 )
 
 add_subdirectory (gabble)
+add_subdirectory (butterfly)
 
diff --git a/butterfly/CMakeLists.txt b/butterfly/CMakeLists.txt
new file mode 100644
index 0000000..eb0cc84
--- /dev/null
+++ b/butterfly/CMakeLists.txt
@@ -0,0 +1,36 @@
+project (kcmtelepathyaccounts-plugin-butterfly)
+
+include_directories (${CMAKE_CURRENT_BINARY_DIR}
+                     ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+set (kcmtelepathyaccounts_plugin_butterfly_SRCS
+     butterfly-account-ui-plugin.cpp
+     butterfly-account-ui.cpp
+     mandatory-parameters-widget.cpp
+)
+
+kde4_add_ui_files (kcmtelepathyaccounts_plugin_butterfly_SRCS
+                   mandatory-parameters-widget.ui
+)
+
+kde4_add_plugin (kcmtelepathyaccounts_plugin_butterfly
+                 ${kcmtelepathyaccounts_plugin_butterfly_SRCS}
+)
+
+target_link_libraries (kcmtelepathyaccounts_plugin_butterfly
+                       ${KCMTELEPATHYACCOUNTS_LIBRARIES}
+                       ${QT_LIBRARIES}
+                       ${KDE4_KDEUI_LIBS}
+                       ${TELEPATHY_QT4_LIBRARIES}
+)
+
+# Install:
+install (TARGETS kcmtelepathyaccounts_plugin_butterfly
+         DESTINATION ${PLUGIN_INSTALL_DIR}
+)
+
+install (FILES kcmtelepathyaccounts_plugin_butterfly.desktop
+         DESTINATION ${SERVICES_INSTALL_DIR}
+)
+
diff --git a/gabble/gabble-account-ui-plugin.cpp b/butterfly/butterfly-account-ui-plugin.cpp
similarity index 59%
copy from gabble/gabble-account-ui-plugin.cpp
copy to butterfly/butterfly-account-ui-plugin.cpp
index 8e497f1..d79c5aa 100644
--- a/gabble/gabble-account-ui-plugin.cpp
+++ b/butterfly/butterfly-account-ui-plugin.cpp
@@ -18,9 +18,9 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include "gabble-account-ui-plugin.h"
+#include "butterfly-account-ui-plugin.h"
 
-#include "gabble-account-ui.h"
+#include "butterfly-account-ui.h"
 
 #include <KCMTelepathyAccounts/PluginMacros>
 
@@ -29,7 +29,7 @@
 
 #include <QtCore/QVariantList>
 
-class GabbleAccountUiPlugin::Private
+class ButterflyAccountUiPlugin::Private
 {
 public:
     Private()
@@ -38,38 +38,38 @@ public:
     }
 };
 
-GabbleAccountUiPlugin::GabbleAccountUiPlugin(QObject *parent, const QVariantList &)
+ButterflyAccountUiPlugin::ButterflyAccountUiPlugin(QObject *parent, const QVariantList &)
  : AbstractAccountUiPlugin(parent),
    d(new Private)
 {
     kDebug();
 
     // Register supported cm/protocol combinations
-    registerProvidedProtocol("gabble", "jabber");
+    registerProvidedProtocol("butterfly", "msn");
 }
 
-GabbleAccountUiPlugin::~GabbleAccountUiPlugin()
+ButterflyAccountUiPlugin::~ButterflyAccountUiPlugin()
 {
     kDebug();
 }
 
-AbstractAccountUi* GabbleAccountUiPlugin::accountUi(const QString &connectionManager, const QString &protocol)
+AbstractAccountUi* ButterflyAccountUiPlugin::accountUi(const QString &connectionManager, const QString &protocol)
 {
     kDebug();
-
-    // We only support gabble/jabber combination.
-    if ((connectionManager == "gabble") && (protocol == "jabber")) {
-        return new GabbleAccountUi;
+    
+    // We only support butterfly/xmpp combination.
+    if ((connectionManager == "butterfly") && (protocol == "msn")) {
+        return new ButterflyAccountUi;
     }
 
     return 0;
 }
 
 
-//KCMTELEPATHYACCOUNTS_PLUGIN_EXPORT("gabble", "GabbleAccountUiPlugin")
-  K_PLUGIN_FACTORY(factory, registerPlugin<GabbleAccountUiPlugin>();) \
-  K_EXPORT_PLUGIN(factory("kcmtelepathyaccounts_plugin_gabble"))
+//KCMTELEPATHYACCOUNTS_PLUGIN_EXPORT("butterfly", "ButterflyAccountUiPlugin")
+  K_PLUGIN_FACTORY(factory, registerPlugin<ButterflyAccountUiPlugin>();) \
+  K_EXPORT_PLUGIN(factory("kcmtelepathyaccounts_plugin_butterfly"))
 
 
-#include "gabble-account-ui-plugin.moc"
+#include "butterfly-account-ui-plugin.moc"
 
diff --git a/gabble/gabble-account-ui-plugin.h b/butterfly/butterfly-account-ui-plugin.h
similarity index 76%
copy from gabble/gabble-account-ui-plugin.h
copy to butterfly/butterfly-account-ui-plugin.h
index 9b343ac..d379cd6 100644
--- a/gabble/gabble-account-ui-plugin.h
+++ b/butterfly/butterfly-account-ui-plugin.h
@@ -18,25 +18,25 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef KCMTELEPATHYACCOUNTS_PLUGIN_GABBLE_ACCOUNT_UI_PLUGIN_H
-#define KCMTELEPATHYACCOUNTS_PLUGIN_GABBLE_ACCOUNT_UI_PLUGIN_H
+#ifndef KCMTELEPATHYACCOUNTS_PLUGIN_BUTTERFLY_ACCOUNT_UI_PLUGIN_H
+#define KCMTELEPATHYACCOUNTS_PLUGIN_BUTTERFLY_ACCOUNT_UI_PLUGIN_H
 
 #include <KCMTelepathyAccounts/AbstractAccountUiPlugin>
 
 #include <QVariantList>
 
-class GabbleAccountUiPlugin : public AbstractAccountUiPlugin
+class ButterflyAccountUiPlugin : public AbstractAccountUiPlugin
 {
     Q_OBJECT
 
 public:
-    GabbleAccountUiPlugin(QObject *parent, const QVariantList &);
-    virtual ~GabbleAccountUiPlugin();
+    ButterflyAccountUiPlugin(QObject *parent, const QVariantList &);
+    virtual ~ButterflyAccountUiPlugin();
 
     virtual AbstractAccountUi* accountUi(const QString &connectionManager, const QString &protocol);
 
 private:
-    Q_DISABLE_COPY(GabbleAccountUiPlugin);
+    Q_DISABLE_COPY(ButterflyAccountUiPlugin);
 
     class Private;
     Private * const d;
diff --git a/gabble/gabble-account-ui-plugin.cpp b/butterfly/butterfly-account-ui.cpp
similarity index 50%
copy from gabble/gabble-account-ui-plugin.cpp
copy to butterfly/butterfly-account-ui.cpp
index 8e497f1..0220a1a 100644
--- a/gabble/gabble-account-ui-plugin.cpp
+++ b/butterfly/butterfly-account-ui.cpp
@@ -18,18 +18,15 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include "gabble-account-ui-plugin.h"
+#include "butterfly-account-ui.h"
 
-#include "gabble-account-ui.h"
+#include "mandatory-parameters-widget.h"
 
-#include <KCMTelepathyAccounts/PluginMacros>
+#include <KCMTelepathyAccounts/AbstractAccountParametersWidget>
 
 #include <KDebug>
-#include <KGenericFactory>
 
-#include <QtCore/QVariantList>
-
-class GabbleAccountUiPlugin::Private
+class ButterflyAccountUi::Private
 {
 public:
     Private()
@@ -38,38 +35,37 @@ public:
     }
 };
 
-GabbleAccountUiPlugin::GabbleAccountUiPlugin(QObject *parent, const QVariantList &)
- : AbstractAccountUiPlugin(parent),
+ButterflyAccountUi::ButterflyAccountUi(QObject *parent)
+ : AbstractAccountUi(parent),
    d(new Private)
 {
     kDebug();
 
-    // Register supported cm/protocol combinations
-    registerProvidedProtocol("gabble", "jabber");
+    // Register supported parameters
+    registerSupportedMandatoryParameter("account", QVariant::String);
+    registerSupportedMandatoryParameter("password", QVariant::String);
 }
 
-GabbleAccountUiPlugin::~GabbleAccountUiPlugin()
+ButterflyAccountUi::~ButterflyAccountUi()
 {
     kDebug();
+
+    delete d;
 }
 
-AbstractAccountUi* GabbleAccountUiPlugin::accountUi(const QString &connectionManager, const QString &protocol)
+AbstractAccountParametersWidget *ButterflyAccountUi::mandatoryParametersWidget(
+        Tp::ProtocolParameterList parameters,
+        const QVariantMap &values) const
 {
     kDebug();
 
-    // We only support gabble/jabber combination.
-    if ((connectionManager == "gabble") && (protocol == "jabber")) {
-        return new GabbleAccountUi;
-    }
-
-    return 0;
+    return new MandatoryParametersWidget(parameters, values);
 }
 
-
-//KCMTELEPATHYACCOUNTS_PLUGIN_EXPORT("gabble", "GabbleAccountUiPlugin")
-  K_PLUGIN_FACTORY(factory, registerPlugin<GabbleAccountUiPlugin>();) \
-  K_EXPORT_PLUGIN(factory("kcmtelepathyaccounts_plugin_gabble"))
-
-
-#include "gabble-account-ui-plugin.moc"
+QList<AbstractAccountParametersWidget*> ButterflyAccountUi::optionalParametersWidgets(Tp::ProtocolParameterList parameters, const QVariantMap &values) const
+{
+    QList<AbstractAccountParametersWidget*> list;
+    return list;
+}
+#include "butterfly-account-ui.moc"
 
diff --git a/gabble/gabble-account-ui.h b/butterfly/butterfly-account-ui.h
similarity index 82%
copy from gabble/gabble-account-ui.h
copy to butterfly/butterfly-account-ui.h
index b04b55c..e0b3d9d 100644
--- a/gabble/gabble-account-ui.h
+++ b/butterfly/butterfly-account-ui.h
@@ -18,18 +18,18 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef KCMTELEPATHYACCOUNTS_PLUGIN_GABBLE_ACCOUNT_UI_H
-#define KCMTELEPATHYACCOUNTS_PLUGIN_GABBLE_ACCOUNT_UI_H
+#ifndef KCMTELEPATHYACCOUNTS_PLUGIN_BUTTERFLY_ACCOUNT_UI_H
+#define KCMTELEPATHYACCOUNTS_PLUGIN_BUTTERFLY_ACCOUNT_UI_H
 
 #include <KCMTelepathyAccounts/AbstractAccountUi>
 
-class GabbleAccountUi : public AbstractAccountUi
+class ButterflyAccountUi : public AbstractAccountUi
 {
     Q_OBJECT
 
 public:
-    explicit GabbleAccountUi(QObject *parent = 0);
-    virtual ~GabbleAccountUi();
+    explicit ButterflyAccountUi(QObject *parent = 0);
+    virtual ~ButterflyAccountUi();
 
     virtual AbstractAccountParametersWidget
               *mandatoryParametersWidget(Tp::ProtocolParameterList parameters,
@@ -39,7 +39,7 @@ public:
                                         const QVariantMap &values = QVariantMap()) const;
 
 private:
-    Q_DISABLE_COPY(GabbleAccountUi);
+    Q_DISABLE_COPY(ButterflyAccountUi);
 
     class Private;
     Private * const d;
diff --git a/butterfly/kcmtelepathyaccounts_plugin_butterfly.desktop b/butterfly/kcmtelepathyaccounts_plugin_butterfly.desktop
new file mode 100644
index 0000000..e2afb0d
--- /dev/null
+++ b/butterfly/kcmtelepathyaccounts_plugin_butterfly.desktop
@@ -0,0 +1,14 @@
+[Desktop Entry]
+Encoding=UTF-8
+Comment=Custom account configuration user interface for accounts using the Butterfly connection manager.
+Type=Service
+ServiceTypes=KCMTelepathyAccounts/AccountUiPlugin
+
+X-KDE-Library=kcmtelepathyaccounts_plugin_butterfly
+X-KDE-PluginInfo-Author=David Edmundson
+X-KDE-PluginInfo-Email=kde at davidedmundson.co.uk
+X-KDE-PluginInfo-Name=butterfly
+X-KDE-PluginInfo-Version=0.1
+X-KDE-PluginInfo-Website=http://techbase.kde.org/Projects/Telepathy
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=true
diff --git a/gabble/mandatory-parameters-widget.cpp b/butterfly/mandatory-parameters-widget.cpp
similarity index 63%
copy from gabble/mandatory-parameters-widget.cpp
copy to butterfly/mandatory-parameters-widget.cpp
index 27d8967..fdf23fd 100644
--- a/gabble/mandatory-parameters-widget.cpp
+++ b/butterfly/mandatory-parameters-widget.cpp
@@ -56,6 +56,10 @@ MandatoryParametersWidget::MandatoryParametersWidget(Tp::ProtocolParameterList p
 
     // Store the parameters this widget supports
     foreach (Tp::ProtocolParameter *parameter, d->parameters) {
+      
+        qDebug() << parameter->name();
+      
+      
         if ((parameter->name() == "account") && (parameter->type() == QVariant::String)) {
             if (!d->accountParameter) {
                 d->accountParameter = parameter;
@@ -71,33 +75,33 @@ MandatoryParametersWidget::MandatoryParametersWidget(Tp::ProtocolParameterList p
     d->ui = new Ui::MandatoryParametersWidget;
     d->ui->setupUi(this);
 
-    // Prefill UI elements if appropriate.
-    if (d->accountParameter) {
-        if (values.contains(d->accountParameter->name())) {
-            d->ui->accountLineEdit->setText(values.value(d->accountParameter->name()).toString());
-        } else {
-            d->ui->accountLineEdit->setText(d->accountParameter->defaultValue().toString());
-        }
-    }
-
-    if (d->passwordParameter) {
-        if (values.contains(d->passwordParameter->name())) {
-            d->ui->passwordLineEdit->setText(values.value(d->passwordParameter->name()).toString());
-        } else {
-            d->ui->passwordLineEdit->setText(d->passwordParameter->defaultValue().toString());
-        }
-    }
-
-    // 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();
-    }
+   // Prefill UI elements if appropriate.
+   if (d->accountParameter) {
+       if (values.contains(d->accountParameter->name())) {
+           d->ui->accountLineEdit->setText(values.value(d->accountParameter->name()).toString());
+       } else {
+           d->ui->accountLineEdit->setText(d->accountParameter->defaultValue().toString());
+       }
+   }
+
+   if (d->passwordParameter) {
+       if (values.contains(d->passwordParameter->name())) {
+           d->ui->passwordLineEdit->setText(values.value(d->passwordParameter->name()).toString());
+       } else {
+           d->ui->passwordLineEdit->setText(d->passwordParameter->defaultValue().toString());
+       }
+   }
+
+//    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()
@@ -113,30 +117,22 @@ QMap<Tp::ProtocolParameter*, QVariant> MandatoryParametersWidget::parameterValue
 
     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());
-    }
+   // 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());
-    }
+   if (d->passwordParameter) {
+       parameters.insert(d->passwordParameter, d->ui->passwordLineEdit->text());
+   }
 
-    return parameters;
+   return parameters;
 }
 
 bool MandatoryParametersWidget::validateParameterValues()
 {
     kDebug();
 
-    // Username is currently the only required parameter
-    if (d->ui->accountLineEdit->text().isEmpty()) {
-        kDebug() << "Returning false and alerting the user.";
-
-        KMessageBox::error(this, i18n("Please enter a Jabber ID."));
-
-        return false;
-    }
 
     return true;
 }
diff --git a/gabble/mandatory-parameters-widget.h b/butterfly/mandatory-parameters-widget.h
similarity index 91%
copy from gabble/mandatory-parameters-widget.h
copy to butterfly/mandatory-parameters-widget.h
index 321fe9f..c8c0c15 100644
--- a/gabble/mandatory-parameters-widget.h
+++ b/butterfly/mandatory-parameters-widget.h
@@ -18,8 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef KCMTELEPATHYACCOUNTS_PLUGIN_GABBLE_ACCOUNT_PARAMETERS_WIDGET_H
-#define KCMTELEPATHYACCOUNTS_PLUGIN_GABBLE_ACCOUNT_PARAMETERS_WIDGET_H
+#ifndef KCMTELEPATHYACCOUNTS_PLUGIN_BUTTERFLY_ACCOUNT_PARAMETERS_WIDGET_H
+#define KCMTELEPATHYACCOUNTS_PLUGIN_BUTTERFLY_ACCOUNT_PARAMETERS_WIDGET_H
 
 #include <KCMTelepathyAccounts/AbstractAccountParametersWidget>
 
diff --git a/butterfly/mandatory-parameters-widget.ui b/butterfly/mandatory-parameters-widget.ui
new file mode 100644
index 0000000..470b3e0
--- /dev/null
+++ b/butterfly/mandatory-parameters-widget.ui
@@ -0,0 +1,75 @@
+<?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>
+  <layout class="QFormLayout" name="formLayout">
+   <property name="fieldGrowthPolicy">
+    <enum>QFormLayout::ExpandingFieldsGrow</enum>
+   </property>
+   <item row="0" column="0">
+    <widget class="QLabel" name="accountLabel">
+     <property name="text">
+      <string>Email Address</string>
+     </property>
+     <property name="alignment">
+      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="1">
+    <widget class="KLineEdit" name="accountLineEdit">
+     <property name="showClearButton" stdset="0">
+      <bool>false</bool>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="0">
+    <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 row="2" column="1">
+    <widget class="KLineEdit" name="passwordLineEdit">
+     <property name="echoMode">
+      <enum>QLineEdit::Password</enum>
+     </property>
+     <property name="showClearButton" stdset="0">
+      <bool>true</bool>
+     </property>
+     <property name="passwordMode">
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="1">
+    <widget class="QLabel" name="label">
+     <property name="text">
+      <string>Example: user at hotmail.com</string>
+     </property>
+    </widget>
+   </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