Commit 8006ba87 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Modernize code

parent a70daa23
Pipeline #39508 passed with stage
in 23 minutes and 20 seconds
......@@ -56,7 +56,7 @@ int main(int argc, char *argv[])
qCDebug(PIMDATAEXPORTERCONSOLE_LOG) << "Log file " << logFile;
}
PimDataExporterConsole *console = new PimDataExporterConsole;
auto *console = new PimDataExporterConsole;
if (!importFile.isEmpty()) {
console->setMode(PimDataExporterConsole::Import);
qCDebug(PIMDATAEXPORTERCONSOLE_LOG) << "Import Mode" << importFile;
......
......@@ -23,7 +23,7 @@ PimDataExporterConsole::PimDataExporterConsole(QObject *parent)
{
//Initialize filtermanager
(void)MailCommon::FilterManager::instance();
PimDataExporterKernel *kernel = new PimDataExporterKernel(this);
auto *kernel = new PimDataExporterKernel(this);
CommonKernel->registerKernelIf(kernel); //register KernelIf early, it is used by the Filter classes
CommonKernel->registerSettingsIf(kernel); //SettingsIf is used in FolderTreeWidget
......
......@@ -136,13 +136,13 @@ void AbstractImportExportJob::overwriteDirectory(const QString &path, const KArc
{
if (QDir(path).exists()) {
if (overwriteDirectoryMessageBox(path)) {
const KArchiveDirectory *dirEntry = static_cast<const KArchiveDirectory *>(entry);
const auto *dirEntry = static_cast<const KArchiveDirectory *>(entry);
if (!dirEntry->copyTo(path)) {
qCWarning(PIMDATAEXPORTERCORE_LOG) << "directory cannot overwrite to " << path;
}
}
} else {
const KArchiveDirectory *dirEntry = static_cast<const KArchiveDirectory *>(entry);
const auto *dirEntry = static_cast<const KArchiveDirectory *>(entry);
if (dirEntry->copyTo(path)) {
qCWarning(PIMDATAEXPORTERCORE_LOG) << "directory cannot overwrite to " << path;
}
......@@ -171,7 +171,7 @@ void AbstractImportExportJob::storeArchiveInfoResources(const KArchiveDirectory
for (const QString &entryName : lst) {
const KArchiveEntry *entry = dir->entry(entryName);
if (entry && entry->isDirectory()) {
const KArchiveDirectory *resourceDir = static_cast<const KArchiveDirectory *>(entry);
const auto *resourceDir = static_cast<const KArchiveDirectory *>(entry);
const QStringList lst = resourceDir->entries();
if (lst.count() >= 2) {
......@@ -261,7 +261,7 @@ void AbstractImportExportJob::initializeImportJob()
void AbstractImportExportJob::copyToDirectory(const KArchiveEntry *entry, const QString &dest)
{
const KArchiveDirectory *subfolderDir = static_cast<const KArchiveDirectory *>(entry);
const auto *subfolderDir = static_cast<const KArchiveDirectory *>(entry);
if (!subfolderDir->copyTo(dest)) {
qCDebug(PIMDATAEXPORTERCORE_LOG) << "directory cannot copy to " << dest;
}
......@@ -302,7 +302,7 @@ void AbstractImportExportJob::copyToFile(const KArchiveFile *archivefile, const
void AbstractImportExportJob::backupResourceFile(const QString &identifier, const QString &defaultPath)
{
BackupResourceFileJobImpl *job = new BackupResourceFileJobImpl(this);
auto *job = new BackupResourceFileJobImpl(this);
job->setDefaultPath(defaultPath);
job->setIdentifier(identifier);
job->setZip(archive());
......@@ -327,7 +327,7 @@ QStringList AbstractImportExportJob::restoreResourceFile(const QString &resource
if (value.akonadiConfigFile.contains(resourceBaseName + QLatin1Char('_'))) {
const KArchiveEntry *fileResouceEntry = mArchiveDirectory->entry(value.akonadiConfigFile);
if (fileResouceEntry && fileResouceEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(fileResouceEntry);
const auto *file = static_cast<const KArchiveFile *>(fileResouceEntry);
if (!file->copyTo(copyToDirName)) {
qCWarning(PIMDATAEXPORTERCORE_LOG) << "file " << value.akonadiConfigFile << " can not copy to " << copyToDirName;
}
......@@ -343,7 +343,7 @@ QStringList AbstractImportExportJob::restoreResourceFile(const QString &resource
const QString dataFile = value.akonadiResources;
const KArchiveEntry *dataResouceEntry = mArchiveDirectory->entry(dataFile);
if (dataResouceEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(dataResouceEntry);
const auto *file = static_cast<const KArchiveFile *>(dataResouceEntry);
if (!file->copyTo(newUrl)) {
qCWarning(PIMDATAEXPORTERCORE_LOG) << "file " << dataFile << " can not copy to " << newUrl;
}
......@@ -354,7 +354,7 @@ QStringList AbstractImportExportJob::restoreResourceFile(const QString &resource
if (!agentConfigFile.isEmpty()) {
const KArchiveEntry *akonadiAgentConfigEntry = mArchiveDirectory->entry(agentConfigFile);
if (akonadiAgentConfigEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(akonadiAgentConfigEntry);
const auto *file = static_cast<const KArchiveFile *>(akonadiAgentConfigEntry);
file->copyTo(copyToDirName);
resourceName = file->name();
const QString configPath = copyToDirName + QLatin1Char('/') + resourceName;
......@@ -412,10 +412,10 @@ void AbstractImportExportJob::extractZipFile(const KArchiveFile *file, const QSt
const KArchiveEntry *entry = zipDir->entry(entryName);
if (entry) {
if (entry->isDirectory()) {
const KArchiveDirectory *dir = static_cast<const KArchiveDirectory *>(entry);
const auto *dir = static_cast<const KArchiveDirectory *>(entry);
dir->copyTo(destination + QLatin1Char('/') + dir->name(), true);
} else if (entry->isFile()) {
const KArchiveFile *dir = static_cast<const KArchiveFile *>(entry);
const auto *dir = static_cast<const KArchiveFile *>(entry);
dir->copyTo(destination);
}
}
......@@ -437,7 +437,7 @@ void AbstractImportExportJob::restoreUiRcFile(const QString &configNameStr, cons
{
const KArchiveEntry *configNameentry = mArchiveDirectory->entry(Utils::configsPath() + configNameStr);
if (configNameentry && configNameentry->isFile()) {
const KArchiveFile *configNameconfiguration = static_cast<const KArchiveFile *>(configNameentry);
const auto *configNameconfiguration = static_cast<const KArchiveFile *>(configNameentry);
const QString configNamerc = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/kxmlgui5/") + applicationName + QLatin1Char('/') + configNameStr;
if (QFileInfo::exists(configNamerc)) {
if (overwriteConfigMessageBox(configNameStr)) {
......@@ -453,7 +453,7 @@ void AbstractImportExportJob::restoreConfigFile(const QString &configNameStr)
{
const KArchiveEntry *configNameentry = mArchiveDirectory->entry(Utils::configsPath() + configNameStr);
if (configNameentry && configNameentry->isFile()) {
const KArchiveFile *configNameconfiguration = static_cast<const KArchiveFile *>(configNameentry);
const auto *configNameconfiguration = static_cast<const KArchiveFile *>(configNameentry);
const QString configNamerc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + configNameStr;
if (QFileInfo::exists(configNamerc)) {
//TODO 4.12 allow to merge config.
......@@ -506,7 +506,7 @@ void AbstractImportExportJob::slotNextStep()
void AbstractImportExportJob::startSynchronizeResources(const QStringList &listResourceToSync)
{
Q_EMIT info(i18n("Start synchronizing..."));
SynchronizeResourceJob *job = new SynchronizeResourceJob(this);
auto *job = new SynchronizeResourceJob(this);
job->setListResources(listResourceToSync);
connect(job, &SynchronizeResourceJob::synchronizationFinished, this, &AbstractImportExportJob::slotAllResourceSynchronized);
connect(job, &SynchronizeResourceJob::synchronizationInstanceDone, this, &AbstractImportExportJob::slotSynchronizeInstanceDone);
......@@ -553,7 +553,7 @@ void AbstractImportExportJob::importDataSubdirectory(const QString &subdirectory
{
const KArchiveEntry *themeEntry = mArchiveDirectory->entry(Utils::dataPath() + subdirectoryRelativePath);
if (themeEntry && themeEntry->isDirectory()) {
const KArchiveDirectory *themeDir = static_cast<const KArchiveDirectory *>(themeEntry);
const auto *themeDir = static_cast<const KArchiveDirectory *>(themeEntry);
const QStringList lst = themeDir->entries();
for (const QString &entryName : lst) {
const KArchiveEntry *entry = themeDir->entry(entryName);
......
......@@ -49,7 +49,7 @@ Akonadi::Collection::Id ExportAddressbookJobInterfaceImpl::convertFolderPathToCo
void ExportAddressbookJobInterfaceImpl::exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier)
{
ExportResourceArchiveJob *resourceJob = new ExportResourceArchiveJob(this);
auto *resourceJob = new ExportResourceArchiveJob(this);
resourceJob->setArchivePath(archivePath);
resourceJob->setUrl(url);
resourceJob->setIdentifier(identifier);
......
......@@ -92,7 +92,7 @@ void ImportAddressbookJobInterface::restoreConfig()
const QString kaddressbookStr(QStringLiteral("kaddressbookrc"));
const KArchiveEntry *kaddressbookrcentry = mArchiveDirectory->entry(Utils::configsPath() + kaddressbookStr);
if (kaddressbookrcentry && kaddressbookrcentry->isFile()) {
const KArchiveFile *kaddressbookrcFile = static_cast<const KArchiveFile *>(kaddressbookrcentry);
const auto *kaddressbookrcFile = static_cast<const KArchiveFile *>(kaddressbookrcentry);
const QString searchExistingFilerc = configLocation() + kaddressbookStr;
const QString installPathFilerc = installConfigLocation() + kaddressbookStr;
......@@ -131,12 +131,12 @@ void ImportAddressbookJobInterface::importkaddressBookConfig(const KArchiveFile
const QString cvsTemplateDirName = QStringLiteral("/kaddressbook/csv-templates/");
const KArchiveEntry *csvtemplateEntry = mArchiveDirectory->entry(Utils::dataPath() + cvsTemplateDirName);
if (csvtemplateEntry && csvtemplateEntry->isDirectory()) {
const KArchiveDirectory *csvTemplateDir = static_cast<const KArchiveDirectory *>(csvtemplateEntry);
const auto *csvTemplateDir = static_cast<const KArchiveDirectory *>(csvtemplateEntry);
const QStringList lst = csvTemplateDir->entries();
for (const QString &entryName : lst) {
const KArchiveEntry *entry = csvTemplateDir->entry(entryName);
if (entry && entry->isFile()) {
const KArchiveFile *csvTemplateFile = static_cast<const KArchiveFile *>(entry);
const auto *csvTemplateFile = static_cast<const KArchiveFile *>(entry);
const QString name = csvTemplateFile->name();
QString autocorrectionPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + cvsTemplateDirName;
if (QFileInfo::exists(autocorrectionPath)) {
......@@ -178,7 +178,7 @@ void ImportAddressbookJobInterface::restoreResources()
|| value.akonadiConfigFile.contains(QLatin1String("akonadi_contacts_resource_"))) {
const KArchiveEntry *fileResouceEntry = mArchiveDirectory->entry(value.akonadiConfigFile);
if (fileResouceEntry && fileResouceEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(fileResouceEntry);
const auto *file = static_cast<const KArchiveFile *>(fileResouceEntry);
copyArchiveFileTo(file, copyToDirName);
QString resourceName(file->name());
......@@ -191,7 +191,7 @@ void ImportAddressbookJobInterface::restoreResources()
const QString dataFile = value.akonadiResources;
const KArchiveEntry *dataResouceEntry = mArchiveDirectory->entry(dataFile);
if (dataResouceEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(dataResouceEntry);
const auto *file = static_cast<const KArchiveFile *>(dataResouceEntry);
//TODO adapt directory name too
extractZipFile(file, copyToDirName, newUrlInfo.path(), value.akonadiConfigFile.contains(QLatin1String("akonadi_contacts_resource_")));
}
......@@ -201,7 +201,7 @@ void ImportAddressbookJobInterface::restoreResources()
if (!agentConfigFile.isEmpty()) {
const KArchiveEntry *akonadiAgentConfigEntry = mArchiveDirectory->entry(agentConfigFile);
if (akonadiAgentConfigEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(akonadiAgentConfigEntry);
const auto *file = static_cast<const KArchiveFile *>(akonadiAgentConfigEntry);
copyArchiveFileTo(file, copyToDirName);
resourceName = file->name();
filename = Utils::akonadiAgentName(copyToDirName + QLatin1Char('/') + resourceName);
......
......@@ -36,7 +36,7 @@ Akonadi::Collection::Id ExportAlarmJobInterfaceImpl::convertFolderPathToCollecti
void ExportAlarmJobInterfaceImpl::exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier)
{
ExportResourceArchiveJob *resourceJob = new ExportResourceArchiveJob(this);
auto *resourceJob = new ExportResourceArchiveJob(this);
resourceJob->setArchivePath(archivePath);
resourceJob->setUrl(url);
resourceJob->setIdentifier(identifier);
......
......@@ -80,7 +80,7 @@ void ImportAlarmJobInterface::restoreConfig()
const QString kalarmStr(QStringLiteral("kalarmrc"));
const KArchiveEntry *kalarmrcentry = mArchiveDirectory->entry(Utils::configsPath() + kalarmStr);
if (kalarmrcentry && kalarmrcentry->isFile()) {
const KArchiveFile *kalarmrcFile = static_cast<const KArchiveFile *>(kalarmrcentry);
const auto *kalarmrcFile = static_cast<const KArchiveFile *>(kalarmrcentry);
const QString searchExistingkalarmrc = configLocation() + kalarmStr;
const QString installPathkalarmrc = installConfigLocation() + kalarmStr;
if (QFileInfo::exists(searchExistingkalarmrc)) {
......@@ -127,7 +127,7 @@ void ImportAlarmJobInterface::restoreResources()
|| value.akonadiConfigFile.contains(QLatin1String("akonadi_kalarm_resource_"))) {
const KArchiveEntry *fileResouceEntry = mArchiveDirectory->entry(value.akonadiConfigFile);
if (fileResouceEntry && fileResouceEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(fileResouceEntry);
const auto *file = static_cast<const KArchiveFile *>(fileResouceEntry);
copyArchiveFileTo(file, copyToDirName);
QString resourceName(file->name());
......@@ -143,7 +143,7 @@ void ImportAlarmJobInterface::restoreResources()
const KArchiveEntry *dataResouceEntry = mArchiveDirectory->entry(dataFile);
bool isDirResource = value.akonadiConfigFile.contains(QLatin1String("akonadi_kalarm_dir_resource_"));
if (dataResouceEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(dataResouceEntry);
const auto *file = static_cast<const KArchiveFile *>(dataResouceEntry);
//TODO adapt directory name too
extractZipFile(file, copyToDirName, newUrlInfo.path(), isDirResource);
}
......@@ -153,7 +153,7 @@ void ImportAlarmJobInterface::restoreResources()
if (!agentConfigFile.isEmpty()) {
const KArchiveEntry *akonadiAgentConfigEntry = mArchiveDirectory->entry(agentConfigFile);
if (akonadiAgentConfigEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(akonadiAgentConfigEntry);
const auto *file = static_cast<const KArchiveFile *>(akonadiAgentConfigEntry);
copyArchiveFileTo(file, copyToDirName);
resourceName = file->name();
filename = Utils::akonadiAgentName(copyToDirName + QLatin1Char('/') + resourceName);
......
......@@ -31,7 +31,7 @@ void ExportAddressbookJobInterfaceTest::exportAddressBook()
{
QFETCH(QByteArray, configpath);
QFETCH(Utils::StoredTypes, options);
TestExportFile *file = new TestExportFile(this);
auto *file = new TestExportFile(this);
file->setPathConfig(configpath);
QVector<Utils::AkonadiInstanceInfo> lstInfo;
Utils::AkonadiInstanceInfo info;
......@@ -46,7 +46,7 @@ void ExportAddressbookJobInterfaceTest::exportAddressBook()
info.identifier = QStringLiteral("akonadi_kolab_resource_2");
lstInfo << info;
ExportAddressbookJobInterfaceTestImpl *exportNote = new ExportAddressbookJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
auto *exportNote = new ExportAddressbookJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
exportNote->setListOfResource(lstInfo);
exportNote->setPathConfig(QLatin1String(configpath));
file->setAbstractImportExportJob(exportNote);
......
......@@ -76,7 +76,7 @@ QString ExportAddressbookJobInterfaceTestImpl::resourcePath(const QString &agent
void ExportAddressbookJobInterfaceTestImpl::backupAddressBookResourceFile(const QString &agentIdentifier, const QString &defaultPath)
{
TestBackupResourceFileJob *job = new TestBackupResourceFileJob(this);
auto *job = new TestBackupResourceFileJob(this);
job->setDefaultPath(defaultPath);
job->setIdentifier(agentIdentifier);
job->setTestPath(mPathConfig);
......
......@@ -38,7 +38,7 @@ void ImportAddressbookJobInterfaceTest::importAddressbook()
file->setPathConfig(zipFilePath + testPath);
file->setExtractPath(QDir::tempPath() + testPath);
file->setExcludePath(Utils::addressbookPath());
ImportAddressbookJobInterfaceTestImpl *impl = new ImportAddressbookJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
auto *impl = new ImportAddressbookJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
impl->setPathConfig(file->pathConfig());
impl->setExtractPath(file->extractPath());
impl->setTempDirName(file->extractPath());
......
......@@ -32,10 +32,10 @@ void ExportAkregatorJobInterfaceTest::exportAkregator()
{
QFETCH(QByteArray, configpath);
QFETCH(Utils::StoredTypes, options);
TestExportFile *file = new TestExportFile(this);
auto *file = new TestExportFile(this);
file->setPathConfig(configpath);
ExportAkregatorJobInterfaceTestImpl *exportAkregator = new ExportAkregatorJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
auto *exportAkregator = new ExportAkregatorJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
file->setAbstractImportExportJob(exportAkregator);
file->start();
delete exportAkregator;
......
......@@ -36,7 +36,7 @@ void ImportAkregatorJobInterfaceTest::importAkegator()
TestImportFile *file = new TestImportFile(zipFilePath + testPath, this);
file->setPathConfig(zipFilePath + testPath);
file->setExtractPath(QDir::tempPath() + testPath);
ImportAkregatorJobInterfaceTestImpl *impl = new ImportAkregatorJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
auto *impl = new ImportAkregatorJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
file->setAbstractImportExportJob(impl);
file->start();
delete impl;
......
......@@ -32,7 +32,7 @@ void ExportAlarmJobInterfaceTest::exportAlarm()
{
QFETCH(QByteArray, configpath);
QFETCH(Utils::StoredTypes, options);
TestExportFile *file = new TestExportFile(this);
auto *file = new TestExportFile(this);
file->setPathConfig(configpath);
QVector<Utils::AkonadiInstanceInfo> lstInfo;
Utils::AkonadiInstanceInfo info;
......@@ -44,7 +44,7 @@ void ExportAlarmJobInterfaceTest::exportAlarm()
info.identifier = QStringLiteral("akonadi_kolab_resource_2");
lstInfo << info;
ExportAlarmJobInterfaceTestImpl *exportNote = new ExportAlarmJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
auto *exportNote = new ExportAlarmJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
exportNote->setListOfResource(lstInfo);
exportNote->setPathConfig(QLatin1String(configpath));
file->setAbstractImportExportJob(exportNote);
......
......@@ -49,7 +49,7 @@ QString ExportAlarmJobInterfaceTestImpl::resourcePath(const QString &identifier)
void ExportAlarmJobInterfaceTestImpl::backupAlarmResourceFile(const QString &agentIdentifier, const QString &defaultPath)
{
TestBackupResourceFileJob *job = new TestBackupResourceFileJob(this);
auto *job = new TestBackupResourceFileJob(this);
job->setDefaultPath(defaultPath);
job->setIdentifier(agentIdentifier);
job->setTestPath(mPathConfig);
......
......@@ -34,11 +34,11 @@ void ImportAlarmJobInterfaceTest::importAlarmConfig()
QFETCH(QString, testPath);
QFETCH(Utils::StoredTypes, options);
const QString fullTestPath = zipFilePath + testPath;
TestImportFile *file = new TestImportFile(fullTestPath, this);
auto *file = new TestImportFile(fullTestPath, this);
file->setPathConfig(fullTestPath);
file->setExtractPath(QDir::tempPath() + testPath);
file->setExcludePath(Utils::alarmPath());
ImportAlarmJobInterfaceTestImpl *impl = new ImportAlarmJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
auto *impl = new ImportAlarmJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
impl->setPathConfig(file->pathConfig());
impl->setExtractPath(file->extractPath());
impl->setTempDirName(file->extractPath());
......
......@@ -15,7 +15,7 @@ BackupResourceFileJobImplTest::BackupResourceFileJobImplTest(QObject *parent)
void BackupResourceFileJobImplTest::shouldHaveDefaultValue()
{
BackupResourceFileJobImpl *job = new BackupResourceFileJobImpl;
auto *job = new BackupResourceFileJobImpl;
QVERIFY(!job->canStart());
QVERIFY(job->identifier().isEmpty());
QVERIFY(!job->zip());
......
......@@ -32,7 +32,7 @@ void ExportCalendarsJobInterfaceTest::exportCalendar()
{
QFETCH(QByteArray, configpath);
QFETCH(Utils::StoredTypes, options);
TestExportFile *file = new TestExportFile(this);
auto *file = new TestExportFile(this);
file->setPathConfig(configpath);
QVector<Utils::AkonadiInstanceInfo> lstInfo;
Utils::AkonadiInstanceInfo info;
......@@ -46,7 +46,7 @@ void ExportCalendarsJobInterfaceTest::exportCalendar()
info.identifier = QStringLiteral("akonadi_kontact_resource_2");
lstInfo << info;
ExportCalendarsJobInterfaceTestImpl *exportNote = new ExportCalendarsJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
auto *exportNote = new ExportCalendarsJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
exportNote->setListOfResource(lstInfo);
exportNote->setPathConfig(QLatin1String(configpath));
file->setAbstractImportExportJob(exportNote);
......
......@@ -65,7 +65,7 @@ QString ExportCalendarsJobInterfaceTestImpl::resourcePath(const QString &identif
void ExportCalendarsJobInterfaceTestImpl::backupCalendarResourceFile(const QString &agentIdentifier, const QString &defaultPath)
{
TestBackupResourceFileJob *job = new TestBackupResourceFileJob(this);
auto *job = new TestBackupResourceFileJob(this);
job->setDefaultPath(defaultPath);
job->setIdentifier(agentIdentifier);
job->setTestPath(mPathConfig);
......
......@@ -36,11 +36,11 @@ void ImportCalendarJobInterfaceTest::importCalendar()
QFETCH(Utils::StoredTypes, options);
const QString fullTestPath = zipFilePath + testPath;
TestImportFile *file = new TestImportFile(fullTestPath, this);
auto *file = new TestImportFile(fullTestPath, this);
file->setPathConfig(fullTestPath);
file->setExtractPath(QDir::tempPath() + testPath);
file->setExcludePath(Utils::calendarPath());
ImportCalendarJobInterfaceTestImpl *impl = new ImportCalendarJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
auto *impl = new ImportCalendarJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
impl->setPathConfig(file->pathConfig());
impl->setExtractPath(file->extractPath());
impl->setTempDirName(file->extractPath());
......
......@@ -58,7 +58,7 @@ void CompareExportFile::compareFiles()
mTempDir->setAutoRemove(false);
#endif
}
const KArchiveFile *currentFile = static_cast<const KArchiveFile *>(currentEntry);
const auto *currentFile = static_cast<const KArchiveFile *>(currentEntry);
QString adaptFile = file;
//We store in zip as configs, but we extract in config/
......
......@@ -62,18 +62,18 @@ bool GenerateListFileFromArchive::searchArchiveElement(const QString &path, cons
void GenerateListFileFromArchive::addSubItems(const QString &topLevelPath, const KArchiveEntry *entry, int indent, const QString &fullpath)
{
const KArchiveDirectory *dir = static_cast<const KArchiveDirectory *>(entry);
const auto *dir = static_cast<const KArchiveDirectory *>(entry);
const QString space = QString(indent * 2, QLatin1Char(' '));
const QStringList lst = dir->entries();
for (const QString &entryName : lst) {
const KArchiveEntry *entry = dir->entry(entryName);
if (entry) {
if (entry->isDirectory()) {
const KArchiveDirectory *dirEntry = static_cast<const KArchiveDirectory *>(entry);
const auto *dirEntry = static_cast<const KArchiveDirectory *>(entry);
//mListFile += space + dirEntry->name();
addSubItems(topLevelPath, entry, indent, (fullpath.isEmpty() ? QString() : fullpath + QLatin1Char('/')) + dirEntry->name());
} else if (entry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(entry);
const auto *file = static_cast<const KArchiveFile *>(entry);
const QString fileFullPath = topLevelPath + (fullpath.isEmpty() ? QString() : fullpath + QLatin1Char('/')) + file->name();
mListFile += space + fileFullPath;
}
......
......@@ -43,7 +43,7 @@ void ExportMailJobInterfaceTest::exportMail()
{
QFETCH(QByteArray, configpath);
QFETCH(Utils::StoredTypes, options);
TestExportFile *file = new TestExportFile(this);
auto *file = new TestExportFile(this);
file->setPathConfig(configpath);
QVector<Utils::AkonadiInstanceInfo> lstInfo;
Utils::AkonadiInstanceInfo info;
......@@ -83,7 +83,7 @@ void ExportMailJobInterfaceTest::exportMail()
info.identifier = QStringLiteral("akonadi_kalarm_dir_resource_2");
lstInfo << info;
ExportMailJobInterfaceTestImpl *exportMail = new ExportMailJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
auto *exportMail = new ExportMailJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
exportMail->setListOfResource(lstInfo);
exportMail->setPathConfig(QLatin1String(configpath));
file->setAbstractImportExportJob(exportMail);
......
......@@ -92,7 +92,7 @@ QString ExportMailJobInterfaceTestImpl::resourcePath(const QString &identifier)
void ExportMailJobInterfaceTestImpl::backupMailResourceFile(const QString &agentIdentifier, const QString &defaultPath)
{
TestBackupResourceFileJob *job = new TestBackupResourceFileJob(this);
auto *job = new TestBackupResourceFileJob(this);
job->setDefaultPath(defaultPath);
job->setIdentifier(agentIdentifier);
job->setTestPath(mPathConfig);
......
......@@ -46,11 +46,11 @@ void ImportMailJobInterfaceTest::importMail()
QFETCH(QString, testPath);
QFETCH(Utils::StoredTypes, options);
const QString fullTestPath = zipFilePath + testPath;
TestImportFile *file = new TestImportFile(fullTestPath, this);
auto *file = new TestImportFile(fullTestPath, this);
file->setPathConfig(fullTestPath);
file->setExtractPath(QDir::tempPath() + QLatin1Char('/') + testPath);
file->setExcludePath(Utils::mailsPath()); // ???
ImportMailJobInterfaceTestImpl *impl = new ImportMailJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
auto *impl = new ImportMailJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
impl->setPathConfig(file->pathConfig());
impl->setExtractPath(file->extractPath());
impl->setTempDirName(file->extractPath());
......
......@@ -33,7 +33,7 @@ void ExportNotesJobInterfaceTest::exportNote()
{
QFETCH(QByteArray, configpath);
QFETCH(Utils::StoredTypes, options);
TestExportFile *file = new TestExportFile(this);
auto *file = new TestExportFile(this);
file->setPathConfig(configpath);
QVector<Utils::AkonadiInstanceInfo> lstInfo;
Utils::AkonadiInstanceInfo info;
......@@ -45,7 +45,7 @@ void ExportNotesJobInterfaceTest::exportNote()
info.identifier = QStringLiteral("akonadi_kontact_resource_2");
lstInfo << info;
ExportNotesJobInterfaceTestImpl *exportNote = new ExportNotesJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
auto *exportNote = new ExportNotesJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
exportNote->setListOfResource(lstInfo);
exportNote->setPathConfig(QLatin1String(configpath));
file->setAbstractImportExportJob(exportNote);
......
......@@ -38,7 +38,7 @@ void ImportNotesJobInterfaceTest::importNote()
file->setPathConfig(fullTestPath);
file->setExtractPath(QDir::tempPath() + testPath);
file->setExcludePath(Utils::notePath());
ImportNotesJobInterfaceTestImpl *impl = new ImportNotesJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
auto *impl = new ImportNotesJobInterfaceTestImpl(this, options, file->archiveStorage(), 1);
impl->setPathConfig(file->pathConfig());
impl->setExistingPathConfig(fullTestPath + QStringLiteral("/existingconfig/"));
file->setAbstractImportExportJob(impl);
......
......@@ -42,7 +42,7 @@ void BackupResourceFileJobBase::start()
if (fileAdded) {
Q_EMIT info(i18n("\"%1\" was backed up.", filename));
StoreResourceJob *job = new StoreResourceJob(this);
auto *job = new StoreResourceJob(this);
connect(job, &StoreResourceJob::error, this, &BackupResourceFileJobBase::error);
connect(job, &StoreResourceJob::info, this, &BackupResourceFileJobBase::info);
job->setArchivePath(archivePath);
......
......@@ -48,7 +48,7 @@ QString ExportCalendarJobInterfaceImpl::convertToFullCollectionPath(const qlongl
void ExportCalendarJobInterfaceImpl::exportResourceToArchive(const QString &archivePath, const QString &url, const QString &identifier)
{
ExportResourceArchiveJob *resourceJob = new ExportResourceArchiveJob(this);
auto *resourceJob = new ExportResourceArchiveJob(this);
resourceJob->setArchivePath(archivePath);
resourceJob->setUrl(url);
resourceJob->setIdentifier(identifier);
......
......@@ -90,7 +90,7 @@ void ImportCalendarJobInterface::restoreConfig()
const QString oldKorganizerPrintrrcStr(QStringLiteral("korganizer_printing.rc"));
const KArchiveEntry *oldKorganizerPrinterEntry = mArchiveDirectory->entry(Utils::configsPath() + oldKorganizerPrintrrcStr);
if (oldKorganizerPrinterEntry && oldKorganizerPrinterEntry->isFile()) {
const KArchiveFile *korganizerFile = static_cast<const KArchiveFile *>(oldKorganizerPrinterEntry);
const auto *korganizerFile = static_cast<const KArchiveFile *>(oldKorganizerPrinterEntry);
const QString oldKorganizerPrintrrc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + korganizerPrinterrcStr;
if (QFileInfo::exists(oldKorganizerPrintrrc)) {
if (overwriteConfigMessageBox(oldKorganizerPrintrrc)) {
......@@ -102,7 +102,7 @@ void ImportCalendarJobInterface::restoreConfig()
} else {
const KArchiveEntry *korganizerPrinterEntry = mArchiveDirectory->entry(Utils::configsPath() + korganizerPrinterrcStr);
if (korganizerPrinterEntry && korganizerPrinterEntry->isFile()) {
const KArchiveFile *korganizerFile = static_cast<const KArchiveFile *>(korganizerPrinterEntry);
const auto *korganizerFile = static_cast<const KArchiveFile *>(korganizerPrinterEntry);
const QString korganizerPrinterrc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + korganizerPrinterrcStr;
if (QFileInfo::exists(korganizerPrinterrc)) {
if (overwriteConfigMessageBox(korganizerPrinterrcStr)) {
......@@ -117,7 +117,7 @@ void ImportCalendarJobInterface::restoreConfig()
const QString korganizerStr(QStringLiteral("korganizerrc"));
const KArchiveEntry *korganizerrcentry = mArchiveDirectory->entry(Utils::configsPath() + korganizerStr);
if (korganizerrcentry && korganizerrcentry->isFile()) {
const KArchiveFile *korganizerrcFile = static_cast<const KArchiveFile *>(korganizerrcentry);
const auto *korganizerrcFile = static_cast<const KArchiveFile *>(korganizerrcentry);
const QString korganizerrc = QStandardPaths::writableLocation(