diff --git a/src/internfile/internfile.cpp b/src/internfile/internfile.cpp index 27fd2981..4bcce3f9 100644 --- a/src/internfile/internfile.cpp +++ b/src/internfile/internfile.cpp @@ -496,54 +496,43 @@ void FileInterner::checkExternalMissing(const string& msg, const string& mt) it++; if (*it == "HELPERNOTFOUND") { it++; - for (; it < verr.end(); it++) { - m_missingdatap->m_missingExternal.insert(*it); - m_missingdatap->m_typesForMissing[*it].insert(mt); + for (; it != verr.end(); it++) { + m_missingdatap->addMissing(*it, mt); } } } } } -void FileInterner::getMissingExternal(FIMissingStore *st, string& out) +void FIMissingStore::getMissingExternal(string& out) { - if (st) - stringsToString(st->m_missingExternal, out); + for (map >::const_iterator it = + m_typesForMissing.begin(); it != m_typesForMissing.end(); it++) { + out += string(" ") + it->first; + } + trimstring(out); } -void FileInterner::getMissingDescription(FIMissingStore *st, string& out) +void FIMissingStore::getMissingDescription(string& out) { - if (st == 0) - return; - out.erase(); - for (set::const_iterator it = - st->m_missingExternal.begin(); - it != st->m_missingExternal.end(); it++) { - out += *it; - map >::const_iterator it2; - it2 = st->m_typesForMissing.find(*it); - if (it2 != st->m_typesForMissing.end()) { - out += " ("; - set::const_iterator it3; - for (it3 = it2->second.begin(); - it3 != it2->second.end(); it3++) { - out += *it3; - out += string(" "); - } - trimstring(out); - out += ")"; - } + for (map >::const_iterator it = + m_typesForMissing.begin(); it != m_typesForMissing.end(); it++) { + out += it->first + " ("; + set::const_iterator it3; + for (it3 = it->second.begin(); + it3 != it->second.end(); it3++) { + out += *it3 + " "; + } + trimstring(out); + out += ")"; out += "\n"; } } -void FileInterner::getMissingFromDescription(FIMissingStore *st, const string& in) +FIMissingStore::FIMissingStore(const string& in) { - if (st == 0) - return; - // The "missing" file is text. Each line defines a missing filter // and the list of mime types actually encountered that needed it // (see method getMissingDescription()) @@ -575,10 +564,9 @@ void FileInterner::getMissingFromDescription(FIMissingStore *st, const string& i if (filter.empty()) continue; - st->m_missingExternal.insert(filter); for (vector::const_iterator itt = mtypes.begin(); itt != mtypes.end(); itt++) { - st->m_typesForMissing[filter].insert(*itt); + m_typesForMissing[filter].insert(*itt); } } } diff --git a/src/internfile/internfile.h b/src/internfile/internfile.h index 7abf9e95..d6a84ff6 100644 --- a/src/internfile/internfile.h +++ b/src/internfile/internfile.h @@ -34,7 +34,7 @@ using std::set; class RclConfig; namespace Rcl { -class Doc; + class Doc; } struct stat; @@ -47,8 +47,19 @@ struct stat; */ class FIMissingStore { public: + FIMissingStore() {} + FIMissingStore(const string& in); + virtual ~FIMissingStore() {} + virtual void addMissing(const string& prog, const string& mt) + { + m_typesForMissing[prog].insert(mt); + } + // Get simple progs list string + virtual void getMissingExternal(string& out); + // Get progs + assoc mtypes description string + virtual void getMissingDescription(string& out); + // Missing external programs - set m_missingExternal; map > m_typesForMissing; }; diff --git a/src/qtgui/preview_w.cpp b/src/qtgui/preview_w.cpp index 309d3eab..1e10a1d2 100644 --- a/src/qtgui/preview_w.cpp +++ b/src/qtgui/preview_w.cpp @@ -766,7 +766,7 @@ class LoadThread : public QThread { imgtmp = interner.get_imgtmp(); } else { out.mimetype = interner.getMimetype(); - interner.getMissingExternal(&mst, missing); + mst.getMissingExternal(missing); *statusp = -1; } } catch (CancelExcept) { diff --git a/src/qtgui/rclmain_w.cpp b/src/qtgui/rclmain_w.cpp index d90b5544..851428fe 100644 --- a/src/qtgui/rclmain_w.cpp +++ b/src/qtgui/rclmain_w.cpp @@ -1127,11 +1127,11 @@ void RclMain::showActiveTypes() mtypesfromdbconf.insert(*it); } - // Substract the types for missing helpers (the docs are indexed by name only): + // Substract the types for missing helpers (the docs are indexed + // by name only): string miss = theconfig->getMissingHelperDesc(); if (!miss.empty()) { - FIMissingStore st; - FileInterner::getMissingFromDescription(&st, miss); + FIMissingStore st(miss); map >::const_iterator it; for (it = st.m_typesForMissing.begin(); it != st.m_typesForMissing.end(); it++) {