Commit 4d1e8e4d authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Modernize code

parent a1fd59cf
Pipeline #60480 passed with stage
in 7 minutes and 6 seconds
......@@ -47,7 +47,7 @@ NotesAgentAlarmDialog::NotesAgentAlarmDialog(QWidget *parent)
mCurrentDateTime->setText(QLocale().toString((QDateTime::currentDateTime()), QLocale::ShortFormat));
vbox->addWidget(mCurrentDateTime);
QLabel *lab = new QLabel(i18n("The following notes triggered alarms:"), this);
auto lab = new QLabel(i18n("The following notes triggered alarms:"), this);
vbox->addWidget(lab);
mListWidget = new NoteShared::NoteListWidget(this);
......@@ -57,7 +57,7 @@ NotesAgentAlarmDialog::NotesAgentAlarmDialog(QWidget *parent)
mainLayout->addWidget(mListWidget);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this);
connect(buttonBox, &QDialogButtonBox::rejected, this, &NotesAgentAlarmDialog::reject);
buttonBox->button(QDialogButtonBox::Close)->setDefault(true);
......@@ -85,11 +85,11 @@ void NotesAgentAlarmDialog::slotCustomContextMenuRequested(const QPoint &pos)
}
Q_UNUSED(pos)
auto entriesContextMenu = new QMenu(this);
QAction *removeAlarm = new QAction(QIcon::fromTheme(QStringLiteral("edit-delete")), i18n("Remove Alarm"), entriesContextMenu);
auto removeAlarm = new QAction(QIcon::fromTheme(QStringLiteral("edit-delete")), i18n("Remove Alarm"), entriesContextMenu);
connect(removeAlarm, &QAction::triggered, this, &NotesAgentAlarmDialog::slotRemoveAlarm);
QAction *showNote = new QAction(i18n("Show Note..."), entriesContextMenu);
auto showNote = new QAction(i18n("Show Note..."), entriesContextMenu);
connect(showNote, &QAction::triggered, this, &NotesAgentAlarmDialog::slotShowNote);
QAction *modifyAlarm = new QAction(i18n("Modify Alarm..."), entriesContextMenu);
auto modifyAlarm = new QAction(i18n("Modify Alarm..."), entriesContextMenu);
connect(modifyAlarm, &QAction::triggered, this, &NotesAgentAlarmDialog::slotModifyAlarm);
entriesContextMenu->addAction(showNote);
entriesContextMenu->addAction(modifyAlarm);
......@@ -199,9 +199,9 @@ void NotesAgentAlarmDialog::slotFetchAlarmItem(KJob *job)
Akonadi::Item::List items = itemFetchJob->items();
if (!items.isEmpty()) {
Akonadi::Item item = items.first();
auto *attr = item.attribute<NoteShared::NoteAlarmAttribute>();
auto attr = item.attribute<NoteShared::NoteAlarmAttribute>();
if (attr) {
KMime::Message::Ptr noteMessage = item.payload<KMime::Message::Ptr>();
auto noteMessage = item.payload<KMime::Message::Ptr>();
if (!noteMessage) {
qCDebug(NOTESAGENT_LOG) << "Error this note doesn't have payload ";
KMessageBox::error(this, i18n("Error during fetch alarm info."), i18n("Alarm"));
......
......@@ -37,7 +37,7 @@ NotesAgentNoteDialog::NotesAgentNoteDialog(QWidget *parent)
mNote = new KPIMTextEdit::RichTextEditorWidget(this);
mNote->setReadOnly(true);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this);
connect(buttonBox, &QDialogButtonBox::rejected, this, &NotesAgentNoteDialog::reject);
mainLayout->addWidget(mNote);
......@@ -69,7 +69,7 @@ void NotesAgentNoteDialog::slotFetchItem(KJob *job)
const Akonadi::Item::List lstItem = itemFetchJob->items();
if (!lstItem.isEmpty()) {
const Akonadi::Item item = lstItem.first();
KMime::Message::Ptr noteMessage = item.payload<KMime::Message::Ptr>();
auto noteMessage = item.payload<KMime::Message::Ptr>();
if (noteMessage) {
const KMime::Headers::Subject *const subject = noteMessage->subject(false);
if (subject) {
......@@ -84,7 +84,7 @@ void NotesAgentNoteDialog::slotFetchItem(KJob *job)
}
}
if (item.hasAttribute<NoteShared::NoteDisplayAttribute>()) {
const auto *attr = item.attribute<NoteShared::NoteDisplayAttribute>();
const auto attr = item.attribute<NoteShared::NoteDisplayAttribute>();
if (attr) {
mNote->editor()->setTextColor(attr->backgroundColor());
// TODO add background color.
......
......@@ -31,7 +31,7 @@ NotesAgentSettingsDialog::NotesAgentSettingsDialog(QWidget *parent)
auto mainLayout = new QVBoxLayout(this);
setModal(true);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help, this);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help, this);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
......
......@@ -120,7 +120,7 @@ void NotesManager::slotCheckAlarm()
Akonadi::Item::List lst;
for (const Akonadi::Item &item : qAsConst(mListItem)) {
const auto *attrAlarm = item.attribute<NoteShared::NoteAlarmAttribute>();
const auto attrAlarm = item.attribute<NoteShared::NoteAlarmAttribute>();
if (attrAlarm) {
if (attrAlarm->dateTime() < QDateTime::currentDateTime()) {
lst.append(item);
......
......@@ -41,29 +41,29 @@ NoteAlarmDialog::NoteAlarmDialog(const QString &caption, QWidget *parent)
{
setWindowTitle(caption);
auto mainLayout = new QVBoxLayout(this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, &QDialogButtonBox::rejected, this, &NoteAlarmDialog::reject);
QWidget *page = new QWidget(this);
auto page = new QWidget(this);
auto pageVBoxLayout = new QVBoxLayout(page);
pageVBoxLayout->setContentsMargins(0, 0, 0, 0);
d->m_buttons = new QButtonGroup(this);
QGroupBox *group = new QGroupBox(i18n("Scheduled Alarm"), page);
auto group = new QGroupBox(i18n("Scheduled Alarm"), page);
pageVBoxLayout->addWidget(group);
auto layout = new QVBoxLayout;
QRadioButton *none = new QRadioButton(i18n("&No alarm"));
auto none = new QRadioButton(i18n("&No alarm"));
layout->addWidget(none);
d->m_buttons->addButton(none, 0);
group->setLayout(layout);
QWidget *at = new QWidget;
auto at = new QWidget;
auto atHBoxLayout = new QHBoxLayout(at);
atHBoxLayout->setContentsMargins(0, 0, 0, 0);
QRadioButton *label_at = new QRadioButton(i18n("Alarm &at:"), at);
auto label_at = new QRadioButton(i18n("Alarm &at:"), at);
atHBoxLayout->addWidget(label_at);
d->m_atDate = new KDateComboBox(at);
atHBoxLayout->addWidget(d->m_atDate);
......
......@@ -20,7 +20,7 @@ NoteActionConfig::NoteActionConfig(QWidget *parent)
auto layout = new QGridLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
QLabel *label_MailAction = new QLabel(i18n("&Mail action:"), this);
auto label_MailAction = new QLabel(i18n("&Mail action:"), this);
layout->addWidget(label_MailAction, 0, 0);
auto kcfg_MailAction = new QLineEdit(this);
......@@ -28,7 +28,7 @@ NoteActionConfig::NoteActionConfig(QWidget *parent)
label_MailAction->setBuddy(kcfg_MailAction);
layout->addWidget(kcfg_MailAction, 0, 1);
QLabel *howItWorks = new QLabel(i18n("<a href=\"whatsthis\">How does this work?</a>"));
auto howItWorks = new QLabel(i18n("<a href=\"whatsthis\">How does this work?</a>"));
connect(howItWorks, &QLabel::linkActivated, this, &NoteActionConfig::slotHelpLinkClicked);
layout->addWidget(howItWorks, 1, 0);
howItWorks->setContextMenuPolicy(Qt::NoContextMenu);
......
......@@ -38,7 +38,7 @@ NoteNetworkConfigWidget::NoteNetworkConfigWidget(QWidget *parent)
auto layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
QGroupBox *incoming = new QGroupBox(i18n("Incoming Notes"));
auto incoming = new QGroupBox(i18n("Incoming Notes"));
auto tmpLayout = new QHBoxLayout;
d->mTmpChkB = new QCheckBox(i18n("Accept incoming notes"));
......@@ -47,10 +47,10 @@ NoteNetworkConfigWidget::NoteNetworkConfigWidget(QWidget *parent)
incoming->setLayout(tmpLayout);
layout->addWidget(incoming);
QGroupBox *outgoing = new QGroupBox(i18n("Outgoing Notes"));
auto outgoing = new QGroupBox(i18n("Outgoing Notes"));
tmpLayout = new QHBoxLayout;
QLabel *label_SenderID = new QLabel(i18n("&Sender ID:"));
auto label_SenderID = new QLabel(i18n("&Sender ID:"));
d->kcfg_SenderID = new QLineEdit;
d->kcfg_SenderID->setClearButtonEnabled(true);
d->kcfg_SenderID->setObjectName(QStringLiteral("kcfg_SenderID"));
......@@ -62,7 +62,7 @@ NoteNetworkConfigWidget::NoteNetworkConfigWidget(QWidget *parent)
tmpLayout = new QHBoxLayout;
QLabel *label_Port = new QLabel(i18n("&Port:"));
auto label_Port = new QLabel(i18n("&Port:"));
tmpLayout->addWidget(label_Port);
......
......@@ -31,19 +31,19 @@ NoteHostDialog::NoteHostDialog(const QString &caption, QWidget *parent)
auto mainLayout = new QVBoxLayout(this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
mOkButton = buttonBox->button(QDialogButtonBox::Ok);
mOkButton->setDefault(true);
mOkButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, &QDialogButtonBox::accepted, this, &NoteHostDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &NoteHostDialog::reject);
QLabel *label = new QLabel(i18n("Select recipient:"), this);
auto label = new QLabel(i18n("Select recipient:"), this);
mainLayout->addWidget(label);
m_servicesView = new QTreeView(this);
m_servicesView->setRootIsDecorated(false);
KDNSSD::ServiceModel *mdl = new KDNSSD::ServiceModel(new KDNSSD::ServiceBrowser(QStringLiteral("_knotes._tcp"), true), this);
auto mdl = new KDNSSD::ServiceModel(new KDNSSD::ServiceBrowser(QStringLiteral("_knotes._tcp"), true), this);
m_servicesView->setModel(mdl);
m_servicesView->setSelectionBehavior(QAbstractItemView::SelectRows);
m_servicesView->hideColumn(KDNSSD::ServiceModel::Port);
......@@ -102,7 +102,7 @@ void NoteHostDialog::slotTextChanged(const QString &text)
void NoteHostDialog::serviceSelected(const QModelIndex &idx)
{
KDNSSD::RemoteService::Ptr srv = idx.data(KDNSSD::ServiceModel::ServicePtrRole).value<KDNSSD::RemoteService::Ptr>();
auto srv = idx.data(KDNSSD::ServiceModel::ServicePtrRole).value<KDNSSD::RemoteService::Ptr>();
m_hostCombo->lineEdit()->setText(srv->hostName() + QLatin1String(":") + QString::number(srv->port()));
}
......@@ -118,7 +118,7 @@ quint16 NoteHostDialog::port() const
void NoteHostDialog::slotServiceDoubleClicked(const QModelIndex &idx)
{
KDNSSD::RemoteService::Ptr srv = idx.data(KDNSSD::ServiceModel::ServicePtrRole).value<KDNSSD::RemoteService::Ptr>();
auto srv = idx.data(KDNSSD::ServiceModel::ServicePtrRole).value<KDNSSD::RemoteService::Ptr>();
m_hostCombo->lineEdit()->setText(srv->hostName() + QLatin1Char(':') + QString::number(srv->port()));
accept();
}
......@@ -80,7 +80,7 @@ void NoteUtils::sendToNetwork(QWidget *parent, const QString &title, const QStri
QString NoteUtils::createToolTip(const Akonadi::Item &item)
{
const KMime::Message::Ptr noteMessage = item.payload<KMime::Message::Ptr>();
const auto noteMessage = item.payload<KMime::Message::Ptr>();
if (!noteMessage) {
return QString();
}
......@@ -92,7 +92,7 @@ QString NoteUtils::createToolTip(const Akonadi::Item &item)
QString tip;
if (item.hasAttribute<NoteDisplayAttribute>()) {
const auto *attr = item.attribute<NoteDisplayAttribute>();
const auto attr = item.attribute<NoteDisplayAttribute>();
if (attr) {
const QString bckColorName = attr->backgroundColor().name();
const QString txtColorName = attr->foregroundColor().name();
......
......@@ -64,7 +64,7 @@ void NoteListWidget::setNotes(const Akonadi::Item::List &notes)
void NoteListWidget::createItem(const Akonadi::Item &note)
{
KMime::Message::Ptr noteMessage = note.payload<KMime::Message::Ptr>();
auto noteMessage = note.payload<KMime::Message::Ptr>();
if (!noteMessage) {
return;
}
......
......@@ -82,7 +82,7 @@ KNotesApp::KNotesApp(QWidget *parent)
QDBusConnection::sessionBus().registerObject(QStringLiteral("/KNotes"), this);
qApp->setQuitOnLastWindowClosed(false);
// create the GUI...
QAction *action = new QAction(QIcon::fromTheme(QStringLiteral("document-new")), i18n("New Note"), this);
auto action = new QAction(QIcon::fromTheme(QStringLiteral("document-new")), i18n("New Note"), this);
actionCollection()->addAction(QStringLiteral("new_note"), action);
KGlobalAccel::setGlobalShortcut(action, QKeySequence(Qt::ALT | Qt::SHIFT | Qt::Key_N));
connect(action, &QAction::triggered, this, [this]() {
......@@ -120,7 +120,7 @@ KNotesApp::KNotesApp(QWidget *parent)
// REmove shortcut here.
act->setShortcut(0);
KHelpMenu *menu = new KHelpMenu(this, KAboutData::applicationData(), false);
auto menu = new KHelpMenu(this, KAboutData::applicationData(), false);
KActionCollection *actions = actionCollection();
QAction *helpContentsAction = menu->action(KHelpMenu::menuHelpContents);
......@@ -185,7 +185,7 @@ KNotesApp::KNotesApp(QWidget *parent)
// is used as a check if updateNoteActions has to be called for a new note
updateNetworkListener();
Akonadi::Session *session = new Akonadi::Session("KNotes Session", this);
auto session = new Akonadi::Session("KNotes Session", this);
mNoteRecorder = new NoteShared::NotesChangeRecorder(this);
mNoteRecorder->changeRecorder()->setSession(session);
mTray = new KNotesAkonadiTray(nullptr);
......@@ -276,8 +276,8 @@ void KNotesApp::slotRowInserted(const QModelIndex &parent, int start, int end)
for (int i = start; i <= end; ++i) {
if (mNoteTreeModel->hasIndex(i, 0, parent)) {
const QModelIndex child = mNoteTreeModel->index(i, 0, parent);
Akonadi::Item item = mNoteTreeModel->data(child, Akonadi::EntityTreeModel::ItemRole).value<Akonadi::Item>();
Akonadi::Collection parentCollection = mNoteTreeModel->data(child, Akonadi::EntityTreeModel::ParentCollectionRole).value<Akonadi::Collection>();
auto item = mNoteTreeModel->data(child, Akonadi::EntityTreeModel::ItemRole).value<Akonadi::Item>();
auto parentCollection = mNoteTreeModel->data(child, Akonadi::EntityTreeModel::ParentCollectionRole).value<Akonadi::Collection>();
if (parentCollection.hasAttribute<NoteShared::ShowFolderNotesAttribute>()) {
createNote(item);
needUpdate = true;
......@@ -466,7 +466,7 @@ void KNotesApp::updateNoteActions()
replaceText = realName;
}
QAction *action = new QAction(replaceText.replace(QLatin1String("&"), QStringLiteral("&&")), this);
auto action = new QAction(replaceText.replace(QLatin1String("&"), QStringLiteral("&&")), this);
action->setToolTip(realName);
action->setObjectName(QString::number(note->noteId()));
connect(action, &QAction::triggered, this, &KNotesApp::slotShowNote);
......@@ -486,7 +486,7 @@ void KNotesApp::updateNoteActions()
actionCollection()->action(QStringLiteral("show_all_notes"))->setEnabled(false);
actionCollection()->action(QStringLiteral("print_selected_notes"))->setEnabled(false);
actionCollection()->action(QStringLiteral("edit_find"))->setEnabled(false);
QAction *action = new QAction(i18n("No Notes"), this);
auto action = new QAction(i18n("No Notes"), this);
action->setEnabled(false);
m_noteActions.append(action);
} else {
......@@ -539,7 +539,7 @@ void KNotesApp::slotWalkThroughNotes()
void KNotesApp::slotPreferences()
{
// create a new preferences dialog...
KNoteConfigDialog *dialog = new KNoteConfigDialog(i18n("Settings"), this);
auto dialog = new KNoteConfigDialog(i18n("Settings"), this);
connect(dialog, qOverload<>(&KCMultiDialog::configCommitted), this, &KNotesApp::slotConfigUpdated);
dialog->show();
}
......@@ -604,7 +604,7 @@ void KNotesApp::slotConfigureAccels()
void KNotesApp::slotNoteKilled(Akonadi::Item::Id id)
{
Akonadi::ItemDeleteJob *deleteJob = new Akonadi::ItemDeleteJob(Akonadi::Item(id), this);
auto deleteJob = new Akonadi::ItemDeleteJob(Akonadi::Item(id), this);
connect(deleteJob, &KJob::result, this, &KNotesApp::slotNoteDeleteFinished);
}
......
......@@ -43,11 +43,11 @@ QVariant KNoteCollectionDisplayProxyModel::data(const QModelIndex &index, int ro
{
if (role == Qt::CheckStateRole) {
if (index.isValid()) {
const Akonadi::Collection collection = data(index, Akonadi::EntityTreeModel::CollectionRole).value<Akonadi::Collection>();
const auto collection = data(index, Akonadi::EntityTreeModel::CollectionRole).value<Akonadi::Collection>();
if (mDisplayCollection.contains(collection)) {
return mDisplayCollection.value(collection) ? Qt::Checked : Qt::Unchecked;
} else {
const auto *attr = collection.attribute<NoteShared::ShowFolderNotesAttribute>();
const auto attr = collection.attribute<NoteShared::ShowFolderNotesAttribute>();
if (attr) {
return Qt::Checked;
}
......@@ -62,7 +62,7 @@ bool KNoteCollectionDisplayProxyModel::setData(const QModelIndex &index, const Q
{
if (role == Qt::CheckStateRole) {
if (index.isValid()) {
const Akonadi::Collection collection = data(index, Akonadi::EntityTreeModel::CollectionRole).value<Akonadi::Collection>();
const auto collection = data(index, Akonadi::EntityTreeModel::CollectionRole).value<Akonadi::Collection>();
mDisplayCollection[collection] = (value == Qt::Checked);
Q_EMIT dataChanged(index, index);
return true;
......@@ -95,12 +95,12 @@ KNoteCollectionConfigWidget::KNoteCollectionConfigWidget(QWidget *parent)
auto tabWidget = new QTabWidget;
mainLayout->addWidget(tabWidget);
QWidget *collectionWidget = new QWidget;
auto collectionWidget = new QWidget;
auto vbox = new QVBoxLayout;
collectionWidget->setLayout(vbox);
tabWidget->addTab(collectionWidget, i18n("Folders"));
QLabel *label = new QLabel(i18n("Select which KNotes folders to show:"));
auto label = new QLabel(i18n("Select which KNotes folders to show:"));
vbox->addWidget(label);
// Create a new change recorder.
......@@ -149,7 +149,7 @@ KNoteCollectionConfigWidget::KNoteCollectionConfigWidget(QWidget *parent)
auto hbox = new QHBoxLayout;
vbox->addLayout(hbox);
QPushButton *button = new QPushButton(i18n("&Select All"), this);
auto button = new QPushButton(i18n("&Select All"), this);
connect(button, &QPushButton::clicked, this, &KNoteCollectionConfigWidget::slotSelectAllCollections);
hbox->addWidget(button);
......@@ -175,7 +175,7 @@ KNoteCollectionConfigWidget::KNoteCollectionConfigWidget(QWidget *parent)
vbox->addWidget(mDefaultSaveFolder);
QWidget *accountWidget = new QWidget;
auto accountWidget = new QWidget;
auto vboxAccountWidget = new QVBoxLayout;
accountWidget->setLayout(vboxAccountWidget);
......@@ -210,7 +210,7 @@ void KNoteCollectionConfigWidget::slotRenameCollection()
QString title = idx.data().toString();
Akonadi::Collection col = idx.data(Akonadi::EntityTreeModel::CollectionRole).value<Akonadi::Collection>();
auto col = idx.data(Akonadi::EntityTreeModel::CollectionRole).value<Akonadi::Collection>();
Q_ASSERT(col.isValid());
if (!col.isValid()) {
return;
......@@ -294,7 +294,7 @@ void KNoteCollectionConfigWidget::updateCollectionsRecursive()
i.next();
Akonadi::Collection collection = i.key();
Akonadi::CollectionModifyJob *modifyJob = nullptr;
auto *attr = collection.attribute<NoteShared::ShowFolderNotesAttribute>();
auto attr = collection.attribute<NoteShared::ShowFolderNotesAttribute>();
const bool selected = i.value();
if (selected && !attr) {
attr = collection.attribute<NoteShared::ShowFolderNotesAttribute>(Akonadi::Collection::AddIfMissing);
......
......@@ -23,7 +23,7 @@ KNoteDisplayConfigWidget::KNoteDisplayConfigWidget(bool defaults, QWidget *paren
{
auto layout = new QGridLayout(this);
QLabel *label_FgColor = new QLabel(i18n("&Text color:"), this);
auto label_FgColor = new QLabel(i18n("&Text color:"), this);
label_FgColor->setObjectName(QStringLiteral("label_FgColor"));
layout->addWidget(label_FgColor, 0, 0);
......@@ -32,7 +32,7 @@ KNoteDisplayConfigWidget::KNoteDisplayConfigWidget(bool defaults, QWidget *paren
label_FgColor->setBuddy(kcfg_FgColor);
layout->addWidget(kcfg_FgColor, 0, 1);
QLabel *label_BgColor = new QLabel(i18n("&Background color:"), this);
auto label_BgColor = new QLabel(i18n("&Background color:"), this);
label_BgColor->setObjectName(QStringLiteral("label_BgColor"));
layout->addWidget(label_BgColor, 1, 0);
......@@ -48,7 +48,7 @@ KNoteDisplayConfigWidget::KNoteDisplayConfigWidget(bool defaults, QWidget *paren
kcfg_RememberDesktop->setObjectName(QStringLiteral("kcfg_RememberDesktop"));
#endif
if (defaults) {
QLabel *label_Width = new QLabel(i18n("Default &width:"), this);
auto label_Width = new QLabel(i18n("Default &width:"), this);
layout->addWidget(label_Width, 2, 0);
......@@ -59,7 +59,7 @@ KNoteDisplayConfigWidget::KNoteDisplayConfigWidget(bool defaults, QWidget *paren
kcfg_Width->setSingleStep(10);
layout->addWidget(kcfg_Width, 2, 1);
QLabel *label_Height = new QLabel(i18n("Default &height:"), this);
auto label_Height = new QLabel(i18n("Default &height:"), this);
layout->addWidget(label_Height, 3, 0);
kcfg_Height = new QSpinBox(this);
......
......@@ -20,7 +20,7 @@ KNoteEditorConfigWidget::KNoteEditorConfigWidget(QWidget *parent)
{
auto layout = new QGridLayout(this);
QLabel *label_TabSize = new QLabel(i18n("&Tab size:"), this);
auto label_TabSize = new QLabel(i18n("&Tab size:"), this);
layout->addWidget(label_TabSize, 0, 0, 1, 2);
kcfg_TabSize = new QSpinBox(this);
......@@ -37,7 +37,7 @@ KNoteEditorConfigWidget::KNoteEditorConfigWidget(QWidget *parent)
kcfg_RichText->setObjectName(QStringLiteral("kcfg_RichText"));
layout->addWidget(kcfg_RichText, 1, 2);
QLabel *label_Font = new QLabel(i18n("Text font:"), this);
auto label_Font = new QLabel(i18n("Text font:"), this);
layout->addWidget(label_Font, 3, 0);
kcfg_Font = new KFontRequester(this);
......@@ -45,7 +45,7 @@ KNoteEditorConfigWidget::KNoteEditorConfigWidget(QWidget *parent)
kcfg_Font->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
layout->addWidget(kcfg_Font, 3, 1, 1, 2);
QLabel *label_TitleFont = new QLabel(i18n("Title font:"), this);
auto label_TitleFont = new QLabel(i18n("Title font:"), this);
layout->addWidget(label_TitleFont, 2, 0);
kcfg_TitleFont = new KFontRequester(this);
......
......@@ -27,7 +27,7 @@ KNoteSimpleConfigDialog::KNoteSimpleConfigDialog(const QString &title, QWidget *
{
auto mainLayout = new QVBoxLayout(this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
......@@ -55,7 +55,7 @@ KNoteSimpleConfigDialog::~KNoteSimpleConfigDialog()
void KNoteSimpleConfigDialog::load(Akonadi::Item &item, bool isRichText)
{
auto *attr = item.attribute<NoteShared::NoteDisplayAttribute>();
auto attr = item.attribute<NoteShared::NoteDisplayAttribute>();
mEditorConfigWidget->load(attr, isRichText);
mDisplayConfigWidget->load(attr);
}
......@@ -67,7 +67,7 @@ void KNoteSimpleConfigDialog::slotUpdateCaption(const QString &name)
void KNoteSimpleConfigDialog::save(Akonadi::Item &item, bool &isRichText)
{
auto *attr = item.attribute<NoteShared::NoteDisplayAttribute>(Akonadi::Item::AddIfMissing);
auto attr = item.attribute<NoteShared::NoteDisplayAttribute>(Akonadi::Item::AddIfMissing);
mEditorConfigWidget->save(attr, isRichText);
mDisplayConfigWidget->save(attr);
}
......
......@@ -21,7 +21,7 @@ KNoteDeleteSelectedNotesDialog::KNoteDeleteSelectedNotesDialog(QWidget *parent)
mNoteList = new NoteShared::NoteListWidget(this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
mOkButton = buttonBox->button(QDialogButtonBox::Ok);
mOkButton->setDefault(true);
mOkButton->setShortcut(Qt::CTRL | Qt::Key_Return);
......
......@@ -25,7 +25,7 @@ KNoteSelectedNotesDialog::KNoteSelectedNotesDialog(QWidget *parent)
connect(mListNotes, &QListWidget::itemSelectionChanged, this, &KNoteSelectedNotesDialog::slotSelectionChanged);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
mOkButton = buttonBox->button(QDialogButtonBox::Ok);
mOkButton->setDefault(true);
mOkButton->setShortcut(Qt::CTRL | Qt::Key_Return);
......
......@@ -20,7 +20,7 @@ KNotesKeyDialog::KNotesKeyDialog(KActionCollection *globals, QWidget *parent)
auto mainLayout = new QVBoxLayout(this);
m_keyChooser = new KShortcutsEditor(globals, this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::RestoreDefaults, this);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::RestoreDefaults, this);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
......
......@@ -27,7 +27,7 @@ KNoteFindDialog::KNoteFindDialog(QWidget *parent)
{
setWindowTitle(i18nc("@title:window", "Search Notes"));
auto mainLayout = new QVBoxLayout(this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this);
connect(buttonBox, &QDialogButtonBox::rejected, this, &KNoteFindDialog::reject);
setAttribute(Qt::WA_DeleteOnClose);
mNoteFindWidget = new KNoteFindWidget(this);
......@@ -70,7 +70,7 @@ KNoteFindWidget::KNoteFindWidget(QWidget *parent)
vbox->setContentsMargins(0, 0, 0, 0);
auto hbox = new QHBoxLayout;
vbox->addLayout(hbox);
QLabel *lab = new QLabel(i18nc("@label:textbox", "Search notes:"), this);
auto lab = new QLabel(i18nc("@label:textbox", "Search notes:"), this);
hbox->addWidget(lab);
mSearchLineEdit = new QLineEdit(this);
mSearchLineEdit->setClearButtonEnabled(true);
......
......@@ -77,21 +77,21 @@ KNoteMiscConfig::KNoteMiscConfig(QWidget *parent)
auto lay = new QVBoxLayout(this);
lay->setContentsMargins(0, 0, 0, 0);
QCheckBox *kcfg_SystemTrayShowNotes = new QCheckBox(i18n("Show number of notes in tray icon"), this);
auto kcfg_SystemTrayShowNotes = new QCheckBox(i18n("Show number of notes in tray icon"), this);
kcfg_SystemTrayShowNotes->setObjectName(QStringLiteral("kcfg_SystemTrayShowNotes"));
lay->addWidget(kcfg_SystemTrayShowNotes);
auto hbox = new QHBoxLayout;
lay->addLayout(hbox);
QLabel *label_DefaultTitle = new QLabel(i18n("Default Title:"), this);
auto label_DefaultTitle = new QLabel(i18n("Default Title:"), this);
hbox->addWidget(label_DefaultTitle);
mDefaultTitle = new QLineEdit(this);
label_DefaultTitle->setBuddy(mDefaultTitle);
hbox->addWidget(mDefaultTitle);
QLabel *howItWorks = new QLabel(i18n("<a href=\"whatsthis\">How does this work?</a>"));
auto howItWorks = new QLabel(i18n("<a href=\"whatsthis\">How does this work?</a>"));
connect(howItWorks, &QLabel::linkActivated, this, &KNoteMiscConfig::slotHelpLinkClicked);
lay->addWidget(howItWorks);
addConfig(KNotesGlobalConfig::self(), this);
......@@ -142,12 +142,12 @@ KNotePrintConfig::KNotePrintConfig(QWidget *parent)
: KCModule(parent)
{
auto lay = new QVBoxLayout(this);
QWidget *w = new QWidget(this);
auto w = new QWidget(this);
lay->addWidget(w);
auto layout = new QGridLayout(w);
layout->setContentsMargins(0, 0, 0, 0);
QLabel *label_PrintAction = new QLabel(i18n("Theme:"), this);
auto label_PrintAction = new QLabel(i18n("Theme:"), this);
layout->addWidget(label_PrintAction, 0, 0);
mSelectTheme = new KNotePrintSelectThemeComboBox(this);
......