Commit 5ff732ed authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use Q_NULLPTR

parent b6562e20
......@@ -45,7 +45,7 @@ void ConflictResolverTest::addAttendee(const QString &email, const KCalCore::Fre
CalendarSupport::FreeBusyItem::Ptr item(new CalendarSupport::FreeBusyItem(KCalCore::Attendee::Ptr(
new KCalCore::Attendee(name, email, false,
KCalCore::Attendee::Accepted,
role)), 0));
role)), Q_NULLPTR));
item->setFreeBusy(KCalCore::FreeBusy::Ptr(new KCalCore::FreeBusy(*fb.data())));
attendees << item;
}
......@@ -66,7 +66,7 @@ void ConflictResolverTest::init()
void ConflictResolverTest::cleanup()
{
delete resolver;
resolver = 0;
resolver = Q_NULLPTR;
attendees.clear();
}
......
......@@ -51,7 +51,7 @@ void FreeBusyGanttProxyModelTest::testModelValidity()
fb1->addPeriod(dt1, KCalCore::Duration(60 * 60));
fb1->addPeriod(dt2, KCalCore::Duration(60 * 60));
CalendarSupport::FreeBusyItem::Ptr item1(new CalendarSupport::FreeBusyItem(a1, 0));
CalendarSupport::FreeBusyItem::Ptr item1(new CalendarSupport::FreeBusyItem(a1, Q_NULLPTR));
item1->setFreeBusy(fb1);
const KDateTime dt3(QDate(2010, 8, 25), QTime(7, 0, 0), KDateTime::UTC);
......@@ -62,7 +62,7 @@ void FreeBusyGanttProxyModelTest::testModelValidity()
fb2->addPeriod(dt3, KCalCore::Duration(60 * 60));
fb2->addPeriod(dt4, KCalCore::Duration(60 * 60));
CalendarSupport::FreeBusyItem::Ptr item2(new CalendarSupport::FreeBusyItem(a2, 0));
CalendarSupport::FreeBusyItem::Ptr item2(new CalendarSupport::FreeBusyItem(a2, Q_NULLPTR));
item2->setFreeBusy(fb2);
fbModel->addItem(item1);
......
......@@ -40,7 +40,7 @@ private Q_SLOTS:
attendees << attendee1 << attendee2 << attendee3;
IndividualMailDialog dialog(QStringLiteral("title"), attendees, buttonYes, buttonNo, 0);
IndividualMailDialog dialog(QStringLiteral("title"), attendees, buttonYes, buttonNo, Q_NULLPTR);
QCOMPARE(dialog.editAttendees().count(), 0);
QCOMPARE(dialog.updateAttendees().count(), 3);
......
......@@ -97,7 +97,7 @@ void initPresets(AlarmPresets::When when)
case AlarmPresets::BeforeStart:
for (int i = 0; i < hardcodedPresets.count(); ++i) {
KCalCore::Alarm::Ptr alarm(new KCalCore::Alarm(0));
KCalCore::Alarm::Ptr alarm(new KCalCore::Alarm(Q_NULLPTR));
alarm->setType(KCalCore::Alarm::Display);
const int minutes = hardcodedPresets[i];
alarm->setStartOffset(-minutes * 60);
......@@ -124,7 +124,7 @@ void initPresets(AlarmPresets::When when)
case AlarmPresets::BeforeEnd:
for (int i = 0; i < hardcodedPresets.count(); ++i) {
KCalCore::Alarm::Ptr alarm(new KCalCore::Alarm(0));
KCalCore::Alarm::Ptr alarm(new KCalCore::Alarm(Q_NULLPTR));
alarm->setType(KCalCore::Alarm::Display);
const int minutes = hardcodedPresets[i];
alarm->setEndOffset(-minutes * 60);
......
......@@ -145,7 +145,7 @@ void AttachmentEditDialog::slotApply()
if (mUi->mStackedWidget->currentIndex() == 0) {
if (mUi->mInlineCheck->isChecked()) {
auto job = KIO::storedGet(url);
KJobWidgets::setWindow(job, 0);
KJobWidgets::setWindow(job, Q_NULLPTR);
if (job->exec()) {
QByteArray data = job->data();
mItem->setData(data);
......
......@@ -52,12 +52,12 @@ AutoCheckTreeWidget::~AutoCheckTreeWidget()
QTreeWidgetItem *AutoCheckTreeWidget::itemByPath(const QStringList &path) const
{
QStringList newPath = path;
QTreeWidgetItem *item = 0;
QTreeWidgetItem *item = Q_NULLPTR;
while (newPath.count()) {
item = findItem(item, newPath.takeFirst());
if (!item) {
return 0;
return Q_NULLPTR;
}
}
......@@ -113,7 +113,7 @@ QTreeWidgetItem *AutoCheckTreeWidget::findItem(QTreeWidgetItem *parent, const QS
}
}
return 0;
return Q_NULLPTR;
}
void AutoCheckTreeWidget::slotRowsInserted(const QModelIndex &parent,
......
......@@ -231,12 +231,12 @@ void CategoryWidget::handleColorChanged(const QColor &newColor)
}
CategoryDialog::CategoryDialog(CategoryConfig *cc, QWidget *parent)
: QDialog(parent), d(0)
: QDialog(parent), d(Q_NULLPTR)
{
setWindowTitle(i18n("Select Categories"));
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
QDialogButtonBox *buttonBox = 0;
QDialogButtonBox *buttonBox = Q_NULLPTR;
buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel /*| QDialogButtonBox::Help*/ | QDialogButtonBox::Apply);
......
......@@ -164,12 +164,12 @@ void CategorySelectWidget::setCategoryList(const QStringList &categories)
}
CategorySelectDialog::CategorySelectDialog(CategoryConfig *cc, QWidget *parent)
: QDialog(parent), d(0)
: QDialog(parent), d(Q_NULLPTR)
{
setWindowTitle(i18n("Select Categories"));
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
QDialogButtonBox *buttonBox = 0;
QDialogButtonBox *buttonBox = Q_NULLPTR;
buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel /*| QDialogButtonBox::Help*/ | QDialogButtonBox::Apply);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
......
......@@ -34,13 +34,13 @@ public:
static void cleanup_config()
{
delete config;
config = 0;
config = Q_NULLPTR;
}
QHash<KCalCore::IncidenceBase::IncidenceType, QStringList> mTemplates;
};
EditorConfig *EditorConfig::Private::config = 0;
EditorConfig *EditorConfig::Private::config = Q_NULLPTR;
EditorConfig::EditorConfig()
: d(new Private)
......
......@@ -80,7 +80,7 @@ public:
};
ItemEditorPrivate::ItemEditorPrivate(Akonadi::IncidenceChanger *changer, EditorItemManager *qq)
: q_ptr(qq), mItemMonitor(0), mIsCounterProposal(false)
: q_ptr(qq), mItemMonitor(Q_NULLPTR), mIsCounterProposal(false)
, currentAction(EditorItemManager::None)
{
mFetchScope.fetchFullPayload();
......
......@@ -40,7 +40,7 @@ void GroupwareUiDelegate::requestIncidenceEditor(const Akonadi::Item &item)
}
IncidenceDialog *dialog = IncidenceDialogFactory::create(/*needs initial saving=*/ false,
incidence->type(), 0);
incidence->type(), Q_NULLPTR);
dialog->setAttribute(Qt::WA_DeleteOnClose, false);
dialog->setIsCounterProposal(true);
dialog->load(item, QDate::currentDate());
......
......@@ -183,7 +183,7 @@ void IncidenceAlarm::newAlarm()
dialog->setAllowEndReminders(mDateTime->endDateTimeEnabled());
if (dialog->exec() == QDialog::Accepted) {
KCalCore::Alarm::Ptr newAlarm(new KCalCore::Alarm(0));
KCalCore::Alarm::Ptr newAlarm(new KCalCore::Alarm(Q_NULLPTR));
dialog->save(newAlarm);
newAlarm->setEnabled(true);
mAlarms.append(newAlarm);
......
......@@ -51,7 +51,7 @@
using namespace IncidenceEditorNG;
IncidenceAttachment::IncidenceAttachment(Ui::EventOrTodoDesktop *ui)
: IncidenceEditor(0),
: IncidenceEditor(Q_NULLPTR),
mUi(ui),
mPopupMenu(new QMenu)
{
......@@ -201,7 +201,7 @@ void IncidenceAttachment::removeSelectedAttachments()
QString labelsStr = labels.join(QStringLiteral("<nl/>"));
if (KMessageBox::questionYesNo(
0,
Q_NULLPTR,
xi18nc("@info",
"Do you really want to remove these attachments?<nl/>%1", labelsStr),
i18nc("@title:window", "Remove Attachments?"),
......@@ -241,13 +241,13 @@ void IncidenceAttachment::saveAttachment(QListWidgetItem *item)
KCalCore::Attachment::Ptr att = attitem->attachment();
// get the saveas file name
QString saveAsFile = QFileDialog::getSaveFileName(0, i18nc("@title", "Save Attachment"),
QString saveAsFile = QFileDialog::getSaveFileName(Q_NULLPTR, i18nc("@title", "Save Attachment"),
att->label());
if (saveAsFile.isEmpty() ||
(QFile(saveAsFile).exists() &&
(KMessageBox::warningYesNo(
0,
Q_NULLPTR,
i18nc("@info", "%1 already exists. Do you want to overwrite it?",
saveAsFile)) == KMessageBox::No))) {
return;
......@@ -262,7 +262,7 @@ void IncidenceAttachment::saveAttachment(QListWidgetItem *item)
// save the attachment url
auto job = KIO::file_copy(sourceUrl, QUrl::fromLocalFile(saveAsFile));
if (!job->exec() && job->error()) {
KMessageBox::error(0, job->errorString());
KMessageBox::error(Q_NULLPTR, job->errorString());
}
}
......@@ -289,14 +289,14 @@ void IncidenceAttachment::showAttachment(QListWidgetItem *item)
if (att->isUri()) {
Q_EMIT openURL(QUrl(att->uri()));
} else {
KRun::runUrl(mAttachmentView->tempFileForAttachment(att), att->mimeType(), 0, true);
KRun::runUrl(mAttachmentView->tempFileForAttachment(att), att->mimeType(), Q_NULLPTR, true);
}
}
void IncidenceAttachment::showContextMenu(const QPoint &pos)
{
QListWidgetItem *item = mAttachmentView->itemAt(pos);
const bool enable = item != 0;
const bool enable = item != Q_NULLPTR;
int numSelected = 0;
for (int itemIndex = 0; itemIndex < mAttachmentView->count(); ++itemIndex) {
......@@ -418,7 +418,7 @@ void IncidenceAttachment::handlePasteOrDrop(const QMimeData *mimeData)
probablyWeHaveUris = true;
}
QMenu menu;
QAction *linkAction = 0, *cancelAction;
QAction *linkAction = Q_NULLPTR, *cancelAction;
if (probablyWeHaveUris) {
linkAction = menu.addAction(QIcon::fromTheme(QStringLiteral("insert-link")), i18nc("@action:inmenu", "&Link here"));
// we need to check if we can reasonably expect to copy the objects
......@@ -598,7 +598,7 @@ void IncidenceAttachment::addUriAttachment(const QString &uri,
}
} else {
auto job = KIO::storedGet(QUrl(uri));
KJobWidgets::setWindow(job, 0);
KJobWidgets::setWindow(job, Q_NULLPTR);
if (job->exec()) {
const QByteArray data = job->data();
addDataAttachment(data, mimeType, label);
......
......@@ -54,7 +54,7 @@ IncidenceAttendee::IncidenceAttendee(QWidget *parent, IncidenceDateTime *dateTim
Ui::EventOrTodoDesktop *ui)
: mUi(ui)
, mParentWidget(parent)
, mConflictResolver(0)
, mConflictResolver(Q_NULLPTR)
, mDateTime(dateTime)
, mStateDelegate(new AttendeeComboBoxDelegate(this))
, mRoleDelegate(new AttendeeComboBoxDelegate(this))
......@@ -232,7 +232,7 @@ void IncidenceAttendee::save(const KCalCore::Incidence::Ptr &incidence)
}
if (KEmailAddress::isValidAddress(attendee->email())) {
if (KMessageBox::warningYesNo(
0,
Q_NULLPTR,
i18nc("@info",
"%1 does not look like a valid email address. "
"Are you sure you want to invite this participant?",
......@@ -354,7 +354,7 @@ void IncidenceAttendee::checkIfExpansionIsNeeded(const KCalCore::Attendee::Ptr &
// stop old job
KJob *oldJob = mMightBeGroupJobs.key(attendee);
if (oldJob != 0) {
if (oldJob != Q_NULLPTR) {
disconnect(oldJob);
oldJob->deleteLater();
mMightBeGroupJobs.remove(oldJob);
......
......@@ -30,7 +30,7 @@ class IncidenceCompletionPriority::Private
IncidenceCompletionPriority *const q;
public:
explicit Private(IncidenceCompletionPriority *parent)
: q(parent), mUi(0), mOrigPercentCompleted(-1)
: q(parent), mUi(Q_NULLPTR), mOrigPercentCompleted(-1)
{
}
......@@ -55,7 +55,7 @@ void IncidenceCompletionPriority::Private::sliderValueChanged(int value)
IncidenceCompletionPriority::IncidenceCompletionPriority(Ui::EventOrTodoDesktop *ui)
: IncidenceEditor(), d(new Private(this))
{
Q_ASSERT(ui != 0);
Q_ASSERT(ui != Q_NULLPTR);
setObjectName(QStringLiteral("IncidenceCompletionPriority"));
d->mUi = ui;
......@@ -83,7 +83,7 @@ void IncidenceCompletionPriority::load(const KCalCore::Incidence::Ptr &incidence
// TODO priority might be valid for other incidence types as well
// only for Todos
KCalCore::Todo::Ptr todo = IncidenceCompletionPriority::incidence<KCalCore::Todo>();
if (todo == 0) {
if (todo == Q_NULLPTR) {
mWasDirty = false;
return;
}
......@@ -110,7 +110,7 @@ void IncidenceCompletionPriority::save(const KCalCore::Incidence::Ptr &incidence
// TODO priority might be valid for other incidence types as well
// only for Todos
KCalCore::Todo::Ptr todo = IncidenceCompletionPriority::incidence<KCalCore::Todo>(incidence);
if (todo == 0) {
if (todo == Q_NULLPTR) {
return;
}
......
......@@ -70,7 +70,7 @@ static bool incidenceHasDefaultTimes(const KCalCore::Incidence::Ptr &incidence)
}
IncidenceDateTime::IncidenceDateTime(Ui::EventOrTodoDesktop *ui)
: IncidenceEditor(0), mUi(ui),
: IncidenceEditor(Q_NULLPTR), mUi(ui),
mTimezoneCombosWereVisibile(false)
{
setTimeZonesVisibility(false);
......
......@@ -46,7 +46,7 @@ public:
}
IncidenceDescription::IncidenceDescription(Ui::EventOrTodoDesktop *ui)
: IncidenceEditor(0), mUi(ui), d(new IncidenceDescriptionPrivate())
: IncidenceEditor(Q_NULLPTR), mUi(ui), d(new IncidenceDescriptionPrivate())
{
setObjectName(QStringLiteral("IncidenceDescription"));
mUi->mRichTextLabel->setContextMenuPolicy(Qt::NoContextMenu);
......
......@@ -47,7 +47,7 @@ IncidenceDialog *IncidenceDialogFactory::create(bool needsSaving,
return dialog;
}
default:
return 0;
return Q_NULLPTR;
}
}
......@@ -81,7 +81,7 @@ IncidenceDialog *IncidenceDialogFactory::createTodoEditor(const QString &summary
IncidenceDialog *dialog = create(true, /* no need for, we're not editing an existing to-do */
KCalCore::Incidence::TypeTodo,
0,
Q_NULLPTR,
parent, flags);
dialog->selectCollection(defaultCollection);
dialog->load(item);
......@@ -119,7 +119,7 @@ IncidenceDialog *IncidenceDialogFactory::createEventEditor(const QString &summar
IncidenceDialog *dialog =
create(false, // not needed for saving, as we're not editing an existing incidence
KCalCore::Incidence::TypeEvent,
0,
Q_NULLPTR,
parent, flags);
dialog->selectCollection(defaultCollection);
......
......@@ -23,7 +23,7 @@
using namespace IncidenceEditorNG;
IncidenceEditorSettings *IncidenceEditorSettings::mSelf = 0;
IncidenceEditorSettings *IncidenceEditorSettings::mSelf = Q_NULLPTR;
IncidenceEditorSettings *IncidenceEditorSettings::self()
{
......
......@@ -159,7 +159,7 @@ void IncidenceRecurrence::load(const KCalCore::Incidence::Ptr &incidence)
}
int f = 0;
KCalCore::Recurrence *r = 0;
KCalCore::Recurrence *r = Q_NULLPTR;
if (mLoadedIncidence->recurrenceType() != KCalCore::Recurrence::rNone) {
r = mLoadedIncidence->recurrence();
f = r->frequency();
......
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