[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9

Maximiliano Curia maxy at moszumanska.debian.org
Mon May 9 09:07:06 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=052659b

The following commit has been merged in the master branch:
commit 052659b1a14c3fb5faa945d0bf1cc0addc3ff85d
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Fri Sep 6 00:36:48 2013 +0000

    Add kpeople plugin to show IM contacts in show details view
    
    REVIEW: 112549
    BUG: 324280
---
 kpeople/CMakeLists.txt                             |  1 +
 kpeople/uiplugins/CMakeLists.txt                   | 13 ++++
 kpeople/uiplugins/imdetailswidget.cpp              | 89 ++++++++++++++++++++++
 .../uiplugins/imdetailswidget.h                    | 29 +++----
 kpeople/uiplugins/imdetailswidgetplugin.desktop    | 11 +++
 5 files changed, 129 insertions(+), 14 deletions(-)

diff --git a/kpeople/CMakeLists.txt b/kpeople/CMakeLists.txt
index 10c3758..c5f1019 100644
--- a/kpeople/CMakeLists.txt
+++ b/kpeople/CMakeLists.txt
@@ -1,2 +1,3 @@
 add_subdirectory(actionsplugin)
 add_subdirectory(datasourceplugin)
+add_subdirectory(uiplugins)
diff --git a/kpeople/uiplugins/CMakeLists.txt b/kpeople/uiplugins/CMakeLists.txt
new file mode 100644
index 0000000..ee82752
--- /dev/null
+++ b/kpeople/uiplugins/CMakeLists.txt
@@ -0,0 +1,13 @@
+kde4_add_plugin(imdetailswidgetplugin imdetailswidget.cpp)
+target_link_libraries(imdetailswidgetplugin ${QT_QTCORE_LIBRARY}
+    ${QT_QTGUI_LIBRARY}
+    ${TELEPATHY_QT4_LIBRARIES}
+    ${KDE4_KDECORE_LIBRARY}
+    ${KDE4_KDEUI_LIBRARY}
+    ${KPEOPLE_LIBS}
+    kpeoplewidgets
+    ktpcommoninternalsprivate
+)
+
+install(TARGETS imdetailswidgetplugin DESTINATION ${PLUGIN_INSTALL_DIR})
+install(FILES imdetailswidgetplugin.desktop DESTINATION ${SERVICES_INSTALL_DIR})
diff --git a/kpeople/uiplugins/imdetailswidget.cpp b/kpeople/uiplugins/imdetailswidget.cpp
new file mode 100644
index 0000000..6102915
--- /dev/null
+++ b/kpeople/uiplugins/imdetailswidget.cpp
@@ -0,0 +1,89 @@
+/*
+    Copyright (C) 2013  David Edmundson <davidedmundson at kde.org>
+
+    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 Street, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#include "imdetailswidget.h"
+
+#include <QGridLayout>
+#include <QLabel>
+#include <QApplication>
+#include <QStyle>
+
+#include <KLocalizedString>
+#include <KPluginFactory>
+
+#include <KPeople/PersonData>
+#include <kpeople/personpluginmanager.h> //no pretty include exists at time of writing.
+
+#include "KTp/im-persons-data-source.h"
+
+K_PLUGIN_FACTORY( ImDetailsWidgetFactory, registerPlugin<ImDetailsWidget>(); )
+K_EXPORT_PLUGIN( ImDetailsWidgetFactory("imdetailswidgetplugin"))
+
+using namespace KPeople;
+
+ImDetailsWidget::ImDetailsWidget(QWidget *parent, const QVariantList &args):
+    AbstractPersonDetailsWidget(parent),
+    m_layout(new QGridLayout(this))
+{
+    Q_UNUSED(args);
+    setTitle(i18n("Instant Messaging Accounts"));
+    setIcon(QIcon::fromTheme(QLatin1String("telepathy-kde")));
+
+    setLayout(m_layout);
+}
+
+void ImDetailsWidget::setPerson(PersonData *person)
+{
+    const QStringList &imAccounts = person->imAccounts();
+
+    //remove all existing widgets
+    QLayoutItem *child;
+    while ((child = m_layout->takeAt(0)) != 0) {
+        delete child->widget();
+        delete child;
+    }
+
+    if (imAccounts.isEmpty()) {
+        setActive(false);
+        return;
+    } else {
+        setActive(true);
+    }
+
+    //fetch KTp::ContactPtr for the contact ID from KTp
+    //display presence and address in grid
+    IMPersonsDataSource *dataSource = dynamic_cast<IMPersonsDataSource*>(KPeople::PersonPluginManager::presencePlugin());
+    for (int i=0; i<imAccounts.size(); i++) {
+        const QString &contactId = imAccounts[i];
+        KTp::ContactPtr contact = dataSource->contactForContactId(contactId);
+        KTp::Presence presence;
+        if (contact) {
+            presence = contact->presence();
+        } else {
+            presence = KTp::Presence(Tp::Presence::offline());
+        }
+
+        QLabel *iconLabel = new QLabel(this);
+        const int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize);
+        iconLabel->setPixmap(presence.icon().pixmap(iconSize, iconSize));
+        m_layout->addWidget(iconLabel, i, 0);
+
+        QLabel *label = new QLabel(contactId, this);
+        m_layout->addWidget(label, i, 1);
+    }
+}
diff --git a/KTp/Declarative/hide-window-component.h b/kpeople/uiplugins/imdetailswidget.h
similarity index 61%
copy from KTp/Declarative/hide-window-component.h
copy to kpeople/uiplugins/imdetailswidget.h
index 78d0bff..b99ff32 100644
--- a/KTp/Declarative/hide-window-component.h
+++ b/kpeople/uiplugins/imdetailswidget.h
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol at blue-systems.com>
+    Copyright (C) 2013  David Edmundson <davidedmundson at kde.org>
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
@@ -16,23 +16,24 @@
     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */
 
-#ifndef HIDEWINDOWCOMPONENT_H
-#define HIDEWINDOWCOMPONENT_H
 
-#include <QObject>
 
-/**
- * Plasma is not exposing such a feature to make its dialogs hidden from the taskbar,
- * that's why we added that weird object
- */
+#ifndef IM_DETAILS_WIDGET_H
+#define IM_DETAILS_WIDGET_H
 
-class HideWindowComponent : public QObject
+#include <kpeople/widgets/abstractpersondetailswidget.h>
+
+#include <QVariant>
+#include <QGridLayout>
+
+class ImDetailsWidget : public KPeople::AbstractPersonDetailsWidget
 {
     Q_OBJECT
-  public:
-    explicit HideWindowComponent(QObject *parent = 0);
-
-    Q_SCRIPTABLE void hideWindowFromTaskbar(qulonglong winId);
+public:
+    explicit ImDetailsWidget(QWidget *parent, const QVariantList &args);
+    void setPerson(KPeople::PersonData *person);
+private:
+    QGridLayout *m_layout;
 };
 
-#endif // HIDEWINDOWCOMPONENT_H
+#endif // IM_DETAILS_WIDGET_H
diff --git a/kpeople/uiplugins/imdetailswidgetplugin.desktop b/kpeople/uiplugins/imdetailswidgetplugin.desktop
new file mode 100644
index 0000000..4ee25ec
--- /dev/null
+++ b/kpeople/uiplugins/imdetailswidgetplugin.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Type=Service
+ServiceTypes=KPeopleWidgets/Plugin
+
+X-KDE-Library=imdetailswidgetplugin
+X-KDE-PluginInfo-Name=imdetailswidgetplugin
+X-KDE-PluginInfo-Author=David Edmundson
+X-KDE-PluginInfo-Email=davidedmundson at kde.org
+X-KDE-PluginInfo-Version=0.1
+X-KDE-PluginInfo-License=LGPL
+X-KPeople-Weight=2

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list