Commit 80415bd1 authored by Andre Hartmann's avatar Andre Hartmann Committed by André Hartmann

Revert "SearchResultWidget: Disable replace button if replace text is unchanged"

The Refactor -> Convert to Camel Case quickfix calls setReplacementText()
with the replacement text already, in contrast to the other search and
refactoring functions, which pass the search text. Therefore, the replace
button is disabled wrongly in that case.

This reverts commit e75f5958.

Task-number: QTCREATORBUG-18947
Change-Id: I906a58f65a88cce42d2da6431e59b88fae4ec45a
Reviewed-by: Eike Ziller's avatarEike Ziller <eike.ziller@qt.io>
parent b58dadfe
......@@ -210,8 +210,6 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
this, &SearchResultWidget::handleReplaceButton);
connect(m_replaceButton, &QAbstractButton::clicked,
this, &SearchResultWidget::handleReplaceButton);
connect(m_replaceTextEdit, &QLineEdit::textChanged,
this, &SearchResultWidget::handleReplaceEditTextChanged);
}
SearchResultWidget::~SearchResultWidget()
......@@ -306,7 +304,6 @@ void SearchResultWidget::setSupportsReplace(bool replaceSupported, const QString
void SearchResultWidget::setTextToReplace(const QString &textToReplace)
{
m_replaceText = textToReplace;
m_replaceTextEdit->setText(textToReplace);
}
......@@ -409,6 +406,7 @@ void SearchResultWidget::goToPrevious()
void SearchResultWidget::restart()
{
m_replaceTextEdit->setEnabled(false);
m_replaceButton->setEnabled(false);
m_searchResultTreeView->clear();
m_count = 0;
Id sizeWarningId(SIZE_WARNING_ID);
......@@ -418,7 +416,6 @@ void SearchResultWidget::restart()
m_searchAgainButton->setVisible(false);
m_messageWidget->setVisible(false);
updateMatchesFoundLabel();
handleReplaceEditTextChanged();
emit restarted();
}
......@@ -439,6 +436,7 @@ void SearchResultWidget::finishSearch(bool canceled)
m_infoBar.removeInfo(sizeWarningId);
m_infoBar.enableInfo(sizeWarningId);
m_replaceTextEdit->setEnabled(m_count > 0);
m_replaceButton->setEnabled(m_count > 0);
m_preserveCaseCheck->setEnabled(m_count > 0);
m_cancelButton->setVisible(false);
m_messageWidget->setVisible(canceled);
......@@ -463,15 +461,6 @@ void SearchResultWidget::cancelAfterSizeWarning()
emit paused(false);
}
void SearchResultWidget::handleReplaceEditTextChanged()
{
const bool enabled = m_replaceTextEdit->text() != m_replaceText;
m_replaceButton->setEnabled(enabled);
m_replaceButton->setToolTip(enabled
? QString()
: tr("Cannot replace because replacement text is unchanged."));
}
void SearchResultWidget::handleJumpToSearchResult(const SearchResultItem &item)
{
emit activated(item);
......
......@@ -115,7 +115,6 @@ private:
void setShowReplaceUI(bool visible);
void continueAfterSizeWarning();
void cancelAfterSizeWarning();
void handleReplaceEditTextChanged();
QList<SearchResultItem> checkedItems() const;
void updateMatchesFoundLabel();
......@@ -142,7 +141,6 @@ private:
bool m_isShowingReplaceUI = false;
bool m_searchAgainSupported = false;
bool m_replaceSupported = false;
QString m_replaceText;
};
} // Internal
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment