Clean up Peer and SecurityItem feeds

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7732 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2014-12-06 15:29:41 +00:00
parent b11459329b
commit 4cbc6c1cdb
4 changed files with 16 additions and 150 deletions

View File

@ -47,7 +47,6 @@ PeerItem::PeerItem(FeedHolder *parent, uint32_t feedId, const RsPeerId &peerId,
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
messageframe->setVisible(false);
sendmsgButton->setEnabled(false);
/* general ones */
@ -56,20 +55,10 @@ PeerItem::PeerItem(FeedHolder *parent, uint32_t feedId, const RsPeerId &peerId,
/* specific ones */
connect( chatButton, SIGNAL( clicked( void ) ), this, SLOT( openChat ( void ) ) );
connect( actionNew_Message, SIGNAL( triggered( ) ), this, SLOT( sendMsg ( void ) ) );
connect( quickmsgButton, SIGNAL( clicked( ) ), this, SLOT( togglequickmessage() ) );
connect( cancelButton, SIGNAL( clicked( ) ), this, SLOT( togglequickmessage() ) );
connect( sendmsgButton, SIGNAL( clicked( ) ), this, SLOT( sendMessage() ) );
connect( sendmsgButton, SIGNAL( clicked( ) ), this, SLOT( sendMsg() ) );
connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(updateItem()));
QMenu *msgmenu = new QMenu();
msgmenu->addAction(actionNew_Message);
quickmsgButton->setMenu(msgmenu);
avatar->setId(RsPeerId(mPeerId));
expandFrame->hide();
@ -165,7 +154,7 @@ void PeerItem::updateItem()
if (!rsPeers->getPeerDetails(mPeerId, details))
{
chatButton->setEnabled(false);
quickmsgButton->setEnabled(false);
sendmsgButton->setEnabled(false);
return;
}
@ -192,11 +181,11 @@ void PeerItem::updateItem()
chatButton->setEnabled(details.state & RS_PEER_STATE_CONNECTED);
if (details.state & RS_PEER_STATE_FRIEND)
{
quickmsgButton->setEnabled(true);
sendmsgButton->setEnabled(true);
}
else
{
quickmsgButton->setEnabled(false);
sendmsgButton->setEnabled(false);
}
}
@ -305,41 +294,3 @@ void PeerItem::openChat()
}
}
void PeerItem::togglequickmessage()
{
if (messageframe->isHidden())
{
messageframe->setVisible(true);
}
else
{
messageframe->setVisible(false);
}
}
void PeerItem::sendMessage()
{
/* construct a message */
MessageInfo mi;
mi.title = tr("Quick Message").toUtf8().constData();
mi.msg = quickmsgText->toHtml().toUtf8().constData();
mi.rspeerid_msgto.push_back(mPeerId);
rsMsgs->MessageSend(mi);
quickmsgText->clear();
messageframe->setVisible(false);
}
void PeerItem::on_quickmsgText_textChanged()
{
if (quickmsgText->toPlainText().isEmpty())
{
sendmsgButton->setEnabled(false);
}
else
{
sendmsgButton->setEnabled(true);
}
}

View File

@ -57,11 +57,7 @@ private slots:
void openChat();
void updateItem();
void togglequickmessage();
void sendMessage();
void on_quickmsgText_textChanged();
private:
FeedHolder *mParent;

View File

@ -7,20 +7,11 @@
<x>0</x>
<y>0</y>
<width>476</width>
<height>338</height>
<height>247</height>
</rect>
</property>
<layout class="QGridLayout">
<property name="leftMargin">
<number>1</number>
</property>
<property name="topMargin">
<number>1</number>
</property>
<property name="rightMargin">
<number>1</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>1</number>
</property>
<item row="0" column="0">
@ -236,19 +227,16 @@
</spacer>
</item>
<item>
<widget class="QToolButton" name="quickmsgButton">
<widget class="QToolButton" name="sendmsgButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Write a quick Message</string>
<string>Send Message</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/message-mail.png</normaloff>:/images/message-mail.png</iconset>
</property>
<property name="popupMode">
<enum>QToolButton::MenuButtonPopup</enum>
<normaloff>:/images/mail_new.png</normaloff>:/images/mail_new.png</iconset>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
@ -277,7 +265,7 @@
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/chat.png</normaloff>:/images/chat.png</iconset>
<normaloff>:/images/chat_24.png</normaloff>:/images/chat_24.png</iconset>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
@ -333,66 +321,6 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QFrame" name="messageframe">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>130</height>
</size>
</property>
<layout class="QGridLayout">
<property name="verticalSpacing">
<number>2</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item row="1" column="1">
<widget class="QPushButton" name="cancelButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="sendmsgButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Send</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>469</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" colspan="3">
<widget class="QTextEdit" name="quickmsgText"/>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QFrame" name="expandFrame">
<layout class="QGridLayout">
<item row="0" column="0">

View File

@ -6,21 +6,12 @@
<rect>
<x>0</x>
<y>0</y>
<width>762</width>
<height>240</height>
<width>763</width>
<height>241</height>
</rect>
</property>
<layout class="QGridLayout">
<property name="leftMargin">
<number>1</number>
</property>
<property name="topMargin">
<number>1</number>
</property>
<property name="rightMargin">
<number>1</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>1</number>
</property>
<item row="0" column="0">
@ -348,11 +339,11 @@
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Write a quick Message</string>
<string>Send Message</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/message-mail.png</normaloff>:/images/message-mail.png</iconset>
<normaloff>:/images/mail_new.png</normaloff>:/images/mail_new.png</iconset>
</property>
<property name="popupMode">
<enum>QToolButton::DelayedPopup</enum>
@ -384,7 +375,7 @@
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/chat.png</normaloff>:/images/chat.png</iconset>
<normaloff>:/images/chat_24.png</normaloff>:/images/chat_24.png</iconset>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>