┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/tests/kfileitemmodeltest.cpp
AgeCommit message (Collapse)Author
2013-10-01Add unit test for the calculation of "name" groups with expanded itemsFrank Reininghaus
This prevents a possible regression that would have happened with the first version of https://git.reviewboard.kde.org/r/112725/ The problem was that isChildItem(int index) would return "false" incorrectly when the QHash for that item was not initialized yet. The grouping code would then try to read the "text" from the empty QHash, which yielded an empty QString, and then accessing the first character of that string caused a crash.
2013-09-29Make sure that removeExpandedItems() also removes filtered itemsFrank Reininghaus
This fixes the problem that filtered child items in Details View may reappear when switching the view mode and the clearing the filter. BUG: 325344 REVIEW: 112962 FIXED-IN: 4.11.3
2013-09-09Always sort items correctly when the refreshItems() signal is receivedFrank Reininghaus
When sorting by, e.g., "Size", and the name is used as a fallback because there are multiple files with the same size, the refreshItems signal that is received when a file's name is changed either with the dialog or outside the current view did not cause the view to be resorted after commit d70a4811807776966c3241a72121242f4d1eaee8. This patch fixes it. BUG: 324713 FIXED-IN: 4.11.2 REVIEW: 112561
2013-09-09Test if the groups are updated correctly when items are refreshedFrank Reininghaus
This unit test will hopefully prevent regressions in the future. It is the first part of https://git.reviewboard.kde.org/r/112561/.
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-04Add some unit tests for grouping in KFileItemModelFrank Reininghaus
Hopefully, this will prevent regressions in the future. REVIEW: 111807
2013-08-04Make KFileItemModelTest fasterFrank Reininghaus
The 500 ms timeout before items are resorted does not make much sense in the unit test. Removing this delay makes the test run much faster.
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-13Remove trailing white spaceFrank Reininghaus
2013-05-22Merge remote-tracking branch 'origin/KDE/4.10'Frank Reininghaus
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-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-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-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-01-30Merge remote-tracking branch 'origin/KDE/4.10'Frank Reininghaus
Conflicts: dolphin/src/tests/kfileitemmodeltest.cpp
2013-01-30Add unit test for bug 314046Frank Reininghaus
The regression happened in the master branch only, but I think it doesn't hurt to add the test to the stable branch. CCBUG: 314046
2013-01-27Merge remote-tracking branch 'origin/KDE/4.10'Frank Reininghaus
Conflicts: dolphin/src/tests/kfileitemmodeltest.cpp
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-27Add a unit test for a recently fixed crashFrank Reininghaus
Before commit 90c7fd400c34e6d4d583c54c04631856c387d359, adding a KFileItem with an empty path caused a crash in KFileItemModel::expandedParentsCountCompare().
2012-10-30Fix some indentation issuesFrank Reininghaus
2012-06-08Krazy fixesPeter Penz
2012-05-26Use an italic font for symbolic linksFrank Reininghaus
BUG: 298218 FIXED-IN: 4.9.0
2012-04-21Prepare view-engine for non-KFileItem usecasePeter Penz
Up to now the view-engine only provided a model-implementation that supports file-items. The view-engine always had been designed to be able to work with any kind of model, so now a KStandardItemModel is available. The plan is to convert the places panel to the new view-engine. It should be no problem to fix this until the feature freeze - in the worst case the places-panel code could be reverted while still keeping the KStandardItemModel changes.
2012-04-11KFileItemModel: interface cleanupsPeter Penz
Fix some naming inconsistencies regarding the usage of 'dir' vs. 'directory' vs. 'folder'.
2012-04-11KItemViews: Internal directory restructurationPeter Penz
- Move all private headers from the kitemviews-directory into the 'private' subdirectory. - Get rid of DolphinDirLister and just use a directory-lister internally in KFileItemModel. - Minor interface-cleanups for signals
2012-03-20Fix sorting-issue when "Sort folders first" is disabledPeter Penz
The comparison of expanded trees may not assume that directories are always sorted first and must respect the "Sort folders first" setting. The sorting-unittest has been extended by a sub-tree and the usecase of bug 296437. The already deactivated test for KFileItemModel::expandedParentsCountCompare() has been completely removed as it has been replaced by testSorting(). BUG: 296437 FIXED-IN: 4.8.2
2012-03-20KFileItemModel: Remove minimum-update timerPeter Penz
The timer became unnecessary after introducing the behavior to collect all new items until KDirLister emits a completed()-signal.
2012-02-23Whitespace cleanups and documentation fixesPeter Penz
2012-02-14Details view: Fix indicator-branchesPeter Penz
Up to now no indicator-branches have been drawn when showing a tree. The patch fixes this so that that the style-dependent branches are drawn. The main part of the patch is the implementation of KItemListView::updateSiblingsInformation(). Most of the other changes are related due to an internal renaming of the expansionsLevel-role to expandedParentsCount and some related cleanups. BUG: 290276 FIXED-IN: 4.8.1
2012-02-05Replace setExpanded(const QSet<KUrl>&) by expandParentItems(const KUrl&)Frank Reininghaus
The use case of this function (Folders Panel) requires the expansion of the parent items of a single URL, so it's not needed to handle a full set of URLs in this function. Moreover, the issue that not only the parents, but also the URLs themselves were expanded is fixed by this commit. (cherry picked from commit 89082ca391807abdc26d8985efe6b4c27183a9b1)
2012-01-05Temporary skip 2 unit-tests in KFileItemModelPeter Penz
KFileItemModel::resortAllItems() always emits a itemsMoved() signal since some time. Before blindly adjusting the tests lets discuss first whether resortAllItems() should be used in this context.
2011-12-23Introduce "isExpandable" rolePeter Penz
The role is used to determine whether a directory can be expanded at all. This is e.g. not the case if a directory has 0 items or the target-URL is different from the item-URL. The expansion toggle will get hidden if a directory is not expandable. CCBUG: 288521
2011-12-14Improve private method KFileItemModel::expansionLevelsCompare()Peter Penz
Get rid of the hack to access the m_itemData member for getting the parent of an item during sorting. ItemData has been extended by a parent-member which allows a fast and save way to do this. Sadly this makes the unit-test for expansionLevelsCompare() more complex and it has been temporary deactivated. I'll take care to fix this during the next week.
2011-12-04Fix crash #1 when filtering itemsPeter Penz
When filtering items it was possible that the current index got an invalid value which resulted in accessing the URL of a null-KFileItem. There is still one (general) open issue in KFileItemModelRolesUpdater (crash #2) where a KFileItem that is already null gets read. It is not really related to filtering but can be triggered quite easy when filtering huge directories with enabled previews. CCBUG: 287642
2011-11-30Reimplement name-filteringPeter Penz
The filtering of items has not been implemented yet in the KFileItemModel of the new view-engine. The patch brings back this functionality again, but some minor issues are open: - When filtering trees expanded directories should only get hidden if no child is visible - Regular expressions are not supported yet (they have not been supported in Dolphin 1.x but it is now quite simple to implement). - When filtering previews and removing the filter it might be possible that the preview is not shown (is most probably an an already existing bug in KFileItemModelRolesUpdater). BUG: 287642 FIXED-IN: 4.8.0
2011-11-24Fix restoring expanded URLsFrank Reininghaus
When navigating back or forward in history, DolphinView tells the KFileItemModel about the expanded URLs which should be restored before the folder is entered. In this case, the algorithm in the new function KFileItemModel::setExpanded(const QSet<KUrl>&) does not work. To fix this, the old function KFileItemModel::restoreExpandedUrls(const QSet<KUrl>&) is restored. Unit test included.
2011-11-20Initial draft for bringing back the "Folders" panelPeter Penz
The folders panel has been adjusted to use the new view-engine. A lot of things don't work yet, but are mostly minor issues that should be fixable during the next 10 days.
2011-10-31Internal KFileItemModel optimizations and cleanupsPeter Penz
- Use merge-sort instead of quick-sort. This assures a sane worst-case scenario where quick-sort has a runtime complexity of O(n*n) (e.g. when changing the sort-order from ascending to descending). - lessThan()-improvements: Change internal data-structures to allow a comparison of any role, not only roles available in KFileItem - Don't synchronously move an item if the value has been changed of a role defined as sort-role: This is too expensive in case if e.g. the sorting is done by "type" and the type is determined step by step.
2011-10-30Fix sorting-issues when value of a sort-role has been changedPeter Penz
If the value of a sort-role has been changed, emitting the signal itemsChanged() is not sufficient as from the KItemModelBase point of view an item has been moved or deleted/reinserted. Corresponding to the unit-test KFileItemModel::setData() respects this case correctly now, however there are some minor visual animation issues left that (hopefully) should not be tricky to solve.
2011-10-15Interface cleanups to prepare the return of "grouped sorting"Peter Penz
- Rename setCategorizedSorting() to setGroupedSorting() - Change the model interface to allow enabling/disabling grouping without the need to declare a role (the sort role will be taken). - Add dummy group role implementation in KFileItemModel The grouping code itself requires some cleanups and might crash at the moment or lead to weird layouts.
2011-09-29Keep current item and selection when resorting, part 1Frank Reininghaus
KFileItemModel now emits the itemsMoved signal when the model is resorted, and KItemListSelectionManager has a new function itemsMoved() which will be called indirectly when this signal is emitted. Unit tests for the new functionality are included. The following things are still needed to make the feature work: 1. KFileItemMdel::resortAllItems() should not emit itemsAdded/itemsRemoved any more. 2. KItemListView::itemsMoved() must update the view according to the changes in the model, and it must call KItemListSelectionManager::itemsMoved().
2011-09-18Implement 'Sort By Size'Frank Reininghaus
It only works for files so far. The sorting of folders by the number of items is more tricky to get right because this number is retrieved asynchronously by KFileItemModelRolesUpdater.
2011-09-18Implement some missing sorting optionsFrank Reininghaus
Changing the sort order and enabling/disabling the "Sort Folders First" option works now.
2011-09-17Implement restoring expanded folders in Details ViewFrank Reininghaus