Commit graph

9119 commits

Author SHA1 Message Date
Andres Vieira
42f493ec9d FileManager: Add folder-specific paste action
This action is a bit different to the regular paste action because it
takes into account the folder in which the context menu was opened,
so it can be enabled/disabled whether that folder is writable or not for
the current user.

Both paste action use the same logic, now moved to the function
do_action(const GUI::Action&), but in the case of the folder being
right clicked, it pastes inside of it.
2020-04-28 10:00:12 +02:00
Andres Vieira
1f007181be FileManager: Disable paste action for non-writable directories 2020-04-28 10:00:12 +02:00
Andres Vieira
a1bcd9ca8a FileManager: Disables mkdir action if permissions don't allow it
Now the "New directory..." contextual menu is disabled if the current
user doesn't have enough permissions to create a node in the current
path.

This prevents the user going to the "New Directory" InputBox, writing
an appropriate name and accepting just to find they can't even do it :)
2020-04-28 10:00:12 +02:00
Brendan Coles
24b9e57b15 Screensaver: Draw screen before first timer iteration and seed srand() 2020-04-28 09:36:28 +02:00
Linus Groh
8f2300afb5 mkdir: Add -p option to create parent directories 2020-04-28 09:36:09 +02:00
Linus Groh
cd81aa41f0 AK: Add FileSystemPath::is_absolute() 2020-04-28 09:36:09 +02:00
Linus Groh
6fd7966d81 mkdir: Use ArgParser, support creating multiple directories 2020-04-28 09:36:09 +02:00
AnotherTest
8d419c1915 LibCore: Trim decompressed Gzip output to size
Prior to this commit, we would (re-)allocate the output buffer aligned
to 1024 bytes, but never trim it down to size, which caused
Gzip::decompress to return uninitialised data.
2020-04-28 09:32:33 +02:00
Brendan Coles
c4d3723087 Fire: Use LibC srand() 2020-04-28 09:30:01 +02:00
mattco98
23ec578a01 LibJS: Implement correct attributes for (almost) all properties
Added the ability to include a u8 attributes parameter with all of the
various put methods in the Object class. They can be omitted, in which
case it defaults to "Writable | Enumerable | Configurable", just like
before this commit.

All of the attribute values for each property were gathered from
SpiderMonkey in the Firefox console. Some properties (e.g. all of the
canvas element properties) have undefined property descriptors... not
quite sure what that means. Those were left as the default specified
above.
2020-04-28 09:29:50 +02:00
Devashish
c4d05049c4 Toolchain: Don't create repository for patches if not necessary
The toolchain builds just fine without the git repository (tested on
windows and linux). We can skip setting up the repo and apply the
patches directly when we aren't working on the toolchain itself. A
flag `--dev` has been added for cases when git repo is needed. Without
the flag, regular patch is applied. This significantly improves build
times for first time builds.
2020-04-27 17:59:33 +02:00
mattco98
80fecc615a LibJS: Add spreading in array literals
Implement the syntax and behavor necessary to support array literals
such as [...[1, 2, 3]]. A type error is thrown if the target of the
spread operator does not evaluate to an array (though it should
eventually just check for an iterable).

Note that the spread token's name is TripleDot, since the '...' token is
used for two features: spread and rest. Calling it anything involving
'spread' or 'rest' would be a bit confusing.
2020-04-27 11:32:18 +02:00
Brian Gianforcaro
49c438ce32 Kernel: Update TimerQueue next due timer only when necessary
Previously we blindly just called update_next_timer_due() when
ever we modified the timer list. Since we know the list is sorted
this is a bit wasteful, and we can do better.

This change refactors the code so we only update the next due time
when necessary. In places where it was possible the code was modified
to directly modify the next due time, instead of having to go to the
front of the list to fetch it.
2020-04-27 11:24:21 +02:00
Brian Gianforcaro
74f3263cea AK: Add SinglyLinkedListIterator::is_begin()
It's useful to be able to tell if we are at the beginning of
the list when using the list as a queue.
2020-04-27 11:24:21 +02:00
Kesse Jones
36c00e8078 LibJS: Add Array.prototype.findIndex 2020-04-27 11:23:23 +02:00
Andres Vieira
bf9926743a FileManager: Add paste action to DirectoryView's context menu 2020-04-27 11:21:24 +02:00
Andres Vieira
ef963dae7e FileManager: Paste inside folder if done through its context menu
Now FileManager will paste the clipboard contents inside a folder if the
paste action was clicked through a folder context menu, being the target
directory the selected folder.

This mimicks most of the behaviours that the different file managers
have.
2020-04-27 11:21:24 +02:00
Andres Vieira
91b70d34e7 FileManager: Copy and Delete selected file(s), not current folder
FileManager had this weird behaviour in which it would ignore the
current selection and try to copy and delete the current folder.
2020-04-27 11:21:24 +02:00
Brian Gianforcaro
eeb5318c25 Kernel: Expose timers via a TimerId type
The public consumers of the timer API shouldn't need to know
the how timer id's are tracked internally. Expose a typedef
instead to allow the internal implementation to be protected
from potential churn in the future.

It's also just good API design.
2020-04-27 11:14:41 +02:00
Stephan Unverwerth
13c122b8b2 Shell: use access() syscall to check if files are executable by user 2020-04-27 11:13:59 +02:00
Andreas Kling
9e365a6c1c AK: Make URL::to_string() produce a data URL for data URLs :^) 2020-04-26 22:59:12 +02:00
Andreas Kling
e3232eb25b LibWeb: Support loading data: URLs transparently via ResourceLoader
This is pretty darn cool! :^)
2020-04-26 22:57:00 +02:00
Andreas Kling
50c1eca9d4 AK: Add a simple and inefficient Base64 decoder 2020-04-26 22:57:00 +02:00
Andreas Kling
389eb1b693 AK: Teach URL how to parse data: URLs :^) 2020-04-26 22:56:58 +02:00
Andreas Kling
da04147cf6 LibWeb: Run clang-format on ResourceLoader.cpp 2020-04-26 22:08:03 +02:00
Brian Gianforcaro
60fc939e81 Tests: Add test case for pthread_cond_timedwait with a timeout.
Add a test case that the timeout argument to pthread_cond_timedwait
works in LibPthread. This change also validates the new support for
timeouts to the futex syscall, as that's how condition variables are
implemented.
2020-04-26 21:31:52 +02:00
Brian Gianforcaro
6116739b38 LibPthread: Hookup abstime argument to pthread_cond_timedwait
Now that the futex implementation actually supports timeouts,
we can fix the LibPthread implementation of pthread_cond_timedwait
to support the timeout argument.
2020-04-26 21:31:52 +02:00
Brian Gianforcaro
25a620a573 Kernel: Enable timeout support for sys$futex(FUTEX_WAIT)
Utilize the new Thread::wait_on timeout parameter to implement
timeout support for FUTEX_WAIT.

As we compute the relative time from the user specified absolute
time, we try to delay that computation as long as possible before
we call into Thread::wait_on(..). To enable this a small bit of
refactoring was done pull futex_queue fetching out and timeout fetch
and calculation separation.
2020-04-26 21:31:52 +02:00
Brian Gianforcaro
faf15e3721 Kernel: Add timeout support to Thread::wait_on
This change plumbs a new optional timeout option to wait_on.
The timeout is enabled by enqueing a timer on the timer queue
while we are waiting. We can then see if we were woken up or
timed out by checking if we are still on the wait queue or not.
2020-04-26 21:31:52 +02:00
Brian Gianforcaro
1d68837456 Kernel: Refactor TimeQueue::add_timer to use timeval
The current API of add_timer makes it hard to use as
you are forced to do a bunch of time arithmetic at the
caller. Ideally we would have overloads for common time
types like timespec or timeval to keep the API as straight
forward as possible. This change moves us in that direction.

While I'm here, we should really also use the machines actual
ticks per second, instead of the OPTIMAL_TICKS_PER_SECOND_RATE.
2020-04-26 21:31:52 +02:00
Brian Gianforcaro
1a80aa999a AK: Add timeval_to_timespec and timespec_to_timeval conversion methods
Add the ability to easily convert between timeval and timespec.
2020-04-26 21:31:52 +02:00
Hüseyin ASLITÜRK
089022e7f6 Applications: Add "thread" for HexEditor
HexEditor crashes during try OpenFile dialog.
2020-04-26 21:31:41 +02:00
Hüseyin ASLITÜRK
59f87d12d0 Base: 32x32 icons for cplusplus and header file types 2020-04-26 21:31:41 +02:00
Andres Vieira
88368df9a2 Base+Browser: Add an icon for the serenity Browser and make it use it
Browser was using the filetype-html icon instead of a dedicated one, so
we now have the globe from that icon reimagined and in good Buggie
company :^)
2020-04-26 21:13:57 +02:00
Linus Groh
14c7988eea LibJS: Implement Number.isInteger() 2020-04-26 20:36:59 +02:00
Linus Groh
7bd6b58b29 LibJS: Implement Number.isNaN()
Like the global isNaN() without the number coercion.
2020-04-26 20:36:59 +02:00
Linus Groh
c350f5ae67 LibJS: Implement Number.isFinite()
Like the global isFinite() without the number coercion.
2020-04-26 20:36:59 +02:00
LepkoQQ
b094c064d8 Base: Add test page for decoding different basic png formats. 2020-04-26 20:29:17 +02:00
LepkoQQ
e5a598414f LibGfx: PNGLoader support for grayscale images with alpha. 2020-04-26 20:29:17 +02:00
LepkoQQ
d009df074f LibGfx: PNGLoader support for grayscale images with 8/16bpp. 2020-04-26 20:29:17 +02:00
Andreas Kling
2778d077e5 LibJS: Grow storage when adding a property to uniquely-shaped Object
Normally the storage would be expanded by set_shape() upon transition
to a new shape, but if the shape is already unique, there is no new
transition so we have to expand the storage manually.
2020-04-26 19:05:08 +02:00
Hüseyin ASLITÜRK
c9c1d1fae0 LibGUI: Create thumnail for gif files 2020-04-26 18:44:20 +02:00
Hüseyin ASLITÜRK
e7b9e03285 LibCore: Open gif files with QuickShow 2020-04-26 18:44:20 +02:00
Hüseyin ASLITÜRK
679702045d QuickShow: Add gif files to navigation file list 2020-04-26 18:44:20 +02:00
LepkoQQ
35dda6222e Base: Improve cursor arrow to feel more symetrical 2020-04-26 18:17:46 +02:00
Linus Groh
9540174b40 js: Follow Serenity C++ naming conventions 2020-04-26 18:09:22 +02:00
Andreas Kling
37918d4141 Revert "LibGUI: Use bold font for the currently active TabWidget tab"
This reverts commit 4d8206f7c2.

This was not visually pleasant. We'll have to come up with some better
way to distinguish the active tab in Browser.
2020-04-26 17:46:16 +02:00
Andreas Kling
fb826aa59a Kernel: Make sys$sethostname() superuser-only
Also take the hostname string lock exclusively.
2020-04-26 15:51:57 +02:00
Andreas Kling
f897c41092 LibJS: Implement basic support for the "delete" operator
It turns out "delete" is actually a unary op :)
This patch implements deletion of object properties, it doesn't yet
work for casually deleting properties from the global object.

When deleting a property from an object, we switch that object to
having a unique shape, no longer sharing shapes with others.
Once an object has a unique shape, it no longer needs to care about
shape transitions.
2020-04-26 15:51:07 +02:00
Andres Vieira
1617be1e6f FileManager: Disable open_parent_directory_action if the new path is "/" 2020-04-26 15:26:01 +02:00