Commit graph

947 commits

Author SHA1 Message Date
Laurent Montel 40cc911319 Remove not implmemented method 2020-10-17 18:05:17 +02:00
Elvis Angelaccio 1ded75ce44 Stop using QVariant < operator
It will be removed in Qt 6 without porting strategy:
f43cb31ba0

We know that that variants will be either ints (for `count`) or longs (for `size`),
so just convert them to longs (to avoid overflows) and compare those.
2020-10-15 01:22:00 +02:00
Elvis Angelaccio d9956c620e Drop obsolete version check
We require Qt 5.14 now.
2020-10-15 01:22:00 +02:00
Elvis Angelaccio a403df91b7 Port to non-deprecated QString::split() variant
This requires Qt 5.14, which we now depend on.
2020-10-15 01:22:00 +02:00
Elvis Angelaccio 3bf2922e33 Port away from QList::toSet()
The QSet range constructor requires Qt 5.14.

In `DolphinView::slotHeaderContextMenuRequested()` the conversion from
QList to QSet was pointless, so we just use a QList now.
2020-10-15 01:22:00 +02:00
Ahmad Samir aa12f9ec1d Don't trigger rubberband with back/foward mouse buttons
Right now the back/foward mouse buttons work, but also if you hold either
of them and move the mouse the rubberband selection is triggered.

This is the correct fix (instead of commit d0c71a1435), to match the
original code before the touch events patches,  we need to check the
back/foward buttons after mouseButtonPressed is emitted and before
triggering the rubberbad selection.
2020-10-04 19:41:40 +00:00
Elvis Angelaccio 041d6a4bd8 Fix build failure after last commit 2020-09-26 17:12:39 +02:00
Steffen Hartleib 81cf9f0375 Allow interaction with folder/files with the stylus again
This Patch works for Wayland and X.

BUG: 426582
2020-09-26 14:53:57 +00:00
Ahmad Samir d0c71a1435 Fix mouse back/forward buttons
We need to emit mouseButtonPressed (now in the onPress method) before the
check needed to not select items on back/foward mouse button press events.
2020-09-20 18:38:29 +02:00
Steffen Hartleib d7b33b76a1 Improve Touch support
With this patch dolphin now supports the following touch gestures:

* Tap gesture to interact/open with directories, files and so on
* TapAndHold and release gesture for access to the context menu (main window, panel folder, places and information)
* TapAndHold and moving gesture for drag and drop action (main windows, panel folder and places)
* pinch gesture for zoom in main window
* kinetic scrolling (QScroller) for main window, panel folder, panel places, panel information, setting preview and service
* two fingers swipe gesture to left, right and up as shortcut to navigate back, forward and up
* two finger tap gesture to toggle item selection, similar to Ctrl and left mouse click

FEATURE: 385066
FIXED-IN: 20.11.80

 You are currently rebasing branch 'touch' on '85241a924'.
2020-09-13 18:53:32 +00:00
Ayushmaan jangid d899c2b401 Fix wreorder warning 2020-09-13 17:52:09 +00:00
Elvis Angelaccio 576a97d8eb Merge branch 'release/20.08' into master 2020-09-05 22:55:59 +02:00
Elvis Angelaccio aee26d29f1 Revert "Set a better defaultDropAction for dragging"
This reverts commit 4440e961a0.

BUG: 425757
BUG: 426196
FIXED-IN: 20.08.2
2020-09-05 22:51:36 +02:00
Laurent Montel 7479fef799 Port away from deprecated Qt::MidButton 2020-08-31 21:24:03 +02:00
Alexander Lohnau 5360bc3ab3 Merge branch 'release/20.08' 2020-08-30 18:49:22 +02:00
Alexander Lohnau 004734e832 Fix file preview for desktop files with absolute icon paths
BUG: 423326
FIXED-IN: 20.08.1
2020-08-30 18:46:32 +02:00
Elvis Angelaccio 954e8c4790 Output of licensedigger + manual cleanup afterwards.
Unfortunately licensedigger does not strip the trailing * characters.
While at it, use a common style for all source files.
2020-08-25 17:07:38 +00:00
Elvis Angelaccio 864b59fcf1 Port away from QWheelEvent::orientation()
We are supposed to use QWheelEvent::angleDelta() instead. Upon an
horizontal/vertical scroll event, its `x()`/`y()` method will return a
value different from zero.
2020-08-17 20:19:44 +00:00
Ismael Asensio bf2eb0d69d Fix selection rect after porting from QFontMetrics::width()
After porting from QFontMetrics::width() to QFontMetrics::boundigRect().width() in system/dolphin!10 we have a visual bug on selection rects, that can be seen on details and compact modes.

While from https://kdepepo.wordpress.com/2019/08/05/about-deprecation-of-qfontmetricswidth/ the use of `boundingRect()` would seem the right option to use (and I struggle to get the difference between the two methods when applied to a whole string and not a single char), in this case the `horizontalAdvance()` seems to return the value we need.

BUG: 421973
FIXED-IN: 20.07.70
2020-07-12 23:30:14 +02:00
Ismael Asensio 76a46fd909 Fix selection rect after porting from QFontMetrics::width()
After porting from QFontMetrics::width() to QFontMetrics::boundigRect().width() in system/dolphin!10 we have a visual bug on selection rects, that can be seen on details and compact modes.

While from https://kdepepo.wordpress.com/2019/08/05/about-deprecation-of-qfontmetricswidth/ the use of `boundingRect()` would seem the right option to use (and I struggle to get the difference between the two methods when applied to a whole string and not a single char), in this case the `horizontalAdvance()` seems to return the value we need.

BUG: 421973
FIXED-IN: 20.07.70
2020-07-12 21:28:02 +00:00
Elvis Angelaccio 85241a9246 Port away from QLinkedList
`QLinkedList` has been deprecated and should not be used in new code. Port
to `std::list` instead.
2020-07-06 07:16:27 +00:00
Gastón Haro 0f0d14d4c2 Provide ability to configure size cut-off for local file previews
Summary:
FileWidgets read from kdeglobals the property "MaximumSize" under "PreviewSettings" to decide if a preview will be generated for that file.
There is no current GUI to change that file size limit. On the other hand Dolphin ignores it.

This patch aims to fix that by adding new configuration options to Dolphin. That is a new spinbox in Dolphin settings under General -> Previews tab.

Test Plan:
1 - Set up a local folder with 2 jpg images of less and more than 1 MB respectively.
2 - Go to Dolphin Preferences. General -> Previews and check "JPEG Images" from
    the list. And set "Skip previews for files above:" to 1MB.
3 - Navigate to the afore mentioned folder. Only the image of size less than 1 MB should
    show a preview.

BUG: 331240

Reviewers: ngraham, #dolphin, meven, elvisangelaccio

Reviewed By: ngraham, #dolphin, meven, elvisangelaccio

Subscribers: cfeck, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D28402
2020-06-09 11:05:55 -06:00
Elvis Angelaccio c16f777b28 Fix FIFO usage
`m_propriorityQueue` and `m_queue` are used as FIFO queues, so we need
to use `takeFirst()` instead of `takeLast()` when removing elements
from the queue.

While at it, add a comment so that we will remember these are FIFO
queues.
2020-05-31 23:45:07 +02:00
Elvis Angelaccio b65576a131 Port away from deprecated QFontMetrics::width()
While the documention says to port to QFontMetrics::horizontalAdvance(),
what we actually need is not the horizontal advance, but the width of
the text. So we need to port to QFontMetrics::boundingRect().width().

Quoting from https://kdepepo.wordpress.com/2019/08/05/about-deprecation-of-qfontmetricswidth/:

"Since it was not clear from the confusingly named function QFontMetrics::width()
that it actually returned the horizontal advance, instead of the bounding width,
this method is now obsolete.
You must port to either QFontMetrics::horizontalAdvance() or QFontMetrics::boundingRect().width().

Please make sure you are aware of the difference, and do not port
blindly. I am pretty sure that in most cases
QFontMetrics::boundingRect() is what you want, unless you are writing
custom text shaping/layouting code. Using the wrong function can cause
clipped text or text that suddenly wraps to the next line despite
calculating the width that it needs."
2020-05-29 23:23:55 +00:00
Elvis Angelaccio 0d679da0a3 Port to non-deprecated variant of QPixmapCache::find()
We need to pass the pixmap by address, not by reference.
2020-05-28 23:04:04 +02:00
Elvis Angelaccio cbb35681f5 Add some missing const qualifiers 2020-05-28 22:42:40 +02:00
Méven Car f6afbbc240 KDirectoryContentsCounter: scan first path not in cache
Use a secondary QLinkedList to store the priority path.
2020-05-25 15:31:51 +00:00
Méven Car eda05b12fb KDirectoryContentsCounter: don't schedule scanning a folder already in the Queue
Use a QLinkedList to check for presence in the queue.

merge request !2
2020-05-20 07:45:58 +02:00
Méven Car a058c64eba Merge branch 'release/20.04' 2020-05-18 08:17:01 +02:00
Méven Car 99cf24c03d Left-elide file/folders while keeping their extension visible
Summary:
Tweak behavior introduced in D19471.

BUG: 404955

Test Plan:
Before:
{F8325282}
After:
{F8325283}
{F8325284}

Reviewers: ngraham, #dolphin, elvisangelaccio, #vdg

Reviewed By: ngraham, #dolphin, elvisangelaccio, #vdg

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D29794
2020-05-18 08:14:47 +02:00
Ahmad Samir e3c03e466e Port QRegExp to QRegularExpression
Summary:
Port QRegExp::exactMatch() with QRegularExpression::anchoredPattern().
Port QRegExp::Wildcard with QRegularExpression::wildcardToRegularExpression().
Note that QRegularExpression::wildcardToRegularExpression() returns an anchored
pattern.

Test Plan:
Using the filter bar in dolphin works as before.

All unit tests pass, except:
- kfileitemmodeltest (which is unrelated AFAICS); it fails on master too
- placesitemmodeltest, which fails on master too

Reviewers: #dolphin, elvisangelaccio, meven

Reviewed By: #dolphin, elvisangelaccio

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D26215
2020-05-06 11:37:38 +02:00
Christian Christiansen 1d72710039 Keep name readable on drag to matching background
Summary:
Previously, when a single item was selected and dragged, the
name would become unreadable when the text colour matched the
background colour it was dragged onto.

This is now fixed by not deselecting the item (and hence keeping
the highlighting around the text) before creating the pixmap for
dragging.

BUG: 405266

Test Plan: Tested with Breeze and Breeze Dark.

Reviewers: #dolphin, elvisangelaccio, meven

Reviewed By: #dolphin, elvisangelaccio, meven

Subscribers: meven, elvisangelaccio, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D29378
2020-05-06 09:40:55 +10:00
Méven Car 91ea1e29ee Sort by file size according to DetailsModeSettings::directorySizeCount
Test Plan: Sort by file size in details view.

Reviewers: #dolphin, ngraham, elvisangelaccio

Reviewed By: #dolphin, ngraham

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D29424
2020-05-05 07:31:57 +02:00
Méven Car 31f5dc7f7c Fix Windows Build
Summary: Due to D25335

Reviewers: #dolphin, elvisangelaccio, ngraham

Reviewed By: #dolphin, ngraham

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D29425
2020-05-05 07:31:22 +02:00
Méven Car e6ea3ab4c4 [Details mode] Allow to fill the column size of directories with actual size
Summary:
Allow to compute the recursive size of directories to fill the details view size column.
A setting allow to set a limit to the recursive level, allowing the user to have some power over the setting.

When sorting by size and the feature is on, we get progressive ordering as the directory size are gathered.

KDirectoryContentsCounter uses a cache internally to keep results so that it can display directory size faster, but counts the dir size of directories each time it is asked to count the size a directory nevertheless and when the size has changed, it is updated.
KDirectoryContentsCounter uses one worker per instance only, meaning one process per view makes the disk spin.

FIXED-IN: 20.08
BUG: 190580
BUG: 158090

Test Plan:
With some recursion allowed:
{F8267580}

Without any recursion allowed (default):
{F8267581}

Reviewers: elvisangelaccio, ngraham, #dolphin

Reviewed By: elvisangelaccio, ngraham, #dolphin

Subscribers: feverfew, anthonyfieroni, iasensio, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D25335
2020-05-04 07:26:59 +02:00
Alexander Lohnau fa3f3a475d Merge branch 'release/20.04' 2020-04-13 21:25:52 +02:00
Martin T. H. Sandsmark 35b4c6d4df Fix crashing on starting and quitting
QCollator (especially with Qt 5.14 and ICU 65.1) is very unhappy with
threads.

To avoid having to lock and unlock the mutex everywhere (and ensure it
is unlocked before calling other things that might lock it, etc.), we do
it as locally as possible. Even if for some reason Qt and ICU make
QCollator threadsafe in the future locking here should have minimal
impact.

BUG: 419585

Differential Revision: https://phabricator.kde.org/D28659
2020-04-12 12:15:03 +02:00
Tranter Madi 4440e961a0 Set a better defaultDropAction for dragging
Summary: Because we use KIO::DropJob to determine the dropAction, so changing this one does not change anything else except the default cursor from the copy icon to the closed-hand one.

Test Plan: Drag files without holding any modifier key and see the cursor.

Reviewers: #dolphin, ngraham

Reviewed By: #dolphin, ngraham

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D28370
2020-03-30 09:54:38 +07:00
Tranter Madi b96c48b44e Update dragCursor while dragging
Summary:
While dragging, the user could want to change the modifier, so we should call event->acceptProposedAction() to do update the dragCursor.

FIXED-IN: 20.04.0

Test Plan: While dragging files, change modifiers between Ctrl/Shift/Alt... and move the mouse at least 1px to see the cursor changes.

Reviewers: #dolphin, meven, ngraham, davidedmundson, elvisangelaccio

Reviewed By: #dolphin, elvisangelaccio

Subscribers: elvisangelaccio, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D28017
2020-03-25 09:23:50 -06:00
George Vogiatzis 9e3418bd55 Add natural sorting and case-insensitive sorting for all role-types
Summary:
 Add natural sorting and case-insensitive sorting, for all role-types
that benefit from.

BUG: 406296
FIXED-IN: 19.12.2

Test Plan:
Sort by any role type specified in `isRoleValueNatural()`
Before: Sorting is always case sensitive
After: Sorting according to 'Sorting mode' in configuration.

Reviewers: #dolphin, nicolasfella, meven, elvisangelaccio, ngraham

Reviewed By: #dolphin, meven, elvisangelaccio, ngraham

Subscribers: cfeck, meven, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D25741
2020-01-28 08:52:58 -07:00
Nate Graham c2fa8ae9ab Merge branch 'release/19.12' 2020-01-27 09:49:44 -07:00
George Vogiatzis 178eb5927c Change drop indicator color
Summary:
Change drop indicator color form highlight to text.
This makes more visible, when indicator is adjacent to a highlight
item, of a list.

BUG: 415010

Test Plan:
Before vs After
{F7974679}

Reviewers: #dolphin, #vdg, elvisangelaccio, ngraham

Reviewed By: #dolphin, #vdg, ngraham

Subscribers: meven, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D26936
2020-01-27 09:49:09 -07:00
Ismael Asensio a8dd699840 Get rid of -Wdeprecated-copy warning
Summary:
Remove the explicit copy constructor of `KItemListStyleOption`, since it does not
add any logic to what the implicit copy constructor does, but triggers a compiler
warning if we don't overload `operator=` too.

Test Plan:
Compiles without `-Wdeprecated-copy` warning
No behavior changes

Reviewers: elvisangelaccio, #dolphin

Reviewed By: elvisangelaccio, #dolphin

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D26585
2020-01-12 19:00:25 +01:00
Robert Hoffmann 17e127edcd Add only canonical paths to dirWatcher
Summary: KDirWatch only works correctly with canonical paths, i.e. symbolic links resolved.

Test Plan:
1. Create dirs:
$ mkdir test1
$ mkdir test1/subdir
$ ln -s test1 test2

2. Start dolphin, navigate to test2/subdir, then in terminal:
$ echo test > test2/subdir/test

Without the patch, test2/subdir/test won't be shown automatically, only after reload (F5).
With the patch applied, test2/subdir/test will be shown automatically.

3. Restart dolphin, navigate to test2/subdir, then in terminal:
$ echo test >> test2/subdir/test

Without the patch, the increased size of test2/subdir/test won't be shown automatically,
only after reload (F5). With the patch applied, it will be shown automatically.

4. Restart dolphin, navigate to test2/subdir, then in terminal:
$ rm test2/subdir/test

Without the patch, test2/subdir/test stays visible, will only disappear after reload (F5).
With the patch applied, it will disappear automatically.

Reviewers: dfaure, #dolphin, elvisangelaccio

Reviewed By: dfaure, #dolphin, elvisangelaccio

Subscribers: ngraham, elvisangelaccio, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D25732
2020-01-11 21:59:12 +01:00
Laurent Montel 98dec73ecc Don't use nullptr for flag. Just use default argument here 2020-01-06 13:30:12 +01:00
Laurent Montel 984e8686e8 Don't use nullptr/0 as flags (deprecated in qt5.15) 2019-12-26 14:23:45 +01:00
Nate Graham 0804983685 Merge branch 'release/19.12' 2019-12-21 11:54:53 -07:00
Nate Graham 403de19d9c Improve scroll wheel speed by basing it on label height, not icon height
Summary:
Dolphin currently scrolls by the height of three items at a time per "step" when
using a scroll wheel. Because item height is highly variable, this leads to scroll
speed being inconsistent between views, and generally far too fast when using
icon view with icons larger than 22px size.

This patch makes the size of the scroll step based on the text label rather than the
icon size just like D25683, ensuring that the scroll speed does not vary and become
super fast when using large icons in particular.

It also reverts 90beb4a5e3, which is no longer needed.

BUG: 386379
FIXED-IN: 19.12.1

Test Plan:
Use a mouse with a scroll wheel and scroll in Dolphin item views with list view,
details view, icon view, etc, using different item sizes. Speed should be
consistent in all views now, and also feel consistent with other KDE apps.

Also try with multiple scale factors to make sure the behavior does not change.

No change with high-resolution two-finger touchpad scrolling.

Reviewers: #dolphin, elvisangelaccio

Reviewed By: #dolphin, elvisangelaccio

Subscribers: ahiemstra, lots0logs, anthonyfieroni, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D19190
2019-12-21 11:54:46 -07:00
Laurent Montel 377484aa00 GIT_SILENT: Port deprecated QSet::toList method 2019-12-19 14:39:43 +01:00
Antonio Rojas 8ffc72e87f Merge branch 'release/19.12' 2019-12-09 23:23:07 +01:00