[Pkg-owncloud-commits] [owncloud-client] 282/484: ShareDialog: fix autocompletion took the wrong user

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Dec 16 00:37:53 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit b29d1e94b59baf95bb917985e93fec42a2bd84c9
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Mon Nov 9 17:21:42 2015 +0100

    ShareDialog: fix autocompletion took the wrong user
---
 src/gui/sharee.cpp               | 3 +++
 src/gui/sharee.h                 | 2 ++
 src/gui/shareusergroupwidget.cpp | 9 ++++++---
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/gui/sharee.cpp b/src/gui/sharee.cpp
index 7f29806..cfb1dec 100644
--- a/src/gui/sharee.cpp
+++ b/src/gui/sharee.cpp
@@ -165,6 +165,9 @@ QVariant ShareeModel::data(const QModelIndex &index, int role) const
     if (role == Qt::DisplayRole || role == Qt::EditRole) {
         return _sharees.at(index.row())->format();
     } 
+    if (role == Qt::UserRole) {
+        return QVariant::fromValue(_sharees.at(index.row()));
+    }
     
     return QVariant();
 }
diff --git a/src/gui/sharee.h b/src/gui/sharee.h
index ec95544..bcada5e 100644
--- a/src/gui/sharee.h
+++ b/src/gui/sharee.h
@@ -85,4 +85,6 @@ private:
 
 }
 
+Q_DECLARE_METATYPE(QSharedPointer<OCC::Sharee>);
+
 #endif  //SHAREE_H
diff --git a/src/gui/shareusergroupwidget.cpp b/src/gui/shareusergroupwidget.cpp
index 8edeaef..6fe79db 100644
--- a/src/gui/shareusergroupwidget.cpp
+++ b/src/gui/shareusergroupwidget.cpp
@@ -32,6 +32,7 @@
 #include <QFileIconProvider>
 #include <QClipboard>
 #include <QFileInfo>
+#include <QAbstractProxyModel>
 #include <QCompleter>
 
 namespace OCC {
@@ -140,9 +141,11 @@ void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>>
     _ui->labelShares->setVisible(!shares.empty());
 }
 
-void ShareUserGroupWidget::slotCompleterActivated(const QModelIndex & index) {
-    auto sharee = _completerModel->getSharee(index.row());
-
+void ShareUserGroupWidget::slotCompleterActivated(const QModelIndex & index)
+{
+    // The index is an index from the QCompletion model which is itelf a proxy
+    // model proxying the _completerModel
+    auto sharee = qvariant_cast<QSharedPointer<Sharee>>(index.data(Qt::UserRole));
     if (sharee.isNull()) {
         return;
     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list