[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: [kalarm] src: Use nullptr
From:       "David Jarvie" <djarvie () kde ! org>
Date:       2017-01-11 18:46:50
Message-ID: 7cd27d08e9cd2ba2bd09773bb62133be.squirrel () ln6-web-05 ! sensical ! net
[Download RAW message or body]

Using nullptr instead of 0 in most (if not all) of these instances is
wrong, since the 0 is not a pointer. Can you please revert this commit.

Thanks,
David.


On Tue, January 10, 2017 9:59 pm, Montel Laurent wrote:
> Git commit a97e32dcc06b1e8f7a20401018f072915083423c by Montel Laurent.
> Committed on 10/01/2017 at 21:58.
> Pushed by mlaurent into branch 'master'.
>
> Use nullptr
>
> M  +1    -1    src/alarmtimewidget.cpp
> M  +1    -1    src/birthdaydlg.cpp
> M  +1    -1    src/calendarmigrator.cpp
> M  +2    -2    src/collectionmodel.cpp
> M  +1    -1    src/dbushandler.cpp
> M  +1    -1    src/editdlg.cpp
> M  +1    -1    src/prefdlg.cpp
> M  +2    -2    src/recurrenceedit.cpp
> M  +1    -1    src/resourceselector.cpp
> M  +2    -2    src/specialactions.cpp
>
> https://commits.kde.org/kalarm/a97e32dcc06b1e8f7a20401018f072915083423c
>
> diff --git a/src/alarmtimewidget.cpp b/src/alarmtimewidget.cpp
> index e92b9f16..85cf69a4 100644
> --- a/src/alarmtimewidget.cpp
> +++ b/src/alarmtimewidget.cpp
> @@ -251,7 +251,7 @@ void AlarmTimeWidget::init(Mode mode, const QString&
> title)
>  void AlarmTimeWidget::setReadOnly(bool ro)
>  {
>      mAtTimeRadio->setReadOnly(ro);
> -    mDateEdit->setOptions(ro ? KDateComboBox::Options(0) :
> KDateComboBox::EditDate | KDateComboBox::SelectDate |
> KDateComboBox::DatePicker);
> +    mDateEdit->setOptions(ro ? KDateComboBox::Options(nullptr) :
> KDateComboBox::EditDate | KDateComboBox::SelectDate |
> KDateComboBox::DatePicker);
>      mTimeEdit->setReadOnly(ro);
>      if (mAnyTimeCheckBox)
>          mAnyTimeCheckBox->setReadOnly(ro);
> diff --git a/src/birthdaydlg.cpp b/src/birthdaydlg.cpp
> index a24699a9..26f0661c 100644
> --- a/src/birthdaydlg.cpp
> +++ b/src/birthdaydlg.cpp
> @@ -227,7 +227,7 @@ BirthdayDlg::BirthdayDlg(QWidget* parent)
>                        Preferences::defaultSoundVolume(), -1, 0,
> Preferences::defaultSoundRepeat());
>      if (mSpecialActionsButton)
>      {
> -        KAEvent::ExtraActionOptions opts(0);
> +        KAEvent::ExtraActionOptions opts(nullptr);
>          if (Preferences::defaultExecPreActionOnDeferral())
>              opts |= KAEvent::ExecPreActOnDeferral;
>          if (Preferences::defaultCancelOnPreActionError())
> diff --git a/src/calendarmigrator.cpp b/src/calendarmigrator.cpp
> index aab905de..ae7e1872 100644
> --- a/src/calendarmigrator.cpp
> +++ b/src/calendarmigrator.cpp
> @@ -143,7 +143,7 @@ bool              CalendarMigrator::mCompleted =
> false;
>
>  CalendarMigrator::CalendarMigrator(QObject* parent)
>      : QObject(parent),
> -      mExistingAlarmTypes(0)
> +      mExistingAlarmTypes(nullptr)
>  {
>  }
>
> diff --git a/src/collectionmodel.cpp b/src/collectionmodel.cpp
> index 27a9ef0d..7fce29ff 100644
> --- a/src/collectionmodel.cpp
> +++ b/src/collectionmodel.cpp
> @@ -762,8 +762,8 @@ CalEvent::Types
> CollectionControlModel::setEnabled(const Collection& collection,
>  CalEvent::Types CollectionControlModel::setEnabledStatus(const
> Collection& collection, CalEvent::Types types, bool inserted)
>  {
>      qCDebug(KALARM_LOG) << "id:" << collection.id() << ", types=" <<
> types;
> -    CalEvent::Types disallowedStdTypes(0);
> -    CalEvent::Types stdTypes(0);
> +    CalEvent::Types disallowedStdTypes(nullptr);
> +    CalEvent::Types stdTypes(nullptr);
>
>      // Prevent the enabling of duplicate alarm types if another
> collection
>      // uses the same backend storage.
> diff --git a/src/dbushandler.cpp b/src/dbushandler.cpp
> index 40e8a65d..1e96bf3d 100644
> --- a/src/dbushandler.cpp
> +++ b/src/dbushandler.cpp
> @@ -475,7 +475,7 @@ KDateTime DBusHandler::convertDateTime(const QString&
> dateTime, const KDateTime&
>  */
>  KAEvent::Flags DBusHandler::convertStartFlags(const KDateTime& start,
> unsigned flags)
>  {
> -    KAEvent::Flags kaEventFlags = 0;
> +    KAEvent::Flags kaEventFlags = nullptr;
>      if (flags & REPEAT_AT_LOGIN) kaEventFlags |=
> KAEvent::REPEAT_AT_LOGIN;
>      if (flags & BEEP)            kaEventFlags |= KAEvent::BEEP;
>      if (flags & SPEAK)           kaEventFlags |= KAEvent::SPEAK;
> diff --git a/src/editdlg.cpp b/src/editdlg.cpp
> index e837a455..fc5228e4 100644
> --- a/src/editdlg.cpp
> +++ b/src/editdlg.cpp
> @@ -859,7 +859,7 @@ void EditAlarmDlg::setEvent(KAEvent& event, const
> QString& text, bool trial)
>  */
>  KAEvent::Flags EditAlarmDlg::getAlarmFlags() const
>  {
> -    KAEvent::Flags flags(0);
> +    KAEvent::Flags flags(nullptr);
>      if (mShowInKorganizer && mShowInKorganizer->isEnabled() &&
> mShowInKorganizer->isChecked())
>          flags |= KAEvent::COPY_KORGANIZER;
>      if (mRecurrenceEdit->repeatType() == RecurrenceEdit::AT_LOGIN)
> diff --git a/src/prefdlg.cpp b/src/prefdlg.cpp
> index 2a057a44..0c0ed74c 100644
> --- a/src/prefdlg.cpp
> +++ b/src/prefdlg.cpp
> @@ -1466,7 +1466,7 @@ void EditPrefTab::restore(bool, bool allTabs)
>              case TimePeriod::Minutes:      index = 0; break;
>          }
>          mReminderUnits->setCurrentIndex(index);
> -        KAEvent::ExtraActionOptions opts(0);
> +        KAEvent::ExtraActionOptions opts(nullptr);
>          if (Preferences::defaultExecPreActionOnDeferral())
>              opts |= KAEvent::ExecPreActOnDeferral;
>          if (Preferences::defaultCancelOnPreActionError())
> diff --git a/src/recurrenceedit.cpp b/src/recurrenceedit.cpp
> index ead2af22..cc9acd47 100644
> --- a/src/recurrenceedit.cpp
> +++ b/src/recurrenceedit.cpp
> @@ -276,7 +276,7 @@ RecurrenceEdit::RecurrenceEdit(bool readOnly, QWidget*
> parent)
>                  "<para><note>This applies to the main recurrence only. It
> does not limit any sub-repetition which will occur
> regardless after the last main
> recurrence.</note></para>"));
>      mRangeButtonGroup->addButton(mEndDateButton);
>      mEndDateEdit = new KDateComboBox(mRangeButtonBox);
> -    mEndDateEdit->setOptions(mReadOnly ? KDateComboBox::Options(0) :
> KDateComboBox::EditDate | KDateComboBox::SelectDate |
> KDateComboBox::DatePicker);
> +    mEndDateEdit->setOptions(mReadOnly ? KDateComboBox::Options(nullptr)
> : KDateComboBox::EditDate | KDateComboBox::SelectDate |
> KDateComboBox::DatePicker);
>      static const QString tzText = i18nc("@info", "This uses the same time
> zone as the start time.");
>      mEndDateEdit->setWhatsThis(xi18nc("@info:whatsthis",
>            "<para>Enter the last date to repeat the
> alarm.</para><para>%1</para>", tzText));
> @@ -336,7 +336,7 @@ RecurrenceEdit::RecurrenceEdit(bool readOnly, QWidget*
> parent)
>          vlayout->setMargin(0);
>          hlayout->addLayout(vlayout);
>          mExceptionDateEdit = new KDateComboBox(mExceptionGroup);
> -        mExceptionDateEdit->setOptions(mReadOnly ?
> KDateComboBox::Options(0) : KDateComboBox::EditDate |
> KDateComboBox::SelectDate | KDateComboBox::DatePicker);
> +        mExceptionDateEdit->setOptions(mReadOnly ?
> KDateComboBox::Options(nullptr) : KDateComboBox::EditDate |
> KDateComboBox::SelectDate | KDateComboBox::DatePicker);
>          mExceptionDateEdit->setDate(KDateTime::currentLocalDate());
>          mExceptionDateEdit->setWhatsThis(i18nc("@info:whatsthis",
>                "Enter a date to insert in the exceptions list. "
> diff --git a/src/resourceselector.cpp b/src/resourceselector.cpp
> index c6e3114c..78c068df 100644
> --- a/src/resourceselector.cpp
> +++ b/src/resourceselector.cpp
> @@ -604,7 +604,7 @@ void ResourceSelector::showInfo()
>                               name, id, calType, alarmTypeString, storage,
> location, perms, enabled, std);
>          // Display the collection information. Because the user requested
>          // the information, don't raise a KNotify event.
> -        KAMessageBox::information(this, text, QString(), QString(), 0);
> +        KAMessageBox::information(this, text, QString(), QString(),
> nullptr);
>      }
>  }
>
> diff --git a/src/specialactions.cpp b/src/specialactions.cpp
> index a60ddcb1..93254807 100644
> --- a/src/specialactions.cpp
> +++ b/src/specialactions.cpp
> @@ -47,7 +47,7 @@
>
>  SpecialActionsButton::SpecialActionsButton(bool enableCheckboxes,
> QWidget* parent)
>      : QPushButton(i18nc("@action:button", "Special Actions..."), parent),
> -      mOptions(0),
> +      mOptions(nullptr),
>        mEnableCheckboxes(enableCheckboxes),
>        mReadOnly(false)
>  {
> @@ -247,7 +247,7 @@ QString SpecialActions::postAction() const
>
>  KAEvent::ExtraActionOptions SpecialActions::options() const
>  {
> -    KAEvent::ExtraActionOptions opts = 0;
> +    KAEvent::ExtraActionOptions opts = nullptr;
>      if (mExecOnDeferral->isChecked())  opts |=
> KAEvent::ExecPreActOnDeferral;
>      if (mCancelOnError->isChecked())   opts |=
> KAEvent::CancelOnPreActError;
>      if (mDontShowError->isChecked())   opts |=
> KAEvent::DontShowPreActError;
>
>

-- 
David Jarvie.
KDE developer.
KAlarm author - http://www.astrojar.org.uk/kalarm

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic