OSDN Git Service

Only show the infobar once
authorDaniel Teske <daniel.teske@nokia.com>
Wed, 27 Jul 2011 11:41:30 +0000 (13:41 +0200)
committerDaniel Teske <daniel.teske@nokia.com>
Thu, 28 Jul 2011 11:48:51 +0000 (13:48 +0200)
Change-Id: I274627999649d00efead89222bbdc325e55932b7
Reviewed-on: http://codereview.qt.nokia.com/2281
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
src/plugins/cmakeprojectmanager/cmakeeditor.cpp
src/plugins/cmakeprojectmanager/cmakeeditor.h

index c00beae..e21c752 100644 (file)
@@ -55,7 +55,8 @@ using namespace CMakeProjectManager::Internal;
 //
 
 CMakeEditor::CMakeEditor(CMakeEditorWidget *editor)
-  : BaseTextEditor(editor)
+  : BaseTextEditor(editor),
+    m_infoBarShown(false)
 {
     setContext(Core::Context(CMakeProjectManager::Constants::C_CMAKEEDITOR,
               TextEditor::Constants::C_TEXTEDITOR));
@@ -78,6 +79,11 @@ QString CMakeEditor::id() const
 
 void CMakeEditor::markAsChanged()
 {
+    if (!file()->isModified())
+        return;
+    if (m_infoBarShown)
+        return;
+    m_infoBarShown = true;
     Core::InfoBarEntry info(QLatin1String("CMakeEditor.RunCMake"),
                             tr("Changes to cmake files are shown in the project tree after building."));
     info.setCustomButtonInfo(tr("Build now"), this, SLOT(build()));
index b0cb039..3b328b3 100644 (file)
@@ -65,6 +65,8 @@ public:
 private slots:
     void markAsChanged();
     void build();
+private:
+    bool m_infoBarShown;
 };
 
 class CMakeEditorWidget : public TextEditor::BaseTextEditorWidget