Changeset View
Changeset View
Standalone View
Standalone View
src/kitemviews/kfileitemmodel.h
Show First 20 Lines • Show All 350 Lines • ▼ Show 20 Line(s) | 283 | private: | |||
---|---|---|---|---|---|
351 | * @return Role-byte-array for the given role-type. | 351 | * @return Role-byte-array for the given role-type. | ||
352 | * Runtime complexity is O(1). | 352 | * Runtime complexity is O(1). | ||
353 | */ | 353 | */ | ||
354 | QByteArray roleForType(RoleType roleType) const; | 354 | QByteArray roleForType(RoleType roleType) const; | ||
355 | 355 | | |||
356 | QHash<QByteArray, QVariant> retrieveData(const KFileItem& item, const ItemData* parent) const; | 356 | QHash<QByteArray, QVariant> retrieveData(const KFileItem& item, const ItemData* parent) const; | ||
357 | 357 | | |||
358 | /** | 358 | /** | ||
359 | * @return True if role values benefit from natural or case insensitive sorting. | ||||
360 | */ | ||||
361 | static bool isRoleValueNatural(const RoleType roleType); | ||||
362 | | ||||
363 | /** | ||||
359 | * @return True if \a a has a KFileItem whose text is 'less than' the one | 364 | * @return True if \a a has a KFileItem whose text is 'less than' the one | ||
360 | * of \a b according to QString::operator<(const QString&). | 365 | * of \a b according to QString::operator<(const QString&). | ||
361 | */ | 366 | */ | ||
362 | static bool nameLessThan(const ItemData* a, const ItemData* b); | 367 | static bool nameLessThan(const ItemData* a, const ItemData* b); | ||
363 | 368 | | |||
364 | /** | 369 | /** | ||
365 | * @return True if the item-data \a a should be ordered before the item-data | 370 | * @return True if the item-data \a a should be ordered before the item-data | ||
366 | * \b. The item-data may have different parent-items. | 371 | * \b. The item-data may have different parent-items. | ||
▲ Show 20 Lines • Show All 132 Lines • ▼ Show 20 Line(s) | 467 | private: | |||
499 | 504 | | |||
500 | friend class KFileItemModelRolesUpdater; // Accesses emitSortProgress() method | 505 | friend class KFileItemModelRolesUpdater; // Accesses emitSortProgress() method | ||
501 | friend class KFileItemModelTest; // For unit testing | 506 | friend class KFileItemModelTest; // For unit testing | ||
502 | friend class KFileItemModelBenchmark; // For unit testing | 507 | friend class KFileItemModelBenchmark; // For unit testing | ||
503 | friend class KFileItemListViewTest; // For unit testing | 508 | friend class KFileItemListViewTest; // For unit testing | ||
504 | friend class DolphinPart; // Accesses m_dirLister | 509 | friend class DolphinPart; // Accesses m_dirLister | ||
505 | }; | 510 | }; | ||
506 | 511 | | |||
512 | inline bool KFileItemModel::isRoleValueNatural(RoleType roleType) | ||||
cfeck: The name of the function is confusing. Maybe 'isStringRole()', 'isTextualRole()', or… | |||||
513 | { | ||||
514 | return (roleType == TypeRole || | ||||
515 | roleType == TagsRole || | ||||
516 | roleType == CommentRole || | ||||
517 | roleType == TitleRole || | ||||
518 | roleType == ArtistRole || | ||||
519 | roleType == GenreRole || | ||||
520 | roleType == AlbumRole || | ||||
521 | roleType == PathRole || | ||||
522 | roleType == DestinationRole || | ||||
523 | roleType == OriginUrlRole || | ||||
524 | roleType == OwnerRole || | ||||
525 | roleType == GroupRole); | ||||
526 | } | ||||
527 | | ||||
507 | inline bool KFileItemModel::nameLessThan(const ItemData* a, const ItemData* b) | 528 | inline bool KFileItemModel::nameLessThan(const ItemData* a, const ItemData* b) | ||
508 | { | 529 | { | ||
509 | return a->item.text() < b->item.text(); | 530 | return a->item.text() < b->item.text(); | ||
510 | } | 531 | } | ||
511 | 532 | | |||
512 | | ||||
513 | inline bool KFileItemModel::isChildItem(int index) const | 533 | inline bool KFileItemModel::isChildItem(int index) const | ||
514 | { | 534 | { | ||
515 | if (m_itemData.at(index)->parent) { | 535 | if (m_itemData.at(index)->parent) { | ||
516 | return true; | 536 | return true; | ||
517 | } else { | 537 | } else { | ||
518 | return false; | 538 | return false; | ||
519 | } | 539 | } | ||
520 | } | 540 | } | ||
521 | 541 | | |||
522 | #endif | 542 | #endif | ||
523 | 543 | | |||
524 | 544 | |
The name of the function is confusing. Maybe 'isStringRole()', 'isTextualRole()', or 'roleNeedsStringSort()' ?