Changeset View
Changeset View
Standalone View
Standalone View
src/bugzillaintegration/productmapping.cpp
Show First 20 Lines • Show All 139 Lines • ▼ Show 20 Line(s) | 139 | if (allVersions.contains(version)) { | |||
---|---|---|---|---|---|
140 | //The version the crash application provided is a valid bugzilla version: use it ! | 140 | //The version the crash application provided is a valid bugzilla version: use it ! | ||
141 | m_bugzillaVersionString = version; | 141 | m_bugzillaVersionString = version; | ||
142 | } else if (version.endsWith(QLatin1String(".00"))) { | 142 | } else if (version.endsWith(QLatin1String(".00"))) { | ||
143 | //check if there is a version on bugzilla with just ".0" | 143 | //check if there is a version on bugzilla with just ".0" | ||
144 | const QString shorterVersion = version.left(version.size() - 1); | 144 | const QString shorterVersion = version.left(version.size() - 1); | ||
145 | if (allVersions.contains(shorterVersion)) { | 145 | if (allVersions.contains(shorterVersion)) { | ||
146 | m_bugzillaVersionString = shorterVersion; | 146 | m_bugzillaVersionString = shorterVersion; | ||
147 | } | 147 | } | ||
148 | } else if (!allVersions.contains(m_bugzillaVersionString)) { | ||||
149 | // No good match found, make sure the default is sound... | ||||
150 | // If our hardcoded fallback is not in bugzilla it was likely | ||||
151 | // renamed so we'll find the version with the lowest id instead | ||||
152 | // and that should technically have been the "default" version. | ||||
153 | Bugzilla::ProductVersion *lowestVersion = nullptr; | ||||
154 | for (const auto &version : product->versions()) { | ||||
155 | if (!lowestVersion || lowestVersion->id() > version->id()) { | ||||
156 | lowestVersion = version; | ||||
157 | } | ||||
158 | } | ||||
159 | if (lowestVersion) { | ||||
160 | m_bugzillaVersionString = lowestVersion->name(); | ||||
161 | } | ||||
148 | } | 162 | } | ||
149 | 163 | | |||
150 | // check whether that versions is disabled for new reports, which | 164 | // check whether that versions is disabled for new reports, which | ||
151 | // usually means that version is outdated and not supported anymore. | 165 | // usually means that version is outdated and not supported anymore. | ||
152 | const QStringList &inactiveVersions = product->inactiveVersions(); | 166 | const QStringList &inactiveVersions = product->inactiveVersions(); | ||
153 | m_bugzillaVersionDisabled = inactiveVersions.contains(m_bugzillaVersionString); | 167 | m_bugzillaVersionDisabled = inactiveVersions.contains(m_bugzillaVersionString); | ||
154 | | ||||
155 | } | 168 | } | ||
156 | 169 | | |||
157 | QStringList ProductMapping::relatedBugzillaProducts() const | 170 | QStringList ProductMapping::relatedBugzillaProducts() const | ||
158 | { | 171 | { | ||
159 | return m_relatedBugzillaProducts; | 172 | return m_relatedBugzillaProducts; | ||
160 | } | 173 | } | ||
161 | 174 | | |||
162 | QString ProductMapping::bugzillaProduct() const | 175 | QString ProductMapping::bugzillaProduct() const | ||
Show All 23 Lines |