Commit 16eb95fd authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Modernize code

parent 15890204
Pipeline #100226 failed with stage
in 5 minutes and 57 seconds
......@@ -149,7 +149,7 @@ QStringList availablePresets(AlarmPresets::When when)
case AlarmPresets::BeforeEnd:
return *sBeforeEndPresetNames;
}
return QStringList();
return {};
}
KCalendarCore::Alarm::Ptr preset(When when, const QString &name)
......@@ -172,7 +172,7 @@ KCalendarCore::Alarm::Ptr preset(When when, const QString &name)
return KCalendarCore::Alarm::Ptr(new KCalendarCore::Alarm(*sBeforeEndPresets->at(sBeforeEndPresetNames->indexOf(name))));
}
return KCalendarCore::Alarm::Ptr();
return {};
}
KCalendarCore::Alarm::Ptr defaultAlarm(When when)
......@@ -185,7 +185,7 @@ KCalendarCore::Alarm::Ptr defaultAlarm(When when)
case AlarmPresets::BeforeEnd:
return Alarm::Ptr(new Alarm(*sBeforeEndPresets->at(sDefaultPresetIndex)));
}
return Alarm::Ptr();
return {};
}
int presetIndex(When when, const KCalendarCore::Alarm::Ptr &alarm)
......
......@@ -46,9 +46,7 @@ AttachmentIconItem::AttachmentIconItem(const KCalendarCore::Attachment &att, QLi
setFlags(flags() | Qt::ItemIsDragEnabled);
}
AttachmentIconItem::~AttachmentIconItem()
{
}
AttachmentIconItem::~AttachmentIconItem() = default;
KCalendarCore::Attachment AttachmentIconItem::attachment() const
{
......
......@@ -76,9 +76,7 @@ public:
enum AttendeeActions { EventActions, TodoActions };
explicit AttendeeLine(QWidget *parent);
~AttendeeLine() override
{
}
~AttendeeLine() override = default;
void activate() override;
bool isActive() const override;
......
......@@ -42,11 +42,11 @@ Qt::ItemFlags AttendeeTableModel::flags(const QModelIndex &index) const
QVariant AttendeeTableModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid()) {
return QVariant();
return {};
}
if (index.row() >= mAttendeeList.size()) {
return QVariant();
return {};
}
const KCalendarCore::Attendee attendee = mAttendeeList[index.row()];
......@@ -90,7 +90,7 @@ QVariant AttendeeTableModel::data(const QModelIndex &index, int role) const
if (role == AttendeeRole) {
return QVariant::fromValue(attendee);
}
return QVariant();
return {};
}
bool AttendeeTableModel::setData(const QModelIndex &index, const QVariant &value, int role)
......@@ -142,7 +142,7 @@ bool AttendeeTableModel::setData(const QModelIndex &index, const QVariant &value
QVariant AttendeeTableModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (role != Qt::DisplayRole) {
return QVariant();
return {};
}
if (orientation == Qt::Horizontal) {
......@@ -166,7 +166,7 @@ QVariant AttendeeTableModel::headerData(int section, Qt::Orientation orientation
}
}
return QVariant();
return {};
}
bool AttendeeTableModel::insertRows(int position, int rows, const QModelIndex &parent)
......
......@@ -55,7 +55,7 @@ QString EditorConfig::fullName() const
if (EditorConfigPrivate::config != this) {
return EditorConfigPrivate::config->fullName();
}
return QString();
return {};
}
QString EditorConfig::email() const
......@@ -63,7 +63,7 @@ QString EditorConfig::email() const
if (EditorConfigPrivate::config != this) {
return EditorConfigPrivate::config->email();
}
return QString();
return {};
}
bool EditorConfig::thatIsMe(const QString &mail) const
......@@ -93,7 +93,7 @@ QStringList EditorConfig::fullEmails() const
if (EditorConfigPrivate::config != this) {
return EditorConfigPrivate::config->fullEmails();
}
return QStringList();
return {};
}
bool EditorConfig::showTimeZoneSelectorInIncidenceEditor() const
......
......@@ -74,7 +74,7 @@ public:
Q_REQUIRED_RESULT virtual QUrl audioFilePath() const
{
return QUrl();
return {};
}
Q_REQUIRED_RESULT virtual int reminderTime() const
......@@ -99,7 +99,7 @@ public:
Q_REQUIRED_RESULT virtual QStringList activeDesignerFields() const
{
return QStringList();
return {};
}
Q_REQUIRED_RESULT virtual QStringList &templates(KCalendarCore::IncidenceBase::IncidenceType type);
......
......@@ -279,7 +279,7 @@ Akonadi::Item EditorItemManager::item(ItemState state) const
}
qCDebug(INCIDENCEEDITOR_LOG) << "state = " << state;
Q_ASSERT_X(false, "EditorItemManager::item", "Unknown enum value");
return Akonadi::Item();
return {};
}
void EditorItemManager::load(const Akonadi::Item &item)
......@@ -348,9 +348,7 @@ void EditorItemManager::setIsCounterProposal(bool isCounterProposal)
d->mIsCounterProposal = isCounterProposal;
}
ItemEditorUi::~ItemEditorUi()
{
}
ItemEditorUi::~ItemEditorUi() = default;
bool ItemEditorUi::isValid() const
{
......
......@@ -25,7 +25,7 @@ FreeBusyGanttProxyModel::FreeBusyGanttProxyModel(QObject *parent)
QVariant FreeBusyGanttProxyModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid()) {
return QVariant();
return {};
}
QModelIndex source_index = mapToSource(index);
......@@ -37,7 +37,7 @@ QVariant FreeBusyGanttProxyModel::data(const QModelIndex &index, int role) const
case Qt::DisplayRole:
return source_index.data(Qt::DisplayRole);
default:
return QVariant();
return {};
}
}
......@@ -58,7 +58,7 @@ QVariant FreeBusyGanttProxyModel::data(const QModelIndex &index, int role) const
case Qt::DisplayRole:
return sourceModel()->data(source_index.parent(), Qt::DisplayRole);
default:
return QVariant();
return {};
}
}
......
......@@ -70,9 +70,7 @@ FreeBusyUrlWidget::FreeBusyUrlWidget(const AttendeeData::Ptr &attendee, QWidget
topLayout->addWidget(mUrlEdit);
}
FreeBusyUrlWidget::~FreeBusyUrlWidget()
{
}
FreeBusyUrlWidget::~FreeBusyUrlWidget() = default;
static QString freeBusyUrlStore()
{
......
......@@ -142,9 +142,7 @@ IncidenceAttendee::IncidenceAttendee(QWidget *parent, IncidenceDateTime *dateTim
connect(filterProxyModel, &AttendeeFilterProxyModel::layoutChanged, this, &IncidenceAttendee::filterLayoutChanged);
}
IncidenceAttendee::~IncidenceAttendee()
{
}
IncidenceAttendee::~IncidenceAttendee() = default;
void IncidenceAttendee::load(const KCalendarCore::Incidence::Ptr &incidence)
{
......
......@@ -90,9 +90,7 @@ IncidenceDateTime::IncidenceDateTime(Ui::EventOrTodoDesktop *ui)
connect(mUi->mEndCheck, &QCheckBox::toggled, this, &IncidenceDateTime::updateEndToolTips);
}
IncidenceDateTime::~IncidenceDateTime()
{
}
IncidenceDateTime::~IncidenceDateTime() = default;
bool IncidenceDateTime::eventFilter(QObject *obj, QEvent *event)
{
......
......@@ -21,9 +21,7 @@ namespace IncidenceEditorNG
class IncidenceDescriptionPrivate
{
public:
IncidenceDescriptionPrivate()
{
}
IncidenceDescriptionPrivate() = default;
QString mRealOriginalDescriptionEditContents;
bool mRichTextEnabled = false;
......
......@@ -16,9 +16,7 @@ IncidenceEditor::IncidenceEditor(QObject *parent)
{
}
IncidenceEditor::~IncidenceEditor()
{
}
IncidenceEditor::~IncidenceEditor() = default;
void IncidenceEditor::checkDirtyStatus()
{
......
......@@ -21,10 +21,6 @@ IncidenceEditorSettings *IncidenceEditorSettings::self()
return mSelf;
}
IncidenceEditorSettings::IncidenceEditorSettings()
{
}
IncidenceEditorSettings::IncidenceEditorSettings() = default;
IncidenceEditorSettings::~IncidenceEditorSettings()
{
}
IncidenceEditorSettings::~IncidenceEditorSettings() = default;
......@@ -36,7 +36,7 @@ IndividualMailDialog::IndividualMailDialog(const QString &question,
options->addItem(i18nc("@item:inlistbox ITIP Messages for one attendee", "Edit mail"), QVariant(Edit));
options->setWhatsThis(i18nc("@info:whatsthis", "Options for this particular attendee."));
options->setToolTip(i18nc("@info:tooltip", "Choose an option for this attendee."));
mAttendeeDecision.push_back(std::make_pair(attendee, options));
mAttendeeDecision.emplace_back(attendee, options);
layout->addWidget(new QLabel(attendee.fullName()), row, 0);
layout->addWidget(options, row, 1);
......@@ -78,9 +78,7 @@ IndividualMailDialog::IndividualMailDialog(const QString &question,
topLayout->addWidget(m_buttons);
}
IndividualMailDialog::~IndividualMailDialog()
{
}
IndividualMailDialog::~IndividualMailDialog() = default;
KCalendarCore::Attendee::List IndividualMailDialog::editAttendees() const
{
......
......@@ -15,9 +15,7 @@ KOrganizerEditorConfig::KOrganizerEditorConfig()
{
}
KOrganizerEditorConfig::~KOrganizerEditorConfig()
{
}
KOrganizerEditorConfig::~KOrganizerEditorConfig() = default;
KConfigSkeleton *KOrganizerEditorConfig::config() const
{
......
......@@ -36,9 +36,7 @@ KWeekdayCheckCombo::KWeekdayCheckCombo(QWidget *parent, bool first5Checked)
}
}
KWeekdayCheckCombo::~KWeekdayCheckCombo()
{
}
KWeekdayCheckCombo::~KWeekdayCheckCombo() = default;
QBitArray KWeekdayCheckCombo::days() const
{
......
......@@ -28,9 +28,7 @@ OpenComposerJob::OpenComposerJob(QObject *parent,
{
}
OpenComposerJob::~OpenComposerJob()
{
}
OpenComposerJob::~OpenComposerJob() = default;
void OpenComposerJob::start()
{
......
......@@ -35,9 +35,7 @@ ResourceItem::ResourceItem(const KLDAP::LdapDN &dn, const QStringList &attrs, co
}
}
ResourceItem::~ResourceItem()
{
}
ResourceItem::~ResourceItem() = default;
ResourceItem::Ptr ResourceItem::child(int number)
{
......@@ -79,7 +77,7 @@ QVariant ResourceItem::data(const QString &column) const
if (!mLdapObject.attributes()[column].isEmpty()) {
return QString::fromUtf8(mLdapObject.attributes()[column][0]);
}
return QVariant();
return {};
}
bool ResourceItem::insertChild(int position, const ResourceItem::Ptr &item)
......
......@@ -36,9 +36,7 @@ using namespace IncidenceEditorNG;
class FreebusyViewCalendar : public EventViews::ViewCalendar
{
public:
~FreebusyViewCalendar() override
{
}
~FreebusyViewCalendar() override = default;
Q_REQUIRED_RESULT bool isValid(const KCalendarCore::Incidence::Ptr &incidence) const override
{
......@@ -62,26 +60,26 @@ public:
int status = incidence->customProperty(QStringLiteral("FREEBUSY").toLatin1(), QStringLiteral("STATUS").toLatin1()).toInt(&ok);
if (!ok) {
return QColor(85, 85, 85);
return {85, 85, 85};
}
switch (status) {
case KCalendarCore::FreeBusyPeriod::Busy:
return QColor(255, 0, 0);
return {255, 0, 0};
case KCalendarCore::FreeBusyPeriod::BusyTentative:
case KCalendarCore::FreeBusyPeriod::BusyUnavailable:
return QColor(255, 119, 0);
return {255, 119, 0};
case KCalendarCore::FreeBusyPeriod::Free:
return QColor(0, 255, 0);
return {0, 255, 0};
default:
return QColor(85, 85, 85);
return {85, 85, 85};
}
}
Q_REQUIRED_RESULT QString iconForIncidence(const KCalendarCore::Incidence::Ptr &incidence) const override
{
Q_UNUSED(incidence)
return QString();
return {};
}
Q_REQUIRED_RESULT KCalendarCore::Calendar::Ptr getCalendar() const override
......
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