mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
rsstatus
-implemented simple rsStatus for messenger window - fixed minor bug with messenger window (starts new pop-up chat dialog when peer responds, if private chat started from messenger window) solution: messenger windows start peers dialogs pop-up chat dialog instead git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2721 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
7aa487e2b6
commit
76a4c34440
@ -69,7 +69,8 @@
|
||||
/* Images for Status icons */
|
||||
#define IMAGE_ONLINE ":/images/im-user.png"
|
||||
#define IMAGE_OFFLINE ":/images/im-user-offline.png"
|
||||
|
||||
#define IMAGE_AWAY ":/images/im-user-away.png"
|
||||
#define IMAGE_BUSY ":/images/im-user-busy.png"
|
||||
|
||||
/******
|
||||
* #define MSG_DEBUG 1
|
||||
@ -112,7 +113,11 @@ MessengerWindow::MessengerWindow(QWidget* parent, Qt::WFlags flags)
|
||||
connect( ui.actionHide_Offline_Friends, SIGNAL(triggered()), this, SLOT(insertPeers()));
|
||||
|
||||
connect(ui.messagelineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(savestatusmessage()));
|
||||
//connect(ui.statuscomboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(savestatus()));
|
||||
connect(ui.statuscomboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(savestatus()));
|
||||
|
||||
QTimer *timer = new QTimer(this);
|
||||
timer->connect(timer, SIGNAL(timeout()), this, SLOT(sendStatus()));
|
||||
timer->start(5000); /* five seconds */
|
||||
|
||||
/* to hide the header */
|
||||
ui.messengertreeWidget->header()->hide();
|
||||
@ -147,7 +152,7 @@ MessengerWindow::MessengerWindow(QWidget* parent, Qt::WFlags flags)
|
||||
updateAvatar();
|
||||
loadmystatusmessage();
|
||||
|
||||
//loadstatus();
|
||||
loadstatus();
|
||||
|
||||
displayMenu();
|
||||
updateMessengerDisplay();
|
||||
@ -446,11 +451,36 @@ void MessengerWindow::insertPeers()
|
||||
}
|
||||
}
|
||||
|
||||
std::list<StatusInfo> statusInfo;
|
||||
rsStatus->getStatus(statusInfo);
|
||||
RsPeerDetails ssl_details;
|
||||
|
||||
int i = 0;
|
||||
if (gpg_connected) {
|
||||
gpg_item->setHidden(false);
|
||||
gpg_item -> setIcon(0,(QIcon(IMAGE_ONLINE)));
|
||||
gpg_item -> setText(1, tr("Online"));
|
||||
gpg_item -> setText(1, tr("Online")); // set to online regardless on update
|
||||
|
||||
std::list<StatusInfo>::iterator it = statusInfo.begin();
|
||||
|
||||
for(; it != statusInfo.end(); it++){
|
||||
rsPeers->getPeerDetails(it->id, ssl_details);
|
||||
if(detail.id == ssl_details.gpg_id){
|
||||
std::string status;
|
||||
rsStatus->getStatusString(it->status, status);
|
||||
gpg_item -> setText(1, QString::fromStdString(status));
|
||||
|
||||
if(it->status == RS_STATUS_ONLINE)
|
||||
gpg_item -> setIcon(0,(QIcon(IMAGE_ONLINE)));
|
||||
else
|
||||
if(it->status == RS_STATUS_AWAY)
|
||||
gpg_item -> setIcon(0,(QIcon(IMAGE_AWAY)));
|
||||
else
|
||||
if(it->status == RS_STATUS_BUSY)
|
||||
gpg_item -> setIcon(0,(QIcon(IMAGE_BUSY)));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QFont font;
|
||||
font.setBold(true);
|
||||
@ -543,49 +573,13 @@ void MessengerWindow::chatfriend()
|
||||
QTreeWidgetItem *i = getCurrentPeer();
|
||||
|
||||
if (!i)
|
||||
return;
|
||||
|
||||
//std::string name = (i -> text(2)).toStdString();
|
||||
std::string id = (i -> text(3)).toStdString();
|
||||
|
||||
bool oneLocationConnected = false;
|
||||
|
||||
RsPeerDetails detail;
|
||||
if (!rsPeers->getPeerDetails(id, detail)) {
|
||||
return;
|
||||
}
|
||||
|
||||
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 {
|
||||
if (detail.state & RS_PEER_STATE_CONNECTED) {
|
||||
oneLocationConnected = true;
|
||||
getPrivateChat(id, detail.name + " - " + detail.location, RS_CHAT_REOPEN);
|
||||
}
|
||||
}
|
||||
emit startChat(i);
|
||||
|
||||
if (!oneLocationConnected) {
|
||||
/* info dialog */
|
||||
if ((QMessageBox::question(this, tr("Friend Not Online"),tr("Your Friend is offline \nDo you want to send them a Message instead"),QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes))== QMessageBox::Yes)
|
||||
{
|
||||
sendMessage();
|
||||
}
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
QTreeWidgetItem *MessengerWindow::getCurrentPeer()
|
||||
{
|
||||
/* get the current, and extract the Id */
|
||||
@ -943,11 +937,20 @@ void MessengerWindow::loadstatus()
|
||||
}
|
||||
|
||||
StatusInfo si;
|
||||
if (!rsStatus->getStatus(ownId, si))
|
||||
std::list<StatusInfo> statusList;
|
||||
std::list<StatusInfo>::iterator it;
|
||||
|
||||
if (!rsStatus->getStatus(statusList))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for(it=statusList.begin(); it != statusList.end(); it++){
|
||||
if(it->id == ownId)
|
||||
si = *it;
|
||||
}
|
||||
|
||||
|
||||
/* set status mode */
|
||||
int statusIndex = 0;
|
||||
switch(si.status)
|
||||
@ -1011,7 +1014,7 @@ void MessengerWindow::savestatus()
|
||||
si.id = ownId;
|
||||
si.status = status;
|
||||
|
||||
rsStatus->setStatus(si);
|
||||
rsStatus->sendStatus(si);
|
||||
|
||||
//rsiface->unlockData(); /* UnLock Interface */
|
||||
|
||||
|
@ -109,6 +109,7 @@ private slots:
|
||||
|
||||
signals:
|
||||
void friendsUpdated() ;
|
||||
void startChat(QTreeWidgetItem* );
|
||||
|
||||
private:
|
||||
|
||||
|
@ -107,7 +107,7 @@ stop: 0.9 #4c4c4c, stop: 1 #333333);
|
||||
<item row="1" column="0">
|
||||
<widget class="QComboBox" name="statuscomboBox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
@ -403,7 +403,7 @@ stop:0 #FEFEFE, stop:1 #E8E8E8);
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>295</width>
|
||||
<height>21</height>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
|
@ -103,7 +103,8 @@ PeersDialog::PeersDialog(QWidget *parent)
|
||||
|
||||
|
||||
connect( ui.peertreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( peertreeWidgetCostumPopupMenu( QPoint ) ) );
|
||||
connect( ui.peertreeWidget, SIGNAL( itemDoubleClicked ( QTreeWidgetItem *, int)), this, SLOT(chatfriend()));
|
||||
connect( ui.peertreeWidget, SIGNAL( itemDoubleClicked ( QTreeWidgetItem *, int)), this, SLOT(chatfriend(QTreeWidgetItem *)));
|
||||
connect( this , SIGNAL( startChat( QTreeWidgetItem *) ), this, SLOT(chatfriend(QTreeWidgetItem *)));
|
||||
|
||||
connect( ui.avatartoolButton, SIGNAL(clicked()), SLOT(getAvatar()));
|
||||
connect( ui.mypersonalstatuslabel, SIGNAL(clicked()), SLOT(statusmessage()));
|
||||
@ -250,7 +251,7 @@ void PeersDialog::peertreeWidgetCostumPopupMenu( QPoint point )
|
||||
connect( collapseAll , SIGNAL( triggered() ), ui.peertreeWidget, SLOT(collapseAll()) );
|
||||
|
||||
chatAct = new QAction(QIcon(IMAGE_CHAT), tr( "Chat" ), this );
|
||||
connect( chatAct , SIGNAL( triggered() ), this, SLOT( chatfriend() ) );
|
||||
connect( chatAct , SIGNAL( triggered() ), this, SLOT( chatfriendproxy() ) );
|
||||
|
||||
msgAct = new QAction(QIcon(IMAGE_MSG), tr( "Message Friend" ), this );
|
||||
connect( msgAct , SIGNAL( triggered() ), this, SLOT( msgfriend() ) );
|
||||
@ -614,15 +615,27 @@ void PeersDialog::exportfriend()
|
||||
|
||||
}
|
||||
|
||||
void PeersDialog::chatfriend()
|
||||
{
|
||||
QTreeWidgetItem *i = getCurrentPeer();
|
||||
void PeersDialog::chatfriendproxy(){
|
||||
|
||||
if (!i)
|
||||
QTreeWidgetItem* i = getCurrentPeer();
|
||||
|
||||
if(!i)
|
||||
return;
|
||||
|
||||
emit startChat(i);
|
||||
return;
|
||||
}
|
||||
|
||||
void PeersDialog::chatfriend(QTreeWidgetItem* currPeer)
|
||||
{
|
||||
// QTreeWidgetItem *currPeer = getCurrentPeer();
|
||||
|
||||
if (!currPeer){
|
||||
return;
|
||||
}
|
||||
|
||||
//std::string name = (i -> text(2)).toStdString();
|
||||
std::string id = (i -> text(3)).toStdString();
|
||||
std::string id = (currPeer -> text(3)).toStdString();
|
||||
|
||||
bool oneLocationConnected = false;
|
||||
|
||||
@ -745,7 +758,7 @@ void PeersDialog::removefriend()
|
||||
if (!c)
|
||||
{
|
||||
#ifdef PEERS_DEBUG
|
||||
std::cerr << "PeersDialog::removefriend() Noone Selected -- sorry" << std::endl;
|
||||
std::cerr << "PeersDialog::removefriend() None Selected -- sorry" << std::endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
@ -102,7 +102,8 @@ private slots:
|
||||
/** Remove friend */
|
||||
void removefriend();
|
||||
/** start a chat with a friend **/
|
||||
void chatfriend();
|
||||
void chatfriend(QTreeWidgetItem* );
|
||||
void chatfriendproxy();
|
||||
void msgfriend();
|
||||
|
||||
void configurefriend();
|
||||
@ -142,6 +143,7 @@ private slots:
|
||||
signals:
|
||||
void friendsUpdated() ;
|
||||
void notifyGroupChat(const QString&,const QString&) ;
|
||||
void startChat(QTreeWidgetItem* );
|
||||
|
||||
private:
|
||||
class QLabel *iconLabel, *textLabel;
|
||||
|
@ -211,7 +211,7 @@ void StartDialog::notSecureWarning() {
|
||||
if(ui.autologin_checkbox->isChecked()){
|
||||
QMessageBox::StandardButton sb = QMessageBox::warning ( NULL,
|
||||
tr("Insecure"),
|
||||
tr("Auto Login is not Secure: Password stored on disk"),
|
||||
tr("Auto-Login is not Secure \n It can be disabled in General Settings"),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "rsiface/rsmsgs.h"
|
||||
#include "rsiface/rsfiles.h"
|
||||
|
||||
|
||||
#include "gui/feeds/AttachFileItem.h"
|
||||
#include <time.h>
|
||||
|
||||
@ -342,6 +343,7 @@ void PopupChatDialog::checkChat()
|
||||
sendChat();
|
||||
else
|
||||
updateStatusTyping() ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -167,6 +167,7 @@ int main(int argc, char *argv[])
|
||||
QObject::connect(w->peersDialog,SIGNAL(friendsUpdated()),w->networkDialog,SLOT(insertConnect())) ;
|
||||
QObject::connect(w->peersDialog,SIGNAL(notifyGroupChat(const QString&,const QString&)),w,SLOT(displaySystrayMsg(const QString&,const QString&)),Qt::QueuedConnection) ;
|
||||
|
||||
QObject::connect(w->messengerWindow,SIGNAL(startChat(QTreeWidgetItem* )),w->peersDialog,SLOT(chatfriend(QTreeWidgetItem* ))) ;
|
||||
/* only show window, if not startMinimized */
|
||||
RshareSettings *_settings = new RshareSettings();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user