mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-24 05:49:29 -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
|
@ -1493,7 +1493,7 @@ void MessagesDialog::decryptSelectedMsg()
|
|||
|
||||
if(!msgInfo.msgflags & RS_MSG_ENCRYPTED)
|
||||
{
|
||||
std::cerr << "This message is not encrypted! Cannot decrypt!" << std::endl;
|
||||
QMessageBox::warning(NULL,tr("Decryption failed!"),tr("This message is not encrypted. Cannot decrypt!")) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
|
@ -1501,7 +1501,16 @@ void MessagesDialog::decryptSelectedMsg()
|
|||
QMessageBox::warning(NULL,tr("Decryption failed!"),tr("This message could not be decrypted.")) ;
|
||||
|
||||
//setMsgAsReadUnread(currentIndex.row(), true);
|
||||
timer->start();
|
||||
|
||||
updateMessageSummaryList();
|
||||
|
||||
//QModelIndex currentIndex = ui.messagestreeView->currentIndex();
|
||||
//QModelIndex index = ui.messagestreeView->model()->index(currentIndex.row(), COLUMN_UNREAD, currentIndex.parent());
|
||||
//currentChanged(index);
|
||||
|
||||
MessagesModel->removeRows (0, MessagesModel->rowCount());
|
||||
|
||||
insertMessages();
|
||||
insertMsgTxtAndFiles();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -25,9 +25,7 @@
|
|||
|
||||
#include "MessagePage.h"
|
||||
#include "gui/common/TagDefs.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "NewTag.h"
|
||||
|
||||
MessagePage::MessagePage(QWidget * parent, Qt::WFlags flags)
|
||||
|
@ -41,6 +39,7 @@ MessagePage::MessagePage(QWidget * parent, Qt::WFlags flags)
|
|||
connect (ui.editpushButton, SIGNAL(clicked(bool)), this, SLOT (editTag()));
|
||||
connect (ui.deletepushButton, SIGNAL(clicked(bool)), this, SLOT (deleteTag()));
|
||||
connect (ui.defaultTagButton, SIGNAL(clicked(bool)), this, SLOT (defaultTag()));
|
||||
connect (ui.encryptedMsgs_CB, SIGNAL(toggled(bool)), this, SLOT (toggleEnableEncryptedDistantMsgs(bool)));
|
||||
|
||||
connect (ui.tags_listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(currentRowChangedTag(int)));
|
||||
|
||||
|
@ -49,6 +48,8 @@ MessagePage::MessagePage(QWidget * parent, Qt::WFlags flags)
|
|||
|
||||
ui.openComboBox->addItem(tr("A new tab"), RshareSettings::MSG_OPEN_TAB);
|
||||
ui.openComboBox->addItem(tr("A new window"), RshareSettings::MSG_OPEN_WINDOW);
|
||||
|
||||
ui.encryptedMsgs_CB->setEnabled(false) ;
|
||||
}
|
||||
|
||||
MessagePage::~MessagePage()
|
||||
|
@ -56,6 +57,11 @@ MessagePage::~MessagePage()
|
|||
delete(m_pTags);
|
||||
}
|
||||
|
||||
void MessagePage::toggleEnableEncryptedDistantMsgs(bool b)
|
||||
{
|
||||
rsMsgs->enableDistantMessaging(b) ;
|
||||
}
|
||||
|
||||
/** Saves the changes on this page */
|
||||
bool
|
||||
MessagePage::save(QString &/*errmsg*/)
|
||||
|
@ -91,6 +97,7 @@ MessagePage::load()
|
|||
ui.setMsgToReadOnActivate->setChecked(Settings->getMsgSetToReadOnActivate());
|
||||
ui.openComboBox->setCurrentIndex(ui.openComboBox->findData(Settings->getMsgOpen()));
|
||||
|
||||
ui.encryptedMsgs_CB->setChecked(rsMsgs->distantMessagingEnabled()) ;
|
||||
// fill items
|
||||
rsMsgs->getMessageTagTypes(*m_pTags);
|
||||
fillTags();
|
||||
|
|
|
@ -53,6 +53,7 @@ private slots:
|
|||
void defaultTag();
|
||||
|
||||
void currentRowChangedTag(int row);
|
||||
void toggleEnableEncryptedDistantMsgs(bool) ;
|
||||
|
||||
private:
|
||||
void fillTags();
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>423</width>
|
||||
<height>340</height>
|
||||
<width>500</width>
|
||||
<height>485</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -16,8 +16,8 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Reading</string>
|
||||
|
@ -47,7 +47,33 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Distant messages:</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="justify">The link below allows people in the network to send encrypted messages to you, using tunnels. To do that, they need your public PGP key, which they will get using the Retroshare discovery system. </p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="encryptedMsgs_CB">
|
||||
<property name="text">
|
||||
<string>Accept encrypted distant messages from everyone</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Tags</string>
|
||||
|
@ -60,6 +86,22 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" rowspan="6">
|
||||
<widget class="QListWidget" name="tags_listWidget"/>
|
||||
</item>
|
||||
|
@ -104,22 +146,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue