[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:04:34 UTC 2016


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

The following commit has been merged in the master branch:
commit b399c56ad49205a2b5af421350c033287efe5558
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Fri Sep 16 23:50:32 2011 +0100

    Add mimeData data to accounts model for dragging to desktop
    Reviewed-by: Martin Klapetek
---
 models/accounts-model.cpp | 27 +++++++++++++++++++++++++++
 models/accounts-model.h   |  3 +++
 2 files changed, 30 insertions(+)

diff --git a/models/accounts-model.cpp b/models/accounts-model.cpp
index d430e44..75d224f 100644
--- a/models/accounts-model.cpp
+++ b/models/accounts-model.cpp
@@ -302,4 +302,31 @@ QModelIndex AccountsModel::parent(const QModelIndex &index) const
     }
 }
 
+QStringList AccountsModel::mimeTypes() const
+{
+    QStringList types;
+    types << "application/vnd.telepathy.contact";
+    return types;
+}
+
+QMimeData* AccountsModel::mimeData(const QModelIndexList& indexes) const
+{
+    QMimeData *mimeData = new QMimeData();
+    QByteArray encodedData;
+
+    QDataStream stream(&encodedData, QIODevice::WriteOnly);
+
+    foreach (const QModelIndex &index, indexes) {
+        if (index.isValid()) {
+            ContactModelItem *c = data(index, AccountsModel::ItemRole).value<ContactModelItem*>();
+            //We put a contact ID and its account ID to the stream, so we can later recreate the contact using AccountsModel
+            stream << c->contact().data()->id() << accountForContactItem(c).data()->uniqueIdentifier();
+        }
+    }
+
+    mimeData->setData("application/vnd.telepathy.contact", encodedData);
+    return mimeData;
+}
+
+
 #include "accounts-model.moc"
diff --git a/models/accounts-model.h b/models/accounts-model.h
index 7a9991e..40b915b 100644
--- a/models/accounts-model.h
+++ b/models/accounts-model.h
@@ -107,6 +107,9 @@ public:
     virtual QModelIndex index(TreeNode *node) const;
     virtual QModelIndex parent(const QModelIndex &index) const;
 
+    virtual QStringList mimeTypes() const;
+    virtual QMimeData* mimeData(const QModelIndexList &indexes) const;
+
     int accountCount() const;
     Q_INVOKABLE QObject *accountItemForId(const QString &id) const;
     Q_INVOKABLE QObject *contactItemForId(const QString &accountId, const QString &contactId) const;

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list