Commit graph

285 commits

Author SHA1 Message Date
Nicolas Fella 1826f905d7 Merge branch 'master' into kf6 2023-10-24 23:14:25 +02:00
Amol Godbole 2f39eb51b6 DolphinView: get rid of writeStateChanged signal in setActive()
The signal writeStateChanged() was not working because it is not connected
to slotWriteStateChanged() slots when the active view changes. Replace the
signal with direct calls to the slots.

Also, do not delay openRequest signal in DolphinSearchBox::slotSearchTextChanged.
It's no longer required.

BUG: 440366
2023-10-12 09:43:37 +00:00
Méven Car 4cbeb81b2b Merge remote-tracking branch 'origin/master' into kf6 2023-09-10 15:24:39 +02:00
Méven Car b58a346be9 Replace qAsConst with std::as_const 2023-09-10 15:19:13 +02:00
Amol Godbole c4bb3db022 Restore the URL when DolphinSearchBox is cleared
Currently, the URL navigator is not updated when the search box is cleared. This MR restores the URL, by closing and reopening the box.

The call for emitting closeRequest() on pressing Esc has been replaced with emitCloseRequest(). The wait duration before starting a search has been reduced to 500ms to increase responsiveness.

Also, the bugfix for BUG: 423328 is slightly incorrect and causes the search term to not be displayed when opening a saved search for the first time. As a better solution for this bug, DolphinSearchBox::setText() now updates the text only if the text has changed.

BUG: 473775
2023-09-04 07:39:13 +00:00
Méven Car 079f903bc8 Fix a bunch of clazy warnings 2023-08-29 07:18:51 +00:00
Friedrich W. H. Kossebau ed2d352c42 Add explicit moc includes to sources for moc-covered headers
* speeds up incremental builds as changes to a header will not always
  need the full mocs_compilation.cpp for all the target's headers rebuild,
  while having a moc file sourced into a source file only adds minor
  extra costs, due to small own code and the used headers usually
  already covered by the source file, being for the same class/struct
* seems to not slow down clean builds, due to empty mocs_compilation.cpp
  resulting in those quickly processed, while the minor extra cost of the
  sourced moc files does not outweigh that in summary.
  Measured times actually improved by some percent points.
  (ideally CMake would just skip empty mocs_compilation.cpp & its object
  file one day)
* enables compiler to see all methods of a class in same compilation unit
  to do some sanity checks
* potentially more inlining in general, due to more in the compilation unit
* allows to keep using more forward declarations in the header, as with the
  moc code being sourced into the cpp file there definitions can be ensured
  and often are already for the needs of the normal class methods
2023-07-05 07:59:18 +00:00
Tem PQD 4d930992c4 Use ellipsis everywhere instead of three dots
Better for screen readers etc.
2023-06-29 22:42:34 +00:00
Ismael Asensio ba60b6ada3 search: Prevent the search box from enlarging the view
By default, the search filters widget calculates its
`minimumSizeHint` as the sum of its components' minimum widths.

This minimum width hint will scale up the widgets hierarchy,
finally imposing a minimum width to the contents view, which
in certain conditions can take the space from the side panels.

Let's set a minimum width hint of 0, so it is the filters widget
which always adapts to the available view size instead.

BUG: 466796
FIXED-IN: 23.04
2023-03-04 10:30:41 +00:00
Serg Podtynnyi 38c34eeca3 Add clang-format and format code as in Frameworks 2023-02-05 12:45:38 +07:00
Laurent Montel e19aa49a08 Remove unused includes 2022-09-26 08:17:13 +02:00
Ahmad Samir 8aa81a1dc7 Cleanup config-dolphin.h includes 2022-06-15 11:28:44 +02:00
Ahmad Samir 28a74d1780 Use cmakedefine01
This way we get a build time warning if the var isn't defined at all, e.g.
a missing check_include_files() CMake call.
2022-06-15 11:28:42 +02:00
Ahmad Samir 8a0003bfbc Use one config-dolphin.h.cmake configuration file 2022-06-15 11:27:55 +02:00
Alexander Lohnau 0fc218fd26 Drop KNS3 prefix for KMoreTools includes
In KF6 KMoreTools should become it's own library and thus the KNS3 prefix should get removed.
Considering that the classes are not in any namespace, having a namespaced include is not needed and only causes noise.
2022-05-13 19:17:06 +00:00
Ismael Asensio 2c91112c61 SearchBox: Add topMargin to balance the spacing 2022-05-06 20:10:04 +00:00
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