GUI, Webengine version: the computed doc number for the right-click menu was wrong on any page but the first
This commit is contained in:
parent
1eeeba4874
commit
e051de0a37
@ -144,31 +144,20 @@ public:
|
|||||||
map<string, vector<string> >& sugg);
|
map<string, vector<string> >& sugg);
|
||||||
virtual string absSep() {return (const char *)(prefs.abssep.toUtf8());}
|
virtual string absSep() {return (const char *)(prefs.abssep.toUtf8());}
|
||||||
#ifdef USING_WEBENGINE
|
#ifdef USING_WEBENGINE
|
||||||
virtual string linkPrefix() override {return "http://localhost/";}
|
virtual string linkPrefix() override {return "http://localhost/";}
|
||||||
|
virtual string bodyAttrs() override {
|
||||||
|
return "onload=\"addEventListener('contextmenu', saveLoc)\"";
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
private:
|
private:
|
||||||
ResList *m_reslist;
|
ResList *m_reslist;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if 0
|
|
||||||
FILE *fp;
|
|
||||||
void logdata(const char *data)
|
|
||||||
{
|
|
||||||
if (fp == 0)
|
|
||||||
fp = fopen("/tmp/recolltoto.html", "a");
|
|
||||||
if (fp)
|
|
||||||
fprintf(fp, "%s", data);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#define logdata(X)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
// /// QtGuiResListPager methods:
|
// /// QtGuiResListPager methods:
|
||||||
bool QtGuiResListPager::append(const string& data)
|
bool QtGuiResListPager::append(const string& data)
|
||||||
{
|
{
|
||||||
LOGDEB2("QtGuiReslistPager::appendString : " << data << "\n");
|
LOGDEB2("QtGuiReslistPager::appendString : " << data << "\n");
|
||||||
logdata(data.c_str());
|
|
||||||
m_reslist->append(QString::fromUtf8(data.c_str()));
|
m_reslist->append(QString::fromUtf8(data.c_str()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -178,7 +167,6 @@ bool QtGuiResListPager::append(const string& data, int docnum,
|
|||||||
{
|
{
|
||||||
LOGDEB2("QtGuiReslistPager::appendDoc: blockCount " <<
|
LOGDEB2("QtGuiReslistPager::appendDoc: blockCount " <<
|
||||||
m_reslist->document()->blockCount() << ", " << data << "\n");
|
m_reslist->document()->blockCount() << ", " << data << "\n");
|
||||||
logdata(data.c_str());
|
|
||||||
#if defined(USING_WEBKIT) || defined(USING_WEBENGINE)
|
#if defined(USING_WEBKIT) || defined(USING_WEBENGINE)
|
||||||
QString sdoc = QString(
|
QString sdoc = QString(
|
||||||
"<div class=\"rclresult\" id=\"%1\" rcldocnum=\"%1\">").arg(docnum);
|
"<div class=\"rclresult\" id=\"%1\" rcldocnum=\"%1\">").arg(docnum);
|
||||||
@ -827,15 +815,6 @@ void ResList::displayPage()
|
|||||||
setHtml(m_text);
|
setHtml(m_text);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(USING_WEBENGINE)
|
|
||||||
// Have to delay running this. Alternative would be to set it as
|
|
||||||
// onload on the body element in the html, like upplay does, but
|
|
||||||
// this would need an ennoying reslistpager modification.
|
|
||||||
m_js = "elt=document.getElementsByTagName('body')[0];"
|
|
||||||
"elt.addEventListener('contextmenu', saveLoc);";
|
|
||||||
QTimer::singleShot(200, this, SLOT(runStoredJS()));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
LOGDEB0("ResList::displayPg: hasNext " << m_pager->hasNext() <<
|
LOGDEB0("ResList::displayPg: hasNext " << m_pager->hasNext() <<
|
||||||
" atBot " << scrollIsAtBottom() << " hasPrev " <<
|
" atBot " << scrollIsAtBottom() << " hasPrev " <<
|
||||||
m_pager->hasPrev() << " at Top " << scrollIsAtTop() << " \n");
|
m_pager->hasPrev() << " at Top " << scrollIsAtTop() << " \n");
|
||||||
@ -1108,7 +1087,7 @@ void ResList::onPopupJsDone(const QVariant &jr)
|
|||||||
QString nm = qsl[i].left(eq).trimmed();
|
QString nm = qsl[i].left(eq).trimmed();
|
||||||
QString value = qsl[i].right(qsl[i].size() - (eq+1)).trimmed();
|
QString value = qsl[i].right(qsl[i].size() - (eq+1)).trimmed();
|
||||||
if (!nm.compare("rcldocnum")) {
|
if (!nm.compare("rcldocnum")) {
|
||||||
m_popDoc = atoi(qs2utf8s(value).c_str());
|
m_popDoc = pageFirstDocNum() + atoi(qs2utf8s(value).c_str());
|
||||||
} else {
|
} else {
|
||||||
LOGERR("onPopupJsDone: unknown key: " << qs2utf8s(nm) << "\n");
|
LOGERR("onPopupJsDone: unknown key: " << qs2utf8s(nm) << "\n");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -358,7 +358,7 @@ void ResListPager::displayPage(RclConfig *config)
|
|||||||
<< "<meta http-equiv=\"content-type\""
|
<< "<meta http-equiv=\"content-type\""
|
||||||
<< " content=\"text/html; charset=utf-8\">" << endl
|
<< " content=\"text/html; charset=utf-8\">" << endl
|
||||||
<< headerContent()
|
<< headerContent()
|
||||||
<< "</head><body>" << endl
|
<< "</head><body " << bodyAttrs() << ">" << endl
|
||||||
<< pageTop()
|
<< pageTop()
|
||||||
<< "<p><span style=\"font-size:110%;\"><b>"
|
<< "<p><span style=\"font-size:110%;\"><b>"
|
||||||
<< m_docSource->title()
|
<< m_docSource->title()
|
||||||
|
|||||||
@ -116,6 +116,7 @@ public:
|
|||||||
}
|
}
|
||||||
virtual string absSep() {return "…";}
|
virtual string absSep() {return "…";}
|
||||||
virtual string linkPrefix() {return "";}
|
virtual string linkPrefix() {return "";}
|
||||||
|
virtual string bodyAttrs() {return string();}
|
||||||
private:
|
private:
|
||||||
int m_pagesize;
|
int m_pagesize;
|
||||||
bool m_alwaysSnippets;
|
bool m_alwaysSnippets;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user