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.addSeparator();
contextMnu.addAction( widgetAction);
if (c->type() != 0) {
//this is a SSL key
contextMnu.addAction( chatAct);
contextMnu.addAction( msgAct);
}
contextMnu.addAction( configurefriendAct);
//contextMnu.addAction( profileviewAct);
if (c->type() != 0) {
@ -565,28 +562,43 @@ void PeersDialog::chatfriend()
if (!i)
return;
std::string name = (i -> text(2)).toStdString();
//std::string name = (i -> text(2)).toStdString();
std::string id = (i -> text(3)).toStdString();
bool oneLocationConnected = false;
RsPeerDetails detail;
if (!rsPeers->getPeerDetails(id, detail))
{
if (!rsPeers->getPeerDetails(id, detail)) {
return;
}
if (detail.state & RS_PEER_STATE_CONNECTED)
{
getPrivateChat(id, name, RS_CHAT_REOPEN);
if (detail.isOnlyGPGdetail) {
//let's get the ssl child details, and open all the chat boxes
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 */
QMessageBox::StandardButton sb = QMessageBox::question ( NULL,
"Friend Not Online",
"Your Friend is offline \nDo you want to send them a Message instead",
(QMessageBox::Yes | QMessageBox::No));
if (sb == QMessageBox::Yes)
{
if (sb == QMessageBox::Yes) {
msgfriend();
}
}
@ -611,6 +623,12 @@ void PeersDialog::msgfriend()
rsicontrol -> ClearInMsg();
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 */
ChanMsgDialog *nMsgDialog = new ChanMsgDialog(true);

View File

@ -65,6 +65,8 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
RshareSettings config;
config.loadWidgetInformation(this);
this->move(qrand()%100, qrand()%100); //avoid to stack multiple popup chat windows on the same position
loadEmoticons();
@ -134,7 +136,7 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
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()

View File

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

View File

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