Peter Penz [Sat, 8 Oct 2011 19:40:34 +0000 (21:40 +0200)]
Context menu cleanups
- Open the context menu on the mouse-press event, not on the
mouse-release event.
- Provide an explicit position-information and don't use
QCursor::pos(). This fixes the issue that opening a context-menu
by the keyboard opens below the cursor.
- Provide different signals in the KItemListController for
the different context-menu types (item vs. view vs. header).
- Implement turning on/off roles by the header-context-menu.
Peter Penz [Thu, 6 Oct 2011 14:41:29 +0000 (16:41 +0200)]
Use QFontMetrics::height() instead of averageCharWidth()
QFontMetrics::averageCharWidth() is quite slow and does not work
well on fonts with broken characters. In the
usecases required by Dolphin QFontMetrics::height() is a better
and faster alternative to get a font-dependent minimum width.
Add function KItemListSelectionManager::isSelected(int index)
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.
Peter Penz [Fri, 30 Sep 2011 21:22:56 +0000 (23:22 +0200)]
Implement smooth-scrolling for horizontal and vertical scrollbars
Currently only a smoothscrolling was provided into the
scroll-direction, but not in case of the details-view where a
horizontal scrollbar might be shown too.
Some minor adjustments of the private KItemListSmoothScroller interface
will be done later...
Keep current item and selection when resorting, part 1
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().
Peter Penz [Sun, 25 Sep 2011 17:52:33 +0000 (19:52 +0200)]
Provide scrollbar for large items
If an item does not fit into the available width/height a scrollbar
should be provided (e.g. typically this represents the horizontal
scrollbar in the details-view where the width can be larger than
the than the visible width).
Currently the interaction with the scrollbar is not implemented but
this will be a quite minor task in comparison to this patch.
Fixed selection of directories with a trailing slash used with --select
parameter.
As QHash would not match a KUrl key with it's value if the key had a
trailing slash, so it would return -1, hence the file won't get
selected.
Changed the UpdateViewState slot to remove the trailing slash before
calling the index function for the selected URL. Also modified
DolphinView to use KUrl list instead of KFileItemList to maintain
simplicity.
Peter Penz [Fri, 23 Sep 2011 22:18:09 +0000 (00:18 +0200)]
Fix size-hint calculation in KFileItemListView
The current approach works fine but should be replaced in the longterm
by a helper class shared by KFileItemListWidget and
KFileItemListView to share information that is required to
calculate the size hints in KFileItemListView and to represent
the actual data in KFileItemListWidget.
Peter Penz [Thu, 22 Sep 2011 20:15:40 +0000 (22:15 +0200)]
Update the layout periodically when resizing the window
Up to now the layout has only been updated when the geometry has
not been changed for at least 300 ms. This has been changed so
that at least each 300 ms the layout is updated to give a better
visual feedback when resizing the window.
Fixed bug for selecting files with --select parameter.
Files selected via --select parameter did not get current item focus.
And if files were deleted while being current item, updating the view
would select the next item instead of the first item in the list.
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.
Fix possible crash in KFileItemModel::slotRefreshItems()
If the changed items have been created recently, they might not be in
m_items yet. In that case, the list 'indexes' might be empty, which
leads to a crash later on (I saw the crash in KFileItemModel's unit
test).
Peter Penz [Sat, 10 Sep 2011 16:08:03 +0000 (18:08 +0200)]
Provide KVersionControlPlugin version 2
Based on the work of Vishesh Yadav some extensions where required
for the KVersionControlPlugin interface that have found there way
now into KVersionControlPlugin2.
Beside some interface cleanups it is now possible that a version
control plugin may also provide context actions for directories or
files that are not versioned yet.
Peter Penz [Tue, 6 Sep 2011 21:42:42 +0000 (23:42 +0200)]
First step to reactivate version control plugin functionality
- Add a DolphinFileItemListWidget that provides icon-overlays
and colored text for the version state (implementation is
missing yet)
- Allow KFileItemListWidget to have custom text colors
- Update interface of VersionControlObserver to work with
KFileItemModel instead of the old model-interface.
Peter Penz [Thu, 25 Aug 2011 14:52:14 +0000 (16:52 +0200)]
Fix smooth-scrolling issue in combination with key-presses
If e.g. the down-arrow-key is pressed constantly the view does not
scroll as the animation always will get restarted. Assure that
the animation proceeds in this case.
Peter Penz [Wed, 24 Aug 2011 19:28:46 +0000 (21:28 +0200)]
Dragging and selection fixes
- Don't clear the selection on mouse-press events, do it (if
allowed) in the mouse-release-event. Otherwise dragging of
multiple selected items would not be possible.
- Don't clear the selection when the context-menu gets opened
by a right-click.
- Fix issue that dragging is not possible after the first
drop that has been canceled.
Peter Penz [Sat, 20 Aug 2011 21:26:07 +0000 (23:26 +0200)]
Fix rubberband-issue in combination with Shift- and Control-key
The old selection must be remembered before starting the rubberband
selection, otherwise it would not be possible anymore to deselect
items that have been selected by the rubberband itself.
Peter Penz [Sat, 20 Aug 2011 11:52:36 +0000 (13:52 +0200)]
Fix possible endless recursion when using the rubberband
If the autoscrolling has been activated when using the rubberband,
it was possible that an endless recursion occured as the
autoscrolling triggered a change of the rubberband which triggered
a change of the autoscrolling etc.
Peter Penz [Thu, 18 Aug 2011 21:11:16 +0000 (23:11 +0200)]
Provide basic rubberband functionality
This is just a rough draft: The rubberband gets visible and an
automatic scrolling is done if the autoscroll-margins have been
reached. However currently no items get selected yet. Currently
the autoscrolling has a severe bug if the scrollbars are manually
changed before or after a rubberband selection.
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'.