┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kfileitemmodel.cpp
AgeCommit message (Collapse)Author
2013-08-15Merge remote-tracking branch 'origin/KDE/4.11'Frank Reininghaus
2013-08-15Make sure that the sort order is correct after renamingFrank Reininghaus
KFileItemModel::setData() should not only cause a resorting when the sort role is changed. The name is always used as a fallback if the sort role of multiple files is equal, therefore, renaming a file can change the correct order of the files even if the files are not sorted by "name". Unit test included. BUG: 323518 FIXED-IN: 4.11.1 REVIEW: 111721
2013-08-14Do not store default values in QHash<QByteArray, QVariant>Frank Reininghaus
Storing values which are equivalent to default-constructed QVariants does not make much sense because QHash::value returns the same value even if the corresponding key is not found in the hash. This commit reduces Dolphin's memory consumption in large folders by up to 7.3% (tested a folder with 100,000 files in Details View) and reduces the time required for loading a folder. BUG: 323517 FIXED-IN: 4.11.1 REVIEW: 111922
2013-08-04Introduce a new signal "groupsChanged"Frank Reininghaus
Sometimes when items are renamed, the order of the items in the directory is not affected, but the groups still change (simple example: with files a, b, c, e, rename "c" to "d"). At the moment, we always emit the itemsMoved signal in such a case to make sure that the view is updated. However, it would be preferable if this signal was not emitted because it can trigger some quite expensive operations which are not needed at all. This commit introduces a new signal groupsChanged and modifies KFileItemModel and KItemListView such that these classes make use of it. Some unit tests for the new functionality are included as well. Thanks to Emmanuel Pescosta for finding a latent bug in the code which was triggered by this change and fixed in 998954db6d53999dfa75d380cbb4ca3111589f66. REVIEW: 111808
2013-07-28Do not convert a KUrl to a QString and back againFrank Reininghaus
This small change saves a lot of CPU cycles when the items are resorted. REVIEW: 111700
2013-06-28Fix memory leak in KFileItemModelFrank Reininghaus
Since m_pendingItemsToInsert is a list of pointers now (and not a list of KFileItems, as in the 4.10 branch), we have to delete all pointers when clearing or destroying the model. I think that no review request is necessary for this small and obvious change. CCMAIL: [email protected]
2013-06-26Re-enable expandable folders for network top level folders (remote:/)Emmanuel Pescosta
Added a hash table for target url to url mapping. So when the dir lister sends us the target url as directory url, we can use the url mapping table to get the right "Dolphin internal" directory url, which is the non-target url. BUG: 306219 FIXED-IN: 4.11.0 REVIEW: 111252
2013-06-26Fix performance regression when loading folders in Details ViewFrank Reininghaus
When using Details View, only insert all pending items immediately if new items are inserted which might be children of a pending item. Fixes the problem that inserting the items in multiple bunches slows down the folder loading. Note that the cause of the slowness when inserting in multiple bunches is that KItemListSizeHintResolver needs O(N^2) time in the worst case for inserting N items into a model with N existing ones. REVIEW: 111226
2013-06-24Merge remote-tracking branch 'origin/KDE/4.10'Frank Reininghaus
2013-06-24Use the target url of a item when creating the QMimeData in ↵Emmanuel Pescosta
KFileItemModel::createMimeData. BUG: 307336 FIXED-IN: 4.10.5 REVIEW: 111209
2013-06-20Avoid a unnecessary resorting when items are changed, only resort the items ↵Emmanuel Pescosta
when the sorting role value is changed. BUG: 299565 FIXED-IN: 4.11 REVIEW: 111146
2013-06-20Merge remote-tracking branch 'origin/KDE/4.10'Dawit Alemayehu
2013-06-18Ensure that the "Sort by Type" setting is respectedFrank Reininghaus
Before this commit, switching from, e.g., "Sort by Name" to "Sort by Type" sometimes had no effect until the view was refreshed. The problem was that the re-sorting was triggered before the type information was actually added to the model. BUG: 310705 BUG: 312014 FIXED-IN: 4.10.5 REVIEW: 111004
2013-06-05Reduce KFileItemModel memory usage by making use of implicit sharingFrank Reininghaus
The idea is based on http://milianw.de/blog/katekdevelop-sprint-vienna-2012-take-1 REVIEW: 110686
2013-05-22Merge remote-tracking branch 'origin/KDE/4.10'Frank Reininghaus
2013-05-22KFileItemModel::insertItems(): guarantee O(N) run time complexityFrank Reininghaus
This commit prevents repeated insertions of single items into the list m_itemData, which shift all following items by one position and result in O(N^2) worst case complexity for the entire function. Moreover, the hash m_items is updated only for the items starting from the first inserted/removed item to save some superfluous calculations of hash values. REVIEW: 110355
2013-05-22Do not reset the 'isExpanded' state when an expanded folder is refreshedFrank Reininghaus
If an item is moved out of an expanded folder, the model receives the dir lister's refreshItems signal for the folder. The method retrieveData() then updates the folder's properties. This commit makes sure that the 'isExpanded' state is not touched by retrieveData(). A side-effect is that the 'isExpanded' role is not initialized to 'false', but this does not matter because trying to read a non-existing role from the QHash<QByteArray, QVariant> yields a default-constructed QVariant, which evaluates to 'false'. BUG: 299675 FIXED-IN: 4.10.4 REVIEW: 110401
2013-03-27Merge remote-tracking branch 'origin/KDE/4.10'Luca Beltrame
Conflicts: plasma/applets/folderview/folderview.cpp
2013-03-26Improve grouping by name for non-ASCII file namesFrank Reininghaus
This commit prevents that all non-ASCII letters which are not umlauts are grouped in a single group "Others", and that the joint group of an ASCII letter and the associated umlaut in some locales is called "Others" if there is only the umlaut in the group. BUG: 315569 REVIEW: 109457 FIXED-IN: 4.10.2
2013-03-21Merge remote-tracking branch 'origin/KDE/4.10'Aurélien Gâteau
@emmanuel: this merge includes your fix from https://git.reviewboard.kde.org/r/109488/ . I assume this is not a problem. CCMAIL: [email protected]
2013-03-17Refresh all expanded directories too, when reloading a directory.Emmanuel Pescosta
BUG: 295300 FIXED-IN: 4.10.2 REVIEW: 109488
2013-03-15Improve handling of filtered items when folders are deleted/collapsedFrank Reininghaus
If an expanded folder with filtered children is collapsed or removed, and the parent-child relationship cannot be determined by parsing the URLs, this patch makes sure that the filtered children do not reappear when the filter bar is cleared. REVIEW: 109455
2013-03-12Fix recent regressions when "Sort by Type" is usedFrank Reininghaus
This commit ensures that the mime types and icons are determined synchronously for 200 ms when "Sort by Type" is enabled. REVIEW: 109344
2013-03-10Merge remote-tracking branch 'origin/KDE/4.10'Frank Reininghaus
Conflicts: dolphin/src/kitemviews/kfileitemmodel.cpp
2013-03-10Remove filtered children if the parent folder is collapsedFrank Reininghaus
This is analogous to commit e053ecdcd57cc39fdcbc314fc8dd22c8b9dbdd4f, which fixes the same problem for the case that the parent folder is deleted. BUG: 316335 FIXED-IN: 4.10.2 REVIEW: 109343
2013-03-03Use a consistent way to group files by "Date"Daniel Kreuter
Before this change, files were grouped by calendar weeks if they were modified in the current month and ignoring the "first week day setting", but by the actual distance measured in multiples of seven days if the were modified last month. This not only fixes the "ignores first week day" bug, but also the problem that the inconsistencies in the algorithm could lead to a broken grouping in the first days of a month (see screenshot in the review request). BUG: 181337 FIXED-IN: 4.11 REVIEW: 108667
2013-02-27Removed everything related to m_expandedParentsCountRoot ->Emmanuel Pescosta
This concept is not needed anymore because of the new "determine parents and expansion levels" approach Side effect: Enables treeview for trash, ... REVIEW: 109191
2013-02-27Big Thanks to Frank Reininghaus, who helped me a lot with theseEmmanuel Pescosta
changes! :) * Fixed the "Network browser" and "timeline" issues, by using the KDirLister's itemsAdded(KUrl,KFileItemList) signal -> Use the given Url to define the parent-child relationship. * Changed the name of the slot "slotNewItems" to "slotItemsAdded" for consistency with the signal. * Use a QHash<KFileItem, ItemData*> instead of a QSet<KFileItem> to store the filtered data (needed to keep the O(1) lookup for filtered KFileItems in slotItemsDeleted + needed to fix bug 311912 "After erasing a filter, some thumbnails randomly disappear") * Made the determination of the "expandedParentsCount" slightly simpler - just adding 1 to the parent's level (Also needed to fix the "Network browser" and "timeline" issues) FIXED-IN: 4.11.0 REVIEW: 109180 BUG: 304565 BUG: 311912 BUG: 312890 BUG: 315593
2013-02-19Merge remote-tracking branch 'origin/KDE/4.10'Frank Reininghaus
Conflicts: dolphin/src/tests/kfileitemmodeltest.cpp lib/konq/konq_operations.cpp
2013-02-18Remove items from m_filteredItems if their parent is deletedFrank Reininghaus
Fixes the problem that filtered children of expanded deleted folders reappear if the filter is cleared. BUG: 315210 FIXED-IN: 4.10.1 REVIEW: 108976
2013-02-10Re-organize the code that compares expanded itemsFrank Reininghaus
The previous approach, which was based on comparing the URLs as strings, was not only very complex, but also could lead to inconsistencies in the model, namely, that not all children were removed from the model when the dir lister reported the parent as deleted. Later on, this could even lead to a crash. BUG: 311947 FIXED-IN: 4.11 REVIEW: 108766
2013-02-10Include parent-child relationships in KFileItemModel's consistency checkFrank Reininghaus
2013-02-06KFileItemModel::insertItems(): reserve sufficient space for m_itemsFrank Reininghaus
This prevents expensive and unnecessary repeated rehashing when many items are inserted into the model.
2013-02-03Two small optimizations in KFileItemModel::removeItems()Frank Reininghaus
1. It seems that it really can happen that KFileItems that we get from the dir lister's itemsDeleted signal are not in the model any more, e.g., if a folder where hidden files are shown is left and a folder where hidden files are not shown is entered. There is no need to output warnings then. 2. Remove the emptiness-check for the KFileItemList at the beginning. Even in the unlikely event that we do get an empty list, we return just a few lines later in the code.
2013-02-03const QList<int> -> const QList<int>&Frank Reininghaus
2013-01-29Fix crashes in KFileItemModel::removeItems()Frank Reininghaus
These crashes were caused by the recent commit ff3267c6dcd0f6d0621b3a96b5462a9581a03883. It introduced two problems: a) A logic error in the code that removes the ItemData pointers from m_itemData that could cause crashes if multiple item ranges are removed, and there were un-removed items behind the last one. b) The implicit assumption that any call of removeItems() will actually result in items being removed in the model. This is incorrect if the model is first cleared and then the hidden-files setting is modified, which happens if "Save view properties for each folder" is enabled, and a folder where hidden files are shown is left. In that case, the dir lister emits itemsDeleted for the hidden items after they have been removed from the model due to the folder change. I'll add a unit test covering these issues soon. Many thanks to Romário Rios and Hrvoje Senjan for testing! BUG: 314046
2013-01-27Move the consistency check for KFileItemModel from the test to the classFrank Reininghaus
This makes it possible to check the model's consistency also in other places, e.g., in KFileItemModel's benchmark.
2013-01-27Performance improvements in KFileItemModel::removeItems()Frank Reininghaus
The performance of this method is improved by: a) Not removing items one by one, but doing it in a way that minimizes the number of moves to prevent O(N^2) worst-case complexity. b) Not sorting the removed items using the potentially extremely slow KFileItemModel::lessThan. We can get the indexes of the removed items very easily from the hash m_items, and sorting ints is a lot faster. c) Preventing repeated rehashing of m_items when removing the deleted URLs by replacing remove() by erase(). REVIEW: 108540
2013-01-15Re-organise the sorting codeFrank Reininghaus
The KFileItemModel-specific parts are now separated from the generic ones, like the parallel sorting implementation. REVIEW: 108386
2013-01-04autoupdate is on by default, remove unnecessary callsDavid Faure
2013-01-03Fix crash when browsing bluetooth device.Michael Jansen
When trying to browse a N900 it crashed here because pathA was empty. Which lead to index = maxIndex beeing -1 and pathA.at(index) crashing. Reorder the while condition to prevent that courtesy of tsdgeos. (cherry picked from commit f0c90a47de3f59e4a98932ae6f0499921d9aa899)
2012-12-30Fix crash when browsing bluetooth device.Michael Jansen
When trying to browse a N900 it crashed here because pathA was empty. Which lead to index = maxIndex beeing -1 and pathA.at(index) crashing. Reorder the while condition to prevent that courtesy of tsdgeos.
2012-10-29Fix Bug 153984 - Clicking cancel on the authentication dialog for ↵Emmanuel Pescosta
fish/sftp/ftp kioslave gets dolphin stuck on "Loading folder" BUG: 153984 REVIEW: 107116
2012-09-29Find out the main window by calling the parent widget's window() memberFrank Reininghaus
KFileItemModel calls the dir lister's setMainWindow() method to make sure that the dir lister caches authentication data. However, the method used to determine the main window (qApp->activeWindow()) is not guaranteed to yield the DolphinMainWindow or the KonqMainWindow. In particular, if "Split View" is enabled in Dolphin's settings dialog, the active window is the dialog, and when it is closed, any later access to the stored pointer leads to a crash. A better method is to verify that the model's parent is a QWidget and then use this widget's window(). I had to make a small modification in DolphinMainWindow to make sure that it also works correctly when the view is split (the new view container had been created with a 0 parent previously). I tested it in Dolphin and Konqueror and verified that the "main window" passed to the dir lister is really the application's main window. BUG: 306459 FIXED-IN: 4.9.3
2012-09-05Implemented the new KParts' listing filter extension, ↵Dawit Alemayehu
KParts::ListingFilterExtension. REVIEW: 106289
2012-08-24Fix regression that caused "(I18N_EMPTY_MESSAGE)" sub menus in menusFrank Reininghaus
For top-level roles like "Name" and "Size", the group translation is 0. In that case, the "group" member of the corresponding RoleInfo struct must be an empty string. This is expected by the code which generates Dolphin's menus, which group the top-level roles into a sub menu with the name "(I18N_EMPTY_MESSAGE)" otherwise. This is a recent regression caused by 199fabbaa8d8a12fb49e4c9922c38ec8b033923c. Thanks to Christoph Feck for investigating this issue! CCBUG: 305228
2012-08-16Fix translations not showing in the Sort by and Additional Information submenusAlbert Astals Cid
Acked by Frank REVIEW: 106049 BUGS: 305228 FIXED-IN: 4.9.1
2012-06-13Fix regression: Open file if entering it in the URL-navigatorPeter Penz
The regression has been introduced when hiding the DolphinDirLister inside KFileItemModel. Now the signal urlIsFileError() gets forwarded to the container again where the file will be opened. BUG: 301757 FIXED-IN: 4.9.0
2012-06-08Krazy fixesPeter Penz
2012-06-08Inline renaming fixesPeter Penz
- Don't use an outdated KFileItem when renaming an item more than once - Use the same font as the view - Don't lose the focus when an editor-popup is shown BUG: 299327 BUG: 298883 BUG: 301253 FIXED-IN: 4.9.0