mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 11:07:46 +00:00
Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte string. As the null state has already been removed, there are no other particularly hairy blockers in repurposing this type as a byte string (what it _really_ is). This commit is auto-generated: $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \ Meta Ports Ladybird Tests Kernel) $ perl -pie 's/\bDeprecatedString\b/ByteString/g; s/deprecated_string/byte_string/g' $xs $ clang-format --style=file -i \ $(git diff --name-only | grep \.cpp\|\.h) $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
parent
38d62563b3
commit
5e1499d104
1615 changed files with 10257 additions and 10257 deletions
|
@ -12,7 +12,7 @@ AccountHolder::AccountHolder()
|
|||
m_mailbox_tree_model = MailboxTreeModel::create(*this);
|
||||
}
|
||||
|
||||
void AccountHolder::add_account_with_name_and_mailboxes(DeprecatedString name, Vector<IMAP::ListItem> const& mailboxes)
|
||||
void AccountHolder::add_account_with_name_and_mailboxes(ByteString name, Vector<IMAP::ListItem> const& mailboxes)
|
||||
{
|
||||
auto account = AccountNode::create(move(name));
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "MailboxTreeModel.h"
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <LibIMAP/Objects.h>
|
||||
|
||||
|
@ -21,7 +21,7 @@ class MailboxNode;
|
|||
|
||||
class AccountNode final : public BaseNode {
|
||||
public:
|
||||
static NonnullRefPtr<AccountNode> create(DeprecatedString name)
|
||||
static NonnullRefPtr<AccountNode> create(ByteString name)
|
||||
{
|
||||
return adopt_ref(*new AccountNode(move(name)));
|
||||
}
|
||||
|
@ -34,21 +34,21 @@ public:
|
|||
}
|
||||
|
||||
Vector<NonnullRefPtr<MailboxNode>> const& mailboxes() const { return m_mailboxes; }
|
||||
DeprecatedString const& name() const { return m_name; }
|
||||
ByteString const& name() const { return m_name; }
|
||||
|
||||
private:
|
||||
explicit AccountNode(DeprecatedString name)
|
||||
explicit AccountNode(ByteString name)
|
||||
: m_name(move(name))
|
||||
{
|
||||
}
|
||||
|
||||
DeprecatedString m_name;
|
||||
ByteString m_name;
|
||||
Vector<NonnullRefPtr<MailboxNode>> m_mailboxes;
|
||||
};
|
||||
|
||||
class MailboxNode final : public BaseNode {
|
||||
public:
|
||||
static NonnullRefPtr<MailboxNode> create(AccountNode const& associated_account, IMAP::ListItem const& mailbox, DeprecatedString display_name)
|
||||
static NonnullRefPtr<MailboxNode> create(AccountNode const& associated_account, IMAP::ListItem const& mailbox, ByteString display_name)
|
||||
{
|
||||
return adopt_ref(*new MailboxNode(associated_account, mailbox, move(display_name)));
|
||||
}
|
||||
|
@ -56,8 +56,8 @@ public:
|
|||
virtual ~MailboxNode() override = default;
|
||||
|
||||
AccountNode const& associated_account() const { return m_associated_account; }
|
||||
DeprecatedString const& select_name() const { return m_mailbox.name; }
|
||||
DeprecatedString const& display_name() const { return m_display_name; }
|
||||
ByteString const& select_name() const { return m_mailbox.name; }
|
||||
ByteString const& display_name() const { return m_display_name; }
|
||||
IMAP::ListItem const& mailbox() const { return m_mailbox; }
|
||||
|
||||
bool has_parent() const { return m_parent; }
|
||||
|
@ -69,7 +69,7 @@ public:
|
|||
void add_child(NonnullRefPtr<MailboxNode> child) { m_children.append(child); }
|
||||
|
||||
private:
|
||||
MailboxNode(AccountNode const& associated_account, IMAP::ListItem const& mailbox, DeprecatedString display_name)
|
||||
MailboxNode(AccountNode const& associated_account, IMAP::ListItem const& mailbox, ByteString display_name)
|
||||
: m_associated_account(associated_account)
|
||||
, m_mailbox(mailbox)
|
||||
, m_display_name(move(display_name))
|
||||
|
@ -78,7 +78,7 @@ private:
|
|||
|
||||
AccountNode const& m_associated_account;
|
||||
IMAP::ListItem m_mailbox;
|
||||
DeprecatedString m_display_name;
|
||||
ByteString m_display_name;
|
||||
|
||||
Vector<NonnullRefPtr<MailboxNode>> m_children;
|
||||
RefPtr<MailboxNode> m_parent;
|
||||
|
@ -93,7 +93,7 @@ public:
|
|||
return adopt_own(*new AccountHolder());
|
||||
}
|
||||
|
||||
void add_account_with_name_and_mailboxes(DeprecatedString, Vector<IMAP::ListItem> const&);
|
||||
void add_account_with_name_and_mailboxes(ByteString, Vector<IMAP::ListItem> const&);
|
||||
|
||||
Vector<NonnullRefPtr<AccountNode>> const& accounts() const { return m_accounts; }
|
||||
MailboxTreeModel& mailbox_tree_model() { return *m_mailbox_tree_model; }
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
|
||||
struct InboxEntry {
|
||||
u32 sequence_number;
|
||||
DeprecatedString date;
|
||||
DeprecatedString from;
|
||||
DeprecatedString subject;
|
||||
ByteString date;
|
||||
ByteString from;
|
||||
ByteString subject;
|
||||
bool seen;
|
||||
};
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ MailWidget::MailWidget()
|
|||
if (!Desktop::Launcher::open(url)) {
|
||||
GUI::MessageBox::show(
|
||||
window(),
|
||||
DeprecatedString::formatted("The link to '{}' could not be opened.", url),
|
||||
ByteString::formatted("The link to '{}' could not be opened.", url),
|
||||
"Failed to open link"sv,
|
||||
GUI::MessageBox::Type::Error);
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ MailWidget::MailWidget()
|
|||
|
||||
m_web_view->on_link_hover = [this](auto& url) {
|
||||
if (url.is_valid())
|
||||
m_statusbar->set_text(String::from_deprecated_string(url.to_deprecated_string()).release_value_but_fixme_should_propagate_errors());
|
||||
m_statusbar->set_text(String::from_byte_string(url.to_byte_string()).release_value_but_fixme_should_propagate_errors());
|
||||
else
|
||||
m_statusbar->set_text({});
|
||||
};
|
||||
|
@ -72,7 +72,7 @@ MailWidget::MailWidget()
|
|||
m_link_context_menu_default_action = link_default_action;
|
||||
m_link_context_menu->add_separator();
|
||||
m_link_context_menu->add_action(GUI::Action::create("&Copy URL", [this](auto&) {
|
||||
GUI::Clipboard::the().set_plain_text(m_link_context_menu_url.to_deprecated_string());
|
||||
GUI::Clipboard::the().set_plain_text(m_link_context_menu_url.to_byte_string());
|
||||
}));
|
||||
|
||||
m_web_view->on_link_context_menu_request = [this](auto& url, auto screen_position) {
|
||||
|
@ -86,7 +86,7 @@ MailWidget::MailWidget()
|
|||
GUI::Clipboard::the().set_bitmap(*m_image_context_menu_bitmap.bitmap());
|
||||
}));
|
||||
m_image_context_menu->add_action(GUI::Action::create("Copy Image &URL", [this](auto&) {
|
||||
GUI::Clipboard::the().set_plain_text(m_image_context_menu_url.to_deprecated_string());
|
||||
GUI::Clipboard::the().set_plain_text(m_image_context_menu_url.to_byte_string());
|
||||
}));
|
||||
m_image_context_menu->add_separator();
|
||||
m_image_context_menu->add_action(GUI::Action::create("&Open Image in Browser", [this](auto&) {
|
||||
|
@ -131,7 +131,7 @@ ErrorOr<bool> MailWidget::connect_and_login()
|
|||
m_statusbar->set_text(String::formatted("Connecting to {}:{}...", server, port).release_value_but_fixme_should_propagate_errors());
|
||||
auto maybe_imap_client = tls ? IMAP::Client::connect_tls(server, port) : IMAP::Client::connect_plaintext(server, port);
|
||||
if (maybe_imap_client.is_error()) {
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to connect to '{}:{}' over {}: {}", server, port, tls ? "TLS" : "Plaintext", maybe_imap_client.error()));
|
||||
GUI::MessageBox::show_error(window(), ByteString::formatted("Failed to connect to '{}:{}' over {}: {}", server, port, tls ? "TLS" : "Plaintext", maybe_imap_client.error()));
|
||||
return false;
|
||||
}
|
||||
m_imap_client = maybe_imap_client.release_value();
|
||||
|
@ -144,7 +144,7 @@ ErrorOr<bool> MailWidget::connect_and_login()
|
|||
|
||||
if (response.status() != IMAP::ResponseStatus::OK) {
|
||||
dbgln("Failed to login. The server says: '{}'", response.response_text());
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to login. The server says: '{}'", response.response_text()));
|
||||
GUI::MessageBox::show_error(window(), ByteString::formatted("Failed to login. The server says: '{}'", response.response_text()));
|
||||
m_statusbar->set_text("Failed to log in"_string);
|
||||
return false;
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ ErrorOr<bool> MailWidget::connect_and_login()
|
|||
|
||||
if (response.status() != IMAP::ResponseStatus::OK) {
|
||||
dbgln("Failed to retrieve mailboxes. The server says: '{}'", response.response_text());
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to retrieve mailboxes. The server says: '{}'", response.response_text()));
|
||||
GUI::MessageBox::show_error(window(), ByteString::formatted("Failed to retrieve mailboxes. The server says: '{}'", response.response_text()));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,7 @@ void MailWidget::selected_mailbox(GUI::ModelIndex const& index)
|
|||
|
||||
if (response.status() != IMAP::ResponseStatus::OK) {
|
||||
dbgln("Failed to select mailbox. The server says: '{}'", response.response_text());
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to select mailbox. The server says: '{}'", response.response_text()));
|
||||
GUI::MessageBox::show_error(window(), ByteString::formatted("Failed to select mailbox. The server says: '{}'", response.response_text()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -301,7 +301,7 @@ void MailWidget::selected_mailbox(GUI::ModelIndex const& index)
|
|||
if (fetch_response.status() != IMAP::ResponseStatus::OK) {
|
||||
dbgln("Failed to retrieve subject/from for e-mails. The server says: '{}'", response.response_text());
|
||||
m_statusbar->set_text(String::formatted("[{}]: Failed to fetch messages :^(", mailbox.name).release_value_but_fixme_should_propagate_errors());
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to retrieve e-mails. The server says: '{}'", response.response_text()));
|
||||
GUI::MessageBox::show_error(window(), ByteString::formatted("Failed to retrieve e-mails. The server says: '{}'", response.response_text()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -316,8 +316,8 @@ void MailWidget::selected_mailbox(GUI::ModelIndex const& index)
|
|||
|
||||
auto seen = !response_data.flags().find_if([](StringView value) { return value.equals_ignoring_ascii_case("\\Seen"sv); }).is_end();
|
||||
|
||||
DeprecatedString date = internal_date.to_deprecated_string();
|
||||
DeprecatedString subject = envelope.subject.is_empty() ? "(No subject)" : envelope.subject;
|
||||
ByteString date = internal_date.to_byte_string();
|
||||
ByteString subject = envelope.subject.is_empty() ? "(No subject)" : envelope.subject;
|
||||
if (subject.contains("=?"sv) && subject.contains("?="sv)) {
|
||||
subject = MUST(IMAP::decode_rfc2047_encoded_words(subject)).span();
|
||||
}
|
||||
|
@ -347,7 +347,7 @@ void MailWidget::selected_mailbox(GUI::ModelIndex const& index)
|
|||
}
|
||||
}
|
||||
}
|
||||
DeprecatedString from = sender_builder.to_deprecated_string();
|
||||
ByteString from = sender_builder.to_byte_string();
|
||||
|
||||
InboxEntry inbox_entry { sequence_number, date, from, subject, seen };
|
||||
m_statusbar->set_text(String::formatted("[{}]: Loading entry {}", mailbox.name, ++i).release_value_but_fixme_should_propagate_errors());
|
||||
|
@ -385,12 +385,12 @@ void MailWidget::selected_email_to_load(GUI::ModelIndex const& index)
|
|||
|
||||
if (fetch_response.status() != IMAP::ResponseStatus::OK) {
|
||||
dbgln("Failed to retrieve the body structure of the selected e-mail. The server says: '{}'", fetch_response.response_text());
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to retrieve the selected e-mail. The server says: '{}'", fetch_response.response_text()));
|
||||
GUI::MessageBox::show_error(window(), ByteString::formatted("Failed to retrieve the selected e-mail. The server says: '{}'", fetch_response.response_text()));
|
||||
return;
|
||||
}
|
||||
|
||||
Vector<u32> selected_alternative_position;
|
||||
DeprecatedString selected_alternative_encoding;
|
||||
ByteString selected_alternative_encoding;
|
||||
|
||||
auto& response_data = fetch_response.data().fetch_data().last().get<IMAP::FetchResponseData>();
|
||||
|
||||
|
@ -449,7 +449,7 @@ void MailWidget::selected_email_to_load(GUI::ModelIndex const& index)
|
|||
|
||||
if (fetch_response.status() != IMAP::ResponseStatus::OK) {
|
||||
dbgln("Failed to retrieve the body of the selected e-mail. The server says: '{}'", fetch_response.response_text());
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to retrieve the selected e-mail. The server says: '{}'", fetch_response.response_text()));
|
||||
GUI::MessageBox::show_error(window(), ByteString::formatted("Failed to retrieve the selected e-mail. The server says: '{}'", fetch_response.response_text()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -474,7 +474,7 @@ void MailWidget::selected_email_to_load(GUI::ModelIndex const& index)
|
|||
}
|
||||
|
||||
auto& body_data = fetch_response_data.body_data();
|
||||
auto body_text_part_iterator = body_data.find_if([](Tuple<IMAP::FetchCommand::DataItem, DeprecatedString>& data) {
|
||||
auto body_text_part_iterator = body_data.find_if([](Tuple<IMAP::FetchCommand::DataItem, ByteString>& data) {
|
||||
const auto data_item = data.get<0>();
|
||||
return data_item.section.has_value() && data_item.section->type == IMAP::FetchCommand::DataItem::SectionType::Parts;
|
||||
});
|
||||
|
@ -482,7 +482,7 @@ void MailWidget::selected_email_to_load(GUI::ModelIndex const& index)
|
|||
|
||||
auto& encoded_data = body_text_part_iterator->get<1>();
|
||||
|
||||
DeprecatedString decoded_data;
|
||||
ByteString decoded_data;
|
||||
|
||||
// FIXME: String uses char internally, so 8bit shouldn't be stored in it.
|
||||
// However, it works for now.
|
||||
|
@ -496,7 +496,7 @@ void MailWidget::selected_email_to_load(GUI::ModelIndex const& index)
|
|||
decoded_data = IMAP::decode_quoted_printable(encoded_data).release_value_but_fixme_should_propagate_errors().span();
|
||||
} else {
|
||||
dbgln("Mail: Unimplemented decoder for encoding: {}", selected_alternative_encoding);
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("The e-mail encoding '{}' is currently unsupported.", selected_alternative_encoding), "Unsupported"sv, GUI::MessageBox::Type::Information);
|
||||
GUI::MessageBox::show(window(), ByteString::formatted("The e-mail encoding '{}' is currently unsupported.", selected_alternative_encoding), "Unsupported"sv, GUI::MessageBox::Type::Information);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue