diff --git a/libretroshare/src/services/p3msgservice.cc b/libretroshare/src/services/p3msgservice.cc
index 73be85bb9..4dfa6ad08 100644
--- a/libretroshare/src/services/p3msgservice.cc
+++ b/libretroshare/src/services/p3msgservice.cc
@@ -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 ;
}
diff --git a/retroshare-gui/src/gui/MessagesDialog.cpp b/retroshare-gui/src/gui/MessagesDialog.cpp
index 6b1719295..7d6cd68b9 100644
--- a/retroshare-gui/src/gui/MessagesDialog.cpp
+++ b/retroshare-gui/src/gui/MessagesDialog.cpp
@@ -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)
diff --git a/retroshare-gui/src/gui/msgs/MessageWidget.cpp b/retroshare-gui/src/gui/msgs/MessageWidget.cpp
index 5a07dd075..dcead1499 100644
--- a/retroshare-gui/src/gui/msgs/MessageWidget.cpp
+++ b/retroshare-gui/src/gui/msgs/MessageWidget.cpp
@@ -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;
+}
diff --git a/retroshare-gui/src/gui/msgs/MessageWidget.h b/retroshare-gui/src/gui/msgs/MessageWidget.h
index c36d1e9b3..24418acf1 100644
--- a/retroshare-gui/src/gui/msgs/MessageWidget.h
+++ b/retroshare-gui/src/gui/msgs/MessageWidget.h
@@ -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();
diff --git a/retroshare-gui/src/gui/msgs/MessageWidget.ui b/retroshare-gui/src/gui/msgs/MessageWidget.ui
index c9afa96c0..8ae5c3d58 100644
--- a/retroshare-gui/src/gui/msgs/MessageWidget.ui
+++ b/retroshare-gui/src/gui/msgs/MessageWidget.ui
@@ -336,6 +336,125 @@
+ -
+
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 204
+ 255
+ 204
+
+
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 204
+ 255
+ 204
+
+
+
+
+
+
+
+
+ 204
+ 255
+ 204
+
+
+
+
+
+
+ 204
+ 255
+ 204
+
+
+
+
+
+
+
+ true
+
+
+ QFrame::Box
+
+
+
+ 6
+
+
+ 6
+
+
-
+
+
+
+
+
+ :/images/mail-encrypted-full.png
+
+
+
+ -
+
+
+ This messages is encrypted. Click the right button to decrypt it.
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 280
+ 20
+
+
+
+
+ -
+
+
+ Decrypt
+
+
+
+
+
+
-
diff --git a/retroshare-gui/src/gui/notifyqt.cpp b/retroshare-gui/src/gui/notifyqt.cpp
index 2b808765a..7801780f1 100644
--- a/retroshare-gui/src/gui/notifyqt.cpp
+++ b/retroshare-gui/src/gui/notifyqt.cpp
@@ -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:
diff --git a/retroshare-gui/src/gui/qss/stylesheet/Standard.qss b/retroshare-gui/src/gui/qss/stylesheet/Standard.qss
index ad9e35d41..10b50daf3 100644
--- a/retroshare-gui/src/gui/qss/stylesheet/Standard.qss
+++ b/retroshare-gui/src/gui/qss/stylesheet/Standard.qss
@@ -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);
+}
diff --git a/retroshare-gui/src/lang/retroshare_en.ts b/retroshare-gui/src/lang/retroshare_en.ts
index 36dcde342..6cefecd83 100644
--- a/retroshare-gui/src/lang/retroshare_en.ts
+++ b/retroshare-gui/src/lang/retroshare_en.ts
@@ -1563,22 +1563,6 @@ Double click lobbies to enter and chat.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1695,6 +1679,30 @@ Double click lobbies to enter and chat.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
ChatStyle
@@ -5815,14 +5823,6 @@ p, li { white-space: pre-wrap; }
-
-
-
-
-
-
-
-
@@ -5895,6 +5895,10 @@ p, li { white-space: pre-wrap; }
+
+
+
+
FriendRequestToaster
@@ -9103,6 +9107,30 @@ Do you want to save message ?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
MessageWindow
@@ -9501,14 +9529,6 @@ Do you want to save message ?
-
-
-
-
-
-
-
-
@@ -9529,10 +9549,6 @@ Do you want to save message ?
-
-
-
-
@@ -12597,18 +12613,6 @@ The default value is 20.
-
-
-
-
@@ -12681,6 +12685,10 @@ p, li { white-space: pre-wrap; }
+
+
+
+
SharedFilesDialog