Commit graph

142 commits

Author SHA1 Message Date
MacDue
35612c6a7f AK+Everywhere: Change URL::path() to serialize_path()
This now defaults to serializing the path with percent decoded segments
(which is what all callers expect), but has an option not to. This fixes
`file://` URLs with spaces in their paths.

The name has been changed to serialize_path() path to make it more clear
that this method will generate a new string each call (except for the
cannot_be_a_base_url() case). A few callers have then been updated to
avoid repeatedly calling this function.
2023-04-15 06:37:04 +02:00
MacDue
2aa8c9950e FileManager: Use GUI::Process::spawn_or_show_error() to open terminals 2023-03-24 22:06:38 +00:00
Cameron Youell
1dc3ba6ed5 Applications: Convert DeprecatedFile usages to LibFileSystem 2023-03-24 10:58:43 +00:00
Cameron Youell
752f06f228 LibFileSystem: Move TempFile from LibCore to LibFileSystem
As suggested in commit de18485
2023-03-21 19:03:21 +00:00
Cameron Youell
1d24f394c6 Everywhere: Use LibFileSystem where trivial 2023-03-21 19:03:21 +00:00
Caoimhe
87bfb47d1f FileManager: Extract .zip files to a temporary folder when opened
Prior to this commit, when you double-click a .zip file to open it, it
gets opened in Text-Editor as there is no other file association.

Now, when FileManager is invoked with a .zip file as the first argument,
a temporary directory will be created and the .zip will be extracted
into it. Once the FileManager window is closed, Core::TempFile will
delete the temporary directory.

This adds something like what we see in other operating systems' file
explorers, except for the fact that most other operating systems will
treat the .zip file as its own independent read-only filesystem. It
would be nice to do that in the future, but I feel like this is
sufficient for now.
2023-03-19 00:14:03 +00:00
Andreas Kling
8a48246ed1 Everywhere: Stop using NonnullRefPtrVector
This class had slightly confusing semantics and the added weirdness
doesn't seem worth it just so we can say "." instead of "->" when
iterating over a vector of NNRPs.

This patch replaces NonnullRefPtrVector<T> with Vector<NNRP<T>>.
2023-03-06 23:46:35 +01:00
Sam Atkins
af03cf9e80 FileManager: Use PathBreadcrumbbar instead of Breadcrumbbar :^) 2023-02-19 01:09:09 +01:00
Sam Atkins
f5cf41eb5d LibGUI+FileManager: Move has_{parent,child}_segment logic into BCB 2023-02-19 01:09:09 +01:00
Sam Atkins
6b66e39df4 LibGUI+Userland: Stop returning Layout from Widget::(try_)set_layout()
Nobody uses this return value any more. It also lets us remove a whole
bunch of `(void)` casts. :^)
2023-02-18 16:56:56 +00:00
Tim Schumacher
d43a7eae54 LibCore: Rename File to DeprecatedFile
As usual, this removes many unused includes and moves used includes
further down the chain.
2023-02-13 00:50:07 +00:00
Tim Ledbetter
d2e1f6ff57 FileManager: Propagate errors from PropertiesWindow initialization 2023-02-11 19:32:07 +00:00
Lucas CHOLLET
be28800e0d FileManager: Factorize code to handle drag-and-drop
The treeview and the breadcrumbbar used to be on one side, sharing
drag-and-drop handling and on the other side the directory view had
its one logic.

This patch factorizes both versions, in the meantime upgrading the
version used by the treeview/breadcrumbbar that was left behind. It now
uses the copy dialog :^).
2023-02-11 14:18:13 +00:00
Linus Groh
6e7459322d AK: Remove StringBuilder::build() in favor of to_deprecated_string()
Having an alias function that only wraps another one is silly, and
keeping the more obvious name should flush out more uses of deprecated
strings.
No behavior change.
2023-01-27 20:38:49 +00:00
Tim Schumacher
82a152b696 LibGfx: Remove try_ prefix from bitmap creation functions
Those don't have any non-try counterpart, so we might as well just omit
it.
2023-01-26 20:24:37 +00:00
Sam Atkins
8297516f89 FileManager: Use Core::Process::set_name() 2023-01-25 14:27:45 +01:00
Sam Atkins
f0395a2042 LibGUI+Userland: Rename try_load_from_gml() -> load_from_gml() :^)
It's the only one, so the `try` prefix is unnecessary now.
2023-01-07 14:39:30 +01:00
Sam Atkins
54b1326165 Userland: Replace all uses of load_from_gml with try_load_from_gml
MOAR FIXMES! ;^)
2023-01-07 14:39:30 +01:00
Sam Atkins
0c24522635 LibGUI+Everywhere: Use fallible Window::set_main_widget() everywhere :^)
Rip that bandaid off!

This does the following, in one big, awkward jump:
- Replace all uses of `set_main_widget<Foo>()` with the `try` version.
- Remove `set_main_widget<Foo>()`.
- Rename the `try` version to just be `set_main_widget` because it's now
  the only one.

The majority of places that call `set_main_widget<Foo>()` are inside
constructors, so this unfortunately gives us a big batch of new
`release_value_but_fixme_should_propagate_errors()` calls.
2023-01-06 13:36:02 -07:00
ericLemanissier
21e8099e42 FileManager: Propagate errors while loading bmp 2022-12-23 12:23:05 +00:00
Sam Atkins
81fe2ef178 FileManager: Silence the "not found" error when setting no wallpaper
If we're setting the path to "" then we can just set the wallpaper to
nullptr and carry on with our day. :^)
2022-12-07 17:12:45 +00:00
Linus Groh
57dc179b1f Everywhere: Rename to_{string => deprecated_string}() where applicable
This will make it easier to support both string types at the same time
while we convert code, and tracking down remaining uses.

One big exception is Value::to_string() in LibJS, where the name is
dictated by the ToString AO.
2022-12-06 08:54:33 +01:00
Linus Groh
6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00
demostanis
34acae90c7 Userland: Let applications make use of make_command_palette_action() 2022-10-25 10:21:18 +01:00
Chun Ngai Au
5bccb16e61 WindowServer: Add wallpaper backing bitmap
Fixes inconsistencies in redrawing the wallpaper when in stretch mode by
first drawing to a backing bitmap. To reduce unnecessary allocations,
the backing bitmap is only used for stretch mode.
2022-10-17 01:12:51 +02:00
networkException
4230dbbb21 AK+Everywhere: Replace "protocol" with "scheme" url helpers
URL had properly named replacements for protocol(), set_protocol() and
create_with_file_protocol() already. This patch removes these function
and updates all call sites to use the functions named according to the
specification.

See https://url.spec.whatwg.org/#concept-url-scheme
2022-09-29 09:39:04 +01:00
Jannis Weis
3911758277 FileManager: Disable open_child_directory_action if no child exists 2022-08-22 12:48:11 +02:00
Jannis Weis
8b395ffcc5 FileManager: Respond to all selection changes in the Breadcrumbbar
Use Breadcrumbbars on_segment_change instead of on_segment_click.
This allows us to remove the manual handler invokation in the
open_child_directory_action
2022-08-22 12:48:11 +02:00
Andreas Kling
81ee870c9b FileManager: Add "open child directory" action (Alt+Down)
This mirrors the "open parent directory" action, but traverses the
breadcrumbbar segments from left-to-right instead. The name is a little
bit strange, and maybe we can come up with something better.

It does feel pretty nice to use though. :^)
2022-08-18 20:44:15 +02:00
Timothy Flynn
299cebbbcb FileManager: Do not activate "Show Dotfiles" action on every startup
Commit 75d1840cf detects if the initial path provided to the FileManager
contains a dotfile, and if so, forces the FileManager to show dotfiles.
However, it does this by activating the "Show Dotfiles" action. This has
the side effect of always setting and persisting the configuration,
overriding whatever the user's preference was.

Instead, only transiently update the view to show dotfiles if the path
contains a dotfile.
2022-08-18 15:58:41 +02:00
cflip
0822bf5580 FileManager: Add 'Set as Desktop Wallpaper' action to file context menu 2022-08-14 09:44:08 +01:00
sin-ack
c8585b77d2 Everywhere: Replace single-char StringView op. arguments with chars
This prevents us from needing a sv suffix, and potentially reduces the
need to run generic code for a single character (as contains,
starts_with, ends_with etc. for a char will be just a length and
equality check).

No functional changes.
2022-07-12 23:11:35 +02:00
sin-ack
3f3f45580a Everywhere: Add sv suffix to strings relying on StringView(char const*)
Each of these strings would previously rely on StringView's char const*
constructor overload, which would call __builtin_strlen on the string.
Since we now have operator ""sv, we can replace these with much simpler
versions. This opens the door to being able to remove
StringView(char const*).

No functional changes.
2022-07-12 23:11:35 +02:00
Sam Atkins
80174439a9 Revert "FileManager: Reduce scope of some variables related to context…
menu"

This reverts commit 61dc489778.

This commit was causing FileManager to crash whenever you selected to
open a file using the context menu.
2022-05-13 16:28:36 +02:00
Sam Atkins
cdffe556c8 LibGUI+Userland: Make Dialog::ExecResult an enum class 2022-05-13 16:27:43 +02:00
offtkp
61a9ad45ed FileManager: Check for write permission before enabling certain actions
Upon DirectoryView selection change, check for write permission before
enabling delete and cut. This disallows attempting to delete/cut and
paste a file that you don't have write permission to by using keybinds.

Fixes #13983.
2022-05-13 10:02:01 +02:00
Karol Kosek
39c0f31009 FileManager: Remove unused lstat() call 2022-05-07 20:14:23 +02:00
Karol Kosek
61dc489778 FileManager: Reduce scope of some variables related to context menu 2022-05-07 20:14:23 +02:00
Karol Kosek
4ef8bf53ba FileManager: Don't use bitwise OR operators on booleans 2022-05-07 20:14:23 +02:00
Karol Kosek
ec02d58b5b FileManager: Rename action_show_dotfiles to show_dotfiles_action
All actions are named that way.
2022-05-07 20:14:23 +02:00
Karol Kosek
ff6df9f27e FileManager: Use VERIFY() instead of if checks with VERIFY_NOT_REACHED
Besides micro simplifying the code, this will also show the failed
condition in the console, instead of vague 'ASSERTION FAILED: false'.
2022-05-07 20:14:23 +02:00
Sam Atkins
dc5a318aa9 FileManager: Use TRY in run_file_operation()
The exception is `execvp()` since that has no Core::System wrapper yet.
2022-03-13 22:38:48 +01:00
Lenny Maiorani
1dd70a6f49 Applications: Change static constexpr variables to constexpr
Function-local `static constexpr` variables can be `constexpr`. This
can reduce memory consumption, binary size, and offer additional
compiler optimizations.
2022-02-28 13:54:27 +01:00
James Puleo
a0e7a4b9a8 WindowServer+Userland: Pass wallpapers as Gfx::Bitmap instead of path
The WindowServer _really_ does not need to know the filesystem path to
it's wallpaper, and allows setting arbitrary wallpapers (those outside
of `/res/wallpapers`).

The GUI::Desktop will keep track of the path to the wallpaper (if any),
and save it to config if desired (to be persisted).

This avoids the need to `unveil` paths to the wallpaper, fixing #11158
2022-02-14 16:38:42 +03:30
Aatos Majava
c23d25d1de FileManager: Add F6 alternate shortcut to "location" action
This mirrors the behaviour in Browser.
2022-02-12 09:06:23 -05:00
Timothy Flynn
55d28a738e Revert "FileManager: Display times in the user's local time zone"
This reverts commit 080b054695.
2022-01-28 15:13:35 +00:00
Timothy Flynn
080b054695 FileManager: Display times in the user's local time zone 2022-01-28 12:25:20 +00:00
electrikmilk
34c5d33eb0 Base+Userland: Add various icons
Add new icons to menus, add existing icons that could be used in menus.
2022-01-12 10:55:20 +01:00
Lucas CHOLLET
75d1840cfc FileManager: Show Dotfiles when passing a Dotfile as an argument
Before this patch, FileManager was failing to open the directory and
open `/` instead.
2022-01-05 15:20:54 -08:00
Lucas CHOLLET
693ae73606 FileManager: Use String const& instead of String
Change ErrorOr<int> run_in_windowed_mode(String, String)
to ErrorOr<int> run_in_windowed_mode(String const&, String const&)
2022-01-05 15:20:54 -08:00