[libraries/ktextaddons] textautogeneratetext/widgets/promptswidget: Add combobox
Laurent Montel <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 1c2d17cb098a71a8874e1ee475930cdf6bc617e5 by Laurent Montel.
Committed on 10/08/2026 at 06:19.
Pushed by mlaurent into branch 'master'.
Add combobox
M +8 -0 textautogeneratetext/widgets/promptswidget/textautogeneratepromptwidget.cpp
M +2 -0 textautogeneratetext/widgets/promptswidget/textautogeneratepromptwidget.h
https://invent.kde.org/libraries/ktextaddons/-/commit/1c2d17cb098a71a8874e1ee475930cdf6bc617e5
diff --git a/textautogeneratetext/widgets/promptswidget/textautogeneratepromptwidget.cpp b/textautogeneratetext/widgets/promptswidget/textautogeneratepromptwidget.cpp
index fbf8d006d..b220061e6 100644
--- a/textautogeneratetext/widgets/promptswidget/textautogeneratepromptwidget.cpp
+++ b/textautogeneratetext/widgets/promptswidget/textautogeneratepromptwidget.cpp
@@ -6,6 +6,7 @@
#include "textautogeneratepromptwidget.h"
#include "core/prompts/textautogenerateprompt.h"
+#include "widgets/promptswidget/textautogeneratepromptcombobox.h"
#include <KLineEditEventHandler>
#include <KLocalizedString>
#include <QFormLayout>
@@ -18,6 +19,7 @@ TextAutoGeneratePromptWidget::TextAutoGeneratePromptWidget(QWidget *parent)
, mName(new QLineEdit(this))
, mDescription(new QPlainTextEdit(this))
, mPrompt(new QPlainTextEdit(this))
+ , mCategory(new TextAutoGeneratePromptComboBox(this))
{
auto mainLayout = new QFormLayout(this);
mainLayout->setObjectName(u"mainLayout"_s);
@@ -25,10 +27,14 @@ TextAutoGeneratePromptWidget::TextAutoGeneratePromptWidget(QWidget *parent)
mName->setObjectName(u"mName"_s);
KLineEditEventHandler::catchReturnKey(mName);
+
+ mCategory->setObjectName(u"mCategory"_s);
+
mDescription->setObjectName(u"mDescription"_s);
mPrompt->setObjectName(u"mPrompt"_s);
mainLayout->addRow(i18n("Name:"), mName);
+ mainLayout->addRow(i18n("Category:"), mCategory);
mainLayout->addRow(i18n("Description:"), mDescription);
mainLayout->addRow(i18n("Prompt:"), mPrompt);
}
@@ -40,6 +46,7 @@ void TextAutoGeneratePromptWidget::setPrompt(const TextAutoGenerateText::TextAut
mName->setText(prompt.name());
mDescription->setPlainText(prompt.description());
mPrompt->setPlainText(prompt.text());
+ mCategory->setCategory(prompt.category());
}
TextAutoGenerateText::TextAutoGeneratePrompt TextAutoGeneratePromptWidget::prompt() const
@@ -48,6 +55,7 @@ TextAutoGenerateText::TextAutoGeneratePrompt TextAutoGeneratePromptWidget::promp
prompt.setDescription(mDescription->toPlainText());
prompt.setText(mPrompt->toPlainText());
prompt.setName(mName->text());
+ prompt.setCategory(mCategory->category());
return prompt;
}
diff --git a/textautogeneratetext/widgets/promptswidget/textautogeneratepromptwidget.h b/textautogeneratetext/widgets/promptswidget/textautogeneratepromptwidget.h
index fb6c7f71a..3c8d84ceb 100644
--- a/textautogeneratetext/widgets/promptswidget/textautogeneratepromptwidget.h
+++ b/textautogeneratetext/widgets/promptswidget/textautogeneratepromptwidget.h
@@ -11,6 +11,7 @@ class QLineEdit;
class QPlainTextEdit;
namespace TextAutoGenerateText
{
+class TextAutoGeneratePromptComboBox;
class TextAutoGeneratePrompt;
class TEXTAUTOGENERATETEXT_TESTS_EXPORT TextAutoGeneratePromptWidget : public QWidget
{
@@ -26,5 +27,6 @@ private:
QLineEdit *const mName;
QPlainTextEdit *const mDescription;
QPlainTextEdit *const mPrompt;
+ TextAutoGeneratePromptComboBox *const mCategory;
};
}