forked from qt-creator/qt-creator
Don't show the warning message (about the dangerous world of code refactoring) if the user pressed the "Yes, I know I am doing" button.
This commit is contained in:
@@ -81,6 +81,7 @@
|
|||||||
#include <QtCore/QTime>
|
#include <QtCore/QTime>
|
||||||
#include <QtCore/QTimer>
|
#include <QtCore/QTimer>
|
||||||
#include <QtCore/QStack>
|
#include <QtCore/QStack>
|
||||||
|
#include <QtCore/QSettings>
|
||||||
#include <QtGui/QAction>
|
#include <QtGui/QAction>
|
||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
#include <QtGui/QHeaderView>
|
#include <QtGui/QHeaderView>
|
||||||
@@ -765,8 +766,32 @@ void CPPEditor::renameUsages()
|
|||||||
renameUsagesNow();
|
renameUsagesNow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CPPEditor::showWarningMessage() const
|
||||||
|
{
|
||||||
|
// Restore settings
|
||||||
|
QSettings *settings = Core::ICore::instance()->settings();
|
||||||
|
settings->beginGroup(QLatin1String("CppEditor"));
|
||||||
|
settings->beginGroup(QLatin1String("Rename"));
|
||||||
|
const bool showWarningMessage = settings->value(QLatin1String("ShowWarningMessage"), true).toBool();
|
||||||
|
settings->endGroup();
|
||||||
|
settings->endGroup();
|
||||||
|
return showWarningMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPPEditor::setShowWarningMessage(bool showWarningMessage)
|
||||||
|
{
|
||||||
|
// Restore settings
|
||||||
|
QSettings *settings = Core::ICore::instance()->settings();
|
||||||
|
settings->beginGroup(QLatin1String("CppEditor"));
|
||||||
|
settings->beginGroup(QLatin1String("Rename"));
|
||||||
|
settings->setValue(QLatin1String("ShowWarningMessage"), showWarningMessage);
|
||||||
|
settings->endGroup();
|
||||||
|
settings->endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
void CPPEditor::hideRenameNotification()
|
void CPPEditor::hideRenameNotification()
|
||||||
{
|
{
|
||||||
|
setShowWarningMessage(false);
|
||||||
Core::EditorManager::instance()->hideEditorInfoBar(QLatin1String("CppEditor.Rename"));
|
Core::EditorManager::instance()->hideEditorInfoBar(QLatin1String("CppEditor.Rename"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -774,10 +799,12 @@ void CPPEditor::renameUsagesNow()
|
|||||||
{
|
{
|
||||||
if (Symbol *canonicalSymbol = markSymbols()) {
|
if (Symbol *canonicalSymbol = markSymbols()) {
|
||||||
if (canonicalSymbol->identifier() != 0) {
|
if (canonicalSymbol->identifier() != 0) {
|
||||||
|
if (showWarningMessage()) {
|
||||||
Core::EditorManager::instance()->showEditorInfoBar(QLatin1String("CppEditor.Rename"),
|
Core::EditorManager::instance()->showEditorInfoBar(QLatin1String("CppEditor.Rename"),
|
||||||
tr("This change cannot be undone."),
|
tr("This change cannot be undone."),
|
||||||
tr("Yes, I know what I am doing."),
|
tr("Yes, I know what I am doing."),
|
||||||
this, SLOT(hideRenameNotification()));
|
this, SLOT(hideRenameNotification()));
|
||||||
|
}
|
||||||
|
|
||||||
m_modelManager->renameUsages(canonicalSymbol);
|
m_modelManager->renameUsages(canonicalSymbol);
|
||||||
}
|
}
|
||||||
|
@@ -235,6 +235,9 @@ private Q_SLOTS:
|
|||||||
void updateSemanticInfo(const SemanticInfo &semanticInfo);
|
void updateSemanticInfo(const SemanticInfo &semanticInfo);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool showWarningMessage() const;
|
||||||
|
void setShowWarningMessage(bool showWarningMessage);
|
||||||
|
|
||||||
CPlusPlus::Symbol *markSymbols();
|
CPlusPlus::Symbol *markSymbols();
|
||||||
bool sortedMethodOverview() const;
|
bool sortedMethodOverview() const;
|
||||||
CPlusPlus::Symbol *findDefinition(CPlusPlus::Symbol *symbol);
|
CPlusPlus::Symbol *findDefinition(CPlusPlus::Symbol *symbol);
|
||||||
|
Reference in New Issue
Block a user