add pref to display Snippets link even if doc has no pages
This commit is contained in:
parent
b00f7127a9
commit
f141e35279
@ -243,6 +243,8 @@ void rwSettings(bool writing)
|
||||
prefs.abssep = "…";
|
||||
SETTING_RW(prefs.snipwMaxLength, "/Recoll/prefs/snipwin/maxlen", Int, 1000);
|
||||
SETTING_RW(prefs.snipwSortByPage,"/Recoll/prefs/snipwin/bypage", Bool,false);
|
||||
SETTING_RW(prefs.alwaysSnippets, "/Recoll/prefs/reslist/alwaysSnippets",
|
||||
Bool,false);
|
||||
|
||||
SETTING_RW(prefs.autoSuffs, "/Recoll/prefs/query/autoSuffs", String, "");
|
||||
SETTING_RW(prefs.autoSuffsEnable,
|
||||
|
||||
@ -92,6 +92,8 @@ class PrefsPack {
|
||||
int snipwMaxLength;
|
||||
// Snippets window sort by page (dflt: by weight)
|
||||
bool snipwSortByPage;
|
||||
// Display Snippets links even for un-paged documents
|
||||
bool alwaysSnippets;
|
||||
bool startWithAdvSearchOpen{false};
|
||||
// Try to display html if it exists in the internfile stack.
|
||||
bool previewHtml;
|
||||
|
||||
@ -128,8 +128,8 @@ bool RclWebPage::acceptNavigationRequest(const QUrl& url,
|
||||
|
||||
class QtGuiResListPager : public ResListPager {
|
||||
public:
|
||||
QtGuiResListPager(ResList *p, int ps)
|
||||
: ResListPager(ps), m_reslist(p)
|
||||
QtGuiResListPager(ResList *p, int ps, bool alwayssnip)
|
||||
: ResListPager(ps, alwayssnip), m_reslist(p)
|
||||
{}
|
||||
virtual bool append(const string& data);
|
||||
virtual bool append(const string& data, int idx, const Rcl::Doc& doc);
|
||||
@ -391,7 +391,7 @@ ResList::ResList(QWidget* parent, const char* name)
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)),
|
||||
this, SLOT(createPopupMenu(const QPoint&)));
|
||||
|
||||
m_pager = new QtGuiResListPager(this, prefs.respagesize);
|
||||
m_pager = new QtGuiResListPager(this, prefs.respagesize, prefs.alwaysSnippets);
|
||||
m_pager->setHighLighter(&g_hiliter);
|
||||
}
|
||||
|
||||
|
||||
@ -76,7 +76,7 @@ static PlainToRichQtReslist g_hiliter;
|
||||
class ResTablePager : public ResListPager {
|
||||
public:
|
||||
ResTablePager(ResTable *p)
|
||||
: ResListPager(1), m_parent(p)
|
||||
: ResListPager(1, prefs.alwaysSnippets), m_parent(p)
|
||||
{}
|
||||
virtual bool append(const string& data, int idx, const Rcl::Doc& doc);
|
||||
virtual string trans(const string& in);
|
||||
|
||||
@ -624,6 +624,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="alwaysSnippetsCB">
|
||||
<property name="text">
|
||||
<string>Display a Snippets link even if the document has no pages (needs restart).</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
@ -200,6 +200,7 @@ void UIPrefsDialog::setFromPrefs()
|
||||
}
|
||||
snipwMaxLenSB->setValue(prefs.snipwMaxLength);
|
||||
snipwByPageCB->setChecked(prefs.snipwSortByPage);
|
||||
alwaysSnippetsCB->setChecked(prefs.alwaysSnippets);
|
||||
paraFormat = prefs.reslistformat;
|
||||
headerText = prefs.reslistheadertext;
|
||||
|
||||
@ -323,6 +324,7 @@ void UIPrefsDialog::accept()
|
||||
}
|
||||
prefs.snipwMaxLength = snipwMaxLenSB->value();
|
||||
prefs.snipwSortByPage = snipwByPageCB->isChecked();
|
||||
prefs.alwaysSnippets = alwaysSnippetsCB->isChecked();
|
||||
|
||||
prefs.creslistformat = (const char*)prefs.reslistformat.toUtf8();
|
||||
|
||||
@ -676,4 +678,3 @@ void UIPrefsDialog::addExtraDbPB_clicked()
|
||||
item->setCheckState(Qt::Checked);
|
||||
idxLV->sortItems();
|
||||
}
|
||||
|
||||
|
||||
@ -53,8 +53,9 @@ public:
|
||||
};
|
||||
static PlainToRichHtReslist g_hiliter;
|
||||
|
||||
ResListPager::ResListPager(int pagesize)
|
||||
ResListPager::ResListPager(int pagesize, bool alwaysSnippets)
|
||||
: m_pagesize(pagesize),
|
||||
m_alwaysSnippets(alwaysSnippets),
|
||||
m_newpagesize(pagesize),
|
||||
m_resultsInCurrentPage(0),
|
||||
m_winfirst(-1),
|
||||
@ -257,7 +258,7 @@ void ResListPager::displayDoc(RclConfig *config, int i, Rcl::Doc& doc,
|
||||
<< trans("Open") << "</a>";
|
||||
}
|
||||
ostringstream snipsbuf;
|
||||
if (doc.haspages) {
|
||||
if (m_alwaysSnippets || doc.haspages) {
|
||||
snipsbuf << "<a href=\"" <<linkPrefix()<<"A" << docnumforlinks << "\">"
|
||||
<< trans("Snippets") << "</a> ";
|
||||
linksbuf << " " << snipsbuf.str();
|
||||
|
||||
@ -33,7 +33,7 @@ class PlainToRich;
|
||||
*/
|
||||
class ResListPager {
|
||||
public:
|
||||
ResListPager(int pagesize=10);
|
||||
ResListPager(int pagesize=10, bool alwaysSnippets = false);
|
||||
virtual ~ResListPager() {}
|
||||
|
||||
void setHighLighter(PlainToRich *ptr) {
|
||||
@ -118,6 +118,7 @@ public:
|
||||
virtual string linkPrefix() {return "";}
|
||||
private:
|
||||
int m_pagesize;
|
||||
bool m_alwaysSnippets;
|
||||
int m_newpagesize;
|
||||
int m_resultsInCurrentPage;
|
||||
// First docnum (from docseq) in current page
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user