Changeset View
Changeset View
Standalone View
Standalone View
src/bugzillaintegration/reportinterface.cpp
Show First 20 Lines • Show All 255 Lines • ▼ Show 20 Line(s) | 236 | { | |||
---|---|---|---|---|---|
256 | comment.append(QStringLiteral("-- Backtrace (Reduced):\n")); | 256 | comment.append(QStringLiteral("-- Backtrace (Reduced):\n")); | ||
257 | QString reducedBacktrace = | 257 | QString reducedBacktrace = | ||
258 | DrKonqi::debuggerManager()->backtraceGenerator()->parser()->simplifiedBacktrace(); | 258 | DrKonqi::debuggerManager()->backtraceGenerator()->parser()->simplifiedBacktrace(); | ||
259 | comment.append(reducedBacktrace.trimmed()); | 259 | comment.append(reducedBacktrace.trimmed()); | ||
260 | 260 | | |||
261 | return comment; | 261 | return comment; | ||
262 | } | 262 | } | ||
263 | 263 | | |||
264 | BugReport ReportInterface::newBugReportTemplate() const | 264 | Bugzilla::NewBug ReportInterface::newBugReportTemplate() const | ||
265 | { | 265 | { | ||
266 | //Generate a new bug report template with some values on it | | |||
267 | BugReport report; | | |||
268 | | ||||
269 | const SystemInformation * sysInfo = DrKonqi::systemInformation(); | 266 | const SystemInformation *sysInfo = DrKonqi::systemInformation(); | ||
270 | 267 | | |||
271 | report.setProduct(m_productMapping->bugzillaProduct()); | 268 | Bugzilla::NewBug bug; | ||
272 | report.setComponent(m_productMapping->bugzillaComponent()); | 269 | bug.product = m_productMapping->bugzillaProduct(); | ||
273 | report.setVersion(m_productMapping->bugzillaVersion()); | 270 | bug.component = m_productMapping->bugzillaComponent(); | ||
274 | report.setOperatingSystem(sysInfo->bugzillaOperatingSystem()); | 271 | bug.version = m_productMapping->bugzillaVersion(); | ||
272 | bug.op_sys = sysInfo->bugzillaOperatingSystem(); | ||||
275 | if (sysInfo->compiledSources()) { | 273 | if (sysInfo->compiledSources()) { | ||
276 | report.setPlatform(QLatin1String("Compiled Sources")); | 274 | bug.platform = QLatin1String("Compiled Sources"); | ||
277 | } else { | 275 | } else { | ||
278 | report.setPlatform(sysInfo->bugzillaPlatform()); | 276 | bug.platform = sysInfo->bugzillaPlatform(); | ||
279 | } | | |||
280 | report.setKeywords(QStringList() << QStringLiteral("drkonqi")); | | |||
281 | report.setPriority(QLatin1String("NOR")); | | |||
282 | report.setBugSeverity(QLatin1String("crash")); | | |||
283 | | ||||
284 | /* | | |||
285 | Disable the backtrace functions on title for RELEASE. | | |||
286 | It also needs a bit of polishment | | |||
287 | | ||||
288 | QString title = m_reportTitle; | | |||
289 | | ||||
290 | //If there are not too much possible duplicates by query then there are more possibilities | | |||
291 | //that this report is unique. Let's add the backtrace functions to the title | | |||
292 | if (m_allPossibleDuplicatesByQuery.count() <= 2) { | | |||
293 | if (!m_firstBacktraceFunctions.isEmpty()) { | | |||
294 | title += (QLatin1String(" [") + m_firstBacktraceFunctions.join(", ").trimmed() | | |||
295 | + QLatin1String("]")); | | |||
296 | } | | |||
297 | } | 277 | } | ||
298 | */ | 278 | bug.keywords = QStringList { QStringLiteral("drkonqi") }; | ||
279 | bug.priority = QLatin1String("NOR"); | ||||
280 | bug.severity = QLatin1String("crash"); | ||||
281 | bug.summary = m_reportTitle; | ||||
299 | 282 | | |||
300 | report.setShortDescription(m_reportTitle); | 283 | return bug; | ||
301 | return report; | | |||
302 | } | 284 | } | ||
303 | 285 | | |||
304 | void ReportInterface::sendBugReport() const | 286 | void ReportInterface::sendBugReport() const | ||
305 | { | 287 | { | ||
306 | if (m_attachToBugNumber > 0) | 288 | if (m_attachToBugNumber > 0) | ||
307 | { | 289 | { | ||
308 | //We are going to attach the report to an existent one | 290 | //We are going to attach the report to an existent one | ||
309 | connect(m_bugzillaManager, &BugzillaManager::addMeToCCFinished, this, &ReportInterface::addedToCC); | 291 | connect(m_bugzillaManager, &BugzillaManager::addMeToCCFinished, this, &ReportInterface::addedToCC); | ||
310 | connect(m_bugzillaManager, &BugzillaManager::addMeToCCError, this, &ReportInterface::sendReportError); | 292 | connect(m_bugzillaManager, &BugzillaManager::addMeToCCError, this, &ReportInterface::sendReportError); | ||
311 | //First add the user to the CC list, then attach | 293 | //First add the user to the CC list, then attach | ||
312 | m_bugzillaManager->addMeToCC(m_attachToBugNumber); | 294 | m_bugzillaManager->addMeToCC(m_attachToBugNumber); | ||
313 | } else { | 295 | } else { | ||
314 | //Creating a new bug report | 296 | //Creating a new bug report | ||
315 | BugReport report = newBugReportTemplate(); | 297 | Bugzilla::NewBug report = newBugReportTemplate(); | ||
316 | report.setDescription(generateReportFullText(true)); | 298 | report.description = generateReportFullText(true); | ||
317 | report.setValid(true); | 299 | Q_ASSERT(!report.description.isEmpty()); | ||
318 | 300 | | |||
319 | connect(m_bugzillaManager, &BugzillaManager::sendReportErrorInvalidValues, this, &ReportInterface::sendUsingDefaultProduct); | 301 | connect(m_bugzillaManager, &BugzillaManager::sendReportErrorInvalidValues, this, &ReportInterface::sendUsingDefaultProduct); | ||
320 | connect(m_bugzillaManager, &BugzillaManager::reportSent, this, &ReportInterface::reportSent); | 302 | connect(m_bugzillaManager, &BugzillaManager::reportSent, this, &ReportInterface::reportSent); | ||
321 | connect(m_bugzillaManager, &BugzillaManager::sendReportError, this, &ReportInterface::sendReportError); | 303 | connect(m_bugzillaManager, &BugzillaManager::sendReportError, this, &ReportInterface::sendReportError); | ||
322 | m_bugzillaManager->sendReport(report); | 304 | m_bugzillaManager->sendReport(report); | ||
323 | } | 305 | } | ||
324 | } | 306 | } | ||
325 | 307 | | |||
326 | void ReportInterface::sendUsingDefaultProduct() const | 308 | void ReportInterface::sendUsingDefaultProduct() const | ||
327 | { | 309 | { | ||
328 | //Fallback function: if some of the custom values fail, we need to reset all the fields to the default | 310 | //Fallback function: if some of the custom values fail, we need to reset all the fields to the default | ||
329 | //(and valid) bugzilla values; and try to resend | 311 | //(and valid) bugzilla values; and try to resend | ||
330 | BugReport report = newBugReportTemplate(); | 312 | Bugzilla::NewBug bug = newBugReportTemplate(); | ||
331 | report.setProduct(QLatin1String("kde")); | 313 | bug.product = QLatin1String("kde"); | ||
332 | report.setComponent(QLatin1String("general")); | 314 | bug.component = QLatin1String("general"); | ||
333 | report.setPlatform(QLatin1String("unspecified")); | 315 | bug.platform = QLatin1String("unspecified"); | ||
334 | report.setDescription(generateReportFullText(true)); | 316 | bug.description = generateReportFullText(true); | ||
335 | report.setValid(true); | 317 | m_bugzillaManager->sendReport(bug); | ||
336 | m_bugzillaManager->sendReport(report); | | |||
337 | } | 318 | } | ||
338 | 319 | | |||
339 | void ReportInterface::addedToCC() | 320 | void ReportInterface::addedToCC() | ||
340 | { | 321 | { | ||
341 | //The user was added to the CC list, proceed with the attachment | 322 | //The user was added to the CC list, proceed with the attachment | ||
342 | connect(m_bugzillaManager, &BugzillaManager::attachToReportSent, this, &ReportInterface::attachSent); | 323 | connect(m_bugzillaManager, &BugzillaManager::attachToReportSent, this, &ReportInterface::attachSent); | ||
343 | connect(m_bugzillaManager, &BugzillaManager::attachToReportError, this, &ReportInterface::sendReportError); | 324 | connect(m_bugzillaManager, &BugzillaManager::attachToReportError, this, &ReportInterface::sendReportError); | ||
344 | 325 | | |||
▲ Show 20 Lines • Show All 104 Lines • Show Last 20 Lines |