* Use the new syntax to connect to DolphinMainWindow::openNewTab from the url
navigator and from folders panel (removed the unused optional parameters from
openNewTab and openNewActivatedTab)
This adds a third option to the "in new tab" and "in new window" which opens
the parent folder in the same view
BUG: 298704
FIXED-IN: 4.15
REVIEW: 110133
In dolphin the Section that leads you to timeline claims
to show "Recently Accessed", which is not true, it shows
"Recently Saved" instead.
BUG: 304854
REVIEW: 119986
This used to work before afcf8961f6 (only
if "Open archives as folder" was enabled in the settings though). The
reason why this commit broke it is that the mime type of a file is not
determined automatically any more before asking
KProtocolManager::protocolForArchiveMimetype for the correct protocol,
so the determination of the protocol may fail.
Keeping the isMimeTypeKnown() check in DolphinView::openItemAsFolderUrl
still makes sense, because it prevents GUI blocking if the user tries
to open many files at the same time.
Therefore, we now call determineMimeType() in
DolphinViewContainer::slotUrlIsFileError(const KUrl&) and then try to
determine the correct protocol and use it to open the archive in the
view, rather than hoping that slotItemActivated(item) will do the right
thing.
BUG: 333078
REVIEW: 119877
FIXED-IN: 4.14.1
view containers are disconnected. Changing the connections is done whenever the
active view has been changed, so we can always guarantee that the active view is
connected.
The problem with restoring saved sessions is, that we create a new view container
in DolphinTabPage::restoreState() when split view was used in the previous session,
but this view container isn't connected to the main window slots because
DolphinMainWindow::connectViewSignals() is not called for this container. This leads
to these strange problems: no context menu, ...
BUG: 338549
REVIEW: 119961
FIXED-IN: 4.14.1
1. Do some operation that causes the KMessageWidget to show an error message
2. Immediately Repeat the same action.
The user has no way to know whether the error message is from the second operation or
is a leftover from the first one. By hiding the widget first and then showing it using
animatedShow(), the user can clearly see that a new message was generated. Also once the
directory successfully loads, the widget should be hidden.
BUG: 323077
FIXED-IN: 4.14.1
REVIEW: 119401
Before this patch, we still kept the URL in m_currentItemUrl if the URL
was not found in the model. This could cause problems the next time
updateViewState() was called, because the current index would then be
set to 0, which could cause other issues.
For example, all items between the first item in the view and a folder
which was expanded in Details View could be selected.
In principle, it is possible that updateViewState() is called multiple
times if many large files are being pasted in the view, but since the
item which should be made the current item (and which the view should
be scrolled to) should always be the first pasted item, this change
will most likely not cause any other problems.
BUG: 329377
REVIEW: 119703
FIXED-IN: 4.14.0
Since DolphinTabPage::saveState() and
DolphinTabPage::restoreState(const QByteArray& state) save and restore
the state of each tab in a different format than DolphinMainWindow did
before the refactoring, we can run into problems: the first time a user
logs into a session that has Dolphin 4.14, Dolphin might read session
data that does not contain the QByteArray that DolphinTabPage wants to
read the data from.
In restoreState, isSplitViewEnabled will thus have the value false, and
no secondary view will be created. Later on, m_primaryViewActive will
also be set to false, but the else branch of the following
"if (m_primaryViewActive)" then tries to activate the secondary view,
which does not exist -> we get a crash.
The easiest solution is to not restore the tab state if no session data
in the new format is found.
BUG: 338187
REVIEW: 119718
FIXED-IN: 4.14.0
Conflicts:
dolphin/src/panels/places/placesitemmodel.cpp
kdepasswd/kcm/CMakeLists.txt [deleted in frameworks]
kdepasswd/kcm/main.cpp [deleted in frameworks]
If Dolphin is launched with the information panel on and set to display
previews, PixmapViewer::paintEvent is called three times before any
pixmap is set. Each time the above warning message is output.
REVIEW: 119553
FIXED-IN: 4.14.0
This commit ensures that the selector is visible in all location bars
if and only if the Places Panel is hidden. It fixes a regression caused
by commit 6a98d83312.
BUG: 337389
FIXED-IN: 4.14.0
REVIEW: 119238
Instead of always opening a new tab with the home url and closing it again when directory/file urls are passed on,
we now use the given directories/files directly to open new tabs on startup.
Makes the code easier and we can reuse openDirectories/openFiles in future (if needed).
REVIEW: 118966
The signal activeViewUrlChanged in DolphinTabPage is currently unused, but we need it later when
we implement the tab widget and tab bar.
DolphinTabPage has saveState/restoreState which are using a QByteArray instead of the KConfigGroup to
be more generic.
REVIEW: 118964
This commit removes the icon tinting for the selected item in Compact
and Details View, and extends the selection rectangle such that it
includes the icon area as well. The icon tinting can be disturbing, and
having a selection rectangle that only includes the text can look a bit
strange, especially in the Places Panel.
BUG: 304643
REVIEW: 119018
FIXED-IN: 4.14.0
In the Places Panel, there is always exactly one selected item, which is
equal to the current item. Since the selected item is highlighted by
drawing its background in a different color, it is not really necessary
to highlight additionally that it is the current item.
This is achieved by removing the calls to
KItemListWidget::setCurrent(true) from KItemListView. The "current"
information in the widget is only used for deciding if the "current item
highlighting", like an underline in Oxygen, should be drawn.
The motivation for this change is that I have seem some complaints about
the "current item" highlighting, which can be even more distracting with
non-Oxygen styles.
REVIEW: 119019
tabs menu related code from DolphinMainWindow in a new class.
The DolphinRecentTabsMenu remembers the tab configuration if a
tab has been closed.
REVIEW: 118805
When emitting the itemsChanged signal in KFileItemModel::setRoles,
use the changed roles in the argument of the signal.
A warning message which was related to this issue was removed in
7a83252e0d
REVIEW: 118815
The message
"TODO: Emitting itemsChanged() with no information what has changed!"
is not helpful for the user.
The implementation of the TODO will be done in master, see
https://git.reviewboard.kde.org/r/118815/
CCBUG: 336174
This removes the remaining unchecked accesses to the clipboard mime
data after commit 7828b057da. According
to a bug report, it can be a null pointer on Wayland.
BUG: 335053
REVIEW: 118649
The KF5 version of KPageDialog has no virtual slot
"slotButtonClicked(int button)". Its kdelibs 4.x counterpart had such
a slot, which was connected automatically to the corresponding signal.
This slot was overriden by
DolphinSettingsDialog::slotButtonClicked(int button)
which was responsible for applying the changed setting and restoring
the default values if the corresponding button was clicked.
The lack of the buttonClicked(int) signal and the corresponding slot
caused the problem that clicking a button in the settings dialog had no
effect.
This patch makes the functions applySettings() and restoreDefaults()
functions slots, and connects them directly to the "clicked" signal of
the corresponding buttons.
BUG: 335709
REVIEW: 118576
By separating the width and height info, we can save some unnecessary
overhead in terms of memory and CPU cycles, and make the calculation of
the height of a row (or the width of a column in Compact View) a bit
simpler.
To achieve this, this patch extends the concept of "logical rows"
(which are actually columns in Compact View) to "logical width" and
"logical height" (which is the actual height and width, respectively, in
Compact View). The distinction between rows/columns and "logical"
rows/columns may be a bit confusing, but the confusion is already in the
current code, and I hope that it will be mitigated a bit by prefixing
the corresponding variables with "logical".
REVIEW: 118454
Since the KF5 libraries and the applications will not have a
synchronized release schedule any more, it does not make sense to
continue using KDE_VERSION_STRING as the Dolphin version.
The return type and return values of KMessageBox::createKMessageBox()
have changed in KF5. We have to adjust the code
in DolphinMainWindow::closeEvent(QCloseEvent* event) in order to make
windows with multiple tabs closable.
BUG: 335732
REVIEW: 118508
When opening the URL "man:", there are multiple items with the same
name (for example, _exit is shown twice here). When opening a new tab,
the kioslave reports some items as deleted (I have not quite understood
why). The problem is that it reports some of the duplicate items twice
in the list of deleted items. This confused KFileItemModel and
corrupted the internal data structures, and finally, caused a crash.
The fix is to remove all duplicates from
KItemRangeList::fromSortedContainer(const Container& container).
New unit tests included.
BUG: 335672
REVIEW: 118507
FIXED-IN: 4.13.2
of "m_selectionToggle->contains(pos)" in
KItemListWidget::setHoverPosition(const QPointF& pos).
This wrong check was accidentally introduced by
commit 24326d4473
BUG: 299328
REVIEW: 118320
FIXED-IN: 4.13.2
The old code would watch the free space on a mount point, i.e.,
determine the free space again, in 10-second intervals, only until the
view became invisible once (even if it was invisible only for a very
short moment, i.e., while splitting the view).
This commit ensures that the mount point is watched again as soon as
the corresponding view becomes visible again.
Moreover, the object that watches the free space for a mount point is
shared among all views that show URLs that belong to this mount point.
To achieve this, there is a central cache which can be used to obtain
an existing MountPointObserver for a certain path. If necessary, a new
MountPointObserver is created and added to the cache.
The MountPointObserver is removed from the cache and destroyed only if
no views use it any more, and no new users appear until the next update
(which happens every 10 seconds). This prevents that the free space is
measured repeatedly when changing the current directory on the same
mount point.
Many thanks to Emmanuel Pescosta for the initial ideas to factor out
the "free space" code and to establish a central storage for the
"observer" objects, and for providing many good suggestions how to
improve the code!
BUG: 327708
REVIEW: 118208
FIXED-IN: 4.14.0
If the "Places" are updated outside the current Dolphin process,
PlacesItemModel::updateBookmarks() is called, which invokes
PlacesItem::setBookmark(const KBookmark& bookmark) for each item. This
commit ensures that the correct translation is used for system
bookmarks like "Root", "Network", etc.
Without this patch, all Places entries in the remaining Dolphin windows
would switch to US English if one of multiple windows is closed.
See http://lists.kde.org/?t=139660468400004&r=1&w=2 for details.
BUG: 334999
REVIEW: 118207
FIXED-IN: 4.13.2
Before this patch, KDirLister would continue listing any children of
collapsed folders, even though the children themselves were removed
from the model. This could lead to new items being inserted as
top-level items at some later point, because no parent could be found
for them. This inconsistent model state could lead to a crash later on.
Many thanks to Martin Koller for helping to debug this problem!
BUG: 332102
REVIEW: 118055
FIXED-IN: 4.13.2
Before this patch, any (direct or indirect) children that might have
been in m_pendingItemsToInsert, i.e., that were not inserted into the
model yet because KDirLister had not finished listing the directory
yet, would be added to the model later without a proper parent. This
could cause a crash later on.
CCBUG: 332102
FIXED-IN: 4.13.2
Since the master branch had never been merged into frameworks since the
creation of the frameworks branch, I had to fix a couple of merge
conflicts and make another change in order to make it build - I hope I
did not get anything wrong.
We should probably merge master into frameworks on a regular basis from
now on.
CCMAIL:kfm-devel@kde.org
Conflicts:
dolphin/src/dolphinmainwindow.cpp
dolphin/src/search/dolphinfacetswidget.cpp
dolphin/src/statusbar/dolphinstatusbar.cpp
dolphin/src/views/dolphinview.cpp
Middle clicking on Forward/Backward/Home/etc. will no longer open a new
tab since the QAction triggered signal no longer tell us which mouse
button was pressed
Removed arguments from DolphinViewActionHandler::slotTrashActivated since
they were unused and made the connection fail.
Also fixed a bad connection in dolphinview.cpp, there is no signal
KFileItemModel::loadingCompleted
TerminalPanel connections to konsole part were not converted since there
is no header available that defines these function, we have to keep the
old syntax here.
Additionally the new syntax no longer accepts QPointer arguments, we have
to explicitly call .data() there.
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.
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
Updating this action is only required if the clipboard contents change,
or if the "is writable" state of the current location changes. In all
other cases, an update of this action should be prevented because it
can be very expensive if many files are in the clipboard.
In particular, the update when the selection changes could make
changing the current item in the view very slow.
BUG: 333903
REVIEW: 117782
FIXED-IN: 4.13.1
In addition to the current long text for previous and next toolbar
buttons ("Activate Previous/Next Tab"), this commit adds shorter icon
texts for them to be used only on the toolbar ("Previous/Next Tab").
BUG: 332629
REVIEW: 117794
FIXED-IN: 4.14.0
Instead of just emitting the slotItemMiddleClicked signal in
PlacesPanel::slotItemContextMenuRequested we now use triggerItem with
Qt::MiddleButton, which does set up the storage first and emit
the slotItemMiddleClicked signal afterwards.
BUG: 311226
FIXED-IN: 4.13.1
REVIEW: 117755
If a range of items has been selected by Shift-clicking or by pressing
Shift+Arrow, then each of them is added individually to the selection
before the items are re-sorted.
Before this commit, the first and the last item in the range were
moved, and all items between them were selected, even though these were
not necessarily the items which had been selected before the
re-sorting.
BUG: 333457
REVIEW: 117603
FIXED-IN: 4.13.1
when multiple tabs are opened. Disable them again
when there is only one remaining tab.
Additionally set the default state to disabled.
BUG: 332628
FIXED-IN: 4.13.1
REVIEW: 117778
In the current version we only call endRetrieval when
beginRetrieval was successfully in UpdateItemStatesThread::run().
This causes some problems with version control plugins (like Dropbox plugin),
which have to do cleanups in endRetrieval.
Now we always call endRetrieval after beginRetrieval when updating the version states.
FIXED-IN: 4.13.1
REVIEW: 117753
Instead of emitting the directoryLoadingCompleted signal (via slotCompleted) in
KFileItemModel::setShowHiddenFiles directly, we now call
dispatchPendingItemsToInsert instead.
@Frank: Thanks for your help!
FIXED-IN: 4.13.1
BUG: 332159
REVIEW: 117021
The icons of items which are "cut" are shown faded in the view. The
"is cut" state of the widget representing an item is updated if the
clipboard contents change. Before this commit, if the sort order was
changed however, then each widget kept the "is cut" state of the item
which had been shown previously at its position.
The solution is to update the "is cut" state also if any of the
widget's data change.
BUG: 332792
REVIEW: 117451
FIXED-IN: 4.12.5
Before this patch, the destructor of KDirectoryContentsCounter might
delete the worker object, which lives in another thread, while one of
its methods was still being executed. This could cause a crash. Only if
the destroyed KDirectoryContentsCounter was the last one, the worker
thread was stopped, and the destructor waited until all workers are
done.
BUG: 332767
FIXED-IN: 4.13.0
REVIEW: 117209
newly opened tab also starts the same search (Because new tab is opened with
the current view url), but the search box is in read-only mode. So you cannot
close the search bar nor edit the search text.
This patch fixes this by parsing the search url. The value of the "search"
parameter is used as search text and the value of the "url" parameter is used
for the search path ("root" folder for the search when "Search from here" mode
is enabled).
In case of Baloo search urls, we use Baloo::Query::fromSearchUrl.
Removed everything related to read only mode in DolphinSearchBox, not needed
anymore.
REVIEW: 111968
BUG: 311950
FIXED-IN: 4.13.0
They were previously checkboxes. Most files cannot have more than 1 type
considering that the exposed types were "Document", "Image", "Video" and
"Audio".
Also, it is not very simple in baloo to search through ORs for types.
Not through the exposed API anyway.
REVIEW: 117015
This required changes in Baloo which require reindexing. Since the
storage location has changed for Beta 3 everyone should be re-indexing
everything, so it won't be a problem.
Before this commit, filenamesearch checked if a file's MIME type begins
with "text/" to determine if its content can be searched. This prevented
that text inside shell scripts is found.
BUG: 332143
REVIEW: 116805
FIXED-IN: 4.12.4
KItemListViewAnimation::slotFinished() used a QHashIterator to iterate
over a QHash, and then removes an item from the hash using
QHash::remove() inside the loop.
This is quite unusual - the recommended way is to use a
QMutableHashIterator (or std-style iterators and then QHash::erase(it)).
This might be related to the cause of a crash in this function.
BUG: 331876
REVIEW: 116666
FIXED-IN: 4.13.0
Before this patch, pressing one of these buttons while an item is
hovered selected this item. The motivation for this behavior was to
provide a fast way to select items. However, this was counter-intuitive
and confusing for many users.
BUG: 310288
FIXED-IN: 4.13.0
REVIEW: 116469
Use scoring to find the best matching plugin for the given directory.
Thanks to Phil Schaf for testing this patch!
BUG: 330605
FIXED-IN: 4.12.3
REVIEW: 116019
If the user sets a maximum number of text lines in the settings, this
number was translated into a maximum height in pixels using
QFontMetrics::lineSpacing() before this commit.
In KStandardItemListWidgetInformant::itemSizeHint(), this maximum height
limited the size that is reserved for the item.
However, in KStandardItemListWidget::updateIconsLayoutTextCache(), the
maximum height was translated back into a maximum number of lines,
which limits the number of lines that are created using the QTextLayout.
This approach could lead to problems if the real height of the layouted
text is 1 pixel more or less than QFontMetrics::lineSpacing() times
"number of lines".
Now we do not store a "maximum height" inside the "maximum size"
explicitly, but store a maximum number of lines and a maximum with (for
Compact View) separately, and then use the number of lines also to
calculate the required size in
KStandardItemListWidgetInformant::itemSizeHint(). This should make sure
that the correct height is reserved for each item.
Thanks to Christoph Feck and Emmanuel Pescosta for helping to debug this
problem and testing the patch.
BUG: 323841
FIXED-IN: 4.13
REVIEW: 113871
Also update the font of the meta data widget in InformationPanelContent (smallest readable font).
BUG: 329186
BUG: 315061
FIXED-IN: 4.13
REVIEW: 115958
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.
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 5c5d87fec4, 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
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
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
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
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
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
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
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!
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
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
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
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
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
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
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
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
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
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
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
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
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
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.
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
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
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
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
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
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).
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
Implemented setActive(bool active), isActive() and activated() signal
for DolphinSearchBox - similar to the KUrlNavigator implementation.
BUG: 296970
FIXED-IN: 4.11.2
REVIEW: 112534
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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/
This feature might have been useful in some cases, but it's most likely
not useful enough to justify that we accept the bugs that it causes.
Even though some of these bugs are not Dolphin's fault at all, they
cause serious problems for users in some cases.
I'm pushing this commit to master only because I prefer to not push such
behavior changes to 4.11 at this point of the release cycle.
BUG: 288629
CCBUG: 322299
CCBUG: 322812
FIXED-IN: 4.12.0
REVIEW: 111692
So that filenames that look like HTML don't get fancy-formatted when
we show info about them (i.e. on hover)
This patch fixes the same issue in two places:
- dolphin, by setting Qt::PlainText on the status bar's label
- konqueror, by escaping setStatusBarText strings emitted by
DolphinPart
BUG: 321778
FIXED-IN: 4.11.0
REVIEW: 111746
The problem was that the view heigt minus the header height was
subtracted from maximumScrollOffset() to determine the maximum value
of the scroll offset of the top of the view.
However, the top of the view is the part that is hiden behind the
header. Therefore, the full view height must be subtracted from
maximumScrollOffset.
The remaining bits of bug 319951 were fixed by other recent commits.
Thanks to Emmanuel Pescosta for helping to track down the problem!
BUG: 319951
FIXED-IN: 4.11.0
REVIEW: 111486
When items are removed, new items may become visible because of that.
This includes
(a) Items *behind* the removed range. KItemListView may try to create
their widgets at their "imaginary" old positions and move them to
the new position with an animation.
(b) Items *before* the removed range, if the deletion causes the view
to scroll up. In that case, the "imaginary" old position and the new
position was equal, but KItemListView still tried to determine the
"old" position by adding the number of removed items to the index.
The result was that the widgets were created at completely wrong
positions, and no animation was started to fix this.
Thanks to Emmanuel for helping to find the cause of this bug!
BUG: 302373
FIXED-IN: 4.11.0
REVIEW: 111630