mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-04 12:49:28 -04:00
added trash in msgservice and trash folder in MessagesDialog
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3020 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
a3a75b7aea
commit
c8a805b8e7
13 changed files with 217 additions and 47 deletions
|
@ -47,7 +47,8 @@
|
||||||
#define RS_MSG_OUTBOX 0x03 /* Outbox */
|
#define RS_MSG_OUTBOX 0x03 /* Outbox */
|
||||||
#define RS_MSG_DRAFTBOX 0x05 /* Draftbox */
|
#define RS_MSG_DRAFTBOX 0x05 /* Draftbox */
|
||||||
|
|
||||||
#define RS_MSG_NEW 0x0010
|
#define RS_MSG_NEW 0x0010 /* New */
|
||||||
|
#define RS_MSG_TRASH 0x0020 /* Trash */
|
||||||
|
|
||||||
class MessageInfo
|
class MessageInfo
|
||||||
{
|
{
|
||||||
|
@ -121,10 +122,11 @@ virtual ~RsMsgs() { return; }
|
||||||
|
|
||||||
virtual bool getMessageSummaries(std::list<MsgInfoSummary> &msgList) = 0;
|
virtual bool getMessageSummaries(std::list<MsgInfoSummary> &msgList) = 0;
|
||||||
virtual bool getMessage(std::string mId, MessageInfo &msg) = 0;
|
virtual bool getMessage(std::string mId, MessageInfo &msg) = 0;
|
||||||
virtual void getMessageCount(unsigned int *pnInbox, unsigned int *pnInboxNew, unsigned int *pnOutbox, unsigned int *pnDraftbox, unsigned int *pnSentbox) = 0;
|
virtual void getMessageCount(unsigned int *pnInbox, unsigned int *pnInboxNew, unsigned int *pnOutbox, unsigned int *pnDraftbox, unsigned int *pnSentbox, unsigned int *pnTrashbox) = 0;
|
||||||
|
|
||||||
virtual bool MessageSend(MessageInfo &info) = 0;
|
virtual bool MessageSend(MessageInfo &info) = 0;
|
||||||
virtual bool MessageToDraft(MessageInfo &info) = 0;
|
virtual bool MessageToDraft(MessageInfo &info) = 0;
|
||||||
|
virtual bool MessageToTrash(std::string mid, bool bTrash) = 0;
|
||||||
|
|
||||||
virtual bool MessageDelete(std::string mid) = 0;
|
virtual bool MessageDelete(std::string mid) = 0;
|
||||||
virtual bool MessageRead(std::string mid) = 0;
|
virtual bool MessageRead(std::string mid) = 0;
|
||||||
|
|
|
@ -62,9 +62,9 @@ bool p3Msgs::getMessage(std::string mid, MessageInfo &msg)
|
||||||
return mMsgSrv->getMessage(mid, msg);
|
return mMsgSrv->getMessage(mid, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void p3Msgs::getMessageCount(unsigned int *pnInbox, unsigned int *pnInboxNew, unsigned int *pnOutbox, unsigned int *pnDraftbox, unsigned int *pnSentbox)
|
void p3Msgs::getMessageCount(unsigned int *pnInbox, unsigned int *pnInboxNew, unsigned int *pnOutbox, unsigned int *pnDraftbox, unsigned int *pnSentbox, unsigned int *pnTrashbox)
|
||||||
{
|
{
|
||||||
mMsgSrv->getMessageCount(pnInbox, pnInboxNew, pnOutbox, pnDraftbox, pnSentbox);
|
mMsgSrv->getMessageCount(pnInbox, pnInboxNew, pnOutbox, pnDraftbox, pnSentbox, pnTrashbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************/
|
/****************************************/
|
||||||
|
@ -80,6 +80,11 @@ bool p3Msgs::MessageToDraft(MessageInfo &info)
|
||||||
return mMsgSrv->MessageToDraft(info);
|
return mMsgSrv->MessageToDraft(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool p3Msgs::MessageToTrash(std::string mid, bool bTrash)
|
||||||
|
{
|
||||||
|
return mMsgSrv->MessageToTrash(mid, bTrash);
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************/
|
/****************************************/
|
||||||
/****************************************/
|
/****************************************/
|
||||||
bool p3Msgs::MessageDelete(std::string mid)
|
bool p3Msgs::MessageDelete(std::string mid)
|
||||||
|
|
|
@ -55,10 +55,11 @@ class p3Msgs: public RsMsgs
|
||||||
*/
|
*/
|
||||||
virtual bool getMessageSummaries(std::list<MsgInfoSummary> &msgList);
|
virtual bool getMessageSummaries(std::list<MsgInfoSummary> &msgList);
|
||||||
virtual bool getMessage(std::string mId, MessageInfo &msg);
|
virtual bool getMessage(std::string mId, MessageInfo &msg);
|
||||||
virtual void getMessageCount(unsigned int *pnInbox, unsigned int *pnInboxNew, unsigned int *pnOutbox, unsigned int *pnDraftbox, unsigned int *pnSentbox);
|
virtual void getMessageCount(unsigned int *pnInbox, unsigned int *pnInboxNew, unsigned int *pnOutbox, unsigned int *pnDraftbox, unsigned int *pnSentbox, unsigned int *pnTrashbox);
|
||||||
|
|
||||||
virtual bool MessageSend(MessageInfo &info);
|
virtual bool MessageSend(MessageInfo &info);
|
||||||
virtual bool MessageToDraft(MessageInfo &info);
|
virtual bool MessageToDraft(MessageInfo &info);
|
||||||
|
virtual bool MessageToTrash(std::string mid, bool bTrash);
|
||||||
virtual bool MessageDelete(std::string mid);
|
virtual bool MessageDelete(std::string mid);
|
||||||
virtual bool MessageRead(std::string mid);
|
virtual bool MessageRead(std::string mid);
|
||||||
|
|
||||||
|
|
|
@ -141,6 +141,7 @@ const uint32_t RS_MSG_FLAGS_OUTGOING = 0x0001;
|
||||||
const uint32_t RS_MSG_FLAGS_PENDING = 0x0002;
|
const uint32_t RS_MSG_FLAGS_PENDING = 0x0002;
|
||||||
const uint32_t RS_MSG_FLAGS_DRAFT = 0x0004;
|
const uint32_t RS_MSG_FLAGS_DRAFT = 0x0004;
|
||||||
const uint32_t RS_MSG_FLAGS_NEW = 0x0010;
|
const uint32_t RS_MSG_FLAGS_NEW = 0x0010;
|
||||||
|
const uint32_t RS_MSG_FLAGS_TRASH = 0x0020;
|
||||||
|
|
||||||
class RsMsgItem: public RsItem
|
class RsMsgItem: public RsItem
|
||||||
{
|
{
|
||||||
|
|
|
@ -199,6 +199,9 @@ int p3MsgService::checkOutgoingMessages()
|
||||||
std::map<uint32_t, RsMsgItem *>::iterator mit;
|
std::map<uint32_t, RsMsgItem *>::iterator mit;
|
||||||
for(mit = msgOutgoing.begin(); mit != msgOutgoing.end(); mit++)
|
for(mit = msgOutgoing.begin(); mit != msgOutgoing.end(); mit++)
|
||||||
{
|
{
|
||||||
|
if (mit->second->msgFlags & RS_MSG_FLAGS_TRASH) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* find the certificate */
|
/* find the certificate */
|
||||||
std::string pid = mit->second->PeerId();
|
std::string pid = mit->second->PeerId();
|
||||||
|
@ -476,7 +479,7 @@ bool p3MsgService::getMessage(std::string mId, MessageInfo &msg)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void p3MsgService::getMessageCount(unsigned int *pnInbox, unsigned int *pnInboxNew, unsigned int *pnOutbox, unsigned int *pnDraftbox, unsigned int *pnSentbox)
|
void p3MsgService::getMessageCount(unsigned int *pnInbox, unsigned int *pnInboxNew, unsigned int *pnOutbox, unsigned int *pnDraftbox, unsigned int *pnSentbox, unsigned int *pnTrashbox)
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||||
|
|
||||||
|
@ -485,6 +488,7 @@ void p3MsgService::getMessageCount(unsigned int *pnInbox, unsigned int *pnInboxN
|
||||||
if (pnOutbox) *pnOutbox = 0;
|
if (pnOutbox) *pnOutbox = 0;
|
||||||
if (pnDraftbox) *pnDraftbox = 0;
|
if (pnDraftbox) *pnDraftbox = 0;
|
||||||
if (pnSentbox) *pnSentbox = 0;
|
if (pnSentbox) *pnSentbox = 0;
|
||||||
|
if (pnTrashbox) *pnTrashbox = 0;
|
||||||
|
|
||||||
std::map<uint32_t, RsMsgItem *>::iterator mit;
|
std::map<uint32_t, RsMsgItem *>::iterator mit;
|
||||||
std::map<uint32_t, RsMsgItem *> *apMsg [2] = { &imsg, &msgOutgoing };
|
std::map<uint32_t, RsMsgItem *> *apMsg [2] = { &imsg, &msgOutgoing };
|
||||||
|
@ -494,6 +498,10 @@ void p3MsgService::getMessageCount(unsigned int *pnInbox, unsigned int *pnInboxN
|
||||||
MsgInfoSummary mis;
|
MsgInfoSummary mis;
|
||||||
initRsMIS(mit->second, mis);
|
initRsMIS(mit->second, mis);
|
||||||
|
|
||||||
|
if (mis.msgflags & RS_MSG_TRASH) {
|
||||||
|
if (pnTrashbox) (*pnTrashbox)++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
switch (mis.msgflags & RS_MSG_BOXMASK) {
|
switch (mis.msgflags & RS_MSG_BOXMASK) {
|
||||||
case RS_MSG_INBOX:
|
case RS_MSG_INBOX:
|
||||||
if (pnInbox) (*pnInbox)++;
|
if (pnInbox) (*pnInbox)++;
|
||||||
|
@ -661,8 +669,7 @@ bool p3MsgService::MessageToDraft(MessageInfo &info)
|
||||||
{
|
{
|
||||||
uint32_t msgId = 0;
|
uint32_t msgId = 0;
|
||||||
if (info.msgId.empty() == false) {
|
if (info.msgId.empty() == false) {
|
||||||
std::istringstream instream(info.msgId);
|
msgId = atoi(info.msgId.c_str());
|
||||||
instream >> msgId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msgId) {
|
if (msgId) {
|
||||||
|
@ -679,11 +686,13 @@ bool p3MsgService::MessageToDraft(MessageInfo &info)
|
||||||
|
|
||||||
if (msgId) {
|
if (msgId) {
|
||||||
// remove existing message
|
// remove existing message
|
||||||
RsMsgItem *existingMsg = imsg[msgId];
|
std::map<uint32_t, RsMsgItem *>::iterator mit;
|
||||||
if (existingMsg) {
|
mit = imsg.find(msgId);
|
||||||
delete (existingMsg);
|
if (mit != imsg.end()) {
|
||||||
|
RsMsgItem *mi = mit->second;
|
||||||
|
imsg.erase(mit);
|
||||||
|
delete mi;
|
||||||
}
|
}
|
||||||
imsg.erase(msgId);
|
|
||||||
}
|
}
|
||||||
/* STORE MsgID */
|
/* STORE MsgID */
|
||||||
imsg[msg->msgId] = msg;
|
imsg[msg->msgId] = msg;
|
||||||
|
@ -699,6 +708,58 @@ bool p3MsgService::MessageToDraft(MessageInfo &info)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* move message to trash based on the unique mid */
|
||||||
|
bool p3MsgService::MessageToTrash(std::string mid, bool bTrash)
|
||||||
|
{
|
||||||
|
std::map<uint32_t, RsMsgItem *>::iterator mit;
|
||||||
|
uint32_t msgId = atoi(mid.c_str());
|
||||||
|
|
||||||
|
bool bChanged = false;
|
||||||
|
bool bFound = false;
|
||||||
|
|
||||||
|
{
|
||||||
|
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||||
|
|
||||||
|
RsMsgItem *mi = NULL;
|
||||||
|
|
||||||
|
mit = imsg.find(msgId);
|
||||||
|
if (mit != imsg.end()) {
|
||||||
|
mi = mit->second;
|
||||||
|
} else {
|
||||||
|
mit = msgOutgoing.find(msgId);
|
||||||
|
if (mit != msgOutgoing.end()) {
|
||||||
|
mi = mit->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mi) {
|
||||||
|
bFound = true;
|
||||||
|
|
||||||
|
if (bTrash) {
|
||||||
|
if ((mi->msgFlags & RS_MSG_FLAGS_TRASH) == 0) {
|
||||||
|
mi->msgFlags |= RS_MSG_FLAGS_TRASH;
|
||||||
|
bChanged = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (mi->msgFlags & RS_MSG_FLAGS_TRASH) {
|
||||||
|
mi->msgFlags &= ~RS_MSG_FLAGS_TRASH;
|
||||||
|
bChanged = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bChanged) {
|
||||||
|
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||||
|
|
||||||
|
checkOutgoingMessages();
|
||||||
|
|
||||||
|
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||||
|
}
|
||||||
|
|
||||||
|
return bFound;
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************/
|
/****************************************/
|
||||||
/****************************************/
|
/****************************************/
|
||||||
|
|
||||||
|
@ -813,6 +874,10 @@ void p3MsgService::initRsMIS(RsMsgItem *msg, MsgInfoSummary &mis)
|
||||||
{
|
{
|
||||||
mis.msgflags |= RS_MSG_NEW;
|
mis.msgflags |= RS_MSG_NEW;
|
||||||
}
|
}
|
||||||
|
if (msg->msgFlags & RS_MSG_FLAGS_TRASH)
|
||||||
|
{
|
||||||
|
mis.msgflags |= RS_MSG_TRASH;
|
||||||
|
}
|
||||||
|
|
||||||
mis.srcId = msg->PeerId();
|
mis.srcId = msg->PeerId();
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,14 +57,14 @@ bool getMessageNotifications(std::list<MsgInfoSummary> ¬eList);
|
||||||
|
|
||||||
bool getMessageSummaries(std::list<MsgInfoSummary> &msgList);
|
bool getMessageSummaries(std::list<MsgInfoSummary> &msgList);
|
||||||
bool getMessage(std::string mid, MessageInfo &msg);
|
bool getMessage(std::string mid, MessageInfo &msg);
|
||||||
void getMessageCount(unsigned int *pnInbox, unsigned int *pnInboxNew, unsigned int *pnOutbox, unsigned int *pnDraftbox, unsigned int *pnSentbox);
|
void getMessageCount(unsigned int *pnInbox, unsigned int *pnInboxNew, unsigned int *pnOutbox, unsigned int *pnDraftbox, unsigned int *pnSentbox, unsigned int *pnTrashbox);
|
||||||
|
|
||||||
bool removeMsgId(std::string mid);
|
bool removeMsgId(std::string mid);
|
||||||
bool markMsgIdRead(std::string mid);
|
bool markMsgIdRead(std::string mid);
|
||||||
|
|
||||||
bool MessageSend(MessageInfo &info);
|
bool MessageSend(MessageInfo &info);
|
||||||
bool MessageToDraft(MessageInfo &info);
|
bool MessageToDraft(MessageInfo &info);
|
||||||
|
bool MessageToTrash(std::string mid, bool bTrash);
|
||||||
|
|
||||||
|
|
||||||
void loadWelcomeMsg(); /* startup message */
|
void loadWelcomeMsg(); /* startup message */
|
||||||
|
|
|
@ -375,7 +375,7 @@ void MainWindow::updateStatus()
|
||||||
rsPeers->getPeerCount (NULL, &online);
|
rsPeers->getPeerCount (NULL, &online);
|
||||||
|
|
||||||
unsigned int newInboxCount = 0;
|
unsigned int newInboxCount = 0;
|
||||||
rsMsgs->getMessageCount (NULL, &newInboxCount, NULL, NULL, NULL);
|
rsMsgs->getMessageCount (NULL, &newInboxCount, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
if(newInboxCount)
|
if(newInboxCount)
|
||||||
messageAction->setIcon(QIcon(QPixmap(":/images/messages_new.png"))) ;
|
messageAction->setIcon(QIcon(QPixmap(":/images/messages_new.png"))) ;
|
||||||
|
|
|
@ -53,6 +53,14 @@
|
||||||
#define COLUMN_CONTENT 7
|
#define COLUMN_CONTENT 7
|
||||||
#define COLUMN_TAGS 8
|
#define COLUMN_TAGS 8
|
||||||
|
|
||||||
|
#define ROW_INBOX 0
|
||||||
|
#define ROW_OUTBOX 1
|
||||||
|
#define ROW_DRAFTBOX 2
|
||||||
|
#define ROW_SENTBOX 3
|
||||||
|
#define ROW_TRASHBOX 4
|
||||||
|
#define ROW_INBOX_TOTAL 6
|
||||||
|
#define ROW_SENTBOX_TOTAL 7
|
||||||
|
|
||||||
#define ACTION_TAGSINDEX_SIZE 3
|
#define ACTION_TAGSINDEX_SIZE 3
|
||||||
#define ACTION_TAGSINDEX_TYPE "Type"
|
#define ACTION_TAGSINDEX_TYPE "Type"
|
||||||
#define ACTION_TAGSINDEX_ID "ID"
|
#define ACTION_TAGSINDEX_ID "ID"
|
||||||
|
@ -270,6 +278,8 @@ MessagesDialog::MessagesDialog(QWidget *parent)
|
||||||
// http://bugreports.qt.nokia.com/browse/QTBUG-8270
|
// http://bugreports.qt.nokia.com/browse/QTBUG-8270
|
||||||
QShortcut *Shortcut = new QShortcut(QKeySequence (Qt::Key_Delete), ui.messagestreeView, 0, 0, Qt::WidgetShortcut);
|
QShortcut *Shortcut = new QShortcut(QKeySequence (Qt::Key_Delete), ui.messagestreeView, 0, 0, Qt::WidgetShortcut);
|
||||||
connect(Shortcut, SIGNAL(activated()), this, SLOT( removemessage ()));
|
connect(Shortcut, SIGNAL(activated()), this, SLOT( removemessage ()));
|
||||||
|
Shortcut = new QShortcut(QKeySequence (Qt::SHIFT | Qt::Key_Delete), ui.messagestreeView, 0, 0, Qt::WidgetShortcut);
|
||||||
|
connect(Shortcut, SIGNAL(activated()), this, SLOT( removemessage ()));
|
||||||
|
|
||||||
/* hide the Tree +/- */
|
/* hide the Tree +/- */
|
||||||
ui.msgList->setRootIsDecorated( false );
|
ui.msgList->setRootIsDecorated( false );
|
||||||
|
@ -330,7 +340,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
|
||||||
|
|
||||||
// fill folder list
|
// fill folder list
|
||||||
updateMessageSummaryList();
|
updateMessageSummaryList();
|
||||||
ui.listWidget->setCurrentRow(0);
|
ui.listWidget->setCurrentRow(ROW_INBOX);
|
||||||
|
|
||||||
#ifdef STATIC_MSGID
|
#ifdef STATIC_MSGID
|
||||||
// create tag menu
|
// create tag menu
|
||||||
|
@ -724,6 +734,19 @@ void MessagesDialog::messageslistWidgetCostumPopupMenu( QPoint point )
|
||||||
connect( removemsgAct , SIGNAL( triggered() ), this, SLOT( removemessage() ) );
|
connect( removemsgAct , SIGNAL( triggered() ), this, SLOT( removemessage() ) );
|
||||||
contextMnu.addAction( removemsgAct);
|
contextMnu.addAction( removemsgAct);
|
||||||
|
|
||||||
|
int listrow = ui.listWidget -> currentRow();
|
||||||
|
if (listrow == ROW_TRASHBOX) {
|
||||||
|
QAction *undeleteAct = new QAction(tr( "Undelete" ), this );
|
||||||
|
connect(undeleteAct, SIGNAL(triggered()), this, SLOT(undeletemessage()));
|
||||||
|
contextMnu.addAction(undeleteAct);
|
||||||
|
|
||||||
|
if (nCount) {
|
||||||
|
undeleteAct->setEnabled(true);
|
||||||
|
} else {
|
||||||
|
undeleteAct->setDisabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
contextMnu.addAction( ui.actionSave_as);
|
contextMnu.addAction( ui.actionSave_as);
|
||||||
contextMnu.addAction( ui.actionPrintPreview);
|
contextMnu.addAction( ui.actionPrintPreview);
|
||||||
contextMnu.addAction( ui.actionPrint);
|
contextMnu.addAction( ui.actionPrint);
|
||||||
|
@ -1124,20 +1147,24 @@ void MessagesDialog::insertMessages()
|
||||||
|
|
||||||
/* check the mode we are in */
|
/* check the mode we are in */
|
||||||
unsigned int msgbox = 0;
|
unsigned int msgbox = 0;
|
||||||
|
bool bTrash = false;
|
||||||
bool bFill = true;
|
bool bFill = true;
|
||||||
switch(listrow)
|
switch(listrow)
|
||||||
{
|
{
|
||||||
case 3:
|
case ROW_INBOX:
|
||||||
msgbox = RS_MSG_SENTBOX;
|
msgbox = RS_MSG_INBOX;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case ROW_OUTBOX:
|
||||||
msgbox = RS_MSG_DRAFTBOX;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
msgbox = RS_MSG_OUTBOX;
|
msgbox = RS_MSG_OUTBOX;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case ROW_DRAFTBOX:
|
||||||
msgbox = RS_MSG_INBOX;
|
msgbox = RS_MSG_DRAFTBOX;
|
||||||
|
break;
|
||||||
|
case ROW_SENTBOX:
|
||||||
|
msgbox = RS_MSG_SENTBOX;
|
||||||
|
break;
|
||||||
|
case ROW_TRASHBOX:
|
||||||
|
bTrash = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
bFill = false;
|
bFill = false;
|
||||||
|
@ -1160,8 +1187,17 @@ void MessagesDialog::insertMessages()
|
||||||
int nRow = 0;
|
int nRow = 0;
|
||||||
for (nRow = 0; nRow < nRowCount; ) {
|
for (nRow = 0; nRow < nRowCount; ) {
|
||||||
for(it = msgList.begin(); it != msgList.end(); it++) {
|
for(it = msgList.begin(); it != msgList.end(); it++) {
|
||||||
if ((it->msgflags & RS_MSG_BOXMASK) != msgbox) {
|
if (bTrash) {
|
||||||
continue;
|
if ((it->msgflags & RS_MSG_TRASH) == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (it->msgflags & RS_MSG_TRASH) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ((it->msgflags & RS_MSG_BOXMASK) != msgbox) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (it->msgId == MessagesModel->item(nRow, COLUMN_MSGID)->text().toStdString()) {
|
if (it->msgId == MessagesModel->item(nRow, COLUMN_MSGID)->text().toStdString()) {
|
||||||
|
@ -1197,11 +1233,17 @@ void MessagesDialog::insertMessages()
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((it -> msgflags & RS_MSG_BOXMASK) != msgbox)
|
if (bTrash) {
|
||||||
{
|
if ((it->msgflags & RS_MSG_TRASH) == 0) {
|
||||||
//std::cerr << "Msg from other box: " << it->msgflags;
|
continue;
|
||||||
//std::cerr << std::endl;
|
}
|
||||||
continue;
|
} else {
|
||||||
|
if (it->msgflags & RS_MSG_TRASH) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ((it->msgflags & RS_MSG_BOXMASK) != msgbox) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bGotInfo = false;
|
bGotInfo = false;
|
||||||
|
@ -1760,23 +1802,48 @@ void MessagesDialog::removemessage()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool bDelete = false;
|
||||||
|
int listrow = ui.listWidget -> currentRow();
|
||||||
|
if (listrow == ROW_TRASHBOX) {
|
||||||
|
bDelete = true;
|
||||||
|
} else {
|
||||||
|
if (QApplication::keyboardModifiers() & Qt::ShiftModifier) {
|
||||||
|
bDelete = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for(QList<int>::const_iterator it1(rowList.begin());it1!=rowList.end();++it1) {
|
for(QList<int>::const_iterator it1(rowList.begin());it1!=rowList.end();++it1) {
|
||||||
QString mid = MessagesModel->item((*it1),COLUMN_MSGID)->text();
|
QString mid = MessagesModel->item((*it1),COLUMN_MSGID)->text();
|
||||||
rsMsgs->MessageDelete(mid.toStdString());
|
if (bDelete) {
|
||||||
|
rsMsgs->MessageDelete(mid.toStdString());
|
||||||
|
|
||||||
// clean locale config
|
// clean locale config
|
||||||
m_pConfig->beginGroup(CONFIG_SECTION_UNREAD);
|
m_pConfig->beginGroup(CONFIG_SECTION_UNREAD);
|
||||||
m_pConfig->remove (mid);
|
m_pConfig->remove (mid);
|
||||||
m_pConfig->endGroup();
|
m_pConfig->endGroup();
|
||||||
|
|
||||||
// remove tag
|
// remove tag
|
||||||
m_pConfig->beginGroup(CONFIG_SECTION_TAG);
|
m_pConfig->beginGroup(CONFIG_SECTION_TAG);
|
||||||
m_pConfig->remove (mid);
|
m_pConfig->remove (mid);
|
||||||
m_pConfig->endGroup();
|
m_pConfig->endGroup();
|
||||||
|
} else {
|
||||||
|
rsMsgs->MessageToTrash(mid.toStdString(), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
insertMessages();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MessagesDialog::undeletemessage()
|
||||||
|
{
|
||||||
|
QList<int> Rows;
|
||||||
|
getSelectedMsgCount (&Rows, NULL, NULL);
|
||||||
|
for (int nRow = 0; nRow < Rows.size(); nRow++) {
|
||||||
|
QString mid = MessagesModel->item (Rows [nRow], COLUMN_MSGID)->text();
|
||||||
|
rsMsgs->MessageToTrash(mid.toStdString(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
insertMessages();
|
insertMessages();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesDialog::print()
|
void MessagesDialog::print()
|
||||||
|
@ -1967,6 +2034,7 @@ void MessagesDialog::updateMessageSummaryList()
|
||||||
unsigned int newDraftCount = 0;
|
unsigned int newDraftCount = 0;
|
||||||
unsigned int newSentboxCount = 0;
|
unsigned int newSentboxCount = 0;
|
||||||
unsigned int inboxCount = 0;
|
unsigned int inboxCount = 0;
|
||||||
|
unsigned int trashboxCount = 0;
|
||||||
|
|
||||||
/* calculating the new messages */
|
/* calculating the new messages */
|
||||||
// rsMsgs->getMessageCount (&inboxCount, &newInboxCount, &newOutboxCount, &newDraftCount, &newSentboxCount);
|
// rsMsgs->getMessageCount (&inboxCount, &newInboxCount, &newOutboxCount, &newDraftCount, &newSentboxCount);
|
||||||
|
@ -1978,6 +2046,11 @@ void MessagesDialog::updateMessageSummaryList()
|
||||||
|
|
||||||
/*calculating the new messages*/
|
/*calculating the new messages*/
|
||||||
for (it = msgList.begin(); it != msgList.end(); it++) {
|
for (it = msgList.begin(); it != msgList.end(); it++) {
|
||||||
|
if (it->msgflags & RS_MSG_TRASH) {
|
||||||
|
trashboxCount++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
switch (it->msgflags & RS_MSG_BOXMASK) {
|
switch (it->msgflags & RS_MSG_BOXMASK) {
|
||||||
case RS_MSG_INBOX:
|
case RS_MSG_INBOX:
|
||||||
inboxCount++;
|
inboxCount++;
|
||||||
|
@ -2010,7 +2083,7 @@ void MessagesDialog::updateMessageSummaryList()
|
||||||
/*updating the labels in leftcolumn*/
|
/*updating the labels in leftcolumn*/
|
||||||
|
|
||||||
//QList<QListWidgetItem *> QListWidget::findItems ( const QString & text, Qt::MatchFlags flags ) const
|
//QList<QListWidgetItem *> QListWidget::findItems ( const QString & text, Qt::MatchFlags flags ) const
|
||||||
QListWidgetItem* item = ui.listWidget->item(0);
|
QListWidgetItem* item = ui.listWidget->item(ROW_INBOX);
|
||||||
if (newInboxCount != 0)
|
if (newInboxCount != 0)
|
||||||
{
|
{
|
||||||
textItem = tr("Inbox") + " " + "(" + QString::number(newInboxCount)+")";
|
textItem = tr("Inbox") + " " + "(" + QString::number(newInboxCount)+")";
|
||||||
|
@ -2033,7 +2106,7 @@ void MessagesDialog::updateMessageSummaryList()
|
||||||
}
|
}
|
||||||
|
|
||||||
//QList<QListWidgetItem *> QListWidget::findItems ( const QString & text, Qt::MatchFlags flags ) const
|
//QList<QListWidgetItem *> QListWidget::findItems ( const QString & text, Qt::MatchFlags flags ) const
|
||||||
item = ui.listWidget->item(1);
|
item = ui.listWidget->item(ROW_OUTBOX);
|
||||||
if (newOutboxCount != 0)
|
if (newOutboxCount != 0)
|
||||||
{
|
{
|
||||||
textItem = tr("Outbox") + " " + "(" + QString::number(newOutboxCount)+")";
|
textItem = tr("Outbox") + " " + "(" + QString::number(newOutboxCount)+")";
|
||||||
|
@ -2053,7 +2126,7 @@ void MessagesDialog::updateMessageSummaryList()
|
||||||
}
|
}
|
||||||
|
|
||||||
//QList<QListWidgetItem *> QListWidget::findItems ( const QString & text, Qt::MatchFlags flags ) const
|
//QList<QListWidgetItem *> QListWidget::findItems ( const QString & text, Qt::MatchFlags flags ) const
|
||||||
item = ui.listWidget->item(2);
|
item = ui.listWidget->item(ROW_DRAFTBOX);
|
||||||
if (newDraftCount != 0)
|
if (newDraftCount != 0)
|
||||||
{
|
{
|
||||||
textItem = tr("Draft") + "(" + QString::number(newDraftCount)+")";
|
textItem = tr("Draft") + "(" + QString::number(newDraftCount)+")";
|
||||||
|
@ -2072,13 +2145,25 @@ void MessagesDialog::updateMessageSummaryList()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
item = ui.listWidget->item(ROW_TRASHBOX);
|
||||||
|
if (trashboxCount != 0)
|
||||||
|
{
|
||||||
|
textItem = tr("Trash") + "(" + QString::number(trashboxCount)+")";
|
||||||
|
item->setText(textItem);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
textItem = tr("Trash");
|
||||||
|
item->setText(textItem);
|
||||||
|
}
|
||||||
|
|
||||||
/* Total Inbox */
|
/* Total Inbox */
|
||||||
item = ui.listWidget->item(5);
|
item = ui.listWidget->item(ROW_INBOX_TOTAL);
|
||||||
textItem = tr("Total Inbox:") + " " + QString::number(inboxCount);
|
textItem = tr("Total Inbox:") + " " + QString::number(inboxCount);
|
||||||
item->setText(textItem);
|
item->setText(textItem);
|
||||||
|
|
||||||
/* Total Sent */
|
/* Total Sent */
|
||||||
item = ui.listWidget->item(6);
|
item = ui.listWidget->item(ROW_SENTBOX_TOTAL);
|
||||||
textItem = tr("Total Sent:") + " " + QString::number(newSentboxCount);
|
textItem = tr("Total Sent:") + " " + QString::number(newSentboxCount);
|
||||||
item->setText(textItem);
|
item->setText(textItem);
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,6 +88,7 @@ private slots:
|
||||||
bool fileSaveAs();
|
bool fileSaveAs();
|
||||||
|
|
||||||
void removemessage();
|
void removemessage();
|
||||||
|
void undeletemessage();
|
||||||
|
|
||||||
#ifdef STATIC_MSGID
|
#ifdef STATIC_MSGID
|
||||||
void markAsRead();
|
void markAsRead();
|
||||||
|
|
|
@ -1072,6 +1072,15 @@ border-image: url(:/images/closepressed.png)
|
||||||
<normaloff>:/images/folder-sent.png</normaloff>:/images/folder-sent.png</iconset>
|
<normaloff>:/images/folder-sent.png</normaloff>:/images/folder-sent.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Trash</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="images.qrc">
|
||||||
|
<normaloff>:/images/folder-trash.png</normaloff>:/images/folder-trash.png</iconset>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
|
|
|
@ -223,7 +223,7 @@ void MsgItem::gotoHome()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********** SPECIFIC FUNCTIOSN ***********************/
|
/*********** SPECIFIC FUNCTIONS ***********************/
|
||||||
|
|
||||||
|
|
||||||
void MsgItem::deleteMsg()
|
void MsgItem::deleteMsg()
|
||||||
|
|
|
@ -178,6 +178,7 @@
|
||||||
<file>images/folder-inbox-new.png</file>
|
<file>images/folder-inbox-new.png</file>
|
||||||
<file>images/folder-outbox.png</file>
|
<file>images/folder-outbox.png</file>
|
||||||
<file>images/folder-sent.png</file>
|
<file>images/folder-sent.png</file>
|
||||||
|
<file>images/folder-trash.png</file>
|
||||||
<file>images/folder_doments.png</file>
|
<file>images/folder_doments.png</file>
|
||||||
<file>images/folder_green.png</file>
|
<file>images/folder_green.png</file>
|
||||||
<file>images/folder_red.png</file>
|
<file>images/folder_red.png</file>
|
||||||
|
|
BIN
retroshare-gui/src/gui/images/folder-trash.png
Normal file
BIN
retroshare-gui/src/gui/images/folder-trash.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 775 B |
Loading…
Add table
Add a link
Reference in a new issue