mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-24 23:19:29 -05:00
added spam box
This commit is contained in:
parent
477f0a8a76
commit
38af9244a6
@ -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}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -214,6 +214,9 @@
|
||||
<file>images/im-user-busy.png</file>
|
||||
<file>images/im-user-inactive.png</file>
|
||||
<file>images/informations_24x24.png</file>
|
||||
<file>images/junk.png</file>
|
||||
<file>images/junk_on.png</file>
|
||||
<file>images/junk_off.png</file>
|
||||
<file>images/connect_friend.png</file>
|
||||
<file>images/kalarm.png</file>
|
||||
<file>images/kbackgammon.png</file>
|
||||
|
BIN
retroshare-gui/src/gui/images/junk-on24.png
Normal file
BIN
retroshare-gui/src/gui/images/junk-on24.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
retroshare-gui/src/gui/images/junk.png
Normal file
BIN
retroshare-gui/src/gui/images/junk.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 384 B |
BIN
retroshare-gui/src/gui/images/junk_off.png
Normal file
BIN
retroshare-gui/src/gui/images/junk_off.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
BIN
retroshare-gui/src/gui/images/junk_on.png
Normal file
BIN
retroshare-gui/src/gui/images/junk_on.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
@ -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.
|
||||
|
@ -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();
|
||||
|
@ -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<QString>& mid)
|
||||
return mid.size();
|
||||
}
|
||||
|
||||
int MessagesDialog::getSelectedMsgCount (QList<QModelIndex> *items, QList<QModelIndex> *itemsRead, QList<QModelIndex> *itemsUnread, QList<QModelIndex> *itemsStar)
|
||||
int MessagesDialog::getSelectedMsgCount (QList<QModelIndex> *items, QList<QModelIndex> *itemsRead, QList<QModelIndex> *itemsUnread, QList<QModelIndex> *itemsStar, QList<QModelIndex> *itemsJunk)
|
||||
{
|
||||
QModelIndexList qmil = ui.messageTreeWidget->selectionModel()->selectedRows();
|
||||
|
||||
@ -477,6 +492,7 @@ int MessagesDialog::getSelectedMsgCount (QList<QModelIndex> *items, QList<QModel
|
||||
if (itemsRead) itemsRead->clear();
|
||||
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<QModelIndex> itemsRead;
|
||||
QList<QModelIndex> itemsUnread;
|
||||
QList<QModelIndex> itemsStar;
|
||||
QList<QModelIndex> 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<QModelIndex> 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<QModelIndex> 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);
|
||||
|
@ -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<QTreeWidgetItem *> &items, bool read);
|
||||
|
||||
int getSelectedMsgCount (QList<QModelIndex> *items, QList<QModelIndex> *itemsRead, QList<QModelIndex> *itemsUnread, QList<QModelIndex> *itemsStar);
|
||||
int getSelectedMsgCount (QList<QModelIndex> *items, QList<QModelIndex> *itemsRead, QList<QModelIndex> *itemsUnread, QList<QModelIndex> *itemsStar, QList<QModelIndex> *itemsJunk);
|
||||
bool isMessageRead(const QModelIndex &real_index);
|
||||
bool hasMessageStar(const QModelIndex &index);
|
||||
bool hasMessageSpam(const QModelIndex &index);
|
||||
|
||||
void processSettings(bool load);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user