Added clear chat history to the context menu of the message text browser.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5456 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2012-08-22 08:19:46 +00:00
parent f2072e9522
commit 28def71b4e
6 changed files with 39 additions and 5 deletions

View file

@ -120,6 +120,8 @@ FriendsDialog::FriendsDialog(QWidget *parent)
connect(ui.Sendbtn, SIGNAL(clicked()), this, SLOT(sendMsg())); connect(ui.Sendbtn, SIGNAL(clicked()), this, SLOT(sendMsg()));
connect(ui.emoticonBtn, SIGNAL(clicked()), this, SLOT(smileyWidgetgroupchat())); connect(ui.emoticonBtn, SIGNAL(clicked()), this, SLOT(smileyWidgetgroupchat()));
connect(ui.msgText,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(contextMenuMsgText(QPoint)));
connect(ui.lineEdit,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(contextMenu(QPoint))); connect(ui.lineEdit,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(contextMenu(QPoint)));
// reset text and color after removing all characters from the QTextEdit and after calling QTextEdit::clear // reset text and color after removing all characters from the QTextEdit and after calling QTextEdit::clear
connect(ui.lineEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(chatCharFormatChanged())); connect(ui.lineEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(chatCharFormatChanged()));
@ -275,6 +277,17 @@ void FriendsDialog::pasteLink()
ui.lineEdit->insertHtml(RSLinkClipboard::toHtml()) ; ui.lineEdit->insertHtml(RSLinkClipboard::toHtml()) ;
} }
void FriendsDialog::contextMenuMsgText(QPoint)
{
QMenu *contextMnu = ui.msgText->createStandardContextMenu();
contextMnu->addSeparator();
contextMnu->addAction(ui.actionClear_Chat_History);
contextMnu->exec(QCursor::pos());
delete(contextMnu);
}
void FriendsDialog::contextMenu(QPoint /*point*/) void FriendsDialog::contextMenu(QPoint /*point*/)
{ {
QMenu *contextMnu = ui.lineEdit->createStandardContextMenu(); QMenu *contextMnu = ui.lineEdit->createStandardContextMenu();

View file

@ -75,6 +75,7 @@ protected:
private slots: private slots:
void pasteLink() ; void pasteLink() ;
void contextMenu(QPoint) ; void contextMenu(QPoint) ;
void contextMenuMsgText(QPoint);
void chatCharFormatChanged(); void chatCharFormatChanged();
void on_actionClear_Chat_History_triggered(); void on_actionClear_Chat_History_triggered();

View file

@ -1202,6 +1202,9 @@ border: 1px solid #CCCCCC;}</string>
<height>60</height> <height>60</height>
</size> </size>
</property> </property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">QTextEdit#msgText{border: 1px solid #CCCCCC; <string notr="true">QTextEdit#msgText{border: 1px solid #CCCCCC;
background: white;}</string> background: white;}</string>

View file

@ -89,6 +89,8 @@ ChatWidget::ChatWidget(QWidget *parent) :
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(const QString&, int)), this, SLOT(updateStatus(const QString&, int))); connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(const QString&, int)), this, SLOT(updateStatus(const QString&, int)));
connect(NotifyQt::getInstance(), SIGNAL(peerHasNewCustomStateString(const QString&, const QString&)), this, SLOT(updatePeersCustomStateString(const QString&, const QString&))); connect(NotifyQt::getInstance(), SIGNAL(peerHasNewCustomStateString(const QString&, const QString&)), this, SLOT(updatePeersCustomStateString(const QString&, const QString&)));
connect(ui->textBrowser, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTextBrowser(QPoint)));
connect(ui->chattextEdit, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint))); connect(ui->chattextEdit, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint)));
// reset text and color after removing all characters from the QTextEdit and after calling QTextEdit::clear // reset text and color after removing all characters from the QTextEdit and after calling QTextEdit::clear
connect(ui->chattextEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(chatCharFormatChanged())); connect(ui->chattextEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(chatCharFormatChanged()));
@ -390,6 +392,17 @@ void ChatWidget::contextMenu(QPoint /*point*/)
delete(contextMnu); delete(contextMnu);
} }
void ChatWidget::contextMenuTextBrowser(QPoint)
{
QMenu *contextMnu = ui->textBrowser->createStandardContextMenu();
contextMnu->addSeparator();
contextMnu->addAction(ui->actionClearChatHistory);
contextMnu->exec(QCursor::pos());
delete(contextMnu);
}
void ChatWidget::chatCharFormatChanged() void ChatWidget::chatCharFormatChanged()
{ {
if (inChatCharFormatChanged) { if (inChatCharFormatChanged) {

View file

@ -99,6 +99,7 @@ private slots:
void pasteLink(); void pasteLink();
void pasteOwnCertificateLink(); void pasteOwnCertificateLink();
void contextMenu(QPoint); void contextMenu(QPoint);
void contextMenuTextBrowser(QPoint);
void chatCharFormatChanged(); void chatCharFormatChanged();
void fileHashingFinished(QList<HashedFile> hashedFiles); void fileHashingFinished(QList<HashedFile> hashedFiles);

View file

@ -180,6 +180,9 @@ border-image: url(:/images/closepressed.png)
<height>30</height> <height>30</height>
</size> </size>
</property> </property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">QTextBrowser{border: 1px solid #B8B6B1; <string notr="true">QTextBrowser{border: 1px solid #B8B6B1;
border-radius: 6px; border-radius: 6px;
@ -656,17 +659,17 @@ background: white;}</string>
</action> </action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget>
<class>LinkTextBrowser</class>
<extends>QTextBrowser</extends>
<header>gui/common/LinkTextBrowser.h</header>
</customwidget>
<customwidget> <customwidget>
<class>HashBox</class> <class>HashBox</class>
<extends>QScrollArea</extends> <extends>QScrollArea</extends>
<header location="global">gui/common/HashBox.h</header> <header location="global">gui/common/HashBox.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>LinkTextBrowser</class>
<extends>QTextBrowser</extends>
<header>gui/common/LinkTextBrowser.h</header>
</customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../images.qrc"/> <include location="../images.qrc"/>