[Pkg-owncloud-commits] [owncloud-client] 28/171: Share UI: Allow typing in a sharee

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Feb 17 09:36:45 UTC 2016


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

hefee-guest pushed a commit to annotated tag upstream/2.1.1+dfsg
in repository owncloud-client.

commit e2d1a5a41db6fe79d5901af2f5474bc302a02655
Author: Christian Kamm <mail at ckamm.de>
Date:   Thu Dec 10 13:49:47 2015 +0100

    Share UI: Allow typing in a sharee
    
    Previously you *had* to select one of the completion options, even
    if the text in the lineedit was identical to one of the options.
---
 src/gui/shareusergroupwidget.cpp | 19 ++++++++++++++++++-
 src/gui/shareusergroupwidget.h   |  1 +
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/gui/shareusergroupwidget.cpp b/src/gui/shareusergroupwidget.cpp
index e70d039..348b5f8 100644
--- a/src/gui/shareusergroupwidget.cpp
+++ b/src/gui/shareusergroupwidget.cpp
@@ -73,7 +73,7 @@ ShareUserGroupWidget::ShareUserGroupWidget(AccountPtr account, const QString &sh
     _manager = new ShareManager(_account, this);
     connect(_manager, SIGNAL(sharesFetched(QList<QSharedPointer<Share>>)), SLOT(slotSharesFetched(QList<QSharedPointer<Share>>)));
     connect(_manager, SIGNAL(shareCreated(QSharedPointer<Share>)), SLOT(getShares()));
-//    connect(_ui->shareeLineEdit, SIGNAL(returnPressed()), SLOT(on_searchPushButton_clicked()));
+    connect(_ui->shareeLineEdit, SIGNAL(returnPressed()), SLOT(slotLineEditReturn()));
     connect(_completer, SIGNAL(activated(QModelIndex)), SLOT(slotCompleterActivated(QModelIndex)));
 
     // Queued connection so this signal is recieved after textChanged
@@ -105,6 +105,23 @@ void ShareUserGroupWidget::slotLineEditTextEdited(const QString& text)
     }
 }
 
+void ShareUserGroupWidget::slotLineEditReturn()
+{
+    // did the user type in one of the options?
+    const auto text = _ui->shareeLineEdit->text();
+    for (int i = 0; i < _completerModel->rowCount(); ++i) {
+        const auto sharee = _completerModel->getSharee(i);
+        if (sharee->format() == text) {
+            slotCompleterActivated(_completerModel->index(i));
+            break;
+        }
+
+    }
+
+    // nothing found? try to refresh completion
+    _completionTimer.start();
+}
+
 
 void ShareUserGroupWidget::searchForSharees()
 {
diff --git a/src/gui/shareusergroupwidget.h b/src/gui/shareusergroupwidget.h
index fcf2458..ba8bbd6 100644
--- a/src/gui/shareusergroupwidget.h
+++ b/src/gui/shareusergroupwidget.h
@@ -104,6 +104,7 @@ private slots:
     void searchForSharees();
     void slotLineEditTextEdited(const QString &text);
 
+    void slotLineEditReturn();
     void slotCompleterActivated(const QModelIndex & index);
     void slotShareesReady();
     void slotAdjustScrollWidgetSize();

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