diff --git a/retroshare-gui/src/gui/chat/ChatDialog.cpp b/retroshare-gui/src/gui/chat/ChatDialog.cpp index f9f3a345f..2a87944ab 100644 --- a/retroshare-gui/src/gui/chat/ChatDialog.cpp +++ b/retroshare-gui/src/gui/chat/ChatDialog.cpp @@ -22,6 +22,8 @@ #include #include +#include +#include #include "ChatDialog.h" #include "gui/common/PeerDefs.h" @@ -254,9 +256,20 @@ void ChatDialog::init(ChatId id, const QString &title) return; } - // more than one ssl ids online or all offline - QMessageBox mb(QMessageBox::Warning, "RetroShare", tr("Your friend has more than one nodes.\nPlease choose one of it to chat with."), QMessageBox::Ok); - mb.exec(); + // show menu with online locations + QMenu menu; + QLabel* label = new QLabel("Select one of your friends locations to chat with"); + QWidgetAction *widgetAction = new QWidgetAction(&menu); + widgetAction->setDefaultWidget(label); + menu.addAction(widgetAction); + QObject cleanupchildren; + for(std::list::iterator it = onlineIds.begin(); it != onlineIds.end(); ++it) + { + RsPeerDetails detail; + rsPeers->getPeerDetails(*it, detail); + menu.addAction(QString::fromUtf8(detail.location.c_str()), new ChatFriendMethod(&cleanupchildren, *it), SLOT(chatFriend())); + } + menu.exec(QCursor::pos()); } void ChatDialog::addToParent(QWidget *newParent) diff --git a/retroshare-gui/src/gui/chat/ChatDialog.h b/retroshare-gui/src/gui/chat/ChatDialog.h index 86c3ccba3..f6b4ae57e 100644 --- a/retroshare-gui/src/gui/chat/ChatDialog.h +++ b/retroshare-gui/src/gui/chat/ChatDialog.h @@ -90,4 +90,15 @@ protected: ChatId mChatId; }; +class ChatFriendMethod: public QObject +{ + Q_OBJECT +public: + ChatFriendMethod(QObject* parent, RsPeerId peerId): QObject(parent), mPeerId(peerId){} +public slots: + void chatFriend(){ChatDialog::chatFriend(ChatId(mPeerId));} +private: + RsPeerId mPeerId; +}; + #endif // CHATDIALOG_H