Commit 2be63c0d authored by Laurent Montel's avatar Laurent Montel 😁

Add custom combobox

parent 702f6e1d
......@@ -35,7 +35,8 @@ CategoryTypeComboBoxTest::~CategoryTypeComboBoxTest()
void CategoryTypeComboBoxTest::shouldHaveDefaultValue()
{
CategoryTypeComboBox w;
//FIXME test custom or not type
CategoryTypeComboBox w(true);
QCOMPARE(w.count(), 5);
}
......
......@@ -22,15 +22,19 @@
#include <KLocalizedString>
CategoryTypeComboBox::CategoryTypeComboBox(QWidget *parent)
CategoryTypeComboBox::CategoryTypeComboBox(bool customType, QWidget *parent)
: QComboBox(parent)
{
addItem(i18n("All"), QVariant::fromValue(LoggingCategory::All));
if (!customType) {
addItem(i18n("All"), QVariant::fromValue(LoggingCategory::All));
}
addItem(i18n("Info"), QVariant::fromValue(LoggingCategory::Info));
addItem(i18n("Debug"), QVariant::fromValue(LoggingCategory::Debug));
addItem(i18n("Warning"), QVariant::fromValue(LoggingCategory::Warning));
addItem(i18n("Critical"), QVariant::fromValue(LoggingCategory::Critical));
addItem(i18n("Off"), QVariant::fromValue(LoggingCategory::Off));
if (!customType) {
addItem(i18n("Off"), QVariant::fromValue(LoggingCategory::Off));
}
}
CategoryTypeComboBox::~CategoryTypeComboBox()
......
......@@ -28,7 +28,7 @@ class CategoryTypeComboBox : public QComboBox
{
Q_OBJECT
public:
explicit CategoryTypeComboBox(QWidget *parent = Q_NULLPTR);
explicit CategoryTypeComboBox(bool customType, QWidget *parent = Q_NULLPTR);
~CategoryTypeComboBox();
LoggingCategory::LoggingType type() const;
......
......@@ -51,7 +51,7 @@ ConfigureCustomSettingWidget::ConfigureCustomSettingWidget(QWidget *parent)
lab->setObjectName(QStringLiteral("categorytype_label"));
categoryLayout->addWidget(lab);
mCategoryType = new CategoryTypeComboBox;
mCategoryType = new CategoryTypeComboBox(true, this);
mCategoryType->setObjectName(QStringLiteral("categorytype_combobox"));
categoryLayout->addWidget(mCategoryType);
......
......@@ -26,7 +26,7 @@ KDEApplicationTreeListWidgetItem::KDEApplicationTreeListWidgetItem(const QString
: QTreeWidgetItem(parent),
mCategory(category)
{
mCategoryTypeCombobox = new CategoryTypeComboBox;
mCategoryTypeCombobox = new CategoryTypeComboBox(false);
treeWidget()->setItemWidget(this, CategoryType, mCategoryTypeCombobox);
}
......
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