Commit graph

4172 commits

Author SHA1 Message Date
Frank Reininghaus dc6322dc09 Re-organize the code that compares expanded items
The previous approach, which was based on comparing the URLs as
strings, was not only very complex, but also could lead to
inconsistencies in the model, namely, that not all children were
removed from the model when the dir lister reported the parent as
deleted. Later on, this could even lead to a crash.

BUG: 311947
FIXED-IN: 4.11
REVIEW: 108766
2013-02-10 18:09:07 +01:00
Frank Reininghaus 45450959ea Add benchmark for adding many child items in a tree structure 2013-02-10 18:07:55 +01:00
Frank Reininghaus 4f5a2eb943 Include parent-child relationships in KFileItemModel's consistency check 2013-02-10 18:06:07 +01:00
Frank Reininghaus ac6d3d8250 KFileItemModel::insertItems(): reserve sufficient space for m_items
This prevents expensive and unnecessary repeated rehashing when many
items are inserted into the model.
2013-02-06 18:58:54 +01:00
Frank Reininghaus 687d5145a2 Two small optimizations in KFileItemModel::removeItems()
1. It seems that it really can happen that KFileItems that we get from
   the dir lister's itemsDeleted signal are not in the model any more,
   e.g., if a folder where hidden files are shown is left and a folder
   where hidden files are not shown is entered. There is no need to
   output warnings then.
2. Remove the emptiness-check for the KFileItemList at the beginning.
   Even in the unlikely event that we do get an empty list, we return
   just a few lines later in the code.
2013-02-03 23:28:57 +01:00
Frank Reininghaus 01dc86f0df const QList<int> -> const QList<int>& 2013-02-03 23:19:58 +01:00
Frank Reininghaus 5f6f77d481 Remove unneeded #include 2013-02-03 23:12:55 +01:00
Frank Reininghaus 5d4d73ff08 Merge remote-tracking branch 'origin/KDE/4.10'
Conflicts:
	dolphin/src/tests/kfileitemmodeltest.cpp
2013-01-30 21:06:34 +01:00
Frank Reininghaus 89134d62c7 Add unit test for bug 314046
The regression happened in the master branch only, but I think it
doesn't hurt to add the test to the stable branch.

CCBUG: 314046
2013-01-30 21:02:43 +01:00
Frank Reininghaus 4396233d21 Update Dolphin version to 2.2 for KDE 4.10.0 2013-01-29 19:13:49 +01:00
Frank Reininghaus 8371fb6d75 Fix crashes in KFileItemModel::removeItems()
These crashes were caused by the recent commit
ff3267c6dc. It introduced two problems:

a) A logic error in the code that removes the ItemData pointers from
   m_itemData that could cause crashes if multiple item ranges are
   removed, and there were un-removed items behind the last one.
b) The implicit assumption that any call of removeItems() will actually
   result in items being removed in the model. This is incorrect if
   the model is first cleared and then the hidden-files setting is
   modified, which happens if "Save view properties for each folder" is
   enabled, and a folder where hidden files are shown is left. In that
   case, the dir lister emits itemsDeleted for the hidden items after
   they have been removed from the model due to the folder change.

I'll add a unit test covering these issues soon.

Many thanks to Romário Rios and Hrvoje Senjan for testing!

BUG: 314046
2013-01-29 19:08:28 +01:00
Weng Xuetian ef248162d0 Merge branch 'KDE/4.10' 2013-01-27 14:13:04 -05:00
Weng Xuetian 2045a64ec6 escape the existing text instead of set to plain text
@info indicates it's rich text and will be added <html> tag by kdelibs,
so just escape the text that will be set to label for KDE/4.10

REVIEW: 108584
BUG: 313992
2013-01-27 14:09:12 -05:00
Frank Reininghaus 1bd91417db Merge remote-tracking branch 'origin/KDE/4.10'
Conflicts:
	dolphin/src/tests/kfileitemmodeltest.cpp
2013-01-27 15:25:47 +01:00
Frank Reininghaus f76f3a1654 Move the consistency check for KFileItemModel from the test to the class
This makes it possible to check the model's consistency also in other
places, e.g., in KFileItemModel's benchmark.
2013-01-27 15:19:39 +01:00
Frank Reininghaus 891ee0c41a Add a unit test for a recently fixed crash
Before commit 90c7fd400c, adding a
KFileItem with an empty path caused a crash in
KFileItemModel::expandedParentsCountCompare().
2013-01-27 14:09:39 +01:00
Frank Reininghaus d1b75d1d64 Performance improvements in KFileItemModel::removeItems()
The performance of this method is improved by:
a) Not removing items one by one, but doing it in a way that minimizes
   the number of moves to prevent O(N^2) worst-case complexity.
b) Not sorting the removed items using the potentially extremely slow
   KFileItemModel::lessThan. We can get the indexes of the removed items
   very easily from the hash m_items, and sorting ints is a lot faster.
c) Preventing repeated rehashing of m_items when removing the deleted
   URLs by replacing remove() by erase().

REVIEW: 108540
2013-01-27 13:07:46 +01:00
Frank Reininghaus 71be8f2bee Add some benchmarks for KFileItemModel
The benchmark executable must be run manually. It is not run
automatically with the other unit tests to prevent waste of CPU cycles
in the not-so-uncommon situation that only test failures attract
attention.
2013-01-27 12:55:37 +01:00
Luca Beltrame dfa170cb49 Merge remote-tracking branch 'origin/KDE/4.10' 2013-01-24 23:49:59 +01:00
Vishesh Handa d27c16d751 KFileItemModelRolesUpdater: Avoid multiple updates for Nepomuk data
The Nepomuk ResourceWatcher emits 3 signals - propertyChanged,
propertyAdded and propertyRemoved. We should only listen to either the
propertyChanged signal or the propertyAdded + Removed signals. There is
no point in listening to all 3 signals. That will just result in
unnecessary updates.

Additionally, we do not need to listen to the resourceCreated signal.
That is only emitted when we are watching for a specific types, which we
are not.

REVIEW: 108543
2013-01-24 23:16:27 +05:30
Frank Reininghaus 6501092421 Merge remote-tracking branch 'origin/KDE/4.10' 2013-01-24 09:39:33 +01:00
Frank Reininghaus 20c3b45449 Make the "A folder cannot be dropped into itself" message less intrusive
Showing this message in the KMessageWidget above the view, which means
that the view contents are moved down, can be extremely annoying
according to user feedback. Just showing the message in the status bar
is probably enough.

BUG: 313466
REVIEW: 108483
FIXED-IN: 4.10.0
2013-01-22 07:17:35 +01:00
Script Kiddy 17cb90c470 SVN_SILENT made messages (.desktop file) 2013-01-18 08:05:47 +01:00
Script Kiddy c652cdc531 SVN_SILENT made messages (.desktop file) 2013-01-17 12:48:56 +01:00
Luca Beltrame ee2742f889 Merge remote-tracking branch 'origin/KDE/4.10' 2013-01-16 23:42:25 +01:00
Andrea Scarpino ce4498ea06 Allow Timeline-URLs as homepage
FEATURE: 313151
REVIEW: 108428
2013-01-16 23:16:10 +00:59
Andrea Scarpino 550da74b54 Allow Timeline-URLs as homepage
FEATURE: 313151
REVIEW: 108428
2013-01-16 23:04:47 +00:59
Kai Uwe Broulik 7c43fce8bf Use proper IconSize for PlacesItemEditDialog's KIconButton
REVIEW: 108443
2013-01-16 22:54:32 +01:00
Script Kiddy b8584c8c8b SVN_SILENT made messages (.desktop file) 2013-01-16 12:34:10 +01:00
Frank Reininghaus 48231488bd Remove incorrect comments about the sorting functions
In fact, we could use the sorting functions provided by Qt or the STL.
The reason why we have our own is that we want to support parallel
sorting because sorting many items naturally by name can be expensive.
2013-01-15 19:07:36 +01:00
Frank Reininghaus b47d582d35 Update Dolphin version to 2.1.98 for KDE 4.10 RC 3 2013-01-15 18:56:14 +01:00
Frank Reininghaus d9680ead80 Re-organise the sorting code
The KFileItemModel-specific parts are now separated from the generic
ones, like the parallel sorting implementation.

REVIEW: 108386
2013-01-15 18:50:37 +01:00
Frank Reininghaus 87ac18f031 Change the sort and merge functions to a more generic form.
This might make it easier to reuse the parallel sorting code. Moreover,
some the upperBound/lowerBound functions have been removed because
equivalents are provided by the STL.
2013-01-15 18:47:51 +01:00
Frank Reininghaus c652807a19 Use std::rotate, rather than reversing three times
We need less code now, and moreover, the STL implementation of rotate
should be more efficient than three reverse() calls.
2013-01-15 18:44:42 +01:00
Simeon Bird cad45e4150 The locking around the plugin access in actions doesn't seem to be
necessary, as actions is only called from the main thread.

Also it wasn't checked consistently; if the lock could not be taken, the
plugin was accessed anyway.
2013-01-15 11:12:09 -05:00
Simeon Bird 7fe1278b1e We don't need the mutex guarding m_itemStates in the
UpdateItemStatesThread, because m_itemStates is only accessed by the
when the thread is done, and set before the thread starts.

Also combine the setData function with the constructor.
2013-01-15 11:11:59 -05:00
Simeon Bird 72de114a94 Merge branch 'KDE/4.10' 2013-01-15 11:11:11 -05:00
Simeon Bird e7fe50bd3d A crash occurs if updateItemStates runs between the
UpdateItemStatesThread finishing and the finished() signal being
delivered.

In this case, a new thread was not created, because the old thread
still existed. However, pendingItemStatesUpdate was not set, because the
thread was not running. Instead, the old thread was restarted.

This meant that the finished() signal from the first run could be delivered
while the thread was running for a second time, causing the thread to be
deleted while still running and thus a crash.

Solution: set pendingItemStatesUpdate if the thread is non-null,
even if it is not running, knowing that slotThreadFinished has not yet run,
and will call updateItemStates itself.

BUG: 302264
FIXED-IN: 4.10
REVIEW: 107656
2013-01-15 11:10:58 -05:00
Emmanuel Pescosta 256792355d Select right item as current item (first item after the deletion) after deleting files
BUG: 290736
REVIEW: 108356
FIXED-IN: 4.10
2013-01-14 20:01:03 +01:00
Kai Uwe Broulik dde672ac94 Don't delay popup menus of "Create New" and "Recently Closed Tabs" toolbar buttons
REVIEW: 108397
2013-01-14 10:42:03 +01:00
Frank Reininghaus 4f0cd0b447 Update Dolphin's About dialog
Emmanuel has contributed a lot of useful patches to Dolphin. Thank you
very much for that! The Dolphin community is looking forward to further
contributions from you.

CCMAIL: emmanuelpescosta099@gmail.com
2013-01-13 14:12:32 +01:00
Luca Beltrame 74143ee656 Merge remote-tracking branch 'origin/KDE/4.10' 2013-01-12 10:19:44 +01:00
Emmanuel Pescosta e7c4b060ad Show the file name as plain text in the file-metadata-tooltip
FIXED-IN: 4.10
BUG: 262464
REVIEW: 108336
2013-01-11 17:27:53 +01:00
Frank Reininghaus 1e2481c974 Merge remote-tracking branch 'origin/KDE/4.10' 2013-01-11 17:24:05 +01:00
Frank Reininghaus d3b92d2d67 Slightly reduce the tinting for selected icons and previews
The intention of the tinting was to make it more obvious in icons view
which icons are selected. However, some icons and previews look quite
ugly with the current tinting value of 1.0 (i.e., the value passed to
KIconEffect::colorize). A slight reduction of this value to 0.8 makes
this a little less ugly. However, the real fix is to remove the tinting
altogether and find something better to indicate which items are
selected.

CCBUG: 309722
2013-01-11 17:12:34 +01:00
Frank Reininghaus 2a7e8b41d3 Only use parallel sorting when sorting by name
The reentrant natural comparison of strings is the only really
expensive operation. Other comparison functions are much cheaper and
might not be reentrant at all. Therefore, we disable parallel sorting
when not sorting by name to prevent crashes and other unpleasant
behaviour.

BUG: 312679
FIXED-IN: 4.10
REVIEW: 108309
2013-01-11 16:57:43 +01:00
Kai Uwe Broulik d7373195f0 Fix information panel interpreting html tags
Only fixes the most obvious file name, the other entries in the table
probably have to be fixed in the FileMetaDataWidget.
REVIEW: 108307
BUG: 262464
(cherry picked from commit 3d7d900d28)
2013-01-09 22:15:56 +01:00
Kai Uwe Broulik 1877eb74e8 Fix information panel interpreting html tags
Only fixes the most obvious file name, the other entries in the table
probably have to be fixed in the FileMetaDataWidget.
REVIEW: 108307
BUG: 262464
2013-01-09 22:10:04 +01:00
Emmanuel Pescosta 4fd99ef4a3 Show the real audio file duration in additional informations
Big Thanks to Frank Reininghaus and Vishesh Handa!

BUG: 311794
REVIEW: 108281
FIXED-IN: 4.10
2013-01-09 16:24:15 +01:00
Emmanuel Pescosta f7216ca591 Show the file name as plain text in the rename dialog
BUG: 312812
BUG: 262464
FIXED-IN: 4.10
REVIEW: 108291
2013-01-09 16:17:55 +01:00