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

Modernize code

parent 66b7dac1
Pipeline #60417 passed with stage
in 6 minutes and 13 seconds
......@@ -41,7 +41,7 @@ ArchiveDialog::ArchiveDialog(const Akonadi::ETMCalendar::Ptr &cal, Akonadi::Inci
{
setWindowTitle(i18nc("@title:window", "Archive/Delete Past Events and To-dos"));
auto mainLayout = new QVBoxLayout(this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel, this);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel, this);
mUser1Button = new QPushButton;
buttonBox->addButton(mUser1Button, QDialogButtonBox::ActionRole);
connect(buttonBox, &QDialogButtonBox::rejected, this, &ArchiveDialog::reject);
......@@ -51,13 +51,13 @@ ArchiveDialog::ArchiveDialog(const Akonadi::ETMCalendar::Ptr &cal, Akonadi::Inci
mCalendar = cal;
mChanger = changer;
QFrame *topFrame = new QFrame(this);
auto topFrame = new QFrame(this);
mainLayout->addWidget(topFrame);
mainLayout->addWidget(buttonBox);
auto topLayout = new QVBoxLayout(topFrame);
topLayout->setContentsMargins(0, 0, 0, 0);
QLabel *descLabel = new QLabel(topFrame);
auto descLabel = new QLabel(topFrame);
descLabel->setText(xi18nc("@info:whatsthis",
"Archiving saves old items into the given file and "
"then deletes them in the current calendar. If the archive file "
......@@ -100,7 +100,7 @@ ArchiveDialog::ArchiveDialog(const Akonadi::ETMCalendar::Ptr &cal, Akonadi::Inci
// Checkbox, numinput and combo for auto-archiving (similar to kmail's
// mExpireFolderCheckBox/mReadExpiryTimeNumInput in kmfolderdia.cpp)
QWidget *autoArchiveHBox = new QWidget(topFrame);
auto autoArchiveHBox = new QWidget(topFrame);
auto autoArchiveHBoxHBoxLayout = new QHBoxLayout(autoArchiveHBox);
autoArchiveHBoxHBoxLayout->setContentsMargins(0, 0, 0, 0);
topLayout->addWidget(autoArchiveHBox);
......@@ -137,7 +137,7 @@ ArchiveDialog::ArchiveDialog(const Akonadi::ETMCalendar::Ptr &cal, Akonadi::Inci
auto fileLayout = new QHBoxLayout();
fileLayout->setContentsMargins(0, 0, 0, 0);
QLabel *l = new QLabel(i18nc("@label", "Archive &file:"), topFrame);
auto l = new QLabel(i18nc("@label", "Archive &file:"), topFrame);
fileLayout->addWidget(l);
mArchiveFile = new KUrlRequester(QUrl::fromLocalFile(KCalPrefs::instance()->mArchiveFile), topFrame);
mArchiveFile->setMode(KFile::File);
......@@ -153,7 +153,7 @@ ArchiveDialog::ArchiveDialog(const Akonadi::ETMCalendar::Ptr &cal, Akonadi::Inci
fileLayout->addWidget(mArchiveFile);
topLayout->addLayout(fileLayout);
QGroupBox *typeBox = new QGroupBox(i18nc("@title:group", "Type of Items to Archive"));
auto typeBox = new QGroupBox(i18nc("@title:group", "Type of Items to Archive"));
typeBox->setWhatsThis(i18nc("@info:whatsthis",
"Here you can select which items "
"should be archived. Events are archived if they "
......
......@@ -172,7 +172,7 @@ bool AttachmentHandler::view(const Attachment &attachment)
// put the attachment in a temporary file and launch it
QUrl tempUrl = tempFileForAttachment(attachment);
if (tempUrl.isValid()) {
KIO::OpenUrlJob *job = new KIO::OpenUrlJob(tempUrl, attachment.mimeType());
auto job = new KIO::OpenUrlJob(tempUrl, attachment.mimeType());
job->setDeleteTemporaryFile(true);
job->setRunExecutables(true);
job->start();
......
......@@ -37,7 +37,7 @@ NoteEditDialogTest::NoteEditDialogTest()
collection.setName(QString::number(id));
collection.setContentMimeTypes(QStringList() << Akonadi::NoteUtils::noteMimeType());
QStandardItem *item = new QStandardItem(collection.name());
auto item = new QStandardItem(collection.name());
item->setData(QVariant::fromValue(collection), Akonadi::EntityTreeModel::CollectionRole);
item->setData(QVariant::fromValue(collection.id()), Akonadi::EntityTreeModel::CollectionIdRole);
......@@ -51,7 +51,7 @@ void NoteEditDialogTest::shouldHaveDefaultValuesOnCreation()
NoteEditDialog edit;
QVERIFY(!edit.note());
auto notetitle = edit.findChild<QLineEdit *>(QStringLiteral("notetitle"));
auto *notetext = edit.findChild<KPIMTextEdit::RichTextEditorWidget *>(QStringLiteral("notetext"));
auto notetext = edit.findChild<KPIMTextEdit::RichTextEditorWidget *>(QStringLiteral("notetext"));
auto ok = edit.findChild<QPushButton *>(QStringLiteral("save-button"));
QVERIFY(notetitle);
QCOMPARE(notetitle->text(), QString());
......@@ -110,7 +110,7 @@ void NoteEditDialogTest::shouldHaveFilledText()
edit.load(item);
auto notetitle = edit.findChild<QLineEdit *>(QStringLiteral("notetitle"));
auto *notetext = edit.findChild<KPIMTextEdit::RichTextEditorWidget *>(QStringLiteral("notetext"));
auto notetext = edit.findChild<KPIMTextEdit::RichTextEditorWidget *>(QStringLiteral("notetext"));
QCOMPARE(notetitle->text(), title);
QCOMPARE(notetext->toPlainText(), text);
}
......@@ -129,7 +129,7 @@ void NoteEditDialogTest::shouldHaveRichText()
item.setPayload(note.message());
edit.load(item);
auto *notetext = edit.findChild<KPIMTextEdit::RichTextEditorWidget *>(QStringLiteral("notetext"));
auto notetext = edit.findChild<KPIMTextEdit::RichTextEditorWidget *>(QStringLiteral("notetext"));
QCOMPARE(notetext->toPlainText(), text);
QVERIFY(notetext->editor()->acceptRichText());
}
......@@ -137,7 +137,7 @@ void NoteEditDialogTest::shouldHaveRichText()
void NoteEditDialogTest::shouldDefaultCollectionIsValid()
{
NoteEditDialog edit;
auto *akonadicombobox = edit.findChild<Akonadi::CollectionComboBox *>(QStringLiteral("akonadicombobox"));
auto akonadicombobox = edit.findChild<Akonadi::CollectionComboBox *>(QStringLiteral("akonadicombobox"));
QVERIFY(akonadicombobox);
QVERIFY(akonadicombobox->currentCollection().isValid());
}
......@@ -145,7 +145,7 @@ void NoteEditDialogTest::shouldDefaultCollectionIsValid()
void NoteEditDialogTest::shouldEmitCollectionChangedWhenCurrentCollectionWasChanged()
{
NoteEditDialog edit;
auto *akonadicombobox = edit.findChild<Akonadi::CollectionComboBox *>(QStringLiteral("akonadicombobox"));
auto akonadicombobox = edit.findChild<Akonadi::CollectionComboBox *>(QStringLiteral("akonadicombobox"));
akonadicombobox->setCurrentIndex(0);
QCOMPARE(akonadicombobox->currentIndex(), 0);
QSignalSpy spy(&edit, &NoteEditDialog::collectionChanged);
......@@ -157,7 +157,7 @@ void NoteEditDialogTest::shouldEmitCollectionChangedWhenCurrentCollectionWasChan
void NoteEditDialogTest::shouldEmitCorrectCollection()
{
NoteEditDialog edit;
auto *akonadicombobox = edit.findChild<Akonadi::CollectionComboBox *>(QStringLiteral("akonadicombobox"));
auto akonadicombobox = edit.findChild<Akonadi::CollectionComboBox *>(QStringLiteral("akonadicombobox"));
Akonadi::NoteUtils::NoteMessageWrapper note;
QString title = QStringLiteral("title");
......@@ -217,7 +217,7 @@ void NoteEditDialogTest::shouldNotEmitNoteWhenTextIsEmpty()
QTest::mouseClick(ok, Qt::LeftButton);
QCOMPARE(spy.count(), 0);
auto *notetext = edit.findChild<KPIMTextEdit::RichTextEditorWidget *>(QStringLiteral("notetext"));
auto notetext = edit.findChild<KPIMTextEdit::RichTextEditorWidget *>(QStringLiteral("notetext"));
notetext->editor()->setText(QStringLiteral("F"));
QTest::mouseClick(ok, Qt::LeftButton);
QCOMPARE(spy.count(), 1);
......@@ -241,7 +241,7 @@ void NoteEditDialogTest::shouldNoteHasCorrectText()
QCOMPARE(spy.count(), 1);
Akonadi::NoteUtils::NoteMessageWrapper rNote(spy.at(0).at(0).value<Akonadi::Item>().payload<KMime::Message::Ptr>());
QCOMPARE(rNote.text(), text);
auto *notetext = edit.findChild<KPIMTextEdit::RichTextEditorWidget *>(QStringLiteral("notetext"));
auto notetext = edit.findChild<KPIMTextEdit::RichTextEditorWidget *>(QStringLiteral("notetext"));
QString text2 = QStringLiteral("F");
notetext->editor()->setText(text2);
QTest::mouseClick(ok, Qt::LeftButton);
......@@ -295,7 +295,7 @@ void NoteEditDialogTest::shouldNoteHasCorrectTextFormat()
QCOMPARE(spy.count(), 1);
Akonadi::NoteUtils::NoteMessageWrapper rNote(spy.at(0).at(0).value<Akonadi::Item>().payload<KMime::Message::Ptr>());
QCOMPARE(rNote.textFormat(), Qt::PlainText);
auto *notetext = edit.findChild<KPIMTextEdit::RichTextEditorWidget *>(QStringLiteral("notetext"));
auto notetext = edit.findChild<KPIMTextEdit::RichTextEditorWidget *>(QStringLiteral("notetext"));
notetext->editor()->setAcceptRichText(true);
QTest::mouseClick(ok, Qt::LeftButton);
QCOMPARE(spy.count(), 2);
......
......@@ -62,9 +62,9 @@ void FreePeriodModelTest::testSplitByDay()
const QDateTime startPeriod2(QDate(2010, 7, 25), QTime(0, 0, 0, 0), Qt::UTC);
QModelIndex index = model->index(0, 0);
KCalendarCore::Period period1 = model->data(index, FreePeriodModel::PeriodRole).value<KCalendarCore::Period>();
auto period1 = model->data(index, FreePeriodModel::PeriodRole).value<KCalendarCore::Period>();
index = model->index(1, 0);
KCalendarCore::Period period2 = model->data(index, FreePeriodModel::PeriodRole).value<KCalendarCore::Period>();
auto period2 = model->data(index, FreePeriodModel::PeriodRole).value<KCalendarCore::Period>();
QCOMPARE(period1.start(), startDt);
QCOMPARE(period1.end(), endPeriod1);
......
......@@ -21,7 +21,7 @@ namespace CalendarSupport
class CALENDARSUPPORT_EXPORT FreeBusyItem
{
public:
typedef QSharedPointer<FreeBusyItem> Ptr;
using Ptr = QSharedPointer<FreeBusyItem>;
/**
* @param parentWidget is passed to Akonadi when fetching free/busy data.
......
......@@ -109,7 +109,7 @@ QVariant FreeBusyItemModel::data(const QModelIndex &index, int role) const
return QVariant();
}
auto *data = (ItemPrivateData *)index.internalPointer();
auto data = (ItemPrivateData *)index.internalPointer();
if (data->parent() == d->mRootData) {
int row = index.row();
......
......@@ -266,7 +266,7 @@ bool KCalPrefs::thatIsMe(const QString &_email)
void KCalPrefs::setCategoryColor(const QString &cat, const QColor &color)
{
Akonadi::Tag tag = d->mTagCache.getTagByName(cat);
auto *attr = tag.attribute<Akonadi::TagAttribute>(Akonadi::Tag::AddIfMissing);
auto attr = tag.attribute<Akonadi::TagAttribute>(Akonadi::Tag::AddIfMissing);
attr->setBackgroundColor(color);
new Akonadi::TagModifyJob(tag);
}
......@@ -277,7 +277,7 @@ QColor KCalPrefs::categoryColor(const QString &cat) const
if (!cat.isEmpty()) {
const Akonadi::Tag &tag = d->mTagCache.getTagByName(cat);
if (const auto *attr = tag.attribute<Akonadi::TagAttribute>()) {
if (const auto attr = tag.attribute<Akonadi::TagAttribute>()) {
color = attr->backgroundColor();
}
}
......
......@@ -31,8 +31,8 @@ NoteEditDialog::NoteEditDialog(QWidget *parent)
{
setAttribute(Qt::WA_DeleteOnClose);
setWindowTitle(i18nc("@title:window", "Create Note"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
QWidget *mainWidget = new QWidget(this);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
auto mainWidget = new QWidget(this);
auto mainLayout = new QVBoxLayout(this);
mainLayout->addWidget(mainWidget);
connect(buttonBox, &QDialogButtonBox::accepted, this, &NoteEditDialog::accept);
......@@ -82,7 +82,7 @@ NoteEditDialog::NoteEditDialog(QWidget *parent)
hbox->addSpacing(5);
hbox->addWidget(mCollectionCombobox);
QLabel *lab = new QLabel(i18nc("@label specify the title for this note", "Title:"), this);
auto lab = new QLabel(i18nc("@label specify the title for this note", "Title:"), this);
layout->addWidget(lab, 0, 0);
layout->addLayout(hbox, 0, 1);
......
......@@ -53,7 +53,7 @@ QWidget *CalPrintIncidence::createConfigWidget(QWidget *w)
void CalPrintIncidence::readSettingsWidget()
{
auto *cfg = dynamic_cast<CalPrintIncidenceConfig *>((QWidget *)mConfigWidget);
auto cfg = dynamic_cast<CalPrintIncidenceConfig *>((QWidget *)mConfigWidget);
if (cfg) {
mUseColors = cfg->mColors->isChecked();
mPrintFooter = cfg->mPrintFooter->isChecked();
......@@ -67,7 +67,7 @@ void CalPrintIncidence::readSettingsWidget()
void CalPrintIncidence::setSettingsWidget()
{
auto *cfg = dynamic_cast<CalPrintIncidenceConfig *>((QWidget *)mConfigWidget);
auto cfg = dynamic_cast<CalPrintIncidenceConfig *>((QWidget *)mConfigWidget);
if (cfg) {
cfg->mColors->setChecked(mUseColors);
cfg->mPrintFooter->setChecked(mPrintFooter);
......@@ -661,7 +661,7 @@ QWidget *CalPrintDay::createConfigWidget(QWidget *w)
void CalPrintDay::readSettingsWidget()
{
auto *cfg = dynamic_cast<CalPrintDayConfig *>((QWidget *)mConfigWidget);
auto cfg = dynamic_cast<CalPrintDayConfig *>((QWidget *)mConfigWidget);
if (cfg) {
mFromDate = cfg->mFromDate->date();
mToDate = cfg->mToDate->date();
......@@ -692,7 +692,7 @@ void CalPrintDay::readSettingsWidget()
void CalPrintDay::setSettingsWidget()
{
auto *cfg = dynamic_cast<CalPrintDayConfig *>((QWidget *)mConfigWidget);
auto cfg = dynamic_cast<CalPrintDayConfig *>((QWidget *)mConfigWidget);
if (cfg) {
cfg->mFromDate->setDate(mFromDate);
cfg->mToDate->setDate(mToDate);
......@@ -765,7 +765,7 @@ void CalPrintDay::saveConfig()
void CalPrintDay::setDateRange(const QDate &from, const QDate &to)
{
CalPrintPluginBase::setDateRange(from, to);
auto *cfg = dynamic_cast<CalPrintDayConfig *>((QWidget *)mConfigWidget);
auto cfg = dynamic_cast<CalPrintDayConfig *>((QWidget *)mConfigWidget);
if (cfg) {
cfg->mFromDate->setDate(from);
cfg->mToDate->setDate(to);
......@@ -956,7 +956,7 @@ QWidget *CalPrintWeek::createConfigWidget(QWidget *w)
void CalPrintWeek::readSettingsWidget()
{
auto *cfg = dynamic_cast<CalPrintWeekConfig *>((QWidget *)mConfigWidget);
auto cfg = dynamic_cast<CalPrintWeekConfig *>((QWidget *)mConfigWidget);
if (cfg) {
mFromDate = cfg->mFromDate->date();
mToDate = cfg->mToDate->date();
......@@ -988,7 +988,7 @@ void CalPrintWeek::readSettingsWidget()
void CalPrintWeek::setSettingsWidget()
{
auto *cfg = dynamic_cast<CalPrintWeekConfig *>((QWidget *)mConfigWidget);
auto cfg = dynamic_cast<CalPrintWeekConfig *>((QWidget *)mConfigWidget);
if (cfg) {
cfg->mFromDate->setDate(mFromDate);
cfg->mToDate->setDate(mToDate);
......@@ -1069,7 +1069,7 @@ QPageLayout::Orientation CalPrintWeek::defaultOrientation() const
void CalPrintWeek::setDateRange(const QDate &from, const QDate &to)
{
CalPrintPluginBase::setDateRange(from, to);
auto *cfg = dynamic_cast<CalPrintWeekConfig *>((QWidget *)mConfigWidget);
auto cfg = dynamic_cast<CalPrintWeekConfig *>((QWidget *)mConfigWidget);
if (cfg) {
cfg->mFromDate->setDate(from);
cfg->mToDate->setDate(to);
......@@ -1213,7 +1213,7 @@ QWidget *CalPrintMonth::createConfigWidget(QWidget *w)
void CalPrintMonth::readSettingsWidget()
{
auto *cfg = dynamic_cast<CalPrintMonthConfig *>((QWidget *)mConfigWidget);
auto cfg = dynamic_cast<CalPrintMonthConfig *>((QWidget *)mConfigWidget);
if (cfg) {
mFromDate = QDate(cfg->mFromYear->value(), cfg->mFromMonth->currentIndex() + 1, 1);
......@@ -1235,7 +1235,7 @@ void CalPrintMonth::readSettingsWidget()
void CalPrintMonth::setSettingsWidget()
{
auto *cfg = dynamic_cast<CalPrintMonthConfig *>((QWidget *)mConfigWidget);
auto cfg = dynamic_cast<CalPrintMonthConfig *>((QWidget *)mConfigWidget);
if (cfg) {
setDateRange(mFromDate, mToDate);
......@@ -1291,7 +1291,7 @@ void CalPrintMonth::saveConfig()
void CalPrintMonth::setDateRange(const QDate &from, const QDate &to)
{
CalPrintPluginBase::setDateRange(from, to);
auto *cfg = dynamic_cast<CalPrintMonthConfig *>((QWidget *)mConfigWidget);
auto cfg = dynamic_cast<CalPrintMonthConfig *>((QWidget *)mConfigWidget);
if (cfg) {
cfg->mFromMonth->clear();
for (int i = 0; i < 12; ++i) {
......@@ -1378,7 +1378,7 @@ QWidget *CalPrintTodos::createConfigWidget(QWidget *w)
void CalPrintTodos::readSettingsWidget()
{
auto *cfg = dynamic_cast<CalPrintTodoConfig *>((QWidget *)mConfigWidget);
auto cfg = dynamic_cast<CalPrintTodoConfig *>((QWidget *)mConfigWidget);
if (cfg) {
mPageTitle = cfg->mTitle->text();
......@@ -1414,7 +1414,7 @@ void CalPrintTodos::readSettingsWidget()
void CalPrintTodos::setSettingsWidget()
{
auto *cfg = dynamic_cast<CalPrintTodoConfig *>((QWidget *)mConfigWidget);
auto cfg = dynamic_cast<CalPrintTodoConfig *>((QWidget *)mConfigWidget);
if (cfg) {
cfg->mTitle->setText(mPageTitle);
......
......@@ -157,7 +157,7 @@ CalPrintDialog::CalPrintDialog(int initialPrintType, const PrintPlugin::List &pl
: QDialog(parent)
{
setWindowTitle(i18nc("@title:window", "Print"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
auto mainLayout = new QVBoxLayout(this);
mOkButton = buttonBox->button(QDialogButtonBox::Ok);
mOkButton->setDefault(true);
......@@ -165,7 +165,7 @@ CalPrintDialog::CalPrintDialog(int initialPrintType, const PrintPlugin::List &pl
connect(buttonBox, &QDialogButtonBox::accepted, this, &CalPrintDialog::slotOk);
connect(buttonBox, &QDialogButtonBox::rejected, this, &CalPrintDialog::reject);
setModal(true);
QWidget *page = new QWidget(this);
auto page = new QWidget(this);
auto pageVBoxLayout = new QVBoxLayout(page);
pageVBoxLayout->setContentsMargins(0, 0, 0, 0);
mainLayout->addWidget(page);
......@@ -175,11 +175,11 @@ CalPrintDialog::CalPrintDialog(int initialPrintType, const PrintPlugin::List &pl
pageVBoxLayout->addWidget(splitter);
splitter->setOrientation(Qt::Horizontal);
splitter->setChildrenCollapsible(false);
QGroupBox *typeBox = new QGroupBox(i18nc("@title:group", "Print Style"), splitter);
auto typeBox = new QGroupBox(i18nc("@title:group", "Print Style"), splitter);
QBoxLayout *typeLayout = new QVBoxLayout(typeBox);
mTypeGroup = new QButtonGroup(typeBox);
QWidget *splitterRight = new QWidget(splitter);
auto splitterRight = new QWidget(splitter);
auto splitterRightLayout = new QGridLayout(splitterRight);
splitterRightLayout->setContentsMargins(0, 0, 0, 0);
// splitterRightLayout->setMargin( marginHint() );
......@@ -187,7 +187,7 @@ CalPrintDialog::CalPrintDialog(int initialPrintType, const PrintPlugin::List &pl
mConfigArea = new QStackedWidget(splitterRight);
splitterRightLayout->addWidget(mConfigArea, 0, 0, 1, 2);
QLabel *orientationLabel = new QLabel(i18nc("@label", "Page &orientation:"), splitterRight);
auto orientationLabel = new QLabel(i18nc("@label", "Page &orientation:"), splitterRight);
orientationLabel->setAlignment(Qt::AlignRight);
splitterRightLayout->addWidget(orientationLabel, 1, 0);
......@@ -220,7 +220,7 @@ CalPrintDialog::CalPrintDialog(int initialPrintType, const PrintPlugin::List &pl
int id = 0;
for (mapit = mPluginIDs.constBegin(); mapit != mPluginIDs.constEnd(); ++mapit) {
PrintPlugin *p = mapit.value();
QRadioButton *radioButton = new QRadioButton(p->description());
auto radioButton = new QRadioButton(p->description());
radioButton->setEnabled(p->enabled());
radioButton->setToolTip(i18nc("@info:tooltip", "Select the type of print"));
radioButton->setWhatsThis(i18nc("@info:whatsthis",
......
......@@ -126,10 +126,10 @@ CalPrintPluginBase::~CalPrintPluginBase()
QWidget *CalPrintPluginBase::createConfigWidget(QWidget *w)
{
QFrame *wdg = new QFrame(w);
auto wdg = new QFrame(w);
auto layout = new QVBoxLayout(wdg);
QLabel *title = new QLabel(description(), wdg);
auto title = new QLabel(description(), wdg);
QFont titleFont(title->font());
titleFont.setPointSize(20);
titleFont.setBold(true);
......
......@@ -22,7 +22,7 @@ QWidget *CalPrintJournal::createConfigWidget(QWidget *w)
void CalPrintJournal::readSettingsWidget()
{
auto *cfg = dynamic_cast<CalPrintJournalConfig *>((QWidget *)mConfigWidget);
auto cfg = dynamic_cast<CalPrintJournalConfig *>((QWidget *)mConfigWidget);
if (cfg) {
mFromDate = cfg->mFromDate->date();
mToDate = cfg->mToDate->date();
......@@ -32,7 +32,7 @@ void CalPrintJournal::readSettingsWidget()
void CalPrintJournal::setSettingsWidget()
{
auto *cfg = dynamic_cast<CalPrintJournalConfig *>((QWidget *)mConfigWidget);
auto cfg = dynamic_cast<CalPrintJournalConfig *>((QWidget *)mConfigWidget);
if (cfg) {
cfg->mFromDate->setDate(mFromDate);
cfg->mToDate->setDate(mToDate);
......@@ -76,7 +76,7 @@ void CalPrintJournal::saveConfig()
void CalPrintJournal::setDateRange(const QDate &from, const QDate &to)
{
CalPrintPluginBase::setDateRange(from, to);
auto *cfg = dynamic_cast<CalPrintJournalConfig *>((QWidget *)mConfigWidget);
auto cfg = dynamic_cast<CalPrintJournalConfig *>((QWidget *)mConfigWidget);
if (cfg) {
cfg->mFromDate->setDate(from);
cfg->mToDate->setDate(to);
......
......@@ -45,7 +45,7 @@ public:
{
}
typedef QList<PrintPlugin *> List;
using List = QList<PrintPlugin *>;
static int interfaceVersion()
{
return 2;
......
......@@ -22,7 +22,7 @@ QWidget *CalPrintYear::createConfigWidget(QWidget *w)
void CalPrintYear::readSettingsWidget()
{
auto *cfg = dynamic_cast<CalPrintYearConfig *>((QWidget *)mConfigWidget);
auto cfg = dynamic_cast<CalPrintYearConfig *>((QWidget *)mConfigWidget);
if (cfg) {
mYear = cfg->mYear->value();
mPages = cfg->mPages->currentText().toInt();
......@@ -33,7 +33,7 @@ void CalPrintYear::readSettingsWidget()
void CalPrintYear::setSettingsWidget()
{
auto *cfg = dynamic_cast<CalPrintYearConfig *>((QWidget *)mConfigWidget);
auto cfg = dynamic_cast<CalPrintYearConfig *>((QWidget *)mConfigWidget);
if (cfg) {
QDate start(mYear, 1, 1);
const int months = 12;
......@@ -89,7 +89,7 @@ QPageLayout::Orientation CalPrintYear::defaultOrientation() const
void CalPrintYear::setDateRange(const QDate &from, const QDate &to)
{
CalPrintPluginBase::setDateRange(from, to);
auto *cfg = dynamic_cast<CalPrintYearConfig *>((QWidget *)mConfigWidget);
auto cfg = dynamic_cast<CalPrintYearConfig *>((QWidget *)mConfigWidget);
if (cfg) {
cfg->mYear->setValue(from.year());
}
......
......@@ -84,7 +84,7 @@ bool UriHandler::process(const QString &uri)
return startKAddressbook(uri);
}
} else { // no special URI, let KDE handle it
KIO::OpenUrlJob *job = new KIO::OpenUrlJob(QUrl(uri));
auto job = new KIO::OpenUrlJob(QUrl(uri));
job->start();
}
......
......@@ -55,7 +55,7 @@ KCalendarCore::Event::Ptr CalendarSupport::event(const Akonadi::Item &item)
{
// relying on exception for performance reasons
try {
KCalendarCore::Incidence::Ptr incidence = item.payload<KCalendarCore::Incidence::Ptr>();
auto incidence = item.payload<KCalendarCore::Incidence::Ptr>();
if (hasEvent(incidence)) {
return item.payload<KCalendarCore::Event::Ptr>();
}
......@@ -87,7 +87,7 @@ KCalendarCore::Incidence::List CalendarSupport::incidencesFromItems(const Akonad
KCalendarCore::Todo::Ptr CalendarSupport::todo(const Akonadi::Item &item)
{
try {
KCalendarCore::Incidence::Ptr incidence = item.payload<KCalendarCore::Incidence::Ptr>();
auto incidence = item.payload<KCalendarCore::Incidence::Ptr>();
if (hasTodo(incidence)) {
return item.payload<KCalendarCore::Todo::Ptr>();
}
......@@ -108,7 +108,7 @@ KCalendarCore::Todo::Ptr CalendarSupport::todo(const KCalendarCore::Incidence::P
KCalendarCore::Journal::Ptr CalendarSupport::journal(const Akonadi::Item &item)
{
try {
KCalendarCore::Incidence::Ptr incidence = item.payload<KCalendarCore::Incidence::Ptr>();
auto incidence = item.payload<KCalendarCore::Incidence::Ptr>();
if (hasJournal(incidence)) {
return item.payload<KCalendarCore::Journal::Ptr>();
}
......@@ -406,7 +406,7 @@ Akonadi::Collection CalendarSupport::selectCollection(QWidget *parent, int &dial
Akonadi::Item CalendarSupport::itemFromIndex(const QModelIndex &idx)
{
Akonadi::Item item = idx.data(Akonadi::EntityTreeModel::ItemRole).value<Akonadi::Item>();
auto item = idx.data(Akonadi::EntityTreeModel::ItemRole).value<Akonadi::Item>();
item.setParentCollection(idx.data(Akonadi::EntityTreeModel::ParentCollectionRole).value<Akonadi::Collection>());
return 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