mirror of
https://invent.kde.org/system/dolphin
synced 2024-11-05 18:47:12 +00:00
Krazy fixes
This commit is contained in:
parent
98a4aa10ef
commit
b2f5de9744
14 changed files with 34 additions and 34 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 <libdolphin_export.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);
|
||||
|
|
|
@ -79,9 +79,9 @@ QHash<QByteArray, QVariant> 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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 = '/';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -419,7 +419,7 @@ void KFileItemModelTest::testExpandItems()
|
|||
|
||||
// Store the URLs of all folders in a set.
|
||||
QSet<KUrl> 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>() << KUrl(m_testDir->name() + "a"));
|
||||
QCOMPARE(m_model->expandedDirectories(), QSet<KUrl>() << KUrl(m_testDir->name() + 'a'));
|
||||
|
||||
QCOMPARE(spyInserted.count(), 1);
|
||||
KItemRangeList itemRangeList = spyInserted.takeFirst().at(0).value<KItemRangeList>();
|
||||
|
@ -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>() << KUrl(m_testDir->name() + "a") << KUrl(m_testDir->name() + "a/a"));
|
||||
QCOMPARE(m_model->expandedDirectories(), QSet<KUrl>() << KUrl(m_testDir->name() + 'a') << KUrl(m_testDir->name() + "a/a"));
|
||||
|
||||
QCOMPARE(spyInserted.count(), 1);
|
||||
itemRangeList = spyInserted.takeFirst().at(0).value<KItemRangeList>();
|
||||
|
@ -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<KItemRangeList>();
|
||||
|
@ -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));
|
||||
|
||||
|
|
|
@ -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<QPair<KeyPress, ViewState> > testList;
|
||||
|
||||
// First, key presses which should have the same effect
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -284,7 +284,7 @@ QList<QByteArray> 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";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue