Skip to content

Commit

Permalink
ShareDialog: remove the search button (#3737)
Browse files Browse the repository at this point in the history
  • Loading branch information
ogoffart committed Nov 17, 2015
1 parent 11ef07c commit 6e42405
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 34 deletions.
1 change: 1 addition & 0 deletions src/gui/sharedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
13 changes: 3 additions & 10 deletions src/gui/shareusergroupwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand All @@ -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);

Expand All @@ -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)
Expand All @@ -108,7 +101,7 @@ void ShareUserGroupWidget::slotLineEditTextEdited(const QString& text)
}


void ShareUserGroupWidget::on_searchPushButton_clicked()
void ShareUserGroupWidget::searchForSharees()
{
_completionTimer.stop();
ShareeModel::ShareeSet blacklist;
Expand Down
2 changes: 1 addition & 1 deletion src/gui/shareusergroupwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
29 changes: 6 additions & 23 deletions src/gui/shareusergroupwidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand All @@ -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"/>
Expand Down

0 comments on commit 6e42405

Please sign in to comment.