diff options
author | Radovan Zivkovic <[email protected]> | 2013-11-19 23:45:05 +0100 |
---|---|---|
committer | Oswald Buddenhagen <[email protected]> | 2014-03-11 19:54:57 +0100 |
commit | d98bdc77d3f0fa485d9814470cf552f7c1813936 (patch) | |
tree | 919728031abbf99da0d6f06ce7881a795ca026bb | |
parent | dd77888a2cb52cd1a213e9996697bbc6a821a2d2 (diff) |
Fixed empty schema file path for VS 2003, 2005 and 2008.
Change-Id: I0dd7b12accce5174698fa7d189e2b4809c8ff403
Reviewed-by: Bojan Petrovic <[email protected]>
-rw-r--r-- | src/plugins/vcprojectmanager/vcprojectmanager.cpp | 46 | ||||
-rw-r--r-- | src/plugins/vcprojectmanager/vcprojectmanager.h | 1 |
2 files changed, 15 insertions, 32 deletions
diff --git a/src/plugins/vcprojectmanager/vcprojectmanager.cpp b/src/plugins/vcprojectmanager/vcprojectmanager.cpp index f2b312d4640..68b40bdefde 100644 --- a/src/plugins/vcprojectmanager/vcprojectmanager.cpp +++ b/src/plugins/vcprojectmanager/vcprojectmanager.cpp @@ -33,6 +33,7 @@ #include "vcprojectbuildoptionspage.h" #include "vcprojectmanagerconstants.h" #include "vcprojectmodel/vcprojectdocument_constants.h" +#include "vcschemamanager.h" #include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actioncontainer.h> @@ -53,9 +54,7 @@ namespace Internal { VcManager::VcManager(VcProjectBuildOptionsPage *configPage) : m_configPage(configPage) -{ - readSchemaPath(); -} +{} QString VcManager::mimeType() const { @@ -110,11 +109,14 @@ void VcManager::updateContextMenu(Project *project, ProjectExplorer::Node *node) bool VcManager::checkIfVersion2003(const QString &filePath) const { - if (m_vc2003Schema.isEmpty()) { + VcSchemaManager *schemaMgr = VcSchemaManager::instance(); + QString vc2003Schema = schemaMgr->documentSchema(Constants::SV_2003); + + if (vc2003Schema.isEmpty()) { return false; } - QFile schemaFile(m_vc2003Schema); + QFile schemaFile(vc2003Schema); schemaFile.open(QIODevice::ReadOnly); QXmlSchema schema; @@ -134,10 +136,12 @@ bool VcManager::checkIfVersion2003(const QString &filePath) const bool VcManager::checkIfVersion2005(const QString &filePath) const { - if (m_vc2005Schema.isEmpty()) + VcSchemaManager *schemaMgr = VcSchemaManager::instance(); + QString vc2005Schema = schemaMgr->documentSchema(Constants::SV_2005); + if (vc2005Schema.isEmpty()) return false; - QFile schemaFile(m_vc2005Schema); + QFile schemaFile(vc2005Schema); schemaFile.open(QIODevice::ReadOnly); QXmlSchema schema; @@ -157,10 +161,12 @@ bool VcManager::checkIfVersion2005(const QString &filePath) const bool VcManager::checkIfVersion2008(const QString &filePath) const { - if (m_vc2008Schema.isEmpty()) + VcSchemaManager *schemaMgr = VcSchemaManager::instance(); + QString vc2008Schema = schemaMgr->documentSchema(Constants::SV_2008); + if (vc2008Schema.isEmpty()) return false; - QFile schemaFile(m_vc2008Schema); + QFile schemaFile(vc2008Schema); schemaFile.open(QIODevice::ReadOnly); QXmlSchema schema; @@ -178,27 +184,5 @@ bool VcManager::checkIfVersion2008(const QString &filePath) const return false; } -void VcManager::readSchemaPath() -{ - QSettings *settings = Core::ICore::settings(); - settings->beginGroup(QLatin1String(VcProjectManager::Constants::VC_PROJECT_SETTINGS_GROUP)); - QString msSchemaPathsData = settings->value(QLatin1String(VcProjectManager::Constants::VC_PROJECT_SCHEMA_PATH)).toString(); - settings->endGroup(); - - QStringList schemaPaths = msSchemaPathsData.split(QLatin1Char(';')); - - foreach (const QString &schema, schemaPaths) { - QStringList schemaData = schema.split(QLatin1String("::")); - if (schemaData.size() == 2) { - if (schemaData[0] == QLatin1String(Constants::VC_PROJECT_SCHEMA_2003_QUIALIFIER)) - m_vc2003Schema = schemaData[1]; - else if (schemaData[0] == QLatin1String(Constants::VC_PROJECT_SCHEMA_2005_QUIALIFIER)) - m_vc2005Schema = schemaData[1]; - else if (schemaData[0] == QLatin1String(Constants::VC_PROJECT_SCHEMA_2008_QUIALIFIER)) - m_vc2008Schema = schemaData[1]; - } - } -} - } // namespace Internal } // namespace VcProjectManager diff --git a/src/plugins/vcprojectmanager/vcprojectmanager.h b/src/plugins/vcprojectmanager/vcprojectmanager.h index 3792e6806af..64bcea36927 100644 --- a/src/plugins/vcprojectmanager/vcprojectmanager.h +++ b/src/plugins/vcprojectmanager/vcprojectmanager.h @@ -57,7 +57,6 @@ private: bool checkIfVersion2003(const QString &filePath) const; bool checkIfVersion2005(const QString &filePath) const; bool checkIfVersion2008(const QString &filePath) const; - void readSchemaPath(); private: ProjectExplorer::Project *m_contextProject; |