Commit 0f477196 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Modernize code

parent 0546e16e
Pipeline #32938 failed with stage
in 48 minutes and 16 seconds
......@@ -21,7 +21,7 @@
namespace Akonadi {
MigrationAgent::MigrationAgent(const QString &id)
: AgentBase(id)
: AgentBase(id)
, mScheduler(new KUiServerJobTracker)
{
KLocalizedString::setApplicationDomain("akonadi_migration_agent");
......
......@@ -58,7 +58,7 @@ void LogModel::message(MigratorBase::MessageType type, const QString &msg)
}
Row::Row(const QSharedPointer<MigratorBase> &migrator, MigratorModel &model)
: QObject()
: QObject()
, mMigrator(migrator)
, mModel(model)
{
......
......@@ -20,7 +20,7 @@ public:
void start() override;
private:
Akonadi::Item::Id mId;
const Akonadi::Item::Id mId;
};
#endif // NEWMAILNOTIFIERSHOWMESSAGEJOB_H
......@@ -39,13 +39,13 @@ private:
void slotActivateNotificationAction(unsigned int index);
void emitNotification(const QPixmap &pixmap = QPixmap());
void deleteItemDone(KJob *job);
QStringList mListEmails;
const QStringList mListEmails;
QString mDefaultIconName;
QString mSubject;
QString mFrom;
QString mPath;
const QString mPath;
Akonadi::Item mItem;
Akonadi::Item::Id mItemId;
const Akonadi::Item::Id mItemId;
};
#endif // SPECIALNOTIFIERJOB_H
......@@ -14,7 +14,7 @@
using namespace Akonadi;
UpdateJob::UpdateJob(const Collection &col, QObject *parent)
: Job(parent)
: Job(parent)
, mCollection(col)
, mModJobRunning(false)
{
......
......@@ -17,19 +17,19 @@ public:
GidMigrator(const QString &mimeType);
~GidMigrator() override;
QString displayName() const override;
QString description() const override;
Q_REQUIRED_RESULT QString displayName() const override;
Q_REQUIRED_RESULT QString description() const override;
bool canStart() override;
Q_REQUIRED_RESULT bool canStart() override;
bool shouldAutostart() const override;
Q_REQUIRED_RESULT bool shouldAutostart() const override;
protected:
void startWork() override;
private Q_SLOTS:
void migrationFinished(KJob *);
private:
QString mMimeType;
const QString mMimeType;
};
#endif // GIDMIGRATOR_H
......@@ -29,7 +29,7 @@ int main(int argc, char **argv)
QStringLiteral("0.1"),
i18n("Migration of Akonadi Items to support GID"),
KAboutLicense::LGPL,
i18n("(c) 2013-2016 the Akonadi developers"),
i18n("(c) 2013-2020 the Akonadi developers"),
QStringLiteral("https://community.kde.org/KDE_PIM/Akonadi"));
aboutData.addAuthor(i18n("Christian Mollekopf"), i18n("Author"), QStringLiteral("mollekopf@kolabsys.com"));
......
......@@ -20,10 +20,10 @@ class GoogleResourceMigrator : public MigratorBase
public:
explicit GoogleResourceMigrator();
QString displayName() const override;
QString description() const override;
Q_REQUIRED_RESULT QString displayName() const override;
Q_REQUIRED_RESULT QString description() const override;
bool shouldAutostart() const override;
Q_REQUIRED_RESULT bool shouldAutostart() const override;
protected:
void startWork() override;
......@@ -50,10 +50,10 @@ private:
T contacts{};
};
bool migrateAccount(const QString &account, const Instances &oldInstances, const Akonadi::AgentInstance &newInstance);
Q_REQUIRED_RESULT bool migrateAccount(const QString &account, const Instances &oldInstances, const Akonadi::AgentInstance &newInstance);
void removeLegacyInstances(const QString &account, const Instances &instances);
QString mergeAccountNames(const ResourceValues<QString> &accountName, const Instances &oldInstances) const;
int mergeAccountIds(const ResourceValues<int> &accountId, const Instances &oldInstances) const;
Q_REQUIRED_RESULT QString mergeAccountNames(const ResourceValues<QString> &accountName, const Instances &oldInstances) const;
Q_REQUIRED_RESULT int mergeAccountIds(const ResourceValues<int> &accountId, const Instances &oldInstances) const;
QMap<QString, Instances> mMigrations;
int mMigrationCount = 0;
......
......@@ -28,10 +28,7 @@ enum {
bool InfoDialog::mError = false;
InfoDialog::InfoDialog(bool closeWhenDone)
: mMigratorCount(0)
, mChange(false)
, mCloseWhenDone(closeWhenDone)
, mAutoScrollList(true)
: mCloseWhenDone(closeWhenDone)
{
setAttribute(Qt::WA_DeleteOnClose);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
......
......@@ -57,7 +57,7 @@ private:
static bool mError;
bool mChange = false;
bool mCloseWhenDone = false;
bool mAutoScrollList = false;
bool mAutoScrollList = true;
};
#endif
......@@ -44,7 +44,7 @@ QString messageTypeToString(KMigratorBase::MessageType type)
}
}
KMigratorBase::KMigratorBase() : m_logFile(nullptr)
KMigratorBase::KMigratorBase()
{
const QString logFileName = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + QCoreApplication::applicationName() + QLatin1String("/migration.log");
QFileInfo fileInfo(logFileName);
......
......@@ -59,9 +59,8 @@ static MigratorBase::MigrationState identifierToState(const QString &identifier)
}
MigratorBase::MigratorBase(const QString &identifier, QObject *parent)
: QObject(parent)
: QObject(parent)
, mIdentifier(identifier)
, mMigrationState(None)
, mConfig(new KConfig(Akonadi::ServerManager::addNamespace(QStringLiteral("akonadi-migrationrc"))))
{
const QString logFileName = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + QCoreApplication::applicationName() + QLatin1Char('/') + identifier
......
......@@ -211,7 +211,7 @@ private:
void setLogfile(const QString &);
const QString mIdentifier;
MigrationState mMigrationState;
MigrationState mMigrationState = None;
QScopedPointer<QFile> mLogFile;
QScopedPointer<KConfig> mConfig;
int mProgress;
......
......@@ -15,8 +15,8 @@ QString translateErrorString(const Error &error)
QString result;
ErrorNumber errorNumber = error.errorNumber();
int responseCode = error.responseCode();
QString errorText = error.errorText();
const int responseCode = error.responseCode();
const QString errorText = error.errorText();
QString err = error.translatedJobError();
switch (errorNumber) {
......
......@@ -64,7 +64,6 @@ typedef QSharedPointer<KCalendarCore::Incidence> IncidencePtr;
DavGroupwareResource::DavGroupwareResource(const QString &id)
: ResourceBase(id)
, FreeBusyProviderBase()
, mSyncErrorNotified(false)
{
AttributeFactory::registerAttribute<EntityDisplayAttribute>();
AttributeFactory::registerAttribute<DavProtocolAttribute>();
......
......@@ -39,7 +39,7 @@ private:
void onCollectionsFetchJobFinished(KJob *job);
Ui::SearchDialog mUi;
QStandardItemModel *mModel = nullptr;
QStandardItemModel *const mModel;
int mSubJobCount = 0;
};
......
......@@ -39,7 +39,7 @@ enum GroupwareServers {
static QString settingsToUrl(const QWizard *wizard, const QString &protocol)
{
QString desktopFilePath = wizard->property("providerDesktopFilePath").toString();
const QString desktopFilePath = wizard->property("providerDesktopFilePath").toString();
if (desktopFilePath.isEmpty()) {
return QString();
}
......@@ -49,14 +49,14 @@ static QString settingsToUrl(const QWizard *wizard, const QString &protocol)
return QString();
}
QStringList supportedProtocols = service->property(QStringLiteral("X-DavGroupware-SupportedProtocols")).toStringList();
const QStringList supportedProtocols = service->property(QStringLiteral("X-DavGroupware-SupportedProtocols")).toStringList();
if (!supportedProtocols.contains(protocol)) {
return QString();
}
QString pathPattern;
QString pathPropertyName(QStringLiteral("X-DavGroupware-") + protocol + QStringLiteral("Path"));
const QString pathPropertyName(QStringLiteral("X-DavGroupware-") + protocol + QStringLiteral("Path"));
if (service->property(pathPropertyName).isNull()) {
return QString();
}
......
......@@ -38,22 +38,18 @@ public:
QString mContentType;
QString mContentId;
QString mContentLocation;
long mSize;
long mSize = 0;
QDateTime mLastModifiedTime;
bool mIsInline;
bool mIsContactPhoto;
bool mIsInline = false;
bool mIsContactPhoto = false;
QByteArray mContent;
EwsItem mItem;
bool mValid;
bool mValid = false;
QBitArray mValidFields;
};
EwsAttachmentPrivate::EwsAttachmentPrivate()
: mType(EwsAttachment::UnknownAttachment)
, mSize(0)
, mIsInline(false)
, mIsContactPhoto(false)
, mValid(false)
, mValidFields(NumFields)
{
}
......
......@@ -37,7 +37,7 @@ protected:
Akonadi::Item mItem;
Akonadi::Collection mCollection;
EwsClient &mClient;
EwsTagStore *mTagStore = nullptr;
EwsTagStore *const mTagStore;
};
#endif
......@@ -10,7 +10,6 @@
EwsFetchItemDetailJob::EwsFetchItemDetailJob(EwsClient &client, QObject *parent, const Akonadi::Collection &collection)
: KCompositeJob(parent)
, mDeletedItems(nullptr)
, mClient(client)
, mCollection(collection)
{
......
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