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
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
The recent commit 022b564831, which added
a few source files to kitemlistcontrollertest, caused a crash in that
test - an assert was hit because now a different virtual method was
called in one place (KStandardItemListView::initializeItemListWidget()),
and qobject_cast could not cast the 'item', which is of type
KFileItemListWidget, to its base class KStandardItemListWidget. Adding
the source file kfileitemlistwidget.cpp fixes this.
CCMAIL: ps_ml@gmx.de
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
This is analogous to commit e053ecdcd5,
which fixes the same problem for the case that the parent folder is
deleted.
BUG: 316335
FIXED-IN: 4.10.2
REVIEW: 109343
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
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.
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.
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
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.
This regression has been introduced on master and has not been
released yet: Due to the changed properties-format an update has
been done which resulted in writing a .directory file into each
newly entered directory.
The patch updates the view-properties and version only in the
constructor so that it is assured that reading properties never
accidently will change the internal version.
A unit-test has been added to catch regressions like this in future.
BUG: 300240
FIXED-IN: 4.9.0
The places-entries for searching revealed some serious issues in
combination with the search-panel. Move the filtering away from
QDockWidget and bring it back below the search-bar.
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.
- 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
It's now possible to change the timeout, after which any call of
KItemListKeyboardSearchManager::addKeys(const QString&) starts a new
search, from the default value of 5000 milliseconds. This is not used
in Dolphin at the moment, but it permits to reduce the timeout to a
small value in the unit test. Before this change, the unit test took
more than 5 seconds to complete.
(cherry picked from commit 82fc1b54bd)
The previous timeout [QApplication::keyboardInputInterval()] was too
short to do a multi-letter search for users who do not type extremely
fast.
(cherry picked from commit 02eab49b2d)
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
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
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 307cca7b31)
Since commit 66ce4db487, 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 61390b201a)
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 89082ca391)
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 7457f4868c)
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.
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
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.
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
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
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.
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.
- 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.
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.
- 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.
This function is used in KItemListView::updateWidgetProperties()
to find out if an item is selected in a more efficient way.
The new function is tested in KItemListSelectionManagerTest.
I've factored out some code from
KItemListSelectionManagerTest::testChangeSelection() to a new
member to simplify the test.
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().
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.
Before this commit, expanding and collapsing folders in the details
view would lead to strange results in a folder with the items "a",
"a/a/", "a/a/1", "a/a-1/", and "a/a-1/1". The problem was that the
comparison between "a/a/1" and "a/a-1/1" went wrong: the first
character in which the paths differ is a "/" in one of the items, such
that the code that reduces this 'index' in
KFileItemModel::expansionLevelsCompare in order to find the 'common
path' did nothing because it checked that only *one* of the two items
does not have an "/" at the position 'index'.
1. Implement DolphinView::clearSelection().
2. Simplify DolphinView::invertSelection().
I found, fixed, and unit-tested a bug in the selection
manager which was uncovered by this change.
This commit adds a unit test that changes the selection in various
ways, verifies the result and checks that the selection manager's
selectionChanged signal has been emitted correctly. The test is
data-driven, so I hope that most further testing needs can be
fulfilled by adding new test data.
Moreover, I changed selectedItems() such that the anchored
selection is only taken into account if anchor and current item
are different. The reason is that in some situation the anchor
should not be selected initially (i.e., if an already selected
item is Control-clicked). If the anchor should be selected from
the beginning, it must be selected manually.
This commit makes sure that the signal is emitted with the correct
current and previous selection after a selection change, and
that the signal is emitted exactly once in
KItemListSelectionManager::itemsInserted and
KItemListSelectionManager::itemsRemoved.
In Dolphin, we don't actually use the 'Deselect' and 'Toggle'
modes for anchored selections, so we can just remove these
modes and always use 'Select' to reduce code complexity.
If items are added or removed in the model, not only the
current item, but also the anchor item, which is the
starting point for any selections via Shift+Click or
Shift+Key, needs to be updated.
BUG: 262638
FIXED-IN: 4.8.0
Dolphin 2.0 will get a new view-engine with the
following improvements:
- Better performance
- Animated transitions
- No clipped filenames due to dynamic item-sizes
- Grouping support for all view-modes
- Non-rectangular selection areas
- Simplified code for better maintenance
More details will be provided in a blog-entry during
the next days.
Please note that the code is in a very
early alpha-stage and although the most tricky parts
have been implemented already very basic things like
drag and drop or selections have not been pushed yet.
Those things are rather trivial to implement but this
still will take some time.
1. Fix possible test failure if hidden files are shown initially.
2. Fix possible test failure if a .directory file is created in
the test directory. I think that this fixes the test failure from
http://my.cdash.org/testDetails.php?test=6350151&build=196639
I noticed unexpected unit test failures when running the tests with
Valgrind. The reason was that test execution was slowed down a lot,
such that that TestBase::waitForFinishedPathLoading() did not receive
the view's signal within the default timeout of 2 seconds, and that
this failure was not detected in every test -> the tests failed later
on because not all expected items had been loaded yet.
To fix this, I changed two things:
1. Added an assert in TestBase::waitForFinishedPathLoading() that checks
if the signal has been received. Continuing does not make much sense if
that is not the case.
2. Increased the default timeout to 20 seconds. The reason why there is
a finite timeout at all is that I didn't want to waste too much time on
machines where the file kioslave seems to have problems loading a
directory (I've seen corresponding test logs at cdash.org). However, with
the first change I mentioned above, the waiting time is lost only once
(due to the assert) rather than every time a directory is loaded
-> I think that the timeout increase does not lead to an increased waste
of time on such machines.
Verify that the current item and the scroll position of the view do not
change if previews are turned off. Actually, the bug was in
KFilePreviewGenerator, but it's easier to test this here.
Rather than reloading the view after it is initilised, we just wait
until the view emits its finishedPathLoading() signal. This saves some
time when running the tests (at least on my system).
Many tests have to wait until this signal is received from the
DolphinView, so it is convenient to have a function that wraps
the QTest::kWaitForSignal() call.
This commit changes mainly two things:
1. The functionality related to the handling of temporary files and
folders is moved to a new class TestDir.
2. The setup of a temporary folder and of DolphinView instances is
now done in each unit test function. A benefit of this change is that
there are no unwanted interactions between different unit test functions
any more. Moreover, different test functions could now share a test
folder more easily.
Additionally, the reference arguments of all functions are changed to
pointers for consistency.
Most developers seem to prefer
if (ptr) ...
if (!ptr) ...
in comparison to
if (ptr != 0) ...
if (ptr == 0) ...
Adjusted the Dolphin-code to use the "most-prefered style" to make contributors happy.
Up to now, some Columns View tests that need a folder to be displayed
in the view only passed if they were run first: The first test always
passed, and if a test name was passed on the command line, such that
only this test would be run, this test would work as well. In other
cases, the view was empty, not showing the items in the folder.
The problem is worked around by creating a new DolphinView before each
test in the case of the Columns View. Added a TODO comment to make me
remember to look into this again at some point.
svn path=/trunk/KDE/kdebase/apps/; revision=1217260
The test assumes that the view does not have the keyboard focus
initially. However, this may not be the case if this is the only test
to be executed (i.e., if testKeyboardFocus is passed to the test
executable on the command line). This commit transfers the keyboard
focus explicitly to another widget.
svn path=/trunk/KDE/kdebase/apps/; revision=1217251
When running the test in the background while using the computer for
other things, it may happen that the test's widgets are not focused,
which led to an infinite loop before this commit. I've removed the
checks that caused this loop because the only thing that is important
for the test is that the view loses the keyboard focus at some point
(see bug 220898).
svn path=/trunk/KDE/kdebase/apps/; revision=1215139
also added a timeout such that the tests fail rather than hang if the
file kioslave dies (which happens sometimes according to some test
logs on cdash.org).
svn path=/trunk/KDE/kdebase/apps/; revision=1202159
DolphinView. The main testing code is inside an abstract base
class. Three classes inherit this base class and do the actual testing
in one view mode each.
svn path=/trunk/KDE/kdebase/apps/; revision=1202157
bug234600_overlappingIconsWhenZooming() such that it's the standard
value again in the following test. Also verify that the zoom level is
as expected after each call to DolphinView::setZoomLevel(int).
svn path=/trunk/KDE/kdebase/apps/; revision=1199137
than the "Name" column. Fixes keyboard navigation problems if files
with very wide names are present in the current folder.
Unit test included.
CCBUG: 257401
svn path=/trunk/KDE/kdebase/apps/; revision=1199123
2. Remove some debug output from DolphinDetailsViewTest - it seems
that the test failure I saw on cdash.org is due to a failing kioslave,
which is probably not Dolphin's fault.
svn path=/trunk/KDE/kdebase/apps/; revision=1194514
To make it work, I had to make DolphinTreeView::indexAt public, but
this method is public in the base class anyway.
svn path=/trunk/KDE/kdebase/apps/; revision=1194511
which has been fixed recently). This commit also adds a new class
TestHelper which provides some funtionality that most Dolphin unit
tests will need. I hope that this makes implementing additional tests
as easy as possible :-)
svn path=/trunk/KDE/kdebase/apps/; revision=1188536
of the problems related to Dolphin's modifications to QTreeView works
as it should.
This is only a small start, but I hope that we can cover at least the
basic functionality of DolphinView, the three item views and possibly
a couple of other classes with a rather stable API soon.
svn path=/trunk/KDE/kdebase/apps/; revision=1188049
KDE4_ADD_TEST_EXECUTABLE is deprecated now use KDE4_ADD_EXECUTABLE(<target> TEST <files>) instead
QT4_ADD_DBUS_INTERFACE_NO_NAMESPACE and QT4_ADD_DBUS_INTERFACES_NO_NAMESPACE are deprecated too
used SET_SOURCE_FILES_PROPERTIES(<files> PROPERTIES NO_NAMESPACE TRUE) QT4_ADD_DBUS_INTERFACES(<srcList> <files>)
set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) is put in each CMakeLists.txt where
KDE4_ADD_EXECUTABLE(<target> TEST <files>) and KDE4_ADD_UNIT_TEST were used.
svn path=/trunk/KDE/kdebase/apps/; revision=716149
> Sounds like the kind of method that would benefit greatly from a unit test :)
OK, committing my first unit test for KDE. Although very minimal it's at least a start ;-) (currently deactivated as I've some problem in CMakeList.txt)
svn path=/trunk/KDE/kdebase/apps/; revision=666162