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.
Peter Penz [Tue, 13 Dec 2011 22:38:57 +0000 (23:38 +0100)]
Fix several sort-issues
- Treeview: When sorting descending assure that the parent item is still
ordered before the child items and not afterwards.
- Treeview: When sorting by other roles than names expansionsLevelCompare()
had been buggy and resulted in ordering child items below wrong parent
items.
- General: When sorting by another role than names and the role of
two items had been equal a case sensitive sorting of the names had
been done. This has been fixed by using the default name sorting
as fallback.
Michael Drueing [Tue, 13 Dec 2011 22:03:35 +0000 (23:03 +0100)]
dolphin: DLLEXPORT is not valid for template class
MSVC tries to import the specialized class from the library, which fails because only the generic version can be exported.
GCC probably silently ignores the export.
Peter Penz [Sun, 11 Dec 2011 19:23:21 +0000 (20:23 +0100)]
Remember sort settings
If the user has changed the sort-role or sort-order by clicking on the view-header of the details-view, the settings have been adjusted to the model but not remembered in the directory settings.
Peter Penz [Sat, 10 Dec 2011 11:23:06 +0000 (12:23 +0100)]
Resort items when they have been changed
This assures that when renaming an item the sort-position will be adjusted. Thanks to Frank Reininghaus and Janardhan Reddy for the patch and the tests.
Peter Penz [Fri, 9 Dec 2011 20:49:59 +0000 (21:49 +0100)]
Fix issue with duplicate items in details view
When expanding an item, collapsing it and expanding it again before the items for the first expanding could be loaded, it was possible that items have been inserted twice into the model.
Peter Penz [Thu, 8 Dec 2011 10:05:27 +0000 (11:05 +0100)]
Fix "show hidden files" issues
Use KFileItemModel instead of KDirLister for toggling the whether
hidden files should be shown. This assures that the signal
KFileItemModel::loadingCompleted() will be emitted.
In the longterm Dolphin should only use the KFileItemModel, so that
the KDirLister instance is used only internally as implementation
detail in KFileItemModel. Although there are only a few cases left
where KDirLister is used instead of KFileItemModel this cleanup
will be postponed to after the 4.8 release...
Peter Penz [Wed, 7 Dec 2011 22:46:35 +0000 (23:46 +0100)]
Prevent unwanted item animations (#2)
Use a cleaner approach to prevent item animations when showing
a hidden tab the first time. For Dolphin > 2.0 the tab-code should
be refactored from DolphinMainWindow and encapsulated into an
own module (but well, this is on my TODO-list since KDE SC 4.4...)
Peter Penz [Wed, 7 Dec 2011 22:04:09 +0000 (23:04 +0100)]
Enable "menu key" functionality
Bring back the functionality that a context-menu is opened if the "menu key" has been pressed. In opposite to Dolphin 1.7 the context-menu is shown above the selected item and not on the (probably unrelated) mouse position.
A new method KItemListView::itemContextRect() has been introduced: The method is now also used as reference for tooltips which fixes the issue that tooltips had a wrong horizontal alignment in the details-view.
Peter Penz [Wed, 7 Dec 2011 17:35:30 +0000 (18:35 +0100)]
Fix issue of unknown icon-types
If the split-view is used and/or the Folders Panel is activated
it might happen that the "unknown"-icon of an item is shown instead
of the correct icon. The root-cause is that one model might already
have been resolved the MIME-type of a KFileItem while the other
model has not updated the icon yet. As KFileItems are shared the
check whether the MIME-type has been resolved is wrong. As at that
stage it is assured anyhow that the MIME-type is known just
applying the icon-name in any case won't slow down the performance.
Peter Penz [Wed, 7 Dec 2011 14:30:55 +0000 (15:30 +0100)]
Fix icon boundaries issue
The size of the icon boundaries should be as minimal as possible.
The patch for fixing the zooming-issues with the selection resulted
into a minor regression where the icon boundaries might be too large.
This patch remembers the original size of the pixmap to be able
to scale m_iconRect.
Peter Penz [Tue, 6 Dec 2011 20:15:36 +0000 (21:15 +0100)]
Selection and current item fixes
- Remember selection + current item when switching view-modes
- Fix the current item indicator alignment for selections
- Set the item as current item when the selection toggle has
been clicked
Peter Penz [Tue, 6 Dec 2011 17:49:12 +0000 (18:49 +0100)]
Fix selection issue for Information Panel
When the selection changes during the Information Panel is
invisible, it still should get applied so that when making the
Information Panel visible again a valid selection is shown.
Thanks to A. Janardhan Reddy for the patch!
(Additionally the obsolete check for an empty selection has
been removed, as this cannot happen anymore with the new view
engine)
Peter Penz [Sun, 4 Dec 2011 19:45:54 +0000 (20:45 +0100)]
Fix crash #2 when filtering items
When KFileItems get removed from the model it is temporary possible
that the pending items are still part of the KFileItemModelRolesUpdater
while they have already been removed from the model (this happens
in the context during the signal itemsRemoved() gets emitted).
Peter Penz [Sun, 4 Dec 2011 17:16:39 +0000 (18:16 +0100)]
Fix crash #1 when filtering items
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.
Clear the selection in MousePressEvent() rather than MouseReleaseEvent()
This fixes the problem that clicking an unselected item in order to drag
it would result in dragging all previously selected items as well. With
this commit, previously selected items are unselected when a new item is
clicked.
The reason why clearing the selection was moved to MouseReleaseEvent()
in commit b583dd6d4d3a03e3af2ec8d370132b84935ff871 was that clicking one
of several selected items should not result in unselecting the other
items (to make sure that dragging multiple items is possible). However,
this can also be assured by just checking in MousePressEvent() if the
clicked item has been selected already and not clearing the previous
selection in that case. This applies equally to the case that a context
menu is requested when several items are selected.
Peter Penz [Tue, 29 Nov 2011 23:18:22 +0000 (00:18 +0100)]
Reimplement name-filtering
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).
Peter Penz [Sat, 26 Nov 2011 00:05:58 +0000 (01:05 +0100)]
Folders Panel fixes
The following functionality from Dolphin 1.x has
been ported to the new view-engine:
- Allow expanding/collapsing of items
- Automatically select the current item
- Context menu for items
Related improvements to the view-engine:
- Make the expanding/collapsing interface already accessible
in the base classes KItemModelBase and KItemListView. If
no expanding/collapsing is supported at all by derived models
(which is usually the default case) simply not reimplementing
those 3 methods is sufficient and it does not introduce an
additional complexity like in QAbstractItemModel/QModelIndex.
- Automatically handle the expanding/collapsing in KItemListController.
This also includes the key-handling, which is quite special for
expandable items.
- Don't let KItemListView automatically scroll to the current item
if the current item got changed. The automatic scrolling should
only be done if the current item has been changed by the user.
Hence this functionality has been moved to the KItemListController
which currently only triggers the automatic scrolling if the current
item has been changed by the keyboard (we might extend the usecases
later if required).
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.
Peter Penz [Mon, 21 Nov 2011 10:04:45 +0000 (11:04 +0100)]
Fix shortcut issue with panels
The KAction instance of the panels is added to the menu instance
now instead of the QDock-actions. It is assured that the state
between the actions gets synchronized. Now it's possible for
the user to apply custom shortcuts and the shortcuts are also
shown in the menu as expected.
Peter Penz [Sun, 20 Nov 2011 18:32:52 +0000 (19:32 +0100)]
Initial draft for bringing back the "Folders" panel
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.
Peter Penz [Sat, 19 Nov 2011 06:04:56 +0000 (07:04 +0100)]
Remove "Rename inline" option
The new view-engine currently does not support inline-renaming
and because of more important pending issues this cannot be
implemented for the 4.8 release of KDE applications.
The plan for 4.9 is to implement inline-renaming again and
to make it "so good" (tm) that it is always turned on (-> there is
no need anymore for an option to disable it ;-)
Peter Penz [Sat, 19 Nov 2011 05:49:32 +0000 (06:49 +0100)]
Fix crash when toggling the menu-bar visibility
Use a queued connection to prevent that the menu
gets hidden during it is still open. Thanks to
Christoph Feck for the hint!
Frank and I could not reproduce the issue in our
environments even when following the steps from
bug 278366, however Christoph's hint sounds sane
and let's hope it works (leaves a bad gut feeling
to "fix" bugs without being able to verify them).
Peter Penz [Sun, 13 Nov 2011 19:55:51 +0000 (20:55 +0100)]
Fix selection style issues
Don't use a custom drawing code for showing the hover-indication
or selection of the text.
- The default style for items is used.
- Merge icon-rectangle and text-rectangle if possible.
- Fix background and minor focus-issues
Peter Penz [Sun, 6 Nov 2011 08:53:03 +0000 (09:53 +0100)]
Fix issues with applying wrong view-mode
- The view properties dialog mixed the details-view with
the compact-view (#285848).
- The view properties have been reset when applying a
setting from the "Dolphin Preferences" dialog. The rootcause
was that the obsolete DolphinSettings class implemented
the saving in a wrong way because of the recent refactoring
(will remove this class completely now to prevent such
issues in future).
Peter Penz [Fri, 4 Nov 2011 22:31:11 +0000 (23:31 +0100)]
Fix layout-issues when sorting by roles that are changed
When sorting is enabled for a role that gets changed e.g. because
a value like the MIME-type is determined asynchronously, then the
layout might get messed up.
slotItemsMoved() has been adjusted to invalidate the sizehint-cache
and to update the group-headers.
Peter Penz [Fri, 4 Nov 2011 20:54:01 +0000 (21:54 +0100)]
Don't use mixed units in size-column of details-view
This makes it tricky to compare the filesizes without adjusting
the sort-order, so now all sizes in the size-column are shown
in KiB or KB (dependent on the KLocale setting).
BUG: 219932
FIXED-IN: 4.8.0
Related fixes:
- Stay consistent with the rounding when using the KiB/KB unit
in the statusbar.
- Fix sorting-by-size issue for folders
- Show "Unknown" in the size-column when the number of items
cannot be determined.
Peter Penz [Mon, 31 Oct 2011 18:32:31 +0000 (19:32 +0100)]
Internal KFileItemModel optimizations and cleanups
- 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.
Peter Penz [Sun, 30 Oct 2011 19:57:50 +0000 (20:57 +0100)]
Fix sorting-issues when value of a sort-role has been changed
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.
Peter Penz [Thu, 27 Oct 2011 20:34:33 +0000 (22:34 +0200)]
Fix minor visual issues in the view-engine
- Increasing the window-size should not result in increasing the
size from previously invisible items
- Rename group 'Numerics' to '0 - 9'
- Fix "damaged" icons when changing the view-sizes or changing the
view-mode
Peter Penz [Tue, 18 Oct 2011 20:11:22 +0000 (22:11 +0200)]
Implement group-header layouting
The most tricky part for groups - the layouting - basically works
now for all views (grouping was available only in the icons views
for Dolphin 1.x) and is nearly equally fast as without groups.
Still open:
- Group headers are ugly screen rectangles
- Return valid groups in KFileItemModel instead of the currently
hardcoded testing values
- Dynamically turning on/off groups does not work currently, the
directory must be reentered
Before this commit, the order of the items in the list returned by
DolphinView::selectedItems() was random. Now the items are sorted like
they are sorted in the view.
BUG: 283409