mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:37:44 +00:00
Everywhere: Add sv suffix to strings relying on StringView(char const*)
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
This commit is contained in:
parent
e5f09ea170
commit
3f3f45580a
762 changed files with 8315 additions and 8316 deletions
|
@ -44,7 +44,7 @@ MailWidget::MailWidget()
|
|||
GUI::MessageBox::show(
|
||||
window(),
|
||||
String::formatted("The link to '{}' could not be opened.", url),
|
||||
"Failed to open link",
|
||||
"Failed to open link"sv,
|
||||
GUI::MessageBox::Type::Error);
|
||||
}
|
||||
};
|
||||
|
@ -98,28 +98,28 @@ MailWidget::MailWidget()
|
|||
|
||||
bool MailWidget::connect_and_login()
|
||||
{
|
||||
auto server = Config::read_string("Mail", "Connection", "Server", {});
|
||||
auto server = Config::read_string("Mail"sv, "Connection"sv, "Server"sv, {});
|
||||
|
||||
if (server.is_empty()) {
|
||||
auto result = GUI::MessageBox::show(window(), "Mail has no servers configured. Do you want configure them now?", "Error", GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::YesNo);
|
||||
auto result = GUI::MessageBox::show(window(), "Mail has no servers configured. Do you want configure them now?"sv, "Error"sv, GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::YesNo);
|
||||
if (result == GUI::MessageBox::ExecResult::Yes)
|
||||
Desktop::Launcher::open(URL::create_with_file_protocol("/bin/MailSettings"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Assume TLS by default, which is on port 993.
|
||||
auto port = Config::read_i32("Mail", "Connection", "Port", 993);
|
||||
auto tls = Config::read_bool("Mail", "Connection", "TLS", true);
|
||||
auto port = Config::read_i32("Mail"sv, "Connection"sv, "Port"sv, 993);
|
||||
auto tls = Config::read_bool("Mail"sv, "Connection"sv, "TLS"sv, true);
|
||||
|
||||
auto username = Config::read_string("Mail", "User", "Username", {});
|
||||
auto username = Config::read_string("Mail"sv, "User"sv, "Username"sv, {});
|
||||
if (username.is_empty()) {
|
||||
GUI::MessageBox::show_error(window(), "Mail has no username configured. Refer to the Mail(1) man page for more information.");
|
||||
GUI::MessageBox::show_error(window(), "Mail has no username configured. Refer to the Mail(1) man page for more information."sv);
|
||||
return false;
|
||||
}
|
||||
|
||||
auto password = Config::read_string("Mail", "User", "Password", {});
|
||||
auto password = Config::read_string("Mail"sv, "User"sv, "Password"sv, {});
|
||||
while (password.is_empty()) {
|
||||
if (GUI::PasswordInputDialog::show(window(), password, "Login", server, username) != GUI::Dialog::ExecResult::OK)
|
||||
if (GUI::PasswordInputDialog::show(window(), password, "Login"sv, server, username) != GUI::Dialog::ExecResult::OK)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ bool MailWidget::connect_and_login()
|
|||
return false;
|
||||
}
|
||||
|
||||
response = m_imap_client->list("", "*")->await().release_value();
|
||||
response = m_imap_client->list(""sv, "*"sv)->await().release_value();
|
||||
|
||||
if (response.status() != IMAP::ResponseStatus::OK) {
|
||||
dbgln("Failed to retrieve mailboxes. The server says: '{}'", response.response_text());
|
||||
|
@ -171,7 +171,7 @@ void MailWidget::on_window_close()
|
|||
|
||||
IMAP::MultiPartBodyStructureData const* MailWidget::look_for_alternative_body_structure(IMAP::MultiPartBodyStructureData const& current_body_structure, Vector<u32>& position_stack) const
|
||||
{
|
||||
if (current_body_structure.media_type.equals_ignoring_case("ALTERNATIVE"))
|
||||
if (current_body_structure.media_type.equals_ignoring_case("ALTERNATIVE"sv))
|
||||
return ¤t_body_structure;
|
||||
|
||||
u32 structure_index = 1;
|
||||
|
@ -227,7 +227,7 @@ Vector<MailWidget::Alternative> MailWidget::get_alternatives(IMAP::MultiPartBody
|
|||
|
||||
bool MailWidget::is_supported_alternative(Alternative const& alternative) const
|
||||
{
|
||||
return alternative.body_structure.type.equals_ignoring_case("text") && (alternative.body_structure.subtype.equals_ignoring_case("plain") || alternative.body_structure.subtype.equals_ignoring_case("html"));
|
||||
return alternative.body_structure.type.equals_ignoring_case("text"sv) && (alternative.body_structure.subtype.equals_ignoring_case("plain"sv) || alternative.body_structure.subtype.equals_ignoring_case("html"sv));
|
||||
}
|
||||
|
||||
void MailWidget::selected_mailbox()
|
||||
|
@ -351,7 +351,7 @@ void MailWidget::selected_mailbox()
|
|||
};
|
||||
|
||||
auto& subject_iterator_value = subject_iterator->get<1>().value();
|
||||
auto subject_index = subject_iterator_value.find("Subject:");
|
||||
auto subject_index = subject_iterator_value.find("Subject:"sv);
|
||||
String subject;
|
||||
if (subject_index.has_value()) {
|
||||
auto potential_subject = subject_iterator_value.substring(subject_index.value());
|
||||
|
@ -363,7 +363,7 @@ void MailWidget::selected_mailbox()
|
|||
subject = "(no subject)";
|
||||
|
||||
auto& from_iterator_value = from_iterator->get<1>().value();
|
||||
auto from_index = from_iterator_value.find("From:");
|
||||
auto from_index = from_iterator_value.find("From:"sv);
|
||||
VERIFY(from_index.has_value());
|
||||
auto potential_from = from_iterator_value.substring(from_index.value());
|
||||
auto from_parts = potential_from.split_limit(':', 2);
|
||||
|
@ -419,7 +419,7 @@ void MailWidget::selected_email_to_load()
|
|||
auto alternatives = get_alternatives(data);
|
||||
if (alternatives.is_empty()) {
|
||||
dbgln("No alternatives. The server said: '{}'", fetch_response.response_text());
|
||||
GUI::MessageBox::show_error(window(), "The server sent no message to display.");
|
||||
GUI::MessageBox::show_error(window(), "The server sent no message to display."sv);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -430,7 +430,7 @@ void MailWidget::selected_email_to_load()
|
|||
});
|
||||
|
||||
if (!chosen_alternative.has_value()) {
|
||||
GUI::MessageBox::show(window(), "Displaying this type of e-mail is currently unsupported.", "Unsupported", GUI::MessageBox::Type::Information);
|
||||
GUI::MessageBox::show(window(), "Displaying this type of e-mail is currently unsupported."sv, "Unsupported"sv, GUI::MessageBox::Type::Information);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -469,14 +469,14 @@ void MailWidget::selected_email_to_load()
|
|||
|
||||
if (fetch_data.is_empty()) {
|
||||
dbgln("The server sent no fetch data.");
|
||||
GUI::MessageBox::show_error(window(), "The server sent no data.");
|
||||
GUI::MessageBox::show_error(window(), "The server sent no data."sv);
|
||||
return;
|
||||
}
|
||||
|
||||
auto& fetch_response_data = fetch_data.last().get<IMAP::FetchResponseData>();
|
||||
|
||||
if (!fetch_response_data.contains_response_type(IMAP::FetchResponseType::Body)) {
|
||||
GUI::MessageBox::show_error(window(), "The server sent no body.");
|
||||
GUI::MessageBox::show_error(window(), "The server sent no body."sv);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -493,21 +493,21 @@ void MailWidget::selected_email_to_load()
|
|||
|
||||
// FIXME: String uses char internally, so 8bit shouldn't be stored in it.
|
||||
// However, it works for now.
|
||||
if (selected_alternative_encoding.equals_ignoring_case("7bit") || selected_alternative_encoding.equals_ignoring_case("8bit")) {
|
||||
if (selected_alternative_encoding.equals_ignoring_case("7bit"sv) || selected_alternative_encoding.equals_ignoring_case("8bit"sv)) {
|
||||
decoded_data = encoded_data;
|
||||
} else if (selected_alternative_encoding.equals_ignoring_case("base64")) {
|
||||
} else if (selected_alternative_encoding.equals_ignoring_case("base64"sv)) {
|
||||
auto decoded_base64 = decode_base64(encoded_data);
|
||||
if (!decoded_base64.is_error())
|
||||
decoded_data = decoded_base64.release_value();
|
||||
} else if (selected_alternative_encoding.equals_ignoring_case("quoted-printable")) {
|
||||
} else if (selected_alternative_encoding.equals_ignoring_case("quoted-printable"sv)) {
|
||||
decoded_data = IMAP::decode_quoted_printable(encoded_data);
|
||||
} else {
|
||||
dbgln("Mail: Unimplemented decoder for encoding: {}", selected_alternative_encoding);
|
||||
GUI::MessageBox::show(window(), String::formatted("The e-mail encoding '{}' is currently unsupported.", selected_alternative_encoding), "Unsupported", GUI::MessageBox::Type::Information);
|
||||
GUI::MessageBox::show(window(), String::formatted("The e-mail encoding '{}' is currently unsupported.", selected_alternative_encoding), "Unsupported"sv, GUI::MessageBox::Type::Information);
|
||||
return;
|
||||
}
|
||||
|
||||
// FIXME: I'm not sure what the URL should be. Just use the default URL "about:blank".
|
||||
// FIXME: It would be nice if we could pass over the charset.
|
||||
m_web_view->load_html(decoded_data, "about:blank");
|
||||
m_web_view->load_html(decoded_data, "about:blank"sv);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue