Commit 2374d3fc authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use setContentsMargins({}) + const'ify pointer + use Q_REQUIRED_RESULT

parent 1c5cc954
Pipeline #72885 canceled with stage
......@@ -82,7 +82,7 @@ CollectionExpiryWidget::CollectionExpiryWidget(QWidget *parent)
formLayout->addRow(actionsGroup);
auto moveToHBox = new QHBoxLayout();
moveToHBox->setContentsMargins(0, 0, 0, 0);
moveToHBox->setContentsMargins({});
moveToHBox->setSpacing(6);
mMoveToRB = new QRadioButton(actionsGroup);
......
......@@ -20,7 +20,7 @@ CollectionTemplatesWidget::CollectionTemplatesWidget(QWidget *parent)
{
auto topLayout = new QVBoxLayout(this);
auto topItems = new QHBoxLayout;
topItems->setContentsMargins(0, 0, 0, 0);
topItems->setContentsMargins({});
topLayout->addLayout(topItems);
mCustom = new QCheckBox(i18n("&Use custom message templates in this folder"), this);
......
......@@ -58,7 +58,7 @@ QWidget *FilterActionAddHeader::createParamWidget(QWidget *parent) const
auto widget = new QWidget(parent);
auto layout = new QHBoxLayout(widget);
layout->setSpacing(4);
layout->setContentsMargins(0, 0, 0, 0);
layout->setContentsMargins({});
auto comboBox = new KComboBox(widget);
comboBox->setMinimumWidth(50);
......
......@@ -26,7 +26,7 @@ public:
void applyParamWidgetValue(QWidget *paramWidget) override;
void clearParamWidget(QWidget *paramWidget) const override;
SearchRule::RequiredPart requiredPart() const override;
Q_REQUIRED_RESULT SearchRule::RequiredPart requiredPart() const override;
Q_REQUIRED_RESULT QString argsAsString() const override;
void argsFromString(const QString &argsStr) override;
......@@ -38,7 +38,7 @@ public:
Q_REQUIRED_RESULT QStringList sieveRequires() const override;
Q_REQUIRED_RESULT QString sieveCode() const override;
bool isEmpty() const override;
Q_REQUIRED_RESULT bool isEmpty() const override;
Q_REQUIRED_RESULT QString informationAboutNotValidAction() const override;
private:
......
......@@ -23,7 +23,7 @@ public:
Q_REQUIRED_RESULT ReturnCode process(ItemContext &context, bool applyOnOutbound) const override;
static FilterAction *newAction();
SearchRule::RequiredPart requiredPart() const override;
Q_REQUIRED_RESULT SearchRule::RequiredPart requiredPart() const override;
Q_REQUIRED_RESULT bool isEmpty() const override;
......
......@@ -78,7 +78,7 @@ QWidget *FilterActionForward::createParamWidget(QWidget *parent) const
{
auto addressAndTemplate = new QWidget(parent);
auto layout = new QHBoxLayout(addressAndTemplate);
layout->setContentsMargins(0, 0, 0, 0);
layout->setContentsMargins({});
QWidget *addressEdit = FilterActionWithAddress::createParamWidget(addressAndTemplate);
addressEdit->setObjectName(QStringLiteral("addressEdit"));
......
......@@ -93,7 +93,7 @@ QWidget *FilterActionRewriteHeader::createParamWidget(QWidget *parent) const
auto widget = new QWidget(parent);
auto layout = new QHBoxLayout(widget);
layout->setSpacing(4);
layout->setContentsMargins(0, 0, 0, 0);
layout->setContentsMargins({});
auto comboBox = new KComboBox(widget);
comboBox->setMinimumWidth(50);
......
......@@ -21,7 +21,7 @@ class FilterActionSetTransport : public FilterAction
public:
explicit FilterActionSetTransport(QObject *parent = nullptr);
ReturnCode process(ItemContext &context, bool applyOnOutbound) const override;
SearchRule::RequiredPart requiredPart() const override;
Q_REQUIRED_RESULT SearchRule::RequiredPart requiredPart() const override;
static FilterAction *newAction();
QWidget *createParamWidget(QWidget *parent) const override;
/**
......@@ -39,7 +39,7 @@ public:
*/
void clearParamWidget(QWidget *paramWidget) const override;
bool argsFromStringInteractive(const QString &argsStr, const QString &filterName) override;
Q_REQUIRED_RESULT bool argsFromStringInteractive(const QString &argsStr, const QString &filterName) override;
/**
* @copydoc FilterAction::argsFromString
......
......@@ -92,12 +92,12 @@ FilterActionWidget::FilterActionWidget(QWidget *parent)
, d(new Private(this))
{
auto mainLayout = new QHBoxLayout(this);
mainLayout->setContentsMargins(0, 0, 0, 0);
mainLayout->setContentsMargins({});
auto widget = new QWidget(this);
mainLayout->addWidget(widget);
d->mLayout = new QGridLayout(widget);
d->mLayout->setContentsMargins(0, 0, 0, 0);
d->mLayout->setContentsMargins({});
d->mComboBox = new QComboBox(widget);
d->mComboBox->setMinimumWidth(50);
......
......@@ -70,7 +70,7 @@ public:
*/
Q_REQUIRED_RESULT QString argsAsString() const override;
bool argsFromStringInteractive(const QString &argsStr, const QString &filterName) override;
Q_REQUIRED_RESULT bool argsFromStringInteractive(const QString &argsStr, const QString &filterName) override;
Q_REQUIRED_RESULT QString argsAsStringReal() const override;
......
......@@ -18,7 +18,7 @@ public:
/**
* @copydoc FilterAction::FilterAction
*/
FilterActionWithTest(const QString &name, const QString &label, QObject *parent = nullptr);
explicit FilterActionWithTest(const QString &name, const QString &label, QObject *parent = nullptr);
/**
* @copydoc FilterAction::~FilterAction
......
......@@ -46,7 +46,7 @@ QWidget *FilterActionWithUrl::createParamWidget(QWidget *parent) const
{
auto widget = new QWidget(parent);
auto layout = new QHBoxLayout;
layout->setContentsMargins(0, 0, 0, 0);
layout->setContentsMargins({});
layout->setSpacing(0);
widget->setLayout(layout);
auto requester = new KUrlRequester(parent);
......
......@@ -18,7 +18,7 @@ public:
explicit FilterconverttosievePurposeMenuWidget(QWidget *parentWidget, QObject *parent = nullptr);
~FilterconverttosievePurposeMenuWidget() override;
QByteArray text() override;
Q_REQUIRED_RESULT QByteArray text() override;
void setEditorWidget(KPIMTextEdit::PlainTextEditor *editor);
private:
......
......@@ -39,7 +39,7 @@ public:
ClawsMailFilter = 6,
IcedoveFilter = 7,
GmailFilter = 8,
SeaMonkeyFilter = 9
SeaMonkeyFilter = 9,
};
/**
......
......@@ -50,13 +50,13 @@ public:
/**
* Returns whether the filter manager is in a usable state.
*/
bool isValid() const;
Q_REQUIRED_RESULT bool isValid() const;
/**
* Checks for existing filters with the @p name and extend the
* "name" to "name (i)" until no match is found for i=1..n
*/
QString createUniqueFilterName(const QString &name) const;
Q_REQUIRED_RESULT QString createUniqueFilterName(const QString &name) const;
/**
* Returns the global filter action dictionary.
......
......@@ -27,7 +27,7 @@ public:
explicit FilterSelectionDialog(QWidget *parent = nullptr);
~FilterSelectionDialog() override;
void setFilters(const QVector<MailFilter *> &filters);
QVector<MailFilter *> selectedFilters() const;
Q_REQUIRED_RESULT QVector<MailFilter *> selectedFilters() const;
public Q_SLOTS:
void slotUnselectAllButton();
......
......@@ -34,7 +34,7 @@ InvalidFilterDialog::InvalidFilterDialog(QWidget *parent)
auto w = new QWidget(this);
auto vbox = new QVBoxLayout;
vbox->setContentsMargins(0, 0, 0, 0);
vbox->setContentsMargins({});
w->setLayout(vbox);
mInvalidFilterWidget = new InvalidFilterWidget(this);
mInvalidFilterWidget->setObjectName(QStringLiteral("invalid_filter_widget"));
......
......@@ -14,9 +14,10 @@ using namespace MailCommon;
InvalidFilterWidget::InvalidFilterWidget(QWidget *parent)
: QWidget(parent)
, mInvalidFilterListWidget(new InvalidFilterListView(this))
{
auto vbox = new QVBoxLayout(this);
vbox->setContentsMargins(0, 0, 0, 0);
vbox->setContentsMargins({});
auto lab =
new QLabel(i18n("The following filters are invalid (e.g. containing no actions "
"or no search rules). Discard or edit invalid filters?"));
......@@ -24,7 +25,6 @@ InvalidFilterWidget::InvalidFilterWidget(QWidget *parent)
lab->setObjectName(QStringLiteral("label"));
vbox->addWidget(lab);
mInvalidFilterListWidget = new InvalidFilterListView(this);
mInvalidFilterListWidget->setObjectName(QStringLiteral("invalidfilterlist"));
connect(mInvalidFilterListWidget, &InvalidFilterListView::showDetails, this, &InvalidFilterWidget::showDetails);
connect(mInvalidFilterListWidget, &InvalidFilterListView::hideInformationWidget, this, &InvalidFilterWidget::hideInformationWidget);
......
......@@ -30,7 +30,7 @@ Q_SIGNALS:
void hideInformationWidget();
private:
InvalidFilterListView *mInvalidFilterListWidget = nullptr;
InvalidFilterListView *const mInvalidFilterListWidget;
};
}
......@@ -46,7 +46,7 @@ public:
* Returns the target collection the item should be moved to, or an invalid
* collection if the item should not be moved at all.
*/
Akonadi::Collection moveTargetCollection() const;
Q_REQUIRED_RESULT Akonadi::Collection moveTargetCollection() const;
/**
* Marks that the item's payload has been changed and needs to be written back.
......@@ -56,7 +56,7 @@ public:
/**
* Returns whether the item's payload needs to be written back.
*/
bool needsPayloadStore() const;
Q_REQUIRED_RESULT bool needsPayloadStore() const;
/**
* Marks that the item's flags has been changed and needs to be written back.
......@@ -66,14 +66,14 @@ public:
/**
* Returns whether the item's flags needs to be written back.
*/
bool needsFlagStore() const;
Q_REQUIRED_RESULT bool needsFlagStore() const;
/** Returns true if the full payload was requested for the item or not.
* Full payload is needed to change the headers or the body */
bool needsFullPayload() const;
Q_REQUIRED_RESULT bool needsFullPayload() const;
void setDeleteItem();
bool deleteItem() const;
Q_REQUIRED_RESULT bool deleteItem() const;
private:
enum ItemContextAction { None = 0, PlayloadStore = 1, FlagStore = 2, DeleteItem = 4, FullPayload = 8 };
......
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