diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2022-06-23 00:48:00 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2022-06-23 00:48:00 -0400 |
commit | d841a2c862eddc6b2053b48907f8e1400e2d1391 (patch) | |
tree | 77741f5d2cb9908f86cd7c1c737b2c52ade4fd3e /src/components | |
parent | 4ee7025ab09b606a2556bf9f42c1218d7fd72843 (diff) | |
download | abaddon-portaudio-d841a2c862eddc6b2053b48907f8e1400e2d1391.tar.gz abaddon-portaudio-d841a2c862eddc6b2053b48907f8e1400e2d1391.zip |
add change filename
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/chatinput.cpp | 15 | ||||
-rw-r--r-- | src/components/chatinput.hpp | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/components/chatinput.cpp b/src/components/chatinput.cpp index 269a2ac..a734dec 100644 --- a/src/components/chatinput.cpp +++ b/src/components/chatinput.cpp @@ -220,6 +220,7 @@ ChatInputAttachmentItem::ChatInputAttachmentItem(const Glib::RefPtr<Gio::File> & show_all_children(); SetupMenu(); + UpdateTooltip(); } Glib::RefPtr<Gio::File> ChatInputAttachmentItem::GetFile() const { @@ -249,6 +250,16 @@ void ChatInputAttachmentItem::SetupMenu() { m_signal_item_removed.emit(); }); + m_menu_set_filename.set_label("Change Filename"); + m_menu_set_filename.signal_activate().connect([this] { + const auto name = Abaddon::Get().ShowTextPrompt("Enter new filename for attachment", "Enter filename", m_filename); + if (name.has_value()) { + m_filename = *name; + UpdateTooltip(); + } + }); + + m_menu.add(m_menu_set_filename); m_menu.add(m_menu_remove); m_menu.show_all(); @@ -262,6 +273,10 @@ void ChatInputAttachmentItem::SetupMenu() { }); } +void ChatInputAttachmentItem::UpdateTooltip() { + set_tooltip_text(m_filename); +} + ChatInputAttachmentItem::type_signal_item_removed ChatInputAttachmentItem::signal_item_removed() { return m_signal_item_removed; } diff --git a/src/components/chatinput.hpp b/src/components/chatinput.hpp index 865b23e..8a4ad8d 100644 --- a/src/components/chatinput.hpp +++ b/src/components/chatinput.hpp @@ -16,9 +16,11 @@ public: private: void SetupMenu(); + void UpdateTooltip(); Gtk::Menu m_menu; Gtk::MenuItem m_menu_remove; + Gtk::MenuItem m_menu_set_filename; Gtk::Box m_box; Gtk::Image *m_img = nullptr; |