From cb1bee331854503495f60bd349c3b098cd0ddea8 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Wed, 8 Sep 2010 19:04:24 +0000 Subject: [PATCH] Enable/disable the send button for quick message in the ChatMsgItem with textChanged signal of the QTextBrowser and not with updateItem. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3460 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/feeds/ChatMsgItem.cpp | 24 +++++++++++--------- retroshare-gui/src/gui/feeds/ChatMsgItem.h | 16 ++++++------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/retroshare-gui/src/gui/feeds/ChatMsgItem.cpp b/retroshare-gui/src/gui/feeds/ChatMsgItem.cpp index 599fe5a8c..7f42add03 100644 --- a/retroshare-gui/src/gui/feeds/ChatMsgItem.cpp +++ b/retroshare-gui/src/gui/feeds/ChatMsgItem.cpp @@ -60,7 +60,6 @@ ChatMsgItem::ChatMsgItem(FeedHolder *parent, uint32_t feedId, std::string peerId connect( quickmsgButton, SIGNAL( clicked( ) ), this, SLOT( togglequickmessage() ) ); connect( sendButton, SIGNAL( clicked( ) ), this, SLOT( sendMessage() ) ); - connect(NotifyQt::getInstance(), SIGNAL(peerHasNewAvatar(const QString&)), this, SLOT(updateAvatar(const QString&))); updateItemStatic(); @@ -129,15 +128,6 @@ void ChatMsgItem::updateItem() } } - /*if (quickmsgText->toPlainText().isEmpty()) - { - sendButton->setEnabled(false); - } - else - { - sendButton->setEnabled(true); - }*/ - /* slow Tick */ int msec_rate = 10129; @@ -284,4 +274,16 @@ void ChatMsgItem::sendMessage() quickmsgText->clear(); messageframe->setVisible(false); sendButton->hide(); -} \ No newline at end of file +} + +void ChatMsgItem::on_quickmsgText_textChanged() +{ + if (quickmsgText->toPlainText().isEmpty()) + { + sendButton->setEnabled(false); + } + else + { + sendButton->setEnabled(true); + } +} diff --git a/retroshare-gui/src/gui/feeds/ChatMsgItem.h b/retroshare-gui/src/gui/feeds/ChatMsgItem.h index a4940149e..afbfbeff2 100644 --- a/retroshare-gui/src/gui/feeds/ChatMsgItem.h +++ b/retroshare-gui/src/gui/feeds/ChatMsgItem.h @@ -43,22 +43,24 @@ public: private slots: /* default stuff */ - void gotoHome(); - void removeItem(); + void gotoHome(); + void removeItem(); void sendMsg(); void openChat(); void updateItem(); void updateAvatar(const QString &peer_id); - + void togglequickmessage(); void sendMessage(); -private: - void insertChat(std::string &message); + void on_quickmsgText_textChanged(); - FeedHolder *mParent; +private: + void insertChat(std::string &message); + + FeedHolder *mParent; uint32_t mFeedId; std::string mPeerId; @@ -66,7 +68,5 @@ private: bool mIsHome; }; - - #endif