Get the result table detail area to use the reslist HTML style (e.g. for dark mode)

This commit is contained in:
Jean-Francois Dockes
2020-09-10 10:53:38 +02:00
parent c1ef2187d3
commit 199abb9980
5 changed files with 125 additions and 69 deletions
+29
View File
@@ -462,8 +462,37 @@ void ResListPager::displayPage(RclConfig *config)
chunk << "</p>" << endl;
chunk << "</body></html>" << endl;
append(chunk.rdbuf()->str());
flush();
}
void ResListPager::displaySingleDoc(RclConfig *config, int idx,
Rcl::Doc& doc,
const HighlightData& hdata)
{
ostringstream chunk;
// Header
// Note: have to append text in chunks that make sense
// html-wise. If we break things up too much, the editor
// gets confused.
string bdtag("<body ");
bdtag += bodyAttrs();
rtrimstring(bdtag, " ");
bdtag += ">";
chunk << "<html><head>\n"
<< "<meta http-equiv=\"content-type\""
<< " content=\"text/html; charset=utf-8\">\n"
<< headerContent()
<< "</head>\n" << bdtag << "\n";
append(chunk.rdbuf()->str());
// Document
displayDoc(config, idx, doc, hdata, string());
// Footer
append("</body></html>\n");
flush();
}
// Default implementations for things that should be implemented by
// specializations
string ResListPager::nextUrl()
+10
View File
@@ -79,9 +79,16 @@ public:
}
void resultPageNext();
void resultPageFor(int docnum);
/* Display page of results */
void displayPage(RclConfig *);
/* Display page with single document */
void displaySingleDoc(RclConfig *config, int idx,
Rcl::Doc& doc, const HighlightData& hdata);
/* Generate HTML for single document inside page */
void displayDoc(RclConfig *, int idx, Rcl::Doc& doc,
const HighlightData& hdata, const string& sh = "");
bool pageEmpty() {return m_respage.size() == 0;}
string queryDescription() {
@@ -95,6 +102,9 @@ public:
virtual bool append(const string& data, int, const Rcl::Doc&) {
return append(data);
}
/* Implementing this allows accumulating the text and setting the HTML
at once */
virtual bool flush() {return true;}
// Translation function. This is reimplemented in the qt reslist
// object For this to work, the strings must be duplicated inside
// reslist.cpp (see the QT_TR_NOOP in there). Very very unwieldy.