Commit graph

4542 commits

Author SHA1 Message Date
Frank Reininghaus 7c99a9c2ad Make sure that the sort order is correct after renaming
KFileItemModel::setData() should not only cause a resorting when the
sort role is changed. The name is always used as a fallback if the sort
role of multiple files is equal, therefore, renaming a file can change
the correct order of the files even if the files are not sorted by
"name".

Unit test included.

BUG: 323518
FIXED-IN: 4.11.1
REVIEW: 111721
2013-08-15 00:07:43 +02:00
Frank Reininghaus 59723fca41 Do not store default values in QHash<QByteArray, QVariant>
Storing values which are equivalent to default-constructed QVariants
does not make much sense because QHash::value returns the same value
even if the corresponding key is not found in the hash.

This commit reduces Dolphin's memory consumption in large folders by
up to 7.3% (tested a folder with 100,000 files in Details View) and
reduces the time required for loading a folder.

BUG: 323517
FIXED-IN: 4.11.1
REVIEW: 111922
2013-08-14 23:57:51 +02:00
Frank Reininghaus fd5ba3b4b2 Fix slow scrolling when hidden files or symbolic links are shown
The problem was that we drawed the overlays using KIconLoader, which can
be very slow, every time an item appeared on the screen. This commit
makes sure that not only the icon, but the icon including overlays is
cached in QPixmapCache. Therefore, the overlay drawing is done just once
for each icon+overlays combination.

For previews, the overlay drawing is done in KFileItemModelRolesUpdater
just after the preview is received.

BUG: 310662
BUG: 314339
FIXED-IN: 4.11.1
REVIEW: 111956
2013-08-14 23:44:57 +02:00
Frank Reininghaus 7e5b7d5626 Fix crash when disabling "Show in groups"
The problem was that items are removed from m_visibleGroups while
a QMutableHashIterator iterates over this hash, such that the iterator
can become invalid. The solution is to use a QHashIterator instead,
which takes a copy of the hash. Therefore, it is not affected if
m_visibleGroups is modified in any way.

BUG: 323248
FIXED-IN: 4.11.1
REVIEW: 111919
2013-08-14 23:40:02 +02:00
Frank Reininghaus 68520f55f0 Merge remote-tracking branch 'origin/KDE/4.11' 2013-08-08 23:39:28 +02:00
Fabio D'Urso 87f8303023 dolphin: Escape text in statusbar tooltip
This fixes the same issue as 4450f8449a,
but for the status bar's tooltip text.

BUG: 323170
FIXED-IN: 4.11.0
REVIEW: 111836
2013-08-05 02:12:09 +02:00
Fabio D'Urso 254ab4b579 DolphinPart: Use Qt::convertFromPlainText instead of Qt::escape for filenames
Unlike escape, convertFromPlainText preserves whitespace sequences

CCBUG: 321778
REVIEW: 111835
2013-08-05 01:47:23 +02:00
Frank Reininghaus 6524bf701a Introduce a new signal "groupsChanged"
Sometimes when items are renamed, the order of the items in the
directory is not affected, but the groups still change (simple example:
with files a, b, c, e, rename "c" to "d"). At the moment, we always emit
the itemsMoved signal in such a case to make sure that the view is
updated. However, it would be preferable if this signal was not emitted
because it can trigger some quite expensive operations which are not
needed at all.

This commit introduces a new signal groupsChanged and modifies
KFileItemModel and KItemListView such that these classes make use of it.
Some unit tests for the new functionality are included as well.

Thanks to Emmanuel Pescosta for finding a latent bug in the code which
was triggered by this change and fixed in
998954db6d.

REVIEW: 111808
2013-08-04 22:20:37 +02:00
Frank Reininghaus bedf1db916 Fix possible out of range error inKItemListSizeHintResolver::itemsMoved
The function assumes implicitly that the moved range always starts with
the index 0. This is indeed the case at the moment, but it might make
sense to change that in the future. This commit prevents that we get an
out of range problem then.

Thanks to Emmanuel Pescosta for finding this problem, see
https://git.reviewboard.kde.org/r/111808/
2013-08-04 21:46:08 +02:00
Frank Reininghaus 6467358eef Merge remote-tracking branch 'origin/KDE/4.11' 2013-08-04 21:28:04 +02:00
Frank Reininghaus 8bf4aab73e Add some unit tests for grouping in KFileItemModel
Hopefully, this will prevent regressions in the future.

REVIEW: 111807
2013-08-04 21:08:57 +02:00
Frank Reininghaus 3f0ed8c44a Make KFileItemModelTest faster
The 500 ms timeout before items are resorted does not make much sense in
the unit test. Removing this delay makes the test run much faster.
2013-08-04 21:04:56 +02:00
l10n daemon script c03e7a3272 SVN_SILENT made messages (.desktop file) 2013-08-04 04:16:50 +00:00
Frank Reininghaus 4e67f53f1c Do not enable the "Create New..." menu when a search is finished
BUG: 321577
FIXED-IN: 4.12.0
REVIEW: 111805
2013-07-31 19:19:30 +02:00
Frank Reininghaus b86388f9c6 Do not allow that panels are dragged out of the main window
This feature might have been useful in some cases, but it's most likely
not useful enough to justify that we accept the bugs that it causes.
Even though some of these bugs are not Dolphin's fault at all, they
cause serious problems for users in some cases.

I'm pushing this commit to master only because I prefer to not push such
behavior changes to 4.11 at this point of the release cycle.

BUG: 288629
CCBUG: 322299
CCBUG: 322812
FIXED-IN: 4.12.0
REVIEW: 111692
2013-07-29 23:22:02 +02:00
Frank Reininghaus 8552eb5d75 Merge remote-tracking branch 'origin/KDE/4.11' 2013-07-29 23:16:58 +02:00
Frank Reininghaus 09bf5b66dc When pasting a folder and expanding it, do not select its children
Thanks to Emmanuel for pointing out a problem with my first patch.

BUG: 322965
FIXED-IN: 4.11.0
REVIEW: 111722
2013-07-29 23:15:49 +02:00
Fabio D'Urso 29013ed214 Don't let HTML-like filenames be interpreted as HTML strings
So that filenames that look like HTML don't get fancy-formatted when
we show info about them (i.e. on hover)

This patch fixes the same issue in two places:
 - dolphin, by setting Qt::PlainText on the status bar's label
 - konqueror, by escaping setStatusBarText strings emitted by
   DolphinPart

BUG: 321778
FIXED-IN: 4.11.0
REVIEW: 111746
2013-07-29 11:21:55 +02:00
Frank Reininghaus 15107c780c Do not convert a KUrl to a QString and back again
This small change saves a lot of CPU cycles when the items are resorted.

REVIEW: 111700
2013-07-28 23:36:43 +02:00
Emmanuel Pescosta 32bf4827c4 Don't open .desktop files with http:/https: urls in Dolphin,
open these urls in the default browser instead.

BUG: 283475
BUG: 318217
FIXED-IN: 4.11.0
REVIEW: 111674
2013-07-26 15:05:40 +02:00
Frank Reininghaus 611c935e03 Merge remote-tracking branch 'origin/KDE/4.11' 2013-07-25 22:35:37 +02:00
Frank Reininghaus 55a989626d Fix maximum value for scroll bar when deleting items in Details View
The problem was that the view heigt minus the header height was
subtracted from maximumScrollOffset() to determine the maximum value
of the scroll offset of the top of the view.

However, the top of the view is the part that is hiden behind the
header. Therefore, the full view height must be subtracted from
maximumScrollOffset.

The remaining bits of bug 319951 were fixed by other recent commits.

Thanks to Emmanuel Pescosta for helping to track down the problem!

BUG: 319951
FIXED-IN: 4.11.0
REVIEW: 111486
2013-07-25 22:25:18 +02:00
Frank Reininghaus 08c2f7f5fb Prevent that removing items can cause icons to overlap
When items are removed, new items may become visible because of that.
This includes

(a) Items *behind* the removed range. KItemListView may try to create
    their widgets at their "imaginary" old positions and move them to
    the new position with an animation.

(b) Items *before* the removed range, if the deletion causes the view
    to scroll up. In that case, the "imaginary" old position and the new
    position was equal, but KItemListView still tried to determine the
    "old" position by adding the number of removed items to the index.
    The result was that the widgets were created at completely wrong
    positions, and no animation was started to fix this.

Thanks to Emmanuel for helping to find the cause of this bug!

BUG: 302373
FIXED-IN: 4.11.0
REVIEW: 111630
2013-07-25 22:15:19 +02:00
l10n daemon script f89b412a8a SVN_SILENT made messages (.desktop file) 2013-07-25 06:33:03 +00:00
l10n daemon script 5e96822ee3 SVN_SILENT made messages (.desktop file) 2013-07-25 03:57:05 +00:00
Frank Reininghaus 3991e9d24e Make sure that widgets are initialized when changing the view mode
The problem was that DolphinItemListView overrides the virtual function
onItemLayoutChanged() without calling the base class implementation.
Therefore, KStandardItemListView::updateLayoutOfVisibleItems(), which
calls initializeItemListWidget(), is never called.

This patch refactors the "change item layout"/"supports item expanding"
code a bit to make it more robust and fix the problem that the view
looks "messed up" when switching from Details View without expandable
folders to Icons View.

I'm only pushing this patch to master (going to be KDE 4.12).
The patch is a bit too intrusive for the KDE/4.11 branch for my taste
at this point of the release cycle, and the bug is not a real
showstopper. If it works well in master, one could consider backporting
it to a 4.11.x bug fix release.

Thanks to Emmanuel Pescosta for helping to analyze this issue.

BUG: 302703
REVIEW: 111632
FIXED-IN: 4.12.0
2013-07-24 22:31:48 +02:00
Frank Reininghaus 0ad86983f4 Do not try to smooth-scroll past the end of the view
KItemListSmoothScroller::scrollTo(qreal position) did not check if
'position' is a valid value. Even if the view is scrolled to the bottom
already, it tried to scroll further and activated "smooth scrolling"
when the mouse wheel is used. Because it never got out of the "smooth
scrolling" state then, it got confused when changing the directory, and
restoring the correct scroll offset could fail.

BUG: 322212
FIXED-IN: 4.11.0
REVIEW: 111557
2013-07-22 19:16:07 +02:00
Frank Reininghaus 9d6d998a51 Fix "truncated header" in Details View with non-Oxygen styles
The code for painting the "empty header" was inconsistent with the
headers of the other columns, which is probably the reason why the other
styles got confused

a) No QStyleOptionHeader is used
b) Even if an empty header must be drawn, the last column is drawn with
   the option QStyleOptionHeader::End.

According to Christoph, it still doesn't work with the Skulpture style,
but it seems that the patch does at least not make things worse.

BUG: 301800
FIXED-IN: 4.11.0
REVIEW: 111608
2013-07-22 19:04:14 +02:00
Frank Reininghaus 0f853681ab Fix build if HAVE_NEPOMUK is not defined
We really have to make nepomuk-core and nepomuk-widgets a hard
dependency in the framworks era.
2013-07-18 22:51:21 +02:00
Emmanuel Pescosta aa2dda8cb4 Overwrite the changed role value with an empty QVariant,
because the nepomuk roles provider doesn't overwrite it when the property
value list is empty.

BUG: 322348
REVIEW: 111505
FIXED-IN: 4.11.0
2013-07-18 17:07:34 +02:00
Frank Reininghaus 63b26cbf2c Load unknown icons for items just before showing items in the view
Rather than loading many icons (without full mime type determination)
in advance, we make sure that an item has an icon just before it is
shown in the view. This makes sure that no "unknown" icons are shown
unnecessarily, and saves some resources.

REVIEW: 111396
2013-07-12 08:27:05 +02:00
Frank Reininghaus 6028bd7cf6 Fix O(N^2) complexity issue in KItemListView::slotItemsRemoved()
If many item ranges are removed, KItemListView::slotItemsRemoved()
could take very long because it looped over all items after the first
removed one for every removed range, even if most of these items are
not visible at all.

This commit improves this by just looping over the visible items (whose
number is limited by the window size) for each range.

Test case (for very large N):

touch {1..N}.png
touch {1..N}.jpg

(wait until all files are shown in the view)

rm *.jpg

REVIEW: 111398
2013-07-05 19:51:14 +02:00
Frank Reininghaus 837be34333 Keep the "item size hints" of moved items
It's quite expensive to re-calculate them, so we should better just move
them to the correct position, rather than throwing them away.

REVIEW: 111399
2013-07-05 19:42:39 +02:00
Frank Reininghaus 786cea0076 Make sure that KItemListSizeHintResolver is always consistent
This was the root cause of bug 317827. The assert tried to make sure
that we never access KItemListSizeHintResolver from
KItemListViewLayouter inside the loop over the item ranges. This would
be dangerous because it might be in an inconsistent state - the removed
item ranges were removed step by step, so accessing the item size hints
before the operation was finished could lead to wrong results.

The solution is to insert/remove all item ranges immediately. A nice
side effect is that there are no sources of O(N^2) complexity in
KItemListSizeHintResolver any more if many item ranges are
inserted/removed.

BUG: 317827
FIXED-IN: 4.11.0
REVIEW: 111382
2013-07-04 23:35:01 +02:00
Frank Reininghaus 508661100f Fix crash when dropping URLs on the URL navigator's drop down menus
The problem was that the files were copied/moved inside the nested event
loop of the drag, which caused problems if the "File exists" dialog was
shown.

The solution is to make the copy/move operation delayed, such that it is
executed in the main event loop.

Note that dropping files on these menus does apparently not work at the
moment when using the Oxygen style (see bug 310016).

BUG: 192139
BUG: 256338
BUG: 293220
BUG: 309076
FIXED-IN: 4.11.0
REVIEW: 111273
2013-07-02 19:27:06 +02:00
Frank Reininghaus 4ff5ae361d Make it clear that the Trash/Delete confirmations apply to all KDE apps
FIXED-IN: 4.11.0
REVIEW: 111324
2013-07-02 19:18:43 +02:00
Frank Reininghaus 82ea33762f Prevent some unnecessary layoutings when the view size is changed
In Icons/Details (Compact) View, no layouting is necessary if the view
height (width) changes.

REVIEW: 111322
2013-07-02 19:13:43 +02:00
Frank Reininghaus 2a612e12ce Replace QList by QVector if the elements are larger than a pointer
If the elements are larger than a pointer, QList does not store the
elements themselves, but pointers to them in a contiguous block of
memory. This wastes quite a bit of memory. This can be prevented easily
by using QVector instead.

REVIEW: 111304
2013-06-30 14:26:24 +02:00
Vishesh Handa dedebed468 Dolphin: Use the Nepomuk2::FileMetaDatConfigWidget
Instead of the KFileMetaDataConfigurationWidget

REVIEW: 111294
2013-06-29 03:38:09 +05:30
Frank Reininghaus 7799bf1828 Fix memory leak in KFileItemModel
Since m_pendingItemsToInsert is a list of pointers now (and not a list
of KFileItems, as in the 4.10 branch), we have to delete all pointers
when clearing or destroying the model.

I think that no review request is necessary for this small and obvious
change.

CCMAIL: emmanuelpescosta099@gmail.com
2013-06-28 21:39:35 +02:00
Emmanuel Pescosta 5ca5a8f3b6 Remove the space (1 pixel) between the file name and the file
icon in Compact View and Details View mode.

BUG: 320899
FIXED-IN: 4.11.0
REVIEW: 111244
2013-06-26 22:07:57 +02:00
Emmanuel Pescosta 391d36edf7 Re-enable expandable folders for network top level folders (remote:/)
Added a hash table for target url to url mapping. So when the dir lister
sends us the target url as directory url, we can use the url mapping table
to get the right "Dolphin internal" directory url, which is the non-target url.

BUG: 306219
FIXED-IN: 4.11.0
REVIEW: 111252
2013-06-26 22:04:52 +02:00
Emmanuel Pescosta 1634501b0e Fix the "dropped files are not selected" regression that has
recently been brought up and that have been caused by review 107351 / commit
fd65a97b07

CCBUG: 233335
FIXED-IN: 4.11.0
REVIEW: 111254
2013-06-26 22:00:09 +02:00
Frank Reininghaus 913e49e915 Merge remote-tracking branch 'origin/KDE/4.10' 2013-06-26 21:26:21 +02:00
Frank Reininghaus 559fdae18f Use the KDE SC version also as the Dolphin versions
This has some advantages:

(a) The version actually changes for every bug fix release, making it
    easier to find out which version a bug reporter has used.

(b) No changes in Dolphin's source code are required to keep the version
    always up to date.

(c) It is more transparent for users because there are not two different
    versions any more.
2013-06-26 21:24:15 +02:00
Frank Reininghaus d72ce53141 Fix performance regression when loading folders in Details View
When using Details View, only insert all pending items immediately if
new items are inserted which might be children of a pending item. Fixes
the problem that inserting the items in multiple bunches slows down the
folder loading.

Note that the cause of the slowness when inserting in multiple bunches
is that KItemListSizeHintResolver needs O(N^2) time in the worst case
for inserting N items into a model with N existing ones.

REVIEW: 111226
2013-06-26 21:18:37 +02:00
Kai Uwe Broulik bbbf039338 Improve filterbar lock button.
Use object-(un)locked icon and make it flat.

REVIEW: 111233
2013-06-26 11:27:01 +02:00
Vishesh Handa 4c99efe4d2 Dolphin Search Date: Set the proper date
QDate's api is not that intuitive and the addDays functions return a
QDate with those amount of days. They do not modify the original QDate.

BUG: 321198
2013-06-26 01:32:33 +05:30
Dawit Alemayehu d72f5d2db7 Do not show "Move To Trash" action in context menu for remote URLs.
BUG: 261762
REVIEW: 111206
FIXED-IN: 4.11
2013-06-24 22:41:53 -04:00
Frank Reininghaus 51b978f7fd Merge remote-tracking branch 'origin/KDE/4.10' 2013-06-24 22:02:04 +02:00