ladybird/Ladybird/Qt/LocationEdit.h
Hugh Davenport 637ccbec35 UI/Qt: Show search engine name in location bar
The placeholder text shows "Search or enter web address" which doesn't
tell the user about *how* the search will be performed. Other popular
open source browsers show the search engine that will be used. For
example:

	Chromium: "Search **engine** or type a URL"
	Firefox: "Search with **engine** or enter address"

This change changes the placeholder text of the location bar to show
"Search with **engine** or enter web address".
2024-06-25 09:56:42 +01:00

38 lines
852 B
C++

/*
* Copyright (c) 2023, Cameron Youell <cameronyouell@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "AutoComplete.h"
#include <AK/OwnPtr.h>
#include <QLineEdit>
namespace Ladybird {
class LocationEdit final : public QLineEdit {
Q_OBJECT
public:
explicit LocationEdit(QWidget*);
URL::URL url() const { return m_url; }
void set_url(URL::URL const&);
bool url_is_hidden() const { return m_url_is_hidden; }
void set_url_is_hidden(bool url_is_hidden) { m_url_is_hidden = url_is_hidden; }
private:
virtual void focusInEvent(QFocusEvent* event) override;
virtual void focusOutEvent(QFocusEvent* event) override;
void update_placeholder();
void highlight_location();
AK::OwnPtr<AutoComplete> m_autocomplete;
URL::URL m_url;
bool m_url_is_hidden { false };
};
}