[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=b0d67eb

The following commit has been merged in the master branch:
commit b0d67eb12fd838ec938ae3a123ca14e859f95799
Author: Francesco Nwokeka <francesco.nwokeka at gmail.com>
Date:   Sun Oct 9 16:45:16 2011 +0200

    changed the mimedata used for drag n drop
    
    contactlist now uses the correct mimedata as the contact-applet enabling drag n drop on the kde plasma
    desktop
    
    REVIEW: 102793
    Reviewed By: David Edmundson
---
 models/accounts-model.cpp | 7 ++++++-
 models/accounts-model.h   | 1 +
 models/groups-model.cpp   | 8 ++++++--
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/models/accounts-model.cpp b/models/accounts-model.cpp
index 88e3080..21f14cb 100644
--- a/models/accounts-model.cpp
+++ b/models/accounts-model.cpp
@@ -245,6 +245,11 @@ Tp::AccountPtr AccountsModel::accountForContactItem(ContactModelItem *contactIte
     }
 }
 
+Tp::AccountPtr AccountsModel::accountPtrForPath(const QString& accountPath) const
+{
+    return mPriv->mAM->accountForPath(accountPath);
+}
+
 Qt::ItemFlags AccountsModel::flags(const QModelIndex &index) const
 {
     if (index.isValid()) {
@@ -321,7 +326,7 @@ QMimeData* AccountsModel::mimeData(const QModelIndexList& indexes) const
         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();
+            stream << c->contact().data()->id() << accountForContactItem(c).data()->objectPath();
         }
     }
 
diff --git a/models/accounts-model.h b/models/accounts-model.h
index 47925e1..825f113 100644
--- a/models/accounts-model.h
+++ b/models/accounts-model.h
@@ -101,6 +101,7 @@ public:
     virtual QVariant data(const QModelIndex &index, int role) const;
 
     Tp::AccountPtr accountForContactItem(ContactModelItem* contactItem) const;
+    Tp::AccountPtr accountPtrForPath(const QString &accountPath) const;
 
     virtual Qt::ItemFlags flags(const QModelIndex &index) const;
     virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
diff --git a/models/groups-model.cpp b/models/groups-model.cpp
index b692ff5..2f029b1 100644
--- a/models/groups-model.cpp
+++ b/models/groups-model.cpp
@@ -138,7 +138,7 @@ QMimeData* GroupsModel::mimeData(const QModelIndexList& indexes) const
         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() << mPriv->mAM->accountForContactItem(c).data()->uniqueIdentifier();
+            stream << c->contact().data()->id() << mPriv->mAM->accountForContactItem(c).data()->objectPath();
         }
     }
 
@@ -167,10 +167,14 @@ bool GroupsModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int
     while (!stream.atEnd()) {
         QString contact;
         QString account;
+
         //get contact and account out of the stream
         stream >> contact >> account;
+
+        Tp::AccountPtr accountPtr = mPriv->mAM->accountPtrForPath(account);
+
         //casted pointer is checked below, before first use
-        contacts.append(qobject_cast<ContactModelItem*>(mPriv->mAM->contactItemForId(account, contact)));
+        contacts.append(qobject_cast<ContactModelItem*>(mPriv->mAM->contactItemForId(accountPtr->uniqueIdentifier(), contact)));
     }
 
     foreach (ContactModelItem *contact, contacts) {

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list