diff options
author | Tobias Hunger <tobias.hunger@nokia.com> | 2011-04-15 16:02:44 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@nokia.com> | 2011-04-15 16:06:38 +0200 |
commit | c07e2133990d23e1aa7df6a8bf6ff77ea50c2167 (patch) | |
tree | cf42bb98786dc8fa615510f8e36c418cde2f40cc /src/plugins/cvs | |
parent | 9978ebeda85bad33f017d2ed0c045ae3b1838714 (diff) | |
download | qt-creator-c07e2133990d23e1aa7df6a8bf6ff77ea50c2167.tar.gz |
VCS: Do not claim to support any operation if unconfigured
Make sure none of the VCS systems claims it does support any
VCS operation while unconfigured. This stops the specific
VCS from showing up in wizards, etc. till they can actually
be used.
Diffstat (limited to 'src/plugins/cvs')
-rw-r--r-- | src/plugins/cvs/cvscontrol.cpp | 12 | ||||
-rw-r--r-- | src/plugins/cvs/cvscontrol.h | 1 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/plugins/cvs/cvscontrol.cpp b/src/plugins/cvs/cvscontrol.cpp index 2dfa2b9566..ce1801eb52 100644 --- a/src/plugins/cvs/cvscontrol.cpp +++ b/src/plugins/cvs/cvscontrol.cpp @@ -32,6 +32,7 @@ #include "cvscontrol.h" #include "cvsplugin.h" +#include "cvssettings.h" #include <QtCore/QFileInfo> @@ -48,9 +49,18 @@ QString CVSControl::displayName() const return QLatin1String("cvs"); } +bool CVSControl::isConfigured() const +{ + const QString binary = m_plugin->settings().cvsCommand; + if (binary.isEmpty()) + return false; + QFileInfo fi(binary); + return fi.exists() && fi.isFile() && fi.isExecutable(); +} + bool CVSControl::supportsOperation(Operation operation) const { - bool rc = true; + bool rc = isConfigured(); switch (operation) { case AddOperation: case DeleteOperation: diff --git a/src/plugins/cvs/cvscontrol.h b/src/plugins/cvs/cvscontrol.h index 12145a6aad..a26366eb0f 100644 --- a/src/plugins/cvs/cvscontrol.h +++ b/src/plugins/cvs/cvscontrol.h @@ -50,6 +50,7 @@ public: bool managesDirectory(const QString &directory, QString *topLevel = 0) const; + bool isConfigured() const; bool supportsOperation(Operation operation) const; bool vcsOpen(const QString &fileName); bool vcsAdd(const QString &fileName); |