┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kfileitemmodelrolesupdater.cpp
AgeCommit message (Collapse)Author
2026-02-08kfileitemmodelrolesupdater: Disconnect change signal before changing dataKai Uwe Broulik
Avoids the item being considered dirty when *we* changed it. It is guarded in most places but wasn't done in the pixmap animation stuff causing the item considered dirty whenever hovering it.
2026-02-07Remove preview ignore maximum local size handling from DolphinKai Uwe Broulik
This all seems to be done by the PreviewJob in KIO already.
2026-02-04KFileItemModelRolesUpdater: Use mime type from preview job, if anyKai Uwe Broulik
The preview job does an async stat on the file, so we might as well use its information to determine the icon. Also only determine mime type in the final "ResolveAll" step since it will initially resolve roles but mime type isn't necessarily fast.
2026-01-22clang-tidy: avoid copy, use const referencesMéven Car
2026-01-07KFileItemModelRolesUpdater: Don't resolve mime type manuallyKai Uwe Broulik
It's no longer true that KIO preview would block. It spawns an asynchronous stat job if it needs to determine the mime type.
2025-05-14Check if the item supports sequencing before looking for sequence pixmapsAkseli Lahtinen
This patch checks the item first if the plugin it's using for it's previews even supports sequences. If not, we can then safely ignore the hover action for polling more sequences and avoid unnecessary work. The sequencing support is false by default, so we set it true only when we know it's possible.
2025-03-13KFileItemModelRolesUpdater: reset size and count before updating foldersAkseli Lahtinen
Folder count would not update properly when user would delete file from a folder, or add a new file to it. Previously when size value is set to -2 after update, the update will never be called again unless user presses F5. This change will instead reset that -2 to 0 whenever we are requesting for calculating directory sizes. We never updated the count when a file was deleted, so that has been added as well. This change also calculates the item counts from the processedAmount, which is the total amount of items we're processing. From there we remove the unwanted items and get the final count. For remote files, we set the count to -1 since we don't calculate them. BUG: 500502
2025-01-17Refactor Overlay HandlingMéven Car
Now all overlays icons in kitemviews are added in KStandardItemListWidget::updatePixmapCache. data[iconOverlays] now contains icon names. DolphinFileItemListWidget::refreshCache is the sole responsible of setting the overlays either coming from KFileItemModelRolesUpdater or KVersionControlPlugin. This garantees consistency in rendering. BUG: 497372
2025-01-11KFileItemModelRolesUpdater: add utility cacheSize functionMéven Car
2025-01-11KFileItemModelRolesUpdater: Show emblems even in hover sequenceMéven Car
2025-01-11Icons: when adding overlays pass in the output sizeMéven Car
Instead of the pixmap size that won't be accurate. It allow KGuiAddons::addOverlays to draw larger images to add overlays. Consequently the emblems are not longer dependant scaled based on the pixmap aspect ratio. BUG: 498211
2025-01-09information panel: scale according dprMéven Car
Also use dpr for icons. Amends cebcf8db BUG: 497576
2024-12-19dolphinview: Update thumbnail on filename changeAkseli Lahtinen
If filename of an item was updated previously, it would modify the model before the file was actually changed. This led to the model calling a signal that would try to run a previewjob, but since the filename is not actually changed yet on disk, it would fail. This patch moves the model updating after copyjob. Copyjob will take care of the file renaming if there is already existing file. We just need to update the model correctly after the job has succeeded. BUG:497555
2024-07-27Port from KIconLoader::drawOverlays to KIconUtils::addOverlaysNicolas Fella
The latter is what most other projects use
2024-03-07Add option to completely disable directory size countingNico Kreipke
Dolphin shows the size of directories by listing their contents, which for some users might cause unwanted load on the file system. Depending on the size of the subdirectories in question and how the storage is accessed, this might cause noticeable delays and even freezing. This commit adds a new option under "View -> Content Display" that enables users to set "Folder size:" to "No size", completely disabling directory size counting. Directory size counting is still enabled by default. As a third option for "Folder size" is added, the DirectorySizeCount boolean setting is replaced with a DirectorySizeMode enum setting. The old setting is migrated using a kconf_update script. FEATURE: 477187 GUI:
2024-01-23Slightly refactor count resortingFelix Ernst
The bug fix 8f043b2958477d3fe2ef094b7e42f792f4cf0b02 introduced a secondary code path to trigger a resort of items. However, the previous way to trigger it only required a small bug fix to work and gives us a couple of optimisations for free. This commit removes the secondary code path and fixes the primary one. CCBUG: 473999
2024-01-20rolesupdater: set isExpandable to false when dir is emptyMéven Car
Signed-off-by: Méven Car <[email protected]>
2023-12-26Do not rely on KIO source-code compat codeAlexander Lohnau
2023-12-15Resort directory size count after refreshingAkseli Lahtinen
After refreshing the view when size count is selected as the sortRole, count is 0 at first. When the actual count is loaded, the sorting is done according to the count being 0. This can break the sort order and cause view and model to be out of sync. Making sure we always resort all items when the directory size/item count is changed fixes this BUG:473999
2023-12-08Do not reset expandability when loading previewsAkseli Lahtinen
Fixes a weird bug with the treeview if one has ``` [PreviewSettings] Plugins=audiothumbnail ``` in their `dolphinrc`. It can be any PreviewSettings plugin, as long as there it at least one. Check the bug report for more, but in short, the bug is reproducible like this: ``` create folder tree inside a test folder with mkdir -p 1/A/B/C/D/E/F/G/H/I mkdir -p 2/A/B/C/D/E/F/G/H/I mkdir -p 3/A/B/C/D/E/F/G/H/I make sure you see the test folder, and expand it expand folder 1, no need to expand all sub folders expand folder 2 collapse and expand test folder 3 loses its expansion arrow if all folders are expanded, only 3 keeps its order if 1 and all its subfolders are expanded, then test is toggled, folder 2 also loses its expansion arrow ``` Video of the bug: ![Screencast_20231207_112700](/uploads/4fad2a62a5a9a67760fa7faa8e3bec40/Screencast_20231207_112700.webm) The path to the bug is: `KFileItemModelRolesUpdater::slotPreviewFailed` -> `KFileItemModelRolesUpdater::applyResolvedRoles` -> `KFileItemModelRolesUpdater::rolesData` -> `KFileItemModelRolesUpdater::startDirectorySizeCounting`. This causes Dolphin with preview plugins enabled trying to count the directories again, and the data gets reset even if there is something there. This then resets the `isExpandable` flag and that breaks the treeview, causing all kinds of issues, like being able to expand non-directories and makes things out of sync. BUG:477607
2023-12-08Do not cache indexes across async tasksDavid Edmundson
Capturing an index is unsafe as it could be out of date when this is processed. The user could have changed directory inserted a file or changed sorting order.
2023-11-21Create thumbnails with scene devicePixelRatioKai Uwe Broulik
2023-11-08Adapt to KConfigGroup name officially being a QString typeFriedrich W. H. Kossebau
GIT_SILENT
2023-09-10Replace qAsConst with std::as_constMéven Car
2023-08-23Merge branch 'master' into kf6Méven Car
2023-08-13Don't compute size for non-local urlsMéven Car
Hide progressInfo for listDir job on the non-recursize path. BUG: 472912
2023-07-08Fix plugin queryNicolas Fella
QT_MAJOR_VERSION is undefined, the proper thing is QT_VERSION_MAJOR This causes the plugin query to not find any plugins Since we only target KF6 we might as well hardcode that
2023-07-05Merge branch 'master' into kf6Nicolas Fella
2023-07-05Add explicit moc includes to sources for moc-covered headersFriedrich W. H. Kossebau
* speeds up incremental builds as changes to a header will not always need the full mocs_compilation.cpp for all the target's headers rebuild, while having a moc file sourced into a source file only adds minor extra costs, due to small own code and the used headers usually already covered by the source file, being for the same class/struct * seems to not slow down clean builds, due to empty mocs_compilation.cpp resulting in those quickly processed, while the minor extra cost of the sourced moc files does not outweigh that in summary. Measured times actually improved by some percent points. (ideally CMake would just skip empty mocs_compilation.cpp & its object file one day) * enables compiler to see all methods of a class in same compilation unit to do some sanity checks * potentially more inlining in general, due to more in the compilation unit * allows to keep using more forward declarations in the header, as with the moc code being sourced into the cpp file there definitions can be ensured and often are already for the needs of the normal class methods
2023-06-28Merge branch 'master' into kf6Méven Car
2023-06-13Settings Add ViewModes > Content displayMéven Car
This does not move the settings location in files though. baby step for https://invent.kde.org/system/dolphin/-/issues/36
2023-05-26KDirectoryContentsCounter: show intermediate dir size counting results, ↵Méven Car
improve stopping, improve data caching Two user visible changes: * we can see the dir size changing as it is updated. * This makes the file counting a lot more reactive, when changing directories for instance. `KDirectoryContentsCounterWorker::walkDir` is not recursive anymore. The cache is now shared and only a single thread is used to count size recursively.
2023-05-10Add a TODO KF6 to solve bug 464722Méven Car
CCBUG: 464722
2023-05-08Merge branch 'master' into kf6Méven Car
2023-05-07Port to Qt6Méven Car
2023-04-29KFileItemModelRolesUpdater: test isSlow in `startDirectorySizeCounting`Méven Car
NO_CHANGELOG
2023-02-15Allow empty metadata for KOverlayIconPluginAlexander Lohnau
We do not read the metadata anywhere, consequently we can allow empty metadata. Consumers now don't have to provide a file and we do no spend time parsing the JSON. Task: https://phabricator.kde.org/T14538
2023-02-12Optimize Directory size countingMéven Car
Two changes: * Prioritise size counting for visible path * stop the worker when switching dirs
2023-02-09KFileItemModelRolesUpdater: Skip directory item count if it isSlow()Andrew Gunnerson
This makes the behavior of kernel cifs/nfs mounts the same as with kio's smb://. It also helps reduce the chance of the UI hanging due to opendir/readdir slowing down stat calls on the UI thread. Signed-off-by: Andrew Gunnerson <[email protected]>
2023-02-05Add clang-format and format code as in FrameworksSerg Podtynnyi
2022-10-11don't use const'ref here (found by clazy)Laurent Montel
2022-10-11Use std::chrono_literalsLaurent Montel
2022-09-26Remove unused includesLaurent Montel
2022-08-15Don't include `iconOverlays` in rolesData if it is emptyKai Uwe Broulik
If this role isn't in the model yet, it would be `QVariant::Invalid` which is obviously a distinct type from an empty string list. This means `KFileItemModel::setData` treats them non-equal and potentially does expensive operations on the model, which is called every time a role is resolved in `KFileItemModelRolesUpdater`. With this change, the number of pointless layout calculations is significantly reduced.
2022-06-15Use cmakedefine01Ahmad Samir
This way we get a build time warning if the var isn't defined at all, e.g. a missing check_include_files() CMake call.
2022-06-11Fix install/load plugins from kf<version>Laurent Montel
2022-04-26Add the ability to sort by file extensionEugene Popov
Currently, Dolphin doesn't have the ability to sort by file extension (sorting by type means that files will be sorted by mimetype but not by extension). This MR fixes this shortcoming. BUG: 429579
2022-02-02Don't set ignoreMaximumSize on preview jobs for slow filesBharadwaj Raju
With this change (plus https://invent.kde.org/frameworks/kio/-/merge_requests/702), slow files will be treated as remote files for generating previews. This should make browsing local mounts of remote locations smoother.
2021-12-01Port away from deprecated KPluginLoaderAlexander Lohnau
2021-11-23KFileItemModelRolesUpdater: Generate thumbnails for visible files firstKai Uwe Broulik
Folder thumbnails are not cached as we cannot know whether something inside a folder changed. Moreover, they are also a collage of several files and might even traverse into subdirectories. This takes time.