Commit 48c2cb91 authored by Alexander Stippich's avatar Alexander Stippich

Check for DQT_NO_CAST_FROM_ASCII

Summary:
Check for DQT_NO_CAST_FROM_ASCII by removing
the removal of the definition and change all
required instances

Reviewers: bruns

Reviewed By: bruns

Subscribers: #baloo

Tags: #baloo

Differential Revision: https://phabricator.kde.org/D22096
parent b9fcf84f
......@@ -29,7 +29,6 @@ include(ECMAddTests)
include(CMakePackageConfigHelpers)
#TODO remove these
remove_definitions(-DQT_NO_CAST_FROM_ASCII)
remove_definitions(-DQT_NO_CAST_FROM_BYTEARRAY)
ecm_setup_version(PROJECT
......
......@@ -41,7 +41,7 @@
void initLocale()
{
QLocale::setDefault(QLocale("en_US"));
QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates));
}
Q_CONSTRUCTOR_FUNCTION(initLocale)
......@@ -94,25 +94,25 @@ void FileMetadataDateDisplayTest::shouldDisplayLongAndShortDates_data()
QTest::addRow("Short date, long ago")
<< Baloo::DateFormats::ShortFormat
<< QUrl::fromLocalFile(QFINDTESTDATA("samplefiles/testtagged.mp3"))
<< QRegularExpression("(?:[1-3][0-9]|[1-9]) (?:[1-2][0-9]|[1-9]):[0-5][0-9] [AP]M")
<< QRegularExpression(QStringLiteral("(?:[1-3][0-9]|[1-9]) (?:[1-2][0-9]|[1-9]):[0-5][0-9] [AP]M"))
;
QTest::addRow("Short date, yesterday")
<< Baloo::DateFormats::ShortFormat
<< QUrl::fromLocalFile(QFINDTESTDATA("samplefiles/testtagged.m4a"))
<< QRegularExpression("Yesterday, (?:[1-2][0-9]|[1-9]):[0-5][0-9] [AP]M")
<< QRegularExpression(QStringLiteral("Yesterday, (?:[1-2][0-9]|[1-9]):[0-5][0-9] [AP]M"))
;
QTest::addRow("Long date, long ago")
<< Baloo::DateFormats::LongFormat
<< QUrl::fromLocalFile(QFINDTESTDATA("samplefiles/testtagged.mp3"))
<< QRegularExpression("[A-Z][a-z]+, [A-Z][a-z]+ (?:[1-3][0-9]|[1-9]), 20[0-9]{2} (?:1[0-2]|[1-9]):[0-5][0-9]:[0-5][0-9] [AP]M [A-Z]{3,4}")
<< QRegularExpression(QStringLiteral("[A-Z][a-z]+, [A-Z][a-z]+ (?:[1-3][0-9]|[1-9]), 20[0-9]{2} (?:1[0-2]|[1-9]):[0-5][0-9]:[0-5][0-9] [AP]M [A-Z]{3,4}"))
;
QTest::addRow("Long date, yesterday")
<< Baloo::DateFormats::LongFormat
<< QUrl::fromLocalFile(QFINDTESTDATA("samplefiles/testtagged.m4a"))
<< QRegularExpression("Yesterday, (?:1[0-2]|[1-9]):[0-5][0-9]:[0-5][0-9] [AP]M [A-Z]{3,4}")
<< QRegularExpression(QStringLiteral("Yesterday, (?:1[0-2]|[1-9]):[0-5][0-9]:[0-5][0-9] [AP]M [A-Z]{3,4}"))
;
}
......
......@@ -45,13 +45,13 @@ void FileMetadataItemCountTest::initTestCase()
QStandardPaths::setTestModeEnabled(true);
KConfig balooConfig("baloofilerc", KConfig::NoGlobals);
KConfig balooConfig(QStringLiteral("baloofilerc"), KConfig::NoGlobals);
KConfigGroup balooSettings = balooConfig.group("General");
// If we use .writePathEntry here, the test will fail.
balooSettings.writeEntry(QStringLiteral("folders"), QString());
// Ensure show configuration
KConfig config("baloofileinformationrc", KConfig::NoGlobals);
KConfig config(QStringLiteral("baloofileinformationrc"), KConfig::NoGlobals);
KConfigGroup settings = config.group("Show");
const auto keys = settings.keyList();
for (const auto &key: keys) {
......
......@@ -38,7 +38,7 @@
void initLocale()
{
QLocale::setDefault(QLocale("en_US"));
QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates));
}
Q_CONSTRUCTOR_FUNCTION(initLocale)
......@@ -50,13 +50,13 @@ void FileMetadataWidgetTest::initTestCase()
QStandardPaths::setTestModeEnabled(true);
KConfig balooConfig("baloofilerc", KConfig::NoGlobals);
KConfig balooConfig(QStringLiteral("baloofilerc"), KConfig::NoGlobals);
KConfigGroup balooSettings = balooConfig.group("General");
// If we use .writePathEntry here, the test will fail.
balooSettings.writeEntry(QStringLiteral("folders"), QString());
// Ensure show configuration
KConfig config("baloofileinformationrc", KConfig::NoGlobals);
KConfig config(QStringLiteral("baloofileinformationrc"), KConfig::NoGlobals);
KConfigGroup settings = config.group("Show");
const auto keys = settings.keyList();
for (const auto &key: keys) {
......@@ -142,20 +142,20 @@ void FileMetadataWidgetTest::shouldShowProperties()
QCOMPARE(spy.count(), 1);
// simple property
QLabel* valueWidget = m_widget->findChild<QLabel*>("kfileitem#type");
QLabel* valueWidget = m_widget->findChild<QLabel*>(QStringLiteral("kfileitem#type"));
QVERIFY2(valueWidget, "Type data missing");
QCOMPARE(valueWidget->text(), QLatin1String("MP3 audio"));
if (m_mayTestRating) {
// editable property
KRatingWidget* ratingWidget = m_widget->findChild<KRatingWidget*>("rating");
KRatingWidget* ratingWidget = m_widget->findChild<KRatingWidget*>(QStringLiteral("rating"));
QVERIFY2(ratingWidget, "Rating data missing");
QCOMPARE(ratingWidget->rating(), 5u);
} else {
qDebug() << "Skipped 'Rating' test";
}
// async property
valueWidget = m_widget->findChild<QLabel*>("albumArtist");
valueWidget = m_widget->findChild<QLabel*>(QStringLiteral("albumArtist"));
QVERIFY2(valueWidget, "albumArtist data was not found");
QCOMPARE(valueWidget->text(), QLatin1String("Bill Laswell"));
......@@ -172,16 +172,16 @@ void FileMetadataWidgetTest::shouldShowCommonProperties()
QCOMPARE(spy.count(), 1);
// simple property
QLabel* valueWidget = m_widget->findChild<QLabel*>("kfileitem#type");
QLabel* valueWidget = m_widget->findChild<QLabel*>(QStringLiteral("kfileitem#type"));
QVERIFY(!valueWidget);
valueWidget = m_widget->findChild<QLabel*>("kfileitem#totalSize");
valueWidget = m_widget->findChild<QLabel*>(QStringLiteral("kfileitem#totalSize"));
// circumvent i18n formatting
QCOMPARE(valueWidget->text().left(3), QLatin1String("153"));
// editable property
if (m_mayTestRating) {
KRatingWidget* ratingWidget = m_widget->findChild<KRatingWidget*>("rating");
KRatingWidget* ratingWidget = m_widget->findChild<KRatingWidget*>(QStringLiteral("rating"));
QVERIFY2(ratingWidget, "Rating data missing");
QCOMPARE(ratingWidget->rating(), 5u);
} else {
......@@ -202,8 +202,8 @@ void FileMetadataWidgetTest::shouldShowMultiValueProperties()
QCOMPARE(spy.count(), 1);
auto artistWidget = m_widget->findChild<QLabel*>(QStringLiteral("artist"));
QVERIFY2(artistWidget, "artist not found");
QCOMPARE(artistWidget->text(), "Artist1 and Artist2");
QCOMPARE(artistWidget->text(), QStringLiteral("Artist1 and Artist2"));
auto genreWidget = m_widget->findChild<QLabel*>(QStringLiteral("genre"));
QVERIFY2(genreWidget, "genre not found");
QCOMPARE(genreWidget->text(), "Genre1, Genre2, and Genre3");
QCOMPARE(genreWidget->text(), QStringLiteral("Genre1, Genre2, and Genre3"));
}
......@@ -109,7 +109,7 @@ void FileMetaDataConfigWidget::Private::addItem(const QString& key)
}
// the item is not hidden, add it to the list
KConfig config("baloofileinformationrc", KConfig::NoGlobals);
KConfig config(QStringLiteral("baloofileinformationrc"), KConfig::NoGlobals);
KConfigGroup settings = config.group("Show");
const QString label = m_provider->label(key);
......@@ -130,9 +130,9 @@ void FileMetaDataConfigWidget::Private::slotLoadingFinished()
QVariantMap data = m_provider->data();
// Always show these 3
data.remove("rating");
data.remove("tags");
data.remove("userComment");
data.remove(QStringLiteral("rating"));
data.remove(QStringLiteral("tags"));
data.remove(QStringLiteral("userComment"));
QVariantMap::const_iterator it = data.constBegin();
while (it != data.constEnd()) {
......@@ -140,9 +140,9 @@ void FileMetaDataConfigWidget::Private::slotLoadingFinished()
++it;
}
addItem("rating");
addItem("tags");
addItem("userComment");
addItem(QStringLiteral("rating"));
addItem(QStringLiteral("tags"));
addItem(QStringLiteral("userComment"));
}
FileMetaDataConfigWidget::FileMetaDataConfigWidget(QWidget* parent) :
......@@ -169,7 +169,7 @@ KFileItemList FileMetaDataConfigWidget::items() const
void FileMetaDataConfigWidget::save()
{
KConfig config("baloofileinformationrc", KConfig::NoGlobals);
KConfig config(QStringLiteral("baloofileinformationrc"), KConfig::NoGlobals);
KConfigGroup showGroup = config.group("Show");
const int count = d->m_metaDataList->count();
......
......@@ -166,26 +166,26 @@ void FileMetaDataProvider::insertSingleFileBasicData()
if (item.isDir()) {
const int count = subDirectoriesCount(item.url().path());
if (count == -1) {
m_data.insert("kfileitem#size", i18nc("unknown file size", "Unknown"));
m_data.insert(QStringLiteral("kfileitem#size"), i18nc("unknown file size", "Unknown"));
} else {
const QString itemCountString = i18ncp("@item:intable", "%1 item", "%1 items", count);
m_data.insert("kfileitem#size", itemCountString);
m_data.insert(QStringLiteral("kfileitem#size"), itemCountString);
}
} else {
KFormat format;
m_data.insert("kfileitem#size", format.formatByteSize(item.size()));
m_data.insert(QStringLiteral("kfileitem#size"), format.formatByteSize(item.size()));
}
m_data.insert("kfileitem#type", item.mimeComment());
m_data.insert("kfileitem#modified", item.time(KFileItem::ModificationTime));
m_data.insert(QStringLiteral("kfileitem#type"), item.mimeComment());
m_data.insert(QStringLiteral("kfileitem#modified"), item.time(KFileItem::ModificationTime));
QDateTime creationTime = item.time(KFileItem::CreationTime);
if (creationTime.isValid()) {
m_data.insert("kfileitem#created", creationTime);
m_data.insert(QStringLiteral("kfileitem#created"), creationTime);
}
m_data.insert("kfileitem#accessed", item.time(KFileItem::AccessTime));
m_data.insert("kfileitem#owner", item.user());
m_data.insert("kfileitem#group", item.group());
m_data.insert("kfileitem#permissions", item.permissionsString());
m_data.insert(QStringLiteral("kfileitem#accessed"), item.time(KFileItem::AccessTime));
m_data.insert(QStringLiteral("kfileitem#owner"), item.user());
m_data.insert(QStringLiteral("kfileitem#group"), item.group());
m_data.insert(QStringLiteral("kfileitem#permissions"), item.permissionsString());
}
}
......@@ -207,7 +207,7 @@ void FileMetaDataProvider::insertFilesListBasicData()
count += subDirectoriesCount(item.url().path());
}
const QString itemCountString = i18ncp("@item:intable", "%1 item", "%1 items", count);
m_data.insert("kfileitem#totalSize", itemCountString);
m_data.insert(QStringLiteral("kfileitem#totalSize"), itemCountString);
} else {
// Calculate the size of all items
......@@ -218,21 +218,21 @@ void FileMetaDataProvider::insertFilesListBasicData()
}
}
KFormat format;
m_data.insert("kfileitem#totalSize", format.formatByteSize(totalSize));
m_data.insert(QStringLiteral("kfileitem#totalSize"), format.formatByteSize(totalSize));
}
}
void FileMetaDataProvider::insertEditableData()
{
if (!m_readOnly) {
if (!m_data.contains("tags")) {
m_data.insert("tags", QVariant());
if (!m_data.contains(QStringLiteral("tags"))) {
m_data.insert(QStringLiteral("tags"), QVariant());
}
if (!m_data.contains("rating")) {
m_data.insert("rating", 0);
if (!m_data.contains(QStringLiteral("rating"))) {
m_data.insert(QStringLiteral("rating"), 0);
}
if (!m_data.contains("userComment")) {
m_data.insert("userComment", QVariant());
if (!m_data.contains(QStringLiteral("userComment"))) {
m_data.insert(QStringLiteral("userComment"), QVariant());
}
}
}
......@@ -250,10 +250,10 @@ void FileMetaDataProvider::insertCommonData(const QList<QVariantMap>& files)
}
// Special handling for certain properties
totalPropertyAndInsert("duration", propertyList, allProperties);
totalPropertyAndInsert("characterCount", propertyList, allProperties);
totalPropertyAndInsert("wordCount", propertyList, allProperties);
totalPropertyAndInsert("lineCount", propertyList, allProperties);
totalPropertyAndInsert(QStringLiteral("duration"), propertyList, allProperties);
totalPropertyAndInsert(QStringLiteral("characterCount"), propertyList, allProperties);
totalPropertyAndInsert(QStringLiteral("wordCount"), propertyList, allProperties);
totalPropertyAndInsert(QStringLiteral("lineCount"), propertyList, allProperties);
foreach (const QString& propUri, allProperties) {
foreach (const QVariantMap& map, propertyList) {
......@@ -378,41 +378,25 @@ void FileMetaDataProvider::setItems(const KFileItemList& items)
QString FileMetaDataProvider::label(const QString& metaDataLabel) const
{
struct TranslationItem {
const char* const key;
const char* const context;
const char* const value;
static QHash<QString, QString> hash = {
{ QStringLiteral("kfileitem#comment"), i18nc("@label", "Comment") },
{ QStringLiteral("kfileitem#created"), i18nc("@label", "Created") },
{ QStringLiteral("kfileitem#accessed"), i18nc("@label", "Accessed") },
{ QStringLiteral("kfileitem#modified"), i18nc("@label", "Modified") },
{ QStringLiteral("kfileitem#owner"), i18nc("@label", "Owner") },
{ QStringLiteral("kfileitem#group"), i18nc("@label", "Group") },
{ QStringLiteral("kfileitem#permissions"), i18nc("@label", "Permissions") },
{ QStringLiteral("kfileitem#rating"), i18nc("@label", "Rating") },
{ QStringLiteral("kfileitem#size"), i18nc("@label", "Size") },
{ QStringLiteral("kfileitem#tags"), i18nc("@label", "Tags") },
{ QStringLiteral("kfileitem#totalSize"), i18nc("@label", "Total Size") },
{ QStringLiteral("kfileitem#type"), i18nc("@label", "Type") },
{ QStringLiteral("tags"), i18nc("@label", "Tags") },
{ QStringLiteral("rating"), i18nc("@label", "Rating") },
{ QStringLiteral("userComment"), i18nc("@label", "Comment") },
{ QStringLiteral("originUrl"), i18nc("@label", "Downloaded From") },
};
static const TranslationItem translations[] = {
{ "kfileitem#comment", I18N_NOOP2_NOSTRIP("@label", "Comment") },
{ "kfileitem#created", I18N_NOOP2_NOSTRIP("@label", "Created") },
{ "kfileitem#accessed", I18N_NOOP2_NOSTRIP("@label", "Accessed") },
{ "kfileitem#modified", I18N_NOOP2_NOSTRIP("@label", "Modified") },
{ "kfileitem#owner", I18N_NOOP2_NOSTRIP("@label", "Owner") },
{ "kfileitem#group", I18N_NOOP2_NOSTRIP("@label", "Group") },
{ "kfileitem#permissions", I18N_NOOP2_NOSTRIP("@label", "Permissions") },
{ "kfileitem#rating", I18N_NOOP2_NOSTRIP("@label", "Rating") },
{ "kfileitem#size", I18N_NOOP2_NOSTRIP("@label", "Size") },
{ "kfileitem#tags", I18N_NOOP2_NOSTRIP("@label", "Tags") },
{ "kfileitem#totalSize", I18N_NOOP2_NOSTRIP("@label", "Total Size") },
{ "kfileitem#type", I18N_NOOP2_NOSTRIP("@label", "Type") },
{ "tags", I18N_NOOP2_NOSTRIP("@label", "Tags") },
{ "rating", I18N_NOOP2_NOSTRIP("@label", "Rating") },
{ "userComment", I18N_NOOP2_NOSTRIP("@label", "Comment") },
{ "originUrl", I18N_NOOP2_NOSTRIP("@label", "Downloaded From") },
{ nullptr, nullptr, nullptr} // Mandatory last entry
};
static QHash<QString, QString> hash;
if (hash.isEmpty()) {
const TranslationItem* item = &translations[0];
while (item->key != nullptr) {
hash.insert(item->key, i18nc(item->context, item->value));
++item;
}
}
QString value = hash.value(metaDataLabel);
if (value.isEmpty()) {
value = KFileMetaData::PropertyInfo::fromName(metaDataLabel).displayName();
......@@ -423,61 +407,61 @@ QString FileMetaDataProvider::label(const QString& metaDataLabel) const
QString FileMetaDataProvider::group(const QString& label) const
{
static QHash<QString, QString> uriGrouper;
if (uriGrouper.isEmpty()) {
static QHash<QString, QString> uriGrouper = {
// KFileItem Data
uriGrouper.insert(QLatin1String("kfileitem#type"), QLatin1String("0FileItemA"));
uriGrouper.insert(QLatin1String("kfileitem#size"), QLatin1String("0FileItemB"));
uriGrouper.insert(QLatin1String("kfileitem#totalSize"), QLatin1String("0FileItemB"));
uriGrouper.insert(QLatin1String("kfileitem#modified"), QLatin1String("0FileItemC"));
uriGrouper.insert(QLatin1String("kfileitem#accessed"), QLatin1String("0FileItemD"));
uriGrouper.insert(QLatin1String("kfileitem#created"), QLatin1String("0FileItemE"));
uriGrouper.insert(QLatin1String("kfileitem#owner"), QLatin1String("0FileItemF"));
uriGrouper.insert(QLatin1String("kfileitem#group"), QLatin1String("0FileItemG"));
uriGrouper.insert(QLatin1String("kfileitem#permissions"), QLatin1String("0FileItemH"));
{ QStringLiteral("kfileitem#type"), QStringLiteral("0FileItemA") },
{ QStringLiteral("kfileitem#size"), QStringLiteral("0FileItemB") },
{ QStringLiteral("kfileitem#totalSize"), QStringLiteral("0FileItemB") },
{ QStringLiteral("kfileitem#modified"), QStringLiteral("0FileItemC") },
{ QStringLiteral("kfileitem#accessed"), QStringLiteral("0FileItemD") },
{ QStringLiteral("kfileitem#created"), QStringLiteral("0FileItemE") },
{ QStringLiteral("kfileitem#owner"), QStringLiteral("0FileItemF") },
{ QStringLiteral("kfileitem#group"), QStringLiteral("0FileItemG") },
{ QStringLiteral("kfileitem#permissions"), QStringLiteral("0FileItemH") },
// Editable Data
uriGrouper.insert(QLatin1String("tags"), QLatin1String("1EditableDataA"));
uriGrouper.insert(QLatin1String("rating"), QLatin1String("1EditableDataB"));
uriGrouper.insert(QLatin1String("userComment"), QLatin1String("1EditableDataC"));
{ QStringLiteral("tags"), QStringLiteral("1EditableDataA") },
{ QStringLiteral("rating"), QStringLiteral("1EditableDataB") },
{ QStringLiteral("userComment"), QStringLiteral("1EditableDataC") },
// Image Data
uriGrouper.insert(QLatin1String("width"), QLatin1String("2ImageA"));
uriGrouper.insert(QLatin1String("height"), QLatin1String("2ImageB"));
uriGrouper.insert(QLatin1String("photoFNumber"), QLatin1String("2ImageC"));
uriGrouper.insert(QLatin1String("photoExposureTime"), QLatin1String("2ImageD"));
uriGrouper.insert(QLatin1String("photoExposureBiasValue"), QLatin1String("2ImageE"));
uriGrouper.insert(QLatin1String("photoISOSpeedRatings"), QLatin1String("2ImageF"));
uriGrouper.insert(QLatin1String("photoFocalLength"), QLatin1String("2ImageG"));
uriGrouper.insert(QLatin1String("photoFocalLengthIn35mmFilm"), QLatin1String("2ImageH"));
uriGrouper.insert(QLatin1String("photoFlash"), QLatin1String("2ImageI"));
uriGrouper.insert(QLatin1String("imageOrientation"), QLatin1String("2ImageJ"));
uriGrouper.insert(QLatin1String("photoGpsLatitude"), QLatin1String("2ImageK"));
uriGrouper.insert(QLatin1String("photoGpsLongitude"), QLatin1String("2ImageL"));
uriGrouper.insert(QLatin1String("photoGpsAltitude"), QLatin1String("2ImageM"));
uriGrouper.insert(QLatin1String("manufacturer"), QLatin1String("2ImageN"));
uriGrouper.insert(QLatin1String("model"), QLatin1String("2ImageO"));
{ QStringLiteral("width"), QStringLiteral("2ImageA") },
{ QStringLiteral("height"), QStringLiteral("2ImageB") },
{ QStringLiteral("photoFNumber"), QStringLiteral("2ImageC") },
{ QStringLiteral("photoExposureTime"), QStringLiteral("2ImageD") },
{ QStringLiteral("photoExposureBiasValue"), QStringLiteral("2ImageE") },
{ QStringLiteral("photoISOSpeedRatings"), QStringLiteral("2ImageF") },
{ QStringLiteral("photoFocalLength"), QStringLiteral("2ImageG") },
{ QStringLiteral("photoFocalLengthIn35mmFilm"), QStringLiteral("2ImageH") },
{ QStringLiteral("photoFlash"), QStringLiteral("2ImageI") },
{ QStringLiteral("imageOrientation"), QStringLiteral("2ImageJ") },
{ QStringLiteral("photoGpsLatitude"), QStringLiteral("2ImageK") },
{ QStringLiteral("photoGpsLongitude"), QStringLiteral("2ImageL") },
{ QStringLiteral("photoGpsAltitude"), QStringLiteral("2ImageM") },
{ QStringLiteral("manufacturer"), QStringLiteral("2ImageN") },
{ QStringLiteral("model"), QStringLiteral("2ImageO") },
// Media Data
uriGrouper.insert("title", QLatin1String("3MediaA"));
uriGrouper.insert("artist", QLatin1String("3MediaB"));
uriGrouper.insert("album", QLatin1String("3MediaC"));
uriGrouper.insert("albumArtist", QLatin1String("3MediaD"));
uriGrouper.insert("genre", QLatin1String("3MediaE"));
uriGrouper.insert("trackNumber", QLatin1String("3MediaF"));
uriGrouper.insert("discNumber", QLatin1String("3MediaG"));
uriGrouper.insert("releaseYear", QLatin1String("3MediaH"));
uriGrouper.insert("duration", QLatin1String("3MediaI"));
uriGrouper.insert("sampleRate", QLatin1String("3MediaJ"));
uriGrouper.insert("bitRate", QLatin1String("3MediaK"));
{ QStringLiteral("title"), QStringLiteral("3MediaA") },
{ QStringLiteral("artist"), QStringLiteral("3MediaB") },
{ QStringLiteral("album"), QStringLiteral("3MediaC") },
{ QStringLiteral("albumArtist"), QStringLiteral("3MediaD") },
{ QStringLiteral("genre"), QStringLiteral("3MediaE") },
{ QStringLiteral("trackNumber"), QStringLiteral("3MediaF") },
{ QStringLiteral("discNumber"), QStringLiteral("3MediaG") },
{ QStringLiteral("releaseYear"), QStringLiteral("3MediaH") },
{ QStringLiteral("duration"), QStringLiteral("3MediaI") },
{ QStringLiteral("sampleRate"), QStringLiteral("3MediaJ") },
{ QStringLiteral("bitRate"), QStringLiteral("3MediaK") },
// Miscellaneous Data
uriGrouper.insert("originUrl", QLatin1String("4MiscA"));
}
{ QStringLiteral("originUrl"), QStringLiteral("4MiscA") },
};
const QString val = uriGrouper.value(label);
if (val.isEmpty()) {
return "lastGroup";
return QStringLiteral("lastGroup");
}
return val;
}
......
......@@ -174,7 +174,7 @@ void FileMetaDataWidget::Private::slotLoadingFinished()
// Iterate through all remaining items.
// Embed the label and the value as new row in the widget
const QStringList keys = sortedKeys(data);
const int spacerWidth = QFontMetrics(q->font()).size(Qt::TextSingleLine, " ").width();
const int spacerWidth = QFontMetrics(q->font()).size(Qt::TextSingleLine, QStringLiteral(" ")).width();
const int labelColumn = m_configureVisibleProperties ? 1 : 0;
......@@ -271,7 +271,7 @@ void FileMetaDataWidget::Private::saveConfig()
return;
}
KConfig config("baloofileinformationrc", KConfig::NoGlobals);
KConfig config(QStringLiteral("baloofileinformationrc"), KConfig::NoGlobals);
KConfigGroup showGroup = config.group("Show");
auto changedIt = m_visibilityChanged.constBegin();
......
......@@ -62,15 +62,15 @@ void KCommentWidget::setText(const QString& comment)
QString text;
if (comment.isEmpty()) {
if (m_readOnly) {
text = "-";
text = QStringLiteral("-");
} else {
text = "<a href=\"addComment\">" + i18nc("@label", "Add...") + "</a>";
text = QStringLiteral("<a href=\"addComment\">") + i18nc("@label", "Add...") + QStringLiteral("</a>");
}
} else {
if (m_readOnly) {
text = QString(comment).toHtmlEscaped();
text = comment.toHtmlEscaped();
} else {
text = "<p>" + QString(comment).toHtmlEscaped() + " <a href=\"editComment\">" + i18nc("@label", "Edit...") + "</a></p>";
text = QStringLiteral("<p>") + comment.toHtmlEscaped() + QStringLiteral(" <a href=\"editComment\">") + i18nc("@label", "Edit...") + QStringLiteral("</a></p>");
}
}
......@@ -115,7 +115,7 @@ bool KCommentWidget::event(QEvent* event)
void KCommentWidget::slotLinkActivated(const QString& link)
{
const QString caption = (link == "editComment") ?
const QString caption = (link == QLatin1String("editComment")) ?
i18nc("@title:window", "Edit Comment") :
i18nc("@title:window", "Add Comment");
......
......@@ -132,7 +132,7 @@ void KEditTagsDialog::slotTextEdited(const QString& text)
// mandatory, as the user cannot see the difference
// between a tag "Test" and "Test ".
QString tagText = text.simplified();
while (tagText.endsWith("//")) {
while (tagText.endsWith(QLatin1String("//"))) {
tagText.chop(1);
m_newTagEdit->setText(tagText);
return;
......
......@@ -44,7 +44,7 @@ void MetadataFilter::initMetaInformationSettings()
const int currentVersion = 11; // increase version, if the blacklist of disabled
// properties should be updated
KConfig config("baloofileinformationrc", KConfig::NoGlobals);
KConfig config(QStringLiteral("baloofileinformationrc"), KConfig::NoGlobals);
if (config.group("Misc").readEntry("version", 0) < currentVersion) {
// The resource file is read the first time. Assure
// that some meta information is disabled per default.
......@@ -101,7 +101,7 @@ QVariantMap MetadataFilter::filter(const QVariantMap& data)
//
// Remove all items, that are marked as hidden in kmetainformationrc
KConfig config("baloofileinformationrc", KConfig::NoGlobals);
KConfig config(QStringLiteral("baloofileinformationrc"), KConfig::NoGlobals);
KConfigGroup settings = config.group("Show");
QVariantMap::iterator it = finalData.begin();
while (it != finalData.end()) {
......
......@@ -39,7 +39,7 @@ TagCheckBox::TagCheckBox(const QString& tag, QWidget* parent)
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
m_label = new QLabel(tag.split('/', QString::SkipEmptyParts).last(), this);
m_label = new QLabel(tag.split(QLatin1Char('/'), QString::SkipEmptyParts).last(), this);
m_label->setToolTip(tag);
m_label->setMouseTracking(true);
m_label->setTextFormat(Qt::PlainText);
......
......@@ -116,7 +116,7 @@ QList<QAction*> TagsFileItemAction::actions(const KFileItemListProperties& fileI
return {};
}
m_tagsLister.openUrl(QUrl("tags:/"), KCoreDirLister::OpenUrlFlag::Reload);
m_tagsLister.openUrl(QUrl(QStringLiteral("tags:/")), KCoreDirLister::OpenUrlFlag::Reload);
return {m_menu->menuAction()};
}
......
......@@ -75,7 +75,7 @@ void TagWidgetPrivate::buildTagHash(const QStringList& tags)
m_showAllLinkLabel = new QLabel( q );
m_flowLayout->addWidget( m_showAllLinkLabel );
if (m_readOnly) {
m_showAllLinkLabel->setText("-");
m_showAllLinkLabel->setText(QStringLiteral("-"));
}
else {
QFont f(q->font());
......
......@@ -320,7 +320,7 @@ void WidgetFactory::slotLinkActivated(const QString& url)
void WidgetFactory::slotTagClicked(const QString& tag)
{
QUrl url;
url.setScheme("tags");
url.setScheme(QStringLiteral("tags"));
url.setPath(tag);
emit urlActivated(url);
......
......@@ -65,7 +65,7 @@ void FileMetadataWidgetTest::slotChooseFiles()
int main( int argc, char** argv )
{
QApplication app( argc, argv );
app.setApplicationName( "FileMetaDataConfigWidgetApp" );
app.setApplicationName(QStringLiteral("FileMetaDataConfigWidgetApp"));
FileMetadataWidgetTest test;
test.show();
return app.exec();
......
......@@ -26,10 +26,10 @@
int main(int argc, char** argv)
{
QApplication app(argc, argv);
app.setApplicationName("FileMetadataWidgetApp");
app.setApplicationName(QStringLiteral("FileMetadataWidgetApp"));
QCommandLineParser parser;