]> cloud.milkyroute.net Git - dolphin.git/log
dolphin.git
11 years agodolphin: convert kitemviews/ to qt5 signal slot syntax
Alex Richardson [Thu, 10 Apr 2014 14:50:43 +0000 (16:50 +0200)]
dolphin: convert kitemviews/ to qt5 signal slot syntax

This conversion was performed automatically using convert2qt5signalslot.
The only manual changes required were changing the overloaded signal
KDirLister::redirection and KDirLister::completed from KUrl to QUrl. All
other cases were no problem since these signals are not overloaded and a
static_cast for disambiguation is not necessary.

Code inside HAVE_BALOO is not converted yet, will do that once I can build
a version with Baloo.

11 years agomake FileNameSearchProtocol::listDir override the KIO::SlaveBase method
Alex Richardson [Thu, 10 Apr 2014 14:34:35 +0000 (16:34 +0200)]
make FileNameSearchProtocol::listDir override the KIO::SlaveBase method

The parameter changed from KUrl to QUrl -> we have to add this.

Found with -Woverloaded-virtual

11 years agocompletely disable QAccessible for now, since it causes assertions
Alex Richardson [Thu, 10 Apr 2014 00:18:05 +0000 (02:18 +0200)]
completely disable QAccessible for now, since it causes assertions

11 years agoKParts::ReadOnlyPart::openUrl() changed from KUrl parameter to QUrl
Alex Richardson [Thu, 10 Apr 2014 01:02:40 +0000 (03:02 +0200)]
KParts::ReadOnlyPart::openUrl() changed from KUrl parameter to QUrl

11 years agoAllow compiling Dolphin with KF5
Alex Richardson [Sun, 6 Apr 2014 01:32:55 +0000 (03:32 +0200)]
Allow compiling Dolphin with KF5

This does not work properly yet, there are probably quite a few bad signal/
slot connections due to KUrl -> QUrl. However dolphin starts without
crashing.

Accessibility is not ported since that changed quite a lot from Qt4 -> Qt5
and I have no idea how it is supposed to be used.

This is the first commit for review 117395

11 years agoRemove some unused functions.
Emmanuel Pescosta [Tue, 11 Feb 2014 19:30:50 +0000 (20:30 +0100)]
Remove some unused functions.

void KFileItemModel::slotClear(const KUrl& url)

bool UpdateItemsThread::lockPlugin()    <- Done with QMutexLocker
void UpdateItemsThread::unlockPlugin()

REVIEW: 115627

11 years agoEnsure that KItemListViewLayouter always has a size hint resolver
Frank Reininghaus [Tue, 11 Feb 2014 17:28:22 +0000 (18:28 +0100)]
Ensure that KItemListViewLayouter always has a size hint resolver

KItemListViewLayouter uses a KItemListSizeHintResolver to find out how
much space the items will need in the view.

Before this commit, the size hint resolver object could be changed at
runtime, and it could also be null. However, we never made use of these
possibilities, so all the code that checks if m_sizeHintResolver is
null is actually not needed at all.

11 years agoFix includes
Christophe Giboudeaux [Fri, 7 Feb 2014 14:41:48 +0000 (15:41 +0100)]
Fix includes

11 years agoMerge remote-tracking branch 'origin/KDE/4.12'
Frank Reininghaus [Fri, 7 Feb 2014 09:26:00 +0000 (10:26 +0100)]
Merge remote-tracking branch 'origin/KDE/4.12'

11 years agoOnly initialize the hash m_items in KFileItemModel if it is needed
Frank Reininghaus [Fri, 7 Feb 2014 09:22:17 +0000 (10:22 +0100)]
Only initialize the hash m_items in KFileItemModel if it is needed

Moreover, clear the entire hash if items are added or removed.

This saves time and memory when loading a directory, and it fixes
problems that might occur if the model is in an inconsistent state, such
as crashes that can happen when we try to remove individual items from
m_items.

BUG: 329494
FIXED-IN: 4.13.0
REVIEW: 115432

11 years agoFix build if Baloo is not installed
Frank Reininghaus [Fri, 7 Feb 2014 09:14:29 +0000 (10:14 +0100)]
Fix build if Baloo is not installed

11 years agoPort Dolphin to Baloo
Vishesh Handa [Thu, 6 Feb 2014 19:29:09 +0000 (20:29 +0100)]
Port Dolphin to Baloo

Nepomuk is being replaced with Baloo

11 years agoSet the Details View colummns width to the preferred column width, by double-clicking...
Emmanuel Pescosta [Thu, 6 Feb 2014 12:00:28 +0000 (13:00 +0100)]
Set the Details View colummns width to the preferred column width, by double-clicking the header grips.

BUG: 293315
FIXED-IN: 4.13
REVIEW: 115503

11 years agoRestore the URLs of both views correctly when restoring a session
Frank Reininghaus [Sun, 2 Feb 2014 09:19:57 +0000 (10:19 +0100)]
Restore the URLs of both views correctly when restoring a session

The problem was that we restored the URL of the right view while the
left one is still active. When we received the signal
urlChanged(KUrl& url) from the right URL navigator, we then set the URL
of the active (i.e., left) view to 'url', such that both views showed
the same URL.

BUG: 330047
FIXED-IN: 4.12.3
REVIEW: 115406

11 years agoDon't store the index of the file item in the VersionControlObserver::ItemState,...
Emmanuel Pescosta [Fri, 31 Jan 2014 19:56:57 +0000 (20:56 +0100)]
Don't store the index of the file item in the VersionControlObserver::ItemState, get the index of the file item on demand instead.

Fixes some "old"-index problems, esp. when you copy/move around files while the version control thread is still running.

FIXED-IN: 4.13
REVIEW: 115410

11 years agoAlways enable the "Create New..." menu if the URL is writable
Frank Reininghaus [Thu, 30 Jan 2014 21:10:08 +0000 (22:10 +0100)]
Always enable the "Create New..." menu if the URL is writable

This commit works around the problem that KDirLister may not provide a
"rootItem" for some kioslaves by setting up a KFileItem with the view
URL and using this to find out if the URL is writable.

BUG: 330001
CCBUG: 330015
REVIEW: 115405
FIXED-IN: 4.12.2

11 years agoSVN_SILENT made messages (.desktop file)
l10n daemon script [Wed, 22 Jan 2014 06:22:47 +0000 (06:22 +0000)]
SVN_SILENT made messages (.desktop file)

11 years agoSVN_SILENT made messages (.desktop file)
l10n daemon script [Wed, 22 Jan 2014 03:54:49 +0000 (03:54 +0000)]
SVN_SILENT made messages (.desktop file)

11 years agoMerge remote-tracking branch 'origin/KDE/4.12'
Frank Reininghaus [Tue, 21 Jan 2014 18:14:44 +0000 (19:14 +0100)]
Merge remote-tracking branch 'origin/KDE/4.12'

11 years agoUse only one "directory contents counting" thread per process
Frank Reininghaus [Tue, 21 Jan 2014 18:07:58 +0000 (19:07 +0100)]
Use only one "directory contents counting" thread per process

The pointer to QThread object is stored in a global variable, and each
view increments/decrements a reference count when it starts/stops using
the thread. If this thread reaches zero, the thread is stopped.

Note that we cannot just use a smart pointer, like QSharedPointer, to
manage the thread, because we must make sure that the thread is not
running any more before the QThread is deleted.

REVIEW: 115064

11 years agoDon't show tooltips while inline-renaming.
Emmanuel Pescosta [Mon, 20 Jan 2014 16:41:44 +0000 (17:41 +0100)]
Don't show tooltips while inline-renaming.

FIXED-IN: 4.12.2
REVIEW: 115146
BUG: 330126

11 years agoRemove the "retrieved items" code from UpdateItemStatesThread and VersionControlObserver.
Emmanuel Pescosta [Thu, 16 Jan 2014 11:55:42 +0000 (12:55 +0100)]
Remove the "retrieved items" code from UpdateItemStatesThread and VersionControlObserver.

Showing an error message, makes no sense in this case - the user can see it when all items are "unversioned".
The plugins still have the ability to show error/warning messages on real errors. (and only where it makes sense ;)

REVIEW: 114992
FIXED-IN: 4.13

11 years agoUse the QMap iterator instead of foreach(key, map.keys()) in UpdateItemStatesThread...
Emmanuel Pescosta [Wed, 15 Jan 2014 19:27:20 +0000 (20:27 +0100)]
Use the QMap iterator instead of foreach(key, map.keys()) in UpdateItemStatesThread::run()
and in VersionControlObserver::slotThreadFinished().

So we get O(n) complexity instead of O(n*logn), and O(1) memory instead of O(n).
Thanks to Thiago Macieira for providing this information.

FIXED-IN: 4.13
REVIEW: 115018

11 years agoCalculate all item size hints at once.
Emmanuel Pescosta [Sun, 12 Jan 2014 22:24:00 +0000 (23:24 +0100)]
Calculate all item size hints at once.

The speed up is really small, but theses changes are mostly straightforward and make the code a bit nicer - break
the KStandardItemListWidgetInformant::itemSizeHint beast into three smaller functions.

FIXED-IN: 4.13
REVIEW: 112979

11 years agoUpdate copyright year
Frank Reininghaus [Sun, 12 Jan 2014 15:56:09 +0000 (16:56 +0100)]
Update copyright year

12 years agoMerge remote-tracking branch 'origin/KDE/4.12'
Frank Reininghaus [Mon, 6 Jan 2014 19:19:48 +0000 (20:19 +0100)]
Merge remote-tracking branch 'origin/KDE/4.12'

12 years agoKill any running preview jobs before starting a new one
Frank Reininghaus [Mon, 6 Jan 2014 19:15:02 +0000 (20:15 +0100)]
Kill any running preview jobs before starting a new one

If loading a preview takes long, it was possible before this commit
that a preview for a new item was requested before the first preview
was shown. In that case, there was a race condition, and the first
preview to arrive stayed in the Information Panel.

This commit fixes this by keeping a pointer to the preview job and
killing it before starting a new one.

BUG: 250787
FIXED-IN: 4.12.1
REVIEW: 114561

12 years agoAvoid calling KFileItemModel::index() in KFileItemModelRolesUpdater
Frank Reininghaus [Mon, 6 Jan 2014 19:10:08 +0000 (20:10 +0100)]
Avoid calling KFileItemModel::index() in KFileItemModelRolesUpdater

KFileItemModel allows to find out the index of a KFileItem with its
index(const KFileItem&) method. Calling this method is not extremely
expensive, but it's also not free (it looks up the URL of the KFileItem
in a QHash, i.e., it has to call qHash(QString) for the full URL).

In KFileItemModelRolesUpdater, we sometimes converted the known index to
a KFileItem and then back to an index in applyResolvedRoles(KFileItem).
This patch fixes this by modifying applyResolvedRoles such that it takes
the index directly as its argument.

REVIEW: 114847

12 years agoMerge remote-tracking branch 'origin/KDE/4.12'
Frank Reininghaus [Sun, 29 Dec 2013 08:50:17 +0000 (09:50 +0100)]
Merge remote-tracking branch 'origin/KDE/4.12'

12 years agoRemove redundant data from KItemListViewLayouter's ItemInfo struct
Frank Reininghaus [Sun, 29 Dec 2013 08:42:25 +0000 (09:42 +0100)]
Remove redundant data from KItemListViewLayouter's ItemInfo struct

It is not necessary to save the position of each item as a QPointF
because all items in a row will have the same y-coordinate, and all
items in a column will have the same x-coordinate. Therefore, we can
reduce the number of doubles that we store from

(number of items) * 2

to

(number of rows) + (number of colums)

which is at least 50% less.

REVIEW: 114460

12 years agoDisable the "Create folder" action in read-only directories
Frank Reininghaus [Sun, 29 Dec 2013 08:23:17 +0000 (09:23 +0100)]
Disable the "Create folder" action in read-only directories

The action can be triggered, e.g., by pressing F10.

BUG: 294054
FIXED-IN: 4.12.1
REVIEW: 114560

12 years agoMerge remote-tracking branch 'origin/KDE/4.12'
Frank Reininghaus [Sun, 22 Dec 2013 12:20:02 +0000 (13:20 +0100)]
Merge remote-tracking branch 'origin/KDE/4.12'

12 years agoFix crash when dragging children of expanded folders in Details View
Frank Reininghaus [Sun, 22 Dec 2013 12:17:05 +0000 (13:17 +0100)]
Fix crash when dragging children of expanded folders in Details View

The problem was that the loop in KFileItemModel::createMimeData() which
is supposed to find out if any parent of an item has been added to the
QMimeData already (because it is not necessary to add the item in that
case) did not loop through the parents of the item, but incorrectly
replaced the local variable 'itemData' by its parent.

BUG: 329119
REVIEW: 114562

12 years agoAdd unit test for KFileItemModel::createMimeData().
Frank Reininghaus [Sun, 22 Dec 2013 12:08:38 +0000 (13:08 +0100)]
Add unit test for KFileItemModel::createMimeData().

The test verifies that creating the mime data for a child of an expanced
folder does not cause a crash. The regression happenened in the master
branch, but it doesn't hurt to have the test also in KDE/4.12.

CCBUG: 329119

12 years agoUpdate filtered items when the "refreshItems" signal is received
Frank Reininghaus [Sun, 22 Dec 2013 11:50:09 +0000 (12:50 +0100)]
Update filtered items when the "refreshItems" signal is received

This fixes the problem that the new file name is not shown in the view
if an item is renamed while it is filtered.

BUG: 329118
FIXED-IN: 4.12.1
REVIEW: 114459

12 years agoUpdate the roles for filtered items if necessary
Frank Reininghaus [Sat, 14 Dec 2013 10:51:07 +0000 (11:51 +0100)]
Update the roles for filtered items if necessary

Since Dolphin 4.11, we store not only KFileItems, but also the
corresponding ItemData struct for filtered items. This is required for
keeping track of the parent-child relationships, and has the nice side
effect that the ItemData need not be re-determined when the items are
shown again.

However, this can become a problem if the visible roles or the sort role
change while some items are filtered.

This is fixed by is fixed by clearing the QHash "values" for the
filtered items if the visible roles change. The hash will be
re-populated with all requested data as soon as the items are shown
again and the data(int) method of the model is called.

Moreover, before the items are inserted into the model after filtering,
we have to make sure that the sort role "Permissions"/"User"/etc. is
present in the hash "values". This is achieved by factoring out the code
that currently does this job for new items in createItemDataList() into
a new function, and calling this in insertItems(), because the same
treatment is required for the previously filtered files.

BUG: 328791
FIXED-IN: 4.12.1
REVIEW: 114266

12 years agoMerge remote-tracking branch 'origin/KDE/4.12'
Frank Reininghaus [Fri, 6 Dec 2013 00:36:42 +0000 (01:36 +0100)]
Merge remote-tracking branch 'origin/KDE/4.12'

12 years agoMake KFileItemModel::createMimeData() faster
Frank Reininghaus [Fri, 6 Dec 2013 00:11:04 +0000 (01:11 +0100)]
Make KFileItemModel::createMimeData() faster

Moreover, this commit ensures that the order of the URLs in the
QMimeData object is the same as the order of the items in the view.

Selecting many items and copying them to the clipboard could take quite
a bit of time. This is because we used
KDirModel::simplifiedUrlList(urls) to remove child items from the list
of URLs, and this function sorts the URLs internally to make it easier
to find out which of them are child URLs.

However, since commit 5c5d87fec44e7c5934e4b24060200173153f0ff4, the
selected indices are already stored in ascending order, and this makes
it easy to detect if an item is a child of the last item that has been
added to the QMimeData.

BUG: 283409
REVIEW: 113515
FIXED-IN: 4.13.0

12 years agoMerge remote-tracking branch 'origin/KDE/4.11' into KDE/4.12
Frank Reininghaus [Thu, 5 Dec 2013 23:56:34 +0000 (00:56 +0100)]
Merge remote-tracking branch 'origin/KDE/4.11' into KDE/4.12

12 years agoFix Bug 328262 - rename bug if you cancel when folder already exists
Emmanuel Pescosta [Tue, 3 Dec 2013 18:00:28 +0000 (19:00 +0100)]
Fix Bug 328262 - rename bug if you cancel when folder already exists

Only connect the renamingFailed signal if there is no item with the new name in the model yet.

BUG: 328262
FIXED-IN: 4.11.5
REVIEW: 114228

12 years agoLazy-load the item data also in Compact View
Frank Reininghaus [Mon, 2 Dec 2013 22:14:20 +0000 (23:14 +0100)]
Lazy-load the item data also in Compact View

The recent changes which prevent that all data for each item are saved
in a QHash already when loading the folder (see
https://git.reviewboard.kde.org/r/112725/), which save both memory and
time, do not work yet in Compact View, because
KItemListWidgetInformant::itemSizeHint() calls the model's data(int)
method for every item, which then initializes the hash.

This patch prevents that by accessing the file name directly if only
the "Name" is shown in the view, just like it's done in Icons View.

REVIEW: 113849

12 years agoMerge remote-tracking branch 'origin/KDE/4.11' into KDE/4.12
Frank Reininghaus [Wed, 20 Nov 2013 23:51:08 +0000 (00:51 +0100)]
Merge remote-tracking branch 'origin/KDE/4.11' into KDE/4.12

12 years agoFix incorrect geometry updates in KItemListContainer
Yichao Yu [Wed, 20 Nov 2013 23:47:23 +0000 (00:47 +0100)]
Fix incorrect geometry updates in KItemListContainer

When resizing the window and when KItemListContainer::updateGeometries
is called before the scrollbar visibility is updated, a relayout is
triggered in `m_controller->view()->setGeometry` which updates the
scrollbar visibility and calls back to
`KItemListContainer::updateGeometries` again. Since the first call,
which has the wrong geometry (due to the incorrect scrollbar states),
updates the geometries of the scene and viewport after the second call
(which has the right geometry!!) returns, the final result is a size
that corresponded to the old scrollbar state before this commit.

This patch uses the new geometry of the view after updating it (since
it might not be the size we put in) and therefore makes the sizes
consistent.

BUG: 327709
FIXED-IN: 4.11.4
REVIEW: 113939

12 years agoMake the "Create New..." menu in the "item context menu" work again
Frank Reininghaus [Wed, 20 Nov 2013 23:41:23 +0000 (00:41 +0100)]
Make the "Create New..." menu in the "item context menu" work again

Since https://git.reviewboard.kde.org/r/111989/, the "Create New..."
menu in the context menu that appears when right-clicking a folder was
not a child of the DolphinMainWindow any more, but of the context menu
itself. This is the reason why the dialog that asks for a file name
when choosing one of the "Create New..." options disappeared
immediately.

This patch makes sure that the main window is the parent of the
"Create New..." menu again.

BUG: 327783
REVIEW: 113930

12 years agodolphinnewfilemenu.cpp is part of dolphinprivate
Patrick von Reth [Tue, 19 Nov 2013 18:51:16 +0000 (19:51 +0100)]
dolphinnewfilemenu.cpp is part of dolphinprivate

12 years agoMerge remote-tracking branch 'origin/KDE/4.11' into KDE/4.12
Frank Reininghaus [Mon, 18 Nov 2013 22:44:45 +0000 (23:44 +0100)]
Merge remote-tracking branch 'origin/KDE/4.11' into KDE/4.12

12 years agoFix scrollbar spacing when no scrollbar is visible in dolphin.
Yichao Yu [Mon, 18 Nov 2013 22:40:40 +0000 (23:40 +0100)]
Fix scrollbar spacing when no scrollbar is visible in dolphin.

Before this commit, Dolphin reserved space for the scrollbar spacing
even when no scrollbar is visible resulting in a ugly gap in the view
when:

1. the theme uses QStyle::SH_ScrollView_FrameOnlyAroundContents and
2. the theme has a positive PM_ScrollView_ScrollBarSpacing.

QtCurve can have both while Oxygen have 1 but not 2.
To reproduce the problem with Oxygen style. Replace the
`width += ....` (which returns -2 or 0 for Oxygen) with `width += 2`.

See more info here:
https://github.com/QtCurve/qtcurve-qt4/issues/9#issuecomment-28630517

CCBUG: 306631
FIXED-IN: 4.11.4
REVIEW: 113902

12 years agoUpdate the Places Panel entries when switching the language
Frank Reininghaus [Fri, 15 Nov 2013 08:16:22 +0000 (09:16 +0100)]
Update the Places Panel entries when switching the language

Before this commit, we stored the translated "Places" in
.kde4/share/apps/kfileplaces/bookmarks.xml. This was not intentional -
it only happened because
PlacesItem::updateBookmarkForRole(const QByteArray& role) always stored
the translated text (returned by PlacesItem::text()) in the KBookmark.

This is be fixed by first checking if the text() is equal to the
translation of the text that is already stored in the KBookmark, and
not updating it in that case.

Note that we have to make sure that all "Places"-related use the same
context "KFile System Bookmarks" to make that work.

Thanks to Burkhard Lück and Albert Astals Cid for helping to fix this
problem!

BUG: 319282
FIXED-IN: 4.12.0
REVIEW: 113850

12 years agoMerge remote-tracking branch 'origin/KDE/4.11' into KDE/4.12
Frank Reininghaus [Thu, 14 Nov 2013 08:14:51 +0000 (09:14 +0100)]
Merge remote-tracking branch 'origin/KDE/4.11' into KDE/4.12

12 years agoDo not select items when navigating back/forward with the mouse
David Rosca [Thu, 14 Nov 2013 08:08:29 +0000 (09:08 +0100)]
Do not select items when navigating back/forward with the mouse

If we detect that the user pressed the back/forward buttons while
hovering the empty space of the view, such that
DolphinView::slotMouseButtonPressed(int, Qt::MouseButtons) will request
that Dolphin navigates back/forward in the history, handling the mouse
press event should stop. This prevents the possible unexpected selection
of items in the new directory.

BUG: 327412
FIXED-IN: 4.11.4

12 years agoMake it build with QT_STRICT_ITERATORS
Wolfgang Bauer [Wed, 6 Nov 2013 16:53:43 +0000 (17:53 +0100)]
Make it build with QT_STRICT_ITERATORS

Redo commit 81c99da7e0043d433756d1f062bf30845db93c66 by Kevin Ottens

Was removed by mistake during the last merge with KDE/4.11, sorry!

12 years agoMerge branch 'KDE/4.11' into KDE/4.12
Wolfgang Bauer [Wed, 6 Nov 2013 16:07:10 +0000 (17:07 +0100)]
Merge branch 'KDE/4.11' into KDE/4.12

Revert "Files passed as arguments: Ignore unsupported files"

This reverts commit cd9e50ae4f3ded5a78d0cfb09a67684a9c15d726.

See bug#327224 for details.

12 years agoRevert "Files passed as arguments: Ignore unsupported files"
Wolfgang Bauer [Wed, 6 Nov 2013 15:46:09 +0000 (16:46 +0100)]
Revert "Files passed as arguments: Ignore unsupported files"

This reverts commit cd9e50ae4f3ded5a78d0cfb09a67684a9c15d726.

See bug#327224 for details.

12 years agoMerge remote-tracking branch 'origin/KDE/4.11' into KDE/4.12
Frank Reininghaus [Tue, 5 Nov 2013 07:47:37 +0000 (08:47 +0100)]
Merge remote-tracking branch 'origin/KDE/4.11' into KDE/4.12

12 years agoOnly do a fast pre-sorting when "Sort by Name" is used
Frank Reininghaus [Tue, 5 Nov 2013 07:44:31 +0000 (08:44 +0100)]
Only do a fast pre-sorting when "Sort by Name" is used

This is a follow-up to commit 0e9f4a398735cfc19ae783d2ab054d2400d95416,
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!

12 years agoFix Bug 287983 - Dolphin truncates tooltip information for long file names
Emmanuel Pescosta [Fri, 1 Nov 2013 23:12:33 +0000 (00:12 +0100)]
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

12 years agoStore the selected items in a more efficient way
Frank Reininghaus [Wed, 30 Oct 2013 22:21:09 +0000 (23:21 +0100)]
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

12 years agoSort in items in two stages to speed up natural sorting
Frank Reininghaus [Wed, 30 Oct 2013 16:48:32 +0000 (17:48 +0100)]
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

12 years agoPrevent storing some redundant data in KItemListViewLayouter
Frank Reininghaus [Wed, 30 Oct 2013 16:39:20 +0000 (17:39 +0100)]
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

12 years agoRestore the tree state in Details View if a folder is re-expanded
Frank Reininghaus [Sat, 26 Oct 2013 07:36:40 +0000 (09:36 +0200)]
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

12 years agoMerge remote-tracking branch 'origin/KDE/4.11'
Frank Reininghaus [Sat, 26 Oct 2013 07:30:18 +0000 (09:30 +0200)]
Merge remote-tracking branch 'origin/KDE/4.11'

12 years agoFix broken view state restoration
Frank Reininghaus [Sat, 26 Oct 2013 07:24:04 +0000 (09:24 +0200)]
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

12 years agoTwo small simplifications in KItemListViewLayouter
Frank Reininghaus [Wed, 16 Oct 2013 21:01:54 +0000 (23:01 +0200)]
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

12 years agoAbort loading the current URL if the user presses Escape
Frank Reininghaus [Wed, 16 Oct 2013 20:37:50 +0000 (22:37 +0200)]
Abort loading the current URL if the user presses Escape

BUG: 323181
FIXED-IN: 4.12.0
REVIEW: 113234

12 years agoMake it build with QT_STRICT_ITERATORS
Kevin Ottens [Wed, 16 Oct 2013 17:24:01 +0000 (19:24 +0200)]
Make it build with QT_STRICT_ITERATORS

12 years agoMerge remote-tracking branch 'origin/KDE/4.11'
David Faure [Tue, 15 Oct 2013 07:08:47 +0000 (09:08 +0200)]
Merge remote-tracking branch 'origin/KDE/4.11'

12 years agoFix crash when triggereing the "Compare files" action via D-Bus
Frank Reininghaus [Sun, 13 Oct 2013 08:55:21 +0000 (10:55 +0200)]
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

12 years agoFiles passed as arguments: Ignore unsupported files
Erik Hahn [Sun, 13 Oct 2013 08:44:13 +0000 (10:44 +0200)]
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

12 years agoMoved all the extension code into dolphinpart_ext.*
Dawit Alemayehu [Fri, 16 Aug 2013 13:01:55 +0000 (09:01 -0400)]
Moved all the extension code into dolphinpart_ext.*

REVIEW: 113132

12 years agoUse the icon size from KItemListStyleOption for the width and height of the
Emmanuel Pescosta [Wed, 9 Oct 2013 17:52:53 +0000 (19:52 +0200)]
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

12 years agoMerge remote-tracking branch 'origin/KDE/4.11'
Frank Reininghaus [Mon, 7 Oct 2013 07:31:45 +0000 (09:31 +0200)]
Merge remote-tracking branch 'origin/KDE/4.11'

12 years agoMake the code that removes items from KFileItemModel more robust
Frank Reininghaus [Mon, 7 Oct 2013 07:26:51 +0000 (09:26 +0200)]
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

12 years agoReload the view if a previously unmounted device is mounted again
Frank Reininghaus [Mon, 7 Oct 2013 07:17:48 +0000 (09:17 +0200)]
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

12 years agoInclude "Space" in the keyboard search string
Frank Reininghaus [Mon, 7 Oct 2013 07:08:55 +0000 (09:08 +0200)]
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

12 years agoSave memory and time in KFileItemModel by lazy-loading the "ItemData"
Frank Reininghaus [Wed, 2 Oct 2013 17:08:39 +0000 (19:08 +0200)]
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

12 years agoMerge remote-tracking branch 'origin/KDE/4.11'
Frank Reininghaus [Mon, 30 Sep 2013 22:15:04 +0000 (00:15 +0200)]
Merge remote-tracking branch 'origin/KDE/4.11'

12 years agoAdd unit test for the calculation of "name" groups with expanded items
Frank Reininghaus [Mon, 30 Sep 2013 22:09:25 +0000 (00:09 +0200)]
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.

12 years agoShow the right version states for expanded items.
Emmanuel Pescosta [Sun, 29 Sep 2013 16:08:06 +0000 (18:08 +0200)]
Show the right version states for expanded items.

BUG: 267171
FIXED-IN: 4.11.3
REVIEW: 112980

12 years agoMake sure that removeExpandedItems() also removes filtered items
Frank Reininghaus [Sun, 29 Sep 2013 13:45:02 +0000 (15:45 +0200)]
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

12 years agoSVN_SILENT made messages (.desktop file)
l10n daemon script [Fri, 27 Sep 2013 07:07:49 +0000 (07:07 +0000)]
SVN_SILENT made messages (.desktop file)

12 years agoSVN_SILENT made messages (.desktop file)
l10n daemon script [Fri, 27 Sep 2013 04:24:51 +0000 (04:24 +0000)]
SVN_SILENT made messages (.desktop file)

12 years agoMove KItemRange to its own header
Frank Reininghaus [Mon, 16 Sep 2013 22:11:32 +0000 (00:11 +0200)]
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

12 years agoMerge remote-tracking branch 'origin/KDE/4.11'
Frank Reininghaus [Sat, 14 Sep 2013 13:11:17 +0000 (15:11 +0200)]
Merge remote-tracking branch 'origin/KDE/4.11'

12 years agoMake preview loading faster when scrolling
Frank Reininghaus [Sat, 14 Sep 2013 12:52:22 +0000 (14:52 +0200)]
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

12 years agoRemove "Copy text" statusbar contextmenu entry
Kai Uwe Broulik [Thu, 12 Sep 2013 16:45:41 +0000 (18:45 +0200)]
Remove "Copy text" statusbar contextmenu entry
REVIEW: 112355

12 years agoFix Bug 311099 - View the underscore when using Ctrl + PagDown
Emmanuel Pescosta [Thu, 12 Sep 2013 11:58:29 +0000 (13:58 +0200)]
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

12 years agoMerge remote-tracking branch 'origin/KDE/4.11'
Frank Reininghaus [Mon, 9 Sep 2013 19:43:29 +0000 (21:43 +0200)]
Merge remote-tracking branch 'origin/KDE/4.11'

12 years agoAlways sort items correctly when the refreshItems() signal is received
Frank Reininghaus [Mon, 9 Sep 2013 19:38:47 +0000 (21:38 +0200)]
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 d70a4811807776966c3241a72121242f4d1eaee8. This patch fixes
it.

BUG: 324713
FIXED-IN: 4.11.2
REVIEW: 112561

12 years agoMerge remote-tracking branch 'origin/KDE/4.11'
Frank Reininghaus [Mon, 9 Sep 2013 19:21:43 +0000 (21:21 +0200)]
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).

12 years agoTest if the groups are updated correctly when items are refreshed
Frank Reininghaus [Mon, 9 Sep 2013 19:13:38 +0000 (21:13 +0200)]
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/.

12 years agoMake expandedParentsCount() work without accessing the data hash
Frank Reininghaus [Sat, 7 Sep 2013 16:06:45 +0000 (18:06 +0200)]
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

12 years agoNothing special, just a little bit of code cleanup in KItemListViewLayouter::doLayout().
Emmanuel Pescosta [Thu, 5 Sep 2013 15:03:04 +0000 (17:03 +0200)]
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

12 years agoFix Bug 296970 - split view wrong behavior with search tab
Emmanuel Pescosta [Thu, 5 Sep 2013 14:22:59 +0000 (16:22 +0200)]
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

12 years agoMerge remote-tracking branch 'origin/KDE/4.11'
Frank Reininghaus [Wed, 4 Sep 2013 19:53:08 +0000 (21:53 +0200)]
Merge remote-tracking branch 'origin/KDE/4.11'

12 years agoCount the items inside directories in another thread
Frank Reininghaus [Wed, 4 Sep 2013 19:49:01 +0000 (21:49 +0200)]
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

12 years agoTry to avoid calling the model's data method if only "text" is needed
Frank Reininghaus [Wed, 4 Sep 2013 19:34:03 +0000 (21:34 +0200)]
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

12 years agoFix color role of services list
Christoph Feck [Tue, 3 Sep 2013 20:05:05 +0000 (22:05 +0200)]
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

12 years agoReplaced all KNewFileMenu usages in DolphinPart by DolphinNewFileMenu.
Emmanuel Pescosta [Wed, 28 Aug 2013 16:46:45 +0000 (18:46 +0200)]
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

12 years agoMerge remote-tracking branch 'origin/KDE/4.11'
Frank Reininghaus [Sun, 25 Aug 2013 17:17:25 +0000 (19:17 +0200)]
Merge remote-tracking branch 'origin/KDE/4.11'

12 years agoMove cursor to begin/end of selection before canceling it
Christoph Feck [Sun, 25 Aug 2013 15:40:49 +0000 (17:40 +0200)]
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