|
a/src/common/rclconfig.h |
|
b/src/common/rclconfig.h |
|
... |
|
... |
78 |
ConfNull *cloneMainConfig();
|
78 |
ConfNull *cloneMainConfig();
|
79 |
|
79 |
|
80 |
/** (re)Read recoll.conf */
|
80 |
/** (re)Read recoll.conf */
|
81 |
bool updateMainConfig();
|
81 |
bool updateMainConfig();
|
82 |
|
82 |
|
83 |
bool ok() {return m_ok;}
|
83 |
bool ok() const {return m_ok;}
|
84 |
const string &getReason() {return m_reason;}
|
84 |
const string &getReason() const {return m_reason;}
|
85 |
|
85 |
|
86 |
/** Return the directory where this configuration is stored.
|
86 |
/** Return the directory where this configuration is stored.
|
87 |
* This was possibly silently created by the rclconfig
|
87 |
* This was possibly silently created by the rclconfig
|
88 |
* constructor it it is the default one (~/.recoll) and it did
|
88 |
* constructor it it is the default one (~/.recoll) and it did
|
89 |
* not exist yet. */
|
89 |
* not exist yet. */
|
90 |
string getConfDir() {return m_confdir;}
|
90 |
string getConfDir() const {return m_confdir;}
|
91 |
|
91 |
|
92 |
/** Check if the config files were modified since we read them */
|
92 |
/** Check if the config files were modified since we read them */
|
93 |
bool sourceChanged();
|
93 |
bool sourceChanged() const;
|
94 |
|
94 |
|
95 |
/** Returns true if this is ~/.recoll */
|
95 |
/** Returns true if this is ~/.recoll */
|
96 |
bool isDefaultConfig();
|
96 |
bool isDefaultConfig() const;
|
97 |
/** Get the local value for /usr/local/share/recoll/ */
|
97 |
/** Get the local value for /usr/local/share/recoll/ */
|
98 |
const string& getDatadir() {return m_datadir;}
|
98 |
const string& getDatadir() const {return m_datadir;}
|
99 |
|
99 |
|
100 |
/** Set current directory reference, and fetch automatic parameters. */
|
100 |
/** Set current directory reference, and fetch automatic parameters. */
|
101 |
void setKeyDir(const string &dir);
|
101 |
void setKeyDir(const string &dir);
|
102 |
string getKeyDir() const {return m_keydir;}
|
102 |
string getKeyDir() const {return m_keydir;}
|
103 |
|
103 |
|
104 |
/** Get generic configuration parameter according to current keydir */
|
104 |
/** Get generic configuration parameter according to current keydir */
|
105 |
bool getConfParam(const string &name, string &value)
|
105 |
bool getConfParam(const string &name, string &value) const
|
106 |
{
|
106 |
{
|
107 |
if (m_conf == 0)
|
107 |
if (m_conf == 0)
|
108 |
return false;
|
108 |
return false;
|
109 |
return m_conf->get(name, value, m_keydir);
|
109 |
return m_conf->get(name, value, m_keydir);
|
110 |
}
|
110 |
}
|
111 |
/** Variant with autoconversion to int */
|
111 |
/** Variant with autoconversion to int */
|
112 |
bool getConfParam(const string &name, int *value);
|
112 |
bool getConfParam(const string &name, int *value) const;
|
113 |
/** Variant with autoconversion to bool */
|
113 |
/** Variant with autoconversion to bool */
|
114 |
bool getConfParam(const string &name, bool *value);
|
114 |
bool getConfParam(const string &name, bool *value) const;
|
115 |
/** Variant with conversion to string list/vector
|
115 |
/** Variant with conversion to string list/vector
|
116 |
* (stringToStrings). Can fail if the string is malformed. */
|
116 |
* (stringToStrings). Can fail if the string is malformed. */
|
117 |
bool getConfParam(const string &name, vector<string> *value);
|
117 |
bool getConfParam(const string &name, vector<string> *value) const;
|
118 |
bool getConfParam(const string &name, list<string> *value);
|
118 |
bool getConfParam(const string &name, list<string> *value) const;
|
119 |
|
119 |
|
120 |
/**
|
120 |
/**
|
121 |
* Get list of config names under current sk, with possible
|
121 |
* Get list of config names under current sk, with possible
|
122 |
* wildcard filtering
|
122 |
* wildcard filtering
|
123 |
*/
|
123 |
*/
|
124 |
vector<string> getConfNames(const char *pattern = 0) {
|
124 |
vector<string> getConfNames(const char *pattern = 0) const
|
|
|
125 |
{
|
125 |
return m_conf->getNames(m_keydir, pattern);
|
126 |
return m_conf->getNames(m_keydir, pattern);
|
126 |
}
|
127 |
}
|
127 |
|
128 |
|
128 |
/** Check if name exists anywhere in config */
|
129 |
/** Check if name exists anywhere in config */
|
129 |
bool hasNameAnywhere(const string& nm)
|
130 |
bool hasNameAnywhere(const string& nm) const
|
130 |
{
|
131 |
{
|
131 |
return m_conf? m_conf->hasNameAnywhere(nm) : false;
|
132 |
return m_conf? m_conf->hasNameAnywhere(nm) : false;
|
132 |
}
|
133 |
}
|
133 |
|
134 |
|
134 |
|
135 |
|
135 |
/** Get default charset for current keydir (was set during setKeydir)
|
136 |
/** Get default charset for current keydir (was set during setKeydir)
|
136 |
* filenames are handled differently */
|
137 |
* filenames are handled differently */
|
137 |
const string &getDefCharset(bool filename = false);
|
138 |
const string &getDefCharset(bool filename = false) const;
|
138 |
|
139 |
|
139 |
/** Get list of top directories. This is needed from a number of places
|
140 |
/** Get list of top directories. This is needed from a number of places
|
140 |
* and needs some cleaning-up code. An empty list is always an error, no
|
141 |
* and needs some cleaning-up code. An empty list is always an error, no
|
141 |
* need for other status */
|
142 |
* need for other status */
|
142 |
list<string> getTopdirs();
|
143 |
list<string> getTopdirs() const;
|
143 |
|
144 |
|
144 |
/** Get database directory */
|
145 |
/** Get database directory */
|
145 |
string getDbDir();
|
146 |
string getDbDir() const;
|
146 |
/** Get stoplist file name */
|
147 |
/** Get stoplist file name */
|
147 |
string getStopfile();
|
148 |
string getStopfile() const;
|
148 |
/** Get indexing pid file name */
|
149 |
/** Get indexing pid file name */
|
149 |
string getPidfile();
|
150 |
string getPidfile() const;
|
150 |
/** Get indexing status file name */
|
151 |
/** Get indexing status file name */
|
151 |
string getIdxStatusFile();
|
152 |
string getIdxStatusFile() const;
|
152 |
|
153 |
|
153 |
/** Get list of skipped file names for current keydir */
|
154 |
/** Get list of skipped file names for current keydir */
|
154 |
vector<string>& getSkippedNames();
|
155 |
vector<string>& getSkippedNames();
|
155 |
|
156 |
|
156 |
/** Get list of skipped paths patterns. Doesn't depend on the keydir */
|
157 |
/** Get list of skipped paths patterns. Doesn't depend on the keydir */
|
157 |
vector<string> getSkippedPaths();
|
158 |
vector<string> getSkippedPaths() const;
|
158 |
/** Get list of skipped paths patterns, daemon version (may add some)
|
159 |
/** Get list of skipped paths patterns, daemon version (may add some)
|
159 |
Doesn't depend on the keydir */
|
160 |
Doesn't depend on the keydir */
|
160 |
vector<string> getDaemSkippedPaths();
|
161 |
vector<string> getDaemSkippedPaths() const;
|
161 |
|
162 |
|
162 |
/** conf: Add local fields to target dic */
|
163 |
/** conf: Add local fields to target dic */
|
163 |
bool addLocalFields(map<string, string> *tgt);
|
164 |
bool addLocalFields(map<string, string> *tgt) const;
|
164 |
|
165 |
|
165 |
/**
|
166 |
/**
|
166 |
* mimemap: Check if file name should be ignored because of suffix
|
167 |
* mimemap: Check if file name should be ignored because of suffix
|
167 |
*
|
168 |
*
|
168 |
* The list of ignored suffixes is initialized on first call, and
|
169 |
* The list of ignored suffixes is initialized on first call, and
|
|
... |
|
... |
175 |
* return command to uncompress if it is.
|
176 |
* return command to uncompress if it is.
|
176 |
*
|
177 |
*
|
177 |
* The returned command has substitutable places for input file name
|
178 |
* The returned command has substitutable places for input file name
|
178 |
* and temp dir name, and will return output name
|
179 |
* and temp dir name, and will return output name
|
179 |
*/
|
180 |
*/
|
180 |
bool getUncompressor(const string &mtpe, vector<string>& cmd);
|
181 |
bool getUncompressor(const string &mtpe, vector<string>& cmd) const;
|
181 |
|
182 |
|
182 |
/** mimemap: compute mimetype */
|
183 |
/** mimemap: compute mimetype */
|
183 |
string getMimeTypeFromSuffix(const string &suffix);
|
184 |
string getMimeTypeFromSuffix(const string &suffix) const;
|
184 |
/** mimemap: get a list of all indexable mime types defined */
|
185 |
/** mimemap: get a list of all indexable mime types defined */
|
185 |
vector<string> getAllMimeTypes();
|
186 |
vector<string> getAllMimeTypes() const;
|
186 |
/** mimemap: Get appropriate suffix for mime type. This is inefficient */
|
187 |
/** mimemap: Get appropriate suffix for mime type. This is inefficient */
|
187 |
string getSuffixFromMimeType(const string &mt);
|
188 |
string getSuffixFromMimeType(const string &mt) const;
|
188 |
|
189 |
|
189 |
/** mimeconf: get input filter for mimetype */
|
190 |
/** mimeconf: get input filter for mimetype */
|
190 |
string getMimeHandlerDef(const string &mimetype, bool filtertypes=false);
|
191 |
string getMimeHandlerDef(const string &mimetype, bool filtertypes=false);
|
191 |
|
192 |
|
192 |
/** For lines like: "name = some value; attr1 = value1; attr2 = val2"
|
193 |
/** For lines like: "name = some value; attr1 = value1; attr2 = val2"
|
193 |
* Separate the value and store the attributes in a ConfSimple
|
194 |
* Separate the value and store the attributes in a ConfSimple
|
194 |
* @param whole the raw value. No way to escape a semi-colon in there.
|
195 |
* @param whole the raw value. No way to escape a semi-colon in there.
|
195 |
*/
|
196 |
*/
|
196 |
bool valueSplitAttributes(const string& whole, string& value,
|
197 |
static bool valueSplitAttributes(const string& whole, string& value,
|
197 |
ConfSimple& attrs);
|
198 |
ConfSimple& attrs) ;
|
198 |
|
199 |
|
199 |
/** Return icon path for mime type and tag */
|
200 |
/** Return icon path for mime type and tag */
|
200 |
string getMimeIconPath(const string &mt, const string& apptag);
|
201 |
string getMimeIconPath(const string &mt, const string& apptag) const;
|
201 |
|
202 |
|
202 |
/** mimeconf: get list of file categories */
|
203 |
/** mimeconf: get list of file categories */
|
203 |
bool getMimeCategories(vector<string>&);
|
204 |
bool getMimeCategories(vector<string>&) const;
|
204 |
/** mimeconf: is parameter one of the categories ? */
|
205 |
/** mimeconf: is parameter one of the categories ? */
|
205 |
bool isMimeCategory(string&);
|
206 |
bool isMimeCategory(string&) const;
|
206 |
/** mimeconf: get list of mime types for category */
|
207 |
/** mimeconf: get list of mime types for category */
|
207 |
bool getMimeCatTypes(const string& cat, vector<string>&);
|
208 |
bool getMimeCatTypes(const string& cat, vector<string>&) const;
|
208 |
|
209 |
|
209 |
/** mimeconf: get list of gui filters (doc cats by default */
|
210 |
/** mimeconf: get list of gui filters (doc cats by default */
|
210 |
bool getGuiFilterNames(vector<string>&);
|
211 |
bool getGuiFilterNames(vector<string>&) const;
|
211 |
/** mimeconf: get query lang frag for named filter */
|
212 |
/** mimeconf: get query lang frag for named filter */
|
212 |
bool getGuiFilter(const string& filtername, string& frag);
|
213 |
bool getGuiFilter(const string& filtername, string& frag) const;
|
213 |
|
214 |
|
214 |
/** fields: get field prefix from field name */
|
215 |
/** fields: get field prefix from field name */
|
215 |
bool getFieldTraits(const string& fldname, const FieldTraits **);
|
216 |
bool getFieldTraits(const string& fldname, const FieldTraits **) const;
|
216 |
const set<string>& getStoredFields() {return m_storedFields;}
|
217 |
const set<string>& getStoredFields() const {return m_storedFields;}
|
217 |
set<string> getIndexedFields();
|
218 |
set<string> getIndexedFields() const;
|
218 |
/** Get canonic name for possible alias */
|
219 |
/** Get canonic name for possible alias */
|
219 |
string fieldCanon(const string& fld);
|
220 |
string fieldCanon(const string& fld) const;
|
220 |
/** Get xattr name to field names translations */
|
221 |
/** Get xattr name to field names translations */
|
221 |
const map<string, string>& getXattrToField() {return m_xattrtofld;}
|
222 |
const map<string, string>& getXattrToField() const {return m_xattrtofld;}
|
222 |
/** Get value of a parameter inside the "fields" file. Only some filters
|
223 |
/** Get value of a parameter inside the "fields" file. Only some filters
|
223 |
use this (ie: mh_mail). The information specific to a given filter
|
224 |
use this (ie: mh_mail). The information specific to a given filter
|
224 |
is typically stored in a separate section(ie: [mail]) */
|
225 |
is typically stored in a separate section(ie: [mail]) */
|
225 |
vector<string> getFieldSectNames(const string &sk, const char* = 0);
|
226 |
vector<string> getFieldSectNames(const string &sk, const char* = 0) const;
|
226 |
bool getFieldConfParam(const string &name, const string &sk, string &value);
|
227 |
bool getFieldConfParam(const string &name, const string &sk, string &value)
|
|
|
228 |
const;
|
227 |
|
229 |
|
228 |
/** mimeview: get/set external viewer exec string(s) for mimetype(s) */
|
230 |
/** mimeview: get/set external viewer exec string(s) for mimetype(s) */
|
229 |
string getMimeViewerDef(const string &mimetype, const string& apptag,
|
231 |
string getMimeViewerDef(const string &mimetype, const string& apptag,
|
230 |
bool useall);
|
232 |
bool useall) const;
|
231 |
string getMimeViewerAllEx();
|
233 |
string getMimeViewerAllEx() const;
|
232 |
bool setMimeViewerAllEx(const string& allex);
|
234 |
bool setMimeViewerAllEx(const string& allex);
|
233 |
bool getMimeViewerDefs(vector<pair<string, string> >&);
|
235 |
bool getMimeViewerDefs(vector<pair<string, string> >&) const;
|
234 |
bool setMimeViewerDef(const string& mimetype, const string& cmd);
|
236 |
bool setMimeViewerDef(const string& mimetype, const string& cmd);
|
235 |
/** Check if mime type is designated as needing no uncompress before view
|
237 |
/** Check if mime type is designated as needing no uncompress before view
|
236 |
* (if a file of this type is found compressed). Default is true,
|
238 |
* (if a file of this type is found compressed). Default is true,
|
237 |
* exceptions are found in the nouncompforviewmts mimeview list */
|
239 |
* exceptions are found in the nouncompforviewmts mimeview list */
|
238 |
bool mimeViewerNeedsUncomp(const string &mimetype);
|
240 |
bool mimeViewerNeedsUncomp(const string &mimetype) const;
|
239 |
|
241 |
|
240 |
/** Store/retrieve missing helpers description string */
|
242 |
/** Store/retrieve missing helpers description string */
|
241 |
string getMissingHelperDesc();
|
243 |
string getMissingHelperDesc() const;
|
242 |
void storeMissingHelperDesc(const string &s);
|
244 |
void storeMissingHelperDesc(const string &s);
|
243 |
|
245 |
|
244 |
/** Find exec file for external filter. cmd is the command name from the
|
246 |
/** Find exec file for external filter. cmd is the command name from the
|
245 |
* command string returned by getMimeHandlerDef */
|
247 |
* command string returned by getMimeHandlerDef */
|
246 |
string findFilter(const string& cmd);
|
248 |
string findFilter(const string& cmd) const;
|
247 |
|
249 |
|
248 |
~RclConfig() {
|
250 |
~RclConfig() {
|
249 |
freeAll();
|
251 |
freeAll();
|
250 |
}
|
252 |
}
|
251 |
|
253 |
|
|
... |
|
... |
288 |
|
290 |
|
289 |
ParamStale m_skpnstate;
|
291 |
ParamStale m_skpnstate;
|
290 |
vector<string> m_skpnlist;
|
292 |
vector<string> m_skpnlist;
|
291 |
|
293 |
|
292 |
// Parameters auto-fetched on setkeydir
|
294 |
// Parameters auto-fetched on setkeydir
|
293 |
string defcharset;
|
295 |
string m_defcharset;
|
|
|
296 |
static string o_localecharset;
|
294 |
// Limiting set of mime types to be processed. Normally empty.
|
297 |
// Limiting set of mime types to be processed. Normally empty.
|
295 |
ParamStale m_rmtstate;
|
298 |
ParamStale m_rmtstate;
|
296 |
set<string> m_restrictMTypes;
|
299 |
set<string> m_restrictMTypes;
|
297 |
|
300 |
|
298 |
/** Create initial user configuration */
|
301 |
/** Create initial user configuration */
|