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


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

The following commit has been merged in the master branch:
commit 01955352465dbde7a439b8c1c9e41389c8d83b71
Author: Aleix Pol <aleixpol at kde.org>
Date:   Mon Feb 25 15:43:16 2013 +0100

    Proper filtering for pinned contacts
    
    This adds a new class to substitute the:
    visible: available && !alreadyChatting
    
    REVIEW: 109137
---
 KTp/Declarative/CMakeLists.txt                     |  1 +
 .../filtered-pinned-contacts-proxy-model.cpp}      | 35 +++++++---------------
 ...nt.h => filtered-pinned-contacts-proxy-model.h} | 24 +++++++--------
 KTp/Declarative/qml-plugins.cpp                    |  2 ++
 4 files changed, 24 insertions(+), 38 deletions(-)

diff --git a/KTp/Declarative/CMakeLists.txt b/KTp/Declarative/CMakeLists.txt
index f42252d..3865c13 100644
--- a/KTp/Declarative/CMakeLists.txt
+++ b/KTp/Declarative/CMakeLists.txt
@@ -13,6 +13,7 @@ set (ktp_qml_plugin_SRCS
     messages-model.cpp
     telepathy-text-observer.cpp
     pinned-contacts-model.cpp
+    filtered-pinned-contacts-proxy-model.cpp
     contact-pin.cpp
 
     qml-plugins.cpp
diff --git a/KTp/abstract-message-filter.cpp b/KTp/Declarative/filtered-pinned-contacts-proxy-model.cpp
similarity index 54%
copy from KTp/abstract-message-filter.cpp
copy to KTp/Declarative/filtered-pinned-contacts-proxy-model.cpp
index acead98..5b162cf 100644
--- a/KTp/abstract-message-filter.cpp
+++ b/KTp/Declarative/filtered-pinned-contacts-proxy-model.cpp
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012  Lasath Fernando <kde at lasath.org>
+    Copyright (C) 2012 Aleix Pol <aleixpol 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,33 +16,20 @@
     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */
 
-#include "abstract-message-filter.h"
+#include "filtered-pinned-contacts-proxy-model.h"
+#include "pinned-contacts-model.h"
 
-namespace KTp {
-
-AbstractMessageFilter::AbstractMessageFilter(QObject* parent)
-    : QObject(parent)
-{
-}
-
-AbstractMessageFilter::~AbstractMessageFilter()
+FilteredPinnedContactsProxyModel::FilteredPinnedContactsProxyModel(QObject* parent)
+    : QSortFilterProxyModel(parent)
 {
+    setDynamicSortFilter(true);
 }
 
-void AbstractMessageFilter::filterMessage(KTp::Message &message, const KTp::MessageContext &context)
+bool FilteredPinnedContactsProxyModel::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const
 {
-    Q_UNUSED(message)
-    Q_UNUSED(context)
+    QModelIndex idx = sourceModel()->index(source_row, 0, source_parent);
+    bool ret = idx.data(PinnedContactsModel::AvailabilityRole).toBool()
+           && !idx.data(PinnedContactsModel::AlreadyChattingRole).toBool();
+    return ret;
 }
 
-QStringList AbstractMessageFilter::requiredScripts()
-{
-    return QStringList();
-}
-
-QStringList AbstractMessageFilter::requiredStylesheets()
-{
-    return QStringList();
-}
-
-}
diff --git a/KTp/Declarative/hide-window-component.h b/KTp/Declarative/filtered-pinned-contacts-proxy-model.h
similarity index 58%
copy from KTp/Declarative/hide-window-component.h
copy to KTp/Declarative/filtered-pinned-contacts-proxy-model.h
index 78d0bff..abfdacd 100644
--- a/KTp/Declarative/hide-window-component.h
+++ b/KTp/Declarative/filtered-pinned-contacts-proxy-model.h
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012 Aleix Pol Gonzalez <aleixpol at blue-systems.com>
+    Copyright (C) 2012 Aleix Pol <aleixpol 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,19 @@
     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */
 
-#ifndef HIDEWINDOWCOMPONENT_H
-#define HIDEWINDOWCOMPONENT_H
+#ifndef FILTEREDPINNEDCONTACTSPROXYMODEL_H
+#define FILTEREDPINNEDCONTACTSPROXYMODEL_H
 
-#include <QObject>
+#include <QSortFilterProxyModel>
 
-/**
- * Plasma is not exposing such a feature to make its dialogs hidden from the taskbar,
- * that's why we added that weird object
- */
-
-class HideWindowComponent : public QObject
+class FilteredPinnedContactsProxyModel : public QSortFilterProxyModel
 {
     Q_OBJECT
-  public:
-    explicit HideWindowComponent(QObject *parent = 0);
+    Q_PROPERTY(QAbstractItemModel* sourceModel READ sourceModel WRITE setSourceModel)
+    public:
+        FilteredPinnedContactsProxyModel(QObject* parent = 0);
 
-    Q_SCRIPTABLE void hideWindowFromTaskbar(qulonglong winId);
+        virtual bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const;
 };
 
-#endif // HIDEWINDOWCOMPONENT_H
+#endif // FILTEREDPINNEDCONTACTSPROXYMODEL_H
diff --git a/KTp/Declarative/qml-plugins.cpp b/KTp/Declarative/qml-plugins.cpp
index bd2a927..7bf1c41 100644
--- a/KTp/Declarative/qml-plugins.cpp
+++ b/KTp/Declarative/qml-plugins.cpp
@@ -32,6 +32,7 @@
 #include "telepathy-text-observer.h"
 #include "pinned-contacts-model.h"
 #include "contact-pin.h"
+#include "filtered-pinned-contacts-proxy-model.h"
 
 #include "Models/contacts-filter-model.h"
 
@@ -43,6 +44,7 @@ void QmlPlugins::registerTypes(const char *uri)
     qmlRegisterType<HideWindowComponent>(uri, 0, 1, "HideWindowComponent");
     qmlRegisterType<PinnedContactsModel>(uri, 0, 1, "PinnedContactsModel");
     qmlRegisterType<ContactPin>(uri, 0, 1, "ContactPin");
+    qmlRegisterType<FilteredPinnedContactsProxyModel>(uri, 0, 1, "FilteredPinnedContactsProxyModel");
 
     qmlRegisterUncreatableType<KTp::ContactsFilterModel> (uri, 0, 1, "AccountsFilterModel",
         QLatin1String("Filter cannot be created. Access through ContactList.filter"));

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list