mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-24 23:19:29 -05:00
Added info widget for encrypted messages in MessageWidget.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6774 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
40ed94f7fb
commit
4dd77457ad
@ -2044,6 +2044,7 @@ bool p3MsgService::decryptMessage(const std::string& mId)
|
||||
delete item ;
|
||||
|
||||
IndicateConfigChanged() ;
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
@ -727,7 +727,7 @@ void MessagesDialog::changeBox(int)
|
||||
listMode = LIST_BOX;
|
||||
|
||||
insertMessages();
|
||||
insertMsgTxtAndFiles();
|
||||
insertMsgTxtAndFiles(ui.messagestreeView->currentIndex());
|
||||
|
||||
inChange = false;
|
||||
}
|
||||
@ -749,7 +749,7 @@ void MessagesDialog::changeQuickView(int newrow)
|
||||
listMode = LIST_QUICKVIEW;
|
||||
|
||||
insertMessages();
|
||||
insertMsgTxtAndFiles();
|
||||
insertMsgTxtAndFiles(ui.messagestreeView->currentIndex());
|
||||
|
||||
inChange = false;
|
||||
}
|
||||
@ -1516,33 +1516,15 @@ void MessagesDialog::insertMsgTxtAndFiles(QModelIndex Index, bool bSetToRead)
|
||||
|
||||
void MessagesDialog::decryptSelectedMsg()
|
||||
{
|
||||
MessageInfo msgInfo;
|
||||
if (!MessageWidget::decryptMsg(mCurrMsgId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!rsMsgs->getMessage(mCurrMsgId, msgInfo))
|
||||
return ;
|
||||
// Force refill
|
||||
mCurrMsgId.clear();
|
||||
msgWidget->fill("");
|
||||
|
||||
if(!msgInfo.msgflags & RS_MSG_ENCRYPTED)
|
||||
{
|
||||
QMessageBox::warning(NULL,tr("Decryption failed!"),tr("This message is not encrypted. Cannot decrypt!")) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
if(!rsMsgs->decryptMessage(mCurrMsgId) )
|
||||
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();
|
||||
insertMsgTxtAndFiles(ui.messagestreeView->currentIndex());
|
||||
}
|
||||
|
||||
bool MessagesDialog::getCurrentMsg(std::string &cid, std::string &mid)
|
||||
|
@ -131,12 +131,14 @@ MessageWidget::MessageWidget(bool controlled, QWidget *parent, Qt::WFlags flags)
|
||||
connect(ui.expandFilesButton, SIGNAL(clicked()), this, SLOT(togglefileview()));
|
||||
connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(getallrecommended()));
|
||||
connect(ui.msgText, SIGNAL(anchorClicked(QUrl)), this, SLOT(anchorClicked(QUrl)));
|
||||
connect(ui.decryptButton, SIGNAL(clicked()), this, SLOT(decrypt()));
|
||||
|
||||
connect(NotifyQt::getInstance(), SIGNAL(messagesTagsChanged()), this, SLOT(messagesTagsChanged()));
|
||||
connect(NotifyQt::getInstance(), SIGNAL(messagesChanged()), this, SLOT(messagesChanged()));
|
||||
|
||||
ui.imageBlockWidget->addButtonAction(tr("Load images always for this message"), this, SLOT(loadImagesAlways()), true);
|
||||
ui.msgText->setImageBlockWidget(ui.imageBlockWidget);
|
||||
ui.decryptFrame->hide();
|
||||
|
||||
/* hide the Tree +/- */
|
||||
ui.msgList->setRootIsDecorated( false );
|
||||
@ -435,6 +437,8 @@ void MessageWidget::fill(const std::string &msgId)
|
||||
return;
|
||||
}
|
||||
|
||||
ui.decryptFrame->hide();
|
||||
|
||||
currMsgId = msgId;
|
||||
|
||||
if (currMsgId.empty()) {
|
||||
@ -558,7 +562,11 @@ void MessageWidget::fill(const std::string &msgId)
|
||||
ui.fromText->setToolTip(PeerDefs::rsidFromId(srcId));
|
||||
}
|
||||
|
||||
ui.subjectText->setText(QString::fromStdWString(msgInfo.title));
|
||||
if (msgInfo.msgflags & RS_MSG_ENCRYPTED) {
|
||||
ui.subjectText->setText(tr("Encrypted message"));
|
||||
} else {
|
||||
ui.subjectText->setText(QString::fromStdWString(msgInfo.title));
|
||||
}
|
||||
|
||||
text = RsHtmlMsg(msgInfo.msgflags).formatText(ui.msgText->document(), QString::fromStdWString(msgInfo.msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS | RSHTML_FORMATTEXT_REPLACE_LINKS);
|
||||
ui.msgText->resetImagesStatus(Settings->getMsgLoadEmbeddedImages() || (msgInfo.msgflags & RS_MSG_LOAD_EMBEDDED_IMAGES));
|
||||
@ -566,6 +574,10 @@ void MessageWidget::fill(const std::string &msgId)
|
||||
|
||||
ui.filesText->setText(QString("(%1 %2)").arg(msgInfo.count).arg(msgInfo.count == 1 ? tr("File") : tr("Files")));
|
||||
|
||||
if (msgInfo.msgflags & RS_MSG_ENCRYPTED) {
|
||||
ui.decryptFrame->show();
|
||||
}
|
||||
|
||||
showTagLabels();
|
||||
|
||||
currMsgFlags = msgInfo.msgflags;
|
||||
@ -723,3 +735,40 @@ void MessageWidget::loadImagesAlways()
|
||||
|
||||
rsMsgs->MessageLoadEmbeddedImages(currMsgId, true);
|
||||
}
|
||||
|
||||
void MessageWidget::decrypt()
|
||||
{
|
||||
if (!decryptMsg(currMsgId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Force refill
|
||||
std::string msgId = currMsgId;
|
||||
currMsgId.clear();
|
||||
|
||||
fill(msgId);
|
||||
}
|
||||
|
||||
bool MessageWidget::decryptMsg(const std::string &msgId)
|
||||
{
|
||||
if (msgId.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
MessageInfo msgInfo;
|
||||
if (!rsMsgs->getMessage(msgId, msgInfo)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(msgInfo.msgflags & RS_MSG_ENCRYPTED)) {
|
||||
QMessageBox::warning(NULL, tr("Decryption failed!"), tr("This message is not encrypted. Cannot decrypt!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!rsMsgs->decryptMessage(msgId)) {
|
||||
QMessageBox::warning(NULL, tr("Decryption failed!"), tr("This message could not be decrypted."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -59,6 +59,8 @@ public:
|
||||
|
||||
QString subject(bool noEmpty);
|
||||
|
||||
static bool decryptMsg(const std::string &msgId);
|
||||
|
||||
private slots:
|
||||
void reply();
|
||||
void replyAll();
|
||||
@ -79,6 +81,7 @@ private slots:
|
||||
void anchorClicked(const QUrl &url);
|
||||
|
||||
void loadImagesAlways();
|
||||
void decrypt();
|
||||
|
||||
private:
|
||||
void clearTagLabels();
|
||||
|
@ -336,6 +336,125 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="decryptFrame">
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>204</red>
|
||||
<green>255</green>
|
||||
<blue>204</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>204</red>
|
||||
<green>255</green>
|
||||
<blue>204</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>204</red>
|
||||
<green>255</green>
|
||||
<blue>204</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>204</red>
|
||||
<green>255</green>
|
||||
<blue>204</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="decryptImage">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../images.qrc">:/images/mail-encrypted-full.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="decryptLabel">
|
||||
<property name="text">
|
||||
<string>This messages is encrypted. Click the right button to decrypt it.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>280</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="decryptButton">
|
||||
<property name="text">
|
||||
<string>Decrypt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="RSTextBrowser" name="msgText">
|
||||
<property name="sizePolicy">
|
||||
|
@ -780,7 +780,7 @@ void NotifyQt::UpdateGUI()
|
||||
|
||||
if (popupflags & RS_POPUP_MSG)
|
||||
{
|
||||
toaster = new Toaster(new MessageToaster(std::string(), tr("Unknown title"), QString("[%1]").arg(tr("Encrypted message"))));
|
||||
toaster = new Toaster(new MessageToaster(std::string(), tr("Encrypted message"), QString("[%1]").arg(tr("Encrypted message"))));
|
||||
}
|
||||
break;
|
||||
case RS_POPUP_MSG:
|
||||
|
@ -490,3 +490,12 @@ ShareManager QLabel#labelInstructions {
|
||||
background: #FFFFD7;
|
||||
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFFFD7, stop:1 #FFFFB2);
|
||||
}
|
||||
|
||||
/* MessageWidget */
|
||||
|
||||
MessageWidget QFrame#decryptFrame {
|
||||
border: 1px solid #50FF5B;
|
||||
border-radius: 6px;
|
||||
background: #CCFFCC;
|
||||
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #CCFFCC, stop:1 #AAFFAA);
|
||||
}
|
||||
|
@ -1563,22 +1563,6 @@ Double click lobbies to enter and chat.</source>
|
||||
<source>History</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Group Chat</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Number of saved messages (0 = unlimited)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Load number of messages (0 = off)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Style</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -1695,6 +1679,30 @@ Double click lobbies to enter and chat.</source>
|
||||
<source>Private chat invite to </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source><html><head/><body><p align="justify">In this tab you can setup how many chat messages Retroshare will keep saved on the disc and how much of the previous conversation it will display, for the different chat systems. The max storage period allows to discard old messages and prevents the chat history from filling up with volatile chat (e.g. chat lobbies and distant chat).</p></body></html></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Chatlobbies</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enabled:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Saved messages (0 = unlimited):</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Number of messages restored (0 = off):</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Maximum storage period, in days:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ChatStyle</name>
|
||||
@ -5815,14 +5823,6 @@ p, li { white-space: pre-wrap; }
|
||||
<source>Copy certificate link</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Copy RetroShare Link</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Paste Friend Link</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Deny Friend</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -5895,6 +5895,10 @@ p, li { white-space: pre-wrap; }
|
||||
<source>Display</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Paste certificate link</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FriendRequestToaster</name>
|
||||
@ -9103,6 +9107,30 @@ Do you want to save message ?</source>
|
||||
<source>Load images always for this message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This messages is encrypted. Click the right button to decrypt it.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Decrypt</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Encrypted message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Decryption failed!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This message is not encrypted. Cannot decrypt!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This message could not be decrypted.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MessageWindow</name>
|
||||
@ -9501,14 +9529,6 @@ Do you want to save message ?</source>
|
||||
<source>Encrypted message. Right-click to decrypt it.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Decryption failed!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This message could not be decrypted.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Messages</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -9529,10 +9549,6 @@ Do you want to save message ?</source>
|
||||
<source>This message was signed but the signature doesn't check</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This message is not encrypted. Cannot decrypt!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> <h1><img width="32" src=":/images/64px_help.png">&nbsp;&nbsp;Messages</h1> <p>Messages are like <b>e-mail</b>: you send/receive them from your friends when both of you are connected.</p> <p>It is also possible to send messages to non friends, using tunnels. Such messages are always encrypted. It is recommended to cryptographically sign distant messages, as a proof of your identity, using the <img width="16" src=":/images/stock_signature_ok.png"/> button in the message composer window. Distant messages are not guarrantied to arrive, since this requires the distant peer to accept them (You need yourself to switch this on in Config-Messages).</p> <p>Some additional features allow you to exchange data in messages: you may recommend files to your friends by pasting file links, or recommend friends-to-be to other friends, in order to streathen your network.</p> </source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -12597,18 +12613,6 @@ The default value is 20.</source>
|
||||
<source>Shared Folder Manager</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">This is a list of shared folders. You can add and remove folders using the buttons at the bottom.</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">When you add a new folder, intially all files in that folder are shared.</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:8pt;">You can separately setup share flags for each shared directory:</span><span style=" font-size:8pt;"> </span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:8pt; font-weight:600;">Browsable</span><span style=" font-family:'Sans'; font-size:8pt;">: files are browsable from your direct friends.</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:8pt; font-weight:600;">Network Wide</span><span style=" font-family:'Sans'; font-size:8pt;">: files can be downloaded by anybody through anonymous tunnels.</span></p></body></html></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Directory</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -12681,6 +12685,10 @@ p, li { white-space: pre-wrap; }
|
||||
<source>Directory not found or directory name not accepted.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This is a list of shared folders. You can add and remove folders using the buttons at the bottom. When you add a new folder, intially all files in that folder are shared. You can separately setup share flags for each shared directory.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SharedFilesDialog</name>
|
||||
|
Loading…
Reference in New Issue
Block a user