mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-15 04:22:27 -04:00
all messages in MessagesDialog are now editable from context menu or with double click
changes from defnax with some corrections from me git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3135 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
f4186fb7c8
commit
5b1fae0123
4 changed files with 54 additions and 34 deletions
|
@ -755,12 +755,22 @@ void MessagesDialog::messageslistWidgetCostumPopupMenu( QPoint point )
|
|||
connect( forwardmsgAct , SIGNAL( triggered() ), this, SLOT( forwardmessage() ) );
|
||||
contextMnu.addAction( forwardmsgAct);
|
||||
|
||||
contextMnu.addSeparator();
|
||||
|
||||
QList<int> RowsRead;
|
||||
QList<int> RowsUnread;
|
||||
int nCount = getSelectedMsgCount (NULL, &RowsRead, &RowsUnread);
|
||||
|
||||
QAction *editAct = new QAction(tr( "Edit..." ), this );
|
||||
connect(editAct, SIGNAL(triggered()), this, SLOT(editmessage()));
|
||||
contextMnu.addAction(editAct);
|
||||
|
||||
if (nCount == 1) {
|
||||
editAct->setEnabled(true);
|
||||
} else {
|
||||
editAct->setDisabled(true);
|
||||
}
|
||||
|
||||
contextMnu.addSeparator();
|
||||
|
||||
QAction *markAsRead = new QAction(QIcon(":/images/message-mail-read.png"), tr( "Mark as read" ), this);
|
||||
connect(markAsRead , SIGNAL(triggered()), this, SLOT(markAsRead()));
|
||||
contextMnu.addAction(markAsRead);
|
||||
|
@ -782,7 +792,7 @@ void MessagesDialog::messageslistWidgetCostumPopupMenu( QPoint point )
|
|||
contextMnu.addSeparator();
|
||||
|
||||
QAction *removemsgAct;
|
||||
if (nCount > 1) {
|
||||
if (nCount > 1) {
|
||||
removemsgAct = new QAction(QIcon(IMAGE_MESSAGEREMOVE), tr( "Remove Messages" ), this );
|
||||
} else {
|
||||
removemsgAct = new QAction(QIcon(IMAGE_MESSAGEREMOVE), tr( "Remove Message" ), this );
|
||||
|
@ -858,6 +868,30 @@ void MessagesDialog::newmessage()
|
|||
/* window will destroy itself! */
|
||||
}
|
||||
|
||||
void MessagesDialog::editmessage()
|
||||
{
|
||||
std::string cid;
|
||||
std::string mid;
|
||||
|
||||
if(!getCurrentMsg(cid, mid))
|
||||
return ;
|
||||
|
||||
MessageInfo msgInfo;
|
||||
if (!rsMsgs->getMessage(mid, msgInfo)) {
|
||||
std::cerr << "MessagesDialog::editmessage() Couldn't find Msg" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
MessageComposer *pMsgDialog = new MessageComposer();
|
||||
/* fill it in */
|
||||
pMsgDialog->newMsg(msgInfo.msgId);
|
||||
|
||||
pMsgDialog->show();
|
||||
pMsgDialog->activateWindow();
|
||||
|
||||
/* window will destroy itself! */
|
||||
}
|
||||
|
||||
void MessagesDialog::replytomessage()
|
||||
{
|
||||
/* put msg on msgBoard, and switch to it. */
|
||||
|
@ -1594,35 +1628,11 @@ void MessagesDialog::clicked(const QModelIndex &index )
|
|||
// double click in messagestreeView
|
||||
void MessagesDialog::doubleClicked(const QModelIndex &index)
|
||||
{
|
||||
int mappedRow = proxyModel->mapToSource(index).row();
|
||||
|
||||
QStandardItem *pItem = MessagesModel->item(mappedRow, COLUMN_MSGID);
|
||||
if (pItem == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::string mid = pItem->text().toStdString();
|
||||
|
||||
MessageInfo msgInfo;
|
||||
if (!rsMsgs->getMessage(mid, msgInfo)) {
|
||||
std::cerr << "MessagesDialog::doubleClicked() Couldn't find Msg" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((msgInfo.msgflags & RS_MSG_BOXMASK) != RS_MSG_DRAFTBOX) {
|
||||
// only draft box for now
|
||||
return;
|
||||
}
|
||||
|
||||
MessageComposer *pMsgDialog = new MessageComposer();
|
||||
/* fill it in */
|
||||
pMsgDialog->newMsg(msgInfo.msgId);
|
||||
|
||||
pMsgDialog->show();
|
||||
pMsgDialog->activateWindow();
|
||||
|
||||
/* window will destroy itself! */
|
||||
/* activate row */
|
||||
clicked (index);
|
||||
|
||||
/* edit message */
|
||||
editmessage();
|
||||
}
|
||||
|
||||
// show current message directly
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue