[Pkg-owncloud-commits] [owncloud-client] 266/484: [Sharing] Build sharee list on every search

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Dec 16 00:37:51 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 6431a2aa4618a5759b9874f4a74cee2e6eacfad5
Author: Roeland Jago Douma <rullzer at owncloud.com>
Date:   Thu Nov 5 15:01:29 2015 +0100

    [Sharing] Build sharee list on every search
---
 src/gui/shareusergroupwidget.cpp | 45 ++++++++++++++++++++++++++--------------
 src/gui/shareusergroupwidget.h   |  2 ++
 2 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/src/gui/shareusergroupwidget.cpp b/src/gui/shareusergroupwidget.cpp
index 031ac84..7beb8a9 100644
--- a/src/gui/shareusergroupwidget.cpp
+++ b/src/gui/shareusergroupwidget.cpp
@@ -80,10 +80,29 @@ void ShareUserGroupWidget::on_shareeLineEdit_textChanged(const QString &text)
 
 void ShareUserGroupWidget::on_searchPushButton_clicked()
 {
+     QVector<QSharedPointer<Sharee>> sharees;
+
+    // Add the current user to _sharees since we can't share with ourself
+    QSharedPointer<Sharee> currentUser(new Sharee(_account->credentials()->user(), "", Sharee::Type::User));
+    sharees.append(currentUser);
+
+    for(int i = 0; i < _ui->sharesLayout->count(); i++) {
+        QWidget *w = _ui->sharesLayout->itemAt(i)->widget();
+
+        if (w != NULL) {
+            const QSharedPointer<Sharee> x = dynamic_cast<ShareWidget *>(w)->share()->getShareWith();
+            sharees.append(x);
+        }
+    }
+
+
+    _sharees.append(currentUser);
+
+
     _completerModel = new ShareeModel(_account,
                                       _ui->shareeLineEdit->text(),
                                       _isFile ? QLatin1String("file") : QLatin1String("folder"),
-                                      _sharees,
+                                      sharees,
                                       _completer);
     connect(_completerModel, SIGNAL(shareesReady()), SLOT(slotUpdateCompletion()));
     _completerModel->fetch();
@@ -101,34 +120,23 @@ void ShareUserGroupWidget::getShares()
 
 void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>> &shares)
 {
-    const QString versionString = _account->serverVersion();
-    qDebug() << Q_FUNC_INFO << versionString << "Fetched" << shares.count() << "shares";
-
-    //FIXME
+    /*
+     * Delete all current widgets
+     */
     QLayoutItem *child;
     while ((child = _ui->sharesLayout->takeAt(0)) != 0) {
         delete child->widget();
     }
 
-    _sharees.clear();
-
     foreach(const auto &share, shares) {
-
+        // We don't handle link shares
         if (share->getShareType() == Share::TypeLink) {
             continue;
         }
 
         ShareWidget *s = new ShareWidget(share, this);
         _ui->sharesLayout->addWidget(s);
-
-        _sharees.append(share->getShareWith());
     }
-    
-    // Add the current user to _sharees since we can't share with ourself
-    QSharedPointer<Sharee> currentUser(new Sharee(_account->credentials()->user(), "", Sharee::Type::User));
-    _sharees.append(currentUser);
-
-    _ui->sharesLayout->invalidate();
 }
 
 void ShareUserGroupWidget::slotCompleterActivated(const QModelIndex & index) {
@@ -225,4 +233,9 @@ void ShareWidget::slotPermissionsSet()
     setEnabled(true);
 }
 
+QSharedPointer<Share> ShareWidget::share() const
+{
+    return _share;
+}
+
 }
diff --git a/src/gui/shareusergroupwidget.h b/src/gui/shareusergroupwidget.h
index 5da18bc..4a8234a 100644
--- a/src/gui/shareusergroupwidget.h
+++ b/src/gui/shareusergroupwidget.h
@@ -48,6 +48,8 @@ public:
     explicit ShareWidget(QSharedPointer<Share> Share, QWidget *parent = 0);
     ~ShareWidget();
 
+    QSharedPointer<Share> share() const;
+
 signals:
     void shareDeleted(ShareWidget *share);
 

-- 
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