improvements MessagesDialog:

- new read/unread state - stored locally
- show all recipients in Outbox, Sentbox and Draftbox


git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2975 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-05-23 17:21:30 +00:00
parent 61e8d588a8
commit cef2c1218f
10 changed files with 1619 additions and 1379 deletions

View File

@ -26,6 +26,7 @@
#include "util/printpreview.h" #include "util/printpreview.h"
#include "util/misc.h" #include "util/misc.h"
#include "rsiface/rsinit.h"
#include "rsiface/rsiface.h" #include "rsiface/rsiface.h"
#include "rsiface/rspeers.h" #include "rsiface/rspeers.h"
#include "rsiface/rsfiles.h" #include "rsiface/rsfiles.h"
@ -41,14 +42,47 @@
#define IMAGE_DOWNLOAD ":/images/start.png" #define IMAGE_DOWNLOAD ":/images/start.png"
#define IMAGE_DOWNLOADALL ":/images/startall.png" #define IMAGE_DOWNLOADALL ":/images/startall.png"
#define COLUMN_COUNT 7 #define COLUMN_COUNT 8
#define COLUMN_ATTACHEMENTS 0 #define COLUMN_ATTACHEMENTS 0
#define COLUMN_SUBJECT 1 #define COLUMN_SUBJECT 1
#define COLUMN_FROM 2 #define COLUMN_READ 2
#define COLUMN_DATE 3 #define COLUMN_FROM 3
#define COLUMN_SRCID 4 #define COLUMN_DATE 4
#define COLUMN_MSGID 5 #define COLUMN_SRCID 5
#define COLUMN_CONTENT 6 #define COLUMN_MSGID 6
#define COLUMN_CONTENT 7
#define CONFIG_SECTION_UNREAD "Unread"
class MyItemDelegate : public QItemDelegate
{
public:
MyItemDelegate(QObject *parent = 0) : QItemDelegate(parent)
{
}
void paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QStyleOptionViewItem ownOption (option);
if (index.column() == COLUMN_READ) {
ownOption.state &= ~QStyle::State_HasFocus; // don't show text and focus rectangle
}
QItemDelegate::paint (painter, ownOption, index);
}
QSize sizeHint (const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QStyleOptionViewItem ownOption (option);
if (index.column() == COLUMN_READ) {
ownOption.state &= ~QStyle::State_HasFocus; // don't show text and focus rectangle
}
return QItemDelegate::sizeHint(ownOption, index);
}
};
static int FilterColumnFromComboBox(int nIndex) static int FilterColumnFromComboBox(int nIndex)
{ {
@ -94,6 +128,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
ui.setupUi(this); ui.setupUi(this);
m_bProcessSettings = false; m_bProcessSettings = false;
m_pConfig = new RSettings (RsInit::RsProfileConfigDirectory() + "/msg_locale.cfg");
connect( ui.messagestreeView, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( messageslistWidgetCostumPopupMenu( QPoint ) ) ); connect( ui.messagestreeView, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( messageslistWidgetCostumPopupMenu( QPoint ) ) );
connect( ui.msgList, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( msgfilelistWidgetCostumPopupMenu( QPoint ) ) ); connect( ui.msgList, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( msgfilelistWidgetCostumPopupMenu( QPoint ) ) );
@ -112,7 +147,6 @@ MessagesDialog::MessagesDialog(QWidget *parent)
ui.actionPrintPreview->setDisabled(true); ui.actionPrintPreview->setDisabled(true);
connect(ui.printbutton, SIGNAL(clicked()), this, SLOT(print())); connect(ui.printbutton, SIGNAL(clicked()), this, SLOT(print()));
connect(ui.expandFilesButton, SIGNAL(clicked()), this, SLOT(togglefileview())); connect(ui.expandFilesButton, SIGNAL(clicked()), this, SLOT(togglefileview()));
connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(getcurrentrecommended())); connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(getcurrentrecommended()));
@ -128,10 +162,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
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(filterRegExpChanged())); connect( ui.filterPatternLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(filterRegExpChanged()));
connect(ui.filterColumnComboBox, SIGNAL(currentIndexChanged(int)), connect(ui.filterColumnComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(filterColumnChanged()));
this, SLOT(filterColumnChanged()));
mCurrCertId = ""; mCurrCertId = "";
mCurrMsgId = ""; mCurrMsgId = "";
@ -140,6 +171,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
MessagesModel = new QStandardItemModel(0, COLUMN_COUNT); MessagesModel = new QStandardItemModel(0, COLUMN_COUNT);
MessagesModel->setHeaderData(COLUMN_ATTACHEMENTS, Qt::Horizontal, tr("#")); MessagesModel->setHeaderData(COLUMN_ATTACHEMENTS, Qt::Horizontal, tr("#"));
MessagesModel->setHeaderData(COLUMN_SUBJECT, Qt::Horizontal, tr("Subject")); MessagesModel->setHeaderData(COLUMN_SUBJECT, Qt::Horizontal, tr("Subject"));
MessagesModel->setHeaderData(COLUMN_READ, Qt::Horizontal, QIcon(":/images/message-mail-state-header.png"), Qt::DecorationRole);
MessagesModel->setHeaderData(COLUMN_FROM, Qt::Horizontal, tr("From")); MessagesModel->setHeaderData(COLUMN_FROM, Qt::Horizontal, tr("From"));
MessagesModel->setHeaderData(COLUMN_DATE, Qt::Horizontal, tr("Date")); MessagesModel->setHeaderData(COLUMN_DATE, Qt::Horizontal, tr("Date"));
MessagesModel->setHeaderData(COLUMN_SRCID, Qt::Horizontal, tr("SRCID")); MessagesModel->setHeaderData(COLUMN_SRCID, Qt::Horizontal, tr("SRCID"));
@ -154,6 +186,9 @@ MessagesDialog::MessagesDialog(QWidget *parent)
ui.messagestreeView->setModel(proxyModel); ui.messagestreeView->setModel(proxyModel);
ui.messagestreeView->setSelectionBehavior(QTreeView::SelectRows); ui.messagestreeView->setSelectionBehavior(QTreeView::SelectRows);
QItemDelegate *pDelegate = new MyItemDelegate(this);
ui.messagestreeView->setItemDelegate(pDelegate);
ui.messagestreeView->setRootIsDecorated(false); ui.messagestreeView->setRootIsDecorated(false);
ui.messagestreeView->setSortingEnabled(true); ui.messagestreeView->setSortingEnabled(true);
ui.messagestreeView->sortByColumn(COLUMN_DATE, Qt::DescendingOrder); ui.messagestreeView->sortByColumn(COLUMN_DATE, Qt::DescendingOrder);
@ -170,14 +205,13 @@ MessagesDialog::MessagesDialog(QWidget *parent)
ui.msgList->setRootIsDecorated( false ); ui.msgList->setRootIsDecorated( false );
ui.msgList->setSelectionMode( QAbstractItemView::ExtendedSelection ); ui.msgList->setSelectionMode( QAbstractItemView::ExtendedSelection );
/* Set header resize modes and initial section sizes */ /* Set header initial section sizes */
QHeaderView * msgwheader = ui.messagestreeView->header () ; QHeaderView * msgwheader = ui.messagestreeView->header () ;
msgwheader->setResizeMode (COLUMN_DATE, QHeaderView::Interactive); msgwheader->resizeSection (COLUMN_ATTACHEMENTS, 24);
msgwheader->resizeSection (COLUMN_SUBJECT, 250);
msgwheader->resizeSection ( COLUMN_ATTACHEMENTS, 24 ); msgwheader->resizeSection (COLUMN_READ, 16);
msgwheader->resizeSection ( COLUMN_SUBJECT, 250 ); msgwheader->resizeSection (COLUMN_FROM, 140);
msgwheader->resizeSection ( COLUMN_FROM, 140 ); msgwheader->resizeSection (COLUMN_DATE, 140);
msgwheader->resizeSection ( COLUMN_DATE, 140 );
/* Set header resize modes and initial section sizes */ /* Set header resize modes and initial section sizes */
QHeaderView * msglheader = ui.msgList->header () ; QHeaderView * msglheader = ui.msgList->header () ;
@ -186,10 +220,10 @@ MessagesDialog::MessagesDialog(QWidget *parent)
msglheader->setResizeMode (2, QHeaderView::Interactive); msglheader->setResizeMode (2, QHeaderView::Interactive);
msglheader->setResizeMode (3, QHeaderView::Interactive); msglheader->setResizeMode (3, QHeaderView::Interactive);
msglheader->resizeSection ( 0, 200 ); msglheader->resizeSection (0, 200);
msglheader->resizeSection ( 1, 100 ); msglheader->resizeSection (1, 100);
msglheader->resizeSection ( 2, 100 ); msglheader->resizeSection (2, 100);
msglheader->resizeSection ( 3, 200 ); msglheader->resizeSection (3, 200);
ui.forwardmessageButton->setToolTip(tr("Forward selected Message")); ui.forwardmessageButton->setToolTip(tr("Forward selected Message"));
ui.replyallmessageButton->setToolTip(tr("Reply to All")); ui.replyallmessageButton->setToolTip(tr("Reply to All"));
@ -218,6 +252,11 @@ MessagesDialog::MessagesDialog(QWidget *parent)
// load settings // load settings
processSettings(true); processSettings(true);
/* Set header sizes for the fixed columns and resize modes, must be set after processSettings */
msgwheader->setResizeMode (COLUMN_DATE, QHeaderView::Interactive);
msgwheader->setResizeMode (COLUMN_READ, QHeaderView::Fixed);
msgwheader->resizeSection (COLUMN_READ, 24);
// fill folder list // fill folder list
updateMessageSummaryList(); updateMessageSummaryList();
ui.listWidget->setCurrentRow(0); ui.listWidget->setCurrentRow(0);
@ -242,6 +281,8 @@ MessagesDialog::~MessagesDialog()
// save settings // save settings
processSettings(false); processSettings(false);
delete (m_pConfig);
} }
void MessagesDialog::processSettings(bool bLoad) void MessagesDialog::processSettings(bool bLoad)
@ -299,8 +340,11 @@ void MessagesDialog::processSettings(bool bLoad)
// MainPage::keyPressEvent(e) ; // MainPage::keyPressEvent(e) ;
//} //}
int MessagesDialog::getSelectedMsgCount () int MessagesDialog::getSelectedMsgCount (QList<int> *pRowsRead, QList<int> *pRowsUnread)
{ {
if (pRowsRead) pRowsRead->clear();
if (pRowsUnread) pRowsUnread->clear();
//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;
@ -310,12 +354,28 @@ int MessagesDialog::getSelectedMsgCount ()
if (rowList.contains(row) == false) if (rowList.contains(row) == false)
{ {
rowList.append(row); rowList.append(row);
if (pRowsRead || pRowsUnread) {
int mappedRow = proxyModel->mapToSource(*it).row();
if (MessagesModel->item(mappedRow, COLUMN_SUBJECT)->font().bold()) {
if (pRowsUnread) pRowsUnread->append(mappedRow);
} else {
if (pRowsRead) pRowsRead->append(mappedRow);
}
}
} }
} }
return rowList.size(); return rowList.size();
} }
bool MessagesDialog::isMessageRead(int nRow)
{
QStandardItem *item;
item = MessagesModel->item(nRow,COLUMN_SUBJECT);
return !item->font().bold();
}
void MessagesDialog::messageslistWidgetCostumPopupMenu( QPoint point ) void MessagesDialog::messageslistWidgetCostumPopupMenu( QPoint point )
{ {
QMenu contextMnu( this ); QMenu contextMnu( this );
@ -326,6 +386,8 @@ void MessagesDialog::messageslistWidgetCostumPopupMenu( QPoint point )
QAction* replyallmsgAct = NULL; QAction* replyallmsgAct = NULL;
QAction* forwardmsgAct = NULL; QAction* forwardmsgAct = NULL;
QAction* removemsgAct = NULL; QAction* removemsgAct = NULL;
QAction* markAsRead = NULL;
QAction* markAsUnread = 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() ) );
@ -341,7 +403,9 @@ void MessagesDialog::messageslistWidgetCostumPopupMenu( QPoint point )
contextMnu.addSeparator(); contextMnu.addSeparator();
int nCount = getSelectedMsgCount (); QList<int> RowsRead;
QList<int> RowsUnread;
int nCount = getSelectedMsgCount (&RowsRead, &RowsUnread);
if (nCount > 1) { if (nCount > 1) {
removemsgAct = new QAction(QIcon(IMAGE_MESSAGEREMOVE), tr( "Remove Messages" ), this ); removemsgAct = new QAction(QIcon(IMAGE_MESSAGEREMOVE), tr( "Remove Messages" ), this );
@ -357,6 +421,22 @@ void MessagesDialog::messageslistWidgetCostumPopupMenu( QPoint point )
contextMnu.addAction( ui.actionPrint); contextMnu.addAction( ui.actionPrint);
contextMnu.addSeparator(); contextMnu.addSeparator();
markAsRead = new QAction(QIcon(":/images/message-mail-read.png"), tr( "Mark as read" ), this);
connect(markAsRead , SIGNAL(triggered()), this, SLOT(markAsRead()));
contextMnu.addAction(markAsRead);
if (RowsUnread.size() == 0) {
markAsRead->setDisabled(true);
}
markAsUnread = new QAction(QIcon(":/images/message-mail.png"), tr( "Mark as unread" ), this);
connect(markAsUnread , SIGNAL(triggered()), this, SLOT(markAsUnread()));
contextMnu.addAction(markAsUnread);
if (RowsRead.size() == 0) {
markAsUnread->setDisabled(true);
}
contextMnu.addSeparator();
newmsgAct = new QAction(QIcon(IMAGE_MESSAGE), tr( "New Message" ), this ); newmsgAct = new QAction(QIcon(IMAGE_MESSAGE), tr( "New Message" ), this );
connect( newmsgAct , SIGNAL( triggered() ), this, SLOT( newmessage() ) ); connect( newmsgAct , SIGNAL( triggered() ), this, SLOT( newmessage() ) );
contextMnu.addAction( newmsgAct); contextMnu.addAction( newmsgAct);
@ -498,9 +578,7 @@ void MessagesDialog::replyallmessage()
std::list<std::string> tl ( msgInfo.msgto ); std::list<std::string> tl ( msgInfo.msgto );
for( std::list<std::string>::iterator tli = tl.begin(); for ( std::list<std::string>::iterator tli = tl.begin(); tli!= tl.end(); tli++ )
tli!= tl.end() ;
tli++ )
{ {
nMsgDialog->addRecipient( *tli ) ; nMsgDialog->addRecipient( *tli ) ;
} }
@ -576,13 +654,10 @@ void MessagesDialog::togglefileview_internal()
* three widgets... * three widgets...
*/ */
if (ui.expandFilesButton->isChecked()) if (ui.expandFilesButton->isChecked()) {
{
ui.expandFilesButton->setIcon(QIcon(QString(":/images/edit_remove24.png"))); ui.expandFilesButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
ui.expandFilesButton->setToolTip(tr("Hide")); ui.expandFilesButton->setToolTip(tr("Hide"));
} } else {
else
{
ui.expandFilesButton->setIcon(QIcon(QString(":/images/edit_add24.png"))); ui.expandFilesButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
ui.expandFilesButton->setToolTip(tr("Expand")); ui.expandFilesButton->setToolTip(tr("Expand"));
} }
@ -683,6 +758,55 @@ void MessagesDialog::changeBox(int)
insertMsgTxtAndFiles(); insertMsgTxtAndFiles();
} }
static void InitIconAndFont(RSettings *pConfig, QStandardItem *pItem [COLUMN_COUNT], int nFlag)
{
QString sText = pItem [COLUMN_SUBJECT]->text();
QString mid = pItem [COLUMN_MSGID]->text();
bool bNew = (nFlag & RS_MSG_NEW);
// show the real "New" state
if (bNew) {
if (sText.startsWith("Re:", Qt::CaseInsensitive)) {
pItem[COLUMN_SUBJECT]->setIcon(QIcon(":/images/message-mail-replied.png"));
} else if (sText.startsWith("Fwd:", Qt::CaseInsensitive)) {
pItem[COLUMN_SUBJECT]->setIcon(QIcon(":/images/message-mail-forwarded.png"));
} else {
pItem[COLUMN_SUBJECT]->setIcon(QIcon(":/images/message-mail.png"));
}
} else {
// Change Message icon when Subject is Re: or Fwd:
if (sText.startsWith("Re:", Qt::CaseInsensitive)) {
pItem[COLUMN_SUBJECT]->setIcon(QIcon(":/images/message-mail-replied-read.png"));
} else if (sText.startsWith("Fwd:", Qt::CaseInsensitive)) {
pItem[COLUMN_SUBJECT]->setIcon(QIcon(":/images/message-mail-forwarded-read.png"));
} else {
pItem[COLUMN_SUBJECT]->setIcon(QIcon(":/images/message-mail-read.png"));
}
}
// show the locale "New" state
if (bNew == false) {
// check locale config
pConfig->beginGroup(CONFIG_SECTION_UNREAD);
bNew = pConfig->value(mid, false).toBool();
pConfig->endGroup();
}
if (bNew) {
pItem[COLUMN_READ]->setIcon(QIcon(":/images/message-mail-state-unread.png"));
} else {
pItem[COLUMN_READ]->setIcon(QIcon(":/images/message-mail-state-read.png"));
}
// set font
for (int i = 0; i < COLUMN_COUNT; i++) {
QFont qf = pItem[i]->font();
qf.setBold(bNew);
pItem[i]->setFont(qf);
}
}
void MessagesDialog::insertMessages() void MessagesDialog::insertMessages()
{ {
std::cerr <<"MessagesDialog::insertMessages called"; std::cerr <<"MessagesDialog::insertMessages called";
@ -690,6 +814,9 @@ void MessagesDialog::insertMessages()
std::list<MsgInfoSummary> msgList; std::list<MsgInfoSummary> msgList;
std::list<MsgInfoSummary>::const_iterator it; std::list<MsgInfoSummary>::const_iterator it;
MessageInfo msgInfo;
bool bGotInfo;
QString text;
rsMsgs -> getMessageSummaries(msgList); rsMsgs -> getMessageSummaries(msgList);
@ -699,6 +826,7 @@ void MessagesDialog::insertMessages()
std::cerr << "Current Row: " << listrow << std::endl; std::cerr << "Current Row: " << listrow << std::endl;
fflush(0); fflush(0);
int i;
int nFilterColumn = FilterColumnFromComboBox(ui.filterColumnComboBox->currentIndex()); int nFilterColumn = FilterColumnFromComboBox(ui.filterColumnComboBox->currentIndex());
/* check the mode we are in */ /* check the mode we are in */
@ -722,6 +850,12 @@ void MessagesDialog::insertMessages()
bFill = false; bFill = false;
} }
if (msgbox == RS_MSG_INBOX) {
MessagesModel->setHeaderData(COLUMN_FROM, Qt::Horizontal, tr("From"));
} else {
MessagesModel->setHeaderData(COLUMN_FROM, Qt::Horizontal, tr("To"));
}
if (bFill) { if (bFill) {
/* remove old items */ /* remove old items */
int nRowCount = MessagesModel->rowCount(); int nRowCount = MessagesModel->rowCount();
@ -732,7 +866,7 @@ void MessagesDialog::insertMessages()
continue; continue;
} }
if (it->msgId == MessagesModel->item(nRow, 5)->text().toStdString()) { if (it->msgId == MessagesModel->item(nRow, COLUMN_MSGID)->text().toStdString()) {
break; break;
} }
} }
@ -772,10 +906,13 @@ void MessagesDialog::insertMessages()
continue; continue;
} }
bGotInfo = false;
msgInfo = MessageInfo(); // clear
// search exisisting items // search exisisting items
nRowCount = MessagesModel->rowCount(); nRowCount = MessagesModel->rowCount();
for (nRow = 0; nRow < nRowCount; nRow++) { for (nRow = 0; nRow < nRowCount; nRow++) {
if (it->msgId == MessagesModel->item(nRow, 5)->text().toStdString()) { if (it->msgId == MessagesModel->item(nRow, COLUMN_MSGID)->text().toStdString()) {
break; break;
} }
} }
@ -787,23 +924,20 @@ void MessagesDialog::insertMessages()
bool bInsert = false; bool bInsert = false;
if (nRow < nRowCount) { if (nRow < nRowCount) {
for (int i = 0; i < COLUMN_COUNT; i++) { for (i = 0; i < COLUMN_COUNT; i++) {
item[i] = MessagesModel->item(nRow, i); item[i] = MessagesModel->item(nRow, i);
} }
} else { } else {
for (int i = 0; i < COLUMN_COUNT; i++) { for (i = 0; i < COLUMN_COUNT; i++) {
item[i] = new QStandardItem(); item[i] = new QStandardItem();
} }
bInsert = true; bInsert = true;
} }
//set this false if you want to expand on double click //set this false if you want to expand on double click
item[COLUMN_ATTACHEMENTS]->setEditable(false); for (i = 0; i < COLUMN_COUNT; i++) {
item[COLUMN_SUBJECT]->setEditable(false); item[i]->setEditable(false);
item[COLUMN_FROM]->setEditable(false); }
item[COLUMN_DATE]->setEditable(false);
item[COLUMN_SRCID]->setEditable(false);
item[COLUMN_CONTENT]->setEditable(false);
/* So Text should be: /* So Text should be:
* (1) Msg / Broadcast * (1) Msg / Broadcast
@ -843,67 +977,47 @@ void MessagesDialog::insertMessages()
// From .... // From ....
{ {
item[COLUMN_FROM] -> setText(QString::fromStdString(rsPeers->getPeerName(it->srcId))); if (msgbox == RS_MSG_INBOX) {
item[COLUMN_FROM]->setData(item[COLUMN_FROM]->text() + dateString, Qt::UserRole); text = QString::fromStdString(rsPeers->getPeerName(it->srcId));
} else {
if (bGotInfo || rsMsgs->getMessage(it->msgId, msgInfo)) {
bGotInfo = true;
text.clear();
std::list<std::string>::const_iterator pit;
for (pit = msgInfo.msgto.begin(); pit != msgInfo.msgto.end(); pit++)
{
if (text.isEmpty() == false) {
text += ";";
}
QString sPeer = QString::fromStdString(rsPeers->getPeerName(*pit));
if (sPeer.isEmpty()) {
text += tr("Anonymous") + "@" + QString::fromStdString(*pit);
} else {
text += sPeer;
}
}
} else {
std::cerr << "MessagesDialog::insertMsgTxtAndFiles() Couldn't find Msg" << std::endl;
}
}
item[COLUMN_FROM]->setText(text);
item[COLUMN_FROM]->setData(text + dateString, Qt::UserRole);
} }
// Subject // Subject
QString text = QString::fromStdWString(it->title); text = QString::fromStdWString(it->title);
item[COLUMN_SUBJECT] -> setText(text); item[COLUMN_SUBJECT]->setText(text);
item[COLUMN_SUBJECT]->setData(text + dateString, Qt::UserRole); item[COLUMN_SUBJECT]->setData(text + dateString, Qt::UserRole);
if ((it -> msgflags & RS_MSG_NEW) == RS_MSG_NEW) // internal data
{ item[COLUMN_SRCID]->setText(QString::fromStdString(it->srcId));
QFont qf = item[COLUMN_SUBJECT]->font(); item[COLUMN_MSGID]->setText(QString::fromStdString(it->msgId));
qf.setBold(true);
item[COLUMN_SUBJECT]->setFont(qf);
} // Init icon and font
InitIconAndFont(m_pConfig, item, it->msgflags);
// Change Message icon when Subject is Re: or Fwd:
if (text.startsWith("Re:", Qt::CaseInsensitive))
{
item[COLUMN_SUBJECT] -> setIcon(QIcon(":/images/message-mail-replied-read.png"));
}
else if (text.startsWith("Fwd:", Qt::CaseInsensitive))
{
item[COLUMN_SUBJECT] -> setIcon(QIcon(":/images/message-mail-forwarded-read.png"));
}
else
{
item[COLUMN_SUBJECT] -> setIcon(QIcon(":/images/message-mail-read.png"));
}
if (it -> msgflags & RS_MSG_NEW)
{
for(int i = 0; i < 10; i++)
{
/*QFont qf = item->font(i);
qf.setBold(true);
item->setFont(i, qf);*/
}
if (text.startsWith("Re:", Qt::CaseInsensitive))
{
item[COLUMN_SUBJECT] -> setIcon(QIcon(":/images/message-mail-replied.png"));
}
else if (text.startsWith("Fwd:", Qt::CaseInsensitive))
{
item[COLUMN_SUBJECT] -> setIcon(QIcon(":/images/message-mail-forwarded.png"));
}
else
{
item[COLUMN_SUBJECT] -> setIcon(QIcon(":/images/message-mail.png"));
}
}
if ((it -> msgflags & RS_MSG_BOXMASK) == RS_MSG_OUTBOX )
{
MessagesModel->setHeaderData(2, Qt::Horizontal, tr("Recipient"));
}
else
{
MessagesModel->setHeaderData(2, Qt::Horizontal, tr("From"));
}
// No of Files. // No of Files.
{ {
@ -914,13 +1028,10 @@ void MessagesDialog::insertMessages()
//item -> setTextAlignment( 0, Qt::AlignCenter ); //item -> setTextAlignment( 0, Qt::AlignCenter );
} }
item[COLUMN_SRCID] -> setText(QString::fromStdString(it->srcId));
item[COLUMN_MSGID] -> setText(QString::fromStdString(it->msgId));
if (nFilterColumn == COLUMN_CONTENT) { if (nFilterColumn == COLUMN_CONTENT) {
// need content for filter // need content for filter
MessageInfo msgInfo; if (bGotInfo || rsMsgs->getMessage(it->msgId, msgInfo)) {
if (rsMsgs->getMessage(it->msgId, msgInfo)) { bGotInfo = true;
QTextDocument doc; QTextDocument doc;
doc.setHtml(QString::fromStdWString(msgInfo.msg)); doc.setHtml(QString::fromStdWString(msgInfo.msg));
item[COLUMN_CONTENT]->setText(doc.toPlainText().replace(QString("\n"), QString(" "))); item[COLUMN_CONTENT]->setText(doc.toPlainText().replace(QString("\n"), QString(" ")));
@ -933,7 +1044,7 @@ void MessagesDialog::insertMessages()
if (bInsert) { if (bInsert) {
/* add to the list */ /* add to the list */
QList<QStandardItem *> itemList; QList<QStandardItem *> itemList;
for (int i = 0; i < COLUMN_COUNT; i++) { for (i = 0; i < COLUMN_COUNT; i++) {
itemList.append(item[i]); itemList.append(item[i]);
} }
MessagesModel->appendRow(itemList); MessagesModel->appendRow(itemList);
@ -943,10 +1054,15 @@ void MessagesDialog::insertMessages()
MessagesModel->removeRows (0, MessagesModel->rowCount()); MessagesModel->removeRows (0, MessagesModel->rowCount());
} }
updateMessageSummaryList(); ui.messagestreeView->showColumn(COLUMN_ATTACHEMENTS);
ui.messagestreeView->showColumn(COLUMN_SUBJECT);
ui.messagestreeView->showColumn(COLUMN_READ);
ui.messagestreeView->showColumn(COLUMN_FROM);
ui.messagestreeView->showColumn(COLUMN_DATE);
ui.messagestreeView->hideColumn(COLUMN_SRCID); ui.messagestreeView->hideColumn(COLUMN_SRCID);
ui.messagestreeView->hideColumn(COLUMN_MSGID); ui.messagestreeView->hideColumn(COLUMN_MSGID);
ui.messagestreeView->hideColumn(COLUMN_CONTENT); ui.messagestreeView->hideColumn(COLUMN_CONTENT);
updateMessageSummaryList();
} }
// current row in messagestreeView has changed // current row in messagestreeView has changed
@ -960,6 +1076,21 @@ void MessagesDialog::currentChanged(const QModelIndex &index )
// click in messagestreeView // click in messagestreeView
void MessagesDialog::clicked(const QModelIndex &index ) void MessagesDialog::clicked(const QModelIndex &index )
{ {
if (index.isValid() == false) {
return;
}
if (index.column() == COLUMN_READ) {
int mappedRow = proxyModel->mapToSource(index).row();
QList<int> Rows;
Rows.append(mappedRow);
setMsgAsReadUnread(Rows, !isMessageRead(mappedRow));
insertMsgTxtAndFiles(index, false);
updateMessageSummaryList();
return;
}
timer->stop(); timer->stop();
timerIndex = index; timerIndex = index;
// show current message directly // show current message directly
@ -971,57 +1102,54 @@ void MessagesDialog::updateCurrentMessage()
{ {
timer->stop(); timer->stop();
insertMsgTxtAndFiles(timerIndex); insertMsgTxtAndFiles(timerIndex);
setMsgAsRead(timerIndex); }
void MessagesDialog::setMsgAsReadUnread(const QList<int> &Rows, bool bRead)
{
for (int nRow = 0; nRow < Rows.size(); nRow++) {
QStandardItem* item[COLUMN_COUNT];
for(int nCol = 0; nCol < COLUMN_COUNT; nCol++)
{
item[nCol] = MessagesModel->item(Rows [nRow], nCol);
}
QString mid = item[COLUMN_MSGID]->text();
m_pConfig->beginGroup(CONFIG_SECTION_UNREAD);
if (bRead) {
// set as read in config
m_pConfig->setValue(mid, false);
// set message to read
rsMsgs->MessageRead(mid.toStdString());
} else {
// set as unread in config
m_pConfig->setValue(mid, true);
}
m_pConfig->endGroup();
InitIconAndFont(m_pConfig, item, 0);
}
}
void MessagesDialog::markAsRead()
{
QList<int> RowsUnread;
getSelectedMsgCount (NULL, &RowsUnread);
setMsgAsReadUnread (RowsUnread, true);
updateMessageSummaryList(); updateMessageSummaryList();
} }
void MessagesDialog::setMsgAsRead(const QModelIndex &index) void MessagesDialog::markAsUnread()
{ {
QString text; QList<int> RowsRead;
QModelIndex currentIndex = proxyModel->mapToSource(index); getSelectedMsgCount (&RowsRead, NULL);
if (currentIndex.isValid() == false)
{
return;
}
else
{
for(int i = 0; i < COLUMN_COUNT; i++)
{
QStandardItem* item; setMsgAsReadUnread (RowsRead, false);
item = MessagesModel->item(currentIndex.row(),i); updateMessageSummaryList();
QFont qf = item->font();
qf.setBold(false);
item->setFont(qf);
//change the icon to read. this need to be done when user clicks to the new message
if(i == COLUMN_SUBJECT)
{
text = item->text();
if (text.startsWith("Re:", Qt::CaseInsensitive))
{
item -> setIcon(QIcon(":/images/message-mail-replied-read.png"));
}
else if (text.startsWith("Fwd:", Qt::CaseInsensitive))
{
item -> setIcon(QIcon(":/images/message-mail-forwarded-read.png"));
}
else
{
item -> setIcon(QIcon(":/images/message-mail-read.png"));
}
}
if(i == COLUMN_MSGID)
{
std::string mid(item->text().toStdString());
rsMsgs->MessageRead(mid);
}
}
}
} }
void MessagesDialog::insertMsgTxtAndFiles(QModelIndex Index) void MessagesDialog::insertMsgTxtAndFiles(QModelIndex Index, bool bSetToRead)
{ {
std::cerr << "MessagesDialog::insertMsgTxtAndFiles()" << std::endl; std::cerr << "MessagesDialog::insertMsgTxtAndFiles()" << std::endl;
@ -1059,7 +1187,7 @@ void MessagesDialog::insertMsgTxtAndFiles(QModelIndex Index)
mid = item->text().toStdString(); mid = item->text().toStdString();
} }
int nCount = getSelectedMsgCount (); int nCount = getSelectedMsgCount (NULL, NULL);
if (nCount == 1) { if (nCount == 1) {
ui.actionSave_as->setEnabled(true); ui.actionSave_as->setEnabled(true);
ui.actionPrintPreview->setEnabled(true); ui.actionPrintPreview->setEnabled(true);
@ -1070,6 +1198,11 @@ void MessagesDialog::insertMsgTxtAndFiles(QModelIndex Index)
ui.actionPrint->setDisabled(true); ui.actionPrint->setDisabled(true);
} }
if (mCurrMsgId == mid) {
// message doesn't changed
return;
}
/* Save the Data.... for later */ /* Save the Data.... for later */
mCurrCertId = cid; mCurrCertId = cid;
@ -1082,6 +1215,27 @@ void MessagesDialog::insertMsgTxtAndFiles(QModelIndex Index)
return; return;
} }
QList<int> Rows;
Rows.append(currentIndex.row());
bool bSetToReadOnActive = Settings->getMsgSetToReadOnActivate();
if (msgInfo.msgflags & RS_MSG_NEW) {
// set to read
setMsgAsReadUnread(Rows, true);
if (bSetToReadOnActive == false || bSetToRead == false) {
// set locally to unread
setMsgAsReadUnread(Rows, false);
}
updateMessageSummaryList();
} else {
if (bSetToRead && bSetToReadOnActive) {
// set to read
setMsgAsReadUnread(Rows, true);
updateMessageSummaryList();
}
}
const std::list<FileInfo> &recList = msgInfo.files; const std::list<FileInfo> &recList = msgInfo.files;
std::list<FileInfo>::const_iterator it; std::list<FileInfo>::const_iterator it;
@ -1119,37 +1273,39 @@ void MessagesDialog::insertMsgTxtAndFiles(QModelIndex Index)
QString msgTxt; QString msgTxt;
for(pit = msgInfo.msgto.begin(); pit != msgInfo.msgto.end(); pit++) for(pit = msgInfo.msgto.begin(); pit != msgInfo.msgto.end(); pit++)
{ {
if (QString::fromStdString(rsPeers->getPeerName(*pit)) == "") QString sPeer = QString::fromStdString(rsPeers->getPeerName(*pit));
if (sPeer.isEmpty())
{ {
msgTxt += "<a style='color: black;'href='" + tr("Anonymous") + "@" + QString::fromStdString(*pit) + "'> " + tr("Anonymous") + "</a>" + " "; msgTxt += "<a style='color: black;'href='" + tr("Anonymous") + "@" + QString::fromStdString(*pit) + "'> " + tr("Anonymous") + "</a>" + " ";
} }
else else
msgTxt += "<a style='color: black;'href='" + QString::fromStdString(rsPeers->getPeerName(*pit)) + "@" + QString::fromStdString(*pit) + "'> " + QString::fromStdString(rsPeers->getPeerName(*pit)) + "</a>" + " "; msgTxt += "<a style='color: black;'href='" + sPeer + "@" + QString::fromStdString(*pit) + "'> " + sPeer + "</a>" + " ";
} }
if (msgInfo.msgcc.size() > 0) if (msgInfo.msgcc.size() > 0)
msgTxt += "\nCc: "; msgTxt += "\nCc: ";
for(pit = msgInfo.msgcc.begin(); pit != msgInfo.msgcc.end(); pit++) for(pit = msgInfo.msgcc.begin(); pit != msgInfo.msgcc.end(); pit++)
{ {
if (QString::fromStdString(rsPeers->getPeerName(*pit)) == "") QString sPeer = QString::fromStdString(rsPeers->getPeerName(*pit));
if (sPeer.isEmpty())
{ {
msgTxt += "<a style='color: black;'href='" + tr("Anonymous") + "@" + QString::fromStdString(*pit) + "'> " + tr("Anonymous") + "</a>" + " "; msgTxt += "<a style='color: black;'href='" + tr("Anonymous") + "@" + QString::fromStdString(*pit) + "'> " + tr("Anonymous") + "</a>" + " ";
} }
else else
msgTxt += "<a style='color: black;'href='" + QString::fromStdString(rsPeers->getPeerName(*pit)) + "@" + QString::fromStdString(*pit) + "'> " + QString::fromStdString(rsPeers->getPeerName(*pit)) + "</a>" + " "; msgTxt += "<a style='color: black;'href='" + sPeer + "@" + QString::fromStdString(*pit) + "'> " + sPeer + "</a>" + " ";
} }
if (msgInfo.msgbcc.size() > 0) if (msgInfo.msgbcc.size() > 0)
msgTxt += "\nBcc: "; msgTxt += "\nBcc: ";
for(pit = msgInfo.msgbcc.begin(); pit != msgInfo.msgbcc.end(); pit++) for(pit = msgInfo.msgbcc.begin(); pit != msgInfo.msgbcc.end(); pit++)
{ {
if (QString::fromStdString(rsPeers->getPeerName(*pit)) == "") QString sPeer = QString::fromStdString(rsPeers->getPeerName(*pit));
if (sPeer.isEmpty())
{ {
msgTxt += "<a style='color: black;'href='" + tr("Anonymous") + "@" + QString::fromStdString(*pit) + "'> " + tr("Anonymous") + "</a>" + " "; msgTxt += "<a style='color: black;'href='" + tr("Anonymous") + "@" + QString::fromStdString(*pit) + "'> " + tr("Anonymous") + "</a>" + " ";
} }
else else
msgTxt += "<a style='color: black;'href='" + QString::fromStdString(rsPeers->getPeerName(*pit)) + "@" + QString::fromStdString(*pit) + "'> " + QString::fromStdString(rsPeers->getPeerName(*pit)) + "</a>" + " "; msgTxt += "<a style='color: black;'href='" + sPeer + "@" + QString::fromStdString(*pit) + "'> " + sPeer + "</a>" + " ";
} }
{ {
@ -1212,8 +1368,8 @@ void MessagesDialog::removemessage()
QList<QModelIndex> selectedIndexList= ui.messagestreeView->selectionModel() -> selectedIndexes (); QList<QModelIndex> selectedIndexList= ui.messagestreeView->selectionModel() -> selectedIndexes ();
QList<int> rowList; QList<int> rowList;
QModelIndex selectedIndex; QModelIndex selectedIndex;
for(QList<QModelIndex>::iterator it = selectedIndexList.begin(); it != selectedIndexList.end(); it++)
{ for(QList<QModelIndex>::iterator it = selectedIndexList.begin(); it != selectedIndexList.end(); it++) {
selectedIndex = proxyModel->mapToSource(*it); selectedIndex = proxyModel->mapToSource(*it);
int row = selectedIndex.row(); int row = selectedIndex.row();
if (rowList.contains(row) == false) if (rowList.contains(row) == false)
@ -1222,9 +1378,14 @@ void MessagesDialog::removemessage()
} }
} }
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();
rsMsgs->MessageDelete(MessagesModel->item((*it1),COLUMN_MSGID)->text().toStdString()); rsMsgs->MessageDelete(mid.toStdString());
// clean locale config
m_pConfig->beginGroup(CONFIG_SECTION_UNREAD);
m_pConfig->remove (mid);
m_pConfig->endGroup();
} }
insertMessages(); insertMessages();
@ -1494,7 +1655,40 @@ void MessagesDialog::updateMessageSummaryList()
unsigned int inboxCount = 0; unsigned int inboxCount = 0;
/* calculating the new messages */ /* calculating the new messages */
rsMsgs->getMessageCount (&inboxCount, &newInboxCount, &newOutboxCount, &newDraftCount, &newSentboxCount); // rsMsgs->getMessageCount (&inboxCount, &newInboxCount, &newOutboxCount, &newDraftCount, &newSentboxCount);
std::list<MsgInfoSummary> msgList;
std::list<MsgInfoSummary>::const_iterator it;
rsMsgs->getMessageSummaries(msgList);
/*calculating the new messages*/
for (it = msgList.begin(); it != msgList.end(); it++) {
switch (it->msgflags & RS_MSG_BOXMASK) {
case RS_MSG_INBOX:
inboxCount++;
if ((it->msgflags & RS_MSG_NEW) == RS_MSG_NEW) {
newInboxCount++;
} else {
// check locale config
m_pConfig->beginGroup(CONFIG_SECTION_UNREAD);
if (m_pConfig->value(QString::fromStdString(it->msgId), false).toBool()) {
newInboxCount++;
}
m_pConfig->endGroup();
}
break;
case RS_MSG_OUTBOX:
newOutboxCount++;
break;
case RS_MSG_DRAFTBOX:
newDraftCount++;
break;
case RS_MSG_SENTBOX:
newSentboxCount++;
break;
}
}
QString textItem; QString textItem;
/*updating the labels in leftcolumn*/ /*updating the labels in leftcolumn*/
@ -1542,7 +1736,6 @@ 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(2);
if (newDraftCount != 0) if (newDraftCount != 0)

View File

@ -33,6 +33,8 @@
#include "mainpage.h" #include "mainpage.h"
#include "ui_MessagesDialog.h" #include "ui_MessagesDialog.h"
class RSettings;
class MessagesDialog : public MainPage class MessagesDialog : public MainPage
{ {
Q_OBJECT Q_OBJECT
@ -43,7 +45,6 @@ public:
/** Default Destructor */ /** Default Destructor */
~MessagesDialog(); ~MessagesDialog();
void insertMsgTxtAndFiles(QModelIndex index = QModelIndex());
// replaced by shortcut // replaced by shortcut
// virtual void keyPressEvent(QKeyEvent *) ; // virtual void keyPressEvent(QKeyEvent *) ;
void updateMessageSummaryList(); void updateMessageSummaryList();
@ -77,6 +78,9 @@ private slots:
void removemessage(); void removemessage();
void markAsRead();
void markAsUnread();
void anchorClicked (const QUrl &); void anchorClicked (const QUrl &);
void getcurrentrecommended(); void getcurrentrecommended();
@ -100,12 +104,15 @@ private:
class QStandardItemModel *MessagesModel; class QStandardItemModel *MessagesModel;
QSortFilterProxyModel *proxyModel; QSortFilterProxyModel *proxyModel;
void insertMsgTxtAndFiles(QModelIndex index = QModelIndex(), bool bSetToRead = true);
bool getCurrentMsg(std::string &cid, std::string &mid); bool getCurrentMsg(std::string &cid, std::string &mid);
void setMsgAsRead(const QModelIndex &index); void setMsgAsReadUnread(const QList<int> &Rows, bool bRead);
void setCurrentFileName(const QString &fileName); void setCurrentFileName(const QString &fileName);
int getSelectedMsgCount (); int getSelectedMsgCount (QList<int> *pRowsRead, QList<int> *pRowsUnread);
bool isMessageRead(int nRow);
/* internal handle splitter */ /* internal handle splitter */
void togglefileview_internal(); void togglefileview_internal();
@ -118,8 +125,8 @@ private:
std::string mCurrMsgId; std::string mCurrMsgId;
QString fileName; QString fileName;
QFont mFont; QFont mFont;
RSettings *m_pConfig;
// timer and index for showing message // timer and index for showing message
QTimer *timer; QTimer *timer;

View File

@ -270,6 +270,9 @@
<file>images/message-mail-forwarded-read.png</file> <file>images/message-mail-forwarded-read.png</file>
<file>images/message-mail-replied.png</file> <file>images/message-mail-replied.png</file>
<file>images/message-mail-forwarded.png</file> <file>images/message-mail-forwarded.png</file>
<file>images/message-mail-state-read.png</file>
<file>images/message-mail-state-unread.png</file>
<file>images/message-mail-state-header.png</file>
<file>images/message-news.png</file> <file>images/message-news.png</file>
<file>images/message.png</file> <file>images/message.png</file>
<file>images/messages_new.png</file> <file>images/messages_new.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

View File

@ -22,12 +22,13 @@
#include "MessagePage.h" #include "MessagePage.h"
#include "rshare.h" #include "rshare.h"
#include "rsharesettings.h"
MessagePage::MessagePage(QWidget * parent, Qt::WFlags flags) MessagePage::MessagePage(QWidget * parent, Qt::WFlags flags)
: ConfigPage(parent, flags) : ConfigPage(parent, flags)
{ {
ui.setupUi(this); ui.setupUi(this);
setAttribute(Qt::WA_QuitOnClose, false); setAttribute(Qt::WA_QuitOnClose, false);
} }
MessagePage::~MessagePage() MessagePage::~MessagePage()
@ -40,11 +41,12 @@ MessagePage::closeEvent (QCloseEvent * event)
QWidget::closeEvent(event); QWidget::closeEvent(event);
} }
/** Saves the changes on this page */ /** Saves the changes on this page */
bool bool
MessagePage::save(QString &errmsg) MessagePage::save(QString &errmsg)
{ {
Settings->setMsgSetToReadOnActivate(ui.setMsgToReadOnActivate->isChecked());
return true; return true;
} }
@ -52,6 +54,6 @@ MessagePage::save(QString &errmsg)
void void
MessagePage::load() MessagePage::load()
{ {
ui.setMsgToReadOnActivate->setChecked(Settings->getMsgSetToReadOnActivate());
} }

View File

@ -1,170 +1,171 @@
<ui version="4.0" > <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MessagePage</class> <class>MessagePage</class>
<widget class="QWidget" name="MessagePage" > <widget class="QWidget" name="MessagePage">
<property name="geometry" > <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>398</width> <width>556</width>
<height>389</height> <height>389</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy" > <property name="sizePolicy">
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" > <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="palette" > <property name="palette">
<palette> <palette>
<active> <active>
<colorrole role="WindowText" > <colorrole role="WindowText">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>0</blue> <blue>0</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Button" > <colorrole role="Button">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>208</red> <red>208</red>
<green>208</green> <green>208</green>
<blue>208</blue> <blue>208</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Light" > <colorrole role="Light">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Midlight" > <colorrole role="Midlight">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>247</red> <red>247</red>
<green>247</green> <green>247</green>
<blue>247</blue> <blue>247</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Dark" > <colorrole role="Dark">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>104</red> <red>104</red>
<green>104</green> <green>104</green>
<blue>104</blue> <blue>104</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Mid" > <colorrole role="Mid">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>139</red> <red>139</red>
<green>139</green> <green>139</green>
<blue>139</blue> <blue>139</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Text" > <colorrole role="Text">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>0</blue> <blue>0</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="BrightText" > <colorrole role="BrightText">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="ButtonText" > <colorrole role="ButtonText">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>0</blue> <blue>0</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Base" > <colorrole role="Base">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Window" > <colorrole role="Window">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>240</red> <red>240</red>
<green>240</green> <green>240</green>
<blue>240</blue> <blue>240</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Shadow" > <colorrole role="Shadow">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>0</blue> <blue>0</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Highlight" > <colorrole role="Highlight">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>128</blue> <blue>128</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="HighlightedText" > <colorrole role="HighlightedText">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Link" > <colorrole role="Link">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="LinkVisited" > <colorrole role="LinkVisited">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>255</red> <red>255</red>
<green>0</green> <green>0</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="AlternateBase" > <colorrole role="AlternateBase">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>231</red> <red>231</red>
<green>231</green> <green>231</green>
<blue>231</blue> <blue>231</blue>
@ -173,153 +174,153 @@
</colorrole> </colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="WindowText" > <colorrole role="WindowText">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>0</blue> <blue>0</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Button" > <colorrole role="Button">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>208</red> <red>208</red>
<green>208</green> <green>208</green>
<blue>208</blue> <blue>208</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Light" > <colorrole role="Light">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Midlight" > <colorrole role="Midlight">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>247</red> <red>247</red>
<green>247</green> <green>247</green>
<blue>247</blue> <blue>247</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Dark" > <colorrole role="Dark">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>104</red> <red>104</red>
<green>104</green> <green>104</green>
<blue>104</blue> <blue>104</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Mid" > <colorrole role="Mid">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>139</red> <red>139</red>
<green>139</green> <green>139</green>
<blue>139</blue> <blue>139</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Text" > <colorrole role="Text">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>0</blue> <blue>0</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="BrightText" > <colorrole role="BrightText">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="ButtonText" > <colorrole role="ButtonText">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>0</blue> <blue>0</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Base" > <colorrole role="Base">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Window" > <colorrole role="Window">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>240</red> <red>240</red>
<green>240</green> <green>240</green>
<blue>240</blue> <blue>240</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Shadow" > <colorrole role="Shadow">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>0</blue> <blue>0</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Highlight" > <colorrole role="Highlight">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>192</red> <red>192</red>
<green>192</green> <green>192</green>
<blue>192</blue> <blue>192</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="HighlightedText" > <colorrole role="HighlightedText">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>0</blue> <blue>0</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Link" > <colorrole role="Link">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="LinkVisited" > <colorrole role="LinkVisited">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>255</red> <red>255</red>
<green>0</green> <green>0</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="AlternateBase" > <colorrole role="AlternateBase">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>231</red> <red>231</red>
<green>231</green> <green>231</green>
<blue>231</blue> <blue>231</blue>
@ -328,153 +329,153 @@
</colorrole> </colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="WindowText" > <colorrole role="WindowText">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>104</red> <red>104</red>
<green>104</green> <green>104</green>
<blue>104</blue> <blue>104</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Button" > <colorrole role="Button">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>208</red> <red>208</red>
<green>208</green> <green>208</green>
<blue>208</blue> <blue>208</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Light" > <colorrole role="Light">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Midlight" > <colorrole role="Midlight">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>247</red> <red>247</red>
<green>247</green> <green>247</green>
<blue>247</blue> <blue>247</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Dark" > <colorrole role="Dark">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>104</red> <red>104</red>
<green>104</green> <green>104</green>
<blue>104</blue> <blue>104</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Mid" > <colorrole role="Mid">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>139</red> <red>139</red>
<green>139</green> <green>139</green>
<blue>139</blue> <blue>139</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Text" > <colorrole role="Text">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>104</red> <red>104</red>
<green>104</green> <green>104</green>
<blue>104</blue> <blue>104</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="BrightText" > <colorrole role="BrightText">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="ButtonText" > <colorrole role="ButtonText">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>104</red> <red>104</red>
<green>104</green> <green>104</green>
<blue>104</blue> <blue>104</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Base" > <colorrole role="Base">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>240</red> <red>240</red>
<green>240</green> <green>240</green>
<blue>240</blue> <blue>240</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Window" > <colorrole role="Window">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>240</red> <red>240</red>
<green>240</green> <green>240</green>
<blue>240</blue> <blue>240</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Shadow" > <colorrole role="Shadow">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>0</blue> <blue>0</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Highlight" > <colorrole role="Highlight">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>128</blue> <blue>128</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="HighlightedText" > <colorrole role="HighlightedText">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="Link" > <colorrole role="Link">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>0</red> <red>0</red>
<green>0</green> <green>0</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="LinkVisited" > <colorrole role="LinkVisited">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>255</red> <red>255</red>
<green>0</green> <green>0</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="AlternateBase" > <colorrole role="AlternateBase">
<brush brushstyle="SolidPattern" > <brush brushstyle="SolidPattern">
<color alpha="255" > <color alpha="255">
<red>231</red> <red>231</red>
<green>231</green> <green>231</green>
<blue>231</blue> <blue>231</blue>
@ -484,7 +485,7 @@
</disabled> </disabled>
</palette> </palette>
</property> </property>
<property name="font" > <property name="font">
<font> <font>
<family>Arial</family> <family>Arial</family>
<pointsize>8</pointsize> <pointsize>8</pointsize>
@ -495,12 +496,32 @@
<strikeout>false</strikeout> <strikeout>false</strikeout>
</font> </font>
</property> </property>
<property name="contextMenuPolicy" > <property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum> <enum>Qt::NoContextMenu</enum>
</property> </property>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>395</width>
<height>61</height>
</rect>
</property>
<property name="title">
<string>Misc</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QCheckBox" name="setMsgToReadOnActivate">
<property name="text">
<string>Set message to read on activate</string>
</property>
</widget> </widget>
<resources> </item>
<include location="../images.qrc" /> </layout>
</resources> </widget>
</widget>
<resources/>
<connections/> <connections/>
</ui> </ui>

View File

@ -345,3 +345,13 @@ void RshareSettings::loadWidgetInformation(QMainWindow *widget, QToolBar *toolBa
loadWidgetInformation(widget); loadWidgetInformation(widget);
} }
/* Messages */
bool RshareSettings::getMsgSetToReadOnActivate ()
{
return valueFromGroup("MessageDialog", "SetMsgToReadOnActivate", true).toBool();
}
void RshareSettings::setMsgSetToReadOnActivate (bool bValue)
{
setValueToGroup("MessageDialog", "SetMsgToReadOnActivate", bValue);
}

View File

@ -126,6 +126,10 @@ public:
//! Method overload. Restore window and toolbar information. //! Method overload. Restore window and toolbar information.
void loadWidgetInformation(QMainWindow *widget, QToolBar *toolBar); void loadWidgetInformation(QMainWindow *widget, QToolBar *toolBar);
/* Messages */
bool getMsgSetToReadOnActivate ();
void setMsgSetToReadOnActivate (bool bValue);
protected: protected:
/** Default constructor. */ /** Default constructor. */
RshareSettings(); RshareSettings();