Commit 10e902e0 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Modernize code

parent a4306694
Pipeline #100376 passed with stage
in 6 minutes and 18 seconds
......@@ -206,9 +206,7 @@ ArchiveDialog::ArchiveDialog(const Akonadi::ETMCalendar::Ptr &cal, Akonadi::Inci
connect(mUser1Button, &QPushButton::clicked, this, &ArchiveDialog::slotUser1);
}
ArchiveDialog::~ArchiveDialog()
{
}
ArchiveDialog::~ArchiveDialog() = default;
void ArchiveDialog::slotEnableUser1()
{
......
......@@ -21,16 +21,12 @@ class CALENDARSUPPORT_EXPORT CategoryHierarchyReader
{
public:
void read(const QStringList &categories);
virtual ~CategoryHierarchyReader()
{
}
virtual ~CategoryHierarchyReader() = default;
static QStringList path(QString string);
protected:
CategoryHierarchyReader()
{
}
CategoryHierarchyReader() = default;
virtual void clear() = 0;
virtual void goUp() = 0;
......@@ -46,9 +42,7 @@ public:
{
}
~CategoryHierarchyReaderQComboBox() override
{
}
~CategoryHierarchyReaderQComboBox() override = default;
protected:
void clear() override;
......@@ -70,9 +64,7 @@ public:
{
}
~CategoryHierarchyReaderQTreeWidget() override
{
}
~CategoryHierarchyReaderQTreeWidget() override = default;
protected:
void clear() override;
......
......@@ -14,13 +14,9 @@ namespace CalendarSupport
class CALENDARSUPPORT_EXPORT CellItem
{
public:
CellItem()
{
}
CellItem() = default;
virtual ~CellItem()
{
}
virtual ~CellItem() = default;
void setSubCells(int v);
Q_REQUIRED_RESULT int subCells() const;
......
......@@ -57,9 +57,7 @@ EventArchiver::EventArchiver(QObject *parent)
{
}
EventArchiver::~EventArchiver()
{
}
EventArchiver::~EventArchiver() = default;
void EventArchiver::runOnce(const Akonadi::ETMCalendar::Ptr &calendar, Akonadi::IncidenceChanger *changer, QDate limitDate, QWidget *widget)
{
......
......@@ -21,9 +21,7 @@ using namespace CalendarSupport;
class CalendarSupport::FreeBusyCalendarPrivate
{
public:
FreeBusyCalendarPrivate()
{
}
FreeBusyCalendarPrivate() = default;
FreeBusyItemModel *mModel = nullptr;
KCalendarCore::Calendar::Ptr mCalendar;
......
......@@ -27,9 +27,7 @@ public:
* @param parentWidget is passed to Akonadi when fetching free/busy data.
*/
FreeBusyItem(const KCalendarCore::Attendee &attendee, QWidget *parentWidget);
~FreeBusyItem()
{
}
~FreeBusyItem() = default;
KCalendarCore::Attendee attendee() const;
void setFreeBusy(const KCalendarCore::FreeBusy::Ptr &fb);
......
......@@ -103,7 +103,7 @@ FreeBusyItemModel::~FreeBusyItemModel() = default;
QVariant FreeBusyItemModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid()) {
return QVariant();
return {};
}
auto data = (ItemPrivateData *)index.internalPointer();
......@@ -111,7 +111,7 @@ QVariant FreeBusyItemModel::data(const QModelIndex &index, int role) const
if (data->parent() == d->mRootData) {
int row = index.row();
if (row >= d->mFreeBusyItems.size()) {
return QVariant();
return {};
}
switch (role) {
......@@ -123,16 +123,16 @@ QVariant FreeBusyItemModel::data(const QModelIndex &index, int role) const
if (d->mFreeBusyItems.at(row)->freeBusy()) {
return QVariant::fromValue(d->mFreeBusyItems.at(row)->freeBusy());
} else {
return QVariant();
return {};
}
default:
return QVariant();
return {};
}
}
FreeBusyItem::Ptr fbitem = d->mFreeBusyItems.at(data->parent()->row());
if (!fbitem->freeBusy() || index.row() >= fbitem->freeBusy()->busyPeriods().size()) {
return QVariant();
return {};
}
KCalendarCore::FreeBusyPeriod period = fbitem->freeBusy()->fullBusyPeriods().at(index.row());
......@@ -143,7 +143,7 @@ QVariant FreeBusyItemModel::data(const QModelIndex &index, int role) const
case FreeBusyItemModel::FreeBusyPeriodRole:
return QVariant::fromValue(period);
default:
return QVariant();
return {};
}
}
......@@ -172,7 +172,7 @@ int FreeBusyItemModel::columnCount(const QModelIndex &parent) const
QModelIndex FreeBusyItemModel::index(int row, int column, const QModelIndex &parent) const
{
if (!hasIndex(row, column, parent)) {
return QModelIndex();
return {};
}
ItemPrivateData *parentData = nullptr;
......@@ -186,20 +186,20 @@ QModelIndex FreeBusyItemModel::index(int row, int column, const QModelIndex &par
if (childData) {
return createIndex(row, column, childData);
} else {
return QModelIndex();
return {};
}
}
QModelIndex FreeBusyItemModel::parent(const QModelIndex &child) const
{
if (!child.isValid()) {
return QModelIndex();
return {};
}
auto childData = static_cast<ItemPrivateData *>(child.internalPointer());
ItemPrivateData *parentData = childData->parent();
if (parentData == d->mRootData) {
return QModelIndex();
return {};
}
return createIndex(parentData->row(), 0, parentData);
......@@ -210,7 +210,7 @@ QVariant FreeBusyItemModel::headerData(int section, Qt::Orientation orientation,
if (role == Qt::DisplayRole && orientation == Qt::Horizontal && section == 0) {
return i18n("Attendee");
}
return QVariant();
return {};
}
void FreeBusyItemModel::addItem(const FreeBusyItem::Ptr &freebusy)
......
......@@ -21,14 +21,12 @@ FreePeriodModel::FreePeriodModel(QObject *parent)
{
}
FreePeriodModel::~FreePeriodModel()
{
}
FreePeriodModel::~FreePeriodModel() = default;
QVariant FreePeriodModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid() || !hasIndex(index.row(), index.column())) {
return QVariant();
return {};
}
if (index.column() == 0) { // day
......@@ -42,7 +40,7 @@ QVariant FreePeriodModel::data(const QModelIndex &index, int role) const
case Qt::TextAlignmentRole:
return static_cast<int>(Qt::AlignRight | Qt::AlignVCenter);
default:
return QVariant();
return {};
}
} else { // everything else
switch (role) {
......@@ -55,7 +53,7 @@ QVariant FreePeriodModel::data(const QModelIndex &index, int role) const
case Qt::TextAlignmentRole:
return static_cast<int>(Qt::AlignLeft | Qt::AlignVCenter);
default:
return QVariant();
return {};
}
}
}
......
......@@ -162,7 +162,7 @@ QVariant IncidenceAttachmentModel::data(const QModelIndex &index, int role) cons
{
Q_D(const IncidenceAttachmentModel);
if (!d->m_incidence) {
return QVariant();
return {};
}
const KCalendarCore::Attachment attachment = d->m_incidence->attachments().at(index.row());
......@@ -174,7 +174,7 @@ QVariant IncidenceAttachmentModel::data(const QModelIndex &index, int role) cons
case MimeTypeRole:
return attachment.mimeType();
}
return QVariant();
return {};
}
QVariant IncidenceAttachmentModel::headerData(int section, Qt::Orientation orientation, int role) const
......
......@@ -33,9 +33,7 @@ public:
{
}
~KCalPrefsPrivate()
{
}
~KCalPrefsPrivate() = default;
Akonadi::Collection::Id mDefaultCalendarId;
......
......@@ -21,9 +21,7 @@ MessageWidget::MessageWidget(QWidget *parent)
setWordWrap(true);
}
MessageWidget::~MessageWidget()
{
}
MessageWidget::~MessageWidget() = default;
void MessageWidget::showEvent(QShowEvent *event)
{
......
......@@ -187,6 +187,6 @@ KMime::Message::Ptr NoteEditDialog::note() const
if (mItem.hasPayload<KMime::Message::Ptr>()) {
return mItem.payload<KMime::Message::Ptr>();
} else {
return KMime::Message::Ptr();
return {};
}
}
......@@ -37,9 +37,7 @@ CalPrintIncidence::CalPrintIncidence()
{
}
CalPrintIncidence::~CalPrintIncidence()
{
}
CalPrintIncidence::~CalPrintIncidence() = default;
QWidget *CalPrintIncidence::createConfigWidget(QWidget *w)
{
......@@ -103,9 +101,7 @@ void CalPrintIncidence::doSaveConfig()
class TimePrintStringsVisitor : public KCalendarCore::Visitor
{
public:
TimePrintStringsVisitor()
{
}
TimePrintStringsVisitor() = default;
bool act(KCalendarCore::IncidenceBase::Ptr incidence)
{
......@@ -643,9 +639,7 @@ CalPrintTimetable::CalPrintTimetable()
{
}
CalPrintTimetable::~CalPrintTimetable()
{
}
CalPrintTimetable::~CalPrintTimetable() = default;
void CalPrintTimetable::doLoadConfig()
{
......@@ -851,9 +845,7 @@ CalPrintDay::CalPrintDay()
{
}
CalPrintDay::~CalPrintDay()
{
}
CalPrintDay::~CalPrintDay() = default;
QWidget *CalPrintDay::createConfigWidget(QWidget *w)
{
......@@ -1061,9 +1053,7 @@ CalPrintWeek::CalPrintWeek()
{
}
CalPrintWeek::~CalPrintWeek()
{
}
CalPrintWeek::~CalPrintWeek() = default;
QWidget *CalPrintWeek::createConfigWidget(QWidget *w)
{
......@@ -1333,9 +1323,7 @@ CalPrintMonth::CalPrintMonth()
{
}
CalPrintMonth::~CalPrintMonth()
{
}
CalPrintMonth::~CalPrintMonth() = default;
QWidget *CalPrintMonth::createConfigWidget(QWidget *w)
{
......@@ -1498,9 +1486,7 @@ CalPrintTodos::CalPrintTodos()
mTodoSortDirection = TodoDirectionUnset;
}
CalPrintTodos::~CalPrintTodos()
{
}
CalPrintTodos::~CalPrintTodos() = default;
QWidget *CalPrintTodos::createConfigWidget(QWidget *w)
{
......
......@@ -245,9 +245,7 @@ CalPrintDialog::CalPrintDialog(int initialPrintType, const PrintPlugin::List &pl
resize(minimumSizeHint());
}
CalPrintDialog::~CalPrintDialog()
{
}
CalPrintDialog::~CalPrintDialog() = default;
void CalPrintDialog::setPreview(bool preview)
{
......
......@@ -122,9 +122,7 @@ CalPrintPluginBase::CalPrintPluginBase()
{
}
CalPrintPluginBase::~CalPrintPluginBase()
{
}
CalPrintPluginBase::~CalPrintPluginBase() = default;
QWidget *CalPrintPluginBase::createConfigWidget(QWidget *w)
{
......@@ -294,7 +292,7 @@ QColor CalPrintPluginBase::categoryBgColor(const KCalendarCore::Incidence::Ptr &
}
return backColor;
} else {
return QColor();
return {};
}
}
......@@ -308,7 +306,7 @@ KCalendarCore::Event::Ptr CalPrintPluginBase::holidayEvent(QDate date) const
{
QString hstring(holidayString(date));
if (hstring.isEmpty()) {
return KCalendarCore::Event::Ptr();
return {};
}
KCalendarCore::Event::Ptr holiday(new KCalendarCore::Event);
......
......@@ -20,9 +20,7 @@ public:
{
}
~CalPrintJournal() override
{
}
~CalPrintJournal() override = default;
Q_REQUIRED_RESULT QString groupName() const override
{
......
......@@ -40,9 +40,7 @@ public:
{
}
virtual ~PrintPlugin()
{
}
virtual ~PrintPlugin() = default;
using List = QList<PrintPlugin *>;
......
......@@ -19,9 +19,7 @@ public:
{
}
~CalPrintYear() override
{
}
~CalPrintYear() override = default;
Q_REQUIRED_RESULT QString groupName() const override
{
......
......@@ -47,7 +47,7 @@ KCalendarCore::Incidence::Ptr CalendarSupport::incidence(const Akonadi::Item &it
try {
return item.payload<KCalendarCore::Incidence::Ptr>();
} catch (const Akonadi::PayloadException &) {
return KCalendarCore::Incidence::Ptr();
return {};
}
}
......@@ -60,9 +60,9 @@ KCalendarCore::Event::Ptr CalendarSupport::event(const Akonadi::Item &item)
return item.payload<KCalendarCore::Event::Ptr>();
}
} catch (const Akonadi::PayloadException &) {
return KCalendarCore::Event::Ptr();
return {};
}
return KCalendarCore::Event::Ptr();
return {};
}
KCalendarCore::Event::Ptr CalendarSupport::event(const KCalendarCore::Incidence::Ptr &incidence)
......@@ -70,7 +70,7 @@ KCalendarCore::Event::Ptr CalendarSupport::event(const KCalendarCore::Incidence:
if (hasEvent(incidence)) {
return incidence.staticCast<KCalendarCore::Event>();
}
return KCalendarCore::Event::Ptr();
return {};
}
KCalendarCore::Incidence::List CalendarSupport::incidencesFromItems(const Akonadi::Item::List &items)
......@@ -92,9 +92,9 @@ KCalendarCore::Todo::Ptr CalendarSupport::todo(const Akonadi::Item &item)
return item.payload<KCalendarCore::Todo::Ptr>();
}
} catch (const Akonadi::PayloadException &) {
return KCalendarCore::Todo::Ptr();
return {};
}
return KCalendarCore::Todo::Ptr();
return {};
}
KCalendarCore::Todo::Ptr CalendarSupport::todo(const KCalendarCore::Incidence::Ptr &incidence)
......@@ -102,7 +102,7 @@ KCalendarCore::Todo::Ptr CalendarSupport::todo(const KCalendarCore::Incidence::P
if (hasTodo(incidence)) {
return incidence.staticCast<KCalendarCore::Todo>();
}
return KCalendarCore::Todo::Ptr();
return {};
}
KCalendarCore::Journal::Ptr CalendarSupport::journal(const Akonadi::Item &item)
......@@ -113,9 +113,9 @@ KCalendarCore::Journal::Ptr CalendarSupport::journal(const Akonadi::Item &item)
return item.payload<KCalendarCore::Journal::Ptr>();
}
} catch (const Akonadi::PayloadException &) {
return KCalendarCore::Journal::Ptr();
return {};
}
return KCalendarCore::Journal::Ptr();
return {};
}
KCalendarCore::Journal::Ptr CalendarSupport::journal(const KCalendarCore::Incidence::Ptr &incidence)
......@@ -123,7 +123,7 @@ KCalendarCore::Journal::Ptr CalendarSupport::journal(const KCalendarCore::Incide
if (hasJournal(incidence)) {
return incidence.staticCast<KCalendarCore::Journal>();
}
return KCalendarCore::Journal::Ptr();
return {};
}
bool CalendarSupport::hasIncidence(const Akonadi::Item &item)
......
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