Commit graph

4780 commits

Author SHA1 Message Date
Frank Reininghaus 4cb0a239e5 Add unit test for the calculation of "name" groups with expanded items
This prevents a possible regression that would have happened with the
first version of https://git.reviewboard.kde.org/r/112725/

The problem was that isChildItem(int index) would return "false"
incorrectly when the QHash for that item was not initialized yet. The
grouping code would then try to read the "text" from the empty QHash,
which yielded an empty QString, and then accessing the first character
of that string caused a crash.
2013-10-01 00:09:25 +02:00
Emmanuel Pescosta c44b9e685e Show the right version states for expanded items.
BUG: 267171
FIXED-IN: 4.11.3
REVIEW: 112980
2013-09-29 18:08:06 +02:00
Frank Reininghaus 08710b05c7 Make sure that removeExpandedItems() also removes filtered items
This fixes the problem that filtered child items in Details View may
reappear when switching the view mode and the clearing the filter.

BUG: 325344
REVIEW: 112962
FIXED-IN: 4.11.3
2013-09-29 15:45:14 +02:00
l10n daemon script 71a2be8d4c SVN_SILENT made messages (.desktop file) 2013-09-27 07:07:49 +00:00
l10n daemon script c185694f79 SVN_SILENT made messages (.desktop file) 2013-09-27 04:24:51 +00:00
Frank Reininghaus 4a093f956b Move KItemRange to its own header
Also factor out the code that transforms a sorted list of ints to a
KItemRangeList. This removes some duplicated code from KFileItemModel.

Note that overriding operator<<() in KItemRangeList was necessary
because it's not a typedef for QList<KItemRange>, but a class derived
from that now, and some code fails to compile if the return type of
that function is QList<KItemRange> and not KItemRangeList.

REVIEW: 112728
2013-09-17 00:11:42 +02:00
Frank Reininghaus 083248d16b Merge remote-tracking branch 'origin/KDE/4.11' 2013-09-14 15:11:17 +02:00
Frank Reininghaus ced472be07 Make preview loading faster when scrolling
KFileItemListView notifies KFileItemModelRolesUpdater of changes of the
visible index range and the icon size with a delay, to prevent that
expensive operations are triggered repeatedly, and that scrolling feels
sluggish because the GUI thread is blocked by icon loading.

This patch ensures that the "long" delay of 300 ms is only used when
the zoom level is changed, and the "short" delay if only the visible
index range has changed.

Thanks to Christoph Feck for helping to analyze this problem!

BUG: 322093
FIXED-IN: 4.11.2
REVIEW: 112580
2013-09-14 14:59:50 +02:00
Kai Uwe Broulik 53c8c76cee Remove "Copy text" statusbar contextmenu entry
REVIEW: 112355
2013-09-12 18:45:41 +02:00
Emmanuel Pescosta 88a7794097 Fix Bug 311099 - View the underscore when using Ctrl + PagDown
Take the style option vertical/horizontal margin into account
for the calculation of the new scroll offset.

Thanks to Frank for pointing out two other problems with "Page Up/Down" and providing
a better way to fix these problems. :)

BUG: 311099
FIXED-IN: 4.11.2
REVIEW: 112678
2013-09-12 13:58:29 +02:00
Frank Reininghaus e03a687c92 Merge remote-tracking branch 'origin/KDE/4.11' 2013-09-09 21:43:29 +02:00
Frank Reininghaus 4416377eae Always sort items correctly when the refreshItems() signal is received
When sorting by, e.g., "Size", and the name is used as a fallback
because there are multiple files with the same size, the refreshItems
signal that is received when a file's name is changed either with the
dialog or outside the current view did not cause the view to be resorted
after commit d70a481180. This patch fixes
it.

BUG: 324713
FIXED-IN: 4.11.2
REVIEW: 112561
2013-09-09 21:38:47 +02:00
Frank Reininghaus 258f0f60fe Merge remote-tracking branch 'origin/KDE/4.11'
The most recent commit from the KDE/4.11 branch (new unit test) had to
be modified slightly due to the changed signal emission when resorting
the model changes only the groups, and not the order of the items
(groupsChaged instead of itemsMoved).
2013-09-09 21:27:22 +02:00
Frank Reininghaus 2d8872c3ac Test if the groups are updated correctly when items are refreshed
This unit test will hopefully prevent regressions in the future. It is
the first part of https://git.reviewboard.kde.org/r/112561/.
2013-09-09 21:13:38 +02:00
Frank Reininghaus 7e30467679 Make expandedParentsCount() work without accessing the data hash
The idea is that we no longer assume that the "expandedParentsCount"
for each item will be stored in the QHash. It is only accessed for
items which are expanded, and which are not top-level items (i.e.,
which have an expandedParentsCount > 1).

Some unit tests are added to improve the coverage of the affected code.

REVIEW: 112562
2013-09-07 18:06:53 +02:00
Emmanuel Pescosta 1848854c6d Nothing special, just a little bit of code cleanup in KItemListViewLayouter::doLayout().
Make use of QSizeF::transpose() and simplify the m_itemInfos usage.

REVIEW: 112535
2013-09-05 17:03:04 +02:00
Emmanuel Pescosta e1d88c4d69 Fix Bug 296970 - split view wrong behavior with search tab
Implemented setActive(bool active), isActive() and activated() signal
for DolphinSearchBox - similar to the KUrlNavigator implementation.

BUG: 296970
FIXED-IN: 4.11.2
REVIEW: 112534
2013-09-05 16:22:59 +02:00
Frank Reininghaus 7b862465d4 Merge remote-tracking branch 'origin/KDE/4.11' 2013-09-04 21:53:08 +02:00
Frank Reininghaus 4bfc28cb4b Count the items inside directories in another thread
This prevents that the GUI freezes if there are many files inside the
directory, or if the access to the directory is slow for some other
reason.

BUG: 318518
REVIEW: 111920
FIXED-IN: 4.12.0
2013-09-04 21:50:16 +02:00
Frank Reininghaus 8f7c3619ec Try to avoid calling the model's data method if only "text" is needed
Currently, KStandardItemListWidgetInformant::itemSizeHint() calls the
model's data(int) method for every single item, but the full data is
actually only needed for the size calculation in Compact View. In
Details View, no data is needed at all to determine the size required
for the item, and in Icons View, only the name is needed.

This patch makes it possible for subclasses of
KStandardItemListWidgetInformant to provide an alternative way to
obtain the "text", and implements this in the subclass
KFileItemListWidgetInformant.

The final goal is to achieve that the QHash which contains all data
for a file item is only created if it is really needed, e.g., because
the view needs access to the data for displaying the item on the
screen.

REVIEW: 112253
2013-09-04 21:37:01 +02:00
Christoph Feck 5df1b07bbc Fix color role of services list
Fixes the color of non-selected items to make them
readable with every color scheme.

BUG: 286459
FIXED-IN: 4.11.2
REVIEW: 112483
2013-09-03 22:05:05 +02:00
Emmanuel Pescosta a4ef4bbfde Replaced all KNewFileMenu usages in DolphinPart by DolphinNewFileMenu.
Removed all signal-slot-connections related to DolphinNewFileMenu->errorMessage(QString)
in DolphinMainWindow and DolphinContextMenu and replaced it by a better solution.

Now we make use of the already existing DolphinNewFileMenuObserver singleton class to achieve a better
error handling, because every newly created DolphinContextMenu instance registers himself by DolphinNewFileMenuObserver
and we use this to connect the errorMessage(QString) signal of every DolphinContextMenu instance to the errorMessage(QString)
signal of the DolphinNewFileMenuObserver singleton class.

So we need only one connection from DolphinNewFileMenuObserver to DolphinMainWindow (or to DolphinPart) to
collect all error messages thrown by every DolphinNewFileMenu instance.

REVIEW: 112178
2013-08-28 18:46:45 +02:00
Frank Reininghaus cba24825c9 Merge remote-tracking branch 'origin/KDE/4.11' 2013-08-25 19:17:25 +02:00
Christoph Feck 092c820023 Move cursor to begin/end of selection before canceling it
Makes Left/Right keys consistent with QLineEdit behavior.

BUG: 323946
FIXED-IN: 4.11.1
REVIEW: 112256
2013-08-25 17:40:49 +02:00
Frank Reininghaus f830e1179c Fix filename trucation issues in Icons View with maximum number of lines
When the name of a file is too long to be shown inside the maximum
number of lines, the last line is elided. However, there were several
problems before this commit:

(a) "lastTextLine", which contains the text to be elided, was not
    assigned the complete remaining text, but only the part that would
    be put into the last line if there were more lines following. This
    may be less than what would fit into the line because we try to not
    break the text at random points.

(b) QFontMetrics::elidedText() was not given the width that is available
    for the last line (that would be maxWidth), but only the width that
    would be occupied by the text if there were more lines following
    (line.naturalTextWidth()).

(c) The variable "nameWidth", which is required to calculate the QRectF
    that is reserved for the name, was not updated correctly.

The result is that the text was sometimes trucated too early (especially
if there would be a line break early in the text if we had more lines
available), that there may be insufficient space to show the "...", and
that the hover/selection rectangle might be too narrow.

BUG: 304558
BUG: 321882
FIXED-IN: 4.11.1
REVIEW: 112265
2013-08-25 16:27:36 +02:00
Emmanuel Pescosta 2bdce34fe1 Adjust the size and position of the selection toggle on icon
resize (when changing the zoomlevel).

BUG: 310412
REVIEW: 112250
FIXED-IN: 4.11.1
2013-08-24 21:00:26 +02:00
Frank Reininghaus ebfcb5e19b Merge remote-tracking branch 'origin/KDE/4.11' 2013-08-24 20:27:30 +02:00
Frank Reininghaus 7ffa66f777 Make determining the mime type faster for folders
KFileItem::determineMimeType() not only determines the mime type, but
also the icon. For folders, it looks for a .directory file inside the
folder, where a custom icon might be stored. This can take quite a bit
of time and cause the problem that some folder's type still appears to
be "unknown" when the view is shown.

We can work around this problem by caching the folder mime type in a
static QString and applying to to all folders, which can be identified
easily with KFileItem::isDir(),

BUG: 321710
FIXED-IN: 4.11.1
REVIEW: 111830
2013-08-24 20:22:56 +02:00
Frank Reininghaus d7997f16a7 Delay the deletion of the role editor as long as possible
This should prevent crashes that can be caused if the view is closed in
a nested event loop that is run from the role editor.

BUG: 322969
FIXED-IN: 4.11.1
REVIEW: 111988
2013-08-24 20:06:11 +02:00
Emmanuel Pescosta efdef7e40c Make use of the "resort all items timer" in KFileItemModel::slotRefreshItems
to avoid too much expensive resorting calls, in case of many refresh items signals.

Followup to patch 111146

CCBUG: 303873
CCBUG: 299565
BUG: 323789
FIXED-IN: 4.11.1
REVIEW: 111195
2013-08-24 18:13:56 +02:00
Emmanuel Pescosta edcc9d5cee Replaced the loop to fill m_sizeHintCache with QSizeF() by a simple m_sizeHintCache.fill() in KItemListSizeHintResolver::clearCache().
REVIEW: 112179
2013-08-24 18:03:40 +02:00
Christoph Feck 5db3bdb9f4 Merge remote-tracking branch 'origin/KDE/4.11' 2013-08-20 12:21:44 +02:00
Christoph Feck 078ebd53e1 Fix crash when failing to get audio CD block device
CCBUG: 314544
REVIEW: 112117
2013-08-20 12:19:15 +02:00
Fabio D'Urso 55bf917361 dolphin: Show full KFileItem statusbar text with hovered folders too
This patch changes the status bar text dolphin shows when a folder is
hovered. It now shows full folder info, eg:
  "mydir (folder, symlink to /opt/mydir")
instead of:
  "mydir"
This is consistent with dolphin's behavior on regular files, and
DolphinPart already does that (DolphinPart::slotRequestItemInfo has no
special cases for folders).

CCBUG: 260717
REVIEW: 112106
2013-08-18 22:16:30 +02:00
Fabio D'Urso bfb10355c9 dolphin: Show full file info in statusbar when only one file is selected
The purpose of this change is to give the user a chance to see hover
file information if it doesn't fit in the status bar, by allowing to
click on the file and hover on the status bar.

As it's now possible to have status bar texts starting with "<qt>",
DolphinPart::updateStatusBar() must escape strings. Otherwise,
filenames such as "<qt>Tes<font color=red>t" would be rendered as HTML
data in konqueror's status bar when selected.

BUG: 260717
FIXED-IN: 4.12.0
REVIEW: 111934
2013-08-18 22:08:28 +02:00
Emmanuel Pescosta 804e83f893 Cut the ropes between DolphinMainWindow and DolphinNewFileMenu. Error handling is now done via signals.
REVIEW: 111989
2013-08-16 20:22:33 +02:00
l10n daemon script b6477f4e65 SVN_SILENT made messages (.desktop file) 2013-08-15 03:59:57 +00:00
Frank Reininghaus 6bfa0ccfc7 Merge remote-tracking branch 'origin/KDE/4.11' 2013-08-15 00:15:51 +02:00
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