Commit 119f7a3f fixed a crash that was caused by the porting of the
natural sorting code to QCollator. QCollator is not thread-safe, so
every thread needs its own instance. However, that commit made every
recursive call in the sorting code create a new deep-copied QCollator
instance, which is quite expensive and thus made inserting any items
into the model very slow (this could also be seen in the KFileItemModel
benchmark).
This commit avoids unnecessary QCollator copying by forcing all sorting
functions which are called in the same thread to pass the 'lessThan'
object by const reference, such that no unnecessary copying of that
object, including a deep copy of the QCollator, takes place.
REVIEW: 123620
This allows to work around limitations in Qt's date formatting.
Examples:
* Uppercasing the first character in a string because it's a title:
Day of the week and month names returned by QDateTime::toString
are usually lowercase.
* Correcting the noun case of a month name from "of [month]" to
"in [month]" in Finnish: "of [month]" is correct when talking
about a specific day, but wrong when talking about a specific month.
REVIEW: 123278
Make use of the QCollator instance (m_collator) in nameRoleGroups instead of using QString::localeAwareCompare (uses QCollator internally)
We don't need the m_caseSensitivity anymore, because the QCollator instance also holds this information.
(This patch doesn't make use of QCollatorSortKey)
Reviewed by Kai
REVIEW: 121480
Commit 1938ad54d4 replaced delete by
deleteLater(). However, the latter cannot be used safely with null
pointers. This commit adds a safety check in order to make sure that
we do not get a crash.
Thanks to Christoph Feck for pointing out this issue.
This patch should make a crash with a backtrace as provided in the bug
report impossible. I'm not sure if this would really prevent the crash
- it looks like the actual cause of the problem could be in
QGraphicsView or anywhere else, but it's hard to tell because the bug
was reported just once and does not seem reproducible. But I'm pretty
sure that this change doesn't make anything worse.
BUG: 334785
REVIEW: 121087
Checking whether the input contains '*', '?' or '[' alone will
not do since there can be files with '[' in their name.
REVIEW: 120986
BUG: 340470
FIXED-IN: 14.12