From e7074329b5354072dedac3448acbe5b486e1efa5 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Thu, 30 Jun 2022 10:07:54 +0200 Subject: [PATCH] GUI reslist: look for a reslisthtmldumpfile value in recoll.conf and dump the HTML page there if it is defined and the target file does not exist --- src/qtgui/reslist.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/qtgui/reslist.cpp b/src/qtgui/reslist.cpp index 6ab49395..44a416d3 100644 --- a/src/qtgui/reslist.cpp +++ b/src/qtgui/reslist.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2020 J.F.Dockes +/* Copyright (C) 2005-2022 J.F.Dockes * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -19,6 +19,7 @@ #include #include +#include #include @@ -809,14 +810,18 @@ void ResList::displayPage() m_progress = nullptr; } const static QUrl baseUrl("file:///"); -#if 0 - auto fp = fopen("/tmp/recoll-reslist.html", "w"); - if (fp) { - auto s = qs2utf8s(m_text); - fwrite(s.c_str(), 1, s.size(), fp); - fclose(fp); + + std::string dumpfile; + if (theconfig->getConfParam("reslisthtmldumpfile", dumpfile)) { + if (!dumpfile.empty() && !path_exists(dumpfile)) { + auto fp = fopen(dumpfile.c_str(), "w"); + if (fp) { + auto s = qs2utf8s(m_text); + fwrite(s.c_str(), 1, s.size(), fp); + fclose(fp); + } + } } -#endif setHtml(m_text, baseUrl); #endif