mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-26 09:41:29 -05:00
Fixed start of chat with right or double click on a friend item (not location) in friend list.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7633 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
26f93c2a55
commit
a3af37c7e4
@ -229,7 +229,27 @@ void ChatDialog::init(const RsPeerId &peerId, const QString &title)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (detail.isOnlyGPGdetail) {
|
if (detail.isOnlyGPGdetail) {
|
||||||
std::list<RsPeerId> onlineIds;
|
/* Should not happen */
|
||||||
|
//chatFriend(detail.gpg_id, forceFocus);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
getChat(peerId, forceFocus ? RS_CHAT_OPEN | RS_CHAT_FOCUS : RS_CHAT_OPEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*static*/ void ChatDialog::chatFriend(const RsPgpId &gpgId, const bool forceFocus)
|
||||||
|
{
|
||||||
|
if (gpgId.isNull()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
RsPeerDetails detail;
|
||||||
|
if (!rsPeers->getGPGDetails(gpgId, detail))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!detail.isOnlyGPGdetail) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//let's get the ssl child details
|
//let's get the ssl child details
|
||||||
std::list<RsPeerId> sslIds;
|
std::list<RsPeerId> sslIds;
|
||||||
@ -237,11 +257,12 @@ void ChatDialog::init(const RsPeerId &peerId, const QString &title)
|
|||||||
|
|
||||||
if (sslIds.size() == 1) {
|
if (sslIds.size() == 1) {
|
||||||
// chat with the one ssl id (online or offline)
|
// chat with the one ssl id (online or offline)
|
||||||
getChat(sslIds.front(), forceFocus ? RS_CHAT_OPEN | RS_CHAT_FOCUS : RS_CHAT_OPEN);
|
chatFriend(sslIds.front(), forceFocus);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// more than one ssl ids available, check for online
|
// more than one ssl ids available, check for online
|
||||||
|
std::list<RsPeerId> onlineIds;
|
||||||
for (std::list<RsPeerId>::iterator it = sslIds.begin(); it != sslIds.end(); ++it) {
|
for (std::list<RsPeerId>::iterator it = sslIds.begin(); it != sslIds.end(); ++it) {
|
||||||
if (rsPeers->isOnline(*it)) {
|
if (rsPeers->isOnline(*it)) {
|
||||||
onlineIds.push_back(*it);
|
onlineIds.push_back(*it);
|
||||||
@ -250,16 +271,13 @@ void ChatDialog::init(const RsPeerId &peerId, const QString &title)
|
|||||||
|
|
||||||
if (onlineIds.size() == 1) {
|
if (onlineIds.size() == 1) {
|
||||||
// chat with the online ssl id
|
// chat with the online ssl id
|
||||||
getChat(onlineIds.front(), forceFocus ? RS_CHAT_OPEN | RS_CHAT_FOCUS : RS_CHAT_OPEN);
|
chatFriend(onlineIds.front(), forceFocus);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// more than one ssl ids online or all offline
|
// more than one ssl ids online or all offline
|
||||||
QMessageBox mb(QMessageBox::Warning, "RetroShare", tr("Your friend has more than one locations.\nPlease choose one of it to chat with."), QMessageBox::Ok);
|
QMessageBox mb(QMessageBox::Warning, "RetroShare", tr("Your friend has more than one locations.\nPlease choose one of it to chat with."), QMessageBox::Ok);
|
||||||
mb.exec();
|
mb.exec();
|
||||||
} else {
|
|
||||||
getChat(peerId, forceFocus ? RS_CHAT_OPEN | RS_CHAT_FOCUS : RS_CHAT_OPEN);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatDialog::addToParent(QWidget *newParent)
|
void ChatDialog::addToParent(QWidget *newParent)
|
||||||
|
@ -38,6 +38,7 @@ public:
|
|||||||
static ChatDialog *getChat(const RsPeerId &peerId, uint chatflags);
|
static ChatDialog *getChat(const RsPeerId &peerId, uint chatflags);
|
||||||
static void cleanupChat();
|
static void cleanupChat();
|
||||||
static void chatFriend(const RsPeerId &peerId, bool forceFocus = true);
|
static void chatFriend(const RsPeerId &peerId, bool forceFocus = true);
|
||||||
|
static void chatFriend(const RsPgpId &gpgId, bool forceFocus = true);
|
||||||
static void closeChat(const RsPeerId &peerId);
|
static void closeChat(const RsPeerId &peerId);
|
||||||
static void chatChanged(int list, int type);
|
static void chatChanged(int list, int type);
|
||||||
|
|
||||||
|
@ -1278,14 +1278,22 @@ void FriendList::chatfriendproxy()
|
|||||||
*
|
*
|
||||||
* @param pPeer the gpg or ssl QTreeWidgetItem to chat with
|
* @param pPeer the gpg or ssl QTreeWidgetItem to chat with
|
||||||
*/
|
*/
|
||||||
void FriendList::chatfriend(QTreeWidgetItem *pPeer)
|
void FriendList::chatfriend(QTreeWidgetItem *item)
|
||||||
{
|
{
|
||||||
if (pPeer == NULL) {
|
if (item == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string id = getRsId(pPeer);
|
switch (item->type()) {
|
||||||
ChatDialog::chatFriend(RsPeerId(id));
|
case TYPE_GROUP:
|
||||||
|
break;
|
||||||
|
case TYPE_GPG:
|
||||||
|
ChatDialog::chatFriend(RsPgpId(getRsId(item)));
|
||||||
|
break;
|
||||||
|
case TYPE_SSL:
|
||||||
|
ChatDialog::chatFriend(RsPeerId(getRsId(item)));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendList::addFriend()
|
void FriendList::addFriend()
|
||||||
|
@ -138,7 +138,7 @@ private slots:
|
|||||||
|
|
||||||
void connectfriend();
|
void connectfriend();
|
||||||
void configurefriend();
|
void configurefriend();
|
||||||
void chatfriend(QTreeWidgetItem *);
|
void chatfriend(QTreeWidgetItem *item);
|
||||||
void chatfriendproxy();
|
void chatfriendproxy();
|
||||||
//void copyLink();
|
//void copyLink();
|
||||||
void copyFullCertificate();
|
void copyFullCertificate();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user