mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-08-03 20:56:49 -04:00
File-not-found tab now displays zim name and path
This commit is contained in:
parent
368fafb6bc
commit
17702f887b
@ -171,5 +171,7 @@
|
||||
"preview-book-in-web-browser": "Preview book in web browser",
|
||||
"file-not-found-title": "ZIM File Not Found",
|
||||
"file-not-found-text": "ZIM file doesn't exist or is not readable",
|
||||
"zim-id": "ZIM Id"
|
||||
"zim-id": "Zim Id",
|
||||
"zim-name": "Zim Name",
|
||||
"zim-path": "Zim File Path"
|
||||
}
|
||||
|
@ -178,5 +178,7 @@
|
||||
"path-was-copied": "Tooltip confirming that the download path from settings was copied.",
|
||||
"file-not-found-title": "Error title text displayed when the desktop application cannot find the Zim file needed to display the web page.",
|
||||
"file-not-found-text": "Error description text for when the desktop application cannot find the Zim file needed to display the web page.",
|
||||
"zim-id": "The term for the unique identifier of a zim file."
|
||||
"zim-id": "The term for the unique identifier of a zim file.",
|
||||
"zim-name": "The term for the name of a Zim file",
|
||||
"zim-path": "The term for the path of a Zim file"
|
||||
}
|
||||
|
@ -181,6 +181,15 @@ UrlSchemeHandler::replyZimNotFoundPage(QWebEngineUrlRequestJob *request,
|
||||
const QString &zimId)
|
||||
{
|
||||
QBuffer *buffer = new QBuffer;
|
||||
QString path = "N/A", name = "N/A";
|
||||
try
|
||||
{
|
||||
auto& book = KiwixApp::instance()->getLibrary()->getBookById(zimId);
|
||||
path = QString::fromStdString(book.getPath());
|
||||
name = QString::fromStdString(book.getName());
|
||||
}
|
||||
catch (...) { /* Blank */ }
|
||||
|
||||
QString contentHtml = "<section><div>"
|
||||
"<h1>" +
|
||||
gt("file-not-found-title") +
|
||||
@ -191,6 +200,12 @@ UrlSchemeHandler::replyZimNotFoundPage(QWebEngineUrlRequestJob *request,
|
||||
"<p>" +
|
||||
gt("zim-id") + ": <b>" + zimId +
|
||||
"</b></p>"
|
||||
"<p>" +
|
||||
gt("zim-name") + ": <b>" + name +
|
||||
"</b></p>"
|
||||
"<p>" +
|
||||
gt("zim-path") + ": <b>" + path +
|
||||
"</b></p>"
|
||||
"</div></section>";
|
||||
|
||||
buffer->open(QIODevice::WriteOnly);
|
||||
|
Loading…
x
Reference in New Issue
Block a user