Commit 0c30f2e4 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Const'ify pointer + use Q_REQUIRED_RESULT

parent 21cf7955
Pipeline #75802 passed with stage
in 53 minutes and 55 seconds
......@@ -16,6 +16,7 @@ using namespace MailMerge;
MailMergeDialog::MailMergeDialog(QWidget *parent)
: QDialog(parent)
, mMailMergeWidget(new MailMergeWidget(this))
, mPreview(new QPushButton(i18n("Preview"), this))
{
auto mainLayout = new QVBoxLayout(this);
setWindowTitle(i18nc("@title:window", "Mail Merge"));
......@@ -31,7 +32,7 @@ MailMergeDialog::MailMergeDialog(QWidget *parent)
connect(buttonBox, &QDialogButtonBox::accepted, this, &MailMergeDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &MailMergeDialog::reject);
mainLayout->addWidget(buttonBox);
mPreview = new QPushButton(i18n("Preview"), this);
buttonBox->addButton(mPreview, QDialogButtonBox::ActionRole);
connect(mPreview, &QPushButton::clicked, this, &MailMergeDialog::slotPreview);
mainLayout->addStretch();
......
......@@ -21,7 +21,7 @@ public:
private:
void slotPreview();
MailMergeWidget *const mMailMergeWidget;
QPushButton *mPreview = nullptr;
QPushButton *const mPreview;
};
}
......@@ -14,6 +14,7 @@ using namespace MailMerge;
SelectAttachmentDialog::SelectAttachmentDialog(QWidget *parent)
: QDialog(parent)
, mUrlRequester(new KUrlRequester(this))
{
setWindowTitle(i18nc("@title:window", "Attachment"));
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
......@@ -30,7 +31,6 @@ SelectAttachmentDialog::SelectAttachmentDialog(QWidget *parent)
auto lab = new QLabel(i18n("Select attachment:"), this);
lab->setObjectName(QStringLiteral("selectattachment_label"));
vbox->addWidget(lab);
mUrlRequester = new KUrlRequester(this);
mUrlRequester->setMode(KFile::LocalOnly | KFile::ExistingOnly);
mUrlRequester->setObjectName(QStringLiteral("urlrequester"));
vbox->addWidget(mUrlRequester);
......
......@@ -22,7 +22,7 @@ public:
Q_REQUIRED_RESULT QString attachmentPath() const;
private:
KUrlRequester *mUrlRequester = nullptr;
KUrlRequester *const mUrlRequester;
};
}
......@@ -24,7 +24,7 @@ public:
~EmailAddressSelectionLdapDialog() override;
Q_REQUIRED_RESULT Akonadi::EmailAddressSelection::List selectedAddresses() const override;
Akonadi::EmailAddressSelectionWidget *view() const override;
Q_REQUIRED_RESULT Akonadi::EmailAddressSelectionWidget *view() const override;
private:
void writeConfig();
......
......@@ -37,17 +37,17 @@ public:
static HebrewDate fromSecular(int year, int month, int day);
static HebrewDate fromHebrew(int year, int month, int day);
int year() const;
int month() const;
int day() const;
int dayOfWeek() const;
int hebrewMonthLength() const;
int secularMonthLength() const;
bool isOnHebrewLeapYear() const;
bool isOnSecularLeapYear() const;
int kvia() const;
int hebrewDayNumber() const;
Q_REQUIRED_RESULT int year() const;
Q_REQUIRED_RESULT int month() const;
Q_REQUIRED_RESULT int day() const;
Q_REQUIRED_RESULT int dayOfWeek() const;
Q_REQUIRED_RESULT int hebrewMonthLength() const;
Q_REQUIRED_RESULT int secularMonthLength() const;
Q_REQUIRED_RESULT bool isOnHebrewLeapYear() const;
Q_REQUIRED_RESULT bool isOnSecularLeapYear() const;
Q_REQUIRED_RESULT int kvia() const;
Q_REQUIRED_RESULT int hebrewDayNumber() const;
private:
int mYear, mMonth, mDay, mDayOfWeek;
......
......@@ -23,6 +23,7 @@
ConfigDialog::ConfigDialog(QWidget *parent)
: QDialog(parent)
, mAspectRatioGroup(new QButtonGroup(this))
{
setWindowTitle(i18nc("@title:window", "Configure Picture of the Day"));
auto mainLayout = new QVBoxLayout(this);
......@@ -42,7 +43,6 @@ ConfigDialog::ConfigDialog(QWidget *parent)
topLayout->addWidget(aspectRatioBox);
auto groupLayout = new QVBoxLayout(aspectRatioBox);
mAspectRatioGroup = new QButtonGroup(this);
auto btn = new QRadioButton(i18n("Ignore aspect ratio"), aspectRatioBox);
btn->setWhatsThis(
i18n("The thumbnail will be scaled freely. "
......
......@@ -27,6 +27,6 @@ protected Q_SLOTS:
void slotOk();
private:
QButtonGroup *mAspectRatioGroup = nullptr;
QButtonGroup *const mAspectRatioGroup;
};
......@@ -56,7 +56,7 @@ public:
/**
Returns the thumbnail URL for a given width corresponding to a full-size image URL. */
QUrl thumbnailUrl(const QUrl &fullSizeUrl, const int width = 0) const;
Q_REQUIRED_RESULT QUrl thumbnailUrl(const QUrl &fullSizeUrl, const int width = 0) const;
Q_SIGNALS:
void gotNewPixmap(const QPixmap &) const;
......
......@@ -20,12 +20,12 @@ public:
{
}
Element::List createDayElements(const QDate &) override;
Element::List createMonthElements(const QDate &) override;
Q_REQUIRED_RESULT Element::List createDayElements(const QDate &) override;
Q_REQUIRED_RESULT Element::List createMonthElements(const QDate &) override;
// void configure( QWidget *parent );
QString info() const override;
Q_REQUIRED_RESULT QString info() const override;
};
class ThisDayInHistoryFactory : public DecorationFactory
......
......@@ -17,15 +17,15 @@
FolderConfigureTreeWidget::FolderConfigureTreeWidget(QWidget *parent)
: QWidget(parent)
, mFolderSettingFilterProxyModel(new FolderSettingFilterProxyModel(this))
, mFolderTreeWidget(new MailCommon::FolderTreeWidget(this,
nullptr,
MailCommon::FolderTreeWidget::TreeViewOptions(MailCommon::FolderTreeWidget::UseDistinctSelectionModel
| MailCommon::FolderTreeWidget::HideStatistics
| MailCommon::FolderTreeWidget::HideHeaderViewMenu)))
{
auto mainLayout = new QVBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainLayout"));
mainLayout->setContentsMargins({});
mFolderTreeWidget = new MailCommon::FolderTreeWidget(this,
nullptr,
MailCommon::FolderTreeWidget::TreeViewOptions(MailCommon::FolderTreeWidget::UseDistinctSelectionModel
| MailCommon::FolderTreeWidget::HideStatistics
| MailCommon::FolderTreeWidget::HideHeaderViewMenu));
mFolderTreeWidget->setObjectName(QStringLiteral("foldertreewidget"));
mFolderTreeWidget->folderTreeView()->setDragEnabled(false);
mFolderTreeWidget->folderTreeView()->setSelectionMode(QAbstractItemView::ExtendedSelection);
......
......@@ -26,6 +26,6 @@ private:
void slotCustomContextMenuRequested(const QPoint &);
void changeFolderSelection(bool select);
FolderSettingFilterProxyModel *const mFolderSettingFilterProxyModel;
MailCommon::FolderTreeWidget *mFolderTreeWidget = nullptr;
MailCommon::FolderTreeWidget *const mFolderTreeWidget;
};
......@@ -22,10 +22,10 @@ public:
HeaderStyle *headerStyle() const override;
HeaderStrategy *headerStrategy() const override;
HeaderStyleInterface *createView(KActionMenu *menu, QActionGroup *actionGroup, KActionCollection *ac, QObject *parent = nullptr) override;
QString name() const override;
bool hasMargin() const override;
QString alignment() const override;
int elidedTextSize() const override;
Q_REQUIRED_RESULT QString name() const override;
Q_REQUIRED_RESULT bool hasMargin() const override;
Q_REQUIRED_RESULT QString alignment() const override;
Q_REQUIRED_RESULT int elidedTextSize() const override;
private:
HeaderStyle *const mHeaderStyle;
......
......@@ -21,7 +21,7 @@ public:
public:
const char *name() const override;
QString format(KMime::Message *message) const override;
Q_REQUIRED_RESULT QString format(KMime::Message *message) const override;
private:
MessageViewer::HeaderStyleUtil mHeaderStyleUtil;
......
......@@ -22,12 +22,12 @@ public:
HeaderStyle *headerStyle() const override;
HeaderStrategy *headerStrategy() const override;
HeaderStyleInterface *createView(KActionMenu *menu, QActionGroup *actionGroup, KActionCollection *ac, QObject *parent = nullptr) override;
QString name() const override;
int elidedTextSize() const override;
QString extraScreenCss(const QString &headerFont) const override;
QString extraPrintCss(const QString &headerFont) const override;
QString extraCommonCss(const QString &headerFont) const override;
QString attachmentHtml() const override;
Q_REQUIRED_RESULT QString name() const override;
Q_REQUIRED_RESULT int elidedTextSize() const override;
Q_REQUIRED_RESULT QString extraScreenCss(const QString &headerFont) const override;
Q_REQUIRED_RESULT QString extraPrintCss(const QString &headerFont) const override;
Q_REQUIRED_RESULT QString extraCommonCss(const QString &headerFont) const override;
Q_REQUIRED_RESULT QString attachmentHtml() const override;
private:
HeaderStyle *const mHeaderStyle;
......
......@@ -19,10 +19,10 @@ public:
explicit GrantleeHeaderStylePlugin(QObject *parent = nullptr, const QList<QVariant> & = QList<QVariant>());
~GrantleeHeaderStylePlugin() override;
HeaderStyle *headerStyle() const override;
HeaderStrategy *headerStrategy() const override;
HeaderStyleInterface *createView(KActionMenu *menu, QActionGroup *actionGroup, KActionCollection *ac, QObject *parent = nullptr) override;
QString name() const override;
Q_REQUIRED_RESULT HeaderStyle *headerStyle() const override;
Q_REQUIRED_RESULT HeaderStrategy *headerStrategy() const override;
Q_REQUIRED_RESULT HeaderStyleInterface *createView(KActionMenu *menu, QActionGroup *actionGroup, KActionCollection *ac, QObject *parent = nullptr) override;
Q_REQUIRED_RESULT QString name() const override;
private:
HeaderStyle *const mHeaderStyle;
......
......@@ -19,10 +19,10 @@ public:
explicit LongHeaderStylePlugin(QObject *parent = nullptr, const QList<QVariant> & = QList<QVariant>());
~LongHeaderStylePlugin() override;
HeaderStyle *headerStyle() const override;
HeaderStrategy *headerStrategy() const override;
HeaderStyleInterface *createView(KActionMenu *menu, QActionGroup *actionGroup, KActionCollection *ac, QObject *parent = nullptr) override;
QString name() const override;
Q_REQUIRED_RESULT HeaderStyle *headerStyle() const override;
Q_REQUIRED_RESULT HeaderStrategy *headerStrategy() const override;
Q_REQUIRED_RESULT HeaderStyleInterface *createView(KActionMenu *menu, QActionGroup *actionGroup, KActionCollection *ac, QObject *parent = nullptr) override;
Q_REQUIRED_RESULT QString name() const override;
private:
HeaderStyle *const mHeaderStyle;
......
......@@ -19,10 +19,10 @@ public:
explicit StandardsHeaderStylePlugin(QObject *parent = nullptr, const QList<QVariant> & = QList<QVariant>());
~StandardsHeaderStylePlugin() override;
HeaderStyle *headerStyle() const override;
HeaderStrategy *headerStrategy() const override;
HeaderStyleInterface *createView(KActionMenu *menu, QActionGroup *actionGroup, KActionCollection *ac, QObject *parent = nullptr) override;
QString name() const override;
Q_REQUIRED_RESULT HeaderStyle *headerStyle() const override;
Q_REQUIRED_RESULT HeaderStrategy *headerStrategy() const override;
Q_REQUIRED_RESULT HeaderStyleInterface *createView(KActionMenu *menu, QActionGroup *actionGroup, KActionCollection *ac, QObject *parent = nullptr) override;
Q_REQUIRED_RESULT QString name() const override;
private:
HeaderStyle *const mHeaderStyle;
......
......@@ -38,6 +38,11 @@ using namespace MessageViewer;
EventEdit::EventEdit(QWidget *parent)
: QWidget(parent)
, mEventEdit(new QLineEdit(this))
, mStartDateTimeEdit(new EventDateTimeWidget(this))
, mEndDateTimeEdit(new EventDateTimeWidget(this))
, mSaveButton(new QPushButton(QIcon::fromTheme(QStringLiteral("appointment-new")), i18n("&Save"), this))
, mOpenEditorButton(new QPushButton(i18n("Open &Editor..."), this))
{
auto vbox = new QVBoxLayout(this);
vbox->setContentsMargins(5, 5, 5, 5);
......@@ -51,7 +56,6 @@ EventEdit::EventEdit(QWidget *parent)
auto lab = new QLabel(i18n("Event:"), this);
hbox->addWidget(lab);
mEventEdit = new QLineEdit(this);
mEventEdit->setClearButtonEnabled(true);
mEventEdit->setObjectName(QStringLiteral("eventedit"));
mEventEdit->setFocus();
......@@ -85,7 +89,6 @@ EventEdit::EventEdit(QWidget *parent)
lab = new QLabel(i18n("Start:"), this);
hbox->addWidget(lab);
QDateTime currentDateTime = QDateTime::currentDateTime();
mStartDateTimeEdit = new EventDateTimeWidget(this);
mStartDateTimeEdit->setObjectName(QStringLiteral("startdatetimeedit"));
mStartDateTimeEdit->setDateTime(currentDateTime);
#ifndef QT_NO_ACCESSIBILITY
......@@ -98,7 +101,6 @@ EventEdit::EventEdit(QWidget *parent)
lab = new QLabel(i18n("End:"), this);
hbox->addWidget(lab);
mEndDateTimeEdit = new EventDateTimeWidget(this);
mEndDateTimeEdit->setObjectName(QStringLiteral("enddatetimeedit"));
mEndDateTimeEdit->setDateTime(currentDateTime.addSecs(3600));
#ifndef QT_NO_ACCESSIBILITY
......@@ -117,7 +119,6 @@ EventEdit::EventEdit(QWidget *parent)
hbox->addStretch(1);
mSaveButton = new QPushButton(QIcon::fromTheme(QStringLiteral("appointment-new")), i18n("&Save"), this);
mSaveButton->setObjectName(QStringLiteral("save-button"));
mSaveButton->setEnabled(false);
#ifndef QT_NO_ACCESSIBILITY
......@@ -126,7 +127,6 @@ EventEdit::EventEdit(QWidget *parent)
connect(mSaveButton, &QPushButton::clicked, this, &EventEdit::slotReturnPressed);
hbox->addWidget(mSaveButton);
mOpenEditorButton = new QPushButton(i18n("Open &Editor..."), this);
#ifndef QT_NO_ACCESSIBILITY
mOpenEditorButton->setAccessibleDescription(i18n("Open event editor, where more details can be changed."));
#endif
......
......@@ -63,12 +63,12 @@ private:
void comboboxRowInserted();
Akonadi::Collection mCollection;
KMime::Message::Ptr mMessage;
QLineEdit *mEventEdit = nullptr;
QLineEdit *const mEventEdit;
Akonadi::CollectionComboBox *mCollectionCombobox = nullptr;
EventDateTimeWidget *mStartDateTimeEdit = nullptr;
EventDateTimeWidget *mEndDateTimeEdit = nullptr;
QPushButton *mSaveButton = nullptr;
QPushButton *mOpenEditorButton = nullptr;
EventDateTimeWidget *const mStartDateTimeEdit;
EventDateTimeWidget *const mEndDateTimeEdit;
QPushButton *const mSaveButton;
QPushButton *const mOpenEditorButton;
};
}
Supports Markdown
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