Bläddra i källkod

ShareDialog: remove the search button (#3737)

Olivier Goffart 10 år sedan
förälder
incheckning
6e42405113

+ 1 - 0
src/gui/sharedialog.cpp

@@ -46,6 +46,7 @@ ShareDialog::ShareDialog(AccountPtr account, const QString &sharePath, const QSt
 
     QPushButton *closeButton = _ui->buttonBox->button(QDialogButtonBox::Close);
     connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
+    closeButton->setDefault(false); // Because people press enter in the dialog and we don't want to close for that
 
     // Set icon
     QFileInfo f_info(_localPath);

+ 3 - 10
src/gui/shareusergroupwidget.cpp

@@ -65,8 +65,6 @@ ShareUserGroupWidget::ShareUserGroupWidget(AccountPtr account, const QString &sh
     _completer->setModel(_completerModel);
     _ui->shareeLineEdit->setCompleter(_completer);
 
-    _ui->searchPushButton->setEnabled(false);
-
     _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()));
@@ -76,7 +74,7 @@ ShareUserGroupWidget::ShareUserGroupWidget(AccountPtr account, const QString &sh
     // Queued connection so this signal is recieved after textChanged
     connect(_ui->shareeLineEdit, SIGNAL(textEdited(QString)),
             this, SLOT(slotLineEditTextEdited(QString)), Qt::QueuedConnection);
-    connect(&_completionTimer, SIGNAL(timeout()), this, SLOT(on_searchPushButton_clicked()));
+    connect(&_completionTimer, SIGNAL(timeout()), this, SLOT(searchForSharees()));
     _completionTimer.setSingleShot(true);
     _completionTimer.setInterval(600);
 
@@ -88,14 +86,9 @@ ShareUserGroupWidget::~ShareUserGroupWidget()
     delete _ui;
 }
 
-void ShareUserGroupWidget::on_shareeLineEdit_textChanged(const QString &text)
+void ShareUserGroupWidget::on_shareeLineEdit_textChanged(const QString &)
 {
     _completionTimer.stop();
-    if (text == "") {
-        _ui->searchPushButton->setEnabled(false);
-    } else {
-        _ui->searchPushButton->setEnabled(true);
-    }
 }
 
 void ShareUserGroupWidget::slotLineEditTextEdited(const QString& text)
@@ -108,7 +101,7 @@ void ShareUserGroupWidget::slotLineEditTextEdited(const QString& text)
 }
 
 
-void ShareUserGroupWidget::on_searchPushButton_clicked()
+void ShareUserGroupWidget::searchForSharees()
 {
     _completionTimer.stop();
     ShareeModel::ShareeSet blacklist;

+ 1 - 1
src/gui/shareusergroupwidget.h

@@ -97,7 +97,7 @@ private slots:
     void slotSharesFetched(const QList<QSharedPointer<Share>> &shares);
 
     void on_shareeLineEdit_textChanged(const QString &text);
-    void on_searchPushButton_clicked();
+    void searchForSharees();
     void slotLineEditTextEdited(const QString &text);
 
     void slotCompleterActivated(const QModelIndex & index);

+ 6 - 23
src/gui/shareusergroupwidget.ui

@@ -14,29 +14,12 @@
    <string>Share NewDocument.odt</string>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
-   <property name="sizeConstraint">
-    <enum>QLayout::SetDefaultConstraint</enum>
-   </property>
    <item>
-    <layout class="QHBoxLayout" name="horizontalLayout">
-     <item>
-      <widget class="QLineEdit" name="shareeLineEdit">
-       <property name="placeholderText">
-        <string>Share with users, groups or remote users ...</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QPushButton" name="searchPushButton">
-       <property name="text">
-        <string>Search</string>
-       </property>
-       <property name="default">
-        <bool>true</bool>
-       </property>
-      </widget>
-     </item>
-    </layout>
+    <widget class="QLineEdit" name="shareeLineEdit">
+     <property name="placeholderText">
+      <string>Share with users, groups or remote users ...</string>
+     </property>
+    </widget>
    </item>
    <item>
     <widget class="QScrollArea" name="scrollArea">
@@ -61,7 +44,7 @@
         <x>0</x>
         <y>0</y>
         <width>441</width>
-        <height>124</height>
+        <height>128</height>
        </rect>
       </property>
       <layout class="QVBoxLayout" name="verticalLayout_3"/>