]> dgit.raspbian.org Git - nextcloud-desktop.git/commitdiff
Add spinner during sharee search (#4764)
authorRoeland Douma <rullzer@users.noreply.github.com>
Fri, 29 Apr 2016 12:11:27 +0000 (14:11 +0200)
committerMarkus Goetz <markus@woboq.com>
Fri, 29 Apr 2016 12:11:27 +0000 (14:11 +0200)
Fixed #4740

When searching for sharees we should display a loading spinner.

src/gui/shareusergroupwidget.cpp
src/gui/shareusergroupwidget.h
src/gui/shareusergroupwidget.ui

index 441606743eafbf6ebe601c6939a5835790dba603..c7f4988e7fb59588215a7655f0dd7dbedb1016f3 100644 (file)
@@ -99,6 +99,9 @@ ShareUserGroupWidget::ShareUserGroupWidget(AccountPtr account,
 
     setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
     _ui->errorLabel->hide();
+
+    // Setup the sharee search progress indicator
+    _ui->shareeHorizontalLayout->addWidget(&_pi_sharee);
 }
 
 ShareUserGroupWidget::~ShareUserGroupWidget()
@@ -147,6 +150,7 @@ void ShareUserGroupWidget::slotLineEditReturn()
 void ShareUserGroupWidget::searchForSharees()
 {
     _completionTimer.stop();
+    _pi_sharee.startAnimation();
     ShareeModel::ShareeSet blacklist;
 
     // Add the current user to _sharees since we can't share with ourself
@@ -158,7 +162,6 @@ void ShareUserGroupWidget::searchForSharees()
     }
     _ui->errorLabel->hide();
     _completerModel->fetch(_ui->shareeLineEdit->text(), blacklist);
-
 }
 
 void ShareUserGroupWidget::getShares()
@@ -218,6 +221,7 @@ void ShareUserGroupWidget::slotAdjustScrollWidgetSize()
 
 void ShareUserGroupWidget::slotShareesReady()
 {
+    _pi_sharee.stopAnimation();
     if (_completerModel->rowCount() == 0) {
         displayError(0, tr("No results for '%1'").arg(_completerModel->currentSearch()));
         return;
@@ -274,6 +278,7 @@ void ShareUserGroupWidget::slotCompleterHighlighted(const QModelIndex & index)
 
 void ShareUserGroupWidget::displayError(int code, const QString& message)
 {
+    _pi_sharee.stopAnimation();
     qDebug() << "Error from server" << code << message;
     _ui->errorLabel->setText(message);
     _ui->errorLabel->show();
index 2d47fcdfd816f64c710945a894cf9c90b0da094e..c99d22f6c8bd489c3ce87f2f7c76b44f6ce81ace 100644 (file)
@@ -129,6 +129,8 @@ private:
     bool _isFile;
     bool _disableCompleterActivated; // in order to avoid that we share the contents twice
     ShareManager *_manager;
+
+    QProgressIndicator _pi_sharee;
 };
 
 }
index 6f9524b99c0629f3e1d89884b9b84753593cfdd6..44befbb7a4d269a7f68402a1bf8392cfd6a3bce9 100644 (file)
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>457</width>
-    <height>188</height>
+    <height>164</height>
    </rect>
   </property>
   <property name="windowTitle">
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
    <item>
-    <widget class="QLineEdit" name="shareeLineEdit">
-     <property name="placeholderText">
-      <string>Share with users or groups ...</string>
-     </property>
-    </widget>
+    <layout class="QHBoxLayout" name="shareeHorizontalLayout">
+     <item>
+      <widget class="QLineEdit" name="shareeLineEdit">
+       <property name="placeholderText">
+        <string>Share with users or groups ...</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
    </item>
    <item>
     <widget class="QLabel" name="errorLabel">
@@ -50,8 +54,8 @@
        <rect>
         <x>0</x>
         <y>0</y>
-        <width>441</width>
-        <height>98</height>
+        <width>437</width>
+        <height>94</height>
        </rect>
       </property>
       <layout class="QVBoxLayout" name="verticalLayout_3"/>