Commit 57a6fec5 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port foreach + use QStringLiteral(..)

parent 7e894f15
......@@ -70,8 +70,8 @@ void UrlTest::testGDriveUrl_data()
<< GDriveUrl::TrashDir;
QTest::newRow("file in trash")
<< gdriveUrl(QStringLiteral("/foo@gmail.com/") + GDriveUrl::TrashDir + ("/baz.txt"))
<< QStringLiteral("gdrive:/foo@gmail.com/") + GDriveUrl::TrashDir + ("/baz.txt")
<< gdriveUrl(QStringLiteral("/foo@gmail.com/") + GDriveUrl::TrashDir + QStringLiteral("/baz.txt"))
<< QStringLiteral("gdrive:/foo@gmail.com/") + GDriveUrl::TrashDir + QStringLiteral("/baz.txt")
<< QStringLiteral("foo@gmail.com")
<< QStringLiteral("/foo@gmail.com/") + GDriveUrl::TrashDir
<< true
......
......@@ -15,7 +15,7 @@ class GoogleDrivePlugin : public KAccountsDPlugin
public:
explicit GoogleDrivePlugin(QObject *parent, const QVariantList &args);
public slots:
public Q_SLOTS:
void onAccountCreated(const Accounts::AccountId accountId, const Accounts::ServiceList &serviceList) override;
void onAccountRemoved(const Accounts::AccountId accountId) override;
void onServiceEnabled(const Accounts::AccountId accountId, const Accounts::Service &service) override;
......
......@@ -99,7 +99,8 @@ QUrl GDriveHelper::convertFromGDocs(KGAPI2::Drive::FilePtr &file)
}
const auto exportLinks = file->exportLinks();
Q_FOREACH (const QString &targetMimeType, convIt.value()) {
const QStringList targetMimeTypeList{convIt.value()};
for (const QString &targetMimeType : targetMimeTypeList) {
const auto linkIt = exportLinks.constFind(targetMimeType);
if (linkIt != exportLinks.cend()) {
// Extra check to safeguard against a mistake in Google's Drive API v2
......@@ -134,5 +135,5 @@ KIO::UDSEntry GDriveHelper::trash()
QString GDriveHelper::elideToken(const QString &token)
{
return token.mid(0, 30).append("...");
return token.mid(0, 30).append(QStringLiteral("..."));
}
......@@ -12,6 +12,7 @@
#include <QClipboard>
#include <QDesktopServices>
#include <KIO/StatJob>
#include <KLocalizedString>
K_PLUGIN_CLASS_WITH_JSON(GDrivePropertiesPlugin, "gdrivepropertiesplugin.json")
......@@ -92,7 +93,7 @@ void GDrivePropertiesPlugin::statJobFinished(KJob *job)
}
const KIO::UDSEntry entry = statJob->statResult();
showEntryDetails(entry);
properties->addPage(&m_widget, "G&oogle Drive");
properties->addPage(&m_widget, i18n("G&oogle Drive"));
}
#include "gdrivepropertiesplugin.moc"
......@@ -25,7 +25,7 @@ private:
void showEntryDetails(const KIO::UDSEntry &entry);
private slots:
private Q_SLOTS:
void statJobFinished(KJob *job);
};
......
......@@ -328,7 +328,7 @@ void KIOGDrive::listAccounts()
return;
}
Q_FOREACH (const QString &account, accounts) {
for (const QString &account : accounts) {
const KIO::UDSEntry entry = accountToUDSEntry(account);
listEntry(entry);
}
......@@ -740,8 +740,8 @@ void KIOGDrive::listDir(const QUrl &url)
return;
}
ObjectsList objects = fileFetchJob.items();
Q_FOREACH (const ObjectPtr &object, objects) {
const ObjectsList objects = fileFetchJob.items();
for (const ObjectPtr &object : objects) {
const FilePtr file = object.dynamicCast<File>();
const KIO::UDSEntry entry = fileToUDSEntry(file, url.adjusted(QUrl::StripTrailingSlash).path());
......
Supports Markdown
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