Commit b813820f authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

add method to load renamecategories files

parent 66f4e32c
......@@ -42,14 +42,14 @@ endmacro ()
add_unittest( kdebugsettingsdialogtest.cpp "${full_source_file}")
add_unittest( kdeapplicationdebugsettingpagetest.cpp "../src/kdeloggingcategory.cpp;../src/loggingcategory.cpp;../src/kdebugsettings_debug.cpp;../src/kdeapplicationdebugsettingpage.cpp;../src/kdeapplicationtreelistwidget.cpp;../src/categorytypecombobox.cpp")
add_unittest( customdebugsettingspagetest.cpp "../src/kdeloggingcategory.cpp;../src/loggingcategory.cpp;../src/kdebugsettings_debug.cpp;../src/categorytypecombobox.cpp;../src/customdebugsettingspage.cpp;../src/configurecustomsettingdialog.cpp;../src/configurecustomsettingwidget.cpp;../src/kdebugsettingsutil.cpp")
add_unittest( configurecustomsettingdialogtest.cpp "../src/kdeloggingcategory.cpp;../src/loggingcategory.cpp;../src/kdebugsettings_debug.cpp;../src/categorytypecombobox.cpp;../src/configurecustomsettingdialog.cpp;../src/configurecustomsettingwidget.cpp;../src/kdebugsettingsutil.cpp")
add_unittest( configurecustomsettingwidgettest.cpp "../src/kdeloggingcategory.cpp;../src/loggingcategory.cpp;../src/kdebugsettings_debug.cpp;../src/categorytypecombobox.cpp;../src/configurecustomsettingwidget.cpp;../src/kdebugsettingsutil.cpp")
add_unittest( environmentsettingsrulespagetest.cpp "../src/kdeloggingcategory.cpp;../src/loggingcategory.cpp;../src/environmentsettingsrulespage.cpp;../src/environmentplaintextedit.cpp")
add_unittest( kdebugsettingutiltest.cpp "../src/kdeloggingcategory.cpp;../src/loggingcategory.cpp;../src/kdebugsettings_debug.cpp;../src/kdebugsettingsutil.cpp")
add_unittest( customdebugsettingspagetest.cpp "../src/renamecategory.cpp;../src/kdeloggingcategory.cpp;../src/loggingcategory.cpp;../src/kdebugsettings_debug.cpp;../src/categorytypecombobox.cpp;../src/customdebugsettingspage.cpp;../src/configurecustomsettingdialog.cpp;../src/configurecustomsettingwidget.cpp;../src/kdebugsettingsutil.cpp")
add_unittest( configurecustomsettingdialogtest.cpp "../src/renamecategory.cpp;../src/kdeloggingcategory.cpp;../src/loggingcategory.cpp;../src/kdebugsettings_debug.cpp;../src/categorytypecombobox.cpp;../src/configurecustomsettingdialog.cpp;../src/configurecustomsettingwidget.cpp;../src/kdebugsettingsutil.cpp")
add_unittest( configurecustomsettingwidgettest.cpp "../src/renamecategory.cpp;../src/kdeloggingcategory.cpp;../src/loggingcategory.cpp;../src/kdebugsettings_debug.cpp;../src/categorytypecombobox.cpp;../src/configurecustomsettingwidget.cpp;../src/kdebugsettingsutil.cpp")
add_unittest( environmentsettingsrulespagetest.cpp "../src/renamecategory.cpp;../src/kdeloggingcategory.cpp;../src/loggingcategory.cpp;../src/environmentsettingsrulespage.cpp;../src/environmentplaintextedit.cpp")
add_unittest( kdebugsettingutiltest.cpp "../src/renamecategory.cpp;../src/kdeloggingcategory.cpp;../src/loggingcategory.cpp;../src/kdebugsettings_debug.cpp;../src/kdebugsettingsutil.cpp")
add_unittest( categorytypecomboboxtest.cpp "../src/loggingcategory.cpp;../src/categorytypecombobox.cpp")
add_unittest( kdeapplicationtreelistwidgettest.cpp "../src/loggingcategory.cpp;../src/kdeapplicationtreelistwidget.cpp;../src/categorytypecombobox.cpp")
add_unittest( kdeapplicationtreelistwidgettest.cpp "../src/renamecategory.cpp;../src/loggingcategory.cpp;../src/kdeapplicationtreelistwidget.cpp;../src/categorytypecombobox.cpp")
add_unittest( categorywarningtest.cpp "../src/categorywarning.cpp")
add_unittest( loggingcategorytest.cpp "../src/loggingcategory.cpp")
add_unittest( loadcategoriesjobtest.cpp "../src/loadcategoriesjob.cpp;../src/loggingcategory.cpp;../src/kdeloggingcategory.cpp;../src/kdebugsettings_debug.cpp;../src/kdebugsettingsutil.cpp")
add_unittest( loadcategoriesjobtest.cpp "../src/renamecategory.cpp;../src/loadcategoriesjob.cpp;../src/loggingcategory.cpp;../src/kdeloggingcategory.cpp;../src/kdebugsettings_debug.cpp;../src/kdebugsettingsutil.cpp")
add_unittest( renamecategorytest.cpp "../src/renamecategory.cpp;../src/kdebugsettingsutil.cpp;../src/kdeloggingcategory.cpp;../src/kdebugsettings_debug.cpp")
......@@ -49,6 +49,28 @@ RenameCategory KDebugSettingsUtil::parseRenameCategories(QString line)
return category;
}
RenameCategory::List KDebugSettingsUtil::readRenameCategories(const QString &filename)
{
RenameCategory::List insertCategories;
QFile file(filename);
if (!file.open(QIODevice::ReadOnly)) {
qCWarning(KDEBUGSETTINGS_LOG) << "Couldn't open" << filename;
} else {
QString data;
QTextStream ts(&file);
ts.setCodec("ISO-8859-1");
while (!ts.atEnd()) {
data = ts.readLine().simplified();
const RenameCategory category = parseRenameCategories(data);
if (category.isValid()) {
insertCategories.append(category);
}
}
}
return insertCategories;
}
KdeLoggingCategory KDebugSettingsUtil::parseLineKdeLoggingCategory(QString line)
{
KdeLoggingCategory category;
......
......@@ -110,7 +110,7 @@ KdeLoggingCategory::List readLoggingCategoriesForInserting(const QString &filena
QList<LoadLoggingCategory> readLoggingQtCategories(const QString &filename);
KDebugSettingsUtil::LineLoggingQtCategory parseLineLoggingQtCategory(const QString &line);
RenameCategory parseRenameCategories(QString line);
RenameCategory::List readRenameCategories(const QString &filename);
}
Q_DECLARE_METATYPE(KDebugSettingsUtil::LoadLoggingCategory::LogType)
......
Supports Markdown
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