Commit graph

10 commits

Author SHA1 Message Date
Emmanuel Pescosta d19d94e60a Ported tests away from KRandomSequence, QTest::kWaitForSignal and KTempDir.
All tests passed!
2014-12-18 14:56:46 +01:00
Emmanuel Pescosta d0f0f1f2e2 make use of initializer lists 2014-11-10 08:45:38 +01:00
Lukáš Tinkl 1b4572dac9 port Dolphin from KUrl to QUrl
REVIEW: 120688
2014-10-21 21:19:14 +02:00
Montel Laurent 938a83b8b1 Port test to qt5 2014-10-18 14:36:34 +02:00
Frank Reininghaus 9f24c02a75 Make the code that removes items from KFileItemModel more robust
When we remove items from the model, we called the function
KFileItemModel::removeItems(const KFileItemList&, RemoveItemsBehavior).
This function then looked up the indexes of the items using the hash
m_items. This is wasteful in the situations when the indexes of the
removed items are known in advance (like when an expanded folder is
collapsed in Details View), and it can cause trouble if one item is
contained in the model multiple times (can happen when searching, and a
file both matches the search and is a child of a folder that matches
the search). Even if expanding folders in the search results list might
not be particularly useful most of the time, it makes sense to make the
model more robust to prevent crashes and other unexpected behavior in
such situations.

This patch makes the following changes to achieve that goal:

* Change the argument of removeItems() from KFileItemList to
  KItemRangeList. To make this work, the "look the indexes up in
  m_items" code is moved from that function to slotItemsDeleted(). In
  the other places where removeItems() is called, the indexes are
  calculated directly (which is not more difficult than determining the
  removed items as a KFileItemList, if one considers that we needed the
  function childItems(KFileItem) for that, which is not needed any more
  with this patch).

* Also removeFilteredChildren() takes a KItemRangeList now. Rather than
  putting the parent KFileItems into a QSet for O(1) lookup (which
  prevents O(N^2) worst case behavior for the entire function), it uses
  a QSet<ItemData*> now, which should even be more efficient (hashing a
  pointer is cheaper than hashing a KFileItem/KUrl).

BUG: 324371
BUG: 325359
FIXED-IN: 4.12.0
REVIEW: 113070
2013-10-07 09:26:51 +02:00
Emmanuel Pescosta f2d70693db Big Thanks to Frank Reininghaus, who helped me a lot with these
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-27 13:35:20 +01:00
Frank Reininghaus 45450959ea Add benchmark for adding many child items in a tree structure 2013-02-10 18:07:55 +01:00
Frank Reininghaus 5f6f77d481 Remove unneeded #include 2013-02-03 23:12:55 +01:00
Frank Reininghaus f76f3a1654 Move the consistency check for KFileItemModel from the test to the class
This makes it possible to check the model's consistency also in other
places, e.g., in KFileItemModel's benchmark.
2013-01-27 15:19:39 +01:00
Frank Reininghaus 71be8f2bee Add some benchmarks for KFileItemModel
The benchmark executable must be run manually. It is not run
automatically with the other unit tests to prevent waste of CPU cycles
in the not-so-uncommon situation that only test failures attract
attention.
2013-01-27 12:55:37 +01:00