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

wilder-portage
Laurent Montel 5 years ago
parent 1c5cc9542b
commit 2374d3fc38
  1. 2
      src/collectionpage/collectionexpirywidget.cpp
  2. 2
      src/collectionpage/collectiontemplateswidget.cpp
  3. 2
      src/filter/filteractions/filteractionaddheader.cpp
  4. 4
      src/filter/filteractions/filteractionaddheader.h
  5. 2
      src/filter/filteractions/filteractionaddtoaddressbook.h
  6. 2
      src/filter/filteractions/filteractionforward.cpp
  7. 2
      src/filter/filteractions/filteractionrewriteheader.cpp
  8. 4
      src/filter/filteractions/filteractionsettransport.h
  9. 4
      src/filter/filteractions/filteractionwidget.cpp
  10. 2
      src/filter/filteractions/filteractionwithfolder.h
  11. 2
      src/filter/filteractions/filteractionwithtest.h
  12. 2
      src/filter/filteractions/filteractionwithurl.cpp
  13. 2
      src/filter/filterconverter/filterconverttosievepurposemenuwidget.h
  14. 2
      src/filter/filterimporterexporter.h
  15. 4
      src/filter/filtermanager.h
  16. 2
      src/filter/filterselectiondialog.h
  17. 2
      src/filter/invalidfilters/invalidfilterdialog.cpp
  18. 4
      src/filter/invalidfilters/invalidfilterwidget.cpp
  19. 2
      src/filter/invalidfilters/invalidfilterwidget.h
  20. 10
      src/filter/itemcontext.h
  21. 2
      src/filter/kmfilteraccountlist.h
  22. 4
      src/filter/kmfilterdialog.cpp
  23. 6
      src/filter/kmfilterlistbox.cpp
  24. 2
      src/filter/kmfilterlistbox.h
  25. 3
      src/filter/mdnadvicedialog.cpp
  26. 2
      src/filter/soundtestwidget.cpp
  27. 4
      src/folder/accountconfigorderdialog.cpp
  28. 2
      src/folder/folderrequester.cpp
  29. 2
      src/folder/foldertreewidget.cpp
  30. 4
      src/search/searchpatternedit.cpp
  31. 2
      src/snippets/snippetattachmentwidget.cpp
  32. 6
      src/snippets/snippetcustomfileattachmentnamewidget.cpp
  33. 2
      src/snippets/snippetselectattachmentwidget.cpp
  34. 2
      src/snippets/snippetwidget.cpp
  35. 2
      src/tag/tagwidget.cpp
  36. 2
      src/widgets/redirectdialog.cpp
  37. 2
      src/widgets/redirectwidget.cpp

@ -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 };

@ -24,7 +24,7 @@ public:
void applyOnAccount(MailCommon::MailFilter *filter);
void applyOnAccount(const QStringList &lst);
QStringList selectedAccount();
Q_REQUIRED_RESULT QStringList selectedAccount();
};
}

@ -149,10 +149,10 @@ KMFilterDialog::KMFilterDialog(const QList<KActionCollection *> &actionCollectio
mainLayout->addWidget(w);
mainLayout->addWidget(buttonBox);
auto topVLayout = new QVBoxLayout(w);
topVLayout->setContentsMargins(0, 0, 0, 0);
topVLayout->setContentsMargins({});
auto topLayout = new QHBoxLayout;
topVLayout->addLayout(topLayout);
topLayout->setContentsMargins(0, 0, 0, 0);
topLayout->setContentsMargins({});
auto splitter = new QSplitter;
splitter->setChildrenCollapsible(false);

@ -120,7 +120,7 @@ KMFilterListBox::KMFilterListBox(const QString &title, QWidget *parent)
//----------- the first row of buttons
auto hb = new QWidget(this);
auto hbHBoxLayout = new QHBoxLayout(hb);
hbHBoxLayout->setContentsMargins(0, 0, 0, 0);
hbHBoxLayout->setContentsMargins({});
hbHBoxLayout->setSpacing(4);
mBtnTop = new QPushButton(QString(), hb);
@ -158,7 +158,7 @@ KMFilterListBox::KMFilterListBox(const QString &title, QWidget *parent)
//----------- the second row of buttons
hb = new QWidget(this);
hbHBoxLayout = new QHBoxLayout(hb);
hbHBoxLayout->setContentsMargins(0, 0, 0, 0);
hbHBoxLayout->setContentsMargins({});
hbHBoxLayout->setSpacing(4);
mBtnNew = new QPushButton(hb);
hbHBoxLayout->addWidget(mBtnNew);
@ -831,7 +831,7 @@ void QListWidgetFilterItem::setFilter(MailCommon::MailFilter *filter)
setCheckState(filter->isEnabled() ? Qt::Checked : Qt::Unchecked);
}
MailCommon::MailFilter *QListWidgetFilterItem::filter()
MailCommon::MailFilter *QListWidgetFilterItem::filter() const
{
return mFilter;
}

@ -49,7 +49,7 @@ public:
~QListWidgetFilterItem() override;
void setFilter(MailCommon::MailFilter *filter);
MailCommon::MailFilter *filter();
Q_REQUIRED_RESULT MailCommon::MailFilter *filter() const;
private:
MailCommon::MailFilter *mFilter = nullptr;

@ -19,9 +19,8 @@ MDNAdviceDialog::MDNAdviceDialog(const QString &text, bool canDeny, QWidget *par
: QDialog(parent)
{
setWindowTitle(i18nc("@title:window", "Message Disposition Notification Request"));
QPushButton *user1Button = nullptr;
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Yes, this);
user1Button = new QPushButton;
QPushButton *user1Button = new QPushButton;
buttonBox->addButton(user1Button, QDialogButtonBox::ActionRole);
connect(user1Button, &QPushButton::clicked, this, &MDNAdviceDialog::slotUser1Clicked);
if (canDeny) {

@ -25,7 +25,7 @@ SoundTestWidget::SoundTestWidget(QWidget *parent)
: QWidget(parent)
{
auto layout = new QHBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->setContentsMargins({});
m_playButton = new QPushButton(this);
m_playButton->setIcon(QIcon::fromTheme(QStringLiteral("media-playback-start")));

@ -65,7 +65,7 @@ AccountConfigOrderDialog::AccountConfigOrderDialog(MailCommon::MailCommonSetting
mainLayout->addWidget(buttonBox);
auto vbox = new QVBoxLayout;
vbox->setContentsMargins(0, 0, 0, 0);
vbox->setContentsMargins({});
page->setLayout(vbox);
d->mEnableAccountOrder = new QCheckBox(i18n("Use custom order"), this);
@ -81,7 +81,7 @@ AccountConfigOrderDialog::AccountConfigOrderDialog(MailCommon::MailCommonSetting
auto upDownBox = new QWidget(page);
auto upDownBoxVBoxLayout = new QVBoxLayout(upDownBox);
upDownBoxVBoxLayout->setContentsMargins(0, 0, 0, 0);
upDownBoxVBoxLayout->setContentsMargins({});
d->mUpButton = new QPushButton(upDownBox);
upDownBoxVBoxLayout->addWidget(d->mUpButton);
d->mUpButton->setIcon(QIcon::fromTheme(QStringLiteral("go-up")));

@ -39,7 +39,7 @@ FolderRequester::FolderRequester(QWidget *parent)
, d(new MailCommon::FolderRequesterPrivate)
{
auto hlay = new QHBoxLayout(this);
hlay->setContentsMargins(0, 0, 0, 0);
hlay->setContentsMargins({});
d->mEdit = new QLineEdit(this);
d->mEdit->setPlaceholderText(i18n("Select Folder"));

@ -73,7 +73,7 @@ FolderTreeWidget::FolderTreeWidget(QWidget *parent,
connect(d->folderTreeView, &FolderTreeView::manualSortingChanged, this, &FolderTreeWidget::slotManualSortingChanged);
auto lay = new QVBoxLayout(this);
lay->setContentsMargins(0, 0, 0, 0);
lay->setContentsMargins({});
d->label = new QLabel(i18n("You can start typing to filter the list of folders."), this);
lay->addWidget(d->label);

@ -136,7 +136,7 @@ void SearchRuleWidget::setPatternEditOptions(SearchPatternEdit::SearchPatternEdi
void SearchRuleWidget::initWidget(SearchPatternEdit::SearchModeType modeType)
{
auto hlay = new QHBoxLayout(this);
hlay->setContentsMargins(0, 0, 0, 0);
hlay->setContentsMargins({});
// initialize the header field combo box
mRuleField = new KComboBox(this);
@ -581,7 +581,7 @@ void SearchPatternEdit::setPatternEditOptions(SearchPatternEdit::SearchPatternEd
void SearchPatternEdit::initLayout(SearchPatternEditOptions options, SearchModeType modeType)
{
auto layout = new QFormLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->setContentsMargins({});
const bool matchAllMessages = (options & MailCommon::SearchPatternEdit::MatchAllMessages);
//------------the radio buttons

@ -19,7 +19,7 @@ SnippetAttachmentWidget::SnippetAttachmentWidget(QWidget *parent)
{
auto layout = new QHBoxLayout(this);
layout->setObjectName(QStringLiteral("layout"));
layout->setContentsMargins(0, 0, 0, 0);
layout->setContentsMargins({});
mLineEdit = new QLineEdit(this);
mLineEdit->setObjectName(QStringLiteral("lineedit"));

@ -19,11 +19,11 @@ SnippetCustomFileAttachmentNameWidget::SnippetCustomFileAttachmentNameWidget(QWi
{
auto mainLayout = new QVBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainLayout"));
mainLayout->setContentsMargins(0, 0, 0, 0);
mainLayout->setContentsMargins({});
auto lineEditLayout = new QHBoxLayout;
lineEditLayout->setObjectName(QStringLiteral("lineEditLayout"));
lineEditLayout->setContentsMargins(0, 0, 0, 0);
lineEditLayout->setContentsMargins({});
auto label = new QLabel(i18n("Filename:"), this);
label->setObjectName(QStringLiteral("label"));
@ -37,7 +37,7 @@ SnippetCustomFileAttachmentNameWidget::SnippetCustomFileAttachmentNameWidget(QWi
auto convertMenuLayout = new QHBoxLayout;
convertMenuLayout->setObjectName(QStringLiteral("convertMenuLayout"));
convertMenuLayout->setContentsMargins(0, 0, 0, 0);
convertMenuLayout->setContentsMargins({});
convertMenuLayout->addStretch(1);
mConvertMenu = new MessageComposer::ConvertSnippetVariableMenu(true, mLineEdit, this);

@ -17,7 +17,7 @@ SnippetSelectAttachmentWidget::SnippetSelectAttachmentWidget(QWidget *parent)
{
auto mainLayout = new QVBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainLayout"));
mainLayout->setContentsMargins(0, 0, 0, 0);
mainLayout->setContentsMargins({});
mEditor = new SnippetSelectorWidget(this);
mEditor->setObjectName(QStringLiteral("editor"));

@ -31,7 +31,7 @@ SnippetWidget::SnippetWidget(QWidget *parent)
{
auto layout = new QVBoxLayout(this);
layout->setObjectName(QStringLiteral("mainlayout"));
layout->setContentsMargins(0, 0, 0, 0);
layout->setContentsMargins({});
d->wdg = new QWidget(this);
d->mUi.setupUi(d->wdg);
layout->addWidget(d->wdg);

@ -50,7 +50,7 @@ TagWidget::TagWidget(const QList<KActionCollection *> &actionCollections, QWidge
, d(new MailCommon::TagWidgetPrivate)
{
auto settings = new QGridLayout(this);
settings->setContentsMargins(0, 0, 0, 0);
settings->setContentsMargins({});
// Stretcher layout for adding some space after the label
auto spacer = new QVBoxLayout();

@ -116,7 +116,7 @@ RedirectDialog::RedirectDialog(SendMode mode, QWidget *parent)
auto mainLayout = new QVBoxLayout;
mainWidget->setLayout(mainLayout);
mainLayout->setContentsMargins(0, 0, 0, 0);
mainLayout->setContentsMargins({});
auto LabelTo = new QLabel(i18n("Select the recipient addresses to redirect to:"));
mainLayout->addWidget(LabelTo);

@ -25,7 +25,7 @@ RedirectWidget::RedirectWidget(QWidget *parent)
{
auto hbox = new QHBoxLayout(this);
hbox->setSpacing(0);
hbox->setContentsMargins(0, 0, 0, 0);
hbox->setContentsMargins({});
hbox->setAlignment(Qt::AlignRight);
mEdit = new MessageComposer::ComposerLineEdit(true);

Loading…
Cancel
Save