Commit 66c2ccbf authored by Laurent Montel's avatar Laurent Montel 😁

Remove static method

parent 79ef4250
......@@ -24,10 +24,10 @@
using namespace KSieveUi;
SelectMatchTypeComboBox::SelectMatchTypeComboBox(QWidget *parent)
SelectMatchTypeComboBox::SelectMatchTypeComboBox(SieveEditorGraphicalModeWidget *sieveGraphicalModeWidget, QWidget *parent)
: KComboBox(parent)
{
mHasRegexCapability = SieveEditorGraphicalModeWidget::sieveCapabilities().contains(QStringLiteral("regex"));
mHasRegexCapability = sieveGraphicalModeWidget->sieveCapabilities().contains(QStringLiteral("regex"));
initialize();
connect(this, static_cast<void (SelectMatchTypeComboBox::*)(int)>(&SelectMatchTypeComboBox::activated), this, &SelectMatchTypeComboBox::valueChanged);
}
......
......@@ -23,11 +23,12 @@
namespace KSieveUi
{
class SieveEditorGraphicalModeWidget;
class SelectMatchTypeComboBox : public KComboBox
{
Q_OBJECT
public:
explicit SelectMatchTypeComboBox(QWidget *parent = Q_NULLPTR);
explicit SelectMatchTypeComboBox(KSieveUi::SieveEditorGraphicalModeWidget *sieveGraphicalModeWidget, QWidget *parent = Q_NULLPTR);
~SelectMatchTypeComboBox();
QString code(bool &negative) const;
......
......@@ -44,7 +44,7 @@ QWidget *SieveActionDeleteHeader::createParamWidget(QWidget *parent) const
grid->setMargin(0);
w->setLayout(grid);
SelectMatchTypeComboBox *matchType = new SelectMatchTypeComboBox;
SelectMatchTypeComboBox *matchType = new SelectMatchTypeComboBox(mSieveGraphicalModeWidget);
matchType->setObjectName(QStringLiteral("matchtype"));
connect(matchType, &SelectMatchTypeComboBox::valueChanged, this, &SieveActionDeleteHeader::valueChanged);
grid->addWidget(matchType, 0, 0);
......
......@@ -45,7 +45,7 @@ QWidget *SieveConditionAddress::createParamWidget(QWidget *parent) const
lay->setMargin(0);
w->setLayout(lay);
SelectAddressPartComboBox *selectAddressPart = new SelectAddressPartComboBox;
SelectAddressPartComboBox *selectAddressPart = new SelectAddressPartComboBox(mSieveGraphicalModeWidget);
connect(selectAddressPart, &SelectAddressPartComboBox::valueChanged, this, &SieveConditionAddress::valueChanged);
selectAddressPart->setObjectName(QStringLiteral("addresspartcombobox"));
lay->addWidget(selectAddressPart);
......@@ -53,7 +53,7 @@ QWidget *SieveConditionAddress::createParamWidget(QWidget *parent) const
QGridLayout *grid = new QGridLayout;
grid->setMargin(0);
lay->addLayout(grid);
SelectMatchTypeComboBox *selectMatchCombobox = new SelectMatchTypeComboBox;
SelectMatchTypeComboBox *selectMatchCombobox = new SelectMatchTypeComboBox(mSieveGraphicalModeWidget);
connect(selectMatchCombobox, &SelectMatchTypeComboBox::valueChanged, this, &SieveConditionAddress::valueChanged);
selectMatchCombobox->setObjectName(QStringLiteral("matchtypecombobox"));
grid->addWidget(selectMatchCombobox, 0, 0);
......
......@@ -47,7 +47,7 @@ QWidget *SieveConditionBody::createParamWidget(QWidget *parent) const
connect(bodyType, &SelectBodyTypeWidget::valueChanged, this, &SieveConditionBody::valueChanged);
lay->addWidget(bodyType);
SelectMatchTypeComboBox *matchType = new SelectMatchTypeComboBox;
SelectMatchTypeComboBox *matchType = new SelectMatchTypeComboBox(mSieveGraphicalModeWidget);
lay->addWidget(matchType);
matchType->setObjectName(QStringLiteral("matchtype"));
connect(matchType, &SelectMatchTypeComboBox::valueChanged, this, &SieveConditionBody::valueChanged);
......
......@@ -42,7 +42,7 @@ QWidget *SieveConditionCurrentDate::createParamWidget(QWidget *parent) const
lay->setMargin(0);
w->setLayout(lay);
SelectMatchTypeComboBox *matchTypeCombo = new SelectMatchTypeComboBox;
SelectMatchTypeComboBox *matchTypeCombo = new SelectMatchTypeComboBox(mSieveGraphicalModeWidget);
matchTypeCombo->setObjectName(QStringLiteral("matchtype"));
lay->addWidget(matchTypeCombo);
connect(matchTypeCombo, &SelectMatchTypeComboBox::valueChanged, this, &SieveConditionCurrentDate::valueChanged);
......
......@@ -43,7 +43,7 @@ QWidget *SieveConditionDate::createParamWidget(QWidget *parent) const
lay->setMargin(0);
w->setLayout(lay);
SelectMatchTypeComboBox *matchTypeCombo = new SelectMatchTypeComboBox;
SelectMatchTypeComboBox *matchTypeCombo = new SelectMatchTypeComboBox(mSieveGraphicalModeWidget);
matchTypeCombo->setObjectName(QStringLiteral("matchtype"));
connect(matchTypeCombo, &SelectMatchTypeComboBox::valueChanged, this, &SieveConditionDate::valueChanged);
lay->addWidget(matchTypeCombo);
......
......@@ -46,7 +46,7 @@ QWidget *SieveConditionEnvelope::createParamWidget(QWidget *parent) const
lay->setMargin(0);
w->setLayout(lay);
SelectAddressPartComboBox *selectAddressPart = new SelectAddressPartComboBox;
SelectAddressPartComboBox *selectAddressPart = new SelectAddressPartComboBox(mSieveGraphicalModeWidget);
connect(selectAddressPart, &SelectAddressPartComboBox::valueChanged, this, &SieveConditionEnvelope::valueChanged);
selectAddressPart->setObjectName(QStringLiteral("addresspartcombobox"));
lay->addWidget(selectAddressPart);
......@@ -55,7 +55,7 @@ QWidget *SieveConditionEnvelope::createParamWidget(QWidget *parent) const
grid->setMargin(0);
lay->addLayout(grid);
SelectMatchTypeComboBox *selectMatchCombobox = new SelectMatchTypeComboBox;
SelectMatchTypeComboBox *selectMatchCombobox = new SelectMatchTypeComboBox(mSieveGraphicalModeWidget);
selectMatchCombobox->setObjectName(QStringLiteral("matchtypecombobox"));
connect(selectMatchCombobox, &SelectMatchTypeComboBox::valueChanged, this, &SieveConditionEnvelope::valueChanged);
grid->addWidget(selectMatchCombobox, 0, 0);
......
......@@ -44,7 +44,7 @@ QWidget *SieveConditionHasFlag::createParamWidget(QWidget *parent) const
QHBoxLayout *lay = new QHBoxLayout;
lay->setMargin(0);
w->setLayout(lay);
SelectMatchTypeComboBox *selecttype = new SelectMatchTypeComboBox;
SelectMatchTypeComboBox *selecttype = new SelectMatchTypeComboBox(mSieveGraphicalModeWidget);
selecttype->setObjectName(QStringLiteral("matchtype"));
connect(selecttype, &SelectMatchTypeComboBox::valueChanged, this, &SieveConditionHasFlag::valueChanged);
lay->addWidget(selecttype);
......
......@@ -43,7 +43,7 @@ QWidget *SieveConditionHeader::createParamWidget(QWidget *parent) const
lay->setMargin(0);
w->setLayout(lay);
SelectMatchTypeComboBox *matchTypeCombo = new SelectMatchTypeComboBox;
SelectMatchTypeComboBox *matchTypeCombo = new SelectMatchTypeComboBox(mSieveGraphicalModeWidget);
matchTypeCombo->setObjectName(QStringLiteral("matchtypecombobox"));
connect(matchTypeCombo, &SelectMatchTypeComboBox::valueChanged, this, &SieveConditionHeader::valueChanged);
lay->addWidget(matchTypeCombo);
......
......@@ -42,7 +42,7 @@ QWidget *SieveConditionMetaData::createParamWidget(QWidget *parent) const
lay->setMargin(0);
w->setLayout(lay);
SelectMatchTypeComboBox *selectType = new SelectMatchTypeComboBox;
SelectMatchTypeComboBox *selectType = new SelectMatchTypeComboBox(mSieveGraphicalModeWidget);
selectType->setObjectName(QStringLiteral("selecttype"));
connect(selectType, &SelectMatchTypeComboBox::valueChanged, this, &SieveConditionMetaData::valueChanged);
lay->addWidget(selectType);
......
......@@ -43,7 +43,7 @@ QWidget *SieveConditionServerMetaData::createParamWidget(QWidget *parent) const
lay->setMargin(0);
w->setLayout(lay);
SelectMatchTypeComboBox *selectType = new SelectMatchTypeComboBox;
SelectMatchTypeComboBox *selectType = new SelectMatchTypeComboBox(mSieveGraphicalModeWidget);
selectType->setObjectName(QStringLiteral("selecttype"));
connect(selectType, &SelectMatchTypeComboBox::valueChanged, this, &SieveConditionServerMetaData::valueChanged);
lay->addWidget(selectType);
......
......@@ -58,7 +58,7 @@ QWidget *SieveConditionSpamTest::createParamWidget(QWidget *parent) const
relation->setObjectName(QStringLiteral("relation"));
lay->addWidget(relation);
SelectComparatorComboBox *comparator = new SelectComparatorComboBox;
SelectComparatorComboBox *comparator = new SelectComparatorComboBox(mSieveGraphicalModeWidget);
connect(comparator, &SelectComparatorComboBox::valueChanged, this, &SieveConditionSpamTest::valueChanged);
comparator->setObjectName(QStringLiteral("comparator"));
lay->addWidget(comparator);
......
......@@ -48,7 +48,7 @@ QWidget *SieveConditionVirusTest::createParamWidget(QWidget *parent) const
relation->setObjectName(QStringLiteral("relation"));
lay->addWidget(relation);
SelectComparatorComboBox *comparator = new SelectComparatorComboBox;
SelectComparatorComboBox *comparator = new SelectComparatorComboBox(mSieveGraphicalModeWidget);
connect(comparator, &SelectComparatorComboBox::valueChanged, this, &SieveConditionVirusTest::valueChanged);
comparator->setObjectName(QStringLiteral("comparator"));
lay->addWidget(comparator);
......
......@@ -24,10 +24,10 @@
using namespace KSieveUi;
SelectAddressPartComboBox::SelectAddressPartComboBox(QWidget *parent)
SelectAddressPartComboBox::SelectAddressPartComboBox(SieveEditorGraphicalModeWidget *sieveGraphicalModeWidget, QWidget *parent)
: QComboBox(parent)
{
mHasSubaddressCapability = SieveEditorGraphicalModeWidget::sieveCapabilities().contains(QStringLiteral("subaddress"));
mHasSubaddressCapability = sieveGraphicalModeWidget->sieveCapabilities().contains(QStringLiteral("subaddress"));
initialize();
connect(this, static_cast<void (SelectAddressPartComboBox::*)(int)>(&SelectAddressPartComboBox::activated), this, &SelectAddressPartComboBox::valueChanged);
}
......
......@@ -23,11 +23,12 @@
namespace KSieveUi
{
class SieveEditorGraphicalModeWidget;
class SelectAddressPartComboBox : public QComboBox
{
Q_OBJECT
public:
explicit SelectAddressPartComboBox(QWidget *parent = Q_NULLPTR);
explicit SelectAddressPartComboBox(KSieveUi::SieveEditorGraphicalModeWidget *sieveGraphicalModeWidget, QWidget *parent = Q_NULLPTR);
~SelectAddressPartComboBox();
QString code() const;
......
......@@ -21,24 +21,24 @@
#include "autocreatescripts/autocreatescriptutil_p.h"
using namespace KSieveUi;
SelectComparatorComboBox::SelectComparatorComboBox(QWidget *parent)
SelectComparatorComboBox::SelectComparatorComboBox(SieveEditorGraphicalModeWidget *sieveGraphicalModeWidget, QWidget *parent)
: QComboBox(parent)
{
connect(this, static_cast<void (SelectComparatorComboBox::*)(int)>(&SelectComparatorComboBox::activated), this, &SelectComparatorComboBox::valueChanged);
initialize();
initialize(sieveGraphicalModeWidget->sieveCapabilities());
}
SelectComparatorComboBox::~SelectComparatorComboBox()
{
}
void SelectComparatorComboBox::initialize()
void SelectComparatorComboBox::initialize(const QStringList &sieveCapabilities)
{
//Default in spec
addItem(QStringLiteral("i;octet"), QStringLiteral("comparator-i;octet"));
addItem(QStringLiteral("i;ascii-casemap"), QStringLiteral("comparator-i;ascii-casemap"));
Q_FOREACH (const QString &capability, KSieveUi::SieveEditorGraphicalModeWidget::sieveCapabilities()) {
Q_FOREACH (const QString &capability, sieveCapabilities) {
if (capability.startsWith(QStringLiteral("comparator-"))) {
QString str(capability);
str.remove(QStringLiteral("comparator-"));
......
......@@ -23,11 +23,12 @@
#include <QComboBox>
namespace KSieveUi
{
class SieveEditorGraphicalModeWidget;
class SelectComparatorComboBox : public QComboBox
{
Q_OBJECT
public:
explicit SelectComparatorComboBox(QWidget *parent = Q_NULLPTR);
explicit SelectComparatorComboBox(KSieveUi::SieveEditorGraphicalModeWidget *sieveGraphicalModeWidget, QWidget *parent = Q_NULLPTR);
~SelectComparatorComboBox();
QString code() const;
......@@ -38,7 +39,7 @@ public:
Q_SIGNALS:
void valueChanged();
private:
void initialize();
void initialize(const QStringList &sieveCapabilities);
};
}
#endif // SELECTCOMPARATORCOMBOBOX_H
......@@ -40,8 +40,8 @@ public:
QString script(QString &requires) const;
static void setSieveCapabilities(const QStringList &capabilities);
static QStringList sieveCapabilities();
void setSieveCapabilities(const QStringList &capabilities);
QStringList sieveCapabilities();
void loadScript(const QDomDocument &doc, QString &error);
......
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