mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:27:35 +00:00
Assistant: Add new URLProvider to open URL's in the browser
This commit is contained in:
parent
d12e14fa95
commit
d5dfc255ed
3 changed files with 45 additions and 0 deletions
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <AK/Queue.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/URL.h>
|
||||
#include <LibDesktop/AppFile.h>
|
||||
#include <LibGUI/Desktop.h>
|
||||
#include <LibJS/Interpreter.h>
|
||||
|
@ -84,6 +85,16 @@ public:
|
|||
void activate() const override;
|
||||
};
|
||||
|
||||
class URLResult : public Result {
|
||||
public:
|
||||
explicit URLResult(const URL& url)
|
||||
: Result(GUI::Icon::default_icon("app-browser").bitmap_for_size(16), url.to_string(), "'Enter' will open this URL in the browser"sv, 50)
|
||||
{
|
||||
}
|
||||
~URLResult() override = default;
|
||||
void activate() const override;
|
||||
};
|
||||
|
||||
class Provider {
|
||||
public:
|
||||
virtual ~Provider() = default;
|
||||
|
@ -113,4 +124,9 @@ private:
|
|||
Queue<String> m_work_queue;
|
||||
};
|
||||
|
||||
class URLProvider : public Provider {
|
||||
public:
|
||||
void query(String const& query, Function<void(Vector<NonnullRefPtr<Result>>)> on_complete) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue