mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-25 05:48:54 -04:00
Use empty string to signify no filter values consistently
Earlier we used, "*" to signify all languages and "all" for all categories. This change removes these inconsistencies. Now, if the filter value is empty, it should signify that no filter is set (show all values)
This commit is contained in:
parent
3c16f795d4
commit
cadac0a1e9
@ -630,8 +630,6 @@ void ContentManager::setCurrentLanguage(QStringList languageList)
|
||||
} catch (std::out_of_range&) {}
|
||||
}
|
||||
}
|
||||
if (languageList.empty())
|
||||
languageList.append("*");
|
||||
auto newLanguage = languageList.join(",");
|
||||
if (m_currentLanguage == newLanguage)
|
||||
return;
|
||||
@ -722,9 +720,9 @@ QStringList ContentManager::getBookIds()
|
||||
filter.acceptTags(acceptTags);
|
||||
filter.rejectTags(rejectTags);
|
||||
filter.query(m_searchQuery.toStdString());
|
||||
if (m_currentLanguage != "*")
|
||||
if (m_currentLanguage != "")
|
||||
filter.lang(m_currentLanguage.toStdString());
|
||||
if (m_categoryFilter != "all")
|
||||
if (m_categoryFilter != "")
|
||||
filter.category(m_categoryFilter.toStdString());
|
||||
|
||||
if (m_local) {
|
||||
|
@ -82,21 +82,14 @@ void ContentManagerSide::setContentManager(ContentManager *contentManager)
|
||||
const auto checkedButton = mp_ui->buttonGroup->button(isLocal == CatalogButtonId::LOCAL);
|
||||
checkedButton->setChecked(true);
|
||||
checkedButton->setStyleSheet("*{font-weight: bold}");
|
||||
connect(mp_languages, &KiwixChoiceBox::choiceUpdated,
|
||||
this, [=](QStringList values) {
|
||||
if (values[0] == "all") {
|
||||
values = QStringList();
|
||||
}
|
||||
mp_contentManager->setCurrentLanguage(values);
|
||||
connect(mp_languages, &KiwixChoiceBox::choiceUpdated, this, [=](QStringList values) {
|
||||
mp_contentManager->setCurrentLanguage(values);
|
||||
});
|
||||
connect(mp_categories, &KiwixChoiceBox::choiceUpdated, this, [=](QStringList values) {
|
||||
mp_contentManager->setCurrentCategoryFilter(values);
|
||||
});
|
||||
connect(mp_contentType, &KiwixChoiceBox::choiceUpdated, this, [=](QStringList values) {
|
||||
if (values[0] == "all") {
|
||||
values = QStringList();
|
||||
}
|
||||
mp_contentManager->setCurrentContentTypeFilter(values);
|
||||
mp_contentManager->setCurrentContentTypeFilter(values);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -272,8 +272,6 @@ void KiwixChoiceBox::setType(QString type)
|
||||
|
||||
QStringList KiwixChoiceBox::getCurrentSelected()
|
||||
{
|
||||
if (choiceSelector->selectedItems().isEmpty())
|
||||
return {"all"};
|
||||
QStringList selections;
|
||||
for (auto &item : choiceSelector->selectedItems()) {
|
||||
selections.append(item->data(Qt::UserRole).toString());
|
||||
|
@ -15,7 +15,7 @@ void OpdsRequestManager::doUpdate(const QString& currentLanguage, const QString&
|
||||
QStringList excludeTags("_sw:yes");
|
||||
|
||||
// Add filter by language (if necessary)
|
||||
if (currentLanguage != "*") {
|
||||
if (currentLanguage != "") {
|
||||
query.addQueryItem("lang", currentLanguage);
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ void OpdsRequestManager::doUpdate(const QString& currentLanguage, const QString&
|
||||
query.addQueryItem("count", QString::number(-1));
|
||||
|
||||
// Add filter by category (if necessary)
|
||||
if (categoryFilter != "all") {
|
||||
if (categoryFilter != "") {
|
||||
query.addQueryItem("category", categoryFilter);
|
||||
}
|
||||
|
||||
|
@ -128,6 +128,6 @@ void SettingsManager::initSettings()
|
||||
m_monitorDir = m_settings.value("monitor/dir", QString("")).toString();
|
||||
m_moveToTrash = m_settings.value("moveToTrash", true).toBool();
|
||||
m_langList = m_settings.value("language", QLocale::languageToString(QLocale().language())).toStringList();
|
||||
m_categoryList = m_settings.value("category", {"all"}).toStringList();
|
||||
m_categoryList = m_settings.value("category", {}).toStringList();
|
||||
m_contentTypeList = m_settings.value("contentType", {}).toStringList();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user