mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 01:41:59 -05:00
2e36e12526
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". (cherry picked from commit 637ccbec3524727e22d07da5331f627165759791)
38 lines
852 B
C++
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 };
|
|
};
|
|
|
|
}
|