Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/kdirmodel.cpp
Show First 20 Lines • Show All 1073 Lines • ▼ Show 20 Line(s) | |||||
1074 | { | 1074 | { | ||
1075 | if (!index.isValid()) { | 1075 | if (!index.isValid()) { | ||
1076 | return d->m_dirLister->rootItem(); | 1076 | return d->m_dirLister->rootItem(); | ||
1077 | } else { | 1077 | } else { | ||
1078 | return static_cast<KDirModelNode *>(index.internalPointer())->item(); | 1078 | return static_cast<KDirModelNode *>(index.internalPointer())->item(); | ||
1079 | } | 1079 | } | ||
1080 | } | 1080 | } | ||
1081 | 1081 | | |||
1082 | #ifndef KIOWIDGETS_NO_DEPRECATED | | |||
1083 | QModelIndex KDirModel::indexForItem(const KFileItem *item) const | 1082 | QModelIndex KDirModel::indexForItem(const KFileItem *item) const | ||
1084 | { | 1083 | { | ||
1085 | // Note that we can only use the URL here, not the pointer. | 1084 | // Note that we can only use the URL here, not the pointer. | ||
1086 | // KFileItems can be copied. | 1085 | // KFileItems can be copied. | ||
1087 | return indexForUrl(item->url()); // O(n) | 1086 | return indexForUrl(item->url()); // O(n) | ||
1088 | } | 1087 | } | ||
1089 | #endif | | |||
1090 | 1088 | | |||
1091 | QModelIndex KDirModel::indexForItem(const KFileItem &item) const | 1089 | QModelIndex KDirModel::indexForItem(const KFileItem &item) const | ||
1092 | { | 1090 | { | ||
1093 | // Note that we can only use the URL here, not the pointer. | 1091 | // Note that we can only use the URL here, not the pointer. | ||
1094 | // KFileItems can be copied. | 1092 | // KFileItems can be copied. | ||
1095 | return indexForUrl(item.url()); // O(n) | 1093 | return indexForUrl(item.url()); // O(n) | ||
1096 | } | 1094 | } | ||
1097 | 1095 | | |||
▲ Show 20 Lines • Show All 213 Lines • Show Last 20 Lines |