From 0b051a5e150838a8c9b498749666736da7a8f521 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 5 Sep 2020 17:02:25 +0200 Subject: [PATCH] ClipboardHistory: Show the size (in bytes) of each remembered clipping --- MenuApplets/ClipboardHistory/ClipboardHistoryModel.cpp | 5 +++++ MenuApplets/ClipboardHistory/ClipboardHistoryModel.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/MenuApplets/ClipboardHistory/ClipboardHistoryModel.cpp b/MenuApplets/ClipboardHistory/ClipboardHistoryModel.cpp index a99b0f35ef8..bb3a84f22f0 100644 --- a/MenuApplets/ClipboardHistory/ClipboardHistoryModel.cpp +++ b/MenuApplets/ClipboardHistory/ClipboardHistoryModel.cpp @@ -25,6 +25,7 @@ */ #include "ClipboardHistoryModel.h" +#include NonnullRefPtr ClipboardHistoryModel::create() { @@ -42,6 +43,8 @@ String ClipboardHistoryModel::column_name(int column) const return "Data"; case Column::Type: return "Type"; + case Column::Size: + return "Size"; default: ASSERT_NOT_REACHED(); } @@ -59,6 +62,8 @@ GUI::Variant ClipboardHistoryModel::data(const GUI::ModelIndex& index, GUI::Mode return "<...>"; case Column::Type: return data_and_type.mime_type; + case Column::Size: + return AK::human_readable_size(data_and_type.data.size()); default: ASSERT_NOT_REACHED(); } diff --git a/MenuApplets/ClipboardHistory/ClipboardHistoryModel.h b/MenuApplets/ClipboardHistory/ClipboardHistoryModel.h index f9a14e33c71..e6f51b8b8c4 100644 --- a/MenuApplets/ClipboardHistory/ClipboardHistoryModel.h +++ b/MenuApplets/ClipboardHistory/ClipboardHistoryModel.h @@ -37,6 +37,7 @@ public: enum Column { Data, Type, + Size, __Count }; @@ -55,3 +56,4 @@ private: Vector m_history_items; size_t m_history_limit { 20 }; }; +