Switch to unified view

a/src/common/rclconfig.cpp b/src/common/rclconfig.cpp
...
...
65
65
66
bool ParamStale::needrecompute()
66
bool ParamStale::needrecompute()
67
{
67
{
68
    LOGDEB2(("ParamStale:: needrecompute. parent gen %d mine %d\n", 
68
    LOGDEB2(("ParamStale:: needrecompute. parent gen %d mine %d\n", 
69
         parent->m_keydirgen, savedkeydirgen));
69
         parent->m_keydirgen, savedkeydirgen));
70
    if (parent->m_keydirgen != savedkeydirgen) {
70
    if (active && parent->m_keydirgen != savedkeydirgen) {
71
    LOGDEB2(("ParamState:: needrecompute. conffile %p\n", conffile));
71
    LOGDEB2(("ParamState:: needrecompute. conffile %p\n", conffile));
72
72
73
        savedkeydirgen = parent->m_keydirgen;
73
        savedkeydirgen = parent->m_keydirgen;
74
        string newvalue;
74
        string newvalue;
75
        if (!conffile)
75
        if (!conffile)
...
...
88
void ParamStale::init(RclConfig *rconf, ConfNull *cnf, const string& nm)
88
void ParamStale::init(RclConfig *rconf, ConfNull *cnf, const string& nm)
89
{
89
{
90
    parent = rconf;
90
    parent = rconf;
91
    conffile = cnf;
91
    conffile = cnf;
92
    paramname = nm;
92
    paramname = nm;
93
    active = false;
94
    if (conffile)
95
      active = conffile->hasNameAnywhere(nm);
93
    savedkeydirgen = -1;
96
    savedkeydirgen = -1;
94
}
97
}
95
98
96
void RclConfig::zeroMe() {
99
void RclConfig::zeroMe() {
97
    m_ok = false; 
100
    m_ok = false; 
...
...
105
    m_stopsuffixes = 0;
108
    m_stopsuffixes = 0;
106
    m_maxsufflen = 0;
109
    m_maxsufflen = 0;
107
    m_stpsuffstate.init(this, 0, "recoll_noindex");
110
    m_stpsuffstate.init(this, 0, "recoll_noindex");
108
    m_skpnstate.init(this, 0, "skippedNames");
111
    m_skpnstate.init(this, 0, "skippedNames");
109
    m_rmtstate.init(this, 0, "indexedmimetypes");
112
    m_rmtstate.init(this, 0, "indexedmimetypes");
113
    m_mdrstate.init(this, 0, "metadatacmds");
110
}
114
}
111
115
112
bool RclConfig::isDefaultConfig() const
116
bool RclConfig::isDefaultConfig() const
113
{
117
{
114
    string defaultconf = path_cat(path_canon(path_home()), ".recoll/");
118
    string defaultconf = path_cat(path_canon(path_home()), ".recoll/");
...
...
244
    setKeyDir(cstr_null);
248
    setKeyDir(cstr_null);
245
249
246
    m_stpsuffstate.init(this, mimemap, "recoll_noindex");
250
    m_stpsuffstate.init(this, mimemap, "recoll_noindex");
247
    m_skpnstate.init(this, m_conf, "skippedNames");
251
    m_skpnstate.init(this, m_conf, "skippedNames");
248
    m_rmtstate.init(this, m_conf, "indexedmimetypes");
252
    m_rmtstate.init(this, m_conf, "indexedmimetypes");
253
    m_mdrstate.init(this, m_conf, "metadatacmds");
249
    return;
254
    return;
250
}
255
}
251
256
252
bool RclConfig::updateMainConfig()
257
bool RclConfig::updateMainConfig()
253
{
258
{
...
...
260
    stringsToString(m_cdirs, where);
265
    stringsToString(m_cdirs, where);
261
    m_reason = string("No/bad main configuration file in: ") + where;
266
    m_reason = string("No/bad main configuration file in: ") + where;
262
    m_ok = false;
267
    m_ok = false;
263
        m_skpnstate.init(this, 0, "skippedNames");
268
        m_skpnstate.init(this, 0, "skippedNames");
264
        m_rmtstate.init(this, 0, "indexedmimetypes");
269
        m_rmtstate.init(this, 0, "indexedmimetypes");
270
        m_mdrstate.init(this, 0, "metadatacmds");
265
    return false;
271
    return false;
266
    }
272
    }
267
    delete m_conf;
273
    delete m_conf;
268
    m_conf = newconf;
274
    m_conf = newconf;
269
    m_skpnstate.init(this, m_conf, "skippedNames");
275
    m_skpnstate.init(this, m_conf, "skippedNames");
270
    m_rmtstate.init(this, m_conf, "indexedmimetypes");
276
    m_rmtstate.init(this, m_conf, "indexedmimetypes");
271
277
    m_mdrstate.init(this, m_conf, "metadatacmds");
272
278
273
    setKeyDir(cstr_null);
279
    setKeyDir(cstr_null);
274
    bool nocjk = false;
280
    bool nocjk = false;
275
    if (getConfParam("nocjk", &nocjk) && nocjk == true) {
281
    if (getConfParam("nocjk", &nocjk) && nocjk == true) {
276
    TextSplit::cjkProcessing(false);
282
    TextSplit::cjkProcessing(false);
...
...
662
    }
668
    }
663
    if (!mimeconf->get(mtype, hs, "index")) {
669
    if (!mimeconf->get(mtype, hs, "index")) {
664
    LOGDEB1(("getMimeHandler: no handler for '%s'\n", mtype.c_str()));
670
    LOGDEB1(("getMimeHandler: no handler for '%s'\n", mtype.c_str()));
665
    }
671
    }
666
    return hs;
672
    return hs;
673
}
674
675
const vector<MDReaper>& RclConfig::getMDReapers()
676
{
677
    string hs;
678
    if (m_mdrstate.needrecompute()) {
679
        m_mdreapers.clear();
680
  // New value now stored in m_mdrstate.savedvalue
681
  string& sreapers = m_mdrstate.savedvalue;
682
  if (sreapers.empty())
683
    return m_mdreapers;
684
  string value;
685
  ConfSimple attrs;
686
  valueSplitAttributes(sreapers, value, attrs);
687
  vector<string> nmlst = attrs.getNames(cstr_null);
688
  for (vector<string>::const_iterator it = nmlst.begin();
689
       it != nmlst.end(); it++) {
690
    MDReaper reaper;
691
    reaper.fieldname = fieldCanon(*it);
692
    string s;
693
    attrs.get(*it, s);
694
    stringToStrings(s, reaper.cmdv);
695
    m_mdreapers.push_back(reaper);
696
  }
697
    }
698
    return m_mdreapers;
667
}
699
}
668
700
669
bool RclConfig::getGuiFilterNames(vector<string>& cats) const
701
bool RclConfig::getGuiFilterNames(vector<string>& cats) const
670
{
702
{
671
    if (!mimeconf)
703
    if (!mimeconf)
...
...
1344
    m_defcharset = r.m_defcharset;
1376
    m_defcharset = r.m_defcharset;
1345
1377
1346
    m_stpsuffstate.init(this, mimemap, r.m_stpsuffstate.paramname);
1378
    m_stpsuffstate.init(this, mimemap, r.m_stpsuffstate.paramname);
1347
    m_skpnstate.init(this, m_conf, r.m_skpnstate.paramname);
1379
    m_skpnstate.init(this, m_conf, r.m_skpnstate.paramname);
1348
    m_rmtstate.init(this, m_conf, r.m_rmtstate.paramname);
1380
    m_rmtstate.init(this, m_conf, r.m_rmtstate.paramname);
1381
    m_mdrstate.init(this, m_conf, r.m_mdrstate.paramname);
1349
    m_thrConf = r.m_thrConf;
1382
    m_thrConf = r.m_thrConf;
1350
}
1383
}
1351
1384
1352
#else // -> Test
1385
#else // -> Test
1353
1386