diff --git a/src/doc/user/usermanual.xml b/src/doc/user/usermanual.xml index c56a940b..4b9e3688 100644 --- a/src/doc/user/usermanual.xml +++ b/src/doc/user/usermanual.xml @@ -1603,6 +1603,86 @@ MimeType=*/* + + The Query Fragments window + + Selecting the Tools + Query Fragments menu + entry will open a window with radio- and check-buttons which + can be used to activate query language fragments for + filtering the current query. This can be useful if you have + frequent reusable selectors, for example, filtering on + alternate directories, or searching just one category of + files, not covered by the standard category + selectors. + + The contents of the window are entirely customizable, and + defined by the contents of the fragbuts.xml + file inside the configuration directory. The sample file + distributed with &RCL; (which you should be able to find under + /usr/share/recoll/examples/fragbuts.xml), + contains an example which filters the results from the WEB + history. + + Here follows an example: + +<?xml version="1.0" encoding="UTF-8"?> + +<fragbuts version="1.0"> + + <radiobuttons> + + <fragbut> + <label>Include Web Results</label> + <frag></frag> + </fragbut> + + <fragbut> + <label>Exclude Web Results</label> + <frag>-rclbes:BGL</frag> + </fragbut> + + <fragbut> + <label>Only Web Results</label> + <frag>rclbes:BGL</frag> + </fragbut> + + </radiobuttons> + + <buttons> + + <fragbut> + <label>Year 2010</label> + <frag>date:2010-01-01/2010-12-31</frag> + </fragbut> + + <fragbut> + <label>My Great Directory Only</label> + <frag>dir:/my/great/directory</frag> + </fragbut> + + </buttons> +</fragbuts> + + + + Each radiobuttons or + buttons section defines a line of + checkbuttons or radiobuttons inside the window. Any number of + buttons can be selected, but the radiobuttons in a line are + exclusive. + + Each fragbut section defines the label + for a button, and the Query Language fragment which will be + added (as an AND filter) before performing the query if the + button is active. + + This feature is new in &RCL; 1.20, and will probably be + refined depending on user feedback. + + + + Complex/advanced search @@ -2135,6 +2215,21 @@ MimeType=*/* to the first page. These work even while the focus is in the search entry. + + Result table: moving the focus to the table + You can use Ctrl-r to move the focus + from the search entry to the table, and then use the arrow keys + to change the current row. Ctrl-Shift-s returns to + the search. + + + Result table: open / preview + With the focus in the result table, you can use + Ctrl-o to open the document from the current + row, Ctrl-Shift-o to open the document and close + recoll, Ctrl-d to preview + the document. + Editing a new search while the focus is not in the search entry diff --git a/src/qtgui/fragbuts.cpp b/src/qtgui/fragbuts.cpp index 24b3e755..6c5e3830 100644 --- a/src/qtgui/fragbuts.cpp +++ b/src/qtgui/fragbuts.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include "fragbuts.h" @@ -113,6 +114,7 @@ bool FragButsParser::endElement(const QString & /* namespaceURI */, QCheckBox *but = new QCheckBox(label, parent); abut = but; } + abut->setToolTip(currentText); buttons.push_back(FragButs::ButFrag(abut, frag)); hl->addWidget(abut); } else if (qName == "buttons" || qName == "radiobuttons") { @@ -125,12 +127,15 @@ bool FragButsParser::endElement(const QString & /* namespaceURI */, } FragButs::FragButs(QWidget* parent) - : QWidget(parent) + : QWidget(parent), m_ok(false) { string conf = path_cat(theconfig->getConfDir(), "fragbuts.xml"); string data, reason; if (!file_to_string(conf, data, &reason)) { + QMessageBox::warning(0, "Recoll", + tr("%1 not found.").arg( + QString::fromLocal8Bit(conf.c_str()))); LOGERR(("Fragbuts:: can't read [%s]\n", conf.c_str())); return; } @@ -142,6 +147,9 @@ FragButs::FragButs(QWidget* parent) QXmlInputSource xmlInputSource; xmlInputSource.setData(QString::fromUtf8(data.c_str())); if (!reader.parse(xmlInputSource)) { + QMessageBox::warning(0, "Recoll", + tr("%1 could not be parsed.").arg( + QString::fromLocal8Bit(conf.c_str()))); LOGERR(("FragButs:: parse failed for [%s]\n", conf.c_str())); return; } @@ -150,6 +158,8 @@ FragButs::FragButs(QWidget* parent) connect(it->button, SIGNAL(clicked(bool)), this, SLOT(onButtonClicked(bool))); } + setWindowTitle(tr("Fragment Buttons")); + m_ok = true; } FragButs::~FragButs() diff --git a/src/qtgui/fragbuts.h b/src/qtgui/fragbuts.h index a07b9f06..40f0560e 100644 --- a/src/qtgui/fragbuts.h +++ b/src/qtgui/fragbuts.h @@ -46,7 +46,7 @@ public: }; void getfrags(std::vector&); - + bool ok() {return m_ok;} private slots: void onButtonClicked(bool); @@ -57,6 +57,7 @@ private: // Detect source file change time_t m_reftime; std::vector m_buttons; + bool m_ok; }; diff --git a/src/qtgui/rclmain_w.cpp b/src/qtgui/rclmain_w.cpp index 8e605c48..64c5e2bf 100644 --- a/src/qtgui/rclmain_w.cpp +++ b/src/qtgui/rclmain_w.cpp @@ -1058,9 +1058,14 @@ void RclMain::showFragButs() { if (fragbuts == 0) { fragbuts = new FragButs(0); - fragbuts->show(); - connect(fragbuts, SIGNAL(fragmentsChanged()), - this, SLOT(onFragmentsChanged())); + if (fragbuts->ok()) { + fragbuts->show(); + connect(fragbuts, SIGNAL(fragmentsChanged()), + this, SLOT(onFragmentsChanged())); + } else { + delete fragbuts; + fragbuts = 0; + } } else { // Close and reopen, in hope that makes us visible... fragbuts->close(); diff --git a/src/qtgui/restable.cpp b/src/qtgui/restable.cpp index 13fb46f3..091db991 100644 --- a/src/qtgui/restable.cpp +++ b/src/qtgui/restable.cpp @@ -488,7 +488,7 @@ void ResTable::init() tableView->setContextMenuPolicy(Qt::CustomContextMenu); new QShortcut(QKeySequence("Ctrl+o"), this, SLOT(menuEdit())); new QShortcut(QKeySequence("Ctrl+Shift+o"), this, SLOT(menuEditAndQuit())); - new QShortcut(QKeySequence("Ctrl+p"), this, SLOT(menuPreview())); + new QShortcut(QKeySequence("Ctrl+d"), this, SLOT(menuPreview())); connect(tableView, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(createPopupMenu(const QPoint&))); diff --git a/src/recollinstall.in b/src/recollinstall.in index d062ebc6..ea544939 100755 --- a/src/recollinstall.in +++ b/src/recollinstall.in @@ -142,6 +142,7 @@ ${INSTALL} -m 0644 python/recoll/recoll/rclconfig.py \ ${INSTALL} -m 0444 \ desktop/recollindex.desktop \ + sampleconf/fragbuts.xml \ sampleconf/mimeconf \ sampleconf/mimeview \ sampleconf/recoll.conf \ diff --git a/src/sampleconf/fragbuts.xml b/src/sampleconf/fragbuts.xml new file mode 100644 index 00000000..2b3178b3 --- /dev/null +++ b/src/sampleconf/fragbuts.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + -rclbes:BGL + + + + + rclbes:BGL + + + + + + + + + date:2010-01-01/2010-12-31 + + + + + ext:cpp OR ext:cxx + + + + + dir:/my/great/directory + + + + +