improve peer chat and message composer

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2078 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
joss17 2010-01-18 22:50:14 +00:00
parent cd7467e86d
commit c62daadacd
4 changed files with 386 additions and 364 deletions

View File

@ -269,11 +269,8 @@ void PeersDialog::peertreeWidgetCostumPopupMenu( QPoint point )
contextMnu.addAction( collapseAll); contextMnu.addAction( collapseAll);
contextMnu.addSeparator(); contextMnu.addSeparator();
contextMnu.addAction( widgetAction); contextMnu.addAction( widgetAction);
if (c->type() != 0) {
//this is a SSL key
contextMnu.addAction( chatAct); contextMnu.addAction( chatAct);
contextMnu.addAction( msgAct); contextMnu.addAction( msgAct);
}
contextMnu.addAction( configurefriendAct); contextMnu.addAction( configurefriendAct);
//contextMnu.addAction( profileviewAct); //contextMnu.addAction( profileviewAct);
if (c->type() != 0) { if (c->type() != 0) {
@ -565,28 +562,43 @@ void PeersDialog::chatfriend()
if (!i) if (!i)
return; return;
std::string name = (i -> text(2)).toStdString(); //std::string name = (i -> text(2)).toStdString();
std::string id = (i -> text(3)).toStdString(); std::string id = (i -> text(3)).toStdString();
bool oneLocationConnected = false;
RsPeerDetails detail; RsPeerDetails detail;
if (!rsPeers->getPeerDetails(id, detail)) if (!rsPeers->getPeerDetails(id, detail)) {
{
return; return;
} }
if (detail.state & RS_PEER_STATE_CONNECTED) if (detail.isOnlyGPGdetail) {
{ //let's get the ssl child details, and open all the chat boxes
getPrivateChat(id, name, RS_CHAT_REOPEN); std::list<std::string> sslIds;
rsPeers->getSSLChildListOfGPGId(detail.gpg_id, sslIds);
for (std::list<std::string>::iterator it = sslIds.begin(); it != sslIds.end(); it++) {
RsPeerDetails sslDetails;
if (rsPeers->getPeerDetails(*it, sslDetails)) {
if (sslDetails.state & RS_PEER_STATE_CONNECTED) {
oneLocationConnected = true;
getPrivateChat(*it, sslDetails.name + " - " + sslDetails.location, RS_CHAT_REOPEN);
} }
else }
{ }
} else {
if (detail.state & RS_PEER_STATE_CONNECTED) {
oneLocationConnected = true;
getPrivateChat(id, detail.name + " - " + detail.location, RS_CHAT_REOPEN);
}
}
if (!oneLocationConnected) {
/* info dialog */ /* info dialog */
QMessageBox::StandardButton sb = QMessageBox::question ( NULL, QMessageBox::StandardButton sb = QMessageBox::question ( NULL,
"Friend Not Online", "Friend Not Online",
"Your Friend is offline \nDo you want to send them a Message instead", "Your Friend is offline \nDo you want to send them a Message instead",
(QMessageBox::Yes | QMessageBox::No)); (QMessageBox::Yes | QMessageBox::No));
if (sb == QMessageBox::Yes) if (sb == QMessageBox::Yes) {
{
msgfriend(); msgfriend();
} }
} }
@ -611,6 +623,12 @@ void PeersDialog::msgfriend()
rsicontrol -> ClearInMsg(); rsicontrol -> ClearInMsg();
rsicontrol -> SetInMsg(id, true); rsicontrol -> SetInMsg(id, true);
std::list<std::string> sslIds;
rsPeers->getSSLChildListOfGPGId(id, sslIds);
for (std::list<std::string>::iterator it = sslIds.begin(); it != sslIds.end(); it++) {
//put all sslChilds in message list
rsicontrol -> SetInMsg(*it, true);
}
/* create a message */ /* create a message */
ChanMsgDialog *nMsgDialog = new ChanMsgDialog(true); ChanMsgDialog *nMsgDialog = new ChanMsgDialog(true);

View File

@ -65,6 +65,8 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
RshareSettings config; RshareSettings config;
config.loadWidgetInformation(this); config.loadWidgetInformation(this);
this->move(qrand()%100, qrand()%100); //avoid to stack multiple popup chat windows on the same position
loadEmoticons(); loadEmoticons();
@ -134,7 +136,7 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
void PopupChatDialog::resetStatusBar() void PopupChatDialog::resetStatusBar()
{ {
statusBar()->showMessage(tr("Chatting with ") + QString::fromStdString(dialogName) + " (" +QString::fromStdString(dialogId)+ ")") ; statusBar()->showMessage(tr("Chatting with ") + QString::fromStdString(dialogName)) ;
} }
void PopupChatDialog::updateStatusTyping() void PopupChatDialog::updateStatusTyping()

View File

@ -322,7 +322,7 @@ void ChanMsgDialog::insertSendList()
/* add all the labels */ /* add all the labels */
/* (0) Person */ /* (0) Person */
item -> setText(0, QString::fromStdString(detail.name)); item -> setText(0, QString::fromStdString(detail.name) + " - " + QString::fromStdString(detail.location));
/* () Org */ /* () Org */
//item -> setText(1, QString::fromStdString(detail.org)); //item -> setText(1, QString::fromStdString(detail.org));
/* () Location */ /* () Location */

View File

@ -21,8 +21,12 @@
<normaloff>:/images/folder-draft.png</normaloff>:/images/folder-draft.png</iconset> <normaloff>:/images/folder-draft.png</normaloff>:/images/folder-draft.png</iconset>
</property> </property>
<widget class="QWidget" name="centralwidget"> <widget class="QWidget" name="centralwidget">
<layout class="QGridLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item row="0" column="0"> <item>
<widget class="QSplitter" name="splitter_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QDockWidget" name="contactsdockWidget"> <widget class="QDockWidget" name="contactsdockWidget">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
@ -92,8 +96,6 @@
</layout> </layout>
</widget> </widget>
</widget> </widget>
</item>
<item row="0" column="1">
<widget class="QSplitter" name="splitter"> <widget class="QSplitter" name="splitter">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -377,6 +379,7 @@
</layout> </layout>
</widget> </widget>
</widget> </widget>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -386,7 +389,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>770</width> <width>770</width>
<height>21</height> <height>25</height>
</rect> </rect>
</property> </property>
</widget> </widget>
@ -452,7 +455,6 @@
</tabstops> </tabstops>
<resources> <resources>
<include location="../images.qrc"/> <include location="../images.qrc"/>
<include location="../images.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>