Diffusion KIO 0ba76d410a7c

KFileItem: call stat() on demand, add SkipMimeTypeDetermination option

Authored by hoffmannrobert on Mar 30 2019, 2:20 PM.

Description

KFileItem: call stat() on demand, add SkipMimeTypeDetermination option

Summary:
This changes the initialization of KFileItem. Constructors won't call init() which might do an unnecessary QT_LSTAT/stat() system call. Instead, only if a method which needs the information from stat() is called, init() and stat() are run.

In addition this adds a KFileItem constructor for passing an enum MimeTypeDetermination parameter. If set to SkipMimeTypeFromContent,
KFileItem::isDir(), KFileItem::determineMimeType() (via isDir()), KFileItem::currentMimeType() and KFileItem::iconName() (via isDir()) won't call init(), QT_LSTAT or read the file.

See also https://phabricator.kde.org/D19784

Reviewers: dfaure, Frameworks, Dolphin

Reviewed By: dfaure

Subscribers: kde-frameworks-devel

Tags: Frameworks

Differential Revision: https://phabricator.kde.org/D19887

Details

Committed
dfaureMar 30 2019, 2:34 PM
Reviewer
dfaure
Differential Revision
D19887: KFileItem: call stat() on demand, add SkipMimeTypeDetermination option
Parents
R241:be91103d9114: GIT_SILENT autotests: add comment
Branches
Unknown
Tags
Unknown