Commit bf0fade6 authored by Méven Car's avatar Méven Car
Browse files

Fix some clazy warnings

parent 708711bd
Pipeline #117803 passed with stage
in 43 seconds
......@@ -32,7 +32,7 @@ int main(int argc, char **argv)
parser.showHelp(1);
}
const QString url = parser.positionalArguments().first();
const QString url = parser.positionalArguments().constFirst();
const QString mimetype = KFileMetaData::MimeUtils::strictMimeType(url, QMimeDatabase()).name();
KFileMetaData::SimpleExtractionResult result(url, mimetype, KFileMetaData::ExtractionResult::ExtractMetaData);
......
......@@ -31,7 +31,7 @@ void FileFetchJob::start()
void FileFetchJob::doStart()
{
for (const QString &filePath : m_urls) {
for (const QString &filePath : qAsConst(m_urls)) {
bool extractorRunning = false;
KFileMetaData::PropertyMap fileProperties;
......
......@@ -94,7 +94,7 @@ void KEditTagsDialog::slotAcceptedButtonClicked()
{
m_tags.clear();
for (const QTreeWidgetItem *item : m_allTagTreeItems.values()) {
for (const QTreeWidgetItem *item : qAsConst(m_allTagTreeItems)) {
if (item->checkState(0) == Qt::Checked) {
m_tags << qvariant_cast<QString>(item->data(0, Qt::UserRole));
}
......@@ -163,11 +163,11 @@ void KEditTagsDialog::slotTextEdited(const QString &text)
void KEditTagsDialog::loadTagWidget()
{
for (const QString &tag : m_tags) {
for (const QString &tag : qAsConst(m_tags)) {
modifyTagWidget(tag);
}
for (const QString &tag : m_allTags) {
for (const QString &tag : qAsConst(m_allTags)) {
modifyTagWidget(tag);
}
......
......@@ -83,7 +83,7 @@ QList<QAction *> TagsFileItemAction::actions(const KFileItemListProperties &file
return {};
}
QString filePath = fileItemInfos.urlList()[0].toLocalFile();
const QString filePath = fileItemInfos.urlList().constFirst().toLocalFile();
if (!QFileInfo(filePath).isWritable()) {
return {};
}
......
......@@ -76,7 +76,8 @@ static QString toString(const QVariant &value, QLocale::FormatType dateFormat)
}
case QVariant::List: {
QStringList list;
for (const QVariant &var : value.toList()) {
const auto valueList = value.toList();
for (const QVariant &var : valueList) {
list << toString(var, dateFormat);
}
return list.join(i18nc("String list separator", ", "));
......@@ -267,7 +268,7 @@ void WidgetFactory::slotTagsChanged(const QStringList &tags)
QStringList newTags = md.tags() + tags;
newTags.removeDuplicates();
for (const QString &tag : m_prevTags) {
for (const QString &tag : qAsConst(m_prevTags)) {
if (!tags.contains(tag)) {
newTags.removeAll(tag);
}
......
......@@ -58,9 +58,9 @@ private:
QWidget *createCommentWidget(const QString &comment, QWidget *parent);
QLabel *createValueWidget(QWidget *parent);
TagWidget *m_tagWidget;
KRatingWidget *m_ratingWidget;
KCommentWidget *m_commentWidget;
TagWidget *m_tagWidget = nullptr;
KRatingWidget *m_ratingWidget = nullptr;
KCommentWidget *m_commentWidget = nullptr;
KFileItemList m_items;
QStringList m_prevTags;
......
......@@ -23,7 +23,8 @@ int main(int argc, char **argv)
Baloo::FileMetaDataWidget *widget = new Baloo::FileMetaDataWidget();
KFileItemList list;
for (const QString &path : parser.positionalArguments()) {
const auto args = parser.positionalArguments();
for (const QString &path : args) {
QFileInfo fi(path);
list << KFileItem(QUrl::fromLocalFile(fi.absoluteFilePath()), QString(), mode_t());
}
......
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