clean up security feed item

Added Send Message context menu action for Identities List

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7864 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2015-01-23 16:35:06 +00:00
parent b155c36170
commit 483934100a
4 changed files with 38 additions and 32 deletions

View file

@ -32,11 +32,11 @@
#include "gui/common/UIStateHelper.h" #include "gui/common/UIStateHelper.h"
#include "gui/chat/ChatDialog.h" #include "gui/chat/ChatDialog.h"
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
#include "gui/msgs/MessageComposer.h"
#include <retroshare/rspeers.h> #include <retroshare/rspeers.h>
#include "retroshare/rsgxsflags.h" #include "retroshare/rsgxsflags.h"
#include "retroshare/rsmsgs.h" #include "retroshare/rsmsgs.h"
#include <iostream> #include <iostream>
#include <algorithm> #include <algorithm>
@ -940,7 +940,8 @@ void IdDialog::IdListCustomPopupMenu( QPoint )
if(own_identities.size() <= 1) if(own_identities.size() <= 1)
{ {
QAction *action = contextMnu.addAction(QIcon(), tr("Chat with this peer"), this, SLOT(chatIdentity())); QAction *action = contextMnu.addAction(QIcon(":/images/chat_24.png"), tr("Chat with this person"), this, SLOT(chatIdentity()));
if(own_identities.empty()) if(own_identities.empty())
action->setEnabled(false) ; action->setEnabled(false) ;
@ -949,7 +950,7 @@ void IdDialog::IdListCustomPopupMenu( QPoint )
} }
else else
{ {
QMenu *mnu = contextMnu.addMenu(tr("Chat with this peer as...")) ; QMenu *mnu = contextMnu.addMenu(QIcon(":/images/chat_24.png"),tr("Chat with this person as...")) ;
for(std::list<RsGxsId>::const_iterator it=own_identities.begin();it!=own_identities.end();++it) for(std::list<RsGxsId>::const_iterator it=own_identities.begin();it!=own_identities.end();++it)
{ {
@ -963,6 +964,9 @@ void IdDialog::IdListCustomPopupMenu( QPoint )
} }
} }
contextMnu.addAction(QIcon(":/images/mail_new.png"), tr("Send message to this person"), this, SLOT(sendMsg()));
contextMnu.exec(QCursor::pos()); contextMnu.exec(QCursor::pos());
} }
@ -986,5 +990,28 @@ void IdDialog::chatIdentity()
uint32_t error_code ; uint32_t error_code ;
if(!rsMsgs->initiateDistantChatConnexion(RsGxsId(keyId), from_gxs_id, error_code)) if(!rsMsgs->initiateDistantChatConnexion(RsGxsId(keyId), from_gxs_id, error_code))
QMessageBox::information(NULL, tr("Distant chat cannot work"), QString("%1 %2: %3").arg(tr("Distant chat refused with this peer.")).arg(tr("Error code")).arg(error_code)) ; QMessageBox::information(NULL, tr("Distant chat cannot work"), QString("%1 %2: %3").arg(tr("Distant chat refused with this person.")).arg(tr("Error code")).arg(error_code)) ;
}
void IdDialog::sendMsg()
{
QTreeWidgetItem *item = ui->treeWidget_IdList->currentItem();
if (!item)
{
return;
}
MessageComposer *nMsgDialog = MessageComposer::newMsg();
if (nMsgDialog == NULL) {
return;
}
std::string keyId = item->text(RSID_COL_KEYID).toStdString();
nMsgDialog->addRecipient(MessageComposer::TO, RsGxsId(keyId));
nMsgDialog->show();
nMsgDialog->activateWindow();
/* window will destroy itself! */
} }

View file

@ -64,6 +64,8 @@ private slots:
void removeIdentity(); void removeIdentity();
void editIdentity(); void editIdentity();
void chatIdentity(); void chatIdentity();
void sendMsg();
void updateSelection(); void updateSelection();

View file

@ -50,7 +50,7 @@ SecurityItem::SecurityItem(FeedHolder *parent, uint32_t feedId, const RsPgpId &g
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */
setupUi(this); setupUi(this);
quickmsgButton->hide(); //quickmsgButton->hide();
chatButton->hide(); chatButton->hide();
removeFriendButton->setEnabled(false); removeFriendButton->setEnabled(false);
removeFriendButton->hide(); removeFriendButton->hide();
@ -65,7 +65,7 @@ SecurityItem::SecurityItem(FeedHolder *parent, uint32_t feedId, const RsPgpId &g
/* specific ones */ /* specific ones */
connect( chatButton, SIGNAL( clicked( void ) ), this, SLOT( openChat ( void ) ) ); connect( chatButton, SIGNAL( clicked( void ) ), this, SLOT( openChat ( void ) ) );
connect( quickmsgButton, SIGNAL( clicked( ) ), this, SLOT( sendMsg() ) ); //connect( quickmsgButton, SIGNAL( clicked( ) ), this, SLOT( sendMsg() ) );
connect( removeFriendButton, SIGNAL(clicked()), this, SLOT(removeFriend())); connect( removeFriendButton, SIGNAL(clicked()), this, SLOT(removeFriend()));
connect( peerDetailsButton, SIGNAL(clicked()), this, SLOT(peerDetails())); connect( peerDetailsButton, SIGNAL(clicked()), this, SLOT(peerDetails()));
@ -205,7 +205,7 @@ void SecurityItem::updateItem()
connLabel->setText(tr("Unknown Peer")); connLabel->setText(tr("Unknown Peer"));
chatButton->hide(); chatButton->hide();
quickmsgButton->hide(); //quickmsgButton->hide();
requestLabel->hide(); requestLabel->hide();
removeFriendButton->setEnabled(false); removeFriendButton->setEnabled(false);
@ -270,7 +270,7 @@ void SecurityItem::updateItem()
removeFriendButton->hide(); removeFriendButton->hide();
} }
quickmsgButton->show(); //quickmsgButton->show();
} }
/* slow Tick */ /* slow Tick */

View file

@ -317,29 +317,6 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<widget class="QToolButton" name="quickmsgButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Send Message</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/mail_new.png</normaloff>:/images/mail_new.png</iconset>
</property>
<property name="popupMode">
<enum>QToolButton::DelayedPopup</enum>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item> <item>
<widget class="QToolButton" name="chatButton"> <widget class="QToolButton" name="chatButton">
<property name="sizePolicy"> <property name="sizePolicy">