* Added Forward Message Button with Forward feature

* set for Reply Message/Forward Message correct WindowTitle from  Message Title
* Added for Forward Message insertForwardPastedText() function to add Forwarded Message in  a <blockquote>.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@841 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2008-11-26 01:19:09 +00:00
parent d19f696278
commit 990fd67052
7 changed files with 734 additions and 644 deletions

View File

@ -46,7 +46,8 @@
/* Images for context menu icons */ /* Images for context menu icons */
#define IMAGE_MESSAGE ":/images/folder-draft.png" #define IMAGE_MESSAGE ":/images/folder-draft.png"
#define IMAGE_MESSAGEREPLY ":/images/mail_reply.png" #define IMAGE_MESSAGEREPLY ":/images/mail_reply.png"
#define IMAGE_MESSAGEREMOVE ":/images/mail_delete.png" #define IMAGE_MESSAGEFORWARD ":/images/mail_forward.png"
#define IMAGE_MESSAGEREMOVE ":/images/message-mail-imapdelete.png"
#define IMAGE_DOWNLOAD ":/images/start.png" #define IMAGE_DOWNLOAD ":/images/start.png"
#define IMAGE_DOWNLOADALL ":/images/startall.png" #define IMAGE_DOWNLOADALL ":/images/startall.png"
@ -66,6 +67,8 @@ MessagesDialog::MessagesDialog(QWidget *parent)
connect(ui.newmessageButton, SIGNAL(clicked()), this, SLOT(newmessage())); connect(ui.newmessageButton, SIGNAL(clicked()), this, SLOT(newmessage()));
connect(ui.removemessageButton, SIGNAL(clicked()), this, SLOT(removemessage())); connect(ui.removemessageButton, SIGNAL(clicked()), this, SLOT(removemessage()));
connect(ui.replymessageButton, SIGNAL(clicked()), this, SLOT(replytomessage())); connect(ui.replymessageButton, SIGNAL(clicked()), this, SLOT(replytomessage()));
connect(ui.forwardmessageButton, SIGNAL(clicked()), this, SLOT(forwardmessage()));
//connect(ui.printbutton, SIGNAL(clicked()), this, SLOT(print())); //connect(ui.printbutton, SIGNAL(clicked()), this, SLOT(print()));
connect(ui.actionPrint, SIGNAL(triggered()), this, SLOT(print())); connect(ui.actionPrint, SIGNAL(triggered()), this, SLOT(print()));
connect(ui.actionPrintPreview, SIGNAL(triggered()), this, SLOT(printpreview())); connect(ui.actionPrintPreview, SIGNAL(triggered()), this, SLOT(printpreview()));
@ -104,11 +107,12 @@ MessagesDialog::MessagesDialog(QWidget *parent)
ui.newmessageButton->setIcon(QIcon(QString(":/images/folder-draft24-pressed.png"))); ui.newmessageButton->setIcon(QIcon(QString(":/images/folder-draft24-pressed.png")));
ui.replymessageButton->setIcon(QIcon(QString(":/images/replymail-pressed.png"))); ui.replymessageButton->setIcon(QIcon(QString(":/images/replymail-pressed.png")));
ui.forwardmessageButton->setIcon(QIcon(QString(":/images/mailforward24-hover.png")));
ui.removemessageButton->setIcon(QIcon(QString(":/images/deletemail-pressed.png"))); ui.removemessageButton->setIcon(QIcon(QString(":/images/deletemail-pressed.png")));
ui.printbutton->setIcon(QIcon(QString(":/images/print24.png"))); ui.printbutton->setIcon(QIcon(QString(":/images/print24.png")));
/*Disabled Reply Button */ ui.forwardmessageButton->setToolTip(tr("Forward selected Message"));
//ui.replymessageButton->setEnabled(false);
QMenu * printmenu = new QMenu(); QMenu * printmenu = new QMenu();
printmenu->addAction(ui.actionPrint); printmenu->addAction(ui.actionPrint);
@ -116,6 +120,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
ui.printbutton->setMenu(printmenu); ui.printbutton->setMenu(printmenu);
ui.msgWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); ui.msgWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
ui.msgWidget->sortItems( 3, Qt::DescendingOrder );
/* Hide platform specific features */ /* Hide platform specific features */
@ -160,6 +165,12 @@ void MessagesDialog::messageslistWidgetCostumPopupMenu( QPoint point )
connect( replytomsgAct , SIGNAL( triggered() ), this, SLOT( replytomessage() ) ); connect( replytomsgAct , SIGNAL( triggered() ), this, SLOT( replytomessage() ) );
contextMnu.addAction( replytomsgAct); contextMnu.addAction( replytomsgAct);
forwardmsgAct = new QAction(QIcon(IMAGE_MESSAGEFORWARD), tr( "Forward Message" ), this );
connect( forwardmsgAct , SIGNAL( triggered() ), this, SLOT( forwardmessage() ) );
contextMnu.addAction( forwardmsgAct);
contextMnu.addSeparator();
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);
@ -225,6 +236,8 @@ void MessagesDialog::replytomessage()
//std::cerr << "MessagesDialog::newmessage()" << std::endl; //std::cerr << "MessagesDialog::newmessage()" << std::endl;
nMsgDialog->newMsg(); nMsgDialog->newMsg();
nMsgDialog->insertTitleText( (QString("Re: ") + QString::fromStdWString(msgInfo.title)).toStdString()) ; nMsgDialog->insertTitleText( (QString("Re: ") + QString::fromStdWString(msgInfo.title)).toStdString()) ;
nMsgDialog->setWindowTitle(tr("Re: ") + QString::fromStdWString(msgInfo.title) ) ;
QTextDocument doc ; QTextDocument doc ;
doc.setHtml(QString::fromStdWString(msgInfo.msg)) ; doc.setHtml(QString::fromStdWString(msgInfo.msg)) ;
@ -236,6 +249,41 @@ void MessagesDialog::replytomessage()
nMsgDialog->activateWindow(); nMsgDialog->activateWindow();
} }
void MessagesDialog::forwardmessage()
{
/* put msg on msgBoard, and switch to it. */
std::string cid;
std::string mid;
if(!getCurrentMsg(cid, mid))
return ;
mCurrCertId = cid;
mCurrMsgId = mid;
MessageInfo msgInfo;
if (!rsMsgs -> getMessage(mid, msgInfo))
return ;
ChanMsgDialog *nMsgDialog = new ChanMsgDialog(true);
/* fill it in */
//std::cerr << "MessagesDialog::newmessage()" << std::endl;
nMsgDialog->newMsg();
nMsgDialog->insertTitleText( (QString("Fwd: ") + QString::fromStdWString(msgInfo.title)).toStdString()) ;
nMsgDialog->setWindowTitle(tr("Fwd: ") + QString::fromStdWString(msgInfo.title) ) ;
QTextDocument doc ;
doc.setHtml(QString::fromStdWString(msgInfo.msg)) ;
std::string cited_text(doc.toPlainText().toStdString()) ;
nMsgDialog->insertForwardPastedText(cited_text) ;
nMsgDialog->addRecipient( msgInfo.srcId ) ;
nMsgDialog->show();
nMsgDialog->activateWindow();
}
void MessagesDialog::togglefileview() void MessagesDialog::togglefileview()
{ {
/* if msg header visible -> hide by changing splitter /* if msg header visible -> hide by changing splitter
@ -459,6 +507,7 @@ void MessagesDialog::insertMessages()
std::ostringstream out; std::ostringstream out;
out << it -> count; out << it -> count;
item -> setText(0, QString::fromStdString(out.str())); item -> setText(0, QString::fromStdString(out.str()));
item -> setTextAlignment( 0, Qt::AlignCenter );
} }
item -> setText(4, QString::fromStdString(it->srcId)); item -> setText(4, QString::fromStdString(it->srcId));

View File

@ -54,6 +54,8 @@ void updateMessages ( QTreeWidgetItem * item, int column );
void newmessage(); void newmessage();
void replytomessage(); void replytomessage();
void forwardmessage();
void print(); void print();
void printpreview(); void printpreview();
@ -79,6 +81,7 @@ private:
/** Defines the actions for the context menu */ /** Defines the actions for the context menu */
QAction* newmsgAct; QAction* newmsgAct;
QAction* replytomsgAct; QAction* replytomsgAct;
QAction* forwardmsgAct;
QAction* removemsgAct; QAction* removemsgAct;
QAction* getRecAct; QAction* getRecAct;

View File

@ -6,7 +6,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>759</width> <width>759</width>
<height>530</height> <height>520</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy" > <property name="sizePolicy" >
@ -577,6 +577,31 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
</item> </item>
<item row="0" column="2" > <item row="0" column="2" >
<widget class="QPushButton" name="forwardmessageButton" >
<property name="minimumSize" >
<size>
<width>28</width>
<height>28</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>28</width>
<height>28</height>
</size>
</property>
<property name="text" >
<string/>
</property>
<property name="iconSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item row="0" column="3" >
<widget class="QPushButton" name="removemessageButton" > <widget class="QPushButton" name="removemessageButton" >
<property name="minimumSize" > <property name="minimumSize" >
<size> <size>
@ -610,7 +635,7 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="3" > <item row="0" column="4" >
<widget class="QPushButton" name="printbutton" > <widget class="QPushButton" name="printbutton" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" > <sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
@ -641,20 +666,20 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="4" > <item row="0" column="5" >
<spacer> <spacer>
<property name="orientation" > <property name="orientation" >
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" > <property name="sizeHint" >
<size> <size>
<width>602</width> <width>541</width>
<height>24</height> <height>20</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="1" column="0" colspan="5" > <item row="1" column="0" colspan="6" >
<widget class="QSplitter" name="splitter_2" > <widget class="QSplitter" name="splitter_2" >
<property name="orientation" > <property name="orientation" >
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>

View File

@ -192,11 +192,14 @@
<file>images/mail_delete.png</file> <file>images/mail_delete.png</file>
<file>images/mail_get.png</file> <file>images/mail_get.png</file>
<file>images/mail_reply.png</file> <file>images/mail_reply.png</file>
<file>images/mail_forward.png</file>
<file>images/mail_send.png</file> <file>images/mail_send.png</file>
<file>images/mail_new.png</file> <file>images/mail_new.png</file>
<file>images/mail_send24.png</file> <file>images/mail_send24.png</file>
<file>images/mailforward24-hover.png</file>
<file>images/message-mail.png</file> <file>images/message-mail.png</file>
<file>images/message-mail-read.png</file>m <file>images/message-mail-read.png</file>
<file>images/message-mail-imapdelete.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/messenger.png</file> <file>images/messenger.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -514,6 +514,15 @@ void ChanMsgDialog::insertPastedText(std::string msg)
ui.msgText->setHtml(QString("<HTML><font color=\"blue\">")+QString::fromStdString(std::string("> ") + msg)+"</font><br/><br/></HTML>") ; ui.msgText->setHtml(QString("<HTML><font color=\"blue\">")+QString::fromStdString(std::string("> ") + msg)+"</font><br/><br/></HTML>") ;
} }
void ChanMsgDialog::insertForwardPastedText(std::string msg)
{
std::string::size_type i=0 ;
while( (i=msg.find_first_of('\n',i+1)) < msg.size())
msg.replace(i,1,std::string("\n<BR/>> ")) ;
ui.msgText->setHtml(QString("<HTML><blockquote ><font color=\"blue\">")+QString::fromStdString(std::string("") + msg)+"</font><br/><br/></blockquote></HTML>") ;
}
void ChanMsgDialog::insertMsgText(std::string msg) void ChanMsgDialog::insertMsgText(std::string msg)
{ {
ui.msgText->setText(QString::fromStdString(msg)); ui.msgText->setText(QString::fromStdString(msg));

View File

@ -54,6 +54,7 @@ void insertChannelSendList(); /* for Channels */
void insertFileList(); /* for Both */ void insertFileList(); /* for Both */
void insertTitleText(std::string title); void insertTitleText(std::string title);
void insertPastedText(std::string msg) ; void insertPastedText(std::string msg) ;
void insertForwardPastedText(std::string msg);
void insertMsgText(std::string msg); void insertMsgText(std::string msg);
void addRecipient(std::string id) ; void addRecipient(std::string id) ;
void Create_New_Image_Tag( const QString urlremoteorlocal ); void Create_New_Image_Tag( const QString urlremoteorlocal );