diff --git a/src/qtgui/reslist.cpp b/src/qtgui/reslist.cpp index ca09ec72..3c9528b5 100644 --- a/src/qtgui/reslist.cpp +++ b/src/qtgui/reslist.cpp @@ -144,31 +144,20 @@ public: map >& sugg); virtual string absSep() {return (const char *)(prefs.abssep.toUtf8());} #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 private: 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: bool QtGuiResListPager::append(const string& data) { LOGDEB2("QtGuiReslistPager::appendString : " << data << "\n"); - logdata(data.c_str()); m_reslist->append(QString::fromUtf8(data.c_str())); return true; } @@ -178,7 +167,6 @@ bool QtGuiResListPager::append(const string& data, int docnum, { LOGDEB2("QtGuiReslistPager::appendDoc: blockCount " << m_reslist->document()->blockCount() << ", " << data << "\n"); - logdata(data.c_str()); #if defined(USING_WEBKIT) || defined(USING_WEBENGINE) QString sdoc = QString( "
").arg(docnum); @@ -827,15 +815,6 @@ void ResList::displayPage() setHtml(m_text); #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() << " atBot " << scrollIsAtBottom() << " hasPrev " << 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 value = qsl[i].right(qsl[i].size() - (eq+1)).trimmed(); if (!nm.compare("rcldocnum")) { - m_popDoc = atoi(qs2utf8s(value).c_str()); + m_popDoc = pageFirstDocNum() + atoi(qs2utf8s(value).c_str()); } else { LOGERR("onPopupJsDone: unknown key: " << qs2utf8s(nm) << "\n"); } diff --git a/src/query/reslistpager.cpp b/src/query/reslistpager.cpp index f8026ba6..ce0f18d7 100644 --- a/src/query/reslistpager.cpp +++ b/src/query/reslistpager.cpp @@ -358,7 +358,7 @@ void ResListPager::displayPage(RclConfig *config) << "" << endl << headerContent() - << "" << endl + << "" << endl << pageTop() << "

" << m_docSource->title() diff --git a/src/query/reslistpager.h b/src/query/reslistpager.h index 8c809d51..8bc30320 100644 --- a/src/query/reslistpager.h +++ b/src/query/reslistpager.h @@ -116,6 +116,7 @@ public: } virtual string absSep() {return "…";} virtual string linkPrefix() {return "";} + virtual string bodyAttrs() {return string();} private: int m_pagesize; bool m_alwaysSnippets;