Commit Graph

125 Commits

Author SHA1 Message Date
Andreas Kling
4a2b718ba2 LibCore: Use ErrorOr<T> for Core::File::copy_file() 2021-11-08 00:35:27 +01:00
Andreas Kling
235f39e449 LibGfx: Use ErrorOr<T> for Bitmap::try_load_from_file()
This was used in a lot of places, so this patch makes liberal use of
ErrorOr<T>::release_value_but_fixme_should_propagate_errors().
2021-11-08 00:35:27 +01:00
FrHun
8249ea792e LibGUI+FileManager: Clarify Widget margins name
Even though they are called content_margins,
they are actually only ever used to determine where
a Widget is supposed to be grabbable.
So all methods and members are renamed accordingly.
2021-11-03 16:13:19 +01:00
Mustafa Quraish
fdfc0d1bac FileManager: Listen for changes to Desktop wallpaper in config
Since there's no global API for being able to just assign a callback
function to config changes, I've made an inline struct in desktop
mode with the sole purpose of checking to see if the Wallpaper
entry has changed, and then updates GUI::Desktop.

It's pretty neat seeing the wallpaper change as soon as you edit the
config file :^)
2021-10-10 01:15:34 -07:00
Tetsui Ohkubo
eb326db028 FileOperation: Deduplicate destination file names on copy
When there is a file with the same name in the destination directory,
FileManager overwrites that file without any warning. With this change,
such a file will be automatically renamed to "emoji-2.txt", for example.

Also, currently there is a check in FileManager that makes copy and
paste of a file in the same directory no-op. This change removes that
check, because it is no longer a problem.
2021-09-13 18:08:34 +04:30
Sam Atkins
e2c32a6c65 Everywhere: Use my shiny new serenityos.org email :^) 2021-09-03 12:22:36 +02:00
Musab Kılıç
432839c2e9 FileManager: Kindly ask the user if they want to delete a file 2021-09-02 23:52:29 +02:00
Andreas Kling
a5992a4ef8 FileManager: Tweak layout spacing in file properties window
There wasn't enough vertical spacing between the TabWidget and the three
(Ok/Cancel/Apply) buttons at the bottom.
2021-08-31 02:43:50 +02:00
Andreas Kling
6cb536daa8 FileManager: Hide the Inode and Symlink Target columns in TableView
These are not generally interesting, so let's hide them by default.
The user can re-enable them if they want.
2021-08-31 01:35:09 +02:00
Andreas Kling
887ab3cc9a LibGUI: Rename FileSystemModel's "Owner" column to "User"
A file is owned by a User+Group, not an Owner+Group.
2021-08-31 01:35:08 +02:00
Karol Kosek
1700b6d113 FileManager: Remove tree_view_directory_context_menu
It isn't used anywhere and the tree view shows only directories
(and that is covered by the tree_view_directory_context_menu).
2021-08-31 00:46:43 +02:00
Karol Kosek
7d6308523a FileManager: Add 'Open in Terminal' action for selected dirs on desktop
This is to be more similar to the context menu from the windowed
instance of File Manager.
2021-08-31 00:46:43 +02:00
Karol Kosek
dd75ed0c5e FileManager: Add default 'Open' action in context menu for directories
This makes the directory context menu more similar to the file context
menu.
2021-08-31 00:46:43 +02:00
Karol Kosek
7cf5904124 FileManager: Place mkdir and touch actions below openings in tree view
This way, the Properties action will always be everywhere on bottom.
2021-08-31 00:46:43 +02:00
Karol Kosek
d184e5327a FileManager: Put file launch actions first
The default action (shown in bold) indicates what would you get
by double-clicking on file.  Since it's a default option, I think it
deserves to be on top (together with alternative launch options). :^)

Also they're not task actions like "Extract .zip here" or "Add to
bookmarks".
2021-08-31 00:46:43 +02:00
Andreas Kling
7b62113db7 FileManager: Report errors from chdir(), if any 2021-08-26 23:41:38 +02:00
Andreas Kling
696dbc889f FileManager: Make DirectoryView listen for configuration changes
DirectoryView now inherits from Config::Listener and will update its
view mode immediately if changed from elsewhere.

This is pretty neat. :^)
2021-08-26 23:41:38 +02:00
Andreas Kling
c8c58626e9 FileManager: Move "View as ViewType" actions into DirectoryView
Let DirectoryView manage these actions itself. This matches what we
already do for a bunch of other actions, and prepares for the next
patch which will add Config::Listener to the mix.
2021-08-26 23:41:38 +02:00
TheFightingCatfish
d2af27d2d0 FileManager: Change the cwd when opening a directory
The `open()` function of DirectoryView should change the current working
directory, so that the "Go to Location" menu item can process relative
paths correctly. Update other functions in DirectoryView to use `open()`
when opening a directory.
2021-08-26 22:02:15 +02:00
TheFightingCatfish
ce66c40160 FileManager: Remove "on activation" debug spam 2021-08-26 22:02:15 +02:00
Andy Jansson
bb399c6955 FileManager: Change read_i32 call to read_bool
The FileManager/Window/Maximized flag was incorrectly read from the
ConfigServer using read_i32 instead of the intended read_bool function
call.

It is now being read with the correct type :^)
2021-08-26 12:05:51 +02:00
Andreas Kling
1a0a35f4b8 FileManager: Use Config::pledge_domains() 2021-08-26 00:54:28 +02:00
Andreas Kling
39d9373bca FileManager: Use LibConfig instead of Core::ConfigFile :^) 2021-08-26 00:54:27 +02:00
networkException
acde7d12b0 Everywhere: Rename get in ConfigFile::get_for_{lib,app,system} to open
This patch brings the ConfigFile helpers for opening lib, app and system
configs more inline with the regular ConfigFile::open functions.
2021-08-22 01:32:25 +02:00
networkException
938051feb8 Everywhere: Use Core::ConfigFile::AllowWriting::Yes to allow writing 2021-08-22 01:32:25 +02:00
Andreas Kling
7d904eed12 FileManager: Reorder main toolbar actions a little bit
Put the "Open in terminal" action next to the other navigation actions.
And separate the "New File" and "New Directory" actions from the actions
that operate on existing items.
2021-08-18 13:00:20 +02:00
sin-ack
e11d177618 Userland+LibGUI: Add shorthand versions of the Margins constructor
This allows for typing [8] instead of [8, 8, 8, 8] to specify the same
margin on all edges, for example. The constructors follow CSS' style of
specifying margins. The added constructors are:

- Margins(int all): Sets the same margin on all edges.
- Margins(int vertical, int horizontal): Sets the first argument to top
  and bottom margins, and the second argument to left and right margins.
- Margins(int top, int vertical, int bottom): Sets the first argument to
  the top margin, the second argument to the left and right margins,
  and the third argument to the bottom margin.
2021-08-18 10:30:50 +02:00
sin-ack
9c9a5c55cb Userland+LibGUI: Make Margins arguments match CSS ordering
Previously the argument order for Margins was (left, top, right,
bottom). To make it more familiar and closer to how CSS does it, the
argument order is now (top, right, bottom, left).
2021-08-18 10:30:50 +02:00
sin-ack
ca2c81251a Everywhere: Replace Model::update() with Model::invalidate()
Most of the models were just calling did_update anyway, which is
pointless since it can be unified to the base Model class. Instead, code
calling update() will now call invalidate(), which functions identically
and is more obvious in what it does.

Additionally, a default implementation is provided, which removes the
need to add empty implementations of update() for each model subclass.

Co-Authored-By: Ali Mohammad Pur <ali.mpfard@gmail.com>
2021-08-06 19:14:31 +02:00
Karol Kosek
4988540cb1 FileManager: Use the current directory as one of the initial locations
This change makes `cd /bin; FileManager` open the app in /bin.
2021-08-03 09:12:33 +02:00
Karol Kosek
35cc5b9873 FileManager: Set chdir to the current path when opening applications 2021-08-03 09:12:33 +02:00
LuK1337
a91848c148 FileManager: Refresh DirectoryView after applying changes
Fixes: #9136
2021-08-01 12:30:24 +02:00
Karol Kosek
92fd86901d FileManager: Enable/Disable mkdir and touch actions on path change
This change disables the icons in read-only directories.
2021-08-01 12:12:59 +02:00
Karol Kosek
755fe2b0ca FileManager: Remove the rename action from the tree view context menu
The action never worked properly here.  It used the selection
from the directory view, instead of the tree view.
Furthermore, the tree view isn't even editable.

Just making tree view editable wouldn't fix it -- it'd probably
need something like creating an on_stop_editing() function
in the AbstractView to change the path after the rename.

For now, I'll remove the action from the menu as a "temporary fix".
2021-08-01 12:12:59 +02:00
Karol Kosek
c1dc9e6de2 FileManager: Add the rename action to the toolbar
When I was adding the action in #8713, the action did not have an icon
yet.  Now, since it has an icon now, we can add it to the toolbar!
2021-08-01 12:12:59 +02:00
Brian Gianforcaro
a51e6547aa Applications: Remove unused header includes 2021-08-01 08:10:16 +02:00
FrHun
0dd4e2d21b FileManager: Fix properties button margins 2021-07-27 22:17:23 +02:00
Andreas Kling
49b9683381 FileManager: Make "show dotfiles" affect the tree view as well
Previously this only affected the main directory view.
2021-07-27 18:27:49 +02:00
Karol Kosek
a1d0ad61a6 FileManager: Show an open icon for selected folder in tree view again
The original work was done in #2752
(deceb91c48 to be precise),
but unfortunately 2c772d1848 replaced
on_selection with on_selection_change, which caused the function
to never be executed, as it was reassigned a few lines below.
2021-07-24 21:13:22 +02:00
Sam Atkins
9ac757647f FileManager: Switch FileOperationProgressWidget::did_error() to SV& 2021-07-22 12:48:44 +02:00
Sam Atkins
469bca9d3a FileManager: Show progress dialog for file deletions
Progress dialogs are nice! :^)

Showing a proper file-deletion animation would be nice, but that is
outside the scope of my abilities.
2021-07-22 12:48:44 +02:00
Sam Atkins
dd833dc220 FileManager: Rename FileOperation::Cut to FileOperation::Move 2021-07-22 12:48:44 +02:00
Sam Atkins
5090b1bdba FileManager: Set file op progress window's text based on the operation 2021-07-22 12:48:44 +02:00
Sam Atkins
0a62d517fd FileManager+FileOperation: Implement (and use) 'Move' command
`FileOperation Move ...` is now used for cut-and-paste in the
FileManager.
2021-07-22 12:48:44 +02:00
Sam Atkins
516764ef17 FileManager: Show progress dialog for pasted files
For now, this is a slight step backwards, as Cut does not remove the
source files. This will be rectified next.
2021-07-22 12:48:44 +02:00
Sam Atkins
d8fb8b9583 FileManager: Move mass-copy code from DirectoryView to FileUtils
This is preparation for calling it from FileManager/main.cpp

Also made file_operation_windows take NonnullRefPtrs.
2021-07-22 12:48:44 +02:00
Sam Atkins
9060310840 FileManager: Combine drag&drop file copies into one progress window
This fixes #6902.

Previously, dragging and dropping multiple files would create a window
for each file or directory that was selected. Now, we combine them and
show one progress window for the whole batch. :^)
2021-07-22 12:48:44 +02:00
Sam Atkins
ca039e6ba1 FileManager+FileOperation: Switch to east const
(And some adjustments based on MaxWipfli's feedback)
2021-07-22 12:48:44 +02:00
Andreas Kling
687a12d7fb Userland: Add GUI::Window::add_menu() and use it everywhere
Applications previously had to create a GUI::Menubar object, add menus
to it, and then call GUI::Window::set_menubar().

This patch introduces GUI::Window::add_menu() which creates the menubar
automatically and adds items to it. Application code becomes slightly
simpler as a result. :^)
2021-07-21 21:24:26 +02:00
Andreas Kling
c7d891765c LibGfx: Use "try_" prefix for static factory functions
Also mark them as [[nodiscard]].
2021-07-21 18:02:15 +02:00