┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/tests/kfileitemmodeltest.cpp
AgeCommit message (Collapse)Author
2023-02-05Add clang-format and format code as in FrameworksSerg Podtynnyi
2022-11-29Exit the deleted directory when it is removedMéven Car
If current directory is a local file, try to find nearest dir ancestor and open it. Display warning to the user.
2022-05-31Fix building kfileitemmodeltest with KF6Ahmad Samir
- Fix kio_version.h include - Explicitly create a QSet for QCOMPARE
2022-03-04Fix issue where newly inserted items end up in the wrong directoryDavid Edmundson
If we have directory "a" and "a/b" and expand both, then collapse "a" we tell KDirWatcher to stop watching both these directories. However, KDirWatcher keeps them in the listersCurrentlyHolding list as well as the listersCurrentlyListing list and will still notify of changes. If a new file appears in "a/b/" we will still get change notifications. When dolphin processes these changes we cannot find the relevant parent node. It then gets confused and inserts the item into the root directory from the POV of the model notifications. When we then open the relevant folder the model knows a node with that URL exists and fails to add it correctly. This can also be reproduced by continually downloading files into a subdirectory tree and rapidly expanding and collapsing folders a few levels deep.
2021-12-06Fix various typosluz paz
Found via `codespell -q 3 -S *.desktop,*.xml`
2021-11-28Properly display parent folders when filtering is active and items are added ↵Eduardo Cruz
or refreshed The methods slotRefreshItems(), slotItemsAdded() and slotItemsDeleted() are adapted so they are now compatible with the new behavior of filtering expanded folders achieved in ed83f37f06bd5c4b38c100503c3ad4dec2a87912. The new behavior is that expanded folders are hidden from view if neither the folder itself nor any of its contents passes the filter. Previously expanded folders would always stay visible no matter the filter. A bug where the parent expanded folder would disappear after adding or refreshing an item while filtering is also fixed. Tests are added to make sure these behavior changes won't regress. BUG: 442275 FIXED-IN: 22.04
2021-10-04Rewrite filter algorithm to properly support filtering with expanded folders ↵Eduardo Cruz
under Detail View mode. BUG: 411878 CCBUG: 442275 FIXED-IN: 21.12
2021-08-29Revert "Revert "Disable Hidden Files Last sort by default""Elvis Angelaccio
This reverts commit 272aa65bb55dd31f58e8a8e24ea7bc8bd2712daa.
2021-08-29Revert "Revert "Show hidden files and folders last""Elvis Angelaccio
This reverts commit 63e12c0cdf4e3437b95b9c50e5791dbf97183687.
2021-08-29Merge branch 'release/21.08'Elvis Angelaccio
2021-08-06Revert "Show hidden files and folders last"Nate Graham
This reverts commit 996e430b62075c5b69571f141456dbe5f2956679. The accompanying feature to make the behavior configurable and disable it by default was reverted in 21.08, so we need to revert the feature itself as well and only ship it in 21.12, to avoid changing people's setting back and forth, which is often not well-received.
2021-08-06Revert "Disable Hidden Files Last sort by default"Heiko Becker
This reverts commit fd2203bb3925edb5d657d49a706e26ea736362d2.
2021-08-05Merge branch 'release/21.08'Nate Graham
2021-08-05Disable Hidden Files Last sort by defaultChris Holland
2021-07-19Use KDirLister directly now that it emits a jobError() signalAhmad Samir
Since KIO 5.82, KCoreDirLister (the base class of KDirLister) emits a jobError() signal when the ListJob used internally emits an error. Drop KFileItemModelDirLister class, now redundant. This also bump the KF version to 5.82.
2021-05-10Show hidden files and folders lastGastón Haro
Hidden files and folders are always displayed after not hidden files. BUG: 241227 Revision: https://phabricator.kde.org/D29115
2021-03-13Enable test mode in all testElvis Angelaccio
2021-02-09Build with QT_NO_KEYWORDSNicolas Fella
2020-08-25Output of licensedigger + manual cleanup afterwards.Elvis Angelaccio
Unfortunately licensedigger does not strip the trailing * characters. While at it, use a common style for all source files.
2020-05-28Port away from deprecated qrand()Elvis Angelaccio
2019-11-09Remove unnecessary semicolons after Q_UNUSEDElvis Angelaccio
GIT_SILENT
2019-09-14Use directly "isEmpty()"Laurent Montel
2019-04-07[KFileItemModelTest] Port to fastInsert()Elvis Angelaccio
We already depend on KF5 > 5.47, so we are ready to switch to the non-deprecated fastInsert() method.
2018-08-16Make this test work again with new uds implementationJaime Torres Amate
Summary: With the new uds implementation, when some data is meant to replace an old one, it has to use replace() instead of insert() to avoid an assert of data already exists. Use 3 different entries and only insert(). Test Plan: before: crash in the uds assert after: passes the test Reviewers: #dolphin, #frameworks, elvisangelaccio Reviewed By: #dolphin, elvisangelaccio Subscribers: bcooksley, bshah, nalvarez, cfeck, dfaure, aacid, ngraham, bruns, elvisangelaccio, kfm-devel Tags: #dolphin Differential Revision: https://phabricator.kde.org/D13813
2018-08-16wrong name and email addressJaime Torres Amate
Summary: This reverts commit 2104d18a6760d28d24665a3281ef090c198c44e7. Test Plan: revert-hammer Reviewers: Subscribers:
2018-08-16Make this test work again with new uds implementationTravis CI Bot
Summary: With the new uds implementation, when some data is meant to replace an old one, it has to use replace() instead of insert() to avoid an assert of data already exists. Use 3 different entries and only insert(). Test Plan: before: crash in the uds assert after: passes the test Reviewers: #dolphin, #frameworks, elvisangelaccio Reviewed By: #dolphin, elvisangelaccio Subscribers: dfaure, aacid, ngraham, bruns, elvisangelaccio, kfm-devel Tags: #dolphin Differential Revision: https://phabricator.kde.org/D13813
2018-02-03Port QSignalSpy to new signal syntaxElvis Angelaccio
More compile-time safety. Tests still pass. This also fixes a krazy warning about "normalised signal/slot signatures".
2017-11-21Modernize: Use nullptr everywhereKevin Funk
2017-05-11Fix kfileitemmodeltestElvis Angelaccio
Commit 6dcbb8127c introduced the isHidden role, update the test accordingly.
2017-01-21Change "Date" to "Modified" and allow access to new "Accessed" time fieldDon Nguyen
This is merge of #128964 and #128942. This will impelement changing the "Date" field to "Modified" and allow a new "Accessed" time field to be available. This also includes changes to update configuration files. REVIEW: 129077
2016-12-03Fix 5 clazy warningsSpencer Brown
This bumps the minimum Qt version to 5.5 (because of Q_ENUM usage). REVIEW: 129604
2016-08-06Fix some low-hanging warning fruitsMartin T. H. Sandsmark
2015-02-26Port away from KDELibs4Support (we only use KDELibs4Support when baloo isn't ↵Emmanuel Pescosta
present, because KFileMetaDataWidget is in KDELibs4Support) Reviewed-By: Vishesh Handa
2014-12-24Fix compilation with Qt 5.2 and 5.3; QSignalSpy can't take a function ↵David Faure
pointer yet
2014-12-18Ported tests away from KRandomSequence, QTest::kWaitForSignal and KTempDir.Emmanuel Pescosta
All tests passed!
2014-12-14port away from deprecated KFileItem(mode_t mode, mode_t permissions, const ↵Emmanuel Pescosta
QUrl &url, bool delayedMimeTypes = false);
2014-11-10make use of initializer listsEmmanuel Pescosta
2014-11-04Fix more unit test failuresFrank Reininghaus
This commit is analogous to 5cf8941ac789e47da70fe466033f45df9af1a3fa, but the problem existed since the frameworks port was started and was not obvious because the QString -> KUrl/QUrl port was done implicitly when calling KIO::rename(oldPath, newPath, KIO::HideProgressInfo). REVIEW: 120941
2014-11-04Fix unit test failuresFrank Reininghaus
These were caused by 86e31084ced8ba4875a6128f91ec2ca3d6df7a31 - note that the correct replacement for KUrl(fileName) is QUrl::fromLocalFile(fileName), and that calling the const function urlA.adjusted(QUrl::RemoveFilename) only has an effect if the return value is taken.
2014-10-21port Konqueror from KUrl to QUrlLukáš Tinkl
REVIEW: 120650
2014-10-18Fix includesMontel Laurent
2014-06-04Fix possible crash if a kioslave adds multiple items with the same URLFrank Reininghaus
When opening the URL "man:", there are multiple items with the same name (for example, _exit is shown twice here). When opening a new tab, the kioslave reports some items as deleted (I have not quite understood why). The problem is that it reports some of the duplicate items twice in the list of deleted items. This confused KFileItemModel and corrupted the internal data structures, and finally, caused a crash. The fix is to remove all duplicates from KItemRangeList::fromSortedContainer(const Container& container). New unit tests included. BUG: 335672 REVIEW: 118507 FIXED-IN: 4.13.2
2014-05-13Ensure that all children of a collapsed folder are removedFrank Reininghaus
Before this patch, any (direct or indirect) children that might have been in m_pendingItemsToInsert, i.e., that were not inserted into the model yet because KDirLister had not finished listing the directory yet, would be added to the model later without a proper parent. This could cause a crash later on. CCBUG: 332102 FIXED-IN: 4.13.2
2013-12-22Add unit test for KFileItemModel::createMimeData().Frank Reininghaus
The test verifies that creating the mime data for a child of an expanced folder does not cause a crash. The regression happenened in the master branch, but it doesn't hurt to have the test also in KDE/4.12. CCBUG: 329119
2013-12-22Update filtered items when the "refreshItems" signal is receivedFrank Reininghaus
This fixes the problem that the new file name is not shown in the view if an item is renamed while it is filtered. BUG: 329118 FIXED-IN: 4.12.1 REVIEW: 114459
2013-12-14Update the roles for filtered items if necessaryFrank Reininghaus
Since Dolphin 4.11, we store not only KFileItems, but also the corresponding ItemData struct for filtered items. This is required for keeping track of the parent-child relationships, and has the nice side effect that the ItemData need not be re-determined when the items are shown again. However, this can become a problem if the visible roles or the sort role change while some items are filtered. This is fixed by is fixed by clearing the QHash "values" for the filtered items if the visible roles change. The hash will be re-populated with all requested data as soon as the items are shown again and the data(int) method of the model is called. Moreover, before the items are inserted into the model after filtering, we have to make sure that the sort role "Permissions"/"User"/etc. is present in the hash "values". This is achieved by factoring out the code that currently does this job for new items in createItemDataList() into a new function, and calling this in insertItems(), because the same treatment is required for the previously filtered files. BUG: 328791 FIXED-IN: 4.12.1 REVIEW: 114266
2013-10-07Make the code that removes items from KFileItemModel more robustFrank Reininghaus
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-01Merge remote-tracking branch 'origin/KDE/4.11'Frank Reininghaus
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