forked from qt-creator/qt-creator
Find: Display "This change cannot be undone" only once.
Every click on Search Again displayed an additional warning message bar. If the bar is closed with the cross button, it reappears on Search Again. This implementation extended InfoBar with a reuseable method bool containsInfo(const QString &id). Task-number: QTCREATORBUG-6873 Change-Id: I1de100d3526b861fc2de190e32f903795fed52c0 Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
This commit is contained in:
committed by
Eike Ziller
parent
d0152332a4
commit
db265b1fa9
@@ -91,6 +91,16 @@ void InfoBar::removeInfo(const QString &id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool InfoBar::containsInfo(const QString &id) const
|
||||||
|
{
|
||||||
|
QListIterator<InfoBarEntry> it(m_infoBarEntries);
|
||||||
|
while (it.hasNext())
|
||||||
|
if (it.next().id == id)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void InfoBar::clear()
|
void InfoBar::clear()
|
||||||
{
|
{
|
||||||
if (!m_infoBarEntries.isEmpty()) {
|
if (!m_infoBarEntries.isEmpty()) {
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ class CORE_EXPORT InfoBar : public QObject
|
|||||||
public:
|
public:
|
||||||
void addInfo(const InfoBarEntry &info);
|
void addInfo(const InfoBarEntry &info);
|
||||||
void removeInfo(const QString &id);
|
void removeInfo(const QString &id);
|
||||||
|
bool containsInfo(const QString &id) const;
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|||||||
@@ -463,7 +463,7 @@ void SearchResultWidget::searchAgain()
|
|||||||
|
|
||||||
bool SearchResultWidget::showWarningMessage() const
|
bool SearchResultWidget::showWarningMessage() const
|
||||||
{
|
{
|
||||||
if (m_dontAskAgainGroup.isEmpty())
|
if (m_dontAskAgainGroup.isEmpty() || m_infoBar.containsInfo(QLatin1String(UNDO_WARNING_ID)))
|
||||||
return false;
|
return false;
|
||||||
// read settings
|
// read settings
|
||||||
QSettings *settings = Core::ICore::settings();
|
QSettings *settings = Core::ICore::settings();
|
||||||
|
|||||||
Reference in New Issue
Block a user