* 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

@ -44,11 +44,12 @@
/* 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_DOWNLOAD ":/images/start.png" #define IMAGE_MESSAGEREMOVE ":/images/message-mail-imapdelete.png"
#define IMAGE_DOWNLOADALL ":/images/startall.png" #define IMAGE_DOWNLOAD ":/images/start.png"
#define IMAGE_DOWNLOADALL ":/images/startall.png"
/** Constructor */ /** Constructor */
@ -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()));
@ -103,19 +106,21 @@ MessagesDialog::MessagesDialog(QWidget *parent)
msglheader->resizeSection ( 3, 200 ); msglheader->resizeSection ( 3, 200 );
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.removemessageButton->setIcon(QIcon(QString(":/images/deletemail-pressed.png"))); ui.forwardmessageButton->setIcon(QIcon(QString(":/images/mailforward24-hover.png")));
ui.printbutton->setIcon(QIcon(QString(":/images/print24.png"))); ui.removemessageButton->setIcon(QIcon(QString(":/images/deletemail-pressed.png")));
ui.printbutton->setIcon(QIcon(QString(":/images/print24.png")));
/*Disabled Reply Button */
//ui.replymessageButton->setEnabled(false); ui.forwardmessageButton->setToolTip(tr("Forward selected Message"));
QMenu * printmenu = new QMenu(); QMenu * printmenu = new QMenu();
printmenu->addAction(ui.actionPrint); printmenu->addAction(ui.actionPrint);
printmenu->addAction(ui.actionPrintPreview); printmenu->addAction(ui.actionPrintPreview);
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

@ -17,34 +17,34 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, * Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
****************************************************************/ ****************************************************************/
#ifndef _MESSAGESDIALOG_H #ifndef _MESSAGESDIALOG_H
#define _MESSAGESDIALOG_H #define _MESSAGESDIALOG_H
#include <QFileDialog> #include <QFileDialog>
#include "mainpage.h"
#include "ui_MessagesDialog.h"
class MessagesDialog : public MainPage
{
Q_OBJECT
public:
/** Default Constructor */
MessagesDialog(QWidget *parent = 0);
/** Default Destructor */
#include "mainpage.h"
#include "ui_MessagesDialog.h"
class MessagesDialog : public MainPage
{
Q_OBJECT
public:
/** Default Constructor */
MessagesDialog(QWidget *parent = 0);
/** Default Destructor */
void insertMessages(); void insertMessages();
void insertMsgTxtAndFiles(); void insertMsgTxtAndFiles();
virtual void keyPressEvent(QKeyEvent *) ; virtual void keyPressEvent(QKeyEvent *) ;
private slots: private slots:
/** Create the context popup menu and it's submenus */ /** Create the context popup menu and it's submenus */
void messageslistWidgetCostumPopupMenu( QPoint point ); void messageslistWidgetCostumPopupMenu( QPoint point );
void msgfilelistWidgetCostumPopupMenu(QPoint); void msgfilelistWidgetCostumPopupMenu(QPoint);
@ -52,14 +52,16 @@ void changeBox( int newrow );
void updateMessages ( QTreeWidgetItem * item, int column ); void updateMessages ( QTreeWidgetItem * item, int column );
void newmessage(); void newmessage();
void replytomessage(); void replytomessage();
void forwardmessage();
void print(); void print();
void printpreview(); void printpreview();
void removemessage(); void removemessage();
void markMsgAsRead(); void markMsgAsRead();
void getcurrentrecommended(); void getcurrentrecommended();
void getallrecommended(); void getallrecommended();
@ -72,21 +74,22 @@ private:
std::string mCurrCertId; std::string mCurrCertId;
std::string mCurrMsgId; std::string mCurrMsgId;
/** Define the popup menus for the Context menu */ /** Define the popup menus for the Context menu */
QMenu* contextMnu; QMenu* contextMnu;
/** 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;
QAction* getAllRecAct; QAction* getAllRecAct;
/** Qt Designer generated object */ /** Qt Designer generated object */
Ui::MessagesDialog ui; Ui::MessagesDialog ui;
}; };
#endif #endif

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

File diff suppressed because it is too large Load diff

View file

@ -17,34 +17,34 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, * Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
****************************************************************/ ****************************************************************/
#ifndef _CHAN_MSG_DIALOG_H #ifndef _CHAN_MSG_DIALOG_H
#define _CHAN_MSG_DIALOG_H #define _CHAN_MSG_DIALOG_H
#include <QMainWindow> #include <QMainWindow>
#include <QMap> #include <QMap>
#include <QPointer> #include <QPointer>
#include <gui/Preferences/rsharesettings.h> #include <gui/Preferences/rsharesettings.h>
#include "ui_ChanMsgDialog.h" #include "ui_ChanMsgDialog.h"
class QAction; class QAction;
class QComboBox; class QComboBox;
class QFontComboBox; class QFontComboBox;
class QTextEdit; class QTextEdit;
class QTextCharFormat; class QTextCharFormat;
class ChanMsgDialog : public QMainWindow
{
Q_OBJECT
public:
/** Default Constructor */
ChanMsgDialog(bool isMsg, QWidget *parent = 0, Qt::WFlags flags = 0); class ChanMsgDialog : public QMainWindow
/** Default Destructor */ {
Q_OBJECT
public:
/** Default Constructor */
ChanMsgDialog(bool isMsg, QWidget *parent = 0, Qt::WFlags flags = 0);
/** Default Destructor */
void newMsg(); void newMsg();
@ -54,13 +54,14 @@ 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 );
QSettings setter; QSettings setter;
public slots: public slots:
/* actions to take.... */ /* actions to take.... */
void sendMessage(); void sendMessage();
void cancelMessage(); void cancelMessage();
@ -71,7 +72,7 @@ protected:
private slots: private slots:
/** Create the context popup menu and it's submenus */ /** Create the context popup menu and it's submenus */
void channelstreeViewCostumPopupMenu( QPoint point ); void channelstreeViewCostumPopupMenu( QPoint point );
/** Defines the context menu functions*/ /** Defines the context menu functions*/
@ -86,25 +87,25 @@ private slots:
void toggleChannelItem( QTreeWidgetItem *item, int col ); void toggleChannelItem( QTreeWidgetItem *item, int col );
void toggleRecommendItem( QTreeWidgetItem *item, int col ); void toggleRecommendItem( QTreeWidgetItem *item, int col );
void fileNew(); void fileNew();
void fileOpen(); void fileOpen();
bool fileSave(); bool fileSave();
bool fileSaveAs(); bool fileSaveAs();
void filePrint(); void filePrint();
//void filePrintPreview(); //void filePrintPreview();
void filePrintPdf(); void filePrintPdf();
void textBold(); void textBold();
void textUnderline(); void textUnderline();
void textItalic(); void textItalic();
void textFamily(const QString &f); void textFamily(const QString &f);
void textSize(const QString &p); void textSize(const QString &p);
void textStyle(int styleIndex); void textStyle(int styleIndex);
void textColor(); void textColor();
void textAlign(QAction *a); void textAlign(QAction *a);
void currentCharFormatChanged(const QTextCharFormat &format); void currentCharFormatChanged(const QTextCharFormat &format);
void cursorPositionChanged(); void cursorPositionChanged();
void clipboardDataChanged(); void clipboardDataChanged();
@ -122,27 +123,27 @@ private:
//bool image_extension( QString nametomake ); //bool image_extension( QString nametomake );
void setCurrentFileName(const QString &fileName); void setCurrentFileName(const QString &fileName);
void mergeFormatOnWordOrSelection(const QTextCharFormat &format); void mergeFormatOnWordOrSelection(const QTextCharFormat &format);
void fontChanged(const QFont &f); void fontChanged(const QFont &f);
void colorChanged(const QColor &c); void colorChanged(const QColor &c);
void alignmentChanged(Qt::Alignment a); void alignmentChanged(Qt::Alignment a);
/** Define the popup menus for the Context menu */ /** Define the popup menus for the Context menu */
QMenu* contextMnu; QMenu* contextMnu;
/** Defines the actions for the context menu */ /** Defines the actions for the context menu */
QAction* deletechannelAct; QAction* deletechannelAct;
QAction* createchannelmsgAct; QAction* createchannelmsgAct;
QAction *actionSave, QAction *actionSave,
*actionAlignLeft, *actionAlignLeft,
*actionAlignCenter, *actionAlignCenter,
*actionAlignRight, *actionAlignRight,
*actionAlignJustify, *actionAlignJustify,
*actionUndo, *actionUndo,
*actionRedo, *actionRedo,
*actionCut, *actionCut,
*actionCopy, *actionCopy,
*actionPaste; *actionPaste;
QTreeView *channelstreeView; QTreeView *channelstreeView;
@ -155,11 +156,11 @@ private:
QHash<QString, int> autoLinkTargetDictionary; QHash<QString, int> autoLinkTargetDictionary;
bool mIsMsg; /* different behaviour for Msg or ChanMsg */ bool mIsMsg; /* different behaviour for Msg or ChanMsg */
/** Qt Designer generated object */
Ui::ChanMsgDialog ui;
}; /** Qt Designer generated object */
Ui::ChanMsgDialog ui;
#endif
};
#endif