From 60578cb556be583a54c2192f76a55dce97765dbe Mon Sep 17 00:00:00 2001
From: Daniel Molkentin <daniel.molkentin@nokia.com>
Date: Thu, 22 Oct 2009 17:57:16 +0200
Subject: [PATCH] Add validChanged(bool) to PathChooser.

This is useful when e.g. connecting directly to the setEnabled() slot of
a Widget.
---
 src/libs/utils/basevalidatinglineedit.cpp | 4 +++-
 src/libs/utils/basevalidatinglineedit.h   | 1 +
 src/libs/utils/pathchooser.cpp            | 1 +
 src/libs/utils/pathchooser.h              | 1 +
 4 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/libs/utils/basevalidatinglineedit.cpp b/src/libs/utils/basevalidatinglineedit.cpp
index c70aa59e1f5..255c9e6a347 100644
--- a/src/libs/utils/basevalidatinglineedit.cpp
+++ b/src/libs/utils/basevalidatinglineedit.cpp
@@ -138,8 +138,10 @@ void BaseValidatingLineEdit::slotChanged(const QString &t)
         m_bd->m_state = newState;
         m_bd->m_firstChange = false;
         setTextColor(this, newState == Invalid ? m_bd->m_errorTextColor : m_bd->m_okTextColor);
-        if (validHasChanged)
+        if (validHasChanged) {
+            emit validChanged(newState == Valid);
             emit validChanged();
+        }
     }
 }
 
diff --git a/src/libs/utils/basevalidatinglineedit.h b/src/libs/utils/basevalidatinglineedit.h
index 77031bbd96c..5773d4f7451 100644
--- a/src/libs/utils/basevalidatinglineedit.h
+++ b/src/libs/utils/basevalidatinglineedit.h
@@ -81,6 +81,7 @@ public:
 
 signals:
     void validChanged();
+    void validChanged(bool validState);
     void validReturnPressed();
 
 protected:
diff --git a/src/libs/utils/pathchooser.cpp b/src/libs/utils/pathchooser.cpp
index c550ecbc39f..76e4247931b 100644
--- a/src/libs/utils/pathchooser.cpp
+++ b/src/libs/utils/pathchooser.cpp
@@ -108,6 +108,7 @@ PathChooser::PathChooser(QWidget *parent) :
     connect(m_d->m_lineEdit, SIGNAL(validReturnPressed()), this, SIGNAL(returnPressed()));
     connect(m_d->m_lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(changed(QString)));
     connect(m_d->m_lineEdit, SIGNAL(validChanged()), this, SIGNAL(validChanged()));
+    connect(m_d->m_lineEdit, SIGNAL(validChanged(bool)), this, SIGNAL(validChanged(bool)));
     connect(m_d->m_lineEdit, SIGNAL(editingFinished()), this, SIGNAL(editingFinished()));
 
     m_d->m_lineEdit->setMinimumWidth(200);
diff --git a/src/libs/utils/pathchooser.h b/src/libs/utils/pathchooser.h
index ee3e6eaf40c..d974e90d031 100644
--- a/src/libs/utils/pathchooser.h
+++ b/src/libs/utils/pathchooser.h
@@ -99,6 +99,7 @@ private:
 
 signals:
     void validChanged();
+    void validChanged(bool validState);
     void changed(const QString &text);
     void editingFinished();
     void beforeBrowsing();
-- 
GitLab