[utilities/kdebugsettings] src/core/model: Add category

Laurent Montel <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 0975a07f294224601f65747b6e8d6b9326b40556 by Laurent Montel.
Committed on 22/07/2026 at 17:45.
Pushed by mlaurent into branch 'master'.

Add category

M  +9    -0    src/core/model/customloggingcategorymodel.cpp
M  +2    -0    src/core/model/customloggingcategorymodel.h

https://invent.kde.org/utilities/kdebugsettings/-/commit/0975a07f294224601f65747b6e8d6b9326b40556

diff --git a/src/core/model/customloggingcategorymodel.cpp b/src/core/model/customloggingcategorymodel.cpp
index f7ff9108..f007d32f 100644
--- a/src/core/model/customloggingcategorymodel.cpp
+++ b/src/core/model/customloggingcategorymodel.cpp
@@ -129,6 +129,15 @@ void CustomLoggingCategoryModel::removeCategory(const LoggingCategory::List &cat
     endResetModel();
 }
 
+void CustomLoggingCategoryModel::addCategory(const QString &categoryName, bool enabled, LoggingCategory::LoggingType type)
+{
+    LoggingCategory category;
+    category.categoryName = categoryName;
+    category.enabled = enabled;
+    category.loggingType = type;
+    if (!addCategory(category)) { }
+}
+
 bool CustomLoggingCategoryModel::addCategory(const LoggingCategory &category)
 {
     bool found = false;
diff --git a/src/core/model/customloggingcategorymodel.h b/src/core/model/customloggingcategorymodel.h
index 6432463e..8265a9ab 100644
--- a/src/core/model/customloggingcategorymodel.h
+++ b/src/core/model/customloggingcategorymodel.h
@@ -50,6 +50,8 @@ public:
 
     void removeCategory(int row);
 
+    Q_INVOKABLE void addCategory(const QString &categoryName, bool enabled, LoggingCategory::LoggingType type);
+
 private:
     LoggingCategory::List mLoggingCategories;
     QHash<int, QByteArray> mRoleNames;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.