diff --git a/src/Makefile.am b/src/Makefile.am index 51cd3efa..5f7577f1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -567,7 +567,7 @@ python/samples/recollgui/rclmain.ui \ python/samples/recollq.py \ python/samples/recollqsd.py \ \ -sampleconf/fields sampleconf/fragbuts.xml sampleconf/mimeconf \ +sampleconf/fields sampleconf/fragment-buttons.xml sampleconf/mimeconf \ sampleconf/mimemap sampleconf/mimeview sampleconf/mimeview.mac \ sampleconf/recoll.conf sampleconf/recoll.qss \ sampleconf/recoll-dark.qss sampleconf/recoll-dark.css \ @@ -656,7 +656,7 @@ desktop/recollindex.desktop \ index/rclmon.sh \ index/recollindex@.service \ index/recollindex.service \ -sampleconf/fragbuts.xml \ +sampleconf/fragment-buttons.xml \ sampleconf/fields \ sampleconf/recoll.conf \ sampleconf/mimeconf \ diff --git a/src/doc/user/usermanual.html b/src/doc/user/usermanual.html index 7e34fd73..5c31a0aa 100644 --- a/src/doc/user/usermanual.html +++ b/src/doc/user/usermanual.html @@ -428,7 +428,7 @@ alink="#0000FF">

List of Tables

-
3.1. Keyboard shortcuts
+
3.1. Keyboard shortcuts
@@ -3538,75 +3538,109 @@ fs.inotify.max_user_watches=32768

Selecting the ToolsQuery 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.

+ which can be used to filter the current query with + user-defined query language fragments. This can be useful + if you have frequent reusable selectors, not covered by + the standard category selectors, for example, filtering + on alternate directories, or searching just one category + of files. In practise, the query fragments are joined to + the current query as an AND clause.

The contents of the window are entirely customizable, - and defined by the contents of the fragbuts.xml file inside the + and defined by the contents of a XML text file, named + fragment-buttons.xml and + which will be looked for in the current index configuration directory. The sample file distributed with - Recoll (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.

+ Recoll contains a number + of example filters. This will be automatically copied to + the configuration directory if the file does not exist in + there (e.g. ~/.recoll/fragment-buttons.xml under + Linux and Mac OS, $HOME/AppData/Local/Recoll for + Windows). Editing the copy will allow you to configure + the tool for your needs .

+
+

Note

+

The fragment-buttons.xml file was named + fragbuts.xml up to + Recoll version 1.31.0. + This was deemed too close to offensive for native + English speakers, so that the file was renamed. An + existing fragbuts.xml + will still be used if fragment-buttons.xml does not exist. + No automatic renaming will be performed.

+

Here follows an example:

 <?xml version="1.0" encoding="UTF-8"?>
-<fragbuts version="1.0">
+<fragbuttons version="1.0">
 
   <radiobuttons>
     <!-- Actually useful: toggle Web queue results inclusion -->
-    <fragbut>
+    <fragbutton>
       <label>Include Web Results</label>
       <frag></frag>
-    </fragbut>
+    </fragbutton>
 
-    <fragbut>
+    <fragbutton>
       <label>Exclude Web Results</label>
       <frag>-rclbes:BGL</frag>
-    </fragbut>
+    </fragbutton>
 
-    <fragbut>
+    <fragbutton>
       <label>Only Web Results</label>
       <frag>rclbes:BGL</frag>
-    </fragbut>
+    </fragbutton>
 
   </radiobuttons>
 
   <buttons>
 
-    <fragbut>
+    <fragbutton>
       <label>Example: Year 2010</label>
       <frag>date:2010-01-01/2010-12-31</frag>
-    </fragbut>
+    </fragbutton>
 
-    <fragbut>
+    <fragbutton>
       <label>Example: c++ files</label>
       <frag>ext:cpp OR ext:cxx</frag>
-    </fragbut>
+    </fragbutton>
 
-    <fragbut>
+    <fragbutton>
       <label>Example: My Great Directory</label>
       <frag>dir:/my/great/directory</frag>
-    </fragbut>
+    </fragbutton>
 
   </buttons>
 
-</fragbuts>
+</fragbuttons>
         

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 + Any number of buttons can be + selected, but the radiobuttons in a line are + exclusive.

+

Each fragbutton 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.

+

The only thing that you need to know about XML for + editing this file is that any opening tag like <label> needs to be + matched by a closing tag after the value: </label>.

+

You will normally edit the file with a regular text + editor, like, e.g. vi or notepad. + Double-clicking the file in a file manager may not work, + because this usually opens it in a WEB browser, which + will not let you modify the contents.

@@ -4083,7 +4117,7 @@ fs.inotify.max_user_watches=32768 Shortcut column, and type the desired sequence.

- +

Table 3.1. Keyboard shortcuts

@@ -4214,14 +4248,20 @@ fs.inotify.max_user_watches=32768 Ctrl+G - Open the current document and - exit Recoll - Ctrl+Shift+O + Copy the text contained in the + selected document to the clipboard, then exit + recoll + Ctrl+Alt+Shift+G Open the current document Ctrl+O + + Open the current document and + exit Recoll + Ctrl+Alst+Shift+O + Show a full preview for the current document diff --git a/src/doc/user/usermanual.xml b/src/doc/user/usermanual.xml index 856bcedd..a9d5cb38 100644 --- a/src/doc/user/usermanual.xml +++ b/src/doc/user/usermanual.xml @@ -2507,82 +2507,96 @@ fs.inotify.max_user_watches=32768 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. + Selecting the Tools Query + Fragments menu entry will open a window with radio- and + check-buttons which can be used to filter the current query with user-defined query language + fragments. This can be useful if you have frequent reusable selectors, not covered by the + standard category selectors, for example, filtering on alternate directories, or searching + just one category of files. In practise, the query fragments are joined to the current + query as an AND clause. - 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. + The contents of the window are entirely customizable, and defined by the contents of a + XML text file, named fragment-buttons.xml and which will be looked + for in the current index configuration directory. The sample file distributed with &RCL; + contains a number of example filters. This will be automatically copied to the + configuration directory if the file does not exist in there + (e.g. ~/.recoll/fragment-buttons.xml under Linux and Mac + OS, $HOME/AppData/Local/Recoll for Windows). Editing the copy will + allow you to configure the tool for your needs . + + The fragment-buttons.xml file was + named fragbuts.xml up to &RCL; version 1.31.0. This was deemed too + close to offensive for native English speakers, so that the file was renamed. An + existing fragbuts.xml will still be used + if fragment-buttons.xml does not exist. No automatic renaming will be + performed. + Here follows an example: - + - + - + - + -rclbes:BGL - + - + rclbes:BGL - + - + date:2010-01-01/2010-12-31 - + - + ext:cpp OR ext:cxx - + - + dir:/my/great/directory - + - + ]]> - 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 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. + Each fragbutton 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. + + The only thing that you need to know about XML for editing this file is that any + opening tag like <label> needs to be matched by a closing + tag after the value: </label>. + + You will normally edit the file with a regular text editor, like, + e.g. vi or notepad. Double-clicking the file in a + file manager may not work, because this usually opens it in a WEB browser, which will not + let you modify the contents. diff --git a/src/qtgui/fragbuts.cpp b/src/qtgui/fragbuts.cpp index 01f83670..f7990ee0 100644 --- a/src/qtgui/fragbuts.cpp +++ b/src/qtgui/fragbuts.cpp @@ -59,8 +59,8 @@ public: radio = true; bg = new QButtonGroup(parent); hl = new QHBoxLayout(); - } else if (nm == "label" || nm == "frag" || nm == "fragbuts" || - nm == "fragbut") { + } else if (nm == "label" || nm == "frag" || nm == "fragbuts" || nm == "fragbuttons" || + nm == "fragbut" || nm == "fragbutton") { } else { QMessageBox::warning( 0, "Recoll", QString("Bad element name: [%1]").arg(nm.c_str())); @@ -73,7 +73,7 @@ public: label = u8s2qs(currentText); } else if (nm == "frag") { frag = currentText; - } else if (nm == "fragbut") { + } else if (nm == "fragbut" || nm == "fragbutton") { string slab = qs2utf8s(label); trimstring(slab, " \t\n\t"); label = u8s2qs(slab.c_str()); @@ -94,7 +94,7 @@ public: } else if (nm == "buttons" || nm == "radiobuttons") { vl->addLayout(hl); hl = 0; - } else if (nm == "fragbuts") { + } else if (nm == "fragbuts" || nm == "fragbuttons") { vlw->addLayout(vl); } else { QMessageBox::warning( @@ -125,32 +125,32 @@ private: FragButs::FragButs(QWidget* parent) : QWidget(parent), m_reftime(0), m_ok(false) { - m_fn = path_cat(theconfig->getConfDir(), "fragbuts.xml"); - + m_fn = path_cat(theconfig->getConfDir(), "fragment-buttons.xml"); string data, reason; if (!path_exists(m_fn)) { - // config does not exist: try to create it from sample - string src = path_cat(theconfig->getDatadir(), "examples"); - src = path_cat(src, "fragbuts.xml"); - copyfile(src.c_str(), m_fn.c_str(), reason); + // Try the older name + m_fn = path_cat(theconfig->getConfDir(), "fragbuts.xml"); + if (!path_exists(m_fn)) { + // No configuration file yet: create it from the sample file + string src = path_cat(theconfig->getDatadir(), "examples"); + src = path_cat(src, "fragment-buttons.xml"); + m_fn = path_cat(theconfig->getConfDir(), "fragment-buttons.xml"); + copyfile(src.c_str(), m_fn.c_str(), reason); + } } if (!file_to_string(m_fn, data, &reason)) { - QMessageBox::warning( - 0, "Recoll", tr("%1 not found.").arg(path2qs(m_fn))); + QMessageBox::warning(0, "Recoll", tr("%1 not found.").arg(path2qs(m_fn))); LOGERR("Fragbuts:: can't read [" << m_fn << "]\n"); return; } FragButsParser parser(data, this, m_buttons); if (!parser.Parse()) { - QMessageBox::warning( - 0, "Recoll", tr("%1:\n %2").arg(path2qs(m_fn)) - .arg(u8s2qs(parser.getReason()))); + QMessageBox::warning(0, "Recoll", tr("%1:\n %2").arg(path2qs(m_fn)) + .arg(u8s2qs(parser.getReason()))); return; } - for (vector::iterator it = m_buttons.begin(); - it != m_buttons.end(); it++) { - connect(it->button, SIGNAL(clicked(bool)), - this, SLOT(onButtonClicked(bool))); + for (auto& entry : m_buttons) { + connect(entry.button, SIGNAL(clicked(bool)), this, SLOT(onButtonClicked(bool))); } setWindowTitle(tr("Query Fragments")); isStale(&m_reftime); @@ -179,11 +179,10 @@ void FragButs::onButtonClicked(bool on) void FragButs::getfrags(std::vector& frags) { - for (vector::iterator it = m_buttons.begin(); - it != m_buttons.end(); it++) { - if (it->button->isChecked() && !it->fragment.empty()) { - LOGDEB("FragButs: fragment [" << (it->fragment) << "]\n" ); - frags.push_back(it->fragment); + for (auto &entry : m_buttons) { + if (entry.button->isChecked() && !entry.fragment.empty()) { + LOGDEB("FragButs: fragment [" << entry.fragment << "]\n" ); + frags.push_back(entry.fragment); } } } diff --git a/src/sampleconf/fragbuts.xml b/src/sampleconf/fragment-buttons.xml similarity index 77% rename from src/sampleconf/fragbuts.xml rename to src/sampleconf/fragment-buttons.xml index f804bef9..bb9f3efe 100644 --- a/src/sampleconf/fragbuts.xml +++ b/src/sampleconf/fragment-buttons.xml @@ -5,53 +5,53 @@ before execution. --> - + - + - + - + -rclbes:BGL - + - + rclbes:BGL - + - + date:2010-01-01/2010-12-31 - + - + ext:cpp OR ext:cxx - + - + dir:/my/great/directory - + - + - + - + diff --git a/src/windows/mkinstdir.sh b/src/windows/mkinstdir.sh index 10f65085..c99e7d72 100644 --- a/src/windows/mkinstdir.sh +++ b/src/windows/mkinstdir.sh @@ -171,7 +171,7 @@ copyrecoll() mkdir -p $DESTDIR/Share/doc/webhelp rsync -av $RCL/doc/user/webhelp/docs/* $DESTDIR/Share/doc/webhelp || exit 1 chkcp $RCL/sampleconf/fields $DESTDIR/Share/examples - chkcp $RCL/sampleconf/fragbuts.xml $DESTDIR/Share/examples + chkcp $RCL/sampleconf/fragment-buttons.xml $DESTDIR/Share/examples chkcp $RCL/windows/mimeconf $DESTDIR/Share/examples chkcp $RCL/sampleconf/mimemap $DESTDIR/Share/examples chkcp $RCL/windows/mimeview $DESTDIR/Share/examples