[SCM] ktp-send-file packaging branch, master, updated. debian/15.12.1-2-216-g8f07cdf

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:14:31 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-send-file.git;a=commitdiff;h=d6d0a32

The following commit has been merged in the master branch:
commit d6d0a3280600d7a95b9dc7ac1b7a412642ff0314
Author: Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
Date:   Thu Feb 9 17:28:22 2012 +0100

    Use FlatModelProxy from common-internals
---
 CMakeLists.txt       |   1 -
 flat-model-proxy.cpp | 188 ---------------------------------------------------
 flat-model-proxy.h   |  64 ------------------
 mainwindow.cpp       |   3 +-
 4 files changed, 1 insertion(+), 255 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1bb21a2..e2f24fb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,7 +28,6 @@ include_directories(
 set(KTP_SEND_FILE_SRCS
     mainwindow.cpp
     main.cpp
-    flat-model-proxy.cpp
 )
 
 set(KTP_SEND_FILE_UI
diff --git a/flat-model-proxy.cpp b/flat-model-proxy.cpp
deleted file mode 100644
index b9a2a43..0000000
--- a/flat-model-proxy.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * This file is part of TelepathyQt4Yell Models
- *
- * Copyright (C) 2010 Collabora Ltd. <info at collabora.com>
- *
- * 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 "flat-model-proxy.h"
-
-
-struct FlatModelProxy::Private
-{
-    int offsetOf(const FlatModelProxy *model, int index) const;
-};
-
-int FlatModelProxy::Private::offsetOf(const FlatModelProxy *model, int index) const
-{
-    int offset = 0;
-    for (int i = 0; i < index; i++) {
-        offset += model->sourceModel()->rowCount(model->sourceModel()->index(i, 0, QModelIndex()));
-    }
-    return offset;
-}
-
-FlatModelProxy::FlatModelProxy(QAbstractItemModel *source)
-    : QAbstractProxyModel(source),
-      mPriv(new Private())
-{
-    setSourceModel(source);
-
-    connect(source,
-            SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
-            SLOT(onRowsAboutToBeInserted(QModelIndex,int,int)));
-    connect(source,
-            SIGNAL(rowsInserted(QModelIndex,int,int)),
-            SLOT(onRowsInserted(QModelIndex,int,int)));
-    connect(source,
-            SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
-            SLOT(onRowsAboutToBeRemoved(QModelIndex,int,int)));
-    connect(source,
-            SIGNAL(rowsRemoved(QModelIndex,int,int)),
-            SLOT(onRowsRemoved(QModelIndex,int,int)));
-    connect(source,
-            SIGNAL(rowsInserted(QModelIndex,int,int)),
-            SIGNAL(rowCountChanged()));
-    connect(source,
-            SIGNAL(rowsRemoved(QModelIndex,int,int)),
-            SIGNAL(rowCountChanged()));
-    connect(source,
-            SIGNAL(dataChanged(QModelIndex,QModelIndex)),
-            SLOT(onDataChanged(QModelIndex,QModelIndex)));
-}
-
-FlatModelProxy::~FlatModelProxy()
-{
-    delete mPriv;
-}
-
-QModelIndex FlatModelProxy::mapFromSource(const QModelIndex &index) const
-{
-    if (!index.isValid()) {
-        return QModelIndex();
-    }
-
-    QModelIndex parent = index.parent();
-
-    if (!parent.isValid()) {
-        return QModelIndex();
-    }
-
-    return createIndex(mPriv->offsetOf(this, parent.row()) + index.row(), index.column(), parent.row());
-}
-
-QModelIndex FlatModelProxy::mapToSource(const QModelIndex &index) const
-{
-    int parentRow = index.internalId();
-    QModelIndex parent = sourceModel()->index(parentRow, 0, QModelIndex());
-    int row = index.row() - mPriv->offsetOf(this, parent.row());
-    return sourceModel()->index(row, index.column(), parent);
-}
-
-QModelIndex FlatModelProxy::index(int row, int column, const QModelIndex &parent) const
-{
-    Q_UNUSED(parent)
-    int count = 0;
-    for (int i = 0; i < sourceModel()->rowCount(QModelIndex()); i++) {
-        QModelIndex sourceIndex = sourceModel()->index(i, 0, QModelIndex());
-        count += sourceModel()->rowCount(sourceIndex);
-        if (row < count) {
-            return createIndex(row, column, i);
-        }
-    }
-
-    return QModelIndex();
-}
-
-QModelIndex FlatModelProxy::parent(const QModelIndex &index) const
-{
-    Q_UNUSED(index)
-    return QModelIndex();
-}
-
-int FlatModelProxy::columnCount(const QModelIndex &parent) const
-{
-    Q_UNUSED(parent)
-    return 1;
-}
-
-int FlatModelProxy::rowCount() const
-{
-    return rowCount(QModelIndex());
-}
-
-int FlatModelProxy::rowCount(const QModelIndex &parent) const
-{
-    Q_UNUSED(parent)
-    return mPriv->offsetOf(this, sourceModel()->rowCount(QModelIndex()));
-}
-
-void FlatModelProxy::onRowsAboutToBeInserted(const QModelIndex &index, int first, int last)
-{
-    if (index.isValid()) {
-        int offset = mPriv->offsetOf(this, index.row());
-        int firstIndex = offset + first;
-        int lastIndex = offset + last;
-
-        beginInsertRows(QModelIndex(), firstIndex, lastIndex);
-    }
-}
-
-void FlatModelProxy::onRowsAboutToBeRemoved(const QModelIndex &index, int first, int last)
-{
-    if (index.isValid()) {
-        int offset = mPriv->offsetOf(this, index.row());
-        int firstIndex = offset + first;
-        int lastIndex = offset + last;
-
-        beginRemoveRows(QModelIndex(), firstIndex, lastIndex);
-    }
-}
-
-void FlatModelProxy::onRowsInserted(const QModelIndex &index, int first, int last)
-{
-    Q_UNUSED(first)
-    Q_UNUSED(last)
-    if (index.isValid()) {
-        endInsertRows();
-    }
-}
-
-void FlatModelProxy::onRowsRemoved(const QModelIndex &index, int first, int last)
-{
-    Q_UNUSED(first)
-    Q_UNUSED(last)
-    if (index.isValid()) {
-        endRemoveRows();
-    }
-}
-
-void FlatModelProxy::onDataChanged(const QModelIndex &first, const QModelIndex &last)
-{
-    if (!first.parent().isValid()) {
-        int firstOffset = mPriv->offsetOf(this, first.row());
-        int lastOffset = mPriv->offsetOf(this, last.row() + 1) - 1;
-
-        QModelIndex firstIndex = createIndex(firstOffset, 0, first.row());
-        QModelIndex lastIndex = createIndex(lastOffset, 0, last.row());
-        emit dataChanged(firstIndex, lastIndex);
-    }
-    else if (first.parent() == last.parent()) {
-        QModelIndex firstIndex = mapFromSource(first);
-        QModelIndex lastIndex = mapFromSource(last);
-        emit dataChanged(firstIndex, lastIndex);
-    }
-}
diff --git a/flat-model-proxy.h b/flat-model-proxy.h
deleted file mode 100644
index f0a8903..0000000
--- a/flat-model-proxy.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * This file is part of TelepathyQt4Yell Models
- *
- * Copyright (C) 2010 Collabora Ltd. <info at collabora.com>
- *
- * 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
- */
-
-#ifndef TelepathyQt4Yell_Models_flat_model_proxy_h_HEADER_GUARD
-#define TelepathyQt4Yell_Models_flat_model_proxy_h_HEADER_GUARD
-
-
-#include <QAbstractProxyModel>
-
-class FlatModelProxy : public QAbstractProxyModel
-{
-    Q_OBJECT
-    Q_DISABLE_COPY(FlatModelProxy)
-    Q_PROPERTY(int rowCount READ rowCount NOTIFY rowCountChanged)
-
-public:
-    FlatModelProxy(QAbstractItemModel *source);
-    virtual ~FlatModelProxy();
-
-    virtual QModelIndex mapFromSource(const QModelIndex &index) const;
-    virtual QModelIndex mapToSource(const QModelIndex &index) const;
-    virtual QModelIndex index(int row, int column, const QModelIndex &parent) const;
-    virtual QModelIndex parent(const QModelIndex &index) const;
-    virtual int rowCount(const QModelIndex &parent) const;
-    virtual int columnCount(const QModelIndex &parent) const;
-
-    int rowCount() const;
-
-Q_SIGNALS:
-    void rowCountChanged();
-
-private Q_SLOTS:
-    void onRowsAboutToBeInserted(const QModelIndex &index, int first, int last);
-    void onRowsInserted(const QModelIndex &index, int first, int last);
-    void onRowsAboutToBeRemoved(const QModelIndex &index, int first, int last);
-    void onRowsRemoved(const QModelIndex &index, int first, int last);
-    void onDataChanged(const QModelIndex &first, const QModelIndex &last);
-
-private:
-    struct Private;
-    friend struct Private;
-    Private *mPriv;
-};
-
-
-
-#endif // TelepathyQt4Yell_Models_flat_model_proxy_h_HEADER_GUARD
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 52225a0..0daffb7 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -44,11 +44,10 @@
 #include <TelepathyQt/PendingChannelRequest>
 #include <TelepathyQt/PendingReady>
 
-#include "flat-model-proxy.h"
-
 #include <KTp/Models/accounts-model.h>
 #include <KTp/Models/accounts-filter-model.h>
 #include <KTp/Models/contact-model-item.h>
+#include <KTp/Models/flat-model-proxy.h>
 
 //FIXME, copy and paste the approver code for loading this from a config file into this, the contact list and the chat handler.
 #define PREFERRED_FILETRANSFER_HANDLER "org.freedesktop.Telepathy.Client.KTp.FileTransfer"

-- 
ktp-send-file packaging



More information about the pkg-kde-commits mailing list