diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index 4d3f1983bc..607cb33a7c 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -532,7 +532,7 @@ void DolphinViewContainer::slotUrlNavigatorLocationChanged(const KUrl& url) } else if (KProtocolManager::isSourceProtocol(url)) { QString app = "konqueror"; if (url.protocol().startsWith(QLatin1String("http"))) { - showMessage(i18nc("@info:status", + showMessage(i18nc("@info:status", // krazy:exclude=qmethods "Dolphin does not support web pages, the web browser has been launched"), Information); diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index 7e5d961d69..eec90065a4 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -938,7 +938,7 @@ void KFileItemModel::insertItems(const KFileItemList& items) insertedCount = 0; } - // Insert item at the position targetIndex by transfering + // Insert item at the position targetIndex by transferring // the ownership of the item-data from sortedItems to m_itemData. // m_items will be inserted after the loop (see comment below) m_itemData.insert(targetIndex, sortedItems.at(sourceIndex)); @@ -1920,7 +1920,7 @@ void KFileItemModel::determineMimeTypes(const KFileItemList& items, int timeout) { QElapsedTimer timer; timer.start(); - foreach (KFileItem item, items) { + foreach (KFileItem item, items) { // krazy:exclude=foreach item.determineMimeType(); if (timer.elapsed() > timeout) { // Don't block the user interface, let the remaining items diff --git a/src/kitemviews/kfileitemmodelrolesupdater.cpp b/src/kitemviews/kfileitemmodelrolesupdater.cpp index bbb01247d1..5418c3f9ce 100644 --- a/src/kitemviews/kfileitemmodelrolesupdater.cpp +++ b/src/kitemviews/kfileitemmodelrolesupdater.cpp @@ -1070,10 +1070,10 @@ int KFileItemModelRolesUpdater::subItemsCount(const QString& path) const int count = -1; DIR* dir = ::opendir(QFile::encodeName(path)); - if (dir) { + if (dir) { // krazy:exclude=syscalls count = 0; struct dirent *dirEntry = 0; - while ((dirEntry = ::readdir(dir))) { // krazy:exclude=syscalls + while ((dirEntry = ::readdir(dir))) { if (dirEntry->d_name[0] == '.') { if (dirEntry->d_name[1] == '\0' || !countHiddenFiles) { // Skip "." or hidden files diff --git a/src/kitemviews/kitemmodelbase.h b/src/kitemviews/kitemmodelbase.h index 129524b31d..70f6883909 100644 --- a/src/kitemviews/kitemmodelbase.h +++ b/src/kitemviews/kitemmodelbase.h @@ -63,7 +63,7 @@ class LIBDOLPHINPRIVATE_EXPORT KItemModelBase : public QObject public: KItemModelBase(QObject* parent = 0); - KItemModelBase(const QByteArray& sortRole, QObject* parent = 0); + explicit KItemModelBase(const QByteArray& sortRole, QObject* parent = 0); virtual ~KItemModelBase(); /** @return The number of items. */ diff --git a/src/kitemviews/kstandarditemlistgroupheader.cpp b/src/kitemviews/kstandarditemlistgroupheader.cpp index 3a5ddd9443..1e23c0a56a 100644 --- a/src/kitemviews/kstandarditemlistgroupheader.cpp +++ b/src/kitemviews/kstandarditemlistgroupheader.cpp @@ -101,7 +101,7 @@ void KStandardItemListGroupHeader::updateCache() const qreal maxWidth = size().width() - 4 * styleOption().padding; if (role() == "rating") { - m_text = QString(); + m_text = QString(); // krazy:exlude=nullstrassign const qreal height = styleOption().fontMetrics.ascent(); const QSizeF pixmapSize(qMin(height * 5, maxWidth), height); diff --git a/src/kitemviews/private/kitemlistkeyboardsearchmanager.h b/src/kitemviews/private/kitemlistkeyboardsearchmanager.h index 3731548c96..661178db8b 100644 --- a/src/kitemviews/private/kitemlistkeyboardsearchmanager.h +++ b/src/kitemviews/private/kitemlistkeyboardsearchmanager.h @@ -20,8 +20,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * ***************************************************************************/ -#ifndef KITEMLISTKEYBOARDMANAGER_H -#define KITEMLISTKEYBOARDMANAGER_H +#ifndef KITEMLISTKEYBOARDSEARCHMANAGER_H +#define KITEMLISTKEYBOARDSEARCHMANAGER_H #include diff --git a/src/kitemviews/private/kitemlistsmoothscroller.h b/src/kitemviews/private/kitemlistsmoothscroller.h index 252c966c7a..ea56822085 100644 --- a/src/kitemviews/private/kitemlistsmoothscroller.h +++ b/src/kitemviews/private/kitemlistsmoothscroller.h @@ -38,8 +38,8 @@ class LIBDOLPHINPRIVATE_EXPORT KItemListSmoothScroller : public QObject Q_OBJECT public: - KItemListSmoothScroller(QScrollBar* scrollBar, - QObject* parent = 0); + explicit KItemListSmoothScroller(QScrollBar* scrollBar, + QObject* parent = 0); virtual ~KItemListSmoothScroller(); void setScrollBar(QScrollBar* scrollBar); diff --git a/src/kitemviews/private/knepomukrolesprovider.cpp b/src/kitemviews/private/knepomukrolesprovider.cpp index fffcd216d6..0ae9b6bd3e 100644 --- a/src/kitemviews/private/knepomukrolesprovider.cpp +++ b/src/kitemviews/private/knepomukrolesprovider.cpp @@ -79,9 +79,9 @@ QHash KNepomukRolesProvider::roleValues(const Nepomuk::Res // Merge the two Nepomuk properties for width and height // as one string into the "imageSize" role const QString uri = property.uri().toString(); - if (uri.endsWith("#width")) { + if (uri.endsWith(QLatin1String("#width"))) { width = value.toInt(); - } else if (uri.endsWith("#height")) { + } else if (uri.endsWith(QLatin1String("#height"))) { height = value.toInt(); } diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp index a0358cb432..5d89dfa7fe 100644 --- a/src/panels/places/placesitemmodel.cpp +++ b/src/panels/places/placesitemmodel.cpp @@ -1082,21 +1082,21 @@ KUrl PlacesItemModel::createTimelineUrl(const KUrl& url) KUrl timelineUrl; const QString path = url.pathOrUrl(); - if (path.endsWith("yesterday")) { + if (path.endsWith(QLatin1String("yesterday"))) { const QDate date = QDate::currentDate().addDays(-1); const int year = date.year(); const int month = date.month(); const int day = date.day(); timelineUrl = "timeline:/" + timelineDateString(year, month) + '/' + timelineDateString(year, month, day); - } else if (path.endsWith("thismonth")) { + } else if (path.endsWith(QLatin1String("thismonth"))) { const QDate date = QDate::currentDate(); timelineUrl = "timeline:/" + timelineDateString(date.year(), date.month()); - } else if (path.endsWith("lastmonth")) { + } else if (path.endsWith(QLatin1String("lastmonth"))) { const QDate date = QDate::currentDate().addMonths(-1); timelineUrl = "timeline:/" + timelineDateString(date.year(), date.month()); } else { - Q_ASSERT(path.endsWith("today")); + Q_ASSERT(path.endsWith(QLatin1String("today"))); timelineUrl= url; } @@ -1128,14 +1128,14 @@ KUrl PlacesItemModel::createSearchUrl(const KUrl& url) #ifdef HAVE_NEPOMUK const QString path = url.pathOrUrl(); - if (path.endsWith("documents")) { + if (path.endsWith(QLatin1String("documents"))) { searchUrl = searchUrlForTerm(Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::NFO::Document())); - } else if (path.endsWith("images")) { + } else if (path.endsWith(QLatin1String("images"))) { searchUrl = searchUrlForTerm(Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::NFO::Image())); - } else if (path.endsWith("audio")) { + } else if (path.endsWith(QLatin1String("audio"))) { searchUrl = searchUrlForTerm(Nepomuk::Query::ComparisonTerm(Nepomuk::Vocabulary::NIE::mimeType(), Nepomuk::Query::LiteralTerm("audio"))); - } else if (path.endsWith("videos")) { + } else if (path.endsWith(QLatin1String("videos"))) { searchUrl = searchUrlForTerm(Nepomuk::Query::ComparisonTerm(Nepomuk::Vocabulary::NIE::mimeType(), Nepomuk::Query::LiteralTerm("video"))); } else { diff --git a/src/panels/terminal/terminalpanel.cpp b/src/panels/terminal/terminalpanel.cpp index dba67f1b40..889c07e45f 100644 --- a/src/panels/terminal/terminalpanel.cpp +++ b/src/panels/terminal/terminalpanel.cpp @@ -74,7 +74,7 @@ void TerminalPanel::dockVisibilityChanged() // signal, we have to update m_konsolePartCurrentDirectory manually. If this // was not done, showing the panel again might not set the part's working // directory correctly. - m_konsolePartCurrentDirectory = "/"; + m_konsolePartCurrentDirectory = '/'; } } diff --git a/src/tests/kfileitemmodeltest.cpp b/src/tests/kfileitemmodeltest.cpp index e6bcb906ea..65c28ce757 100644 --- a/src/tests/kfileitemmodeltest.cpp +++ b/src/tests/kfileitemmodeltest.cpp @@ -419,7 +419,7 @@ void KFileItemModelTest::testExpandItems() // Store the URLs of all folders in a set. QSet allFolders; - allFolders << KUrl(m_testDir->name() + "a") << KUrl(m_testDir->name() + "a/a") << KUrl(m_testDir->name() + "a/a-1"); + allFolders << KUrl(m_testDir->name() + 'a') << KUrl(m_testDir->name() + "a/a") << KUrl(m_testDir->name() + "a/a-1"); m_model->loadDirectory(m_testDir->url()); QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout)); @@ -437,7 +437,7 @@ void KFileItemModelTest::testExpandItems() QVERIFY(m_model->isExpanded(0)); QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout)); QCOMPARE(m_model->count(), 3); // 3 items: "a/", "a/a/", "a/a-1/" - QCOMPARE(m_model->expandedDirectories(), QSet() << KUrl(m_testDir->name() + "a")); + QCOMPARE(m_model->expandedDirectories(), QSet() << KUrl(m_testDir->name() + 'a')); QCOMPARE(spyInserted.count(), 1); KItemRangeList itemRangeList = spyInserted.takeFirst().at(0).value(); @@ -453,7 +453,7 @@ void KFileItemModelTest::testExpandItems() QVERIFY(m_model->isExpanded(1)); QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout)); QCOMPARE(m_model->count(), 4); // 4 items: "a/", "a/a/", "a/a/1", "a/a-1/" - QCOMPARE(m_model->expandedDirectories(), QSet() << KUrl(m_testDir->name() + "a") << KUrl(m_testDir->name() + "a/a")); + QCOMPARE(m_model->expandedDirectories(), QSet() << KUrl(m_testDir->name() + 'a') << KUrl(m_testDir->name() + "a/a")); QCOMPARE(spyInserted.count(), 1); itemRangeList = spyInserted.takeFirst().at(0).value(); @@ -482,7 +482,7 @@ void KFileItemModelTest::testExpandItems() m_model->setExpanded(0, false); QVERIFY(!m_model->isExpanded(0)); QCOMPARE(m_model->count(), 1); - QVERIFY(!m_model->expandedDirectories().contains(KUrl(m_testDir->name() + "a"))); // TODO: Make sure that child URLs are also removed + QVERIFY(!m_model->expandedDirectories().contains(KUrl(m_testDir->name() + 'a'))); // TODO: Make sure that child URLs are also removed QCOMPARE(spyRemoved.count(), 1); itemRangeList = spyRemoved.takeFirst().at(0).value(); @@ -593,7 +593,7 @@ void KFileItemModelTest::testSorting() m_model->loadDirectory(m_testDir->url()); QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout)); - int index = m_model->index(KUrl(m_testDir->url().url() + "c")); + int index = m_model->index(KUrl(m_testDir->url().url() + 'c')); m_model->setExpanded(index, true); QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout)); diff --git a/src/tests/kitemlistcontrollertest.cpp b/src/tests/kitemlistcontrollertest.cpp index 47b2b8b759..2085dead61 100644 --- a/src/tests/kitemlistcontrollertest.cpp +++ b/src/tests/kitemlistcontrollertest.cpp @@ -210,7 +210,7 @@ void KItemListControllerTest::testKeyboardNavigation_data() groupingEnabledList.append(true); groupingEnabledNames[true] = "grouping enabled"; - foreach (KFileItemListView::ItemLayout layout, layoutList) { + foreach (const KFileItemListView::ItemLayout& layout, layoutList) { // The following settings depend on the layout. // Note that 'columns' are actually 'rows' in // Compact layout. @@ -249,8 +249,8 @@ void KItemListControllerTest::testKeyboardNavigation_data() } foreach (int columnCount, columnCountList) { - foreach (KItemListController::SelectionBehavior selectionBehavior, selectionBehaviorList) { - foreach (bool groupingEnabled, groupingEnabledList) { + foreach (const KItemListController::SelectionBehavior& selectionBehavior, selectionBehaviorList) { + foreach (bool groupingEnabled, groupingEnabledList) { // krazy:exclude=foreach QList > testList; // First, key presses which should have the same effect diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index ff5c2988a2..53f9b45bf8 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -1482,7 +1482,7 @@ KUrl::List DolphinView::simplifiedSelectedUrls() const KUrl::List urls; const KFileItemList items = selectedItems(); - foreach (const KFileItem &item, items) { + foreach (const KFileItem& item, items) { urls.append(item.url()); } @@ -1507,7 +1507,7 @@ void DolphinView::markPastedUrlsAsSelected(const QMimeData* mimeData) const KUrl::List sourceUrls = KUrl::List::fromMimeData(mimeData); KUrl::List destUrls; foreach (const KUrl& source, sourceUrls) { - KUrl destination(url().url() + "/" + source.fileName()); + KUrl destination(url().url() + '/' + source.fileName()); destUrls << destination; } markUrlsAsSelected(destUrls); diff --git a/src/views/viewproperties.cpp b/src/views/viewproperties.cpp index 96a00dc1dc..ff0c274bef 100644 --- a/src/views/viewproperties.cpp +++ b/src/views/viewproperties.cpp @@ -284,7 +284,7 @@ QList ViewProperties::visibleRoles() const roles.append("text"); // Iterate through all stored keys and append all roles that match to - // the curren view mode. + // the current view mode. const QString prefix = viewModePrefix(); const int prefixLength = prefix.length(); @@ -426,7 +426,7 @@ void ViewProperties::convertNameRoleToTextRole() { QStringList visibleRoles = m_node->visibleRoles(); for (int i = 0; i < visibleRoles.count(); ++i) { - if (visibleRoles[i].endsWith("_name")) { + if (visibleRoles[i].endsWith(QLatin1String("_name"))) { const int leftLength = visibleRoles[i].length() - 5; visibleRoles[i] = visibleRoles[i].left(leftLength) + "_text"; }