Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 462ffb86 authored by Laurent Montel's avatar Laurent Montel 😁

Use QLatin1String here

parent f46ef476
......@@ -54,27 +54,27 @@ void OperaAddressBook::importAddressBook()
if (!contact) {
contact = new KContacts::Addressee;
}
if (line.startsWith(QStringLiteral("ID"))) {
if (line.startsWith(QLatin1String("ID"))) {
//Nothing
} else if (line.startsWith(QStringLiteral("NAME"))) {
} else if (line.startsWith(QLatin1String("NAME"))) {
contact->setName(line.remove(QStringLiteral("NAME=")));
} else if (line.startsWith(QStringLiteral("URL"))) {
} else if (line.startsWith(QLatin1String("URL"))) {
KContacts::ResourceLocatorUrl url;
url.setUrl(QUrl(line.remove(QStringLiteral("URL="))));
contact->setUrl(url);
} else if (line.startsWith(QStringLiteral("DESCRIPTION"))) {
} else if (line.startsWith(QLatin1String("DESCRIPTION"))) {
contact->setNote(line.remove(QStringLiteral("DESCRIPTION=")));
} else if (line.startsWith(QStringLiteral("PHONE"))) {
} else if (line.startsWith(QLatin1String("PHONE"))) {
contact->insertPhoneNumber(KContacts::PhoneNumber(line.remove(QStringLiteral("PHONE=")), KContacts::PhoneNumber::Home));
} else if (line.startsWith(QStringLiteral("FAX"))) {
} else if (line.startsWith(QLatin1String("FAX"))) {
contact->insertPhoneNumber(KContacts::PhoneNumber(line.remove(QStringLiteral("FAX=")), KContacts::PhoneNumber::Fax));
} else if (line.startsWith(QStringLiteral("POSTALADDRESS"))) {
} else if (line.startsWith(QLatin1String("POSTALADDRESS"))) {
//TODO
} else if (line.startsWith(QStringLiteral("PICTUREURL"))) {
} else if (line.startsWith(QLatin1String("PICTUREURL"))) {
//TODO
} else if (line.startsWith(QStringLiteral("ICON"))) {
} else if (line.startsWith(QLatin1String("ICON"))) {
//TODO
} else if (line.startsWith(QStringLiteral("SHORT NAME"))) {
} else if (line.startsWith(QLatin1String("SHORT NAME"))) {
contact->setNickName(line.remove(QStringLiteral("SHORT NAME=")));
}
}
......
......@@ -225,7 +225,7 @@ void CSVImportExportPluginInterface::exportCSV()
bool CSVImportExportPluginInterface::canImportFileType(const QUrl &url)
{
return url.path().endsWith(QStringLiteral(".csv"));
return url.path().endsWith(QLatin1String(".csv"));
}
void CSVImportExportPluginInterface::importFile(const QUrl &url)
......
......@@ -468,8 +468,8 @@ void GMXImportExportPluginInterface::importGMX()
QString line, line2;
line = gmxStream.readLine();
line2 = gmxStream.readLine();
if (!line.startsWith(QStringLiteral("AB_ADDRESSES:"))
|| !line2.startsWith(QStringLiteral("Address_id"))) {
if (!line.startsWith(QLatin1String("AB_ADDRESSES:"))
|| !line2.startsWith(QLatin1String("Address_id"))) {
KMessageBox::error(
parentWidget(),
i18n("%1 is not a GMX address book file.", fileName));
......@@ -519,7 +519,7 @@ void GMXImportExportPluginInterface::importGMX()
// now read the address records
line = gmxStream.readLine();
if (!line.startsWith(QStringLiteral("AB_ADDRESS_RECORDS:"))) {
if (!line.startsWith(QLatin1String("AB_ADDRESS_RECORDS:"))) {
qCWarning(KADDRESSBOOK_IMPORTEXPORT_GMX_LOG) << "Could not find address records!";
return;
}
......@@ -529,7 +529,7 @@ void GMXImportExportPluginInterface::importGMX()
line = gmxStream.readLine();
line = gmxStream.readLine();
while (!line.startsWith(QStringLiteral("####")) && !gmxStream.atEnd()) {
while (!line.startsWith(QLatin1String("####")) && !gmxStream.atEnd()) {
// an address entry may spread over several lines in the file
while (1) {
itemList = line.split(QLatin1Char('#'), QString::KeepEmptyParts);
......@@ -619,11 +619,11 @@ void GMXImportExportPluginInterface::importGMX()
QStringList usedCategoryList;
line = gmxStream.readLine();
line2 = gmxStream.readLine();
if (!line.startsWith(QStringLiteral("AB_CATEGORIES:"))
|| !line2.startsWith(QStringLiteral("Category_id"))) {
if (!line.startsWith(QLatin1String("AB_CATEGORIES:"))
|| !line2.startsWith(QLatin1String("Category_id"))) {
qCWarning(KADDRESSBOOK_IMPORTEXPORT_GMX_LOG) << "Could not find category records!";
} else {
while (!line.startsWith(QStringLiteral("####"))
while (!line.startsWith(QLatin1String("####"))
&& !gmxStream.atEnd()) {
// a category should not spread over multiple lines, but just in case
while (1) {
......@@ -672,5 +672,5 @@ void GMXImportExportPluginInterface::importGMX()
bool GMXImportExportPluginInterface::canImportFileType(const QUrl &url)
{
return url.path().endsWith(QStringLiteral(".gmx"));
return url.path().endsWith(QLatin1String(".gmx"));
}
......@@ -210,7 +210,7 @@ void LDifImportExportPluginInterface::exportLdif()
bool LDifImportExportPluginInterface::canImportFileType(const QUrl &url)
{
return url.path().endsWith(QStringLiteral(".ldif"));
return url.path().endsWith(QLatin1String(".ldif"));
}
void LDifImportExportPluginInterface::importFile(const QUrl &url)
......
......@@ -515,7 +515,7 @@ void VCardImportExportPluginInterface::exportVCard()
bool VCardImportExportPluginInterface::canImportFileType(const QUrl &url)
{
return url.path().endsWith(QStringLiteral(".vcf"));
return url.path().endsWith(QLatin1String(".vcf"));
}
QString VCardImportExportPluginInterface::contactFileName(const KContacts::Addressee &contact) const
......
......@@ -46,10 +46,10 @@ void ShortUrlEngineInterface::slotErrorFound(QNetworkReply::NetworkError error)
void ShortUrlEngineInterface::setShortUrl(const QString &url)
{
mErrorFound = false;
if (!url.trimmed().startsWith(QStringLiteral("http://"))
&& !url.trimmed().startsWith(QStringLiteral("https://"))
&& !url.trimmed().startsWith(QStringLiteral("ftp://"))
&& !url.trimmed().startsWith(QStringLiteral("ftps://"))) {
if (!url.trimmed().startsWith(QLatin1String("http://"))
&& !url.trimmed().startsWith(QLatin1String("https://"))
&& !url.trimmed().startsWith(QLatin1String("ftp://"))
&& !url.trimmed().startsWith(QLatin1String("ftps://"))) {
mOriginalUrl = QStringLiteral("http://") + url;
} else {
mOriginalUrl = url;
......
......@@ -123,7 +123,7 @@ void POTDElement::step1Result(KJob *job)
= QString::fromUtf8(transferJob->data().data(), transferJob->data().size()).split(QLatin1Char('\n'));
for (const QString &line : lines) {
if (line.startsWith(QStringLiteral("|image="))) {
if (line.startsWith(QLatin1String("|image="))) {
mFileName = line;
break;
}
......@@ -131,7 +131,7 @@ void POTDElement::step1Result(KJob *job)
mFileName = mFileName.remove(QStringLiteral("|image=")).replace(QLatin1Char(' '), QLatin1Char('_'));
for (const QString &line : lines) {
if (line.startsWith(QStringLiteral("|texttitle="))) {
if (line.startsWith(QLatin1String("|texttitle="))) {
mDescription = line;
break;
}
......
......@@ -842,7 +842,7 @@ public:
} else {
queryStr = i18n("Do you really want to cancel this invitation?");
}
} else if (path.startsWith(QStringLiteral("ATTACH:"))) {
} else if (path.startsWith(QLatin1String("ATTACH:"))) {
return false;
} else {
queryStr = i18n("%1?", path);
......@@ -1372,7 +1372,7 @@ public:
result = true;
}
if (path.startsWith(QStringLiteral("ATTACH:"))) {
if (path.startsWith(QLatin1String("ATTACH:"))) {
const QString name = QString::fromUtf8(QByteArray::fromBase64(path.mid(7).toUtf8()));
result = openAttachment(name, iCal);
}
......@@ -1392,7 +1392,7 @@ public:
bool handleContextMenuRequest(MimeTreeParser::Interface::BodyPart *part, const QString &path, const QPoint &point) const override
{
QString name = path;
if (path.startsWith(QStringLiteral("ATTACH:"))) {
if (path.startsWith(QLatin1String("ATTACH:"))) {
name = QString::fromUtf8(QByteArray::fromBase64(path.mid(7).toUtf8()));
} else {
return false; //because it isn't an attachment inviation
......@@ -1455,7 +1455,7 @@ public:
return i18n("Forward invitation");
} else if (path == QLatin1String("cancel")) {
return i18n("Remove invitation from my calendar");
} else if (path.startsWith(QStringLiteral("ATTACH:"))) {
} else if (path.startsWith(QLatin1String("ATTACH:"))) {
const QString name = QString::fromUtf8(QByteArray::fromBase64(path.mid(7).toUtf8()));
return i18n("Open attachment \"%1\"", name);
}
......
......@@ -202,10 +202,10 @@ public:
return true;
}
if (path.startsWith(QStringLiteral("addToAddressBook"))) {
if (path.startsWith(QLatin1String("addToAddressBook"))) {
KPIM::AddContactJob *job = new KPIM::AddContactJob(a, nullptr);
job->start();
} else if (path.startsWith(QStringLiteral("updateToAddressBook"))) {
} else if (path.startsWith(QLatin1String("updateToAddressBook"))) {
UpdateContactJob *job = new UpdateContactJob(a.emails().first(), a, nullptr);
job->start();
}
......@@ -257,7 +257,7 @@ public:
QString statusBarMessage(BodyPart *part, const QString &path) const override
{
KContacts::Addressee a = findAddressee(part, path);
const bool addToAddressBook = path.startsWith(QStringLiteral("addToAddressBook"));
const bool addToAddressBook = path.startsWith(QLatin1String("addToAddressBook"));
if (a.realName().isEmpty()) {
return addToAddressBook ? i18n("Add this contact to the address book.") : i18n("Update this contact to the address book.");
} else {
......
......@@ -110,9 +110,9 @@ void AdBlockBlockableItemsJob::start()
void AdBlockBlockableItemsJob::adaptSource(QString &src, const QString &hostName)
{
if (src.startsWith(QStringLiteral("http://")) || src.startsWith(QStringLiteral("https://"))) {
if (src.startsWith(QLatin1String("http://")) || src.startsWith(QLatin1String("https://"))) {
//Nothing
} else if (src.startsWith(QStringLiteral("//"))) {
} else if (src.startsWith(QLatin1String("//"))) {
src = QStringLiteral("https:") + src;
} else if (src.startsWith(QLatin1Char('/'))) {
src = QStringLiteral("https://") + hostName + src;
......
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