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


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

The following commit has been merged in the master branch:
commit 78e4ee81cfa3f5bf9193daf29cc0c6565f86413d
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Sun Apr 24 14:28:38 2011 +0100

    Add Facebook profile UI
---
 gabble/CMakeLists.txt                              |  2 +
 gabble/gabble-account-ui.cpp                       |  6 +-
 gabble/main-options-widget-facebook.cpp            | 78 ++++++++++++++++++++++
 ...ons-widget.h => main-options-widget-facebook.h} | 20 +++---
 .../main-options-widget-facebook.ui                | 26 ++++++--
 5 files changed, 114 insertions(+), 18 deletions(-)

diff --git a/gabble/CMakeLists.txt b/gabble/CMakeLists.txt
index 33972ed..cc8031e 100644
--- a/gabble/CMakeLists.txt
+++ b/gabble/CMakeLists.txt
@@ -9,6 +9,7 @@ set (kcmtelepathyaccounts_plugin_gabble_SRCS
      gabble-account-ui.cpp
      main-options-widget.cpp
      main-options-widget-googletalk.cpp
+     main-options-widget-facebook.cpp
      server-settings-widget.cpp
      proxy-settings-widget.cpp
 )
@@ -16,6 +17,7 @@ set (kcmtelepathyaccounts_plugin_gabble_SRCS
 kde4_add_ui_files (kcmtelepathyaccounts_plugin_gabble_SRCS
                    main-options-widget.ui
                    main-options-widget-googletalk.ui
+                   main-options-widget-facebook.ui
                    server-settings-widget.ui
                    proxy-settings-widget.ui
 )
diff --git a/gabble/gabble-account-ui.cpp b/gabble/gabble-account-ui.cpp
index 71ce0ac..ae2d2b0 100644
--- a/gabble/gabble-account-ui.cpp
+++ b/gabble/gabble-account-ui.cpp
@@ -22,6 +22,7 @@
 
 #include "main-options-widget.h"
 #include "main-options-widget-googletalk.h"
+#include "main-options-widget-facebook.h"
 #include "server-settings-widget.h"
 #include "proxy-settings-widget.h"
 
@@ -69,8 +70,9 @@ AbstractAccountParametersWidget *GabbleAccountUi::mainOptionsWidget(
 {
     if(m_serviceName == QLatin1String("google-talk")) {
 	return new MainOptionsWidgetGoogleTalk(model, parent);
-    }
-    else {
+    } else if (m_serviceName == QLatin1String("facebook")) {
+        return new MainOptionsWidgetFacebook(model, parent);
+    } else {
       return new MainOptionsWidget(model, parent);
     }
 }
diff --git a/gabble/main-options-widget-facebook.cpp b/gabble/main-options-widget-facebook.cpp
new file mode 100644
index 0000000..ad163dd
--- /dev/null
+++ b/gabble/main-options-widget-facebook.cpp
@@ -0,0 +1,78 @@
+/*
+ * This file is part of telepathy-accounts-kcm
+ *
+ * Copyright (C) 2011 David Edmundson <kde at davidedmundson.co.uk>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "main-options-widget-facebook.h"
+
+
+#include <KCMTelepathyAccounts/ParameterEditModel>
+#include <KDebug>
+
+MainOptionsWidgetFacebook::MainOptionsWidgetFacebook(ParameterEditModel *model,
+                                     QWidget *parent)
+ : AbstractAccountParametersWidget(model, parent)
+{
+    kDebug();
+
+    // Set up the UI.
+    m_ui = new Ui::MainOptionsWidgetFacebook;
+    m_ui->setupUi(this);
+
+    // We cannot use handleParameter directly as we need to append @chat.facebook.com onto the end of the JID.
+    // Profiles have no method to do this, so pseudo-hardcoding is the only available option.
+
+    Tp::ProtocolParameter parameter = parameterModel()->parameter("account");
+    QModelIndex index = parameterModel()->indexForParameter(parameter);
+    if (index.isValid()) {
+        QString account = index.data().toString();
+        //strip off any "@chat.facebook.com" from the parameter when displaying it in the text edit.
+        account = account.left(account.indexOf('@'));
+        m_ui->accountLineEdit->setText(account);
+    }
+
+    handleParameter("password", QVariant::String, m_ui->passwordLineEdit, m_ui->passwordLabel);
+}
+
+MainOptionsWidgetFacebook::~MainOptionsWidgetFacebook()
+{
+    kDebug();
+
+    delete m_ui;
+}
+
+void MainOptionsWidgetFacebook::submit()
+{
+    Tp::ProtocolParameter parameter = parameterModel()->parameter("account");
+    QModelIndex index = parameterModel()->indexForParameter(parameter);
+    if (index.isValid()) {
+        QString account = m_ui->accountLineEdit->text();
+
+        //append "@chat.facebook.com" (fetching the address from the default params for as much future compatiability as possible)
+        account.append('@');
+        QString serverAddress = parameterModel()->indexForParameter(parameterModel()->parameter("server")).data().toString();
+        account.append(serverAddress);
+
+        //update the model with the account value from the text box.
+        parameterModel()->setData(index, account, Qt::EditRole);
+    }
+    AbstractAccountParametersWidget::submit();
+}
+
+#include "main-options-widget-facebook.moc"
+
diff --git a/gabble/main-options-widget.h b/gabble/main-options-widget-facebook.h
similarity index 71%
copy from gabble/main-options-widget.h
copy to gabble/main-options-widget-facebook.h
index e6a7112..0f5f42f 100644
--- a/gabble/main-options-widget.h
+++ b/gabble/main-options-widget-facebook.h
@@ -1,7 +1,7 @@
 /*
  * This file is part of telepathy-accounts-kcm
  *
- * Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright (C) 2011 David Edmundson <kde at davidedmundson.co.uk>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -18,25 +18,27 @@
  * 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_GABBLE_ACCOUNT_PARAMETERS_WIDGET_FACEBOOK_H
+#define KCMTELEPATHYACCOUNTS_PLUGIN_GABBLE_ACCOUNT_PARAMETERS_WIDGET_FACEBOOK_H
 
-#include "ui_main-options-widget.h"
+#include "ui_main-options-widget-facebook.h"
 
 #include <KCMTelepathyAccounts/AbstractAccountParametersWidget>
 
-class MainOptionsWidget : public AbstractAccountParametersWidget
+class MainOptionsWidgetFacebook : public AbstractAccountParametersWidget
 {
     Q_OBJECT
+    Q_DISABLE_COPY(MainOptionsWidgetFacebook);
 
 public:
-    explicit MainOptionsWidget(ParameterEditModel *model,
+    explicit MainOptionsWidgetFacebook(ParameterEditModel *model,
                                QWidget *parent = 0);
-    virtual ~MainOptionsWidget();
+    virtual ~MainOptionsWidgetFacebook();
+
+    virtual void submit();
 
 private:
-    Q_DISABLE_COPY(MainOptionsWidget);
-    Ui::MainOptionsWidget *m_ui;
+    Ui::MainOptionsWidgetFacebook *m_ui;
 };
 
 #endif // header guard
diff --git a/sunshine/sunshine-main-options-widget.ui b/gabble/main-options-widget-facebook.ui
similarity index 68%
copy from sunshine/sunshine-main-options-widget.ui
copy to gabble/main-options-widget-facebook.ui
index 6dcd9b7..33aa9ee 100644
--- a/sunshine/sunshine-main-options-widget.ui
+++ b/gabble/main-options-widget-facebook.ui
@@ -1,13 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <ui version="4.0">
- <class>SunshineMainOptionsWidget</class>
- <widget class="QWidget" name="SunshineMainOptionsWidget">
+ <class>MainOptionsWidgetFacebook</class>
+ <widget class="QWidget" name="MainOptionsWidgetFacebook">
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>400</width>
-    <height>58</height>
+    <width>409</width>
+    <height>92</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -22,7 +22,7 @@
      <item row="0" column="0">
       <widget class="QLabel" name="accountLabel">
        <property name="text">
-        <string>Account</string>
+        <string>Username:</string>
        </property>
        <property name="alignment">
         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -32,7 +32,7 @@
      <item row="0" column="1">
       <widget class="KLineEdit" name="accountLineEdit"/>
      </item>
-     <item row="1" column="0">
+     <item row="2" column="0">
       <widget class="QLabel" name="passwordLabel">
        <property name="text">
         <string>Password:</string>
@@ -42,7 +42,7 @@
        </property>
       </widget>
      </item>
-     <item row="1" column="1">
+     <item row="2" column="1">
       <widget class="KLineEdit" name="passwordLineEdit">
        <property name="echoMode">
         <enum>QLineEdit::Password</enum>
@@ -52,6 +52,18 @@
        </property>
       </widget>
      </item>
+     <item row="1" column="1">
+      <widget class="QLabel" name="label">
+       <property name="text">
+        <string>This is your username, not your normal Facebook login.<br/>
+If you are facebook.com/<b>badger</b>, enter <b>badger</b>.<br/>
+Use <a href="http://www.facebook.com/username/">this page</a> to choose a Facebook username.</string>
+       </property>
+       <property name="textFormat">
+        <enum>Qt::RichText</enum>
+       </property>
+      </widget>
+     </item>
     </layout>
    </item>
   </layout>

-- 
ktp-accounts-kcm packaging



More information about the pkg-kde-commits mailing list