Commit ddc0c89b authored by Eike Ziller's avatar Eike Ziller

Show warning with continue/cancel in case of many search results

Task-number: QTCREATORBUG-6116
Change-Id: I57a66b8989f1cc4137b02df370704dfe43d392ac
Reviewed-by: default avatarRobert Löhning <robert.loehning@nokia.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@nokia.com>
parent 72187be3
...@@ -208,6 +208,8 @@ void runFileSearch(QFutureInterface<FileSearchResultList> &future, ...@@ -208,6 +208,8 @@ void runFileSearch(QFutureInterface<FileSearchResultList> &future,
if (!future.isCanceled()) if (!future.isCanceled())
future.setProgressValueAndText(files->currentProgress(), msgFound(searchTerm, numMatches, numFilesSearched)); future.setProgressValueAndText(files->currentProgress(), msgFound(searchTerm, numMatches, numFilesSearched));
delete files; delete files;
if (future.isPaused())
future.waitForResume();
} }
void runFileSearchRegExp(QFutureInterface<FileSearchResultList> &future, void runFileSearchRegExp(QFutureInterface<FileSearchResultList> &future,
...@@ -290,6 +292,8 @@ void runFileSearchRegExp(QFutureInterface<FileSearchResultList> &future, ...@@ -290,6 +292,8 @@ void runFileSearchRegExp(QFutureInterface<FileSearchResultList> &future,
if (!future.isCanceled()) if (!future.isCanceled())
future.setProgressValueAndText(files->currentProgress(), msgFound(searchTerm, numMatches, numFilesSearched)); future.setProgressValueAndText(files->currentProgress(), msgFound(searchTerm, numMatches, numFilesSearched));
delete files; delete files;
if (future.isPaused())
future.waitForResume();
} }
} // namespace } // namespace
......
...@@ -66,6 +66,13 @@ void InfoBarEntry::setCancelButtonInfo(QObject *_object, const char *_member) ...@@ -66,6 +66,13 @@ void InfoBarEntry::setCancelButtonInfo(QObject *_object, const char *_member)
cancelButtonPressMember = _member; cancelButtonPressMember = _member;
} }
void InfoBarEntry::setCancelButtonInfo(const QString &_cancelButtonText, QObject *_object, const char *_member)
{
cancelButtonText = _cancelButtonText;
cancelObject = _object;
cancelButtonPressMember = _member;
}
void InfoBar::addInfo(const InfoBarEntry &info) void InfoBar::addInfo(const InfoBarEntry &info)
{ {
...@@ -169,15 +176,22 @@ void InfoBarDisplay::update() ...@@ -169,15 +176,22 @@ void InfoBarDisplay::update()
} }
QToolButton *infoWidgetCloseButton = new QToolButton; QToolButton *infoWidgetCloseButton = new QToolButton;
infoWidgetCloseButton->setAutoRaise(true);
infoWidgetCloseButton->setIcon(QIcon(QLatin1String(Core::Constants::ICON_CLEAR)));
infoWidgetCloseButton->setToolTip(tr("Close"));
infoWidgetCloseButton->setProperty("infoId", info.id); infoWidgetCloseButton->setProperty("infoId", info.id);
connect(infoWidgetCloseButton, SIGNAL(clicked()), SLOT(cancelButtonClicked()));
// need to connect to cancelObjectbefore connecting to cancelButtonClicked,
// because the latter removes the button and with it any connect
if (info.cancelObject) if (info.cancelObject)
connect(infoWidgetCloseButton, SIGNAL(clicked()), connect(infoWidgetCloseButton, SIGNAL(clicked()),
info.cancelObject, info.cancelButtonPressMember); info.cancelObject, info.cancelButtonPressMember);
connect(infoWidgetCloseButton, SIGNAL(clicked()), SLOT(cancelButtonClicked()));
if (info.cancelButtonText.isEmpty()) {
infoWidgetCloseButton->setAutoRaise(true);
infoWidgetCloseButton->setIcon(QIcon(QLatin1String(Core::Constants::ICON_CLEAR)));
infoWidgetCloseButton->setToolTip(tr("Close"));
} else {
infoWidgetCloseButton->setText(info.cancelButtonText);
}
hbox->addWidget(infoWidgetCloseButton); hbox->addWidget(infoWidgetCloseButton);
......
...@@ -53,6 +53,7 @@ public: ...@@ -53,6 +53,7 @@ public:
InfoBarEntry(const InfoBarEntry &other) { *this = other; } InfoBarEntry(const InfoBarEntry &other) { *this = other; }
void setCustomButtonInfo(const QString &_buttonText, QObject *_object, const char *_member); void setCustomButtonInfo(const QString &_buttonText, QObject *_object, const char *_member);
void setCancelButtonInfo(QObject *_object, const char *_member); void setCancelButtonInfo(QObject *_object, const char *_member);
void setCancelButtonInfo(const QString &_cancelButtonText, QObject *_object, const char *_member);
private: private:
QString id; QString id;
...@@ -60,6 +61,7 @@ private: ...@@ -60,6 +61,7 @@ private:
QString buttonText; QString buttonText;
QObject *object; QObject *object;
const char *buttonPressMember; const char *buttonPressMember;
QString cancelButtonText;
QObject *cancelObject; QObject *cancelObject;
const char *cancelButtonPressMember; const char *cancelButtonPressMember;
friend class InfoBar; friend class InfoBar;
......
...@@ -113,6 +113,8 @@ public: ...@@ -113,6 +113,8 @@ public:
QList<Usage> operator()(const QString &fileName) QList<Usage> operator()(const QString &fileName)
{ {
QList<Usage> usages; QList<Usage> usages;
if (future->isPaused())
future->waitForResume();
if (future->isCanceled()) if (future->isCanceled())
return usages; return usages;
const Identifier *symbolId = symbol->identifier(); const Identifier *symbolId = symbol->identifier();
...@@ -145,6 +147,8 @@ public: ...@@ -145,6 +147,8 @@ public:
usages = process.usages(); usages = process.usages();
} }
if (future->isPaused())
future->waitForResume();
return usages; return usages;
} }
}; };
...@@ -252,6 +256,7 @@ void CppFindReferences::findUsages(CPlusPlus::Symbol *symbol, ...@@ -252,6 +256,7 @@ void CppFindReferences::findUsages(CPlusPlus::Symbol *symbol,
search->setTextToReplace(replacement); search->setTextToReplace(replacement);
connect(search, SIGNAL(replaceButtonClicked(QString,QList<Find::SearchResultItem>)), connect(search, SIGNAL(replaceButtonClicked(QString,QList<Find::SearchResultItem>)),
SLOT(onReplaceButtonClicked(QString,QList<Find::SearchResultItem>))); SLOT(onReplaceButtonClicked(QString,QList<Find::SearchResultItem>)));
connect(search, SIGNAL(paused(bool)), this, SLOT(setPaused(bool)));
search->setSearchAgainSupported(true); search->setSearchAgainSupported(true);
connect(search, SIGNAL(searchAgainRequested()), this, SLOT(searchAgain())); connect(search, SIGNAL(searchAgainRequested()), this, SLOT(searchAgain()));
CppFindReferencesParameters parameters; CppFindReferencesParameters parameters;
...@@ -293,7 +298,7 @@ void CppFindReferences::findAll_helper(Find::SearchResult *search) ...@@ -293,7 +298,7 @@ void CppFindReferences::findAll_helper(Find::SearchResult *search)
Core::FutureProgress *progress = progressManager->addTask(result, tr("Searching"), Core::FutureProgress *progress = progressManager->addTask(result, tr("Searching"),
CppTools::Constants::TASK_SEARCH); CppTools::Constants::TASK_SEARCH);
connect(progress, SIGNAL(clicked()), Find::SearchResultWindow::instance(), SLOT(popup())); connect(progress, SIGNAL(clicked()), search, SLOT(popup()));
} }
void CppFindReferences::onReplaceButtonClicked(const QString &text, void CppFindReferences::onReplaceButtonClicked(const QString &text,
...@@ -511,6 +516,16 @@ void CppFindReferences::cancel() ...@@ -511,6 +516,16 @@ void CppFindReferences::cancel()
watcher->cancel(); watcher->cancel();
} }
void CppFindReferences::setPaused(bool paused)
{
Find::SearchResult *search = qobject_cast<Find::SearchResult *>(sender());
QTC_ASSERT(search, return);
QFutureWatcher<Usage> *watcher = m_watchers.key(search);
QTC_ASSERT(watcher, return);
if (!paused || watcher->isRunning()) // guard against pausing when the search is finished
watcher->setPaused(paused);
}
void CppFindReferences::openEditor(const Find::SearchResultItem &item) void CppFindReferences::openEditor(const Find::SearchResultItem &item)
{ {
if (item.path.size() > 0) { if (item.path.size() > 0) {
...@@ -545,6 +560,8 @@ public: ...@@ -545,6 +560,8 @@ public:
QList<Usage> operator()(const QString &fileName) QList<Usage> operator()(const QString &fileName)
{ {
QList<Usage> usages; QList<Usage> usages;
if (future->isPaused())
future->waitForResume();
if (future->isCanceled()) if (future->isCanceled())
return usages; return usages;
...@@ -566,6 +583,8 @@ public: ...@@ -566,6 +583,8 @@ public:
} }
} }
if (future->isPaused())
future->waitForResume();
return usages; return usages;
} }
...@@ -638,6 +657,7 @@ void CppFindReferences::findMacroUses(const Macro &macro) ...@@ -638,6 +657,7 @@ void CppFindReferences::findMacroUses(const Macro &macro)
connect(search, SIGNAL(activated(Find::SearchResultItem)), connect(search, SIGNAL(activated(Find::SearchResultItem)),
this, SLOT(openEditor(Find::SearchResultItem))); this, SLOT(openEditor(Find::SearchResultItem)));
connect(search, SIGNAL(cancelled()), this, SLOT(cancel())); connect(search, SIGNAL(cancelled()), this, SLOT(cancel()));
connect(search, SIGNAL(paused(bool)), this, SLOT(setPaused(bool)));
const Snapshot snapshot = _modelManager->snapshot(); const Snapshot snapshot = _modelManager->snapshot();
const CppModelManagerInterface::WorkingCopy workingCopy = _modelManager->workingCopy(); const CppModelManagerInterface::WorkingCopy workingCopy = _modelManager->workingCopy();
...@@ -662,7 +682,7 @@ void CppFindReferences::findMacroUses(const Macro &macro) ...@@ -662,7 +682,7 @@ void CppFindReferences::findMacroUses(const Macro &macro)
Core::ProgressManager *progressManager = Core::ICore::progressManager(); Core::ProgressManager *progressManager = Core::ICore::progressManager();
Core::FutureProgress *progress = progressManager->addTask(result, tr("Searching"), Core::FutureProgress *progress = progressManager->addTask(result, tr("Searching"),
CppTools::Constants::TASK_SEARCH); CppTools::Constants::TASK_SEARCH);
connect(progress, SIGNAL(clicked()), Find::SearchResultWindow::instance(), SLOT(popup())); connect(progress, SIGNAL(clicked()), search, SLOT(popup()));
} }
DependencyTable CppFindReferences::updateDependencyTable(CPlusPlus::Snapshot snapshot) DependencyTable CppFindReferences::updateDependencyTable(CPlusPlus::Snapshot snapshot)
......
...@@ -89,6 +89,7 @@ private Q_SLOTS: ...@@ -89,6 +89,7 @@ private Q_SLOTS:
void displayResults(int first, int last); void displayResults(int first, int last);
void searchFinished(); void searchFinished();
void cancel(); void cancel();
void setPaused(bool paused);
void openEditor(const Find::SearchResultItem &item); void openEditor(const Find::SearchResultItem &item);
void onReplaceButtonClicked(const QString &text, const QList<Find::SearchResultItem> &items); void onReplaceButtonClicked(const QString &text, const QList<Find::SearchResultItem> &items);
void searchAgain(); void searchAgain();
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "cpptoolsconstants.h" #include "cpptoolsconstants.h"
#include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/progressmanager/futureprogress.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <find/textfindconstants.h> #include <find/textfindconstants.h>
#include <utils/runextensions.h> #include <utils/runextensions.h>
...@@ -77,7 +78,11 @@ namespace { ...@@ -77,7 +78,11 @@ namespace {
findString = QString::fromLatin1("\\b%1\\b").arg(findString); findString = QString::fromLatin1("\\b%1\\b").arg(findString);
QRegExp matcher(findString, (parameters.flags & Find::FindCaseSensitively QRegExp matcher(findString, (parameters.flags & Find::FindCaseSensitively
? Qt::CaseSensitive : Qt::CaseInsensitive)); ? Qt::CaseSensitive : Qt::CaseInsensitive));
while (it != snapshot.end() && !future.isCanceled()) { while (it != snapshot.end()) {
if (future.isPaused())
future.waitForResume();
if (future.isCanceled())
break;
if (fileNames.isEmpty() || fileNames.contains(it.value()->fileName())) { if (fileNames.isEmpty() || fileNames.contains(it.value()->fileName())) {
QVector<Find::SearchResultItem> resultItems; QVector<Find::SearchResultItem> resultItems;
QList<ModelItemInfo> modelInfos = search(it.value()); QList<ModelItemInfo> modelInfos = search(it.value());
...@@ -104,6 +109,8 @@ namespace { ...@@ -104,6 +109,8 @@ namespace {
++progress; ++progress;
future.setProgressValue(progress); future.setProgressValue(progress);
} }
if (future.isPaused())
future.waitForResume();
} }
} //namespace } //namespace
...@@ -144,6 +151,16 @@ void SymbolsFindFilter::cancel() ...@@ -144,6 +151,16 @@ void SymbolsFindFilter::cancel()
watcher->cancel(); watcher->cancel();
} }
void SymbolsFindFilter::setPaused(bool paused)
{
Find::SearchResult *search = qobject_cast<Find::SearchResult *>(sender());
QTC_ASSERT(search, return);
QFutureWatcher<Find::SearchResultItem> *watcher = m_watchers.key(search);
QTC_ASSERT(watcher, return);
if (!paused || watcher->isRunning()) // guard against pausing when the search is finished
watcher->setPaused(paused);
}
Find::FindFlags SymbolsFindFilter::supportedFindFlags() const Find::FindFlags SymbolsFindFilter::supportedFindFlags() const
{ {
return Find::FindCaseSensitively | Find::FindRegularExpression | Find::FindWholeWords; return Find::FindCaseSensitively | Find::FindRegularExpression | Find::FindWholeWords;
...@@ -157,6 +174,7 @@ void SymbolsFindFilter::findAll(const QString &txt, Find::FindFlags findFlags) ...@@ -157,6 +174,7 @@ void SymbolsFindFilter::findAll(const QString &txt, Find::FindFlags findFlags)
connect(search, SIGNAL(activated(Find::SearchResultItem)), connect(search, SIGNAL(activated(Find::SearchResultItem)),
this, SLOT(openEditor(Find::SearchResultItem))); this, SLOT(openEditor(Find::SearchResultItem)));
connect(search, SIGNAL(cancelled()), this, SLOT(cancel())); connect(search, SIGNAL(cancelled()), this, SLOT(cancel()));
connect(search, SIGNAL(paused(bool)), this, SLOT(setPaused(bool)));
connect(search, SIGNAL(searchAgainRequested()), this, SLOT(searchAgain())); connect(search, SIGNAL(searchAgainRequested()), this, SLOT(searchAgain()));
connect(this, SIGNAL(enabledChanged(bool)), search, SLOT(setSearchAgainEnabled(bool))); connect(this, SIGNAL(enabledChanged(bool)), search, SLOT(setSearchAgainEnabled(bool)));
window->popup(true); window->popup(true);
...@@ -190,9 +208,10 @@ void SymbolsFindFilter::startSearch(Find::SearchResult *search) ...@@ -190,9 +208,10 @@ void SymbolsFindFilter::startSearch(Find::SearchResult *search)
watcher->setFuture(QtConcurrent::run<Find::SearchResultItem, SymbolsFindParameters, watcher->setFuture(QtConcurrent::run<Find::SearchResultItem, SymbolsFindParameters,
CPlusPlus::Snapshot, QSet<QString> >(runSearch, parameters, CPlusPlus::Snapshot, QSet<QString> >(runSearch, parameters,
m_manager->snapshot(), projectFileNames)); m_manager->snapshot(), projectFileNames));
Core::ICore::progressManager()->addTask(watcher->future(), Core::FutureProgress *progress = Core::ICore::progressManager()->addTask(watcher->future(),
tr("Searching"), tr("Searching"),
Find::Constants::TASK_SEARCH); Find::Constants::TASK_SEARCH);
connect(progress, SIGNAL(clicked()), search, SLOT(popup()));
} }
void SymbolsFindFilter::addResults(int begin, int end) void SymbolsFindFilter::addResults(int begin, int end)
......
...@@ -87,6 +87,7 @@ private slots: ...@@ -87,6 +87,7 @@ private slots:
void addResults(int begin, int end); void addResults(int begin, int end);
void finish(); void finish();
void cancel(); void cancel();
void setPaused(bool paused);
void onTaskStarted(const QString &type); void onTaskStarted(const QString &type);
void onAllTasksFinished(const QString &type); void onAllTasksFinished(const QString &type);
void searchAgain(); void searchAgain();
......
...@@ -47,6 +47,10 @@ ...@@ -47,6 +47,10 @@
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QHBoxLayout> #include <QHBoxLayout>
static const int SEARCHRESULT_WARNING_LIMIT = 200000;
static const char UNDO_WARNING_ID[] = "warninglabel";
static const char SIZE_WARNING_ID[] = "sizeWarningLabel";
namespace Find { namespace Find {
namespace Internal { namespace Internal {
...@@ -77,6 +81,8 @@ using namespace Find::Internal; ...@@ -77,6 +81,8 @@ using namespace Find::Internal;
SearchResultWidget::SearchResultWidget(QWidget *parent) : SearchResultWidget::SearchResultWidget(QWidget *parent) :
QWidget(parent), QWidget(parent),
m_count(0), m_count(0),
m_sizeWarningActive(false),
m_sizeWarningOverridden(false),
m_isShowingReplaceUI(false), m_isShowingReplaceUI(false),
m_searchAgainSupported(false) m_searchAgainSupported(false)
{ {
...@@ -182,6 +188,12 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) : ...@@ -182,6 +188,12 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
connect(m_replaceButton, SIGNAL(clicked()), this, SLOT(handleReplaceButton())); connect(m_replaceButton, SIGNAL(clicked()), this, SLOT(handleReplaceButton()));
} }
SearchResultWidget::~SearchResultWidget()
{
if (m_sizeWarningActive)
cancelAfterSizeWarning();
}
void SearchResultWidget::setInfo(const QString &label, const QString &toolTip, const QString &term) void SearchResultWidget::setInfo(const QString &label, const QString &toolTip, const QString &term)
{ {
m_label->setText(label); m_label->setText(label);
...@@ -210,9 +222,10 @@ void SearchResultWidget::addResults(const QList<SearchResultItem> &items, Search ...@@ -210,9 +222,10 @@ void SearchResultWidget::addResults(const QList<SearchResultItem> &items, Search
bool firstItems = (m_count == 0); bool firstItems = (m_count == 0);
m_count += items.size(); m_count += items.size();
m_searchResultTreeView->addResults(items, mode); m_searchResultTreeView->addResults(items, mode);
updateMatchesFoundLabel();
if (firstItems) { if (firstItems) {
if (showWarningMessage()) { if (showWarningMessage()) {
Core::InfoBarEntry info(QLatin1String("warninglabel"), tr("This change cannot be undone.")); Core::InfoBarEntry info(QLatin1String(UNDO_WARNING_ID), tr("This change cannot be undone."));
info.setCustomButtonInfo(tr("Do not warn again"), this, SLOT(hideNoUndoWarning())); info.setCustomButtonInfo(tr("Do not warn again"), this, SLOT(hideNoUndoWarning()));
m_infoBar.addInfo(info); m_infoBar.addInfo(info);
} }
...@@ -227,10 +240,21 @@ void SearchResultWidget::addResults(const QList<SearchResultItem> &items, Search ...@@ -227,10 +240,21 @@ void SearchResultWidget::addResults(const QList<SearchResultItem> &items, Search
} }
m_searchResultTreeView->selectionModel()->select(m_searchResultTreeView->model()->index(0, 0, QModelIndex()), QItemSelectionModel::Select); m_searchResultTreeView->selectionModel()->select(m_searchResultTreeView->model()->index(0, 0, QModelIndex()), QItemSelectionModel::Select);
emit navigateStateChanged(); emit navigateStateChanged();
} else if (m_count > SEARCHRESULT_WARNING_LIMIT && !m_sizeWarningOverridden && !m_sizeWarningActive) {
m_sizeWarningActive = true;
emit paused(true);
Core::InfoBarEntry info(QLatin1String(SIZE_WARNING_ID),
tr("The search resulted in more than %1 items, do you still want to continue?")
.arg(SEARCHRESULT_WARNING_LIMIT));
info.setCancelButtonInfo(tr("Cancel"), this, SLOT(cancelAfterSizeWarning()));
info.setCustomButtonInfo(tr("Continue"), this, SLOT(continueAfterSizeWarning()));
m_infoBar.addInfo(info);
emit requestPopup(false/*no focus*/);
} }
updateMatchesFoundLabel();
} }
int SearchResultWidget::count() const int SearchResultWidget::count() const
{ {
return m_count; return m_count;
...@@ -345,6 +369,10 @@ void SearchResultWidget::restart() ...@@ -345,6 +369,10 @@ void SearchResultWidget::restart()
m_replaceButton->setEnabled(false); m_replaceButton->setEnabled(false);
m_searchResultTreeView->clear(); m_searchResultTreeView->clear();
m_count = 0; m_count = 0;
if (m_sizeWarningActive)
m_infoBar.removeInfo(QLatin1String(SIZE_WARNING_ID));
m_sizeWarningActive = false;
m_sizeWarningOverridden = false;
m_cancelButton->setVisible(true); m_cancelButton->setVisible(true);
m_searchAgainButton->setVisible(false); m_searchAgainButton->setVisible(false);
m_messageWidget->setVisible(false); m_messageWidget->setVisible(false);
...@@ -365,6 +393,10 @@ void SearchResultWidget::setSearchAgainEnabled(bool enabled) ...@@ -365,6 +393,10 @@ void SearchResultWidget::setSearchAgainEnabled(bool enabled)
void SearchResultWidget::finishSearch(bool canceled) void SearchResultWidget::finishSearch(bool canceled)
{ {
if (m_sizeWarningActive)
m_infoBar.removeInfo(QLatin1String(SIZE_WARNING_ID));
m_sizeWarningActive = false;
m_sizeWarningOverridden = false;
m_replaceTextEdit->setEnabled(m_count > 0); m_replaceTextEdit->setEnabled(m_count > 0);
m_replaceButton->setEnabled(m_count > 0); m_replaceButton->setEnabled(m_count > 0);
m_cancelButton->setVisible(false); m_cancelButton->setVisible(false);
...@@ -372,10 +404,32 @@ void SearchResultWidget::finishSearch(bool canceled) ...@@ -372,10 +404,32 @@ void SearchResultWidget::finishSearch(bool canceled)
m_searchAgainButton->setVisible(m_searchAgainSupported); m_searchAgainButton->setVisible(m_searchAgainSupported);
} }
void SearchResultWidget::sendRequestPopup()
{
emit requestPopup(true/*focus*/);
}
void SearchResultWidget::hideNoUndoWarning() void SearchResultWidget::hideNoUndoWarning()
{ {
setShowWarningMessage(false); setShowWarningMessage(false);
m_infoBar.clear(); m_infoBar.removeInfo(QLatin1String(UNDO_WARNING_ID));
}
void SearchResultWidget::continueAfterSizeWarning()
{
m_sizeWarningOverridden = true;
m_sizeWarningActive = false;
m_infoBar.removeInfo(QLatin1String(SIZE_WARNING_ID));
emit paused(false);
}
void SearchResultWidget::cancelAfterSizeWarning()
{
m_infoBar.removeInfo(QLatin1String(SIZE_WARNING_ID));
m_sizeWarningOverridden = true;
m_sizeWarningActive = false;
emit cancelled();
emit paused(false);
} }
void SearchResultWidget::handleJumpToSearchResult(const SearchResultItem &item) void SearchResultWidget::handleJumpToSearchResult(const SearchResultItem &item)
...@@ -396,7 +450,10 @@ void SearchResultWidget::handleReplaceButton() ...@@ -396,7 +450,10 @@ void SearchResultWidget::handleReplaceButton()
void SearchResultWidget::cancel() void SearchResultWidget::cancel()
{ {
m_cancelButton->setVisible(false); m_cancelButton->setVisible(false);
emit cancelled(); if (m_sizeWarningActive)
cancelAfterSizeWarning();
else
emit cancelled();
} }
void SearchResultWidget::searchAgain() void SearchResultWidget::searchAgain()
......
...@@ -53,6 +53,7 @@ class SearchResultWidget : public QWidget ...@@ -53,6 +53,7 @@ class SearchResultWidget : public QWidget
Q_OBJECT Q_OBJECT
public: public:
explicit SearchResultWidget(QWidget *parent = 0); explicit SearchResultWidget(QWidget *parent = 0);
~SearchResultWidget();
void setInfo(const QString &label, const QString &toolTip, const QString &term); void setInfo(const QString &label, const QString &toolTip, const QString &term);
...@@ -91,19 +92,24 @@ public: ...@@ -91,19 +92,24 @@ public:
public slots: public slots:
void finishSearch(bool canceled); void finishSearch(bool canceled);
void sendRequestPopup();
signals: signals:
void activated(const Find::SearchResultItem &item); void activated(const Find::SearchResultItem &item);
void replaceButtonClicked(const QString &replaceText, const QList<Find::SearchResultItem> &checkedItems); void replaceButtonClicked(const QString &replaceText, const QList<Find::SearchResultItem> &checkedItems);
void searchAgainRequested(); void searchAgainRequested();
void cancelled(); void cancelled();
void paused(bool paused);
void restarted(); void restarted();
void visibilityChanged(bool visible); void visibilityChanged(bool visible);
void requestPopup(bool focus);
void navigateStateChanged(); void navigateStateChanged();
private slots: private slots:
void hideNoUndoWarning(); void hideNoUndoWarning();
void continueAfterSizeWarning();
void cancelAfterSizeWarning();
void handleJumpToSearchResult(const SearchResultItem &item); void handleJumpToSearchResult(const SearchResultItem &item);
void handleReplaceButton(); void handleReplaceButton();
void cancel(); void cancel();
...@@ -117,6 +123,8 @@ private: ...@@ -117,6 +123,8 @@ private:
SearchResultTreeView *m_searchResultTreeView; SearchResultTreeView *m_searchResultTreeView;
int m_count; int m_count;
bool m_sizeWarningActive;
bool m_sizeWarningOverridden;
QString m_dontAskAgainGroup; QString m_dontAskAgainGroup;
QFrame *m_messageWidget; QFrame *m_messageWidget;
Core::InfoBar m_infoBar; Core::InfoBar m_infoBar;
......
...@@ -86,6 +86,7 @@ namespace Internal { ...@@ -86,6 +86,7 @@ namespace Internal {
SearchResultWindowPrivate(SearchResultWindow *window); SearchResultWindowPrivate(SearchResultWindow *window);
bool isSearchVisible() const; bool isSearchVisible() const;
int visibleSearchIndex() const; int visibleSearchIndex() const;
void setCurrentIndex(int index, bool focus);
SearchResultWindow *q;