Commit graph

269 commits

Author SHA1 Message Date
Kai Uwe Broulik 0603e18cd4 Port back to KFilePlacesView
This removes the custom-view engine version of the places panel
and replaces it with the upstream `KFilePlacesView` from KIO.
2022-01-09 18:09:10 +01:00
Alexander Lohnau fd717b88fa Drop now unneeded QOverload statements
By defining the KF_DISABLE_DEPRECATED_BEFORE_AND_AT and QT_DISABLE_DEPRECATED_BEFOREvalues,
the deprecated overloads are hidden. This way we only have the un-deprecated one visible.
2021-12-13 08:35:26 +00:00
Ismael Asensio 4d9ea4261a Merge branch 'release/21.04' 2021-05-13 15:09:42 +02:00
Ismael Asensio 29636baff0 search/facetswidget: Check for protocol before trying to fetch tags
This was causing an error when trying to list items from the
non-existent `tags:` protocol.

BUG: 435586
FIXED-IN: 21.04.1
2021-05-10 14:05:35 +02:00
Ismael Asensio 65b283a909 search: Add action to clear tag selection
BUG: 432719
2021-05-03 16:22:21 +02:00
Nicolas Fella f65b0899c3 Build with QT_NO_KEYWORDS 2021-02-09 20:39:50 +00:00
Ahmad Samir 1d64b9bb10 DolphinView: set the parent of layout in the ctor
This silences a runtime warning:
QLayout: Attempting to add QLayout "" to DolphinView "", which already
has a layout

Remove redudant setLayout() calls, passing a parent widget to the
Q*BoxLayout ctor sets that layout as the top-level layout for that widget.
2020-12-03 19:50:04 +00:00
Alexander Lohnau 97415729c3 Compile with QT_NO_KEYWORDS 2020-10-23 18:23:06 +00:00
Alexander Lohnau a24327cd50 Compile without foreach 2020-10-23 18:23:06 +00: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
Ismael Asensio 73cac464c5 Merge branch 'release/20.08' 2020-08-04 22:39:11 +02:00
Ismael Asensio f9fd0e7be3 [search] Close tags menu after click when there is only one tag
It stays open otherwise to allow checking/unchecking several tags at a time

BUG: 424873
FIXED-IN: 20.08
2020-08-04 22:34:05 +02:00
Ismael Asensio 2fc117703f Add support to tags: scheme in DolphinQuery
It allows to start a search from a `tags:/mytag/` view.
The use case is to refine a search on additional terms (another tags,
ratings, etc)
2020-07-11 18:33:58 +00:00
Ismael Asensio ee97db4dfc [search] Fix corner cases when using quotes in filenames
The `filename` term in a search query is enclosed into quotes.
As the user can have additional quotes in the search term, there were several
corner cases where the parsing would fail to correctly split the terms

New test cases have been added to cover this possibility
Previous tests still passes to avoid regressions

BEFORE:
```
(filename/quoted) Compared values are not the same
Actual   (query.text()): "xyz\"\""
Expected (expectedText): "\"abc xyz\""

(filename/mixed) Compared values are not the same
Actual   (query.text()): "xyz\" tuv\""
Expected (expectedText): "\"abc xyz\" tuv"

(content+filename/quoted) Compared values are not the same
Actual   (query.text()): "abc xyz xyz\"\""
Expected (expectedText): "abc xyz filename:\"\"abc xyz\"\""
```
2020-07-05 17:15:31 +00:00
Ismael Asensio ec03435022 [search] Do not update text input when it has focus
When the user is entering a search term, a delayed search will be
emmited after a few seconds. This means updating the search URL, which
in turn gets parsed and reflected back on the search input.

To avoid interrupting the user input flow and unexpectedly move the
cursor to the end, let's update the input search box only when it
doesn't have the focus.

It's still updated on other interactions such as changing the search
options or clicking a saved search on the places panel.

BUG: 423328
FIXED-IN: 20.08
2020-07-05 17:14:19 +00:00
Ismael Asensio f57ee4b64d Expand DolphinQuery to support different Url schemes 2020-06-22 12:33:29 +00:00
Nate Graham 1ee665bac8 Move search and filter bar close buttons to the right
Summary:
Close buttons for windows, tabs, and pretty much everything else in KDE are on the right,
not the left. This patch makes Dolphin's search and filter bars follow that.

BUG: 421372
FIXED-IN: 20.08.0

Test Plan: {F8314176}

Reviewers: abetts, #dolphin, #vdg, elvisangelaccio, GB_2

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

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D29693
2020-05-18 07:30:12 -06:00
Méven Car e076d8668f filenamesearch:/ define a title for the query
Summary: CCBUG: 420354

Reviewers: ngraham, elvisangelaccio, #dolphin, #frameworks, iasensio

Reviewed By: elvisangelaccio, #dolphin, iasensio

Subscribers: iasensio, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D29198
2020-05-03 12:46:00 +02:00
René Bertin d3813ee65e prevent a QFileInfo warning
DolphinSearchBox::init() can generate a terminal warning depending on
the user's search history:

QFileInfo::absolutePath: Constructed with empty filename

The warning can seem to appear randomly if you don't use the search
feature often, because of its dependency on previous search activity.

Prevent this warning by adding a simple check if the current
m_searchPath is valid or not. This check has no effect on the value
returned by DolphinSearchBox::isIndexingEnabled() and is in line with
the fact that m_searchPath == QUrl() indicates that no search path has
been set.

Differential Revision: https://phabricator.kde.org/D29194
2020-04-27 10:32:34 +02:00
Shlomi Fish 196f4553e6 Move from the searchbox to the results with the down arrow key
Summary:
Move from the searchbox to the search results listbox/view using the
down arrow key in addition to the existing methods using the tab key,
return key, or the mouse.

Test Plan:
use ctrl+f to search in a directory tree, press down arrow key
to go to the results

Reviewers: ngraham, #dolphin

Reviewed By: ngraham, #dolphin

Subscribers: meven, elvisangelaccio, ngraham, iasensio, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D26362
2020-04-18 10:37:01 -06:00
Ismael Asensio 5778099ece (search) Fix searching tags with spaces
Summary:
Tags containing blank spaces were not handled properly in the search widget.
Now we enclose them in quotes and strip the quotes before setting them to the widget.

{F7854247}

Test Plan:
No artifacts when searching tags containing spaces
Added test cases to `bin/dolphinquerytest`

Reviewers: #dolphin, elvisangelaccio, ngraham, meven

Reviewed By: #dolphin, elvisangelaccio, ngraham

Subscribers: meven, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D26369
2020-01-19 23:17:26 +01:00
Ismael Asensio 296082b2b9 (search) Keep menu open when selecting tags
Summary:
Keeps the `Tags` menu open while selecting and deselecting tags in the
search panel, saving many mouse clicks for multiple tags.
It cannot be done natively on `QMenu` (https://bugreports.qt.io/browse/QTBUG-6635)
but it is a one-liner and I haven't seen any bad behavior so far.

Test Plan:
{F7853717}

- `Tags` menu does not close when selecting/deselecting tags
- Tag search is consistent
- Clicking anywhere else will close the menu

Reviewers: #dolphin, elvisangelaccio, ngraham, #vdg

Reviewed By: #dolphin, elvisangelaccio, #vdg

Subscribers: #vdg, broulik, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D26343
2020-01-06 16:03:46 +01:00
Ismael Asensio c331d70685 Clean-up DolphinFacetsWidget
Summary:
Small refactor patch to clean-up some logic on setter and getter:
- Search terms are previously splitted and set separately, so no need
  for extra splitting and `foreach` loop
- Return search terms on a `QStringList` rather than join first

Depends on: D26029

Test Plan: No behavior changes

Reviewers: #dolphin, elvisangelaccio

Reviewed By: #dolphin, elvisangelaccio

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D26150
2019-12-29 21:05:45 +01:00
Ismael Asensio 732697d0d6 Rename methods on DolphinFacetsWidget
Summary:
Small refactor patch to rename method names, from `ratingTerm` to `searchTerm`,
since its scope has grown bigger.

Test Plan: No behavior changes

Reviewers: #dolphin, elvisangelaccio

Reviewed By: #dolphin, elvisangelaccio

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D26029
2019-12-26 19:30:08 +01:00
Ismael Asensio 616d4e6bdd fix(search): Correctly parse filename and/or content search
Summary:
Currently, the search url parsing does not detect if the search is based on Content or Filename, and it just keeps the last selection which can be inconsistent with the actual search.

This patch add such detection, and since an advanced user can combine filename and content search (using the keyword `filename:`), now the parsing detects both items and handles the four possible cases:

| Content | Filename | Search text | Search type |
|---|---|------------------------|------------------|
| T | T | abc filename:"xyz"  | Content          |
| T | F | abc                           | Content          |
| F | T | xyz                           | Filename         |
| F | F |                                  | do not set       |

Depends on: D25260

Test Plan: `bin/dolphinquerytest`: Added new test cases for searches with content text and/or filename

Reviewers: elvisangelaccio, bruns, #dolphin

Reviewed By: elvisangelaccio, #dolphin

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D25416
2019-12-21 19:17:18 +01:00
Ismael Asensio 8e80c1d6dc [dolphin/search] Search by (multiple) tags
Summary:
Adds a tag selector in the extended filters of the search box.
Selected tag or tags are added to the search query along with the other filters (type, date, rating).

FEATURE: 412564
CCBUG: 356062

Test Plan:
- Menu shows the user tags
- Picking any tag/s filters the search to that specific tag/s

{F7727909}

Reviewers: elvisangelaccio, ngraham, #dolphin, #vdg

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

Subscribers: kfm-devel

Tags: #dolphin

Maniphest Tasks: T9094

Differential Revision: https://phabricator.kde.org/D25130
2019-12-15 17:28:38 +01:00
Antonio Rojas faa37a6138 Fix build with Qt 5.14 RC
Add needed Qt includes that are no longer pulled transitively.

BUG: 414492

Differential Revision: https://phabricator.kde.org/D25783
2019-12-09 23:21:51 +01:00
Ismael Asensio 6776fbc947 fix(search): Fix baloo searchString parsing
Summary:
Fix the parsing of Baloo query `searchString` to represent its parameters properly
in the search box:
# Baloo terms (`rating`, `modified`) are added to the user search text: {F7575590}
# Extra quotes are added to the search text: https://bugs.kde.org/show_bug.cgi?id=412952

This revision supersedes D24422, by making the fixes on the new dolphin query model,
instead of directly on the UI.

BUG: 412952
FIXED IN: 19.11.90

Test Plan:
  - `bin/dolphinquerytest` passes without `XFAIL`s
  - Dolphin search box is not garbled by search terms or quotes

Reviewers: elvisangelaccio, bruns, ngraham, #dolphin

Reviewed By: elvisangelaccio

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D25260
2019-11-28 22:08:13 +01:00
Ismael Asensio adfc098aa7 fix(search): Allow to set empty type
Summary:
This small patch allows to set and empty `type` to the extended options, which will set the `Any Type` option (index 0).
It doesn't make any change in current code, since this case is not called, but it helps simplifying follow-up patches.

Test Plan:
No behavior changes with current code.
Calling `setFacetsType(QString())` actually sets the first option (`Any Type`)

Reviewers: elvisangelaccio, #dolphin

Reviewed By: elvisangelaccio, #dolphin

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D25255
2019-11-13 22:53:18 +01:00
Elvis Angelaccio fc5546d03b DolphinQuery: drop DOLPHIN_EXPORT
DOLPHIN_EXPORT is only used by classes in the `dolphinprivate` target,
while DolphinQuery is part of `dolphinstatic`.

This should fix the failing Windows build on the CI.
2019-11-13 22:41:48 +01:00
Ismael Asensio 8d92c8be7f refactor(search): De-couple baloo URL parsing logic from UI
Summary:
Extracts the logic that parses `baloosearch:` urls into a new model class. The parser logic itself is kept as is.
The search box UI is later updated using the model fields.

This refactor has been proposed by @bruns in the review of D24422, as it largely simplifies the unit tests and further expansion/improvements.

Test Plan:
No behavior changes.
Test case is added in the follow-up revision: D25258

Reviewers: #dolphin, elvisangelaccio, bruns

Reviewed By: #dolphin, elvisangelaccio, bruns

Subscribers: ngraham, bruns, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D25257
2019-11-13 22:21:07 +01:00
Elvis Angelaccio 16a3aea6a6 Remove unnecessary semicolons after Q_UNUSED
GIT_SILENT
2019-11-09 22:09:16 +01:00
Ismael Asensio 7949aee2d2 Make the search box more compact
Summary:
Reduce the spacing between widgets and remove the content margins on the extended search options to have a more compact and space-saving layout.
Currently, some widgets are not even aligned.
This will be even more important if we remove the toggle button for 'More Options'.

CCBUG: 386754

Test Plan:
BEFORE: {F7681182}
AFTER: {F7681184}

Reviewers: elvisangelaccio, ngraham, #dolphin, #vdg

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

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D25028
2019-11-07 01:51:25 +01:00
Ismael Asensio 54bd267eb9 Get rid of search "More Options" toggle button
Summary:
With the new compact search filters (type/date/rating) it makes sense to show these options whenever available, and save some horizontal space on the main bar (specially for verbose languages).
These options will be hidden nevertheless if the search is non-indexed or Baloo is disabled.
For some nicer aesthetics D25029 should be also applied.

CCBUG: 386754

Test Plan:
Current: {F7681182}
After: {F7687380}
Along with D25029: {F7687385}

Reviewers: elvisangelaccio, ngraham, #dolphin, #vdg

Reviewed By: ngraham, #vdg

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D25057
2019-11-03 23:00:36 +01:00
Ismael Asensio 1c50de3b38 New design for extended search options
Summary:
Replace the arrays of radiobuttons in dolphin search box to more simple dropdown boxes.
This provides a leaner look, saving a lot user space on the main view and it is more consistent with the 'Search tools' in the most known sites (Google, DuckDuckGo, etc.)
There is room for improvement, as `QComboBox` doesn't match perfectly with the tool buttons used avobe, but I think it is an improvement over the current situation.

BEFORE:
{F7581883}

AFTER:
{F7580952}

Test Plan: Same behavior with different aesthetics

Reviewers: elvisangelaccio, #dolphin, #vdg

Subscribers: ndavis, ngraham, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D24602
2019-10-27 22:52:01 +01:00
Ismael Asensio c540b4eef1 [dolphin/search] Reset search options when needed
Summary:
Adds a method to reset the options in `facetsWidget` in two cases: when disabled and before parsing a new search URL.
Otherwise, controls for a parameter (ex. `rating`) which are not found in the new URL would stay on the old positions, instead of the default "any".
See D24422

Test Plan: Controls on `facetsWidget` go back to the default in such two cases.

Reviewers: #dolphin, elvisangelaccio, meven, ngraham

Reviewed By: ngraham

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D24450
2019-10-20 11:51:59 +02:00
Ismael Asensio 167d5184ed [dolphin/search] Fix search behavior when selecting "Your Files"
Summary:
Fix the search box forgetting the location where the user was previously searching into.

To do a search on "All Files" instead of setting the `m_searchPath` to `$HOME`, it checks the button state, so the "From Here" location is not lost.
As an added benefit, selecting "Your Files" when in a non-indexed folder will use the baloo search instead of a fully non-indexed search from $HOME.

This issue is the last remaining one of the series started with D24422, with the purpose of fixing the searchbox parsing and update.

Test Plan:
- Toggle between "From Here/Your Files" and navigate between locations
- The search box remembers the location and keeps a coherent state

{F7575402}

Reviewers: #dolphin, elvisangelaccio

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D24577
2019-10-20 11:43:32 +02:00
Ismael Asensio c144701c28 Hide search extra options when not available
Summary:
Hide the search extra options when they are not available, because the current location is not indexed or Baloo is not enabled.
The button is disabled and shows a tooltip to provide feedback of why it's not available.
Depends on D24478

{F7531893}

CCBUG: 396898
FEATURE: 318580
FEATURE: 408680
FIXED-IN: 19.11.80

Test Plan:
 - `Ctrl-F` on a non-indexed location
 - `balooctl disable` and `Ctrl-F` on an indexed location

On both cases the extra options are not shown, the button is disabled and the reason is shown in the tooltip
The user selection is remembered between indexed locations.

Reviewers: #dolphin, elvisangelaccio, meven, ngraham

Reviewed By: meven

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D24446
2019-10-13 17:22:28 +02:00
Ismael Asensio df9ca5b0c2 [dolphin/search] Add method isIndexEnabled()
Summary: Extracts the logic for checking if the current path is indexed to its own method.

Test Plan: No behavior changes

Reviewers: elvisangelaccio, ngraham, meven

Reviewed By: ngraham, meven

Subscribers: meven, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D24478
2019-10-08 21:42:11 +02:00
Ismael Asensio e30357343b [dolphin/search] Avoid unnecesary reloads on setSearchPath
Summary:
Check in `setSearchPath()` if the `url` passed is already the `searchPath`
This was causing an effect where reloading the same search URL results on buttons `From Here/Everywhere` toggling.
See D24422

Test Plan:
On your home folder press `Ctrl-F` several times
Buttons `From Here/Everywhere` should now not toggle each time

Reviewers: #dolphin, elvisangelaccio, meven, ngraham

Reviewed By: #dolphin, ngraham

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D24449
2019-10-07 21:50:59 +02:00
Ismael Asensio 304ab14e08 [dolphin/search] Add missing parsing for type 'Folder'
Summary:
Add missing parsing for type 'Folder'
See D24422

Test Plan:
dolphin --new-window 'baloosearch:?json=%7B%22type%22:[%22Folder%22]%7D'
- `Folders` is selected in search options

Reviewers: #dolphin, elvisangelaccio, meven, ngraham

Reviewed By: #dolphin, ngraham

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D24448
2019-10-07 21:44:34 +02:00
Laurent Montel 81065795b7 GIT_SILENT: minor qstring optimization 2019-09-08 09:33:41 +02:00
Carl Schwan 8dc5c7a199
Use placeholder for search action
Summary:
See https://hig.kde.org/style/writing/placeholder.html

Screenshot:

Old: {F6691712}
New: {F6698685}

Test Plan: Compile and run

Reviewers: #dolphin, #vdg, ngraham, elvisangelaccio

Reviewed By: #dolphin, #vdg, ngraham

Subscribers: GB_2, kde-doc-english, elvisangelaccio, ngraham, yurchor, kfm-devel

Tags: #dolphin, #documentation

Maniphest Tasks: T10258

Differential Revision: https://phabricator.kde.org/D19770
2019-04-22 23:03:10 +02:00
Stefan Brüns 9ce757b3d3 Make buttons in seach bar nicer (icon, tooltip, autoselect)
Summary:
The "Everywhere" button actually selects the home directory, so use
an appropriate label ("Your files") and add a "user-home" icon.

Pre-select the right button when entering search, depending on the
location where the "Find ..." action was triggered.

Add tooltips for both buttons, stating where to look for files. Most
importantly, this includes the full path for "From here".

Canonicalize the path correctly (always strip trailing slash), otherwise
QUrl::fileName() will be an empty string, resulting in "From Here (/)"

Do not hide the buttons in case the url is non-local, as it is confusing:
1. The state depends on the previous search. When the user hits "Find"
    when browsing e.g an SMB share, the search was probably in the home dir.
2. The current search location was hidden
3. The user may want to do a local search, give the option to do so.

Reviewers: #dolphin, ngraham, elvisangelaccio

Reviewed By: #dolphin, ngraham, elvisangelaccio

Subscribers: loh.tar, meven, elvisangelaccio, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D20357
2019-04-09 23:18:50 +02:00
Laurent Montel 4315e5c938 remove deprecated methods 2019-02-27 08:59:18 +01:00
Elvis Angelaccio 9616edbb66 Fix loop of FocusIn events
Summary:
Commit 43da84eefc introduced the risk of entering an endless loop of
`FocusIn`/`FocusOut` events sent to two DolphinSearchBox instances when
opening a second tab (see D11871).

This happens because we deactivate the first tab when we open a new one, but
since the `setActive(true)` is delayed with a QTimer, both the old tab
and the new one become active and receive their own `FocusIn` event
(which starts the loop of focus in/out events).

To prevent this issue, we schedule the searchbox activation only if the
searchbox is not already active.

Test Plan:
- Search something in dolphin
- Open a new tab after the search ends
- Check that dolphin does not eat the CPU

Reviewers: #dolphin, anthonyfieroni

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D13152
2018-06-13 21:39:22 +02:00
Roman Inflianskas 48b58f830a Remove unused #include
Summary: I used CLion inspection to hunt all unused #include

Reviewers: #dolphin, elvisangelaccio, markg

Reviewed By: #dolphin, elvisangelaccio, markg

Subscribers: bcooksley, markg, elvisangelaccio, #dolphin

Differential Revision: https://phabricator.kde.org/D10985
2018-03-04 21:00:47 +03:00
Roman Inflianskas 848abc5922 Remove unused #include
Summary: I used CLion inspection to hunt all unused #include

Reviewers: #dolphin, elvisangelaccio, markg

Reviewed By: #dolphin, elvisangelaccio, markg

Subscribers: markg, elvisangelaccio, #dolphin

Differential Revision: https://phabricator.kde.org/D10985
2018-03-03 17:08:01 +03:00
Renato Araujo Oliveira Filho da6f8fe086 Use Kio::KPlacesModel as source model for PlacesItemModel
Summary:
Use Kio::KPlacesModel as source model for PlacesItemModel avoiding
duplicated code.

Depends on D8862
Depends on D8332
Depends on D8434
Depends on D8348
Depends on D8630

Test Plan: Unit test created

Reviewers: elvisangelaccio, emmanuelp, mlaurent, mwolff

Reviewed By: elvisangelaccio, mlaurent, mwolff

Subscribers: mwolff, mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin

Differential Revision: https://phabricator.kde.org/D8855
2017-12-14 09:40:34 -03:00
Kevin Funk a6db5029ac Modernize: Use nullptr everywhere 2017-11-21 10:53:12 +01:00