Commit 3e616400 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Modernize code

parent ee91c0d6
Pipeline #39714 passed with stage
in 12 minutes and 45 seconds
......@@ -71,7 +71,7 @@ Q_SIGNALS:
private Q_SLOTS:
void onObjectSetupFinished(SetupObject *obj)
{
if (Transport *transport = qobject_cast<Transport *>(obj)) {
if (auto *transport = qobject_cast<Transport *>(obj)) {
mTransportId = transport->transportId();
}
}
......
......@@ -42,7 +42,7 @@ Dialog::Dialog(QWidget *parent)
const bool showPersonalDataPage = Global::typeFilter().size() == 1 && Global::typeFilter().at(0) == KMime::Message::mimeType();
if (showPersonalDataPage) {
// todo: don't ask these details based on a setting of the desktop file.
PersonalDataPage *pdpage = new PersonalDataPage(this);
auto *pdpage = new PersonalDataPage(this);
addPage(pdpage, i18n("Provide personal data"));
connect(pdpage, &PersonalDataPage::manualWanted, this, &Dialog::slotManualConfigWanted);
if (!Global::assistant().isEmpty()) {
......@@ -50,13 +50,13 @@ Dialog::Dialog(QWidget *parent)
}
if (!GpgME::checkEngine(GpgME::OpenPGP)) {
CryptoPage *cryptoPage = new CryptoPage(this);
auto *cryptoPage = new CryptoPage(this);
addPage(cryptoPage, i18n("Secure your Communication"));
}
}
if (Global::assistant().isEmpty()) {
TypePage *typePage = new TypePage(this);
auto *typePage = new TypePage(this);
connect(typePage->treeview(), &QAbstractItemView::doubleClicked, this, &Dialog::slotNextPage);
#ifndef ACCOUNTWIZARD_NO_GHNS
connect(typePage, &TypePage::ghnsWanted, this, &Dialog::slotGhnsWanted);
......@@ -65,7 +65,7 @@ Dialog::Dialog(QWidget *parent)
setAppropriate(mTypePage, false);
#ifndef ACCOUNTWIZARD_NO_GHNS
ProviderPage *ppage = new ProviderPage(this);
auto *ppage = new ProviderPage(this);
connect(typePage, &TypePage::ghnsWanted, ppage, &ProviderPage::startFetchingData);
connect(ppage->treeview(), &QAbstractItemView::doubleClicked, this, &Dialog::slotNextPage);
connect(ppage, &ProviderPage::ghnsNotWanted, this, &Dialog::slotGhnsNotWanted);
......@@ -74,7 +74,7 @@ Dialog::Dialog(QWidget *parent)
#endif
}
LoadPage *loadPage = new LoadPage(this);
auto *loadPage = new LoadPage(this);
mLoadPage = addPage(loadPage, i18n("Loading Assistant"));
setAppropriate(mLoadPage, false);
loadPage->exportObject(this, QStringLiteral("Dialog"));
......@@ -82,7 +82,7 @@ Dialog::Dialog(QWidget *parent)
loadPage->exportObject(new ServerTest(this), QStringLiteral("ServerTest"));
connect(loadPage, &LoadPage::aboutToStart, this, &Dialog::clearDynamicPages);
SetupPage *setupPage = new SetupPage(this);
auto *setupPage = new SetupPage(this);
mLastPage = addPage(setupPage, i18n("Setting up Account"));
mSetupManager->setSetupPage(setupPage);
......
......@@ -19,7 +19,7 @@
DynamicPage::DynamicPage(const QString &uiFile, KAssistantDialog *parent)
: Page(parent)
{
QVBoxLayout *layout = new QVBoxLayout(this);
auto *layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
QWidget *pageParent = this;
......@@ -32,7 +32,7 @@ DynamicPage::DynamicPage(const QString &uiFile, KAssistantDialog *parent)
m_dynamicWidget = loader.load(&file, pageParent);
file.close();
if (!Global::poFileName().isEmpty()) {
KLocalizedTranslator *translator = new KLocalizedTranslator(this);
auto *translator = new KLocalizedTranslator(this);
QCoreApplication::instance()->installTranslator(translator);
translator->setTranslationDomain(Global::poFileName());
......
......@@ -50,7 +50,7 @@ void AutoconfigKolabMail::slotResult(KJob *job)
return;
}
KIO::TransferJob *tjob = qobject_cast<KIO::TransferJob *>(job);
auto *tjob = qobject_cast<KIO::TransferJob *>(job);
int responsecode = tjob->queryMetaData(QStringLiteral("responsecode")).toInt();
......
......@@ -38,7 +38,7 @@ PersonalDataPage::PersonalDataPage(Dialog *parent)
ui.setupUi(pageParent);
ui.mProgress->stop();
PimCommon::EmailValidator *emailValidator = new PimCommon::EmailValidator(this);
auto *emailValidator = new PimCommon::EmailValidator(this);
ui.emailEdit->setValidator(emailValidator);
// KEmailSettings defaults
......@@ -158,7 +158,7 @@ void PersonalDataPage::configureSmtpAccount()
qCDebug(ACCOUNTWIZARD_LOG) << "Configuring transport for" << s.hostname;
QObject *object = mSetupManager->createTransport(QStringLiteral("smtp"));
Transport *t = qobject_cast<Transport *>(object);
auto *t = qobject_cast<Transport *>(object);
t->setName(accountName(mIspdb, s.username));
t->setHost(s.hostname);
t->setPort(s.port);
......@@ -209,7 +209,7 @@ void PersonalDataPage::configureImapAccount()
qCDebug(ACCOUNTWIZARD_LOG) << "Configuring imap for" << s.hostname;
QObject *object = mSetupManager->createResource(QStringLiteral("akonadi_imap_resource"));
Resource *t = qobject_cast<Resource *>(object);
auto *t = qobject_cast<Resource *>(object);
t->setName(accountName(mIspdb, s.username));
t->setOption(QStringLiteral("ImapServer"), s.hostname);
t->setOption(QStringLiteral("ImapPort"), s.port);
......@@ -261,7 +261,7 @@ void PersonalDataPage::configurePop3Account()
qCDebug(ACCOUNTWIZARD_LOG) << "No Imap to be created, configuring pop3 for" << s.hostname;
QObject *object = mSetupManager->createResource(QStringLiteral("akonadi_pop3_resource"));
Resource *t = qobject_cast<Resource *>(object);
auto *t = qobject_cast<Resource *>(object);
t->setName(accountName(mIspdb, s.username));
t->setOption(QStringLiteral("Host"), s.hostname);
t->setOption(QStringLiteral("Port"), s.port);
......
......@@ -92,7 +92,7 @@ void ProviderPage::leavePageNext()
return;
}
const QSortFilterProxyModel *proxy = static_cast<const QSortFilterProxyModel *>(ui.listView->model());
const auto *proxy = static_cast<const QSortFilterProxyModel *>(ui.listView->model());
const QStandardItem *item = m_model->itemFromIndex(proxy->mapToSource(index));
qCDebug(ACCOUNTWIZARD_LOG) << "Item selected:" << item->text();
......
......@@ -92,7 +92,7 @@ void Resource::create()
}
Q_EMIT info(i18n("Creating resource instance for '%1'...", type.name()));
AgentInstanceCreateJob *job = new AgentInstanceCreateJob(type, this);
auto *job = new AgentInstanceCreateJob(type, this);
connect(job, &AgentInstanceCreateJob::result, this, &Resource::instanceCreateResult);
job->start();
}
......
......@@ -33,7 +33,7 @@ int SetupAutoconfigKolabFreebusy::countFreebusyServers() const
void SetupAutoconfigKolabFreebusy::fillFreebusyServer(int i, QObject *o) const
{
const freebusy isp = mIspdb->freebusyServers().values().at(i);
ConfigFile *korganizer = qobject_cast<ConfigFile *>(o);
auto *korganizer = qobject_cast<ConfigFile *>(o);
QFileInfo path(isp.path);
QString url(QStringLiteral("https://"));
......
......@@ -50,7 +50,7 @@ void SetupIspdb::fillIdentity(int i, QObject *o) const
{
identity isp = mIspdb->identities().at(i);
Identity *id = qobject_cast<Identity *>(o);
auto *id = qobject_cast<Identity *>(o);
id->setIdentityName(isp.name);
id->setRealName(isp.name);
......@@ -65,7 +65,7 @@ void SetupIspdb::fillImapServer(int i, QObject *o) const
return;
}
Server isp = mIspdb->imapServers().at(i);
Resource *imapRes = qobject_cast<Resource *>(o);
auto *imapRes = qobject_cast<Resource *>(o);
imapRes->setName(isp.hostname);
imapRes->setOption(QStringLiteral("ImapServer"), isp.hostname);
......@@ -89,7 +89,7 @@ int SetupIspdb::countImapServers() const
void SetupIspdb::fillSmtpServer(int i, QObject *o) const
{
Server isp = mIspdb->smtpServers().at(i);
Transport *smtpRes = qobject_cast<Transport *>(o);
auto *smtpRes = qobject_cast<Transport *>(o);
smtpRes->setName(isp.hostname);
smtpRes->setHost(isp.hostname);
......
......@@ -63,7 +63,7 @@ QObject *SetupManager::createLdap()
QObject *SetupManager::createIdentity()
{
Identity *identity = new Identity(this);
auto *identity = new Identity(this);
identity->setEmail(m_email);
identity->setRealName(m_name);
identity->setPgpAutoSign(m_pgpAutoSign);
......
......@@ -29,7 +29,7 @@ void SetupPage::detailsClicked()
void SetupPage::addMessage(SetupPage::MessageType type, const QString &msg)
{
QStandardItem *item = new QStandardItem;
auto *item = new QStandardItem;
item->setText(msg);
item->setEditable(false);
switch (type) {
......
......@@ -16,7 +16,7 @@ template<typename T>
struct StringValueTable {
const char *name;
typename T::type value;
typedef typename T::type value_type;
using value_type = typename T::type;
};
static const StringValueTable<MailTransport::Transport::EnumEncryption> encryptionEnum[] = {
......
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