mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-24 22:30:42 -04:00
replaced multiple location warning with a location selector menu
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8311 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
6b87ca2414
commit
6b2cdaf9e1
2 changed files with 27 additions and 3 deletions
|
@ -22,6 +22,8 @@
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QWidgetAction>
|
||||||
|
|
||||||
#include "ChatDialog.h"
|
#include "ChatDialog.h"
|
||||||
#include "gui/common/PeerDefs.h"
|
#include "gui/common/PeerDefs.h"
|
||||||
|
@ -254,9 +256,20 @@ void ChatDialog::init(ChatId id, const QString &title)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// more than one ssl ids online or all offline
|
// show menu with online locations
|
||||||
QMessageBox mb(QMessageBox::Warning, "RetroShare", tr("Your friend has more than one nodes.\nPlease choose one of it to chat with."), QMessageBox::Ok);
|
QMenu menu;
|
||||||
mb.exec();
|
QLabel* label = new QLabel("<strong>Select one of your friends locations to chat with</strong>");
|
||||||
|
QWidgetAction *widgetAction = new QWidgetAction(&menu);
|
||||||
|
widgetAction->setDefaultWidget(label);
|
||||||
|
menu.addAction(widgetAction);
|
||||||
|
QObject cleanupchildren;
|
||||||
|
for(std::list<RsPeerId>::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)
|
void ChatDialog::addToParent(QWidget *newParent)
|
||||||
|
|
|
@ -90,4 +90,15 @@ protected:
|
||||||
ChatId mChatId;
|
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
|
#endif // CHATDIALOG_H
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue