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