┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/tests/kitemlistcontrollertest.cpp
AgeCommit message (Collapse)Author
2024-05-18Avoid implicitly selecting itemsFelix Ernst
Items should only be selected if the user wants to act on them. However, previous to this commit we sometimes selected items even when there is no reason to assume that the user would like to act on them. Such selections are dangerous because they make it more likely that the user manipulates items by accident which they never even explicitly selected. Example: The "Up" action is used to navigate to the parent folder. This will implicitly select the folder one emerged from after opening the parent folder, so just one accidental press of the Delete key will lead to data loss if the press goes unnoticed. This scenario would have been avoided if no folder had been selected automatically. The above example becomes even more dangerous if the user is acting with elevated privileges. The following implicit selections of items are being removed: - Selecting items that are being activated - Selecting folders one emerges from Even though these items will no longer be selected after these actions, they will still be marked as current. The only downside I see is that our indication of which item is "current" is a lot weaker than the selection highlight, so it might be more difficult to spot which folder one has emerged from. However, this could be counter-acted with some other temporary indication if this really turns out to be a problem. The only downside I see is that our indication of which item is "current" is a lot weaker than the selection highlight, so it might be more difficult to spot which folder one has emerged from. However, this could be counter-acted with some other temporary indication if this really turns out to be a problem. BUG: 424723
2024-03-27Better support for RTLEugene Popov
This MR fixes some issues related to RTL scripts: - wrong layout in Compact View mode - broken horizontal scrolling in Icon View and Details View modes - broken navigation with left and right arrow keys in Details View mode BUG: 484012 BUG: 449493
2024-01-30Add test cases for right-to-left keyboard navigationFelix Ernst
This commit reuses our test cases for keyboard navigation to also test the right-to-left layout direction under various conditions. There is also a small change to make the error output more human-readable.
2023-10-05Merge branch 'master' into kf6Nate Graham
2023-10-05Fix accessibility ancestor treeFelix Ernst
Before this commit, KItemListViewAccessible would always return nullptr as its parent. This meant that accessibility software would have to guess to which window/hierarchy the KItemListView belongs to. Guessing shouldn't be necessary here. This commit makes sure that the KItemListView always returns a sensible parent in the accessible hierarchy. It does so by explicitly setting the accessible parent for every KItemListView after construction in the DolphinView contructor. Since KItemListView now always knows about its accessible parent, the accessibleInterfaceFactory can always ask the KItemListView for that information when constructing the QAccessibleInterfaces. Fixes https://invent.kde.org/system/dolphin/-/issues/47.
2023-09-10Replace qAsConst with std::as_constMéven Car
2023-04-25Revert "Adapt autotest to new expected "Space" key behaviour"Felix Ernst
This reverts commit df5cf6fe851021a73159fdd3487fe629c1ea8376. The autotest was orginally changed to adapt to new behaviour when the Space key is pressed. This change used to be implemented in KItemListController which meant that the KItemListControllerTest needed changing, but this is no longer the case. Instead the new behaviour when the Space key is pressed is now implemented further up the hierarchy, so the KItemListController change could be reverted in 7b6a67e520c04f56b4b05fa26b252177398df6df and as such we can also revert this autotest change.
2023-02-05Add clang-format and format code as in FrameworksSerg Podtynnyi
2023-01-11Adapt autotest to new expected "Space" key behaviourFelix Ernst
The old expected behaviour was that pressing Space would select the current item. We now trigger selection mode instead and don't select. At some point in the future we might want to instead have Space trigger a "QuickLook" feature for quick viewing of full files. In any case, the old behaviour of having Space select is no longer expected, but Ctrl+Space can still be used for this. It might also make sense to have Space trigger the old selection behaviour if both selection mode and "QuickLook" are disabled, but that is very low priority and will cause more code complexity than the non-default benefits are worth.
2021-03-13Enable test mode in all testElvis Angelaccio
2021-02-09Build with QT_NO_KEYWORDSNicolas Fella
2020-10-23Compile without foreachAlexander Lohnau
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.
2019-10-26When the selection is deselected, restart the keyboard search from the beginningMéven Car
Summary: BUG: 411538 FIXED-IN: 19.12 Test Plan: Open a directory with 3 files starting with the same letter. 1. Press this letter key twice 2. The second file is selected 3. Deselect the file with the mouse or using Esc 4. Wait 1 second 5. Press the same key again Before: The third file gets selected After: The first file get selected ctest Reviewers: #dolphin, elvisangelaccio, ngraham Reviewed By: #dolphin, elvisangelaccio, ngraham Subscribers: ngraham, kfm-devel Tags: #dolphin Differential Revision: https://phabricator.kde.org/D23716
2019-01-11Consti'fyLaurent Montel
2018-10-07Fix implicit-fallthrough gcc warningElvis Angelaccio
GIT_SILENT
2018-02-03Fix -Wunused-result warningsElvis Angelaccio
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-11-20Modernize: Use override where possibleKevin Funk
Also use override instead of Q_DECL_OVERRIDE
2017-01-03Add missing Q_OBJECT macrosIlya Bizyaev
REVIEW: 129738
2015-09-01Pedantic--Montel Laurent
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
2015-02-01Port away from KGlobalSettings::singleClick() and use the mouse kcm module ↵Emmanuel Pescosta
instead of implementing the single/double click settings on our one. REVIEW: 122311
2014-12-18Ported tests away from KRandomSequence, QTest::kWaitForSignal and KTempDir.Emmanuel Pescosta
All tests passed!
2014-10-18Port test to qt5Montel Laurent
2013-10-30Store the selected items in a more efficient wayFrank Reininghaus
Since Dolphin 2.0, we have stored the selected items in a QSet<int>, which is neither space-efficient nor particularly fast when inserting many items which are in a consecutive range. This commit replaces the QSet<int> by a new class "KItemSet", which stores the items in a sorted list of ranges. For each range, we only store the first index and the length of the range, so we need a lot less memory for most common selection patterns, and we also save quite a few CPU cycles in many situations, because adding an item to the KItemSet will in many cases not need a memory allocation at all, and it's particularly easy when inserting sorted items into the KItemSet in a row. KItemSet contains a minimal subset of QSet's API which makes it suitable as a drop-in replacement for our needs. It also has iterators, such that the items can be iterated through easily, also with foreach. One advantage of KItemSet compared to QSet<int> is that the items are always iterated through in ascending order. REVIEW: 113488
2013-10-07Include "Space" in the keyboard search stringFrank Reininghaus
Before this commit, we only added pressed keys to the search string if they have no other meaning. This means that files containing a Space in their name could not be searched because Ctrl+Space toggles the selection state of the current item, and Space alone selects the current item. After this commit, Space is added to the search string if (a) the key press did not have any other effect, i.e., if Ctrl was not pressed, and the current item is selected already, and (b) a keyboard search has been started already (to prevent unexpected effects when pressing Space accidentally - I think that it's rather uncommon to have files whose names start with a Space - and to make the unit test simpler). I modified the unit test of KItemListController, which did not test keyboard search yet. This uncovered a small problem in KItemListController::slotChangeCurrentItem() when NoSelection mode is used. It's not really relevant for anything that is executed inside Dolphin, but I still fixed it to make the unit test happy. BUG: 324479 FIXED-IN: 4.11.3 REVIEW: 113071
2013-02-17Another fix for KItemListControllerTest::testMouseClickActivation()Frank Reininghaus
One one machine, I see that changing the global "single click" setting fails. I don't know why that is the case, but I think we should better just skip the test in that case and not hang forever.
2013-02-13Improve the recently added test testMouseClickActivationFrank Reininghaus
The method to make sure that the first item is visible turned out to be less reliable than I thought. This could make the test hang forever. Moreover, this commit removes some trailing whitespace that had been added accidentally.
2013-02-05Add unit test for bug 313342Frank Reininghaus
2012-06-08Krazy fixesPeter Penz
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-02-13Test which items are activated when pressing Enter or ReturnFrank Reininghaus
The ViewState struct gets a new bool member to indicate if the selected items should have been activated after the last event or not. One could argue that adding a bool parameter to the constructor is not optimal, but I think adding an enum is not really worth the effort because the struct is not used outside this unit test. Moreover, I could not think of a good name for the enum type and its values. (cherry picked from commit 307cca7b31b998fb7e8af0478a8e97e53bdc059c)
2012-02-13Fix regression in KItemListControllerTestFrank Reininghaus
Since commit 66ce4db4879cd80b2dcb6d65a0c74599c5e5f0ba, enabling or disabling groupling may change the number of columns in the view. Therefore, the test should first change the "grouping" setting and then change the view geometry to make sure that the column count is correct. (cherry picked from commit 61390b201acae2d8eea94fefc947977a8799af85)
2012-02-04Simplify KItemListControllerTest::testKeyboardNavigation_data()Frank Reininghaus
Function-static variables do not help much in a function which is called exactly once. (cherry picked from commit 847c8ebfd3259a6f090db7451dd3350c6e01e0d2)
2012-02-01First version of a unit test for KItemListControllerFrank Reininghaus
At the moment, only key press events are tested, and the current item and selection after the event are verified. Moreover, this commit makes sure that KItemListController::keyPressEvent() really does not select anything if the selection mode is NoSelection. (cherry picked from commit 7457f4868cf0bc83e8a90ce5693292378f3d07c4)