Commit 6ee416c0 authored by Laurent Montel's avatar Laurent Montel 😁

Use QLatin1String

parent 54c83bcb
......@@ -90,7 +90,7 @@ void ExportAddressbookJob::slotWriteNextArchiveResource()
if (mIndexIdentifier < list.count()) {
Akonadi::AgentInstance agent = list.at(mIndexIdentifier);
const QString identifier = agent.identifier();
if (identifier.contains(QStringLiteral("akonadi_vcarddir_resource_")) || identifier.contains(QStringLiteral("akonadi_contacts_resource_"))) {
if (identifier.contains(QLatin1String("akonadi_vcarddir_resource_")) || identifier.contains(QLatin1String("akonadi_contacts_resource_"))) {
const QString archivePath = Utils::addressbookPath() + identifier + QDir::separator();
QString url = Utils::resourcePath(agent, QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/share/contacts/"));
......@@ -114,7 +114,7 @@ void ExportAddressbookJob::slotWriteNextArchiveResource()
} else {
QTimer::singleShot(0, this, &ExportAddressbookJob::slotAddressbookJobTerminated);
}
} else if (identifier.contains(QStringLiteral("akonadi_vcard_resource_"))) {
} else if (identifier.contains(QLatin1String("akonadi_vcard_resource_"))) {
backupResourceFile(agent, Utils::addressbookPath());
QTimer::singleShot(0, this, &ExportAddressbookJob::slotAddressbookJobTerminated);
} else {
......
......@@ -93,8 +93,8 @@ void ImportAddressbookJob::restoreResources()
for (int i = 0; i < numberOfResourceFile; ++i) {
resourceFiles value = mListResourceFile.at(i);
QMap<QString, QVariant> settings;
if (value.akonadiConfigFile.contains(QStringLiteral("akonadi_vcarddir_resource_"))
|| value.akonadiConfigFile.contains(QStringLiteral("akonadi_contacts_resource_"))) {
if (value.akonadiConfigFile.contains(QLatin1String("akonadi_vcarddir_resource_"))
|| 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);
......@@ -113,7 +113,7 @@ void ImportAddressbookJob::restoreResources()
if (dataResouceEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(dataResouceEntry);
//TODO adapt directory name too
extractZipFile(file, copyToDirName, newUrlInfo.path(), value.akonadiConfigFile.contains(QStringLiteral("akonadi_contacts_resource_")));
extractZipFile(file, copyToDirName, newUrlInfo.path(), value.akonadiConfigFile.contains(QLatin1String("akonadi_contacts_resource_")));
}
settings.insert(QStringLiteral("Path"), newUrl);
......@@ -128,9 +128,9 @@ void ImportAddressbookJob::restoreResources()
}
}
QString instanceType;
if (value.akonadiConfigFile.contains(QStringLiteral("akonadi_vcarddir_resource_"))) {
if (value.akonadiConfigFile.contains(QLatin1String("akonadi_vcarddir_resource_"))) {
instanceType = QStringLiteral("akonadi_vcarddir_resource");
} else if (value.akonadiConfigFile.contains(QStringLiteral("akonadi_contacts_resource_"))) {
} else if (value.akonadiConfigFile.contains(QLatin1String("akonadi_contacts_resource_"))) {
instanceType = QStringLiteral("akonadi_contacts_resource");
} else {
qCDebug(PIMSETTINGEXPORTERCORE_LOG) << " not supported" << value.akonadiConfigFile;
......@@ -168,9 +168,9 @@ void ImportAddressbookJob::addSpecificResourceSettings(KSharedConfig::Ptr resour
bool ImportAddressbookJob::isAConfigFile(const QString &name) const
{
return name.endsWith(QLatin1String("rc")) && (name.contains(QStringLiteral("akonadi_vcarddir_resource_"))
|| name.contains(QStringLiteral("akonadi_vcard_resource_"))
|| name.contains(QStringLiteral("akonadi_contacts_resource_")));
return name.endsWith(QLatin1String("rc")) && (name.contains(QLatin1String("akonadi_vcarddir_resource_"))
|| name.contains(QLatin1String("akonadi_vcard_resource_"))
|| name.contains(QLatin1String("akonadi_contacts_resource_")));
}
void ImportAddressbookJob::restoreConfig()
......
......@@ -91,7 +91,7 @@ void ExportAlarmJob::slotWriteNextArchiveResource()
if (mIndexIdentifier < list.count()) {
Akonadi::AgentInstance agent = list.at(mIndexIdentifier);
const QString identifier = agent.identifier();
if (identifier.contains(QStringLiteral("akonadi_kalarm_dir_resource_"))) {
if (identifier.contains(QLatin1String("akonadi_kalarm_dir_resource_"))) {
const QString archivePath = Utils::alarmPath() + identifier + QDir::separator();
QString url = Utils::resourcePath(agent);
......@@ -115,7 +115,7 @@ void ExportAlarmJob::slotWriteNextArchiveResource()
} else {
QTimer::singleShot(0, this, &ExportAlarmJob::slotAlarmJobTerminated);
}
} else if (identifier.contains(QStringLiteral("akonadi_kalarm_resource_"))) {
} else if (identifier.contains(QLatin1String("akonadi_kalarm_resource_"))) {
backupResourceFile(agent, Utils::alarmPath());
QTimer::singleShot(0, this, &ExportAlarmJob::slotAlarmJobTerminated);
} else {
......
......@@ -94,8 +94,8 @@ void ImportAlarmJob::restoreResources()
for (int i = 0; i < numberOfResourceFile; ++i) {
resourceFiles value = mListResourceFile.at(i);
QMap<QString, QVariant> settings;
if (value.akonadiConfigFile.contains(QStringLiteral("akonadi_kalarm_dir_resource_"))
|| value.akonadiConfigFile.contains(QStringLiteral("akonadi_kalarm_resource_"))) {
if (value.akonadiConfigFile.contains(QLatin1String("akonadi_kalarm_dir_resource_"))
|| 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);
......@@ -112,7 +112,7 @@ void ImportAlarmJob::restoreResources()
QFileInfo newUrlInfo(newUrl);
const QString dataFile = value.akonadiResources;
const KArchiveEntry *dataResouceEntry = mArchiveDirectory->entry(dataFile);
bool isDirResource = value.akonadiConfigFile.contains(QStringLiteral("akonadi_kalarm_dir_resource_"));
bool isDirResource = value.akonadiConfigFile.contains(QLatin1String("akonadi_kalarm_dir_resource_"));
if (dataResouceEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(dataResouceEntry);
//TODO adapt directory name too
......@@ -145,8 +145,8 @@ void ImportAlarmJob::restoreResources()
bool ImportAlarmJob::isAConfigFile(const QString &name) const
{
return name.endsWith(QLatin1String("rc")) && (name.contains(QStringLiteral("akonadi_kalarm_resource_"))
|| name.contains(QStringLiteral("akonadi_kalarm_dir_resource_")));
return name.endsWith(QLatin1String("rc")) && (name.contains(QLatin1String("akonadi_kalarm_resource_"))
|| name.contains(QLatin1String("akonadi_kalarm_dir_resource_")));
}
void ImportAlarmJob::restoreConfig()
......
......@@ -92,7 +92,7 @@ void ExportCalendarJob::slotWriteNextArchiveResource()
if (mIndexIdentifier < list.count()) {
Akonadi::AgentInstance agent = list.at(mIndexIdentifier);
const QString identifier = agent.identifier();
if (identifier.contains(QStringLiteral("akonadi_icaldir_resource_"))) {
if (identifier.contains(QLatin1String("akonadi_icaldir_resource_"))) {
const QString archivePath = Utils::calendarPath() + identifier + QDir::separator();
QString url = Utils::resourcePath(agent);
......@@ -116,7 +116,7 @@ void ExportCalendarJob::slotWriteNextArchiveResource()
} else {
QTimer::singleShot(0, this, &ExportCalendarJob::slotCalendarJobTerminated);
}
} else if (identifier.contains(QStringLiteral("akonadi_ical_resource_"))) {
} else if (identifier.contains(QLatin1String("akonadi_ical_resource_"))) {
backupResourceFile(agent, Utils::calendarPath());
QTimer::singleShot(0, this, &ExportCalendarJob::slotCalendarJobTerminated);
} else {
......
......@@ -98,8 +98,8 @@ void ImportCalendarJob::restoreResources()
for (int i = 0; i < numberOfResourceFile; ++i) {
resourceFiles value = mListResourceFile.at(i);
QMap<QString, QVariant> settings;
if (value.akonadiConfigFile.contains(QStringLiteral("akonadi_icaldir_resource_"))
|| value.akonadiConfigFile.contains(QStringLiteral("akonadi_ical_resource_"))) {
if (value.akonadiConfigFile.contains(QLatin1String("akonadi_icaldir_resource_"))
|| value.akonadiConfigFile.contains(QLatin1String("akonadi_ical_resource_"))) {
const KArchiveEntry *fileResouceEntry = mArchiveDirectory->entry(value.akonadiConfigFile);
if (fileResouceEntry && fileResouceEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(fileResouceEntry);
......@@ -119,11 +119,11 @@ void ImportCalendarJob::restoreResources()
const QString dataFile = value.akonadiResources;
const KArchiveEntry *dataResouceEntry = mArchiveDirectory->entry(dataFile);
bool isDirResource = value.akonadiConfigFile.contains(QStringLiteral("akonadi_icaldir_resource_"));
bool isDirResource = value.akonadiConfigFile.contains(QLatin1String("akonadi_icaldir_resource_"));
if (dataResouceEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(dataResouceEntry);
//TODO adapt directory name too
extractZipFile(file, copyToDirName, newUrlInfo.path(), value.akonadiConfigFile.contains(QStringLiteral("akonadi_icaldir_resource_")));
extractZipFile(file, copyToDirName, newUrlInfo.path(), value.akonadiConfigFile.contains(QLatin1String("akonadi_icaldir_resource_")));
}
settings.insert(QStringLiteral("Path"), newUrl);
......@@ -168,8 +168,8 @@ void ImportCalendarJob::addSpecificResourceSettings(KSharedConfig::Ptr resourceC
bool ImportCalendarJob::isAConfigFile(const QString &name) const
{
return name.endsWith(QLatin1String("rc")) && (name.contains(QStringLiteral("akonadi_ical_resource_"))
|| name.contains(QStringLiteral("akonadi_icaldir_resource_")));
return name.endsWith(QLatin1String("rc")) && (name.contains(QLatin1String("akonadi_ical_resource_"))
|| name.contains(QLatin1String("akonadi_icaldir_resource_")));
}
void ImportCalendarJob::restoreConfig()
......
......@@ -146,12 +146,12 @@ void ExportMailJob::slotWriteNextArchiveResource()
const Akonadi::AgentInstance agent = list.at(mIndexIdentifier);
const QStringList capabilities(agent.type().capabilities());
if (agent.type().mimeTypes().contains(KMime::Message::mimeType())) {
if (capabilities.contains(QStringLiteral("Resource"))
&& !capabilities.contains(QStringLiteral("Virtual"))
&& !capabilities.contains(QStringLiteral("MailTransport"))) {
if (capabilities.contains(QLatin1String("Resource"))
&& !capabilities.contains(QLatin1String("Virtual"))
&& !capabilities.contains(QLatin1String("MailTransport"))) {
const QString identifier = agent.identifier();
if (identifier.contains(QStringLiteral("akonadi_maildir_resource_"))
|| identifier.contains(QStringLiteral("akonadi_mixedmaildir_resource_"))) {
if (identifier.contains(QLatin1String("akonadi_maildir_resource_"))
|| identifier.contains(QLatin1String("akonadi_mixedmaildir_resource_"))) {
const QString archivePath = Utils::mailsPath() + identifier + QDir::separator();
const QString url = Utils::resourcePath(agent);
......@@ -176,7 +176,7 @@ void ExportMailJob::slotWriteNextArchiveResource()
} else {
QTimer::singleShot(0, this, &ExportMailJob::slotMailsJobTerminated);
}
} else if (identifier.contains(QStringLiteral("akonadi_mbox_resource_"))) {
} else if (identifier.contains(QLatin1String("akonadi_mbox_resource_"))) {
backupResourceFile(agent, Utils::addressbookPath());
QTimer::singleShot(0, this, &ExportMailJob::slotMailsJobTerminated);
} else {
......@@ -241,13 +241,13 @@ void ExportMailJob::backupResources()
for (const Akonadi::AgentInstance &agent : list) {
const QStringList capabilities(agent.type().capabilities());
if (agent.type().mimeTypes().contains(KMime::Message::mimeType())) {
if (capabilities.contains(QStringLiteral("Resource"))
&& !capabilities.contains(QStringLiteral("Virtual"))
&& !capabilities.contains(QStringLiteral("MailTransport"))) {
if (capabilities.contains(QLatin1String("Resource"))
&& !capabilities.contains(QLatin1String("Virtual"))
&& !capabilities.contains(QLatin1String("MailTransport"))) {
const QString identifier = agent.identifier();
//Store just pop3/imap/kolab/gmail account. Store other config when we copy data.
if (identifier.contains(QStringLiteral("pop3")) || identifier.contains(QStringLiteral("imap"))
|| identifier.contains(QStringLiteral("_kolab_")) || identifier.contains(QStringLiteral("_gmail_"))) {
if (identifier.contains(QLatin1String("pop3")) || identifier.contains(QLatin1String("imap"))
|| identifier.contains(QLatin1String("_kolab_")) || identifier.contains(QLatin1String("_gmail_"))) {
const QString errorStr = Utils::storeResources(archive(), identifier, Utils::resourcesPath());
if (!errorStr.isEmpty()) {
Q_EMIT error(errorStr);
......
......@@ -138,9 +138,9 @@ void ImportMailJob::storeMailArchiveResource(const KArchiveDirectory *dir, const
resourceFiles files;
for (const QString &name : lst) {
if (name.endsWith(QLatin1String("rc"))
&& (name.contains(QStringLiteral("akonadi_mbox_resource_"))
|| name.contains(QStringLiteral("akonadi_mixedmaildir_resource_"))
|| name.contains(QStringLiteral("akonadi_maildir_resource_")))) {
&& (name.contains(QLatin1String("akonadi_mbox_resource_"))
|| name.contains(QLatin1String("akonadi_mixedmaildir_resource_"))
|| name.contains(QLatin1String("akonadi_maildir_resource_")))) {
files.akonadiConfigFile = archPath + name;
} else if (name.startsWith(Utils::prefixAkonadiConfigFile())) {
files.akonadiAgentConfigFile = archPath + name;
......@@ -273,7 +273,7 @@ void ImportMailJob::restoreResources()
const QString resourceFileName = destDirectory + QLatin1Char('/') + filename;
KSharedConfig::Ptr resourceConfig = KSharedConfig::openConfig(resourceFileName);
QMap<QString, QVariant> settings;
if (filename.contains(QStringLiteral("pop3"))) {
if (filename.contains(QLatin1String("pop3"))) {
KConfigGroup general = resourceConfig->group(QStringLiteral("General"));
if (general.hasKey(QStringLiteral("login"))) {
settings.insert(QStringLiteral("Login"), general.readEntry("login"));
......@@ -349,7 +349,7 @@ void ImportMailJob::restoreResources()
mHashResources.insert(filename, newResource);
infoAboutNewResource(newResource);
}
} else if (filename.contains(QStringLiteral("imap")) || filename.contains(QStringLiteral("kolab_")) || filename.contains(QStringLiteral("gmail_"))) {
} else if (filename.contains(QLatin1String("imap")) || filename.contains(QLatin1String("kolab_")) || filename.contains(QLatin1String("gmail_"))) {
KConfigGroup network = resourceConfig->group(QStringLiteral("network"));
if (network.hasKey(QStringLiteral("Authentication"))) {
settings.insert(QStringLiteral("Authentication"), network.readEntry("Authentication", 1));
......@@ -440,9 +440,9 @@ void ImportMailJob::restoreResources()
}
QString newResource;
if (filename.contains(QStringLiteral("kolab_"))) {
if (filename.contains(QLatin1String("kolab_"))) {
newResource = mCreateResource->createResource(QStringLiteral("akonadi_kolab_resource"), filename, settings);
} else if (filename.contains(QStringLiteral("gmail_"))) {
} else if (filename.contains(QLatin1String("gmail_"))) {
newResource = mCreateResource->createResource(QStringLiteral("akonadi_gmail_resource"), filename, settings);
} else {
newResource = mCreateResource->createResource(QStringLiteral("akonadi_imap_resource"), filename, settings);
......@@ -501,7 +501,7 @@ void ImportMailJob::restoreMails()
}
QMap<QString, QVariant> settings;
if (resourceName.contains(QStringLiteral("akonadi_mbox_resource_"))) {
if (resourceName.contains(QLatin1String("akonadi_mbox_resource_"))) {
const QString dataFile = value.akonadiResources;
const KArchiveEntry *dataResouceEntry = mArchiveDirectory->entry(dataFile);
if (dataResouceEntry->isFile()) {
......@@ -544,8 +544,8 @@ void ImportMailJob::restoreMails()
mHashResources.insert(filename, newResource);
infoAboutNewResource(newResource);
}
} else if (resourceName.contains(QStringLiteral("akonadi_maildir_resource_"))
|| resourceName.contains(QStringLiteral("akonadi_mixedmaildir_resource_"))) {
} else if (resourceName.contains(QLatin1String("akonadi_maildir_resource_"))
|| resourceName.contains(QLatin1String("akonadi_mixedmaildir_resource_"))) {
settings.insert(QStringLiteral("Path"), newUrl);
KConfigGroup general = resourceConfig->group(QStringLiteral("General"));
if (general.hasKey(QStringLiteral("TopLevelIsContainer"))) {
......@@ -558,7 +558,7 @@ void ImportMailJob::restoreMails()
settings.insert(QStringLiteral("MonitorFilesystem"), general.readEntry(QStringLiteral("MonitorFilesystem"), true));
}
const QString newResource = mCreateResource->createResource(resourceName.contains(QStringLiteral("akonadi_mixedmaildir_resource_"))
const QString newResource = mCreateResource->createResource(resourceName.contains(QLatin1String("akonadi_mixedmaildir_resource_"))
? QStringLiteral("akonadi_mixedmaildir_resource")
: QStringLiteral("akonadi_maildir_resource"),
filename, settings);
......
......@@ -104,7 +104,7 @@ void ExportNotesJob::slotWriteNextArchiveResource()
if (mIndexIdentifier < list.count()) {
Akonadi::AgentInstance agent = list.at(mIndexIdentifier);
const QString identifier = agent.identifier();
if (identifier.contains(QStringLiteral("akonadi_akonotes_resource_"))) {
if (identifier.contains(QLatin1String("akonadi_akonotes_resource_"))) {
const QString archivePath = Utils::notePath() + identifier + QDir::separator();
QString url = Utils::resourcePath(agent);
......
......@@ -146,7 +146,7 @@ void ImportNotesJob::restoreResources()
for (int i = 0; i < numberOfResourceFile; ++i) {
resourceFiles value = mListResourceFile.at(i);
QMap<QString, QVariant> settings;
if (value.akonadiConfigFile.contains(QStringLiteral("akonadi_akonotes_resource_"))) {
if (value.akonadiConfigFile.contains(QLatin1String("akonadi_akonotes_resource_"))) {
const KArchiveEntry *fileResouceEntry = mArchiveDirectory->entry(value.akonadiConfigFile);
if (fileResouceEntry && fileResouceEntry->isFile()) {
const KArchiveFile *file = static_cast<const KArchiveFile *>(fileResouceEntry);
......
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