Commit graph

19058 commits

Author SHA1 Message Date
Wolfgang Bauer 1c856e4477 Revert "Files passed as arguments: Ignore unsupported files"
This reverts commit cd9e50ae4f.

See bug#327224 for details.
2013-11-06 16:46:09 +01:00
Frank Reininghaus 999300f4a1 Merge remote-tracking branch 'origin/KDE/4.11' into KDE/4.12 2013-11-05 08:47:37 +01:00
Frank Reininghaus 7128eb58ac Only do a fast pre-sorting when "Sort by Name" is used
This is a follow-up to commit 0e9f4a3987,
which tries to speed up sorting the items naturally by their name using
the idea that a fast non-natural pre-sorting already sorts the items
mostly correctly and thus reduces the number of expensive natural
comparisons.

This change only makes sense if the view is really sorted by "Name". In
other cases, the pre-sorting will most likely not be useful.

Thanks to Christoph Feck for pointing this out!
2013-11-05 08:44:31 +01:00
Emmanuel Pescosta 1af756f101 Fix Bug 287983 - Dolphin truncates tooltip information for long file names
Use KStringHandler and QTextLayout to wrap the text (file name)
into the maximum width of the label "name".

Make use of QFontMetrics to calculate a font size aware tooltip size.

BUG: 287983
FIXED-IN: 4.11.3
REVIEW: 113101
2013-11-02 00:12:33 +01:00
Frank Reininghaus 5c5d87fec4 Store the selected items in a more efficient way
Since Dolphin 2.0, we have stored the selected items in a QSet<int>,
which is neither space-efficient nor particularly fast when inserting
many items which are in a consecutive range.

This commit replaces the QSet<int> by a new class "KItemSet", which
stores the items in a sorted list of ranges. For each range, we only
store the first index and the length of the range, so we need a lot
less memory for most common selection patterns, and we also save quite
a few CPU cycles in many situations, because adding an item to the
KItemSet will in many cases not need a memory allocation at all, and
it's particularly easy when inserting sorted items into the KItemSet in
a row.

KItemSet contains a minimal subset of QSet's API which makes it
suitable as a drop-in replacement for our needs. It also has iterators,
such that the items can be iterated through easily, also with foreach.
One advantage of KItemSet compared to QSet<int> is that the items are
always iterated through in ascending order.

REVIEW: 113488
2013-10-30 23:22:23 +01:00
Frank Reininghaus 0e9f4a3987 Sort in items in two stages to speed up natural sorting
Sort the items in a folder first according to their name, without doing
a natural/locale-aware sorting. This is very fast, but the order of the
items is then already close to the final order in most cases.

The number of expensive natural comparisons required to sort the items
is thus greatly reduced.

In my experiments with a folder with 100,000 items, the time required
to sort the files was reduced by 63% with this patch.

REVIEW: 113485
2013-10-30 17:48:42 +01:00
Frank Reininghaus dcfed0028c Prevent storing some redundant data in KItemListViewLayouter
In KItemListViewLayouter, we have always stored a QRectF for each item,
which is "the area that the item occupies". However, the size of the
QRectF is already stored in the size hint resolver.

Therefore, it is sufficient to store the position of the top left
corner of the QRectF in a QPointF and construct the QRectF on demand.

This patch reduces the memory usage by 16 bytes for each item in the
view:

* a QRectF is 4 doubles -> 32 byes
* a QPointF contains only 2 doubles -> 16 bytes

REVIEW: 113487
2013-10-30 17:40:23 +01:00
Frank Reininghaus 07f0d125b2 Restore the tree state in Details View if a folder is re-expanded
This patch actually does two things when collapsing an expanded folder
with expanded children:

(a) It removes all expanded children (which are removed from the model)
    from m_expandedDirs.

(b) It remembers the expanded children and restores them if the
    top-level folder is re-expanded.

BUG: 304363
FIXED-IN: 4.12.0
REVIEW: 113293
2013-10-26 09:36:50 +02:00
Frank Reininghaus 8f6471b664 Merge remote-tracking branch 'origin/KDE/4.11' 2013-10-26 09:30:18 +02:00
Frank Reininghaus ec4efae642 Fix broken view state restoration
The fix for bug 161385 (which was about Dolphin still showing an empty
view if a device that had been unmounted earlier was clicked in the
Places Panel) caused a regression: the view state (current item, scroll
position, Details View expansion state) was not restored any more when
going "Back".

The reason is that "m_view->reload()" in
DolphinViewContainer::setUrl(const KUrl& newUrl) was always executed
just after entering a directory, and that command overwrites this
information.

Distinguishing between "change URL" and "reload the view" works better
if it's done in DolphinMainWindow instead of DolphinViewContainer.

BUG: 326039
FIXED-IN: 4.11.3
REVIEW: 113290
2013-10-26 09:24:04 +02:00
l10n daemon script 3b5eb11415 SVN_SILENT made messages (.desktop file) 2013-10-19 06:28:00 +00:00
l10n daemon script 1f81f98206 SVN_SILENT made messages (.desktop file) 2013-10-19 03:51:56 +00:00
Frank Reininghaus 6771d9510f Two small simplifications in KItemListViewLayouter
1. Remove the unneeded variable rowCount.

2. Simplify the calculation of the member m_maximumScrollOffset. We can
   just use the current value of "y" because this is the offset that
   the next row would have.

REVIEW: 113233
2013-10-16 23:02:06 +02:00
Frank Reininghaus 1a997903fd Abort loading the current URL if the user presses Escape
BUG: 323181
FIXED-IN: 4.12.0
REVIEW: 113234
2013-10-16 22:39:47 +02:00
Kevin Ottens 81c99da7e0 Make it build with QT_STRICT_ITERATORS 2013-10-16 19:24:01 +02:00
l10n daemon script 950e6f5d15 SVN_SILENT made messages (.desktop file) 2013-10-16 03:58:38 +00:00
David Faure 3a069b2373 Merge remote-tracking branch 'origin/KDE/4.11' 2013-10-15 09:08:47 +02:00
David Faure aa0e209f57 Simplify code using foreach() 2013-10-15 09:07:59 +02:00
David Faure 0e92874175 Fix TODO, unused "bool copy" 2013-10-15 09:07:58 +02:00
David Faure ae76d6f3ff Fix DnD crash for more cases (moving N bookmarks into subfolder or parent folder)
Solution: copy all selected bookmarks first, then delete them all
(at their possibly updated address).

BUG: 287038
FIXED-IN: 4.11.3
2013-10-15 09:07:58 +02:00
Kai Uwe Broulik aa3982d83a Add detailedsorry and detailderror support to kdialog
DIGEST: For all those of you writing handy console scripts, kdialog now supports detailederror and detailedsorry methods for providing additional information in a messagebox
REVIEW: 105304
2013-10-14 20:39:41 +02:00
l10n daemon script 5abe7a70d8 SVN_SILENT made messages (.desktop file) 2013-10-14 06:54:59 +00:00
l10n daemon script e8035defa9 SVN_SILENT made messages (.desktop file) 2013-10-14 04:14:41 +00:00
Frank Reininghaus 42c26b1554 Fix crash when triggereing the "Compare files" action via D-Bus
If the number of selected items is not two, Dolphin disables this
action. However, it is still possible to trigger it via D-Bus, and this
could cause a crash in DolphinMainWindow::compareFiles() because this
function did not test at all if there are really two items selected.

This patch adds such a check and simplifies the code in that function.

BUG: 325517
FIXED-IN: 4.11.3
2013-10-13 10:55:21 +02:00
Erik Hahn cd9e50ae4f Files passed as arguments: Ignore unsupported files
With this patch, Dolphin ignores all files passed to it that it can't

Also, archives are now opened inside Dolphin so it can be used as an
archive manager at least for local files. If the user tries to open a
remote archive Dolphin still opens it externally; I have observed that
if it receives one as an argument, it will display a pseudo-folder that
contains only said archive. So having it set as the archive handler is
still broken, but in a less annoying way.

CCBUG: 318683
REVIEW: 113191
FIXED-IN: 4.11.3
2013-10-13 10:48:00 +02:00
Dawit Alemayehu 6f45a12136 Moved all the extension code into dolphinpart_ext.*
REVIEW: 113132
2013-10-12 13:33:42 -04:00
Albert Astals Cid d6f614dc8d Merge remote-tracking branch 'origin/KDE/4.11' 2013-10-10 12:13:28 +02:00
Ömer Fadıl Usta c5b668c8f3 Missing response for "Authentication failure" in kdepasswd
REVIEW: 110108
2013-10-10 12:11:39 +02:00
Emmanuel Pescosta 4873685ebd Use the icon size from KItemListStyleOption for the width and height of the
expansion area instead of KIconLoad::SizeSmall.

BUG: 325543
REVIEW: 113169
FIXED-IN: 4.12
2013-10-09 19:52:53 +02:00
l10n daemon script ea78f8f44a SVN_SILENT made messages (.desktop file) 2013-10-09 06:49:57 +00:00
l10n daemon script cbb2d014d4 SVN_SILENT made messages (.desktop file) 2013-10-09 04:07:56 +00:00
Frank Reininghaus 7327e466af Merge remote-tracking branch 'origin/KDE/4.11' 2013-10-07 09:31:45 +02:00
Frank Reininghaus 84b40da88d Make the code that removes items from KFileItemModel more robust
When we remove items from the model, we called the function
KFileItemModel::removeItems(const KFileItemList&, RemoveItemsBehavior).
This function then looked up the indexes of the items using the hash
m_items. This is wasteful in the situations when the indexes of the
removed items are known in advance (like when an expanded folder is
collapsed in Details View), and it can cause trouble if one item is
contained in the model multiple times (can happen when searching, and a
file both matches the search and is a child of a folder that matches
the search). Even if expanding folders in the search results list might
not be particularly useful most of the time, it makes sense to make the
model more robust to prevent crashes and other unexpected behavior in
such situations.

This patch makes the following changes to achieve that goal:

* Change the argument of removeItems() from KFileItemList to
  KItemRangeList. To make this work, the "look the indexes up in
  m_items" code is moved from that function to slotItemsDeleted(). In
  the other places where removeItems() is called, the indexes are
  calculated directly (which is not more difficult than determining the
  removed items as a KFileItemList, if one considers that we needed the
  function childItems(KFileItem) for that, which is not needed any more
  with this patch).

* Also removeFilteredChildren() takes a KItemRangeList now. Rather than
  putting the parent KFileItems into a QSet for O(1) lookup (which
  prevents O(N^2) worst case behavior for the entire function), it uses
  a QSet<ItemData*> now, which should even be more efficient (hashing a
  pointer is cheaper than hashing a KFileItem/KUrl).

BUG: 324371
BUG: 325359
FIXED-IN: 4.12.0
REVIEW: 113070
2013-10-07 09:26:51 +02:00
Frank Reininghaus 7f8dca1b80 Reload the view if a previously unmounted device is mounted again
The problem was that DolphinViewContainer::setUrl(newUrl) was ignored
if newUrl is equal to the URL which is shown in the view already.

The new approach is to reload the view in that method if it is empty, to
make sure that we do not miss that a previously unmounted device has
been re-mounted.

Thanks to Grigoriadis Grigoris for analyzing the root cause of this
issue!

BUG: 161385
FIXED-IN: 4.11.3
2013-10-07 09:17:48 +02:00
Frank Reininghaus c802f3d2e7 Include "Space" in the keyboard search string
Before this commit, we only added pressed keys to the search string if
they have no other meaning. This means that files containing a Space in
their name could not be searched because Ctrl+Space toggles the
selection state of the current item, and Space alone selects the
current item.

After this commit, Space is added to the search string if

(a) the key press did not have any other effect, i.e., if Ctrl was not
    pressed, and the current item is selected already, and
(b) a keyboard search has been started already (to prevent unexpected
    effects when pressing Space accidentally - I think that it's rather
    uncommon to have files whose names start with a Space - and to make
    the unit test simpler).

I modified the unit test of KItemListController, which did not test
keyboard search yet. This uncovered a small problem in
KItemListController::slotChangeCurrentItem() when NoSelection mode is
used. It's not really relevant for anything that is executed inside
Dolphin, but I still fixed it to make the unit test happy.

BUG: 324479
FIXED-IN: 4.11.3
REVIEW: 113071
2013-10-07 09:09:00 +02:00
Andrea Iacovitti ac823eabbc Merge remote-tracking branch 'origin/KDE/4.11' 2013-10-06 20:49:42 +02:00
Andrea Iacovitti 5d72d41c94 Pressing "reset" button results in a call to KProxyDialog::load(): make
sure showEnvValueCheckBox is unchecked before setting proxy environment
variables in the ui. It could have been previously checked by user.
2013-10-06 20:24:21 +02:00
Dawit Alemayehu 677d43bdb5 Merge remote-tracking branch 'origin/KDE/4.11' 2013-10-06 12:40:34 -04:00
Dawit Alemayehu cd67f0651b Make sure clicking reset works under every circumstance.
BUG: 318412
FIXED-IN: 4.11.3
2013-10-06 12:40:08 -04:00
Dawit Alemayehu 911849ac18 Merge remote-tracking branch 'origin/KDE/4.11' 2013-10-06 11:53:19 -04:00
Andrea Iacovitti 623adc32ca Use the correct variable, instead of the entire QStringList, to fill in
lineedit's text in autoDetectSystemProxy().
When saving for "System Proxy" configuration be sure to write the name
of environment variables and not their values in the configuration file.
Added missing signal connection for mUi.systemProxyRadioButton.
Connect slotChanged() to textEdited() signal, instead of textChanged(),
for systemProxy's lineedits: this avoid to emit changed() when
"Show the value of the envirnment variables" checkbox is clicked.

BUG: 304707
FIXED-IN: 4.11.3
REVIEW: 113129
2013-10-06 15:12:27 +02:00
l10n daemon script b3ce215ca2 SVN_SILENT made messages (.desktop file) 2013-10-06 04:10:57 +00:00
Frank Reininghaus d7446760f7 Save memory and time in KFileItemModel by lazy-loading the "ItemData"
To reduce unnecessary memory comsumption and CPU usage, we only fill the
QHash<QByteArray, QVariant> if the methods data(int) or setData(int) are
called for the corresponding index, or the data is necessary for sorting
the model.

According to my tests, this patch reduces the memory usage when loading
a folder with 100,000 items by 17% in Icons View, and by 26% in Details
View.

REVIEW: 112725
2013-10-02 19:08:39 +02:00
Frank Reininghaus d395680268 Merge remote-tracking branch 'origin/KDE/4.11' 2013-10-01 00:15:04 +02:00
Frank Reininghaus 54ba8cc85b 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 bbbfeb28c5 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 befa646f8f 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 5751238b34 SVN_SILENT made messages (.desktop file) 2013-09-27 07:07:49 +00:00
l10n daemon script 9ef355c866 SVN_SILENT made messages (.desktop file) 2013-09-27 04:24:51 +00:00
Frank Reininghaus 7dde35ccb9 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