1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 10:27:35 +00:00

Browser: Have the bookmark button use the editor dialog

Now when the bookmark button that has not yet bookmarked the current
URL is pressed, it will add the bookmark but also prompt the user
with the BookmarkEditor dialog in case they wish to make final
touches to their bookmark title or URL. If they cancel or escape
the dialog, the bookmark will be removed.
This commit is contained in:
Kemal Zebari 2023-02-24 01:10:57 -08:00 committed by Sam Atkins
parent 5ec727deb4
commit 3918a8492b
3 changed files with 55 additions and 20 deletions

View file

@ -34,11 +34,18 @@ public:
Function<void(DeprecatedString const& url, Open)> on_bookmark_click;
Function<void(DeprecatedString const&, DeprecatedString const&)> on_bookmark_hover;
Function<void(DeprecatedString const& url)> on_bookmark_add;
bool contains_bookmark(DeprecatedString const& url);
bool remove_bookmark(DeprecatedString const& url);
bool add_bookmark(DeprecatedString const& url, DeprecatedString const& title);
bool edit_bookmark(DeprecatedString const& url);
enum class PerformEditOn {
NewBookmark,
ExistingBookmark
};
bool edit_bookmark(DeprecatedString const& url, PerformEditOn perform_edit_on = PerformEditOn::ExistingBookmark);
virtual Optional<GUI::UISize> calculated_min_size() const override
{
@ -57,6 +64,8 @@ private:
void update_content_size();
bool update_model(Vector<JsonValue>& values, Function<bool(GUI::JsonArrayModel& model, Vector<JsonValue>&& values)> perform_model_change);
RefPtr<GUI::Model> m_model;
RefPtr<GUI::Button> m_additional;
RefPtr<GUI::Widget> m_separator;