Commit d39b87ab authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Modernize code

parent 08063ba5
Pipeline #39340 passed with stage
in 25 minutes and 18 seconds
......@@ -96,12 +96,12 @@ bool ReminderTreeItem::operator<(const QTreeWidgetItem &other) const
switch (treeWidget()->sortColumn()) {
case 1:
{ // happening datetime
const ReminderTreeItem *item = static_cast<const ReminderTreeItem *>(&other);
const auto *item = static_cast<const ReminderTreeItem *>(&other);
return item->mHappening < mHappening;
}
case 2:
{ // trigger datetime
const ReminderTreeItem *item = static_cast<const ReminderTreeItem *>(&other);
const auto *item = static_cast<const ReminderTreeItem *>(&other);
return item->mTrigger < mTrigger;
}
default:
......@@ -150,8 +150,8 @@ AlarmDialog::AlarmDialog(const Akonadi::ETMCalendar::Ptr &calendar, QWidget *par
QWidget *topBox = new QWidget(this);
setWindowTitle(i18nc("@title:window", "Reminders"));
setWindowIcon(QIcon::fromTheme(QStringLiteral("korgac")));
QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
auto *buttonBox = new QDialogButtonBox(this);
auto *mainLayout = new QVBoxLayout(this);
mainLayout->addWidget(topBox);
mOkButton = new QPushButton;
mOkButton->setShortcut(Qt::CTRL | Qt::Key_Return);
......@@ -195,7 +195,7 @@ AlarmDialog::AlarmDialog(const Akonadi::ETMCalendar::Ptr &calendar, QWidget *par
"Press this button to suspend the currently selected incidences. "
"The suspend interval is configurable by the Suspend duration settings."));
QVBoxLayout *topLayout = new QVBoxLayout(topBox);
auto *topLayout = new QVBoxLayout(topBox);
// Try to keep the dialog small and non-obtrusive.
// the user can resize down to the minimum
setMinimumSize(280, 160);
......@@ -258,7 +258,7 @@ AlarmDialog::AlarmDialog(const Akonadi::ETMCalendar::Ptr &calendar, QWidget *par
mLastItem = nullptr;
QWidget *suspendBox = new QWidget(topBox);
QHBoxLayout *suspendBoxHBoxLayout = new QHBoxLayout(suspendBox);
auto *suspendBoxHBoxLayout = new QHBoxLayout(suspendBox);
suspendBoxHBoxLayout->setContentsMargins({});
topLayout->addWidget(suspendBox);
......@@ -328,7 +328,7 @@ ReminderTreeItem *AlarmDialog::searchByItem(const Akonadi::Item &incidence)
ReminderTreeItem *found = nullptr;
QTreeWidgetItemIterator it(mIncidenceTree);
while (*it) {
ReminderTreeItem *item = static_cast<ReminderTreeItem *>(*it);
auto *item = static_cast<ReminderTreeItem *>(*it);
if (item->mIncidence == incidence) {
found = item;
break;
......@@ -535,7 +535,7 @@ void AlarmDialog::suspend()
if ((*it)->isSelected() && !(*it)->isDisabled()) { //suspend selected, non-suspended reminders
(*it)->setSelected(false);
(*it)->setDisabled(true);
ReminderTreeItem *item = static_cast<ReminderTreeItem *>(*it);
auto *item = static_cast<ReminderTreeItem *>(*it);
item->mRemindAt = QDateTime::currentDateTime().addSecs(unit * mSuspendSpin->value());
item->mHappening = item->mRemindAt;
item->mNotified = false;
......@@ -572,7 +572,7 @@ void AlarmDialog::setTimer()
QTreeWidgetItemIterator it(mIncidenceTree);
while (*it) {
ReminderTreeItem *item = static_cast<ReminderTreeItem *>(*it);
auto *item = static_cast<ReminderTreeItem *>(*it);
if (item->mRemindAt > QDateTime::currentDateTime()) {
const int secs = QDateTime::currentDateTime().secsTo(item->mRemindAt);
nextReminderAt = nextReminderAt <= 0 ? secs : qMin(nextReminderAt, secs);
......@@ -609,7 +609,7 @@ void AlarmDialog::show()
// select the first item that hasn't already been notified
QTreeWidgetItemIterator it(mIncidenceTree);
while (*it) {
ReminderTreeItem *item = static_cast<ReminderTreeItem *>(*it);
auto *item = static_cast<ReminderTreeItem *>(*it);
if (!item->mNotified && !item->isDisabled()) {
(*it)->setSelected(true);
break;
......@@ -663,7 +663,7 @@ void AlarmDialog::eventNotification()
QTreeWidgetItemIterator it(mIncidenceTree);
while (*it) {
ReminderTreeItem *item = static_cast<ReminderTreeItem *>(*it);
auto *item = static_cast<ReminderTreeItem *>(*it);
++it;
if (item->isDisabled() || item->mNotified) {
//skip suspended reminders or reminders that have been notified
......@@ -784,7 +784,7 @@ void AlarmDialog::wakeUp()
if (!firstItem) {
firstItem = *it;
}
ReminderTreeItem *item = static_cast<ReminderTreeItem *>(*it);
auto *item = static_cast<ReminderTreeItem *>(*it);
Incidence::Ptr incidence = CalendarSupport::incidence(item->mIncidence);
if (item->mRemindAt <= QDateTime::currentDateTime()) {
......@@ -830,7 +830,7 @@ void AlarmDialog::slotSave()
QTreeWidgetItemIterator it(mIncidenceTree);
while (*it) {
ReminderTreeItem *item = static_cast<ReminderTreeItem *>(*it);
auto *item = static_cast<ReminderTreeItem *>(*it);
KConfigGroup incidenceConfig(config,
QStringLiteral("Incidence-%1").arg(numReminders + 1));
......@@ -942,7 +942,7 @@ void AlarmDialog::showDetails(QTreeWidgetItem *item)
return;
}
ReminderTreeItem *reminderItem = dynamic_cast<ReminderTreeItem *>(item);
auto *reminderItem = dynamic_cast<ReminderTreeItem *>(item);
if (!reminderItem) {
mDetailView->setIncidence(Akonadi::Item());
......
......@@ -258,7 +258,7 @@ bool MailClient::send(const KIdentityManagement::Identity &identity, const QStri
message->contentType()->setParameter(QStringLiteral("method"), QStringLiteral("request"));
if (!attachment.isEmpty()) {
KMime::Headers::ContentDisposition *disposition
auto *disposition
= new KMime::Headers::ContentDisposition;
disposition->setDisposition(KMime::Headers::CDinline);
message->setHeader(disposition);
......@@ -276,8 +276,8 @@ bool MailClient::send(const KIdentityManagement::Identity &identity, const QStri
ct->setCategory(KMime::Headers::CCcontainer);
// Set the first multipart, the body message.
KMime::Content *bodyMessage = new KMime::Content;
KMime::Headers::ContentDisposition *bodyDisposition
auto *bodyMessage = new KMime::Content;
auto *bodyDisposition
= new KMime::Headers::ContentDisposition;
bodyDisposition->setDisposition(KMime::Headers::CDinline);
bodyMessage->contentType()->setMimeType("text/plain");
......@@ -289,8 +289,8 @@ bool MailClient::send(const KIdentityManagement::Identity &identity, const QStri
// Set the second multipart, the attachment.
if (!attachment.isEmpty()) {
KMime::Content *attachMessage = new KMime::Content;
KMime::Headers::ContentDisposition *attachDisposition
auto *attachMessage = new KMime::Content;
auto *attachDisposition
= new KMime::Headers::ContentDisposition;
attachDisposition->setDisposition(KMime::Headers::CDattachment);
attachMessage->contentType()->setMimeType("text/calendar");
......@@ -309,7 +309,7 @@ bool MailClient::send(const KIdentityManagement::Identity &identity, const QStri
message->assemble();
// Put the newly created item in the MessageQueueJob.
MailTransport::MessageQueueJob *qjob = new MailTransport::MessageQueueJob(this);
auto *qjob = new MailTransport::MessageQueueJob(this);
qjob->transportAttribute().setTransportId(transportId);
if (identity.disabledFcc()) {
......
......@@ -35,7 +35,7 @@ int main(int argc, char **argv)
parser.addHelpOption();
parser.process(app);
Event *e1 = new Event;
auto *e1 = new Event;
e1->setSummary(QStringLiteral("This is a summary."));
QDateTime now = QDateTime::currentDateTime();
e1->setDtStart(now);
......@@ -49,14 +49,14 @@ int main(int argc, char **argv)
t1->setDtDue(now);
t1->newAlarm();
Event *e2 = new Event;
auto *e2 = new Event;
e2->setSummary(QStringLiteral("This is another summary. "
"But it is a very long summary of total sillyness for no good reason"));
e2->setDtStart(now.addDays(1));
e2->setDtEnd(now.addDays(2));
e2->newAlarm();
Event *e3 = new Event;
auto *e3 = new Event;
e3->setSummary(QStringLiteral("Meet with Fred"));
e3->setDtStart(now.addDays(2));
e3->setDtEnd(now.addDays(3));
......@@ -72,7 +72,7 @@ int main(int argc, char **argv)
t3->setDtDue(now);
t3->newAlarm();
Event *e4 = new Event;
auto *e4 = new Event;
e4->setSummary(QStringLiteral("Watch TV"));
e4->setDtStart(now.addSecs(120));
e4->setDtEnd(now.addSecs(180));
......
......@@ -204,7 +204,7 @@ void ActionManager::createCalendarAkonadi()
mCollectionView->setCollectionSelectionProxyModel(checkableProxy);
CalendarSupport::CollectionSelection *collectionSelection
auto *collectionSelection
= new CalendarSupport::CollectionSelection(selectionModel);
EventViews::EventView::setGlobalCollectionSelection(collectionSelection);
......@@ -864,7 +864,7 @@ void ActionManager::slotMergeFinished(bool success, int total)
{
Q_ASSERT(sender());
mImportAction->setEnabled(true);
Akonadi::ICalImporter *importer = qobject_cast<Akonadi::ICalImporter *>(sender());
auto *importer = qobject_cast<Akonadi::ICalImporter *>(sender());
if (success) {
mCalendarView->showMessage(i18np("1 incidence was imported successfully.",
......@@ -881,7 +881,7 @@ void ActionManager::slotMergeFinished(bool success, int total)
void ActionManager::slotNewResourceFinished(bool success)
{
Q_ASSERT(sender());
Akonadi::ICalImporter *importer = qobject_cast<Akonadi::ICalImporter *>(sender());
auto *importer = qobject_cast<Akonadi::ICalImporter *>(sender());
mImportAction->setEnabled(true);
if (success) {
mCalendarView->showMessage(i18n("New calendar added successfully"),
......@@ -996,7 +996,7 @@ void ActionManager::file_archive()
bool ActionManager::importURL(const QUrl &url, bool merge)
{
Akonadi::ICalImporter *importer = new Akonadi::ICalImporter();
auto *importer = new Akonadi::ICalImporter();
bool jobStarted;
if (merge) {
connect(importer, &Akonadi::ICalImporter::importIntoExistingFinished, this,
......@@ -1516,7 +1516,7 @@ void ActionManager::openEventEditor(const QString &summary, const QString &descr
action = IncidenceEditorNG::IncidenceEditorSettings::Link;
} else if (IncidenceEditorNG::IncidenceEditorSettings::self()->defaultEmailAttachMethod()
== IncidenceEditorNG::IncidenceEditorSettings::Ask) {
QMenu *menu = new QMenu(nullptr);
auto *menu = new QMenu(nullptr);
QAction *attachLink = menu->addAction(i18n("Attach as &link"));
QAction *attachInline = menu->addAction(i18n("Attach &inline"));
QAction *attachBody = menu->addAction(i18n("Attach inline &without attachments"));
......@@ -1553,7 +1553,7 @@ void ActionManager::openEventEditor(const QString &summary, const QString &descr
if (!f.open(QFile::ReadOnly)) {
return;
}
KMime::Message *msg = new KMime::Message();
auto *msg = new KMime::Message();
msg->setContent(f.readAll());
msg->parse();
if (msg == msg->textContent() || msg->textContent() == nullptr) { // no attachments
......@@ -1568,7 +1568,7 @@ void ActionManager::openEventEditor(const QString &summary, const QString &descr
delete msg;
return;
}
KMime::Message *newMsg = new KMime::Message();
auto *newMsg = new KMime::Message();
newMsg->setHead(msg->head());
newMsg->setBody(msg->textContent()->body());
newMsg->parse();
......@@ -1613,7 +1613,7 @@ void ActionManager::openTodoEditor(const QString &summary, const QString &descri
if (attachmentMimetype != QLatin1String("message/rfc822")) {
action = KOPrefs::TodoAttachLink;
} else if (KOPrefs::instance()->defaultTodoAttachMethod() == KOPrefs::TodoAttachAsk) {
QMenu *menu = new QMenu(nullptr);
auto *menu = new QMenu(nullptr);
QAction *attachLink = menu->addAction(i18n("Attach as &link"));
QAction *attachInline = menu->addAction(i18n("Attach &inline"));
menu->addSeparator();
......
......@@ -325,7 +325,7 @@ protected:
const Akonadi::Collection &col
= sourceIndex.data(Akonadi::EntityTreeModel::CollectionRole).value<Akonadi::Collection>();
const Akonadi::CollectionIdentificationAttribute *attr
const auto *attr
= col.attribute<Akonadi::CollectionIdentificationAttribute>();
//We filter the user folders because we insert person nodes for user folders.
......@@ -407,10 +407,10 @@ AkonadiCollectionView::AkonadiCollectionView(CalendarView *view, bool hasContext
{
mManagerShowCollectionProperties = new ManageShowCollectionProperties(this, this);
QVBoxLayout *topLayout = new QVBoxLayout(this);
auto *topLayout = new QVBoxLayout(this);
topLayout->setContentsMargins({});
QLineEdit *searchCol = new QLineEdit(this);
auto *searchCol = new QLineEdit(this);
searchCol->setToolTip(i18nc("@info:tooltip", "Set search keyword"));
searchCol->setWhatsThis(
i18nc("@info:whatsthis", "Lets you search for a keyword in your calendars"));
......@@ -419,16 +419,16 @@ AkonadiCollectionView::AkonadiCollectionView(CalendarView *view, bool hasContext
"textbox, verb to search", "Search..."));
topLayout->addWidget(searchCol);
ColorProxyModel *colorProxy = new ColorProxyModel(this);
auto *colorProxy = new ColorProxyModel(this);
colorProxy->setObjectName(QStringLiteral("Show calendar colors"));
colorProxy->setDynamicSortFilter(true);
mBaseModel = colorProxy;
CalendarDelegateModel *calendarDelegateModel = new CalendarDelegateModel(this);
auto *calendarDelegateModel = new CalendarDelegateModel(this);
calendarDelegateModel->setSourceModel(mBaseModel);
//Hide collections that are not required
CollectionFilter *collectionFilter = new CollectionFilter(this);
auto *collectionFilter = new CollectionFilter(this);
collectionFilter->setSourceModel(calendarDelegateModel);
mCollectionView = new Akonadi::EntityTreeView(this);
......@@ -436,7 +436,7 @@ AkonadiCollectionView::AkonadiCollectionView(CalendarView *view, bool hasContext
mCollectionView->setRootIsDecorated(true);
// mCollectionView->setSorting( true );
{
StyledCalendarDelegate *delegate = new StyledCalendarDelegate(mCollectionView);
auto *delegate = new StyledCalendarDelegate(mCollectionView);
connect(delegate, &StyledCalendarDelegate::action, this, &AkonadiCollectionView::onAction);
mCollectionView->setItemDelegate(delegate);
}
......@@ -448,11 +448,11 @@ AkonadiCollectionView::AkonadiCollectionView(CalendarView *view, bool hasContext
= new NewNodeExpander(mCollectionView, false, QStringLiteral("CollectionTreeView"));
//Filter tree view.
ReparentingModel *searchProxy = new ReparentingModel(this);
auto *searchProxy = new ReparentingModel(this);
searchProxy->setSourceModel(collectionFilter);
searchProxy->setObjectName(QStringLiteral("searchProxy"));
QSortFilterProxyModel *filterTreeViewModel = new QSortFilterProxyModel(this);
auto *filterTreeViewModel = new QSortFilterProxyModel(this);
filterTreeViewModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
filterTreeViewModel->setRecursiveFilteringEnabled(true);
filterTreeViewModel->setDynamicSortFilter(true);
......@@ -460,11 +460,11 @@ AkonadiCollectionView::AkonadiCollectionView(CalendarView *view, bool hasContext
connect(searchCol, &QLineEdit::textChanged, filterTreeViewModel,
&QSortFilterProxyModel::setFilterWildcard);
Akonadi::EntityTreeView *mSearchView = new Akonadi::EntityTreeView(this);
auto *mSearchView = new Akonadi::EntityTreeView(this);
mSearchView->header()->hide();
mSearchView->setRootIsDecorated(true);
{
StyledCalendarDelegate *delegate = new StyledCalendarDelegate(mCollectionView);
auto *delegate = new StyledCalendarDelegate(mCollectionView);
connect(delegate, &StyledCalendarDelegate::action, this, &AkonadiCollectionView::onAction);
mSearchView->setItemDelegate(delegate);
}
......@@ -598,7 +598,7 @@ void AkonadiCollectionView::slotServerSideSubscription()
if (!collection.isValid()) {
return;
}
PimCommon::ManageServerSideSubscriptionJob *job
auto *job
= new PimCommon::ManageServerSideSubscriptionJob(this);
job->setCurrentCollection(collection);
job->setParentWidget(this);
......@@ -738,7 +738,7 @@ void AkonadiCollectionView::newCalendar()
mNotSendAddRemoveSignal = true;
const Akonadi::AgentType agentType = dlg->agentType();
if (agentType.isValid()) {
Akonadi::AgentInstanceCreateJob *job = new Akonadi::AgentInstanceCreateJob(agentType,
auto *job = new Akonadi::AgentInstanceCreateJob(agentType,
this);
job->configure(this);
connect(job, &Akonadi::AgentInstanceCreateJob::result, this,
......@@ -751,7 +751,7 @@ void AkonadiCollectionView::newCalendar()
void AkonadiCollectionView::newCalendarDone(KJob *job)
{
Akonadi::AgentInstanceCreateJob *createjob
auto *createjob
= static_cast<Akonadi::AgentInstanceCreateJob *>(job);
if (createjob->error()) {
//TODO(AKONADI_PORT)
......@@ -790,7 +790,7 @@ void AkonadiCollectionView::deleteCalendar()
if (!isTopLevel) {
// deletes contents
Akonadi::CollectionDeleteJob *job = new Akonadi::CollectionDeleteJob(collection, this);
auto *job = new Akonadi::CollectionDeleteJob(collection, this);
connect(job, &Akonadi::AgentInstanceCreateJob::result, this,
&AkonadiCollectionView::deleteCalendarDone);
} else {
......@@ -806,7 +806,7 @@ void AkonadiCollectionView::deleteCalendar()
void AkonadiCollectionView::deleteCalendarDone(KJob *job)
{
Akonadi::CollectionDeleteJob *deletejob = static_cast<Akonadi::CollectionDeleteJob *>(job);
auto *deletejob = static_cast<Akonadi::CollectionDeleteJob *>(job);
if (deletejob->error()) {
qCWarning(KORGANIZER_LOG) << "Delete calendar failed:" << deletejob->errorString();
mNotSendAddRemoveSignal = false;
......@@ -888,9 +888,9 @@ bool AkonadiCollectionView::isChecked(const Akonadi::Collection &collection) con
Akonadi::EntityTreeModel *AkonadiCollectionView::entityTreeModel() const
{
QAbstractProxyModel *proxy = qobject_cast<QAbstractProxyModel *>(mCollectionView->model());
auto *proxy = qobject_cast<QAbstractProxyModel *>(mCollectionView->model());
while (proxy) {
Akonadi::EntityTreeModel *etm = qobject_cast<Akonadi::EntityTreeModel *>(
auto *etm = qobject_cast<Akonadi::EntityTreeModel *>(
proxy->sourceModel());
if (etm) {
return etm;
......@@ -904,7 +904,7 @@ Akonadi::EntityTreeModel *AkonadiCollectionView::entityTreeModel() const
void AkonadiCollectionView::onAction(const QModelIndex &index, int a)
{
const StyledCalendarDelegate::Action action = static_cast<StyledCalendarDelegate::Action>(a);
const auto action = static_cast<StyledCalendarDelegate::Action>(a);
switch (action) {
case StyledCalendarDelegate::Quickview:
{
......
......@@ -35,10 +35,10 @@ void KoEventPopupMenuTest::createEventFromEvent()
menu.setCalendar(calendar);
menu.showIncidencePopup(item, QDate());
QAction *createevent = menu.findChild<QAction *>(QStringLiteral("createevent"));
auto *createevent = menu.findChild<QAction *>(QStringLiteral("createevent"));
createevent->trigger();
IncidenceEditorNG::IncidenceDialog *dlg
auto *dlg
= menu.findChild<IncidenceEditorNG::IncidenceDialog *>(QStringLiteral("incidencedialog"));
QVERIFY(!dlg);
}
......@@ -55,10 +55,10 @@ void KoEventPopupMenuTest::createTodoFromTodo()
menu.setCalendar(calendar);
menu.showIncidencePopup(item, QDate());
QAction *createtodo = menu.findChild<QAction *>(QStringLiteral("createtodo"));
auto *createtodo = menu.findChild<QAction *>(QStringLiteral("createtodo"));
createtodo->trigger();
IncidenceEditorNG::IncidenceDialog *dlg
auto *dlg
= menu.findChild<IncidenceEditorNG::IncidenceDialog *>(QStringLiteral("incidencedialog"));
QVERIFY(!dlg);
}
......@@ -83,12 +83,12 @@ void KoEventPopupMenuTest::createEventFromTodo()
menu.setCalendar(calendar);
menu.showIncidencePopup(item, QDate());
QAction *createevent = menu.findChild<QAction *>(QStringLiteral("createevent"));
auto *createevent = menu.findChild<QAction *>(QStringLiteral("createevent"));
createevent->trigger();
IncidenceEditorNG::IncidenceDialog *dlg
auto *dlg
= menu.findChild<IncidenceEditorNG::IncidenceDialog *>();
QVERIFY(dlg);
IncidenceEditorNG::IncidenceEditor *editor
auto *editor
= menu.findChild<IncidenceEditorNG::IncidenceEditor *>();
QVERIFY(editor);
KCalendarCore::Event::Ptr event(editor->incidence<KCalendarCore::Event>());
......@@ -119,12 +119,12 @@ void KoEventPopupMenuTest::createTodoFromEvent()
menu.setCalendar(calendar);
menu.showIncidencePopup(item, QDate());
QAction *createtodo = menu.findChild<QAction *>(QStringLiteral("createtodo"));
auto *createtodo = menu.findChild<QAction *>(QStringLiteral("createtodo"));
createtodo->trigger();
IncidenceEditorNG::IncidenceDialog *dlg
auto *dlg
= menu.findChild<IncidenceEditorNG::IncidenceDialog *>();
QVERIFY(dlg);
IncidenceEditorNG::IncidenceEditor *editor
auto *editor
= menu.findChild<IncidenceEditorNG::IncidenceEditor *>();
QVERIFY(editor);
KCalendarCore::Todo::Ptr todo(editor->incidence<KCalendarCore::Todo>());
......@@ -157,8 +157,8 @@ void KoEventPopupMenuTest::createNoteFromEvent()
menu.setCalendar(calendar);
menu.showIncidencePopup(item, QDate());
QAction *createnote = menu.findChild<QAction *>(QStringLiteral("createnote"));
CalendarSupport::NoteEditDialog *noteedit = menu.findChild<CalendarSupport::NoteEditDialog *>();
auto *createnote = menu.findChild<QAction *>(QStringLiteral("createnote"));
auto *noteedit = menu.findChild<CalendarSupport::NoteEditDialog *>();
QVERIFY(!noteedit);
createnote->trigger();
noteedit = menu.findChild<CalendarSupport::NoteEditDialog *>();
......@@ -195,9 +195,9 @@ void KoEventPopupMenuTest::createNoteFromTodo()
menu.setCalendar(calendar);
menu.showIncidencePopup(item, QDate());
QAction *createnote = menu.findChild<QAction *>(QStringLiteral("createnote"));
auto *createnote = menu.findChild<QAction *>(QStringLiteral("createnote"));
CalendarSupport::NoteEditDialog *noteedit = menu.findChild<CalendarSupport::NoteEditDialog *>();
auto *noteedit = menu.findChild<CalendarSupport::NoteEditDialog *>();
QVERIFY(!noteedit);
createnote->trigger();
noteedit = menu.findChild<CalendarSupport::NoteEditDialog *>();
......@@ -223,9 +223,9 @@ void KoEventPopupMenuTest::defaultMenuEventVisible()
menu.setCalendar(calendar);
menu.showIncidencePopup(item, QDate());
QAction *createevent = menu.findChild<QAction *>(QStringLiteral("createevent"));
QAction *createnote = menu.findChild<QAction *>(QStringLiteral("createnote"));
QAction *createtodo = menu.findChild<QAction *>(QStringLiteral("createtodo"));
auto *createevent = menu.findChild<QAction *>(QStringLiteral("createevent"));
auto *createnote = menu.findChild<QAction *>(QStringLiteral("createnote"));
auto *createtodo = menu.findChild<QAction *>(QStringLiteral("createtodo"));
QVERIFY(!createevent->isVisible());
QVERIFY(createnote->isVisible());
QVERIFY(createtodo->isVisible());
......@@ -244,9 +244,9 @@ void KoEventPopupMenuTest::defaultMenuTodoVisible()
menu.setCalendar(calendar);
menu.showIncidencePopup(item, QDate());
QAction *createevent = menu.findChild<QAction *>(QStringLiteral("createevent"));
QAction *createnote = menu.findChild<QAction *>(QStringLiteral("createnote"));
QAction *createtodo = menu.findChild<QAction *>(QStringLiteral("createtodo"));
auto *createevent = menu.findChild<QAction *>(QStringLiteral("createevent"));
auto *createnote = menu.findChild<QAction *>(QStringLiteral("createnote"));
auto *createtodo = menu.findChild<QAction *>(QStringLiteral("createtodo"));
QVERIFY(createevent->isVisible());
QVERIFY(createnote->isVisible());
QVERIFY(!createtodo->isVisible());
......
......@@ -134,7 +134,7 @@ CalendarView::CalendarView(QWidget *parent)
mDateNavigator = new DateNavigator(this);
mDateChecker = new DateChecker(this);
QVBoxLayout *topLayout = new QVBoxLayout(this);
auto *topLayout = new QVBoxLayout(this);
topLayout->setContentsMargins({});
// create the main layout frames.
......@@ -156,7 +156,7 @@ CalendarView::CalendarView(QWidget *parent)
mTodoList->setObjectName(QStringLiteral("todolist"));
mEventViewerBox = new QWidget(mLeftSplitter);
QVBoxLayout *mEventViewerBoxVBoxLayout = new QVBoxLayout(mEventViewerBox);
auto *mEventViewerBoxVBoxLayout = new QVBoxLayout(mEventViewerBox);
mEventViewerBoxVBoxLayout->setContentsMargins({});
mEventViewerBoxVBoxLayout->setContentsMargins({});
mEventViewer = new CalendarSupport::IncidenceViewer(mCalendar.data(), mEventViewerBox);
......@@ -164,7 +164,7 @@ CalendarView::CalendarView(QWidget *parent)
mEventViewerBoxVBoxLayout->addWidget(mEventViewer);
QWidget *rightBox = new QWidget(mPanner);
QVBoxLayout *rightBoxVBoxLayout = new QVBoxLayout(rightBox);
auto *rightBoxVBoxLayout = new QVBoxLayout(rightBox);
rightBoxVBoxLayout->setContentsMargins({});
mNavigatorBar = new NavigatorBar(rightBox);
rightBoxVBoxLayout->addWidget(mNavigatorBar);
......@@ -483,7 +483,7 @@ void CalendarView::readFilterSettings(KConfig *config)
QStringList::ConstIterator it = filterList.constBegin();
QStringList::ConstIterator end = filterList.constEnd();
while (it != end) {
KCalendarCore::CalFilter *filter = new KCalendarCore::CalFilter(*it);
auto *filter = new KCalendarCore::CalFilter(*it);
KConfigGroup filterConfig(config, QStringLiteral("Filter_") + (*it));
filter->setCriteria(filterConfig.readEntry("Criteria", 0));
filter->setCategoryList(filterConfig.readEntry("CategoryList", QStringList()));
......@@ -1824,7 +1824,7 @@ void CalendarView::exportICalendar()
return;
}
}
KCalendarCore::ICalFormat *format = new KCalendarCore::ICalFormat;
auto *format = new KCalendarCore::ICalFormat;
KCalendarCore::FileStorage storage(mCalendar, filename, format);
if (!storage.save()) {
......@@ -2168,7 +2168,7 @@ void CalendarView::pasteIncidence()
void CalendarView::showIncidence(const Akonadi::Item &item)
{
KOEventViewerDialog *eventViewer = new KOEventViewerDialog(mCalendar.data(), this);
auto *eventViewer = new KOEventViewerDialog(mCalendar.data(), this);
eventViewer->setIncidence(item, QDate());
// Disable the Edit button for read-only Incidences.
if (!mCalendar->hasRight(item, Akonadi::Collection::CanChangeItem)) {
......
......@@ -40,9 +40,9 @@ CollectionGeneralPage::CollectionGeneralPage(QWidget *parent)
void CollectionGeneralPage::init(const Akonadi::Collection &collection)
{
QVBoxLayout *topLayout = new QVBoxLayout(this);
auto *topLayout = new QVBoxLayout(this);
QHBoxLayout *hbox = new QHBoxLayout();
auto *hbox = new QHBoxLayout();
topLayout->addItem(hbox);
QLabel *label = new QLabel(i18nc("@label:textbox Name of the folder.", "&Name:"), this);
......@@ -86,7 +86,7 @@ void CollectionGeneralPage::init(const Akonadi::Collection &collection)
if ((collection.parentCollection() != Akonadi::Collection::root())
&& PimCommon::Util::isImapResource(collection.resource())) {
const PimCommon::CollectionAnnotationsAttribute *annotationAttribute
const auto *annotationAttribute
= collection.attribute<PimCommon::CollectionAnnotationsAttribute>();
const QMap<QByteArray, QByteArray> annotations
......@@ -160,7 +160,7 @@ void CollectionGeneralPage::save(Collection &collection)
collection.setName(mNameEdit->text());
}
BlockAlarmsAttribute *attr
auto *attr
= collection.attribute<BlockAlarmsAttribute>(Collection::AddIfMissing);
attr->blockEverything(mBlockAlarmsCheckBox->isChecked());
......@@ -170,7 +170,7 @@ void CollectionGeneralPage::save(Collection &collection)
} else if (collection.hasAttribute<EntityDisplayAttribute>()) {
collection.attribute<EntityDisplayAttribute>()->setIconName(QString());
}
PimCommon::CollectionAnnotationsAttribute *annotationsAttribute
auto *annotationsAttribute
= collection.attribute<PimCommon::CollectionAnnotationsAttribute>(Collection::AddIfMissing);
QMap<QByteArray, QByteArray> annotations = annotationsAttribute->annotations();
......
......@@ -226,7 +226,7 @@ void DateNavigatorContainer::resizeAllContents()
}
while (count > (mExtraViews.count() + 1)) {
KDateNavigator *n = new KDateNavigator(this);