mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-08 17:15:16 -04:00
Distant messages GUI code. Now the GUI can receive/send/decrypt distant messages. Since the protocols are not finalized, the GUI is disabled, to avoid later crashes
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6549 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
a570f66e79
commit
3f86a707b7
11 changed files with 259 additions and 62 deletions
|
@ -209,7 +209,8 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WFlags flags)
|
|||
/* initialize friends list */
|
||||
ui.friendSelectionWidget->setHeaderText(tr("Send To:"));
|
||||
ui.friendSelectionWidget->setModus(FriendSelectionWidget::MODUS_MULTI);
|
||||
ui.friendSelectionWidget->setShowType(FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_SSL);
|
||||
//ui.friendSelectionWidget->setShowType(FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_SSL | FriendSelectionWidget::SHOW_NON_FRIEND_GPG );
|
||||
ui.friendSelectionWidget->setShowType(FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_SSL );
|
||||
ui.friendSelectionWidget->start();
|
||||
|
||||
QActionGroup *grp = new QActionGroup(this);
|
||||
|
@ -1406,8 +1407,10 @@ void MessageComposer::setRecipientToRow(int row, enumType type, std::string id,
|
|||
|
||||
QIcon icon;
|
||||
QString name;
|
||||
if (id.empty() == FALSE) {
|
||||
if (group) {
|
||||
if (!id.empty())
|
||||
{
|
||||
if (group)
|
||||
{
|
||||
icon = QIcon(IMAGE_GROUP16);
|
||||
|
||||
RsGroupInfo groupInfo;
|
||||
|
@ -1417,28 +1420,39 @@ void MessageComposer::setRecipientToRow(int row, enumType type, std::string id,
|
|||
name = tr("Unknown");
|
||||
id.clear();
|
||||
}
|
||||
} else {
|
||||
RsPeerDetails details;
|
||||
if(_distant_peers.find(id) != _distant_peers.end())
|
||||
{
|
||||
name = tr("Distant peer (PGP key: %1)").arg(QString::fromStdString(_distant_peers[id])) ;
|
||||
icon = QIcon(StatusDefs::imageUser(RS_STATUS_ONLINE));
|
||||
}
|
||||
else if (rsPeers->getPeerDetails(id, details))
|
||||
{
|
||||
name = PeerDefs::nameWithLocation(details);
|
||||
}
|
||||
else
|
||||
{
|
||||
RsPeerDetails details;
|
||||
|
||||
StatusInfo peerStatusInfo;
|
||||
// No check of return value. Non existing status info is handled as offline.
|
||||
rsStatus->getStatus(id, peerStatusInfo);
|
||||
if(_distant_peers.find(id) != _distant_peers.end())
|
||||
{
|
||||
if(!rsPeers->getPeerDetails(_distant_peers[id], details))
|
||||
{
|
||||
std::cerr << "Can't get peer details from " << _distant_peers[id] << std::endl;
|
||||
return ;
|
||||
}
|
||||
|
||||
icon = QIcon(StatusDefs::imageUser(peerStatusInfo.status));
|
||||
} else {
|
||||
icon = QIcon(StatusDefs::imageUser(RS_STATUS_OFFLINE));
|
||||
name = tr("Unknown friend");
|
||||
id.clear();
|
||||
}
|
||||
}
|
||||
name = tr("Distant peer (name: %2, PGP key: %1)").arg(QString::fromStdString(_distant_peers[id])).arg(QString::fromStdString(details.name)) ;
|
||||
icon = QIcon(StatusDefs::imageUser(RS_STATUS_ONLINE));
|
||||
}
|
||||
else if(rsPeers->getPeerDetails(id, details) && (!details.isOnlyGPGdetail))
|
||||
{
|
||||
name = PeerDefs::nameWithLocation(details);
|
||||
|
||||
StatusInfo peerStatusInfo;
|
||||
// No check of return value. Non existing status info is handled as offline.
|
||||
rsStatus->getStatus(id, peerStatusInfo);
|
||||
|
||||
icon = QIcon(StatusDefs::imageUser(peerStatusInfo.status));
|
||||
}
|
||||
else
|
||||
{
|
||||
icon = QIcon(StatusDefs::imageUser(RS_STATUS_OFFLINE));
|
||||
name = tr("Unknown friend");
|
||||
id.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
comboBox->setCurrentIndex(comboBox->findData(type, Qt::UserRole));
|
||||
|
@ -2291,6 +2305,16 @@ void MessageComposer::addContact(enumType type)
|
|||
for (idIt = ids.begin(); idIt != ids.end(); idIt++) {
|
||||
addRecipient(type, *idIt, false);
|
||||
}
|
||||
|
||||
ids.empty();
|
||||
ui.friendSelectionWidget->selectedGpgIds(ids, true);
|
||||
for (idIt = ids.begin(); idIt != ids.end(); idIt++)
|
||||
{
|
||||
std::string hash ;
|
||||
|
||||
if(rsMsgs->getDistantMessageHash(*idIt,hash))
|
||||
addRecipient(type, hash, *idIt);
|
||||
}
|
||||
}
|
||||
|
||||
void MessageComposer::addTo()
|
||||
|
|
|
@ -50,6 +50,7 @@ public:
|
|||
|
||||
static void msgFriend(const std::string &id, bool group);
|
||||
static void msgDistantPeer(const std::string& hash,const std::string& pgp_id) ;
|
||||
static void msgDistantPeer(const std::string& pgp_id) ;
|
||||
|
||||
static QString recommendMessage();
|
||||
static void recommendFriend(const std::list <std::string> &sslIds, const std::string &to = "", const QString &msg = "", bool autoSend = false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue