Commit bb3f2ccc authored by Laurent Montel's avatar Laurent Montel 😁

Don't save value when it's default value

parent 244d265f
......@@ -55,3 +55,8 @@ LoggingCategory::LoggingType CategoryTypeComboBox::type() const
{
return currentData().value<LoggingCategory::LoggingType>();
}
bool CategoryTypeComboBox::loggingCategoryIsNotDefault() const
{
return (type() != LoggingCategory::Info);
}
......@@ -33,6 +33,7 @@ public:
LoggingCategory::LoggingType type() const;
void setType(LoggingCategory::LoggingType type);
bool loggingCategoryIsNotDefault() const;
};
#endif // CATEGORYTYPECOMBOBOX_H
......@@ -53,9 +53,11 @@ void KDEApplicationTreeListWidgetItem::setLogName(const QString &category)
LoggingCategory KDEApplicationTreeListWidgetItem::rule() const
{
LoggingCategory cat;
cat.enabled = false;
cat.logName = mCategory;
cat.loggingType = mCategoryTypeCombobox->type();
if (mCategoryTypeCombobox->loggingCategoryIsNotDefault()) {
cat.enabled = false;
cat.logName = mCategory;
cat.loggingType = mCategoryTypeCombobox->type();
}
return cat;
}
......
......@@ -37,7 +37,7 @@ bool LoggingCategory::operator ==(const LoggingCategory &other) const
bool LoggingCategory::isValid() const
{
return !logName.isEmpty();
return !logName.isEmpty() && (loggingType != Undefined);
}
QString LoggingCategory::createCustomRule() const
......
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