summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Montel <[email protected]>2018-02-21 22:23:48 +0100
committerLaurent Montel <[email protected]>2018-02-21 22:23:48 +0100
commit7f3594a45cd83a1914d5eba42626f687e4dd9e70 (patch)
treeca5ef95616507670dabcfed0c14e9b11192da386
parent820138417c10896687a782030b148e5d505ba13f (diff)
Make sure to export all rules (even if it's default on this machine)
-rw-r--r--src/kdeapplicationdebugsettingpage.cpp4
-rw-r--r--src/kdeapplicationdebugsettingpage.h2
-rw-r--r--src/kdeapplicationtreelistwidget.cpp8
-rw-r--r--src/kdeapplicationtreelistwidget.h4
-rw-r--r--src/kdebugsettingsdialog.cpp6
-rw-r--r--src/kdebugsettingsdialog.h2
6 files changed, 13 insertions, 13 deletions
diff --git a/src/kdeapplicationdebugsettingpage.cpp b/src/kdeapplicationdebugsettingpage.cpp
index 9abde3a..31c3f93 100644
--- a/src/kdeapplicationdebugsettingpage.cpp
+++ b/src/kdeapplicationdebugsettingpage.cpp
@@ -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)
diff --git a/src/kdeapplicationdebugsettingpage.h b/src/kdeapplicationdebugsettingpage.h
index ec7ac3c..b06735f 100644
--- a/src/kdeapplicationdebugsettingpage.h
+++ b/src/kdeapplicationdebugsettingpage.h
@@ -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();
diff --git a/src/kdeapplicationtreelistwidget.cpp b/src/kdeapplicationtreelistwidget.cpp
index 12e232c..ab1f4d8 100644
--- a/src/kdeapplicationtreelistwidget.cpp
+++ b/src/kdeapplicationtreelistwidget.cpp
@@ -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);
}
diff --git a/src/kdeapplicationtreelistwidget.h b/src/kdeapplicationtreelistwidget.h
index b9c4150..1a6acca 100644
--- a/src/kdeapplicationtreelistwidget.h
+++ b/src/kdeapplicationtreelistwidget.h
@@ -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();
diff --git a/src/kdebugsettingsdialog.cpp b/src/kdebugsettingsdialog.cpp
index 691a3b4..96c63e1 100644
--- a/src/kdebugsettingsdialog.cpp
+++ b/src/kdebugsettingsdialog.cpp
@@ -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);
}
}
diff --git a/src/kdebugsettingsdialog.h b/src/kdebugsettingsdialog.h
index 99dcc60..2850b8e 100644
--- a/src/kdebugsettingsdialog.h
+++ b/src/kdebugsettingsdialog.h
@@ -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();