1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

FalkonSchemeHandler: Redirect falkon:reportbug to KDE bugzilla

This commit is contained in:
David Rosca 2018-02-16 14:44:32 +01:00
parent 4360ed982f
commit d2d0594c63
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
4 changed files with 4 additions and 96 deletions

View File

@ -2,7 +2,6 @@
<qresource prefix="/">
<file>html/about.html</file>
<file>html/copyright</file>
<file>html/reportbug.html</file>
<file>html/start.html</file>
<file>html/speeddial.html</file>
<file>html/jquery.js</file>

View File

@ -1,54 +0,0 @@
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>%TITLE%</title>
<style>
html {background: #dddddd;font-family: sans-serif;color: #525c66;}
html * {font-size: 100%;line-height: 1.6;}
#box {background: #ffffff;max-width:650px;min-width:400px;overflow:auto;margin: 25px auto 10px auto;padding: 10px 40px;text-align: %LEFT_STR%;direction: %DIRECTION%;}
h1 {color: #1a4ba4;font-size: 160%;margin-bottom: 0px;}
p {margin-%LEFT_STR%: 1%;}
.submit {width: 100px;}
select {width: 200px;}
textarea {width: 400px;height: 100px; border: 1px solid #babcb8;}
textarea:focus {border-color: #579eea;}
input[type="text"], input[type="email"] {width: 200px;height: 25px;border: 1px solid #babcb8;}
input[type="text"]:focus, input[type="email"]:focus {border-color: #579eea;}
</style>
<script>
function checkFields()
{
var type = document.getElementById("type").value;
var description = document.getElementById("text").value;
if (type == null || type == "" || description == null || description == "") {
alert("%FIELDS-ARE-REQUIRED%");
return false;
}
return true;
}
</script>
</head>
<body>
<div id="box">
<h1>%REPORT-ISSUE%</h1>
<p>%PLUGINS-TEXT%</p>
<p style="display:none" id="result"> </p>
<p>
<table>
<form action="https://www.qupzilla.com/reportbug.php" onsubmit="return checkFields()" method="POST">
<tr><td>%EMAIL%*:</td><td><input type="email" id="mail" name="mail"> </tr>
<tr><td>%TYPE%:</td><td><input type="text" id="type" name="type" required> </tr>
<tr><td>%DESCRIPTION%:</td><td><textarea id="text" name="text" required></textarea> </tr>
<tr><td colspan=2 align=%RIGHT_STR%><input class="submit" type="submit" name="ok" value="%SEND%"> </tr>
<input type="hidden" name="os" value="%INFO_OS%">
<input type="hidden" name="version" value="%INFO_APP%">
<input type="hidden" name="qtversion" value="%INFO_QT%">
<input type="hidden" name="webkitversion" value="%INFO_WEBKIT%">
</form>
</table>
</p>
<p>* %E-MAIL-OPTIONAL%</p>
</div>
</body></html>

View File

@ -51,7 +51,7 @@ void FalkonSchemeHandler::requestStarted(QWebEngineUrlRequestJob *job)
}
QStringList knownPages;
knownPages << "about" << "reportbug" << "start" << "speeddial" << "config" << "restore";
knownPages << "about" << "start" << "speeddial" << "config" << "restore";
if (knownPages.contains(job->requestUrl().path()))
job->reply(QByteArrayLiteral("text/html"), new FalkonSchemeReply(job));
@ -73,6 +73,9 @@ bool FalkonSchemeHandler::handleRequest(QWebEngineUrlRequestJob *job)
mApp->destroyRestoreManager();
job->redirect(QUrl(QSL("falkon:start")));
return true;
} else if (job->requestUrl().path() == QL1S("reportbug")) {
job->redirect(QUrl(Qz::BUGSADDRESS));
return true;
}
return false;
@ -100,9 +103,6 @@ void FalkonSchemeReply::loadPage()
if (m_pageName == QLatin1String("about")) {
stream << aboutPage();
}
else if (m_pageName == QLatin1String("reportbug")) {
stream << reportbugPage();
}
else if (m_pageName == QLatin1String("start")) {
stream << startPage();
}
@ -140,42 +140,6 @@ qint64 FalkonSchemeReply::writeData(const char *data, qint64 len)
return 0;
}
QString FalkonSchemeReply::reportbugPage()
{
static QString bPage;
if (!bPage.isEmpty()) {
return bPage;
}
bPage.append(QzTools::readAllFileContents(":html/reportbug.html"));
bPage.replace(QLatin1String("%TITLE%"), tr("Report Issue"));
bPage.replace(QLatin1String("%REPORT-ISSUE%"), tr("Report Issue"));
bPage.replace(QLatin1String("%PLUGINS-TEXT%"), tr("If you are experiencing problems with Falkon, please try to disable"
" all extensions first. <br/>If this does not fix it, then please fill out this form: "));
bPage.replace(QLatin1String("%EMAIL%"), tr("Your E-mail"));
bPage.replace(QLatin1String("%TYPE%"), tr("Issue type"));
bPage.replace(QLatin1String("%DESCRIPTION%"), tr("Issue description"));
bPage.replace(QLatin1String("%SEND%"), tr("Send"));
bPage.replace(QLatin1String("%E-MAIL-OPTIONAL%"), tr("E-mail is optional<br/><b>Note: </b>Please read how to make a "
"bug report <a href=%1>here</a> first.").arg("https://github.com/QupZilla/qupzilla/wiki/Bug-Reports target=_blank"));
bPage.replace(QLatin1String("%FIELDS-ARE-REQUIRED%"), tr("Please fill out all required fields!"));
bPage.replace(QLatin1String("%INFO_OS%"), QzTools::operatingSystemLong());
bPage.replace(QLatin1String("%INFO_APP%"),
#ifdef FALKON_GIT_REVISION
QString("%1 (%2)").arg(Qz::VERSION, FALKON_GIT_REVISION)
#else
Qz::VERSION
#endif
);
bPage.replace(QLatin1String("%INFO_QT%"), QString("%1 (built with %2)").arg(qVersion(), QT_VERSION_STR));
bPage.replace(QLatin1String("%INFO_WEBKIT%"), QSL("QtWebEngine")),
bPage = QzTools::applyDirectionToPage(bPage);
return bPage;
}
QString FalkonSchemeReply::startPage()
{
static QString sPage;

View File

@ -51,7 +51,6 @@ private slots:
private:
QString aboutPage();
QString reportbugPage();
QString startPage();
QString speeddialPage();
QString restorePage();