Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 7f3594a4 authored by Laurent Montel's avatar Laurent Montel 😁

Make sure to export all rules (even if it's default on this machine)

parent 82013841
......@@ -89,9 +89,9 @@ void KDEApplicationDebugSettingPage::fillList(const LoggingCategory::List &list)
mTreeListWidget->fillList(list);
}
LoggingCategory::List KDEApplicationDebugSettingPage::rules() const
LoggingCategory::List KDEApplicationDebugSettingPage::rules(bool forceSavingAllRules) const
{
return mTreeListWidget->rules();
return mTreeListWidget->rules(forceSavingAllRules);
}
void KDEApplicationDebugSettingPage::insertCategories(const LoggingCategory::List &list)
......
......@@ -33,7 +33,7 @@ public:
explicit KDEApplicationDebugSettingPage(QWidget *parent = nullptr);
~KDEApplicationDebugSettingPage() override;
void fillList(const LoggingCategory::List &list);
LoggingCategory::List rules() const;
LoggingCategory::List rules(bool forceSavingAllRules) const;
void insertCategories(const LoggingCategory::List &list);
void restoreToDefault();
......
......@@ -59,10 +59,10 @@ void KDEApplicationTreeListWidgetItem::setLogName(const QString &category)
mCategory = category;
}
LoggingCategory KDEApplicationTreeListWidgetItem::rule() const
LoggingCategory KDEApplicationTreeListWidgetItem::rule(bool forceSavingAllRules) const
{
LoggingCategory cat;
if (mCategoryTypeCombobox->loggingCategoryIsNotDefault()) {
if (mCategoryTypeCombobox->loggingCategoryIsNotDefault() || forceSavingAllRules) {
cat.enabled = false;
cat.logName = mCategory;
cat.loggingType = mCategoryTypeCombobox->type();
......@@ -122,12 +122,12 @@ void KDEApplicationTreeListWidget::insertCategories(const LoggingCategory::List
addListItems(list, false);
}
LoggingCategory::List KDEApplicationTreeListWidget::rules() const
LoggingCategory::List KDEApplicationTreeListWidget::rules(bool forceSavingAllRules) const
{
LoggingCategory::List lst;
for (int i = 0; i < topLevelItemCount(); ++i) {
KDEApplicationTreeListWidgetItem *listWidgetItem = static_cast<KDEApplicationTreeListWidgetItem *>(topLevelItem(i));
const LoggingCategory cat = listWidgetItem->rule();
const LoggingCategory cat = listWidgetItem->rule(forceSavingAllRules);
if (cat.isValid()) {
lst.append(cat);
}
......
......@@ -40,7 +40,7 @@ public:
void setType(LoggingCategory::LoggingType type);
void setDefaultCategory(LoggingCategory::LoggingType type);
LoggingCategory rule() const;
LoggingCategory rule(bool forceSavingAllRules) const;
void restoreToDefault();
private:
QString mCategory;
......@@ -59,7 +59,7 @@ public:
void fillList(const LoggingCategory::List &list);
void insertCategories(const LoggingCategory::List &list);
LoggingCategory::List rules() const;
LoggingCategory::List rules(bool forceSavingAllRules) const;
void restoreToDefault();
......
......@@ -204,12 +204,12 @@ void KDebugSettingsDialog::readCategoriesFiles(const QString &path)
}
}
bool KDebugSettingsDialog::saveRules(const QString &path)
bool KDebugSettingsDialog::saveRules(const QString &path, bool forceSavingAllRules)
{
SaveRulesJob job;
job.setFileName(path);
job.setListCustom(mCustomSettingsPage->rules());
job.setListKde(mKdeApplicationSettingsPage->rules());
job.setListKde(mKdeApplicationSettingsPage->rules(forceSavingAllRules));
if (!job.start()) {
KMessageBox::error(this, i18n("\'%1\' cannot be opened. Please verify it.", path));
return false;
......@@ -264,7 +264,7 @@ void KDebugSettingsDialog::slotSaveAs()
{
const QString path = QFileDialog::getSaveFileName(this, i18n("Save As"));
if (!path.isEmpty()) {
saveRules(path);
saveRules(path, true);
}
}
......
......@@ -48,7 +48,7 @@ private:
void slotRestoreDefault();
void readQtLoggingFile();
bool saveRules(const QString &path);
bool saveRules(const QString &path, bool forceSavingAllRules = false);
bool saveInQtLogging();
void readCategoriesFiles(const QString &path);
void saveConfig();
......
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