mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Improved MessagesDialog:
- corrected calculation of message counts - p3MsgService::checkOutgoingMessages -> notify when message was sent - refill of message list without clear, selected messages and scroll position are not changed - corrected sorting of date with only time for today - changed context menu in message list git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2863 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
5813a6454a
commit
f239e7e4d4
@ -186,6 +186,9 @@ int p3MsgService::checkOutgoingMessages()
|
|||||||
* if online, send
|
* if online, send
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
bool changed = false ;
|
||||||
|
|
||||||
|
{
|
||||||
const std::string ownId = mConnMgr->getOwnId();
|
const std::string ownId = mConnMgr->getOwnId();
|
||||||
|
|
||||||
std::list<uint32_t>::iterator it;
|
std::list<uint32_t>::iterator it;
|
||||||
@ -224,6 +227,8 @@ int p3MsgService::checkOutgoingMessages()
|
|||||||
|
|
||||||
sendItem(mit->second);
|
sendItem(mit->second);
|
||||||
toErase.push_back(mit->first);
|
toErase.push_back(mit->first);
|
||||||
|
|
||||||
|
changed = true ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -246,6 +251,10 @@ int p3MsgService::checkOutgoingMessages()
|
|||||||
{
|
{
|
||||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(changed)
|
||||||
|
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,9 @@ MessagesDialog::MessagesDialog(QWidget *parent)
|
|||||||
connect(ui.forwardmessageButton, SIGNAL(clicked()), this, SLOT(forwardmessage()));
|
connect(ui.forwardmessageButton, SIGNAL(clicked()), this, SLOT(forwardmessage()));
|
||||||
|
|
||||||
connect(ui.actionPrint, SIGNAL(triggered()), this, SLOT(print()));
|
connect(ui.actionPrint, SIGNAL(triggered()), this, SLOT(print()));
|
||||||
|
ui.actionPrint->setDisabled(true);
|
||||||
connect(ui.actionPrintPreview, SIGNAL(triggered()), this, SLOT(printpreview()));
|
connect(ui.actionPrintPreview, SIGNAL(triggered()), this, SLOT(printpreview()));
|
||||||
|
ui.actionPrintPreview->setDisabled(true);
|
||||||
connect(ui.printbutton, SIGNAL(clicked()), this, SLOT(print()));
|
connect(ui.printbutton, SIGNAL(clicked()), this, SLOT(print()));
|
||||||
|
|
||||||
|
|
||||||
@ -93,6 +95,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
|
|||||||
connect(ui.actionTextUnderIcon, SIGNAL(triggered()), this, SLOT(buttonstextundericon()));
|
connect(ui.actionTextUnderIcon, SIGNAL(triggered()), this, SLOT(buttonstextundericon()));
|
||||||
|
|
||||||
connect(ui.actionSave_as, SIGNAL(triggered()), this, SLOT(fileSaveAs()));
|
connect(ui.actionSave_as, SIGNAL(triggered()), this, SLOT(fileSaveAs()));
|
||||||
|
ui.actionSave_as->setDisabled(true);
|
||||||
|
|
||||||
connect( ui.clearButton, SIGNAL(clicked()), this, SLOT(clearFilter()));
|
connect( ui.clearButton, SIGNAL(clicked()), this, SLOT(clearFilter()));
|
||||||
connect( ui.filterPatternLineEdit, SIGNAL( textChanged(const QString &)), this, SLOT(toggleclearButton()));
|
connect( ui.filterPatternLineEdit, SIGNAL( textChanged(const QString &)), this, SLOT(toggleclearButton()));
|
||||||
@ -120,6 +123,8 @@ MessagesDialog::MessagesDialog(QWidget *parent)
|
|||||||
proxyModel = new QSortFilterProxyModel(this);
|
proxyModel = new QSortFilterProxyModel(this);
|
||||||
proxyModel->setDynamicSortFilter(true);
|
proxyModel->setDynamicSortFilter(true);
|
||||||
proxyModel->setSourceModel(MessagesModel);
|
proxyModel->setSourceModel(MessagesModel);
|
||||||
|
proxyModel->setSortRole(Qt::UserRole);
|
||||||
|
proxyModel->sort (3, Qt::DescendingOrder);
|
||||||
ui.messagestreeView->setModel(proxyModel);
|
ui.messagestreeView->setModel(proxyModel);
|
||||||
ui.messagestreeView->setSelectionBehavior(QTreeView::SelectRows);
|
ui.messagestreeView->setSelectionBehavior(QTreeView::SelectRows);
|
||||||
|
|
||||||
@ -216,22 +221,13 @@ MessagesDialog::~MessagesDialog()
|
|||||||
// MainPage::keyPressEvent(e) ;
|
// MainPage::keyPressEvent(e) ;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
void MessagesDialog::messageslistWidgetCostumPopupMenu( QPoint point )
|
int MessagesDialog::getSelectedMsgCount ()
|
||||||
{
|
{
|
||||||
QMenu contextMnu( this );
|
|
||||||
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
|
|
||||||
|
|
||||||
contextMnu.clear();
|
|
||||||
|
|
||||||
newmsgAct = new QAction(QIcon(IMAGE_MESSAGE), tr( "New Message" ), this );
|
|
||||||
connect( newmsgAct , SIGNAL( triggered() ), this, SLOT( newmessage() ) );
|
|
||||||
|
|
||||||
//To check if the selection has more than one row.
|
//To check if the selection has more than one row.
|
||||||
QList<QModelIndex> selectedIndexList = ui.messagestreeView->selectionModel() -> selectedIndexes ();
|
QList<QModelIndex> selectedIndexList = ui.messagestreeView->selectionModel() -> selectedIndexes ();
|
||||||
QList<int> rowList;
|
QList<int> rowList;
|
||||||
for(QList<QModelIndex>::iterator it = selectedIndexList.begin(); it != selectedIndexList.end(); it++)
|
for(QList<QModelIndex>::iterator it = selectedIndexList.begin(); it != selectedIndexList.end(); it++)
|
||||||
{
|
{
|
||||||
|
|
||||||
int row = it->row();
|
int row = it->row();
|
||||||
if (rowList.contains(row) == false)
|
if (rowList.contains(row) == false)
|
||||||
{
|
{
|
||||||
@ -239,15 +235,23 @@ void MessagesDialog::messageslistWidgetCostumPopupMenu( QPoint point )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int nn = rowList.size();
|
return rowList.size();
|
||||||
if(nn > 1)
|
}
|
||||||
{
|
|
||||||
removemsgAct = new QAction(QIcon(IMAGE_MESSAGEREMOVE), tr( "Remove Messages" ), this );
|
void MessagesDialog::messageslistWidgetCostumPopupMenu( QPoint point )
|
||||||
connect( removemsgAct , SIGNAL( triggered() ), this, SLOT( removemessage() ) );
|
{
|
||||||
contextMnu.addAction( removemsgAct);
|
QMenu contextMnu( this );
|
||||||
}
|
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
|
||||||
else if(nn == 1)
|
|
||||||
{
|
contextMnu.clear();
|
||||||
|
|
||||||
|
/** Defines the actions for the context menu */
|
||||||
|
QAction* newmsgAct = NULL;
|
||||||
|
QAction* replytomsgAct = NULL;
|
||||||
|
QAction* replyallmsgAct = NULL;
|
||||||
|
QAction* forwardmsgAct = NULL;
|
||||||
|
QAction* removemsgAct = NULL;
|
||||||
|
|
||||||
replytomsgAct = new QAction(QIcon(IMAGE_MESSAGEREPLY), tr( "Reply to Message" ), this );
|
replytomsgAct = new QAction(QIcon(IMAGE_MESSAGEREPLY), tr( "Reply to Message" ), this );
|
||||||
connect( replytomsgAct , SIGNAL( triggered() ), this, SLOT( replytomessage() ) );
|
connect( replytomsgAct , SIGNAL( triggered() ), this, SLOT( replytomessage() ) );
|
||||||
contextMnu.addAction( replytomsgAct);
|
contextMnu.addAction( replytomsgAct);
|
||||||
@ -262,21 +266,43 @@ void MessagesDialog::messageslistWidgetCostumPopupMenu( QPoint point )
|
|||||||
|
|
||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
|
|
||||||
|
int nCount = getSelectedMsgCount ();
|
||||||
|
|
||||||
|
if (nCount > 1) {
|
||||||
|
removemsgAct = new QAction(QIcon(IMAGE_MESSAGEREMOVE), tr( "Remove Messages" ), this );
|
||||||
|
} else {
|
||||||
removemsgAct = new QAction(QIcon(IMAGE_MESSAGEREMOVE), tr( "Remove Message" ), this );
|
removemsgAct = new QAction(QIcon(IMAGE_MESSAGEREMOVE), tr( "Remove Message" ), this );
|
||||||
|
}
|
||||||
|
|
||||||
connect( removemsgAct , SIGNAL( triggered() ), this, SLOT( removemessage() ) );
|
connect( removemsgAct , SIGNAL( triggered() ), this, SLOT( removemessage() ) );
|
||||||
contextMnu.addAction( removemsgAct);
|
contextMnu.addAction( removemsgAct);
|
||||||
}
|
|
||||||
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);
|
||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
|
|
||||||
|
newmsgAct = new QAction(QIcon(IMAGE_MESSAGE), tr( "New Message" ), this );
|
||||||
|
connect( newmsgAct , SIGNAL( triggered() ), this, SLOT( newmessage() ) );
|
||||||
contextMnu.addAction( newmsgAct);
|
contextMnu.addAction( newmsgAct);
|
||||||
|
|
||||||
|
if (nCount != 1) {
|
||||||
|
replytomsgAct->setDisabled(true);
|
||||||
|
replyallmsgAct->setDisabled(true);
|
||||||
|
forwardmsgAct->setDisabled(true);
|
||||||
|
}
|
||||||
|
if (nCount == 0) {
|
||||||
|
removemsgAct->setDisabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
contextMnu.exec( mevent->globalPos() );
|
contextMnu.exec( mevent->globalPos() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MessagesDialog::msgfilelistWidgetCostumPopupMenu( QPoint point )
|
void MessagesDialog::msgfilelistWidgetCostumPopupMenu( QPoint point )
|
||||||
{
|
{
|
||||||
|
QAction* getRecAct = NULL;
|
||||||
|
QAction* getAllRecAct = NULL;
|
||||||
|
|
||||||
QMenu contextMnu( this );
|
QMenu contextMnu( this );
|
||||||
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
|
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
|
||||||
@ -287,7 +313,6 @@ void MessagesDialog::msgfilelistWidgetCostumPopupMenu( QPoint point )
|
|||||||
// getAllRecAct = new QAction(QIcon(IMAGE_DOWNLOADALL), tr( "Download" ), this );
|
// getAllRecAct = new QAction(QIcon(IMAGE_DOWNLOADALL), tr( "Download" ), this );
|
||||||
// connect( getAllRecAct , SIGNAL( triggered() ), this, SLOT( getallrecommended() ) );
|
// connect( getAllRecAct , SIGNAL( triggered() ), this, SLOT( getallrecommended() ) );
|
||||||
|
|
||||||
|
|
||||||
contextMnu.clear();
|
contextMnu.clear();
|
||||||
contextMnu.addAction( getRecAct);
|
contextMnu.addAction( getRecAct);
|
||||||
// contextMnu.addAction( getAllRecAct);
|
// contextMnu.addAction( getAllRecAct);
|
||||||
@ -572,6 +597,8 @@ void MessagesDialog::getallrecommended()
|
|||||||
|
|
||||||
void MessagesDialog::changeBox(int)
|
void MessagesDialog::changeBox(int)
|
||||||
{
|
{
|
||||||
|
MessagesModel->removeRows (0, MessagesModel->rowCount());
|
||||||
|
|
||||||
insertMessages();
|
insertMessages();
|
||||||
insertMsgTxtAndFiles();
|
insertMsgTxtAndFiles();
|
||||||
}
|
}
|
||||||
@ -580,33 +607,21 @@ void MessagesDialog::insertMessages()
|
|||||||
{
|
{
|
||||||
std::cerr <<"MessagesDialog::insertMessages called";
|
std::cerr <<"MessagesDialog::insertMessages called";
|
||||||
fflush(0);
|
fflush(0);
|
||||||
int c;
|
|
||||||
c = MessagesModel->rowCount();
|
|
||||||
MessagesModel->removeRows(0,c);
|
|
||||||
//ui.messagestreeView->showColumn(4);
|
|
||||||
//ui.messagestreeView->showColumn(5);
|
|
||||||
std::list<MsgInfoSummary> msgList;
|
std::list<MsgInfoSummary> msgList;
|
||||||
std::list<MsgInfoSummary>::const_iterator it;
|
std::list<MsgInfoSummary>::const_iterator it;
|
||||||
|
|
||||||
rsMsgs -> getMessageSummaries(msgList);
|
rsMsgs -> getMessageSummaries(msgList);
|
||||||
|
|
||||||
/* get the MsgId of the current one ... */
|
|
||||||
|
|
||||||
std::string cid;
|
|
||||||
std::string mid;
|
|
||||||
|
|
||||||
bool oldSelected = getCurrentMsg(cid, mid);
|
|
||||||
QStandardItem *newSelected = NULL;
|
|
||||||
|
|
||||||
/* remove old items ??? */
|
|
||||||
|
|
||||||
int listrow = ui.listWidget -> currentRow();
|
int listrow = ui.listWidget -> currentRow();
|
||||||
|
|
||||||
std::cerr << "MessagesDialog::insertMessages()" << std::endl;
|
std::cerr << "MessagesDialog::insertMessages()" << std::endl;
|
||||||
std::cerr << "Current Row: " << listrow << std::endl;
|
std::cerr << "Current Row: " << listrow << std::endl;
|
||||||
fflush(0);
|
fflush(0);
|
||||||
|
|
||||||
/* check the mode we are in */
|
/* check the mode we are in */
|
||||||
unsigned int msgbox = 0;
|
unsigned int msgbox = 0;
|
||||||
|
bool bFill = true;
|
||||||
switch(listrow)
|
switch(listrow)
|
||||||
{
|
{
|
||||||
case 3:
|
case 3:
|
||||||
@ -619,13 +634,35 @@ void MessagesDialog::insertMessages()
|
|||||||
msgbox = RS_MSG_OUTBOX;
|
msgbox = RS_MSG_OUTBOX;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
default:
|
|
||||||
msgbox = RS_MSG_INBOX;
|
msgbox = RS_MSG_INBOX;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
bFill = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bFill) {
|
||||||
|
/* remove old items */
|
||||||
|
int nRowCount = MessagesModel->rowCount();
|
||||||
|
int nRow = 0;
|
||||||
|
for (nRow = 0; nRow < nRowCount; ) {
|
||||||
|
for(it = msgList.begin(); it != msgList.end(); it++) {
|
||||||
|
if ((it->msgflags & RS_MSG_BOXMASK) != msgbox) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (it->msgId == MessagesModel->item(nRow, 5)->text().toStdString()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (it == msgList.end ()) {
|
||||||
|
MessagesModel->removeRow (nRow);
|
||||||
|
nRowCount = MessagesModel->rowCount();
|
||||||
|
} else {
|
||||||
|
nRow++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//std::list<std::string>::iterator it;
|
|
||||||
for(it = msgList.begin(); it != msgList.end(); it++)
|
for(it = msgList.begin(); it != msgList.end(); it++)
|
||||||
{
|
{
|
||||||
/* check the message flags, to decide which
|
/* check the message flags, to decide which
|
||||||
@ -653,14 +690,41 @@ void MessagesDialog::insertMessages()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// search exisisting items
|
||||||
|
nRowCount = MessagesModel->rowCount();
|
||||||
|
for (nRow = 0; nRow < nRowCount; nRow++) {
|
||||||
|
if (it->msgId == MessagesModel->item(nRow, 5)->text().toStdString()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* make a widget per friend */
|
/* make a widget per friend */
|
||||||
|
|
||||||
QStandardItem *item0 = new QStandardItem();
|
QStandardItem *item0 = NULL;
|
||||||
QStandardItem *item1 = new QStandardItem();
|
QStandardItem *item1 = NULL;
|
||||||
QStandardItem *item2 = new QStandardItem();
|
QStandardItem *item2 = NULL;
|
||||||
QStandardItem *item3 = new QStandardItem();
|
QStandardItem *item3 = NULL;
|
||||||
QStandardItem *item4 = new QStandardItem();
|
QStandardItem *item4 = NULL;
|
||||||
QStandardItem *item5 = new QStandardItem();
|
QStandardItem *item5 = NULL;
|
||||||
|
|
||||||
|
bool bInsert = false;
|
||||||
|
|
||||||
|
if (nRow < nRowCount) {
|
||||||
|
item0 = MessagesModel->item(nRow, 0);
|
||||||
|
item1 = MessagesModel->item(nRow, 1);
|
||||||
|
item2 = MessagesModel->item(nRow, 2);
|
||||||
|
item3 = MessagesModel->item(nRow, 3);
|
||||||
|
item4 = MessagesModel->item(nRow, 4);
|
||||||
|
item5 = MessagesModel->item(nRow, 5);
|
||||||
|
} else {
|
||||||
|
item0 = new QStandardItem();
|
||||||
|
item1 = new QStandardItem();
|
||||||
|
item2 = new QStandardItem();
|
||||||
|
item3 = new QStandardItem();
|
||||||
|
item4 = new QStandardItem();
|
||||||
|
item5 = new QStandardItem();
|
||||||
|
bInsert = true;
|
||||||
|
}
|
||||||
|
|
||||||
//set this false if you want to expand on double click
|
//set this false if you want to expand on double click
|
||||||
item0->setEditable(false);
|
item0->setEditable(false);
|
||||||
@ -669,7 +733,6 @@ void MessagesDialog::insertMessages()
|
|||||||
item3->setEditable(false);
|
item3->setEditable(false);
|
||||||
item4->setEditable(false);
|
item4->setEditable(false);
|
||||||
|
|
||||||
|
|
||||||
/* So Text should be:
|
/* So Text should be:
|
||||||
* (1) Msg / Broadcast
|
* (1) Msg / Broadcast
|
||||||
* (1b) Person / Channel Name
|
* (1b) Person / Channel Name
|
||||||
@ -698,15 +761,19 @@ void MessagesDialog::insertMessages()
|
|||||||
QVariant varDateTime(qdatetime);
|
QVariant varDateTime(qdatetime);
|
||||||
item3->setData(varDateTime, Qt::DisplayRole);
|
item3->setData(varDateTime, Qt::DisplayRole);
|
||||||
}
|
}
|
||||||
|
// for sorting
|
||||||
|
item3->setData(qdatetime, Qt::UserRole);
|
||||||
}
|
}
|
||||||
|
|
||||||
// From ....
|
// From ....
|
||||||
{
|
{
|
||||||
item2 -> setText(QString::fromStdString(rsPeers->getPeerName(it->srcId)));
|
item2 -> setText(QString::fromStdString(rsPeers->getPeerName(it->srcId)));
|
||||||
|
item2->setData(item2->text(), Qt::UserRole);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Subject
|
// Subject
|
||||||
item1 -> setText(QString::fromStdWString(it->title));
|
item1 -> setText(QString::fromStdWString(it->title));
|
||||||
|
item1->setData(item1->text(), Qt::UserRole);
|
||||||
|
|
||||||
if ((it -> msgflags & RS_MSG_NEW) == RS_MSG_NEW)
|
if ((it -> msgflags & RS_MSG_NEW) == RS_MSG_NEW)
|
||||||
{
|
{
|
||||||
@ -770,17 +837,14 @@ void MessagesDialog::insertMessages()
|
|||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
out << it -> count;
|
out << it -> count;
|
||||||
item0 -> setText(QString::fromStdString(out.str()));
|
item0 -> setText(QString::fromStdString(out.str()));
|
||||||
|
item0->setData(item0->text(), Qt::UserRole);
|
||||||
//item -> setTextAlignment( 0, Qt::AlignCenter );
|
//item -> setTextAlignment( 0, Qt::AlignCenter );
|
||||||
}
|
}
|
||||||
|
|
||||||
item4 -> setText(QString::fromStdString(it->srcId));
|
item4 -> setText(QString::fromStdString(it->srcId));
|
||||||
item5 -> setText(QString::fromStdString(it->msgId));
|
item5 -> setText(QString::fromStdString(it->msgId));
|
||||||
|
|
||||||
if ((oldSelected) && (mid == it->msgId))
|
if (bInsert) {
|
||||||
{
|
|
||||||
//newSelected = item;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* add to the list */
|
/* add to the list */
|
||||||
QList<QStandardItem *> itemList;
|
QList<QStandardItem *> itemList;
|
||||||
itemList.append(item0);
|
itemList.append(item0);
|
||||||
@ -791,6 +855,10 @@ void MessagesDialog::insertMessages()
|
|||||||
itemList.append(item5);
|
itemList.append(item5);
|
||||||
MessagesModel->appendRow(itemList);
|
MessagesModel->appendRow(itemList);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
MessagesModel->removeRows (0, MessagesModel->rowCount());
|
||||||
|
}
|
||||||
|
|
||||||
updateMessageSummaryList();
|
updateMessageSummaryList();
|
||||||
ui.messagestreeView->hideColumn(4);
|
ui.messagestreeView->hideColumn(4);
|
||||||
@ -890,6 +958,10 @@ void MessagesDialog::insertMsgTxtAndFiles(QModelIndex Index)
|
|||||||
ui.msgList->clear();
|
ui.msgList->clear();
|
||||||
ui.msgText->clear();
|
ui.msgText->clear();
|
||||||
|
|
||||||
|
ui.actionSave_as->setDisabled(true);
|
||||||
|
ui.actionPrintPreview->setDisabled(true);
|
||||||
|
ui.actionPrint->setDisabled(true);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -903,6 +975,16 @@ void MessagesDialog::insertMsgTxtAndFiles(QModelIndex Index)
|
|||||||
mid = item->text().toStdString();
|
mid = item->text().toStdString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int nCount = getSelectedMsgCount ();
|
||||||
|
if (nCount == 1) {
|
||||||
|
ui.actionSave_as->setEnabled(true);
|
||||||
|
ui.actionPrintPreview->setEnabled(true);
|
||||||
|
ui.actionPrint->setEnabled(true);
|
||||||
|
} else {
|
||||||
|
ui.actionSave_as->setDisabled(true);
|
||||||
|
ui.actionPrintPreview->setDisabled(true);
|
||||||
|
ui.actionPrint->setDisabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
/* Save the Data.... for later */
|
/* Save the Data.... for later */
|
||||||
|
|
||||||
@ -1312,19 +1394,18 @@ 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_BOXMASK) == RS_MSG_INBOX && ((it -> msgflags & RS_MSG_NEW) == RS_MSG_NEW))
|
if ((it -> msgflags & RS_MSG_BOXMASK) == RS_MSG_INBOX)
|
||||||
{
|
|
||||||
newInboxCount ++;
|
|
||||||
}
|
|
||||||
if ((it -> msgflags & RS_MSG_BOXMASK) == RS_MSG_INBOX )
|
|
||||||
{
|
{
|
||||||
inboxCount ++;
|
inboxCount ++;
|
||||||
|
if ((it -> msgflags & RS_MSG_NEW) == RS_MSG_NEW) {
|
||||||
|
newInboxCount ++;
|
||||||
}
|
}
|
||||||
if ((it -> msgflags & RS_MSG_BOXMASK) == RS_MSG_OUTBOX )
|
}
|
||||||
|
if ((it -> msgflags & RS_MSG_BOXMASK) == RS_MSG_OUTBOX)
|
||||||
{
|
{
|
||||||
newOutboxCount ++;
|
newOutboxCount ++;
|
||||||
}
|
}
|
||||||
if ((it -> msgflags & RS_MSG_BOXMASK) == RS_MSG_DRAFTBOX )
|
if ((it -> msgflags & RS_MSG_BOXMASK) == RS_MSG_DRAFTBOX)
|
||||||
{
|
{
|
||||||
newDraftCount ++;
|
newDraftCount ++;
|
||||||
}
|
}
|
||||||
@ -1336,10 +1417,11 @@ void MessagesDialog::updateMessageSummaryList()
|
|||||||
|
|
||||||
QString textItem;
|
QString textItem;
|
||||||
/*updating the labels in leftcolumn*/
|
/*updating the labels in leftcolumn*/
|
||||||
if(newInboxCount != 0)
|
|
||||||
{
|
|
||||||
//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(0);
|
||||||
|
if (newInboxCount != 0)
|
||||||
|
{
|
||||||
textItem = tr("Inbox") + " " + "(" + QString::number(newInboxCount)+")";
|
textItem = tr("Inbox") + " " + "(" + QString::number(newInboxCount)+")";
|
||||||
item->setText(textItem);
|
item->setText(textItem);
|
||||||
QFont qf = item->font();
|
QFont qf = item->font();
|
||||||
@ -1350,8 +1432,6 @@ void MessagesDialog::updateMessageSummaryList()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QListWidgetItem* item = ui.listWidget->item(0);
|
|
||||||
|
|
||||||
textItem = tr("Inbox");
|
textItem = tr("Inbox");
|
||||||
item->setText(textItem);
|
item->setText(textItem);
|
||||||
QFont qf = item->font();
|
QFont qf = item->font();
|
||||||
@ -1361,11 +1441,10 @@ void MessagesDialog::updateMessageSummaryList()
|
|||||||
item->setForeground(QBrush(QColor(0, 0, 0)));
|
item->setForeground(QBrush(QColor(0, 0, 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newOutboxCount != 0)
|
|
||||||
{
|
|
||||||
//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(1);
|
item = ui.listWidget->item(1);
|
||||||
|
if (newOutboxCount != 0)
|
||||||
|
{
|
||||||
textItem = tr("Outbox") + " " + "(" + QString::number(newOutboxCount)+")";
|
textItem = tr("Outbox") + " " + "(" + QString::number(newOutboxCount)+")";
|
||||||
item->setText(textItem);
|
item->setText(textItem);
|
||||||
QFont qf = item->font();
|
QFont qf = item->font();
|
||||||
@ -1374,8 +1453,6 @@ void MessagesDialog::updateMessageSummaryList()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QListWidgetItem* item = ui.listWidget->item(1);
|
|
||||||
|
|
||||||
textItem = tr("Outbox");
|
textItem = tr("Outbox");
|
||||||
item->setText(textItem);
|
item->setText(textItem);
|
||||||
QFont qf = item->font();
|
QFont qf = item->font();
|
||||||
@ -1384,11 +1461,11 @@ void MessagesDialog::updateMessageSummaryList()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newDraftCount != 0)
|
|
||||||
{
|
|
||||||
//QList<QListWidgetItem *> QListWidget::findItems ( const QString & text, Qt::MatchFlags flags ) const
|
|
||||||
QListWidgetItem* item = ui.listWidget->item(2);
|
|
||||||
|
|
||||||
|
//QList<QListWidgetItem *> QListWidget::findItems ( const QString & text, Qt::MatchFlags flags ) const
|
||||||
|
item = ui.listWidget->item(2);
|
||||||
|
if (newDraftCount != 0)
|
||||||
|
{
|
||||||
textItem = tr("Draft") + "(" + QString::number(newDraftCount)+")";
|
textItem = tr("Draft") + "(" + QString::number(newDraftCount)+")";
|
||||||
item->setText(textItem);
|
item->setText(textItem);
|
||||||
QFont qf = item->font();
|
QFont qf = item->font();
|
||||||
@ -1397,8 +1474,6 @@ void MessagesDialog::updateMessageSummaryList()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QListWidgetItem* item = ui.listWidget->item(2);
|
|
||||||
|
|
||||||
textItem = tr("Draft");
|
textItem = tr("Draft");
|
||||||
item->setText(textItem);
|
item->setText(textItem);
|
||||||
QFont qf = item->font();
|
QFont qf = item->font();
|
||||||
@ -1408,48 +1483,14 @@ void MessagesDialog::updateMessageSummaryList()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Total Inbox */
|
/* Total Inbox */
|
||||||
if(inboxCount != 0)
|
item = ui.listWidget->item(5);
|
||||||
{
|
|
||||||
QListWidgetItem* item = ui.listWidget->item(5);
|
|
||||||
|
|
||||||
textItem = tr("Total Inbox:") + " " + QString::number(inboxCount);
|
textItem = tr("Total Inbox:") + " " + QString::number(inboxCount);
|
||||||
item->setText(textItem);
|
item->setText(textItem);
|
||||||
/*QFont qf = item->font();
|
|
||||||
qf.setBold(true);
|
|
||||||
item->setFont(qf);*/
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QListWidgetItem* item = ui.listWidget->item(5);
|
|
||||||
|
|
||||||
textItem = tr("Total Inbox:") + " " + "0";
|
|
||||||
item->setText(textItem);
|
|
||||||
/*QFont qf = item->font();
|
|
||||||
qf.setBold(false);
|
|
||||||
item->setFont(qf);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Total Sent */
|
/* Total Sent */
|
||||||
if(newSentboxCount != 0)
|
item = ui.listWidget->item(6);
|
||||||
{
|
|
||||||
QListWidgetItem* item = ui.listWidget->item(6);
|
|
||||||
|
|
||||||
textItem = tr("Total Sent:") + " " + QString::number(newSentboxCount);
|
textItem = tr("Total Sent:") + " " + QString::number(newSentboxCount);
|
||||||
item->setText(textItem);
|
item->setText(textItem);
|
||||||
/*QFont qf = item->font();
|
|
||||||
qf.setBold(true);
|
|
||||||
item->setFont(qf);*/
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QListWidgetItem* item = ui.listWidget->item(6);
|
|
||||||
|
|
||||||
textItem = tr("Total Sent:") + " " + "0";
|
|
||||||
item->setText(textItem);
|
|
||||||
/*QFont qf = item->font();
|
|
||||||
qf.setBold(false);
|
|
||||||
item->setFont(qf);*/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** clear Filter **/
|
/** clear Filter **/
|
||||||
|
@ -110,24 +110,11 @@ private:
|
|||||||
|
|
||||||
void setCurrentFileName(const QString &fileName);
|
void setCurrentFileName(const QString &fileName);
|
||||||
|
|
||||||
|
int getSelectedMsgCount ();
|
||||||
|
|
||||||
std::string mCurrCertId;
|
std::string mCurrCertId;
|
||||||
std::string mCurrMsgId;
|
std::string mCurrMsgId;
|
||||||
|
|
||||||
/** Define the popup menus for the Context menu */
|
|
||||||
QMenu* contextMnu;
|
|
||||||
|
|
||||||
/** Defines the actions for the context menu */
|
|
||||||
QAction* newmsgAct;
|
|
||||||
QAction* replytomsgAct;
|
|
||||||
QAction* replyallmsgAct;
|
|
||||||
QAction* forwardmsgAct;
|
|
||||||
QAction* removemsgAct;
|
|
||||||
|
|
||||||
QAction* getRecAct;
|
|
||||||
QAction* getAllRecAct;
|
|
||||||
|
|
||||||
QString fileName;
|
QString fileName;
|
||||||
|
|
||||||
QFont mFont;
|
QFont mFont;
|
||||||
|
@ -948,13 +948,13 @@ border-image: url(:/images/closepressed.png)
|
|||||||
<widget class="QListWidget" name="listWidget">
|
<widget class="QListWidget" name="listWidget">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>120</width>
|
<width>140</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>120</width>
|
<width>140</width>
|
||||||
<height>16777215</height>
|
<height>16777215</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
Loading…
Reference in New Issue
Block a user