* 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 */
#define IMAGE_MESSAGE ":/images/folder-draft.png"
#define IMAGE_MESSAGEREPLY ":/images/mail_reply.png"
#define IMAGE_MESSAGEREMOVE ":/images/mail_delete.png"
#define IMAGE_DOWNLOAD ":/images/start.png"
#define IMAGE_DOWNLOADALL ":/images/startall.png"
#define IMAGE_MESSAGE ":/images/folder-draft.png"
#define IMAGE_MESSAGEREPLY ":/images/mail_reply.png"
#define IMAGE_MESSAGEFORWARD ":/images/mail_forward.png"
#define IMAGE_MESSAGEREMOVE ":/images/message-mail-imapdelete.png"
#define IMAGE_DOWNLOAD ":/images/start.png"
#define IMAGE_DOWNLOADALL ":/images/startall.png"
/** Constructor */
@ -66,6 +67,8 @@ MessagesDialog::MessagesDialog(QWidget *parent)
connect(ui.newmessageButton, SIGNAL(clicked()), this, SLOT(newmessage()));
connect(ui.removemessageButton, SIGNAL(clicked()), this, SLOT(removemessage()));
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.actionPrint, SIGNAL(triggered()), this, SLOT(print()));
connect(ui.actionPrintPreview, SIGNAL(triggered()), this, SLOT(printpreview()));
@ -103,19 +106,21 @@ MessagesDialog::MessagesDialog(QWidget *parent)
msglheader->resizeSection ( 3, 200 );
ui.newmessageButton->setIcon(QIcon(QString(":/images/folder-draft24-pressed.png")));
ui.replymessageButton->setIcon(QIcon(QString(":/images/replymail-pressed.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.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.printbutton->setIcon(QIcon(QString(":/images/print24.png")));
ui.forwardmessageButton->setToolTip(tr("Forward selected Message"));
QMenu * printmenu = new QMenu();
printmenu->addAction(ui.actionPrint);
printmenu->addAction(ui.actionPrintPreview);
ui.printbutton->setMenu(printmenu);
ui.msgWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
ui.msgWidget->sortItems( 3, Qt::DescendingOrder );
/* Hide platform specific features */
@ -160,6 +165,12 @@ void MessagesDialog::messageslistWidgetCostumPopupMenu( QPoint point )
connect( replytomsgAct , SIGNAL( triggered() ), this, SLOT( replytomessage() ) );
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 );
connect( removemsgAct , SIGNAL( triggered() ), this, SLOT( removemessage() ) );
contextMnu.addAction( removemsgAct);
@ -225,6 +236,8 @@ void MessagesDialog::replytomessage()
//std::cerr << "MessagesDialog::newmessage()" << std::endl;
nMsgDialog->newMsg();
nMsgDialog->insertTitleText( (QString("Re: ") + QString::fromStdWString(msgInfo.title)).toStdString()) ;
nMsgDialog->setWindowTitle(tr("Re: ") + QString::fromStdWString(msgInfo.title) ) ;
QTextDocument doc ;
doc.setHtml(QString::fromStdWString(msgInfo.msg)) ;
@ -236,6 +249,41 @@ void MessagesDialog::replytomessage()
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()
{
/* if msg header visible -> hide by changing splitter
@ -459,6 +507,7 @@ void MessagesDialog::insertMessages()
std::ostringstream out;
out << it -> count;
item -> setText(0, QString::fromStdString(out.str()));
item -> setTextAlignment( 0, Qt::AlignCenter );
}
item -> setText(4, QString::fromStdString(it->srcId));

View File

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

View File

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

View File

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