add pref to display Snippets link even if doc has no pages

This commit is contained in:
Jean-Francois Dockes 2020-03-11 10:44:49 +01:00
parent b00f7127a9
commit f141e35279
8 changed files with 185 additions and 168 deletions

View File

@ -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,

View File

@ -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;

View File

@ -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);
}

View File

@ -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);

View File

@ -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>

View File

@ -77,27 +77,27 @@ void UIPrefsDialog::init()
connect(resetSnipCssPB, SIGNAL(clicked()), this, SLOT(resetSnipCss()));
connect(idxLV, SIGNAL(itemSelectionChanged()),
this, SLOT(extradDbSelectChanged()));
this, SLOT(extradDbSelectChanged()));
connect(ptransPB, SIGNAL(clicked()),
this, SLOT(extraDbEditPtrans()));
this, SLOT(extraDbEditPtrans()));
connect(addExtraDbPB, SIGNAL(clicked()),
this, SLOT(addExtraDbPB_clicked()));
this, SLOT(addExtraDbPB_clicked()));
connect(delExtraDbPB, SIGNAL(clicked()),
this, SLOT(delExtraDbPB_clicked()));
this, SLOT(delExtraDbPB_clicked()));
connect(togExtraDbPB, SIGNAL(clicked()),
this, SLOT(togExtraDbPB_clicked()));
this, SLOT(togExtraDbPB_clicked()));
connect(actAllExtraDbPB, SIGNAL(clicked()),
this, SLOT(actAllExtraDbPB_clicked()));
this, SLOT(actAllExtraDbPB_clicked()));
connect(unacAllExtraDbPB, SIGNAL(clicked()),
this, SLOT(unacAllExtraDbPB_clicked()));
this, SLOT(unacAllExtraDbPB_clicked()));
connect(CLEditPara, SIGNAL(clicked()), this, SLOT(editParaFormat()));
connect(CLEditHeader, SIGNAL(clicked()), this, SLOT(editHeaderText()));
connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
connect(buildAbsCB, SIGNAL(toggled(bool)),
replAbsCB, SLOT(setEnabled(bool)));
replAbsCB, SLOT(setEnabled(bool)));
connect(ssNoCompleteCB, SIGNAL(toggled(bool)),
ssSearchOnCompleteCB, SLOT(setDisabled(bool)));
ssSearchOnCompleteCB, SLOT(setDisabled(bool)));
setFromPrefs();
}
@ -115,22 +115,22 @@ void UIPrefsDialog::setFromPrefs()
maxHLTSB->setValue(prefs.maxhltextmbs);
if (prefs.ssearchTypSav) {
ssearchTypCMB->setCurrentIndex(4);
ssearchTypCMB->setCurrentIndex(4);
} else {
ssearchTypCMB->setCurrentIndex(prefs.ssearchTyp);
ssearchTypCMB->setCurrentIndex(prefs.ssearchTyp);
}
switch (prefs.filterCtlStyle) {
case PrefsPack::FCS_MN:
filterMN_RB->setChecked(1);
break;
filterMN_RB->setChecked(1);
break;
case PrefsPack::FCS_CMB:
filterCMB_RB->setChecked(1);
break;
filterCMB_RB->setChecked(1);
break;
case PrefsPack::FCS_BT:
default:
filterBT_RB->setChecked(1);
break;
filterBT_RB->setChecked(1);
break;
}
noBeepsCB->setChecked(prefs.noBeeps);
ssNoCompleteCB->setChecked(prefs.ssearchNoComplete);
@ -161,15 +161,15 @@ void UIPrefsDialog::setFromPrefs()
previewActiveLinksCB->setChecked(prefs.previewActiveLinks);
switch (prefs.previewPlainPre) {
case PrefsPack::PP_BR:
plainBRRB->setChecked(1);
break;
plainBRRB->setChecked(1);
break;
case PrefsPack::PP_PRE:
plainPRERB->setChecked(1);
break;
plainPRERB->setChecked(1);
break;
case PrefsPack::PP_PREWRAP:
default:
plainPREWRAPRB->setChecked(1);
break;
plainPREWRAPRB->setChecked(1);
break;
}
// Query terms color
qtermStyleLE->setText(prefs.qtermstyle);
@ -185,21 +185,22 @@ void UIPrefsDialog::setFromPrefs()
// Style sheet
qssFile = prefs.qssFile;
if (qssFile.isEmpty()) {
stylesheetPB->setText(tr("Choose"));
stylesheetPB->setText(tr("Choose"));
} else {
string nm = path_getsimple((const char *)qssFile.toLocal8Bit());
stylesheetPB->setText(QString::fromLocal8Bit(nm.c_str()));
string nm = path_getsimple((const char *)qssFile.toLocal8Bit());
stylesheetPB->setText(QString::fromLocal8Bit(nm.c_str()));
}
snipCssFile = prefs.snipCssFile;
if (snipCssFile.isEmpty()) {
snipCssPB->setText(tr("Choose"));
snipCssPB->setText(tr("Choose"));
} else {
string nm = path_getsimple((const char *)snipCssFile.toLocal8Bit());
snipCssPB->setText(QString::fromLocal8Bit(nm.c_str()));
string nm = path_getsimple((const char *)snipCssFile.toLocal8Bit());
snipCssPB->setText(QString::fromLocal8Bit(nm.c_str()));
}
snipwMaxLenSB->setValue(prefs.snipwMaxLength);
snipwByPageCB->setChecked(prefs.snipwSortByPage);
alwaysSnippetsCB->setChecked(prefs.alwaysSnippets);
paraFormat = prefs.reslistformat;
headerText = prefs.reslistheadertext;
@ -209,18 +210,18 @@ void UIPrefsDialog::setFromPrefs()
stemLangCMB->addItem(g_stringAllStem);
vector<string> langs;
if (!getStemLangs(langs)) {
QMessageBox::warning(0, "Recoll",
tr("error retrieving stemming languages"));
QMessageBox::warning(0, "Recoll",
tr("error retrieving stemming languages"));
}
int cur = prefs.queryStemLang == "" ? 0 : 1;
for (vector<string>::const_iterator it = langs.begin();
it != langs.end(); it++) {
stemLangCMB->
addItem(QString::fromUtf8(it->c_str(), it->length()));
if (cur == 0 && !strcmp((const char*)prefs.queryStemLang.toUtf8(),
it->c_str())) {
cur = stemLangCMB->count();
}
it != langs.end(); it++) {
stemLangCMB->
addItem(QString::fromUtf8(it->c_str(), it->length()));
if (cur == 0 && !strcmp((const char*)prefs.queryStemLang.toUtf8(),
it->c_str())) {
cur = stemLangCMB->count();
}
}
stemLangCMB->setCurrentIndex(cur);
@ -237,27 +238,27 @@ void UIPrefsDialog::setFromPrefs()
synFileCB->setChecked(prefs.synFileEnable);
synFile = prefs.synFile;
if (synFile.isEmpty()) {
synFilePB->setText(tr("Choose"));
synFilePB->setText(tr("Choose"));
} else {
string nm = path_getsimple((const char *)synFile.toLocal8Bit());
synFilePB->setText(QString::fromLocal8Bit(nm.c_str()));
string nm = path_getsimple((const char *)synFile.toLocal8Bit());
synFilePB->setText(QString::fromLocal8Bit(nm.c_str()));
}
// Initialize the extra indexes listboxes
idxLV->clear();
for (const auto& dbdir : prefs.allExtraDbs) {
QListWidgetItem *item =
new QListWidgetItem(QString::fromLocal8Bit(dbdir.c_str()), idxLV);
if (item)
item->setCheckState(Qt::Unchecked);
QListWidgetItem *item =
new QListWidgetItem(QString::fromLocal8Bit(dbdir.c_str()), idxLV);
if (item)
item->setCheckState(Qt::Unchecked);
}
for (const auto& dbdir : prefs.activeExtraDbs) {
auto items =
auto items =
idxLV->findItems (QString::fromLocal8Bit(dbdir.c_str()),
Qt::MatchFixedString|Qt::MatchCaseSensitive);
for (auto& entry : items) {
entry->setCheckState(Qt::Checked);
}
for (auto& entry : items) {
entry->setCheckState(Qt::Checked);
}
}
idxLV->sortItems();
}
@ -266,10 +267,10 @@ void UIPrefsDialog::setupReslistFontPB()
{
QString s;
if (reslistFontFamily.length() == 0) {
reslistFontPB->setText(tr("Default QtWebkit font"));
reslistFontPB->setText(tr("Default QtWebkit font"));
} else {
reslistFontPB->setText(reslistFontFamily + "-" +
s.setNum(reslistFontSize));
reslistFontPB->setText(reslistFontFamily + "-" +
s.setNum(reslistFontSize));
}
}
@ -283,20 +284,20 @@ void UIPrefsDialog::accept()
prefs.ssearchStartOnComplete = ssSearchOnCompleteCB->isChecked();
if (ssearchTypCMB->currentIndex() == 4) {
prefs.ssearchTypSav = true;
// prefs.ssearchTyp will be set from the current value when
// exiting the program
prefs.ssearchTypSav = true;
// prefs.ssearchTyp will be set from the current value when
// exiting the program
} else {
prefs.ssearchTypSav = false;
prefs.ssearchTyp = ssearchTypCMB->currentIndex();
prefs.ssearchTypSav = false;
prefs.ssearchTyp = ssearchTypCMB->currentIndex();
}
if (filterMN_RB->isChecked()) {
prefs.filterCtlStyle = PrefsPack::FCS_MN;
prefs.filterCtlStyle = PrefsPack::FCS_MN;
} else if (filterCMB_RB->isChecked()) {
prefs.filterCtlStyle = PrefsPack::FCS_CMB;
prefs.filterCtlStyle = PrefsPack::FCS_CMB;
} else {
prefs.filterCtlStyle = PrefsPack::FCS_BT;
prefs.filterCtlStyle = PrefsPack::FCS_BT;
}
m_mainWindow->setFilterCtlStyle(prefs.filterCtlStyle);
@ -318,26 +319,27 @@ void UIPrefsDialog::accept()
prefs.reslistformat = paraFormat;
prefs.reslistheadertext = headerText;
if (prefs.reslistformat.trimmed().isEmpty()) {
prefs.reslistformat = prefs.dfltResListFormat;
paraFormat = prefs.reslistformat;
prefs.reslistformat = prefs.dfltResListFormat;
paraFormat = prefs.reslistformat;
}
prefs.snipwMaxLength = snipwMaxLenSB->value();
prefs.snipwSortByPage = snipwByPageCB->isChecked();
prefs.alwaysSnippets = alwaysSnippetsCB->isChecked();
prefs.creslistformat = (const char*)prefs.reslistformat.toUtf8();
if (stemLangCMB->currentIndex() == 0) {
prefs.queryStemLang = "";
prefs.queryStemLang = "";
} else if (stemLangCMB->currentIndex() == 1) {
prefs.queryStemLang = "ALL";
prefs.queryStemLang = "ALL";
} else {
prefs.queryStemLang = stemLangCMB->currentText();
prefs.queryStemLang = stemLangCMB->currentText();
}
prefs.ssearchAutoPhrase = autoPhraseCB->isChecked();
prefs.ssearchAutoPhraseThreshPC = autoPThreshSB->value();
prefs.queryBuildAbstract = buildAbsCB->isChecked();
prefs.queryReplaceAbstract = buildAbsCB->isChecked() &&
replAbsCB->isChecked();
replAbsCB->isChecked();
prefs.startWithAdvSearchOpen = initStartAdvCB->isChecked();
@ -354,11 +356,11 @@ void UIPrefsDialog::accept()
prefs.previewActiveLinks = previewActiveLinksCB->isChecked();
if (plainBRRB->isChecked()) {
prefs.previewPlainPre = PrefsPack::PP_BR;
prefs.previewPlainPre = PrefsPack::PP_BR;
} else if (plainPRERB->isChecked()) {
prefs.previewPlainPre = PrefsPack::PP_PRE;
prefs.previewPlainPre = PrefsPack::PP_PRE;
} else {
prefs.previewPlainPre = PrefsPack::PP_PREWRAP;
prefs.previewPlainPre = PrefsPack::PP_PREWRAP;
}
prefs.syntAbsLen = syntlenSB->value();
@ -373,14 +375,14 @@ void UIPrefsDialog::accept()
prefs.allExtraDbs.clear();
prefs.activeExtraDbs.clear();
for (int i = 0; i < idxLV->count(); i++) {
QListWidgetItem *item = idxLV->item(i);
if (item) {
prefs.allExtraDbs.push_back((const char *)item->text().toLocal8Bit());
if (item->checkState() == Qt::Checked) {
prefs.activeExtraDbs.push_back((const char *)
item->text().toLocal8Bit());
}
}
QListWidgetItem *item = idxLV->item(i);
if (item) {
prefs.allExtraDbs.push_back((const char *)item->text().toLocal8Bit());
if (item->checkState() == Qt::Checked) {
prefs.activeExtraDbs.push_back((const char *)
item->text().toLocal8Bit());
}
}
}
rwSettings(true);
@ -394,11 +396,11 @@ void UIPrefsDialog::editParaFormat()
{
EditDialog dialog(this);
dialog.setWindowTitle(tr("Result list paragraph format "
"(erase all to reset to default)"));
"(erase all to reset to default)"));
dialog.plainTextEdit->setPlainText(paraFormat);
int result = dialog.exec();
if (result == QDialog::Accepted)
paraFormat = dialog.plainTextEdit->toPlainText();
paraFormat = dialog.plainTextEdit->toPlainText();
}
void UIPrefsDialog::editHeaderText()
@ -408,7 +410,7 @@ void UIPrefsDialog::editHeaderText()
dialog.plainTextEdit->setPlainText(headerText);
int result = dialog.exec();
if (result == QDialog::Accepted)
headerText = dialog.plainTextEdit->toPlainText();
headerText = dialog.plainTextEdit->toPlainText();
}
void UIPrefsDialog::reject()
@ -421,16 +423,16 @@ void UIPrefsDialog::setStemLang(const QString& lang)
{
int cur = 0;
if (lang == "") {
cur = 0;
cur = 0;
} else if (lang == "ALL") {
cur = 1;
cur = 1;
} else {
for (int i = 1; i < stemLangCMB->count(); i++) {
if (lang == stemLangCMB->itemText(i)) {
cur = i;
break;
}
}
for (int i = 1; i < stemLangCMB->count(); i++) {
if (lang == stemLangCMB->itemText(i)) {
cur = i;
break;
}
}
}
stemLangCMB->setCurrentIndex(cur);
}
@ -440,18 +442,18 @@ void UIPrefsDialog::showFontDialog()
bool ok;
QFont font;
if (prefs.reslistfontfamily.length()) {
font.setFamily(prefs.reslistfontfamily);
font.setPointSize(prefs.reslistfontsize);
font.setFamily(prefs.reslistfontfamily);
font.setPointSize(prefs.reslistfontsize);
}
font = QFontDialog::getFont(&ok, font, this);
if (ok) {
// We used to check if the default font was set, in which case
// we erased the preference, but this would result in letting
// webkit make a choice of default font which it usually seems
// to do wrong. So now always set the font. There is still a
// way for the user to let webkit choose the default though:
// click reset, then the font name and size will be empty.
// We used to check if the default font was set, in which case
// we erased the preference, but this would result in letting
// webkit make a choice of default font which it usually seems
// to do wrong. So now always set the font. There is still a
// way for the user to let webkit choose the default though:
// click reset, then the font name and size will be empty.
reslistFontFamily = font.family();
reslistFontSize = font.pointSize();
setupReslistFontPB();
@ -505,10 +507,10 @@ void UIPrefsDialog::resetReslistFont()
void UIPrefsDialog::showViewAction()
{
if (m_viewAction== 0) {
m_viewAction = new ViewAction(0);
m_viewAction = new ViewAction(0);
} else {
// Close and reopen, in hope that makes us visible...
m_viewAction->close();
// Close and reopen, in hope that makes us visible...
m_viewAction->close();
}
m_viewAction->show();
}
@ -524,24 +526,24 @@ void UIPrefsDialog::showViewAction(const QString& mt)
void UIPrefsDialog::extradDbSelectChanged()
{
if (idxLV->selectedItems().size() <= 1)
ptransPB->setEnabled(true);
ptransPB->setEnabled(true);
else
ptransPB->setEnabled(false);
ptransPB->setEnabled(false);
}
void UIPrefsDialog::extraDbEditPtrans()
{
string dbdir;
if (idxLV->selectedItems().size() == 0) {
dbdir = theconfig->getDbDir();
dbdir = theconfig->getDbDir();
} else if (idxLV->selectedItems().size() == 1) {
QListWidgetItem *item = idxLV->selectedItems()[0];
QString qd = item->data(Qt::DisplayRole).toString();
dbdir = (const char *)qd.toLocal8Bit();
QListWidgetItem *item = idxLV->selectedItems()[0];
QString qd = item->data(Qt::DisplayRole).toString();
dbdir = (const char *)qd.toLocal8Bit();
} else {
QMessageBox::warning(
0, "Recoll", tr("At most one index should be selected"));
return;
QMessageBox::warning(
0, "Recoll", tr("At most one index should be selected"));
return;
}
dbdir = path_canon(dbdir);
EditTrans *etrans = new EditTrans(dbdir, this);
@ -551,28 +553,28 @@ void UIPrefsDialog::extraDbEditPtrans()
void UIPrefsDialog::togExtraDbPB_clicked()
{
for (int i = 0; i < idxLV->count(); i++) {
QListWidgetItem *item = idxLV->item(i);
if (item->isSelected()) {
if (item->checkState() == Qt::Checked) {
item->setCheckState(Qt::Unchecked);
} else {
item->setCheckState(Qt::Checked);
}
}
QListWidgetItem *item = idxLV->item(i);
if (item->isSelected()) {
if (item->checkState() == Qt::Checked) {
item->setCheckState(Qt::Unchecked);
} else {
item->setCheckState(Qt::Checked);
}
}
}
}
void UIPrefsDialog::actAllExtraDbPB_clicked()
{
for (int i = 0; i < idxLV->count(); i++) {
QListWidgetItem *item = idxLV->item(i);
item->setCheckState(Qt::Checked);
QListWidgetItem *item = idxLV->item(i);
item->setCheckState(Qt::Checked);
}
}
void UIPrefsDialog::unacAllExtraDbPB_clicked()
{
for (int i = 0; i < idxLV->count(); i++) {
QListWidgetItem *item = idxLV->item(i);
item->setCheckState(Qt::Unchecked);
QListWidgetItem *item = idxLV->item(i);
item->setCheckState(Qt::Unchecked);
}
}
@ -580,8 +582,8 @@ void UIPrefsDialog::delExtraDbPB_clicked()
{
QList<QListWidgetItem *> items = idxLV->selectedItems();
for (QList<QListWidgetItem *>::iterator it = items.begin();
it != items.end(); it++) {
delete *it;
it != items.end(); it++) {
delete *it;
}
}
@ -592,11 +594,11 @@ static bool samedir(const string& dir1, const string& dir2)
#else
struct stat st1, st2;
if (stat(dir1.c_str(), &st1))
return false;
return false;
if (stat(dir2.c_str(), &st2))
return false;
return false;
if (st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino) {
return true;
return true;
}
return false;
#endif
@ -620,60 +622,59 @@ void UIPrefsDialog::on_showTrayIconCB_clicked()
void UIPrefsDialog::addExtraDbPB_clicked()
{
QString input = myGetFileName(true,
tr("Select recoll config directory or "
"xapian index directory "
"(e.g.: /home/me/.recoll or "
"/home/me/.recoll/xapiandb)"));
tr("Select recoll config directory or "
"xapian index directory "
"(e.g.: /home/me/.recoll or "
"/home/me/.recoll/xapiandb)"));
if (input.isEmpty())
return;
return;
string dbdir = (const char *)input.toLocal8Bit();
if (path_exists(path_cat(dbdir, "recoll.conf"))) {
// Chosen dir is config dir.
RclConfig conf(&dbdir);
dbdir = conf.getDbDir();
if (dbdir.empty()) {
QMessageBox::warning(
0, "Recoll", tr("The selected directory looks like a Recoll "
"configuration directory but the configuration "
"could not be read"));
return;
}
// Chosen dir is config dir.
RclConfig conf(&dbdir);
dbdir = conf.getDbDir();
if (dbdir.empty()) {
QMessageBox::warning(
0, "Recoll", tr("The selected directory looks like a Recoll "
"configuration directory but the configuration "
"could not be read"));
return;
}
}
LOGDEB("ExtraDbDial: got: [" << (dbdir) << "]\n" );
bool stripped;
if (!Rcl::Db::testDbDir(dbdir, &stripped)) {
QMessageBox::warning(0, "Recoll",
tr("The selected directory does not appear to be a Xapian index"));
return;
QMessageBox::warning(0, "Recoll",
tr("The selected directory does not appear to be a Xapian index"));
return;
}
if (o_index_stripchars != stripped) {
QMessageBox::warning(0, "Recoll",
tr("Cant add index with different case/diacritics"
" stripping option"));
return;
QMessageBox::warning(0, "Recoll",
tr("Cant add index with different case/diacritics"
" stripping option"));
return;
}
if (samedir(dbdir, theconfig->getDbDir())) {
QMessageBox::warning(0, "Recoll",
tr("This is the main/local index!"));
return;
QMessageBox::warning(0, "Recoll",
tr("This is the main/local index!"));
return;
}
for (int i = 0; i < idxLV->count(); i++) {
QListWidgetItem *item = idxLV->item(i);
string existingdir = (const char *)item->text().toLocal8Bit();
if (samedir(dbdir, existingdir)) {
QMessageBox::warning(
0, "Recoll", tr("The selected directory is already in the "
"index list"));
return;
}
QListWidgetItem *item = idxLV->item(i);
string existingdir = (const char *)item->text().toLocal8Bit();
if (samedir(dbdir, existingdir)) {
QMessageBox::warning(
0, "Recoll", tr("The selected directory is already in the "
"index list"));
return;
}
}
QListWidgetItem *item =
new QListWidgetItem(QString::fromLocal8Bit(dbdir.c_str()), idxLV);
new QListWidgetItem(QString::fromLocal8Bit(dbdir.c_str()), idxLV);
item->setCheckState(Qt::Checked);
idxLV->sortItems();
}

View File

@ -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>&nbsp;&nbsp;";
linksbuf << "&nbsp;&nbsp;" << snipsbuf.str();

View File

@ -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