restrict attachments when editing
This commit is contained in:
@@ -570,12 +570,16 @@ void ChatInput::StopReplying() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ChatInput::StartEditing(const Message &message) {
|
void ChatInput::StartEditing(const Message &message) {
|
||||||
|
m_is_editing = true;
|
||||||
m_input.Get().grab_focus();
|
m_input.Get().grab_focus();
|
||||||
m_input.Get().get_style_context()->add_class("editing");
|
m_input.Get().get_style_context()->add_class("editing");
|
||||||
GetBuffer()->set_text(message.Content);
|
GetBuffer()->set_text(message.Content);
|
||||||
|
m_attachments.Clear();
|
||||||
|
m_attachments_revealer.set_reveal_child(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatInput::StopEditing() {
|
void ChatInput::StopEditing() {
|
||||||
|
m_is_editing = false;
|
||||||
m_input.Get().get_style_context()->remove_class("editing");
|
m_input.Get().get_style_context()->remove_class("editing");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -595,7 +599,7 @@ bool ChatInput::AddFileAsImageAttachment(const Glib::RefPtr<Gio::File> &file) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ChatInput::CanAttachFiles() {
|
bool ChatInput::CanAttachFiles() {
|
||||||
return Abaddon::Get().GetDiscordClient().HasSelfChannelPermission(m_active_channel, Permission::ATTACH_FILES | Permission::SEND_MESSAGES);
|
return !m_is_editing && Abaddon::Get().GetDiscordClient().HasSelfChannelPermission(m_active_channel, Permission::ATTACH_FILES | Permission::SEND_MESSAGES);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatInput::type_signal_submit ChatInput::signal_submit() {
|
ChatInput::type_signal_submit ChatInput::signal_submit() {
|
||||||
|
@@ -155,6 +155,8 @@ private:
|
|||||||
|
|
||||||
Snowflake m_active_channel;
|
Snowflake m_active_channel;
|
||||||
|
|
||||||
|
bool m_is_editing = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using type_signal_submit = sigc::signal<bool, ChatSubmitParams>;
|
using type_signal_submit = sigc::signal<bool, ChatSubmitParams>;
|
||||||
using type_signal_escape = sigc::signal<void>;
|
using type_signal_escape = sigc::signal<void>;
|
||||||
|
Reference in New Issue
Block a user