Commit c247b065 authored by Volker Krause's avatar Volker Krause
Browse files

Allow to edit targeting expressions in the survey dialog

parent d0bf8b81
......@@ -21,6 +21,7 @@
#include <core/survey.h>
#include <QIcon>
#include <QPushButton>
#include <QUrl>
using namespace UserFeedback::Console;
......@@ -31,6 +32,8 @@ SurveyDialog::SurveyDialog(QWidget *parent) :
{
ui->setupUi(this);
setWindowIcon(QIcon::fromTheme(QStringLiteral("dialog-question")));
connect(ui->buttonBox->button(QDialogButtonBox::Discard), &QPushButton::clicked, this, &QDialog::reject);
}
SurveyDialog::~SurveyDialog() = default;
......@@ -40,6 +43,7 @@ Survey SurveyDialog::survey() const
Survey s;
s.setName(ui->name->text());
s.setUrl(QUrl(ui->url->text()));
s.setTarget(ui->targetExpression->toPlainText());
return s;
}
......@@ -47,4 +51,5 @@ void SurveyDialog::setSurvey(const Survey& survey)
{
ui->name->setText(survey.name());
ui->url->setText(survey.url().toString());
ui->targetExpression->setPlainText(survey.target());
}
......@@ -44,13 +44,26 @@
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Targeting e&amp;xpression:</string>
</property>
<property name="buddy">
<cstring>targetExpression</cstring>
</property>
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="targetExpression"/>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
<set>QDialogButtonBox::Discard|QDialogButtonBox::Save</set>
</property>
</widget>
</item>
......
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