Commit a7d5a1f4 authored by kh1's avatar kh1
Browse files

Hide the Unfiltered filter in the settings dialog.

Reviewed-by: ck
parent d9e445bb
......@@ -106,9 +106,20 @@ void FilterSettingsPage::updateFilterPage()
m_ui.attributeWidget->clear();
m_filterMapBackup.clear();
QString lastTrUnfiltered;
const QString trUnfiltered = tr("Unfiltered");
const QHelpEngineCore &engine = LocalHelpManager::helpEngine();
if (engine.customValue(Help::Constants::WeAddedFilterKey).toInt() == 1) {
lastTrUnfiltered =
engine.customValue(Help::Constants::PreviousFilterNameKey).toString();
}
const QStringList &filters = engine.customFilters();
foreach (const QString &filter, filters) {
if (filter == trUnfiltered || filter == lastTrUnfiltered)
continue;
const QStringList &attributes = engine.filterAttributes(filter);
m_filterMapBackup.insert(filter, attributes);
if (!m_filterMap.contains(filter))
......
......@@ -44,6 +44,8 @@ enum {
static const QLatin1String ListSeparator("|");
static const QLatin1String DefaultZoomFactor("0.0");
static const QLatin1String AboutBlank("about:blank");
static const QLatin1String WeAddedFilterKey("UnfilteredFilterInserted");
static const QLatin1String PreviousFilterNameKey("UnfilteredFilterName");
const int P_MODE_HELP = 70;
const char * const ID_MODE_HELP = "Help";
......
......@@ -456,11 +456,10 @@ void HelpPlugin::resetFilter()
engine->removeCustomFilter(filter);
}
const QLatin1String weAddedFilterKey("UnfilteredFilterInserted");
const QLatin1String previousFilterNameKey("UnfilteredFilterName");
if (engine->customValue(weAddedFilterKey).toInt() == 1) {
// we added a filter at some point, remove previously added filter
const QString &filter = engine->customValue(previousFilterNameKey).toString();
// we added a filter at some point, remove previously added filter
if (engine->customValue(Help::Constants::WeAddedFilterKey).toInt() == 1) {
const QString &filter =
engine->customValue(Help::Constants::PreviousFilterNameKey).toString();
if (!filter.isEmpty())
engine->removeCustomFilter(filter);
}
......@@ -469,8 +468,8 @@ void HelpPlugin::resetFilter()
const QString filterName = tr("Unfiltered");
engine->removeCustomFilter(filterName);
engine->addCustomFilter(filterName, QStringList());
engine->setCustomValue(weAddedFilterKey, 1);
engine->setCustomValue(previousFilterNameKey, filterName);
engine->setCustomValue(Help::Constants::WeAddedFilterKey, 1);
engine->setCustomValue(Help::Constants::PreviousFilterNameKey, filterName);
engine->setCurrentFilter(filterName);
updateFilterComboBox();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment