aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/clearcase
diff options
context:
space:
mode:
authorKnut Petter Svendsen <knutpett@pvv.org>2013-11-07 12:31:22 +0100
committerKnut Petter Svendsen <knutpett@pvv.org>2013-11-13 15:31:31 +0100
commit16b4c2e0327ce102fac26ac3da47884618a3cf0b (patch)
tree6949bfad04aca29fb10d499e3097bbbac1e0cbd8 /src/plugins/clearcase
parent4c0d07a9aace583cd6d97114d7de1d279339bf0e (diff)
ClearCase: Handle read-only view private files
View private files have state NotManaged. In the corner case where a NotManaged file is read-only they should be made writeable by the ReadOnlyFilesDialog, and not vcsOpen()-ed. Change-Id: Icfeab6bebb76cc01da693b3bfff7b46c45b106b4 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/plugins/clearcase')
-rw-r--r--src/plugins/clearcase/clearcasecontrol.cpp23
-rw-r--r--src/plugins/clearcase/clearcasecontrol.h2
2 files changed, 19 insertions, 6 deletions
diff --git a/src/plugins/clearcase/clearcasecontrol.cpp b/src/plugins/clearcase/clearcasecontrol.cpp
index 30262623896..c1497f979a2 100644
--- a/src/plugins/clearcase/clearcasecontrol.cpp
+++ b/src/plugins/clearcase/clearcasecontrol.cpp
@@ -83,12 +83,23 @@ bool ClearCaseControl::supportsOperation(Operation operation) const
return rc;
}
-Core::IVersionControl::OpenSupportMode ClearCaseControl::openSupportMode() const
-{
- if (m_plugin->isDynamic())
- return IVersionControl::OpenMandatory; // Checkout is the only option for dynamic views
- else
+Core::IVersionControl::OpenSupportMode ClearCaseControl::openSupportMode(const QString &fileName) const
+{
+ if (m_plugin->isDynamic()) {
+ // NB! Has to use managesFile() and not vcsStatus() since the index can only be guaranteed
+ // to be up to date if the file has been explicitly opened, which is not the case when
+ // doing a search and replace as a part of a refactoring.
+ if (m_plugin->managesFile(QFileInfo(fileName).absolutePath(), fileName)) {
+ // Checkout is the only option for managed files in dynamic views
+ return IVersionControl::OpenMandatory;
+ } else {
+ // Not managed files can be edited without noticing the VCS
+ return IVersionControl::NoOpen;
+ }
+
+ } else {
return IVersionControl::OpenOptional; // Snapshot views supports Hijack and check out
+ }
}
bool ClearCaseControl::vcsOpen(const QString &fileName)
@@ -153,6 +164,8 @@ QString ClearCaseControl::vcsOpenText() const
QString ClearCaseControl::vcsMakeWritableText() const
{
+ if (m_plugin->isDynamic())
+ return QString();
return tr("&Hijack");
}
diff --git a/src/plugins/clearcase/clearcasecontrol.h b/src/plugins/clearcase/clearcasecontrol.h
index f94ee440524..794cd8b2b40 100644
--- a/src/plugins/clearcase/clearcasecontrol.h
+++ b/src/plugins/clearcase/clearcasecontrol.h
@@ -53,7 +53,7 @@ public:
bool isConfigured() const;
bool supportsOperation(Operation operation) const;
- OpenSupportMode openSupportMode() const;
+ OpenSupportMode openSupportMode(const QString &fileName) const;
bool vcsOpen(const QString &fileName);
SettingsFlags settingsFlags() const;
bool vcsAdd(const QString &fileName);