diff --git a/libretroshare/src/retroshare/rsmsgs.h b/libretroshare/src/retroshare/rsmsgs.h
index 1aca4fd1a..614a99707 100644
--- a/libretroshare/src/retroshare/rsmsgs.h
+++ b/libretroshare/src/retroshare/rsmsgs.h
@@ -62,6 +62,7 @@
#define RS_MSG_SIGNED 0x004000 /* message was signed and signature didn't check */
#define RS_MSG_LOAD_EMBEDDED_IMAGES 0x008000 /* load embedded images */
#define RS_MSG_PUBLISH_KEY 0x020000 /* publish key */
+#define RS_MSG_SPAM 0x040000 /* Message is marked as spam */
#define RS_MSG_SYSTEM (RS_MSG_USER_REQUEST | RS_MSG_FRIEND_RECOMMENDATION | RS_MSG_PUBLISH_KEY)
@@ -703,6 +704,15 @@ public:
*/
virtual bool MessageStar(const std::string &msgId, bool mark) = 0;
+ /**
+ * @brief MessageJunk
+ * @jsonapi{development}
+ * @param[in] msgId
+ * @param[in] mark
+ * @return true on success
+ */
+ virtual bool MessageJunk(const std::string &msgId, bool mark) = 0;
+
/**
* @brief MessageLoadEmbeddedImages
* @jsonapi{development}
diff --git a/libretroshare/src/rsitems/rsmsgitems.h b/libretroshare/src/rsitems/rsmsgitems.h
index 7757288e7..27447aec0 100644
--- a/libretroshare/src/rsitems/rsmsgitems.h
+++ b/libretroshare/src/rsitems/rsmsgitems.h
@@ -68,6 +68,7 @@ const uint32_t RS_MSG_FLAGS_LOAD_EMBEDDED_IMAGES = 0x00040000;
const uint32_t RS_MSG_FLAGS_DECRYPTED = 0x00080000;
const uint32_t RS_MSG_FLAGS_ROUTED = 0x00100000;
const uint32_t RS_MSG_FLAGS_PUBLISH_KEY = 0x00200000;
+const uint32_t RS_MSG_FLAGS_SPAM = 0x00400000;
const uint32_t RS_MSG_FLAGS_SYSTEM = RS_MSG_FLAGS_USER_REQUEST | RS_MSG_FLAGS_FRIEND_RECOMMENDATION | RS_MSG_FLAGS_PUBLISH_KEY;
diff --git a/libretroshare/src/rsserver/p3msgs.cc b/libretroshare/src/rsserver/p3msgs.cc
index 48a694fb0..b877c0282 100644
--- a/libretroshare/src/rsserver/p3msgs.cc
+++ b/libretroshare/src/rsserver/p3msgs.cc
@@ -376,11 +376,15 @@ bool p3Msgs::getMessageTagTypes(MsgTagType& tags)
}
bool p3Msgs::MessageStar(const std::string &mid, bool star)
-
{
return mMsgSrv->setMsgFlag(mid, star ? RS_MSG_FLAGS_STAR : 0, RS_MSG_FLAGS_STAR);
}
+bool p3Msgs::MessageJunk(const std::string &mid, bool junk)
+{
+ return mMsgSrv->setMsgFlag(mid, junk ? RS_MSG_FLAGS_SPAM : 0, RS_MSG_FLAGS_SPAM);
+}
+
bool p3Msgs::setMessageTagType(uint32_t tagId, std::string& text, uint32_t rgb_color)
{
return mMsgSrv->setMessageTagType(tagId, text, rgb_color);
diff --git a/libretroshare/src/rsserver/p3msgs.h b/libretroshare/src/rsserver/p3msgs.h
index 955018d26..91d044ee5 100644
--- a/libretroshare/src/rsserver/p3msgs.h
+++ b/libretroshare/src/rsserver/p3msgs.h
@@ -78,6 +78,7 @@ public:
virtual bool MessageReplied(const std::string &mid, bool replied);
virtual bool MessageForwarded(const std::string &mid, bool forwarded);
virtual bool MessageStar(const std::string &mid, bool star);
+ virtual bool MessageJunk(const std::string &mid, bool junk);
virtual bool MessageLoadEmbeddedImages(const std::string &mid, bool load);
virtual bool getMsgParentId(const std::string &msgId, std::string &msgParentId);
diff --git a/libretroshare/src/services/p3msgservice.cc b/libretroshare/src/services/p3msgservice.cc
index a04ba5fce..01a825bb3 100644
--- a/libretroshare/src/services/p3msgservice.cc
+++ b/libretroshare/src/services/p3msgservice.cc
@@ -1737,6 +1737,7 @@ void p3MsgService::initRsMI(RsMsgItem *msg, MessageInfo &mi)
if (msg->msgFlags & RS_MSG_FLAGS_REPLIED) mi.msgflags |= RS_MSG_REPLIED;
if (msg->msgFlags & RS_MSG_FLAGS_FORWARDED) mi.msgflags |= RS_MSG_FORWARDED;
if (msg->msgFlags & RS_MSG_FLAGS_STAR) mi.msgflags |= RS_MSG_STAR;
+ if (msg->msgFlags & RS_MSG_FLAGS_SPAM) mi.msgflags |= RS_MSG_SPAM;
if (msg->msgFlags & RS_MSG_FLAGS_USER_REQUEST) mi.msgflags |= RS_MSG_USER_REQUEST;
if (msg->msgFlags & RS_MSG_FLAGS_FRIEND_RECOMMENDATION) mi.msgflags |= RS_MSG_FRIEND_RECOMMENDATION;
if (msg->msgFlags & RS_MSG_FLAGS_PUBLISH_KEY) mi.msgflags |= RS_MSG_PUBLISH_KEY;
@@ -1831,6 +1832,10 @@ void p3MsgService::initRsMIS(RsMsgItem *msg, MsgInfoSummary &mis)
{
mis.msgflags |= RS_MSG_STAR;
}
+ if (msg->msgFlags & RS_MSG_FLAGS_SPAM)
+ {
+ mis.msgflags |= RS_MSG_SPAM;
+ }
if (msg->msgFlags & RS_MSG_FLAGS_USER_REQUEST)
{
mis.msgflags |= RS_MSG_USER_REQUEST;
diff --git a/retroshare-gui/src/gui/images.qrc b/retroshare-gui/src/gui/images.qrc
index f33664066..52dbea31d 100644
--- a/retroshare-gui/src/gui/images.qrc
+++ b/retroshare-gui/src/gui/images.qrc
@@ -214,6 +214,9 @@
images/im-user-busy.png
images/im-user-inactive.png
images/informations_24x24.png
+ images/junk.png
+ images/junk_on.png
+ images/junk_off.png
images/connect_friend.png
images/kalarm.png
images/kbackgammon.png
diff --git a/retroshare-gui/src/gui/images/junk-on24.png b/retroshare-gui/src/gui/images/junk-on24.png
new file mode 100644
index 000000000..155c2a230
Binary files /dev/null and b/retroshare-gui/src/gui/images/junk-on24.png differ
diff --git a/retroshare-gui/src/gui/images/junk.png b/retroshare-gui/src/gui/images/junk.png
new file mode 100644
index 000000000..4fbd66128
Binary files /dev/null and b/retroshare-gui/src/gui/images/junk.png differ
diff --git a/retroshare-gui/src/gui/images/junk_off.png b/retroshare-gui/src/gui/images/junk_off.png
new file mode 100644
index 000000000..9b838c89f
Binary files /dev/null and b/retroshare-gui/src/gui/images/junk_off.png differ
diff --git a/retroshare-gui/src/gui/images/junk_on.png b/retroshare-gui/src/gui/images/junk_on.png
new file mode 100644
index 000000000..2a2beba9c
Binary files /dev/null and b/retroshare-gui/src/gui/images/junk_on.png differ
diff --git a/retroshare-gui/src/gui/msgs/MessageModel.cpp b/retroshare-gui/src/gui/msgs/MessageModel.cpp
index f5680effe..5e35a7c56 100644
--- a/retroshare-gui/src/gui/msgs/MessageModel.cpp
+++ b/retroshare-gui/src/gui/msgs/MessageModel.cpp
@@ -42,6 +42,9 @@
#define IMAGE_STAR_ON ":/images/star-on-16.png"
#define IMAGE_STAR_OFF ":/images/star-off-16.png"
+#define IMAGE_SPAM ":/images/junk.png"
+#define IMAGE_SPAM_ON ":/images/junk_on.png"
+#define IMAGE_SPAM_OFF ":/images/junk_off.png"
std::ostream& operator<<(std::ostream& o, const QModelIndex& i);// defined elsewhere
@@ -173,6 +176,7 @@ QVariant RsMessageModel::headerData(int section, Qt::Orientation orientation, in
switch(section)
{
case COLUMN_THREAD_STAR: return FilesDefs::getIconFromQtResourcePath(IMAGE_STAR_ON);
+ case COLUMN_THREAD_SPAM: return FilesDefs::getIconFromQtResourcePath(IMAGE_SPAM);
case COLUMN_THREAD_READ: return FilesDefs::getIconFromQtResourcePath(":/images/message-state-header.png");
case COLUMN_THREAD_ATTACHMENT: return FilesDefs::getIconFromQtResourcePath(":/icons/png/attachements.png");
default:
@@ -189,6 +193,7 @@ QVariant RsMessageModel::headerData(int section, Qt::Orientation orientation, in
case COLUMN_THREAD_DATE: return tr("Click to sort by date");
case COLUMN_THREAD_TAGS: return tr("Click to sort by tags");
case COLUMN_THREAD_STAR: return tr("Click to sort by star");
+ case COLUMN_THREAD_SPAM: return tr("Click to sort by junk status");
default:
return QVariant();
}
@@ -336,7 +341,8 @@ bool RsMessageModel::passesFilter(const Rs::Msgs::MsgInfoSummary& fmpe,int colum
(mQuickViewFilter==QUICK_VIEW_ALL)
|| (std::find(fmpe.msgtags.begin(),fmpe.msgtags.end(),mQuickViewFilter) != fmpe.msgtags.end())
|| (mQuickViewFilter==QUICK_VIEW_STARRED && (fmpe.msgflags & RS_MSG_STAR))
- || (mQuickViewFilter==QUICK_VIEW_SYSTEM && (fmpe.msgflags & RS_MSG_SYSTEM));
+ || (mQuickViewFilter==QUICK_VIEW_SYSTEM && (fmpe.msgflags & RS_MSG_SYSTEM))
+ || (mQuickViewFilter==QUICK_VIEW_SPAM && (fmpe.msgflags & RS_MSG_SPAM));
#ifdef DEBUG_MESSAGE_MODEL
std::cerr << "Passes filter: type=" << mFilterType << " s=\"" << s.toStdString() << "MsgFlags=" << fmpe.msgflags << " msgtags=" ;
foreach(uint32_t i,fmpe.msgtags) std::cerr << i << " " ;
@@ -434,6 +440,8 @@ QVariant RsMessageModel::sortRole(const Rs::Msgs::MsgInfoSummary& fmpe,int colum
case COLUMN_THREAD_STAR: return QVariant((fmpe.msgflags & RS_MSG_STAR)? 1:0);
+ case COLUMN_THREAD_SPAM: return QVariant((fmpe.msgflags & RS_MSG_SPAM)? 1:0);
+
case COLUMN_THREAD_AUTHOR:{
QString name;
@@ -453,6 +461,7 @@ QVariant RsMessageModel::displayRole(const Rs::Msgs::MsgInfoSummary& fmpe,int co
case COLUMN_THREAD_ATTACHMENT:return QVariant(QString::number(fmpe.count));
case COLUMN_THREAD_STAR:
+ case COLUMN_THREAD_SPAM:
case COLUMN_THREAD_READ:return QVariant();
case COLUMN_THREAD_DATE:{
QDateTime qtime;
@@ -551,6 +560,9 @@ QVariant RsMessageModel::decorationRole(const Rs::Msgs::MsgInfoSummary& fmpe,int
case COLUMN_THREAD_STAR:
return FilesDefs::getIconFromQtResourcePath((fmpe.msgflags & RS_MSG_STAR) ? (IMAGE_STAR_ON ): (IMAGE_STAR_OFF));
+ case COLUMN_THREAD_SPAM:
+ return FilesDefs::getIconFromQtResourcePath((fmpe.msgflags & RS_MSG_SPAM) ? (IMAGE_SPAM_ON ): (IMAGE_SPAM_OFF));
+
case COLUMN_THREAD_AUTHOR://Return icon as place holder.
return FilesDefs::getIconFromGxsIdCache(RsGxsId(fmpe.srcId.toStdString()),QIcon(), exist);
}
@@ -680,6 +692,15 @@ void RsMessageModel::setMsgStar(const QModelIndex& i,bool star)
emit dataChanged(i.sibling(i.row(),0),i.sibling(i.row(),COLUMN_THREAD_NB_COLUMNS-1));
}
+void RsMessageModel::setMsgJunk(const QModelIndex& i,bool junk)
+{
+ preMods();
+ rsMsgs->MessageJunk(i.data(MsgIdRole).toString().toStdString(),junk);
+
+ emit dataChanged(i.sibling(i.row(),0),i.sibling(i.row(),COLUMN_THREAD_NB_COLUMNS-1));
+}
+
+
QModelIndex RsMessageModel::getIndexOfMessage(const std::string& mid) const
{
// Brutal search. This is not so nice, so dont call that in a loop! If too costly, we'll use a map.
diff --git a/retroshare-gui/src/gui/msgs/MessageModel.h b/retroshare-gui/src/gui/msgs/MessageModel.h
index d6939fff1..262f53900 100644
--- a/retroshare-gui/src/gui/msgs/MessageModel.h
+++ b/retroshare-gui/src/gui/msgs/MessageModel.h
@@ -58,11 +58,12 @@ public:
COLUMN_THREAD_SUBJECT = 0x02,
COLUMN_THREAD_READ = 0x03,
COLUMN_THREAD_AUTHOR = 0x04,
- COLUMN_THREAD_DATE = 0x05,
- COLUMN_THREAD_TAGS = 0x06,
- COLUMN_THREAD_MSGID = 0x07,
- COLUMN_THREAD_NB_COLUMNS = 0x08,
- COLUMN_THREAD_CONTENT = 0x08,
+ COLUMN_THREAD_SPAM = 0x05,
+ COLUMN_THREAD_DATE = 0x06,
+ COLUMN_THREAD_TAGS = 0x07,
+ COLUMN_THREAD_MSGID = 0x08,
+ COLUMN_THREAD_NB_COLUMNS = 0x0a,
+ COLUMN_THREAD_CONTENT = 0x09
};
enum QuickViewFilter {
@@ -74,6 +75,7 @@ public:
QUICK_VIEW_LATER = 0x05,
QUICK_VIEW_STARRED = 0x06,
QUICK_VIEW_SYSTEM = 0x07,
+ QUICK_VIEW_SPAM = 0x08,
QUICK_VIEW_USER = 100
};
@@ -147,6 +149,7 @@ public:
// control over message flags and so on. This is handled by the model because it will allow it to update accordingly
void setMsgReadStatus(const QModelIndex& i, bool read_status);
void setMsgStar(const QModelIndex& index,bool star) ;
+ void setMsgJunk(const QModelIndex& index,bool junk) ;
public slots:
void updateMessages();
diff --git a/retroshare-gui/src/gui/msgs/MessagesDialog.cpp b/retroshare-gui/src/gui/msgs/MessagesDialog.cpp
index a53b582c5..5c73b2e67 100644
--- a/retroshare-gui/src/gui/msgs/MessagesDialog.cpp
+++ b/retroshare-gui/src/gui/msgs/MessagesDialog.cpp
@@ -61,6 +61,8 @@
#define IMAGE_DECRYPTMESSAGE ":/images/decrypt-mail.png"
#define IMAGE_AUTHOR_INFO ":/images/info16.png"
#define IMAGE_NOTFICATION ":/icons/notification.png"
+#define IMAGE_SPAM_ON ":/images/junk_on.png"
+#define IMAGE_SPAM_OFF ":/images/junk_off.png"
#define IMAGE_INBOX ":/images/folder-inbox.png"
#define IMAGE_OUTBOX ":/images/folder-outbox.png"
@@ -79,6 +81,7 @@
#define QUICKVIEW_STATIC_ID_STARRED 1
#define QUICKVIEW_STATIC_ID_SYSTEM 2
+#define QUICKVIEW_STATIC_ID_SPAM 3
#define ROW_INBOX 0
#define ROW_OUTBOX 1
@@ -194,6 +197,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
msgwheader->resizeSection (RsMessageModel::COLUMN_THREAD_STAR, fm.width('0')*1.5);
msgwheader->resizeSection (RsMessageModel::COLUMN_THREAD_ATTACHMENT, fm.width('0')*1.5);
msgwheader->resizeSection (RsMessageModel::COLUMN_THREAD_READ, fm.width('0')*1.5);
+ msgwheader->resizeSection (RsMessageModel::COLUMN_THREAD_SPAM, fm.width('0')*1.5);
msgwheader->resizeSection (RsMessageModel::COLUMN_THREAD_SUBJECT, fm.width("You have a message")*3.0);
msgwheader->resizeSection (RsMessageModel::COLUMN_THREAD_AUTHOR, fm.width("[Retroshare]")*1.1);
@@ -206,6 +210,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
QHeaderView_setSectionResizeModeColumn(msgwheader, RsMessageModel::COLUMN_THREAD_STAR, QHeaderView::Fixed);
QHeaderView_setSectionResizeModeColumn(msgwheader, RsMessageModel::COLUMN_THREAD_ATTACHMENT, QHeaderView::Fixed);
QHeaderView_setSectionResizeModeColumn(msgwheader, RsMessageModel::COLUMN_THREAD_READ, QHeaderView::Fixed);
+ QHeaderView_setSectionResizeModeColumn(msgwheader, RsMessageModel::COLUMN_THREAD_SPAM, QHeaderView::Fixed);
ui.messageTreeWidget->setSortingEnabled(true);
@@ -432,6 +437,16 @@ void MessagesDialog::fillQuickView()
itemToSelect = item;
}
+ item = new QListWidgetItem(tr("Spam"), ui.quickViewWidget);
+ item->setIcon(QIcon(IMAGE_SPAM_ON));
+ item->setData(ROLE_QUICKVIEW_TYPE, QUICKVIEW_TYPE_STATIC);
+ item->setData(ROLE_QUICKVIEW_ID, QUICKVIEW_STATIC_ID_SPAM);
+ item->setData(ROLE_QUICKVIEW_TEXT, item->text()); // for updateMessageSummaryList
+
+ if (selectedType == QUICKVIEW_TYPE_STATIC && selectedId == QUICKVIEW_STATIC_ID_SPAM) {
+ itemToSelect = item;
+ }
+
for (tag = tags.types.begin(); tag != tags.types.end(); ++tag) {
text = TagDefs::name(tag->first, tag->second.first);
@@ -469,7 +484,7 @@ int MessagesDialog::getSelectedMessages(QList& mid)
return mid.size();
}
-int MessagesDialog::getSelectedMsgCount (QList *items, QList *itemsRead, QList *itemsUnread, QList *itemsStar)
+int MessagesDialog::getSelectedMsgCount (QList *items, QList *itemsRead, QList *itemsUnread, QList *itemsStar, QList *itemsJunk)
{
QModelIndexList qmil = ui.messageTreeWidget->selectionModel()->selectedRows();
@@ -477,6 +492,7 @@ int MessagesDialog::getSelectedMsgCount (QList *items, QListclear();
if (itemsUnread) itemsUnread->clear();
if (itemsStar) itemsStar->clear();
+ if (itemsJunk) itemsJunk->clear();
foreach(const QModelIndex& m, qmil)
{
@@ -511,6 +527,14 @@ bool MessagesDialog::hasMessageStar(const QModelIndex& real_index)
return real_index.data(RsMessageModel::MsgFlagsRole).toInt() & RS_MSG_STAR;
}
+bool MessagesDialog::hasMessageSpam(const QModelIndex& real_index)
+{
+ if (!real_index.isValid())
+ return false;
+
+ return real_index.data(RsMessageModel::MsgFlagsRole).toInt() & RS_MSG_SPAM;
+}
+
void MessagesDialog::messageTreeWidgetCustomPopupMenu(QPoint /*point*/)
{
std::string cid;
@@ -529,8 +553,9 @@ void MessagesDialog::messageTreeWidgetCustomPopupMenu(QPoint /*point*/)
QList itemsRead;
QList itemsUnread;
QList itemsStar;
+ QList itemsJunk;
- int nCount = getSelectedMsgCount (NULL, &itemsRead, &itemsUnread, &itemsStar);
+ int nCount = getSelectedMsgCount (NULL, &itemsRead, &itemsUnread, &itemsStar, &itemsJunk);
/** Defines the actions for the context menu */
@@ -576,6 +601,11 @@ void MessagesDialog::messageTreeWidgetCustomPopupMenu(QPoint /*point*/)
action->setChecked(itemsStar.size());
connect(action, SIGNAL(triggered(bool)), this, SLOT(markWithStar(bool)));
+ action = contextMnu.addAction(tr("Mark as Junk"));
+ action->setCheckable(true);
+ action->setChecked(itemsStar.size());
+ connect(action, SIGNAL(triggered(bool)), this, SLOT(markWithJunk(bool)));
+
contextMnu.addSeparator();
// add tags
@@ -801,23 +831,27 @@ void MessagesDialog::changeQuickView(int newrow)
ui.tabWidget->setTabText(0, tr("System"));
ui.tabWidget->setTabIcon(0, QIcon(IMAGE_SYSTEM));
break;
- case 0x02: f = RsMessageModel::QUICK_VIEW_IMPORTANT;
+ case 0x02: f = RsMessageModel::QUICK_VIEW_SPAM ;
+ ui.tabWidget->setTabText(0, tr("Spam"));
+ ui.tabWidget->setTabIcon(0, QIcon(IMAGE_SPAM_ON));
+ break;
+ case 0x03: f = RsMessageModel::QUICK_VIEW_IMPORTANT;
ui.tabWidget->setTabText(0, tr("Important"));
ui.tabWidget->setTabIcon(0, QIcon(IMAGE_FOLDER));
break;
- case 0x03: f = RsMessageModel::QUICK_VIEW_WORK ;
+ case 0x04: f = RsMessageModel::QUICK_VIEW_WORK ;
ui.tabWidget->setTabText(0, tr("Work"));
ui.tabWidget->setTabIcon(0, QIcon(IMAGE_FOLDER));
break;
- case 0x04: f = RsMessageModel::QUICK_VIEW_PERSONAL ;
+ case 0x05: f = RsMessageModel::QUICK_VIEW_PERSONAL ;
ui.tabWidget->setTabText(0, tr("Personal"));
ui.tabWidget->setTabIcon(0, QIcon(IMAGE_FOLDER));
break;
- case 0x05: f = RsMessageModel::QUICK_VIEW_TODO ;
+ case 0x06: f = RsMessageModel::QUICK_VIEW_TODO ;
ui.tabWidget->setTabText(0, tr("Todo"));
ui.tabWidget->setTabIcon(0, QIcon(IMAGE_FOLDER));
break;
- case 0x06: f = RsMessageModel::QUICK_VIEW_LATER ;
+ case 0x07: f = RsMessageModel::QUICK_VIEW_LATER ;
ui.tabWidget->setTabText(0, tr("Later"));
ui.tabWidget->setTabIcon(0, QIcon(IMAGE_FOLDER));
break;
@@ -873,6 +907,11 @@ void MessagesDialog::clicked(const QModelIndex& proxy_index)
mMessageModel->setMsgStar(real_index, !hasMessageStar(proxy_index));
return;
}
+ case RsMessageModel::COLUMN_THREAD_SPAM:
+ {
+ mMessageModel->setMsgJunk(real_index, !hasMessageSpam(proxy_index));
+ return;
+ }
}
// show current message directly
@@ -921,7 +960,7 @@ void MessagesDialog::updateCurrentMessage()
void MessagesDialog::markAsRead()
{
QList itemsUnread;
- getSelectedMsgCount (NULL, NULL, &itemsUnread, NULL);
+ getSelectedMsgCount (NULL, NULL, &itemsUnread, NULL, NULL);
foreach(const QModelIndex& index,itemsUnread)
mMessageModel->setMsgReadStatus(index,true);
@@ -932,7 +971,7 @@ void MessagesDialog::markAsRead()
void MessagesDialog::markAsUnread()
{
QList itemsRead;
- getSelectedMsgCount (NULL, &itemsRead, NULL, NULL);
+ getSelectedMsgCount (NULL, &itemsRead, NULL, NULL, NULL);
foreach(const QModelIndex& index,itemsRead)
mMessageModel->setMsgReadStatus(index,false);
@@ -948,7 +987,13 @@ void MessagesDialog::markWithStar(bool checked)
mMessageModel->setMsgStar(index, checked);
}
+void MessagesDialog::markWithJunk(bool checked)
+{
+ QModelIndexList lst = ui.messageTreeWidget->selectionModel()->selectedRows();
+ foreach(const QModelIndex& index,lst)
+ mMessageModel->setMsgJunk(index, checked);
+}
void MessagesDialog::insertMsgTxtAndFiles(const QModelIndex& proxy_index)
{
@@ -1117,6 +1162,7 @@ void MessagesDialog::updateMessageSummaryList()
unsigned int trashboxCount = 0;
unsigned int starredCount = 0;
unsigned int systemCount = 0;
+ unsigned int spamCount = 0;
/* calculating the new messages */
@@ -1145,6 +1191,10 @@ void MessagesDialog::updateMessageSummaryList()
++systemCount;
}
+ if (it->msgflags & RS_MSG_SPAM) {
+ ++spamCount;
+ }
+
/* calculate box */
if (it->msgflags & RS_MSG_TRASH) {
++trashboxCount;
@@ -1304,6 +1354,9 @@ void MessagesDialog::updateMessageSummaryList()
case QUICKVIEW_STATIC_ID_SYSTEM:
text += " (" + QString::number(systemCount) + ")";
break;
+ case QUICKVIEW_STATIC_ID_SPAM:
+ text += " (" + QString::number(spamCount) + ")";
+ break;
}
item->setText(text);
diff --git a/retroshare-gui/src/gui/msgs/MessagesDialog.h b/retroshare-gui/src/gui/msgs/MessagesDialog.h
index 766268a79..abc80349d 100644
--- a/retroshare-gui/src/gui/msgs/MessagesDialog.h
+++ b/retroshare-gui/src/gui/msgs/MessagesDialog.h
@@ -94,6 +94,7 @@ private slots:
void markAsRead();
void markAsUnread();
void markWithStar(bool checked);
+ void markWithJunk(bool checked);
void emptyTrash();
@@ -118,9 +119,10 @@ private:
bool getCurrentMsg(std::string &cid, std::string &mid);
void setMsgAsReadUnread(const QList &items, bool read);
- int getSelectedMsgCount (QList *items, QList *itemsRead, QList *itemsUnread, QList *itemsStar);
+ int getSelectedMsgCount (QList *items, QList *itemsRead, QList *itemsUnread, QList *itemsStar, QList *itemsJunk);
bool isMessageRead(const QModelIndex &real_index);
bool hasMessageStar(const QModelIndex &index);
+ bool hasMessageSpam(const QModelIndex &index);
void processSettings(bool load);