Commit 7ffd8d60 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Modernize code

parent b1f88097
Pipeline #60851 passed with stage
in 8 minutes and 5 seconds
......@@ -26,12 +26,12 @@ KCMAkregatorAdvancedConfig::KCMAkregatorAdvancedConfig(QWidget *parent, const QV
{
auto layout = new QVBoxLayout(this);
layout->addWidget(m_widget);
KAboutData *about = new KAboutData(QStringLiteral("kcmakradvancedconfig"),
i18n("Advanced Feed Reader Settings"),
QString(),
QString(),
KAboutLicense::GPL,
i18n("(c), 2004 - 2008 Frank Osterfeld"));
auto about = new KAboutData(QStringLiteral("kcmakradvancedconfig"),
i18n("Advanced Feed Reader Settings"),
QString(),
QString(),
KAboutLicense::GPL,
i18n("(c), 2004 - 2008 Frank Osterfeld"));
about->addAuthor(i18n("Frank Osterfeld"), QString(), QStringLiteral("osterfeld@kde.org"));
......
......@@ -41,12 +41,12 @@ KCMAkregatorAppearanceConfig::KCMAkregatorAppearanceConfig(QWidget *parent, cons
connect(m_ui.kcfg_MinimumFontSize, qOverload<int>(&KPluralHandlingSpinBox::valueChanged), m_ui.slider_minimumFontSize, &QSlider::setValue);
connect(m_ui.kcfg_MediumFontSize, qOverload<int>(&KPluralHandlingSpinBox::valueChanged), m_ui.slider_mediumFontSize, &QSlider::setValue);
KAboutData *about = new KAboutData(QStringLiteral("kcmakrappearanceconfig"),
i18n("Configure Feed Reader Appearance"),
QString(),
QString(),
KAboutLicense::GPL,
i18n("(c), 2004 - 2008 Frank Osterfeld"));
auto about = new KAboutData(QStringLiteral("kcmakrappearanceconfig"),
i18n("Configure Feed Reader Appearance"),
QString(),
QString(),
KAboutLicense::GPL,
i18n("(c), 2004 - 2008 Frank Osterfeld"));
about->addAuthor(i18n("Frank Osterfeld"), QString(), QStringLiteral("osterfeld@kde.org"));
......
......@@ -39,12 +39,12 @@ KCMAkregatorArchiveConfig::KCMAkregatorArchiveConfig(QWidget *parent, const QVar
m_archiveModeGroup->addButton(m_ui.rb_DisableArchiving, Settings::EnumArchiveMode::disableArchiving);
connect(m_archiveModeGroup, QOverload<QAbstractButton *>::of(&QButtonGroup::buttonClicked), this, &KCMAkregatorArchiveConfig::markAsChanged);
KAboutData *about = new KAboutData(QStringLiteral("kcmakrarchiveconfig"),
i18n("Configure Feed Reader Archive"),
QString(),
QString(),
KAboutLicense::GPL,
i18n("(c), 2004 - 2008 Frank Osterfeld"));
auto about = new KAboutData(QStringLiteral("kcmakrarchiveconfig"),
i18n("Configure Feed Reader Archive"),
QString(),
QString(),
KAboutLicense::GPL,
i18n("(c), 2004 - 2008 Frank Osterfeld"));
about->addAuthor(i18n("Frank Osterfeld"), QString(), QStringLiteral("osterfeld@kde.org"));
setAboutData(about);
......
......@@ -31,12 +31,12 @@ KCMAkregatorBrowserConfig::KCMAkregatorBrowserConfig(QWidget *parent, const QVar
layout->addWidget(m_widget);
connect(ui.kcfg_ExternalBrowserUseCustomCommand, &QAbstractButton::toggled, ui.kcfg_ExternalBrowserCustomCommand, &QWidget::setEnabled);
KAboutData *about = new KAboutData(QStringLiteral("kcmakrbrowserconfig"),
i18n("Configure Feed Reader Browser"),
QString(),
QString(),
KAboutLicense::GPL,
i18n("(c), 2004 - 2008 Frank Osterfeld"));
auto about = new KAboutData(QStringLiteral("kcmakrbrowserconfig"),
i18n("Configure Feed Reader Browser"),
QString(),
QString(),
KAboutLicense::GPL,
i18n("(c), 2004 - 2008 Frank Osterfeld"));
about->addAuthor(i18n("Frank Osterfeld"), QString(), QStringLiteral("osterfeld@kde.org"));
......
......@@ -34,12 +34,12 @@ KCMAkregatorGeneralConfig::KCMAkregatorGeneralConfig(QWidget *parent, const QVar
connect(ui.kcfg_UseIntervalFetch, &QAbstractButton::toggled, ui.kcfg_AutoFetchInterval, &QWidget::setEnabled);
connect(ui.kcfg_UseIntervalFetch, &QAbstractButton::toggled, ui.autoFetchIntervalLabel, &QWidget::setEnabled);
KAboutData *about = new KAboutData(QStringLiteral("kcmakrgeneralconfig"),
i18n("Configure Feeds"),
QString(),
QString(),
KAboutLicense::GPL,
i18n("(c), 2004 - 2008 Frank Osterfeld"));
auto about = new KAboutData(QStringLiteral("kcmakrgeneralconfig"),
i18n("Configure Feeds"),
QString(),
QString(),
KAboutLicense::GPL,
i18n("(c), 2004 - 2008 Frank Osterfeld"));
about->addAuthor(i18n("Frank Osterfeld"), QString(), QStringLiteral("osterfeld@kde.org"));
......
......@@ -23,12 +23,12 @@ KCMAkregatorPluginsConfig::KCMAkregatorPluginsConfig(QWidget *parent, const QVar
auto lay = new QHBoxLayout(this);
lay->setContentsMargins({});
KAboutData *about = new KAboutData(QStringLiteral("kcmakrpluginsconfig"),
i18n("Configure Plugins"),
QString(),
QString(),
KAboutLicense::GPL,
i18n("(c), 2016-2021 Laurent Montel"));
auto about = new KAboutData(QStringLiteral("kcmakrpluginsconfig"),
i18n("Configure Plugins"),
QString(),
QString(),
KAboutLicense::GPL,
i18n("(c), 2016-2021 Laurent Montel"));
about->addAuthor(i18n("Laurent Montel"), QString(), QStringLiteral("montel@kde.org"));
......
......@@ -24,12 +24,12 @@ KCMAkregatorUserFeedBackConfig::KCMAkregatorUserFeedBackConfig(QWidget *parent,
auto lay = new QHBoxLayout(this);
lay->setContentsMargins({});
KAboutData *about = new KAboutData(QStringLiteral("kcmaddressbookuserfeedbackconfig"),
i18n("Configure User Feedback"),
QString(),
QString(),
KAboutLicense::GPL,
i18n("(c), 2020-2021 Laurent Montel"));
auto about = new KAboutData(QStringLiteral("kcmaddressbookuserfeedbackconfig"),
i18n("Configure User Feedback"),
QString(),
QString(),
KAboutLicense::GPL,
i18n("(c), 2020-2021 Laurent Montel"));
about->addAuthor(i18n("Laurent Montel"), QString(), QStringLiteral("montel@kde.org"));
......
......@@ -20,7 +20,7 @@ class QString;
template<class T> class QList;
typedef unsigned int uint;
using uint = unsigned int;
class QUrl;
......@@ -28,7 +28,7 @@ namespace Syndication
{
class Enclosure;
class Item;
typedef QSharedPointer<Item> ItemPtr;
using ItemPtr = QSharedPointer<Item>;
}
namespace Akregator
......
......@@ -26,7 +26,7 @@ AkregatorPlugin::AkregatorPlugin(KontactInterface::Core *core, const QVariantLis
{
setComponentName(QStringLiteral("akregator"), i18n("Akregator"));
QAction *action = new QAction(QIcon::fromTheme(QStringLiteral("bookmark-new")), i18nc("@action:inmenu", "New Feed..."), this);
auto action = new QAction(QIcon::fromTheme(QStringLiteral("bookmark-new")), i18nc("@action:inmenu", "New Feed..."), this);
actionCollection()->addAction(QStringLiteral("feed_new"), action);
actionCollection()->setDefaultShortcut(action, QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_F));
setHelpText(action, i18nc("@info:status", "Create a new feed"));
......
......@@ -314,7 +314,7 @@ void ActionManagerImpl::initMainWidget(MainWidget *mainWidget)
coll->setDefaultShortcut(action, QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_R));
// Settings menu
auto *sqf = coll->add<KToggleAction>(QStringLiteral("show_quick_filter"));
auto sqf = coll->add<KToggleAction>(QStringLiteral("show_quick_filter"));
sqf->setText(i18n("Show Quick Filter"));
connect(sqf, &QAction::triggered, d->mainWidget, &MainWidget::slotToggleShowQuickFilter);
sqf->setChecked(Settings::showQuickFilter());
......@@ -361,7 +361,7 @@ void ActionManagerImpl::initMainWidget(MainWidget *mainWidget)
connect(action, &QAction::triggered, d->mainWidget, &MainWidget::slotArticleDelete);
coll->setDefaultShortcut(action, QKeySequence(Qt::Key_Delete));
auto *statusMenu = coll->add<KActionMenu>(QStringLiteral("article_set_status"));
auto statusMenu = coll->add<KActionMenu>(QStringLiteral("article_set_status"));
statusMenu->setText(i18n("&Mark As"));
statusMenu->setEnabled(false);
......@@ -389,7 +389,7 @@ void ActionManagerImpl::initMainWidget(MainWidget *mainWidget)
connect(action, &QAction::triggered, d->mainWidget, &MainWidget::slotSetSelectedArticleUnread);
statusMenu->addAction(action);
auto *importantAction = coll->add<KToggleAction>(QStringLiteral("article_set_status_important"));
auto importantAction = coll->add<KToggleAction>(QStringLiteral("article_set_status_important"));
importantAction->setText(i18n("&Mark as Important"));
importantAction->setIcon(QIcon::fromTheme(QStringLiteral("mail-mark-important")));
const QList<QKeySequence> importantSC = {QKeySequence(Qt::CTRL | Qt::Key_I), QKeySequence(Qt::Key_I)};
......
......@@ -16,14 +16,14 @@
QAction *Akregator::createOpenLinkInNewTabAction(const QUrl &url, QObject *parent)
{
QAction *action = new QAction(QIcon::fromTheme(QStringLiteral("tab-new")), i18n("Open Link in New &Tab"), parent);
auto action = new QAction(QIcon::fromTheme(QStringLiteral("tab-new")), i18n("Open Link in New &Tab"), parent);
action->setData(url);
return action;
}
QAction *Akregator::createOpenLinkInExternalBrowserAction(const QUrl &url, QObject *parent)
{
QAction *action = new QAction(QIcon::fromTheme(QStringLiteral("window-new")), i18n("Open Link in External &Browser"), parent);
auto action = new QAction(QIcon::fromTheme(QStringLiteral("window-new")), i18n("Open Link in External &Browser"), parent);
action->setData(url);
return action;
}
......@@ -53,7 +53,7 @@ AddFeedDialog::AddFeedDialog(QWidget *parent, const QString &name)
auto mainLayout = new QVBoxLayout(this);
widget = new AddFeedWidget(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);
......
......@@ -33,7 +33,7 @@ struct ArticleId {
}
};
typedef QVector<Akregator::ArticleId> ArticleIdList;
using ArticleIdList = QVector<Akregator::ArticleId>;
class AKREGATOR_EXPORT CompositeJob : public KCompositeJob
{
......
......@@ -267,8 +267,8 @@ void ArticleMatcher::readConfig(KConfigGroup *config)
bool ArticleMatcher::operator==(const AbstractMatcher &other) const
{
auto *ptr = const_cast<AbstractMatcher *>(&other);
auto *o = dynamic_cast<ArticleMatcher *>(ptr);
auto ptr = const_cast<AbstractMatcher *>(&other);
auto o = dynamic_cast<ArticleMatcher *>(ptr);
if (!o) {
return false;
} else {
......
......@@ -89,7 +89,7 @@ ArticleViewerWebEngine::ArticleViewerWebEngine(KActionCollection *ac, QWidget *p
mExternalReference = new WebEngineViewer::LoadExternalReferencesUrlInterceptor(this);
// connect(externalReference, &MessageViewer::LoadExternalReferencesUrlInterceptor::urlBlocked, this, &MailWebEngineView::urlBlocked);
mNetworkAccessManager->addInterceptor(mExternalReference);
auto *blockTracking = new WebEngineViewer::BlockTrackingUrlInterceptor(this);
auto blockTracking = new WebEngineViewer::BlockTrackingUrlInterceptor(this);
connect(blockTracking, &WebEngineViewer::BlockTrackingUrlInterceptor::trackingFound, this, &ArticleViewerWebEngine::trackingFound);
mNetworkAccessManager->addInterceptor(blockTracking);
mBlockExternalReference = new WebEngineViewer::BlockExternalResourcesUrlInterceptor(this);
......@@ -178,7 +178,7 @@ void ArticleViewerWebEngine::slotSaveLinkAs()
url.setPath(url.path() + QLatin1String("/index.html"));
}
QFileDialog *dlg = new QFileDialog(this);
auto dlg = new QFileDialog(this);
dlg->setAttribute(Qt::WA_DeleteOnClose);
dlg->setAcceptMode(QFileDialog::AcceptSave);
dlg->setWindowTitle(i18n("Save As"));
......
......@@ -148,7 +148,7 @@ void ArticleViewerWebEngineWidgetNg::slotHandlePagePrinted(bool result)
void ArticleViewerWebEngineWidgetNg::slotPrintPreview()
{
QPrintPreviewDialog *dialog = new QPrintPreviewDialog(this);
auto dialog = new QPrintPreviewDialog(this);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->resize(800, 750);
......@@ -172,7 +172,7 @@ void ArticleViewerWebEngineWidgetNg::slotOpenInBrowser()
connect(job, &WebEngineViewer::WebEngineExportHtmlPageJob::success, this, &ArticleViewerWebEngineWidgetNg::slotExportHtmlPageSuccess);
job->start();
} else {
KIO::OpenUrlJob *job = new KIO::OpenUrlJob(currentUrl, QStringLiteral("text/html"));
auto job = new KIO::OpenUrlJob(currentUrl, QStringLiteral("text/html"));
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
job->setDeleteTemporaryFile(true);
job->start();
......@@ -186,7 +186,7 @@ void ArticleViewerWebEngineWidgetNg::slotExportHtmlPageFailed()
void ArticleViewerWebEngineWidgetNg::slotExportHtmlPageSuccess(const QString &filename)
{
KIO::OpenUrlJob *job = new KIO::OpenUrlJob(QUrl::fromLocalFile(filename), QStringLiteral("text/html"));
auto job = new KIO::OpenUrlJob(QUrl::fromLocalFile(filename), QStringLiteral("text/html"));
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
job->setDeleteTemporaryFile(true);
job->start();
......
......@@ -224,7 +224,7 @@ void ArticleViewerWidget::slotUpdateCombinedView()
QElapsedTimer spent;
spent.start();
const std::vector<QSharedPointer<const AbstractMatcher>>::const_iterator filterEnd = m_filters.cend();
const auto filterEnd = m_filters.cend();
QVector<Article> articles;
for (const Article &i : qAsConst(m_articles)) {
......
......@@ -18,7 +18,7 @@ CrashWidget::CrashWidget(QWidget *parent)
auto vbox = new QVBoxLayout(this);
auto labelLayout = new QHBoxLayout;
QLabel *label = new QLabel(i18n("Akregator did not close correctly. Would you like to restore the previous session?"), this);
auto label = new QLabel(i18n("Akregator did not close correctly. Would you like to restore the previous session?"), this);
label->setObjectName(QStringLiteral("restoresessionlabel"));
label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
QFont font = label->font();
......@@ -34,19 +34,19 @@ CrashWidget::CrashWidget(QWidget *parent)
vbox->addLayout(buttonLayout);
buttonLayout->addStretch(0);
QPushButton *restoreSessionButton = new QPushButton(QIcon::fromTheme(QStringLiteral("window-new")), i18n("Restore Session"), this);
auto restoreSessionButton = new QPushButton(QIcon::fromTheme(QStringLiteral("window-new")), i18n("Restore Session"), this);
restoreSessionButton->setObjectName(QStringLiteral("restoresessionbutton"));
restoreSessionButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
buttonLayout->addWidget(restoreSessionButton);
connect(restoreSessionButton, &QPushButton::clicked, this, &CrashWidget::slotRestoreSession);
QPushButton *dontRestoreSessionButton = new QPushButton(QIcon::fromTheme(QStringLiteral("dialog-close")), i18n("Do Not Restore Session"), this);
auto dontRestoreSessionButton = new QPushButton(QIcon::fromTheme(QStringLiteral("dialog-close")), i18n("Do Not Restore Session"), this);
dontRestoreSessionButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
dontRestoreSessionButton->setObjectName(QStringLiteral("dontrestoresessionbutton"));
buttonLayout->addWidget(dontRestoreSessionButton);
connect(dontRestoreSessionButton, &QPushButton::clicked, this, &CrashWidget::slotDontRestoreSession);
QPushButton *askMeLaterButton = new QPushButton(QIcon::fromTheme(QStringLiteral("chronometer")), i18n("Ask me later"), this);
auto askMeLaterButton = new QPushButton(QIcon::fromTheme(QStringLiteral("chronometer")), i18n("Ask me later"), this);
askMeLaterButton->setObjectName(QStringLiteral("askmelaterbutton"));
buttonLayout->addWidget(askMeLaterButton);
connect(askMeLaterButton, &QPushButton::clicked, this, &CrashWidget::slotAskMeLater);
......
......@@ -158,7 +158,7 @@ FeedList::FeedList(Backend::Storage *storage)
: QObject(nullptr)
, d(new Private(storage, this))
{
Folder *rootNode = new Folder(i18n("All Feeds"));
auto rootNode = new Folder(i18n("All Feeds"));
rootNode->setId(1);
setRootNode(rootNode);
addNode(rootNode, true);
......
......@@ -63,7 +63,7 @@ FeedPropertiesDialog::FeedPropertiesDialog(QWidget *parent, const QString &name)
auto mainLayout = new QVBoxLayout(this);
widget = new FeedPropertiesWidget(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);
......
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