#include "kitemviews/private/kfileitemmodelfilter.h"
#include <KFileItem>
+#include <KLazyLocalizedString>
#include <QCollator>
#include <QHash>
#include <functional>
-class KFileItemModelDirLister;
+class KDirLister;
+
class QTimer;
+namespace KIO {
+ class Job;
+}
+
/**
* @brief KItemModelBase implementation for KFileItems.
*
void slotRefreshItems(const QList<QPair<KFileItem, KFileItem> >& items);
void slotClear();
void slotSortingChoiceChanged();
+ void slotListerError(KIO::Job *job);
void dispatchPendingItemsToInsert();
enum RoleType {
// User visible roles:
NoRole, NameRole, SizeRole, ModificationTimeRole, CreationTimeRole, AccessTimeRole, PermissionsRole, OwnerRole,
- GroupRole, TypeRole, DestinationRole, PathRole, DeletionTimeRole,
+ GroupRole, TypeRole, ExtensionRole, DestinationRole, PathRole, DeletionTimeRole,
// User visible roles available with Baloo:
- CommentRole, TagsRole, RatingRole, WidthRole, HeightRole, ImageDateTimeRole, OrientationRole,
- WordCountRole, TitleRole, LineCountRole, ArtistRole, GenreRole, AlbumRole, DurationRole, TrackRole, ReleaseYearRole,
+ CommentRole, TagsRole, RatingRole, DimensionsRole, WidthRole, HeightRole, ImageDateTimeRole, OrientationRole,
+ WordCountRole, TitleRole, AuthorRole, LineCountRole, ArtistRole, GenreRole, AlbumRole, DurationRole, TrackRole, ReleaseYearRole,
BitrateRole, OriginUrlRole, AspectRatioRole, FrameRateRole,
// Non-visible roles:
IsDirRole, IsLinkRole, IsHiddenRole, IsExpandedRole, IsExpandableRole, ExpandedParentsCountRole,
enum RemoveItemsBehavior {
KeepItemData,
- DeleteItemData
+ DeleteItemData,
+ DeleteItemDataIfUnfiltered
};
void insertItems(QList<ItemData*>& items);
{
const char* const role;
const RoleType roleType;
- const char* const roleTranslationContext;
- const char* const roleTranslation;
- const char* const groupTranslationContext;
- const char* const groupTranslation;
+ const KLazyLocalizedString roleTranslation;
+ const KLazyLocalizedString groupTranslation;
const bool requiresBaloo;
const bool requiresIndexer;
};
*/
bool isConsistent() const;
+ /**
+ * Filters out the expanded folders that don't pass the filter themselves and don't have any filter-passing children.
+ * Will update the removedItemRanges arguments to include the parents that have been filtered.
+ * @returns the number of parents that have been filtered.
+ * @param removedItemRanges The ranges of items being deleted/filtered, will get updated
+ * @param parentsToEnsureVisible Parents that must be visible no matter what due to being ancestors of newly visible items
+ */
+ int filterChildlessParents(KItemRangeList &removedItemRanges, const QSet<ItemData *> &parentsToEnsureVisible = QSet<ItemData *>());
+
private:
- KFileItemModelDirLister* m_dirLister;
+ KDirLister *m_dirLister = nullptr;
QCollator m_collator;
bool m_naturalSorting;
inline bool KFileItemModel::isRoleValueNatural(RoleType roleType)
{
return (roleType == TypeRole ||
+ roleType == ExtensionRole ||
roleType == TagsRole ||
roleType == CommentRole ||
roleType == TitleRole ||