void FinalPage::initializePage () { auto wiz = qobject_cast<ReportWizard*> (wizard ()); QString title; QString desc; const auto type = wiz->GetReportTypePage ()->GetReportType (); switch (type) { case ReportTypePage::Type::Bug: title = wiz->GetBugReportPage ()->GetTitle (); desc = wiz->GetBugReportPage ()->GetText (); break; case ReportTypePage::Type::Feature: title = wiz->GetFRPage ()->GetTitle (); desc = wiz->GetFRPage ()->GetText (); break; } const auto& data = XMLGenerator ().CreateIssue (title, desc, ReportTypePage::Type::Bug); auto reply = wiz->PostRequest ("/issues.xml", data); connect (reply, SIGNAL (finished ()), this, SLOT (handleReplyFinished ())); }
void Plugin::checkSavedReports () { const auto& dolozheeDir = Util::CreateIfNotExists ("dolozhee"); auto news = dolozheeDir; if (!news.cd ("crashreports")) return; news.mkdir ("old"); QStringList names; for (const auto& name : news.entryList (QDir::Files | QDir::NoDotAndDotDot)) { const auto& newName = news.absoluteFilePath ("old/" + name); if (!QFile::rename (news.absoluteFilePath (name), newName)) continue; names << newName; } if (names.isEmpty ()) return; auto wizard = initiateReporting (); wizard->GetReportTypePage ()->ForceReportType (ReportTypePage::Type::Bug); auto attachPage = wizard->GetFilePage (); for (const auto& name : names) attachPage->AddFile (name); }
void PreviewPage::initializePage () { auto wiz = qobject_cast<ReportWizard*> (wizard ()); if (!wiz) return; const auto typePage = wiz->GetReportTypePage (); const auto type = typePage->GetReportType (); QString title; QList<QPair<QString, QString>> sections; QString typeText; switch (type) { case ReportTypePage::Type::Bug: title = wiz->GetBugReportPage ()->GetTitle (); sections = wiz->GetBugReportPage ()->GetReportSections (); typeText = tr ("Bug"); break; case ReportTypePage::Type::Feature: title = wiz->GetFRPage ()->GetTitle (); sections = wiz->GetFRPage ()->GetReportSections (); typeText = tr ("Feature"); break; } QString preview = "<strong>User:</strong><br/>" + ((wiz->GetChooseUserPage ()->GetUser () == ChooseUserPage::User::Anonymous) ? "Anonymous" : wiz->GetChooseUserPage ()->GetLogin ()) + "<br/><br/>"; preview += "<strong>Title:</strong><br/>" + title + "<br/><br/>"; preview += "<strong>Type:</strong><br/>" + typeText + "<br/><br/>"; preview += "<strong>Category:</strong><br/>" + wiz->GetReportTypePage ()->GetCategoryName () + "<br/><br/>"; preview += "<strong>Priority:</strong><br/>" + PriorityToString (wiz->GetReportTypePage ()->GetPriority ()) + "<br/><br/>"; for (const auto& section : sections) preview += QString ("<strong>%1:</strong><br/>%2<br/><br/>") .arg (section.first) .arg (Util::Escape (section.second)); preview += "<strong>Attached files:</strong><br/>" + wiz->GetFilePage ()->GetFiles ().join ("<br/>"); preview.remove ("\r"); preview.replace ("\n", "<br/>"); Ui_.Preview_->setHtml (preview); }