Added a custom context menu for pasting RS-links to the base class MimeTextEdit and removed the custom context menu from derived classes.

Updated english translation.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6977 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2013-12-30 19:12:16 +00:00
parent dddc4356f1
commit abd6b46ca0
17 changed files with 206 additions and 374 deletions

View File

@ -1733,18 +1733,6 @@ QString RSLinkClipboard::toHtml()
return res ;
}
QString RSLinkClipboard::toHtmlFull()
{
QList<RetroShareLink> links;
parseClipboard(links);
QString res ;
for(int i = 0; i < links.size(); ++i)
res += links[i].toHtmlFull() + "<br>" ;
return res ;
}
bool RSLinkClipboard::empty(RetroShareLink::enumType type /* = RetroShareLink::TYPE_UNKNOWN*/)
{
QList<RetroShareLink> links;

View File

@ -187,10 +187,6 @@ class RSLinkClipboard
//
static QString toHtml();
// produces a list of html links that displays the full links
//
static QString toHtmlFull();
// produces a list of html links that displays with the file name + filesize
//
static QString toHtmlSize();

View File

@ -140,6 +140,12 @@ ChatWidget::ChatWidget(QWidget *parent) :
ui->chatTextEdit->setCompleterKeyModifiers(Qt::ControlModifier);
ui->chatTextEdit->setCompleterKey(Qt::Key_Space);
//#ifdef ENABLE_DISTANT_CHAT_AND_MSGS
// contextMnu->addSeparator();
// QAction *action = new QAction(QIcon(":/images/pasterslink.png"), tr("Paste/Create private chat or Message link..."), this);
// connect(action, SIGNAL(triggered()), this, SLOT(pasteCreateMsgLink()));
// ui->chatTextEdit->addContextMenuAction(action);
//#endif
}
ChatWidget::~ChatWidget()
@ -608,43 +614,6 @@ void ChatWidget::pasteText(const QString& S)
setColorAndFont();
}
void ChatWidget::pasteLink()
{
//std::cerr << "In paste link" << std::endl;
ui->chatTextEdit->insertHtml(RSLinkClipboard::toHtml());
setColorAndFont();
}
void ChatWidget::pasteOwnCertificateLink()
{
//std::cerr << "In paste own certificate link" << std::endl;
RetroShareLink link ;
std::string ownId = rsPeers->getOwnId() ;
if( link.createCertificate(ownId) ) {
ui->chatTextEdit->insertHtml(link.toHtml() + " ");
setColorAndFont();
}
}
void ChatWidget::contextMenu(QPoint point)
{
std::cerr << "In context menu" << std::endl;
QMenu *contextMnu = ui->chatTextEdit->createStandardContextMenu(point);
contextMnu->addSeparator();
QAction *action = contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste RetroShare Link"), this, SLOT(pasteLink()));
action->setDisabled(RSLinkClipboard::empty());
contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste my certificate link"), this, SLOT(pasteOwnCertificateLink()));
//#ifdef ENABLE_DISTANT_CHAT_AND_MSGS
// contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste/Create private chat or Message link..."), this, SLOT(pasteCreateMsgLink()));
//#endif
contextMnu->exec(QCursor::pos());
delete(contextMnu);
}
void ChatWidget::pasteCreateMsgLink()
{
RSettingsWin::showYourself(this, RSettingsWin::Chat);

View File

@ -81,6 +81,7 @@ public:
public slots:
void updateStatus(const QString &peer_id, int status);
private slots:
void pasteCreateMsgLink() ;
void clearChatHistory();
@ -100,9 +101,6 @@ protected:
void updateTitle();
private slots:
void pasteLink();
void pasteOwnCertificateLink();
void contextMenu(QPoint);
void contextMenuTextBrowser(QPoint);
void chatCharFormatChanged();

View File

@ -287,9 +287,6 @@ border-image: url(:/images/closepressed.png)
<height>30</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
</widget>
</item>
</layout>

View File

@ -21,20 +21,24 @@
#include <QMimeData>
#include <QTextDocumentFragment>
#include "MimeTextEdit.h"
#include "util/HandleRichText.h"
#include <QCompleter>
#include <QAbstractItemView>
#include <QKeyEvent>
#include <QScrollBar>
#include <QMenu>
#include "MimeTextEdit.h"
#include "util/HandleRichText.h"
#include "gui/RetroShareLink.h"
#include <retroshare/rspeers.h>
MimeTextEdit::MimeTextEdit(QWidget *parent)
: QTextEdit(parent), mCompleter(0)
: QTextEdit(parent), mCompleter(0)
{
mCompleterKeyModifiers=Qt::ControlModifier;
mCompleterKey=Qt::Key_Space;
mForceCompleterShowNextKeyEvent=false;
mCompleterStartString="";
mCompleterKeyModifiers = Qt::ControlModifier;
mCompleterKey = Qt::Key_Space;
mForceCompleterShowNextKeyEvent = false;
}
bool MimeTextEdit::canInsertFromMimeData(const QMimeData* source) const
@ -63,7 +67,7 @@ void MimeTextEdit::insertFromMimeData(const QMimeData* source)
QString encodedImage;
if (RsHtml::makeEmbeddedImage(image, encodedImage, 640*480)) {
QTextDocumentFragment fragment = QTextDocumentFragment::fromHtml(encodedImage);
this->textCursor().insertFragment(fragment);
textCursor().insertFragment(fragment);
return;
}
}
@ -76,136 +80,183 @@ void MimeTextEdit::insertFromMimeData(const QMimeData* source)
void MimeTextEdit::setCompleter(QCompleter *completer)
{
if (mCompleter)
QObject::disconnect(mCompleter, 0, this, 0);
if (mCompleter)
QObject::disconnect(mCompleter, 0, this, 0);
mCompleter = completer;
mCompleter = completer;
if (!mCompleter)
return;
if (!mCompleter)
return;
mCompleter->setWidget(this);
mCompleter->setCompletionMode(QCompleter::PopupCompletion);
mCompleter->setCaseSensitivity(Qt::CaseInsensitive);
QObject::connect(mCompleter, SIGNAL(activated(QString)),
this, SLOT(insertCompletion(QString)));
mCompleter->setWidget(this);
mCompleter->setCompletionMode(QCompleter::PopupCompletion);
mCompleter->setCaseSensitivity(Qt::CaseInsensitive);
QObject::connect(mCompleter, SIGNAL(activated(QString)), this, SLOT(insertCompletion(QString)));
}
QCompleter *MimeTextEdit::completer() const
{
return mCompleter;
return mCompleter;
}
void MimeTextEdit::insertCompletion(const QString& completion)
{
if (mCompleter->widget() != this)
return;
QTextCursor tc = textCursor();
if (mCompleter->completionPrefix().length()>0) {
tc.movePosition(QTextCursor::PreviousWord, QTextCursor::KeepAnchor);
}
tc.removeSelectedText();
tc.insertText(mCompleterStartString+completion);
mCompleterStartString="";
setTextCursor(tc);
if (mCompleter->widget() != this)
return;
QTextCursor tc = textCursor();
if (mCompleter->completionPrefix().length() > 0) {
tc.movePosition(QTextCursor::PreviousWord, QTextCursor::KeepAnchor);
}
tc.removeSelectedText();
tc.insertText(mCompleterStartString+completion);
mCompleterStartString.clear();
setTextCursor(tc);
}
QString MimeTextEdit::textUnderCursor() const
{
QTextCursor tc = textCursor();
tc.select(QTextCursor::WordUnderCursor);
return tc.selectedText();
QTextCursor tc = textCursor();
tc.select(QTextCursor::WordUnderCursor);
return tc.selectedText();
}
void MimeTextEdit::focusInEvent(QFocusEvent *e)
{
if (mCompleter)
mCompleter->setWidget(this);
QTextEdit::focusInEvent(e);
if (mCompleter)
mCompleter->setWidget(this);
QTextEdit::focusInEvent(e);
}
void MimeTextEdit::keyPressEvent(QKeyEvent *e)
{
if (mCompleter && mCompleter->popup()->isVisible()) {
// The following keys are forwarded by the completer to the widget
switch (e->key()) {
case Qt::Key_Enter:
case Qt::Key_Return:
case Qt::Key_Escape:
case Qt::Key_Tab:
case Qt::Key_Backtab:
mCompleter->popup()->hide();
mForceCompleterShowNextKeyEvent=false;
e->ignore();
return; // let the completer do default behavior
default:
break;
}
}
if (mCompleter && mCompleter->popup()->isVisible()) {
// The following keys are forwarded by the completer to the widget
switch (e->key()) {
case Qt::Key_Enter:
case Qt::Key_Return:
case Qt::Key_Escape:
case Qt::Key_Tab:
case Qt::Key_Backtab:
mCompleter->popup()->hide();
mForceCompleterShowNextKeyEvent=false;
e->ignore();
return; // let the completer do default behavior
default:
break;
}
}
bool isShortcut = ((e->modifiers() & mCompleterKeyModifiers) && e->key() == mCompleterKey);
if (isShortcut && !mForceCompleterShowNextKeyEvent) {
mCompleterStartString.clear();
}
isShortcut |= mForceCompleterShowNextKeyEvent;
if (!mCompleter || !isShortcut) // do not process the shortcut when we have a completer
QTextEdit::keyPressEvent(e);
bool isShortcut = ((e->modifiers() & mCompleterKeyModifiers) && e->key() == mCompleterKey);
if (isShortcut && !mForceCompleterShowNextKeyEvent) {
mCompleterStartString="";
}
isShortcut |= mForceCompleterShowNextKeyEvent;
if (!mCompleter || !isShortcut) // do not process the shortcut when we have a completer
QTextEdit::keyPressEvent(e);
if (!mCompleter) return; //Nothing else to do if not mCompleter initialized
if (!mCompleter) return; //Nothing else to do if not mCompleter initialized
if (!isShortcut && (mCompleter && !mCompleter->popup()->isVisible())) {
return;
}
if (!isShortcut && (mCompleter && !mCompleter->popup()->isVisible())) {
return;
}
if (!mForceCompleterShowNextKeyEvent) {
static QString eow(" ~!@#$%^&*()_+{}|:\"<>?,./;'[]\\-="); // end of word
if (!isShortcut && !e->text().isEmpty() && eow.contains(e->text())){
mCompleter->popup()->hide();
return;
}
}
if (!mForceCompleterShowNextKeyEvent) {
static QString eow(" ~!@#$%^&*()_+{}|:\"<>?,./;'[]\\-="); // end of word
if (!isShortcut && !e->text().isEmpty() && eow.contains(e->text())){
mCompleter->popup()->hide();
return;
}
}
QString completionPrefix = textUnderCursor();
if (completionPrefix != mCompleter->completionPrefix()) {
mCompleter->setCompletionPrefix(completionPrefix);
mCompleter->popup()->setCurrentIndex(mCompleter->completionModel()->index(0, 0));
}
QString completionPrefix = textUnderCursor();
if (completionPrefix != mCompleter->completionPrefix()) {
mCompleter->setCompletionPrefix(completionPrefix);
mCompleter->popup()->setCurrentIndex(mCompleter->completionModel()->index(0, 0));
}
QRect cr = cursorRect();
cr.setWidth(mCompleter->popup()->sizeHintForColumn(0) + mCompleter->popup()->verticalScrollBar()->sizeHint().width());
mCompleter->complete(cr); // popup it up!
QRect cr = cursorRect();
cr.setWidth(mCompleter->popup()->sizeHintForColumn(0)
+ mCompleter->popup()->verticalScrollBar()->sizeHint().width());
mCompleter->complete(cr); // popup it up!
if (mCompleter->completionCount()==0 && isShortcut){
QTextEdit::keyPressEvent(e);// Process the key if no match
}
mForceCompleterShowNextKeyEvent=false;
if (mCompleter->completionCount()==0 && isShortcut){
QTextEdit::keyPressEvent(e);// Process the key if no match
}
mForceCompleterShowNextKeyEvent = false;
}
void MimeTextEdit::setCompleterKeyModifiers(Qt::KeyboardModifier modifiers)
{
mCompleterKeyModifiers=modifiers;
mCompleterKeyModifiers = modifiers;
}
Qt::KeyboardModifier MimeTextEdit::getCompleterKeyModifiers() const
{
return mCompleterKeyModifiers;
return mCompleterKeyModifiers;
}
void MimeTextEdit::setCompleterKey(Qt::Key key)
{
mCompleterKey=key;
mCompleterKey = key;
}
Qt::Key MimeTextEdit::getCompleterKey() const
{
return mCompleterKey;
return mCompleterKey;
}
void MimeTextEdit::forceCompleterShowNextKeyEvent(QString startString="")
{
if (!mCompleter) return; //Nothing else to do if not mCompleter initialized
if(!mCompleter->popup()->isVisible()){
mForceCompleterShowNextKeyEvent=true;
mCompleterStartString=startString;
void MimeTextEdit::forceCompleterShowNextKeyEvent(QString startString)
{
if (!mCompleter) return; //Nothing else to do if not mCompleter initialized
if(!mCompleter->popup()->isVisible()){
mForceCompleterShowNextKeyEvent = true;
mCompleterStartString = startString;
}
}
void MimeTextEdit::addContextMenuAction(QAction *action)
{
mContextMenuActions.push_back(action);
}
void MimeTextEdit::contextMenuEvent(QContextMenuEvent *e)
{
emit calculateContextMenuActions();
QMenu *contextMenu = createStandardContextMenu(e->pos());
/* Add actions for pasting links */
contextMenu->addSeparator();
QAction *pasteLinkAction = contextMenu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste RetroShare Link"), this, SLOT(pasteLink()));
contextMenu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste my certificate link"), this, SLOT(pasteOwnCertificateLink()));
if (RSLinkClipboard::empty()) {
pasteLinkAction->setDisabled(true);
}
QList<QAction*>::iterator it;
for (it = mContextMenuActions.begin(); it != mContextMenuActions.end(); ++it) {
contextMenu->addAction(*it);
}
contextMenu->exec(QCursor::pos());
delete(contextMenu);
}
void MimeTextEdit::pasteLink()
{
insertHtml(RSLinkClipboard::toHtml()) ;
}
void MimeTextEdit::pasteOwnCertificateLink()
{
RetroShareLink link;
std::string ownId = rsPeers->getOwnId();
if (link.createCertificate(ownId)) {
insertHtml(link.toHtml() + " ");
}
}

View File

@ -32,34 +32,43 @@ class MimeTextEdit : public QTextEdit
public:
MimeTextEdit(QWidget *parent = 0);
//Form here: http://qt-project.org/doc/qt-4.8/tools-customcompleter.html
void setCompleter(QCompleter *completer);
QCompleter *completer() const;
void setCompleterKeyModifiers(Qt::KeyboardModifier modifiers);
Qt::KeyboardModifier getCompleterKeyModifiers() const;
void setCompleterKey(Qt::Key key);
Qt::Key getCompleterKey() const;
void forceCompleterShowNextKeyEvent(QString startString);
//Form here: http://qt-project.org/doc/qt-4.8/tools-customcompleter.html
void setCompleter(QCompleter *completer);
QCompleter *completer() const;
void setCompleterKeyModifiers(Qt::KeyboardModifier modifiers);
Qt::KeyboardModifier getCompleterKeyModifiers() const;
void setCompleterKey(Qt::Key key);
Qt::Key getCompleterKey() const;
void forceCompleterShowNextKeyEvent(QString startString = "");
// Add QAction to context menu (action won't be deleted)
void addContextMenuAction(QAction *action);
signals:
void calculateContextMenuActions();
protected:
virtual bool canInsertFromMimeData(const QMimeData* source) const;
virtual void insertFromMimeData(const QMimeData* source);
void keyPressEvent(QKeyEvent *e);
void focusInEvent(QFocusEvent *e);
virtual void contextMenuEvent(QContextMenuEvent *e);
virtual void keyPressEvent(QKeyEvent *e);
virtual void focusInEvent(QFocusEvent *e);
private slots:
void insertCompletion(const QString &completion);
void insertCompletion(const QString &completion);
void pasteLink();
void pasteOwnCertificateLink();
private:
QString textUnderCursor() const;
QString textUnderCursor() const;
private:
QCompleter *mCompleter;
Qt::KeyboardModifier mCompleterKeyModifiers;
Qt::Key mCompleterKey;
bool mForceCompleterShowNextKeyEvent;
QString mCompleterStartString;
QCompleter *mCompleter;
Qt::KeyboardModifier mCompleterKeyModifiers;
Qt::Key mCompleterKey;
bool mForceCompleterShowNextKeyEvent;
QString mCompleterStartString;
QList<QAction*> mContextMenuActions;
};
#endif // MIMETEXTEDIT_H

View File

@ -21,7 +21,6 @@
#include "CreateForumMsg.h"
#include <QMenu>
#include <QMessageBox>
#include <QFile>
#include <QDesktopWidget>
@ -30,7 +29,6 @@
#include <QTextDocumentFragment>
#include <retroshare/rsforums.h>
#include <retroshare/rspeers.h>
#include "gui/settings/rsharesettings.h"
#include "gui/RetroShareLink.h"
@ -58,8 +56,6 @@ CreateForumMsg::CreateForumMsg(const std::string &fId, const std::string &pId)
Settings->loadWidgetInformation(this);
connect( ui.forumMessage, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( forumMessageCostumPopupMenu( QPoint ) ) );
connect(ui.hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>)));
// connect up the buttons.
@ -68,7 +64,6 @@ CreateForumMsg::CreateForumMsg(const std::string &fId, const std::string &pId)
connect( ui.emoticonButton, SIGNAL(clicked()), this, SLOT(smileyWidgetForums()));
connect( ui.attachFileButton, SIGNAL(clicked() ), this , SLOT(addFile()));
connect(ui.attachPictureButton, SIGNAL(clicked()), this, SLOT(addPicture()));
connect( ui.pastersButton, SIGNAL(clicked() ), this , SLOT(pasteLink()));
setAcceptDrops(true);
ui.hashBox->setDropWidget(this);
@ -77,25 +72,6 @@ CreateForumMsg::CreateForumMsg(const std::string &fId, const std::string &pId)
newMsg();
}
/** context menu searchTablewidget2 **/
void CreateForumMsg::forumMessageCostumPopupMenu(QPoint point)
{
QMenu *contextMnu = ui.forumMessage->createStandardContextMenu(point);
contextMnu->addSeparator();
QAction *pasteLinkAct = contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste RetroShare Link"), this, SLOT(pasteLink()));
QAction *pasteLinkFullAct = contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste full RetroShare Link"), this, SLOT(pasteLinkFull()));
contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste my certificate link"), this, SLOT(pasteOwnCertificateLink()));
if (RSLinkClipboard::empty()) {
pasteLinkAct->setDisabled (true);
pasteLinkFullAct->setDisabled (true);
}
contextMnu->exec(QCursor::pos());
delete(contextMnu);
}
void CreateForumMsg::newMsg()
{
/* clear all */
@ -253,22 +229,3 @@ void CreateForumMsg::fileHashingFinished(QList<HashedFile> hashedFiles)
ui.forumMessage->setFocus( Qt::OtherFocusReason );
}
void CreateForumMsg::pasteLink()
{
ui.forumMessage->insertHtml(RSLinkClipboard::toHtml()) ;
}
void CreateForumMsg::pasteLinkFull()
{
ui.forumMessage->insertHtml(RSLinkClipboard::toHtmlFull()) ;
}
void CreateForumMsg::pasteOwnCertificateLink()
{
RetroShareLink link ;
std::string ownId = rsPeers->getOwnId() ;
if( link.createCertificate(ownId) ) {
ui.forumMessage->insertHtml(link.toHtml() + " ");
}
}

View File

@ -35,15 +35,9 @@ public:
void newMsg(); /* cleanup */
private slots:
/** Create the context popup menu and it's submenus */
void forumMessageCostumPopupMenu( QPoint point );
void fileHashingFinished(QList<HashedFile> hashedFiles);
/* actions to take.... */
void createMsg();
void pasteLink();
void pasteLinkFull();
void pasteOwnCertificateLink();
void smileyWidgetForums();
void addSmileys();

View File

@ -195,23 +195,6 @@
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="pastersButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Paste RetroShare Link</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/pasterslink.png</normaloff>:/images/pasterslink.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -223,9 +206,6 @@
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="MimeTextEdit" name="forumMessage">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="html">
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;

View File

@ -21,7 +21,6 @@
#include "CreateGxsForumMsg.h"
#include <QMenu>
#include <QMessageBox>
#include <QFile>
#include <QDesktopWidget>
@ -29,7 +28,6 @@
#include <QPushButton>
#include <retroshare/rsgxsforums.h>
#include <retroshare/rspeers.h>
#include "gui/settings/rsharesettings.h"
#include "gui/RetroShareLink.h"
@ -83,8 +81,6 @@ CreateGxsForumMsg::CreateGxsForumMsg(const std::string &fId, const std::string &
Settings->loadWidgetInformation(this);
connect(ui.forumMessage, SIGNAL( customContextMenuRequested(QPoint)), this, SLOT(forumMessageCostumPopupMenu(QPoint)));
connect(ui.hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>)));
// connect up the buttons.
@ -92,7 +88,6 @@ CreateGxsForumMsg::CreateGxsForumMsg(const std::string &fId, const std::string &
connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(close()));
connect(ui.emoticonButton, SIGNAL(clicked()), this, SLOT(smileyWidgetForums()));
connect(ui.attachFileButton, SIGNAL(clicked()), this, SLOT(addFile()));
connect(ui.pastersButton, SIGNAL(clicked()), this, SLOT(pasteLink()));
connect(ui.generateCheckBox, SIGNAL(toggled(bool)), ui.generateSpinBox, SLOT(setEnabled(bool)));
setAcceptDrops(true);
@ -115,25 +110,6 @@ CreateGxsForumMsg::~CreateGxsForumMsg()
delete(mForumQueue);
}
void CreateGxsForumMsg::forumMessageCostumPopupMenu(QPoint point)
{
QMenu *contextMnu = ui.forumMessage->createStandardContextMenu(point);
contextMnu->addSeparator();
QAction *pasteLinkAct = contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste RetroShare Link"), this, SLOT(pasteLink()));
QAction *pasteLinkFullAct = contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste full RetroShare Link"), this, SLOT(pasteLinkFull()));
contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste my certificate link"), this, SLOT(pasteOwnCertificateLink()));
if (RSLinkClipboard::empty()) {
pasteLinkAct->setDisabled (true);
pasteLinkFullAct->setDisabled (true);
}
contextMnu->exec(QCursor::pos());
delete(contextMnu);
}
void CreateGxsForumMsg::newMsg()
{
/* clear all */
@ -409,25 +385,6 @@ void CreateGxsForumMsg::fileHashingFinished(QList<HashedFile> hashedFiles)
ui.forumMessage->setFocus( Qt::OtherFocusReason );
}
void CreateGxsForumMsg::pasteLink()
{
ui.forumMessage->insertHtml(RSLinkClipboard::toHtml()) ;
}
void CreateGxsForumMsg::pasteLinkFull()
{
ui.forumMessage->insertHtml(RSLinkClipboard::toHtmlFull()) ;
}
void CreateGxsForumMsg::pasteOwnCertificateLink()
{
RetroShareLink link ;
std::string ownId = rsPeers->getOwnId() ;
if( link.createCertificate(ownId) ) {
ui.forumMessage->insertHtml(link.toHtml() + " ");
}
}
void CreateGxsForumMsg::loadForumInfo(const uint32_t &token)
{
std::cerr << "CreateGxsForumMsg::loadForumInfo()";

View File

@ -42,15 +42,9 @@ public:
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
private slots:
/** Create the context popup menu and it's submenus */
void forumMessageCostumPopupMenu( QPoint point );
void fileHashingFinished(QList<HashedFile> hashedFiles);
/* actions to take.... */
void createMsg();
void pasteLink();
void pasteLinkFull();
void pasteOwnCertificateLink();
void smileyWidgetForums();
void addSmileys();

View File

@ -187,26 +187,6 @@
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="pastersButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Paste RetroShare Link</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/pasterslink.png</normaloff>:/images/pasterslink.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -217,10 +197,7 @@
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTextEdit" name="forumMessage">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<widget class="MimeTextEdit" name="forumMessage">
<property name="html">
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
@ -296,9 +273,15 @@ p, li { white-space: pre-wrap; }
</widget>
<customwidgets>
<customwidget>
<class>GxsIdChooser</class>
<extends>QComboBox</extends>
<header>gui/gxs/GxsIdChooser.h</header>
<class>HashBox</class>
<extends>QScrollArea</extends>
<header location="global">gui/common/HashBox.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>MimeTextEdit</class>
<extends>QTextEdit</extends>
<header location="global">gui/common/MimeTextEdit.h</header>
</customwidget>
<customwidget>
<class>HeaderFrame</class>
@ -307,10 +290,9 @@ p, li { white-space: pre-wrap; }
<container>1</container>
</customwidget>
<customwidget>
<class>HashBox</class>
<extends>QScrollArea</extends>
<header location="global">gui/common/HashBox.h</header>
<container>1</container>
<class>GxsIdChooser</class>
<extends>QComboBox</extends>
<header>gui/gxs/GxsIdChooser.h</header>
</customwidget>
</customwidgets>
<resources>

View File

@ -162,7 +162,6 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WindowFlags flags)
connect(ui.msgText, SIGNAL(currentCharFormatChanged(const QTextCharFormat &)), this, SLOT(currentCharFormatChanged(const QTextCharFormat &)));
connect(ui.msgText, SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChanged()));
connect(ui.msgText,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(contextMenu(QPoint)));
connect(ui.msgText->document(), SIGNAL(modificationChanged(bool)), actionSave, SLOT(setEnabled(bool)));
connect(ui.msgText->document(), SIGNAL(modificationChanged(bool)), this, SLOT(setWindowModified(bool)));
@ -565,23 +564,6 @@ void MessageComposer::closeEvent (QCloseEvent * event)
}
}
void MessageComposer::contextMenu(QPoint point)
{
QMenu *contextMnu = ui.msgText->createStandardContextMenu(point);
contextMnu->addSeparator();
QAction *action = contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste RetroShare Link"), this, SLOT(pasteLink()));
action->setDisabled(RSLinkClipboard::empty());
contextMnu->exec(QCursor::pos());
delete(contextMnu);
}
void MessageComposer::pasteLink()
{
ui.msgText->insertHtml(RSLinkClipboard::toHtml()) ;
}
void MessageComposer::contextMenuFileList(QPoint)
{
QMenu contextMnu(this);

View File

@ -84,8 +84,6 @@ protected:
private slots:
/* toggle Contacts DockWidget */
void contextMenu(QPoint);
void pasteLink();
void contextMenuFileList(QPoint);
void contextMenuMsgSendList(QPoint);
void pasteRecommended();

View File

@ -671,9 +671,6 @@
<verstretch>4</verstretch>
</sizepolicy>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::TextEditorInteraction</set>
</property>

View File

@ -1870,14 +1870,6 @@ Double click lobbies to enter and chat.</source>
<source>Reset font to default</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Paste RetroShare Link</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Paste my certificate link</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>is typing...</source>
<translation type="unfinished"></translation>
@ -3883,10 +3875,6 @@ p, li { white-space: pre-wrap; }
<source>Sign Message</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Paste RetroShare Link</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Forum Post</source>
<translation type="unfinished"></translation>
@ -3903,14 +3891,6 @@ p, li { white-space: pre-wrap; }
<source>Start New Thread</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Paste full RetroShare Link</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Paste my certificate link</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>In Reply to</source>
<translation type="unfinished"></translation>
@ -4094,10 +4074,6 @@ p, li { white-space: pre-wrap; }
<source>Sign Message</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Paste RetroShare Link</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Forum Post</source>
<translation type="unfinished"></translation>
@ -4114,14 +4090,6 @@ p, li { white-space: pre-wrap; }
<source>Start New Thread</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Paste full RetroShare Link</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Paste my certificate link</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>No Forum</source>
<translation type="unfinished"></translation>
@ -9659,6 +9627,17 @@ Do you want to save message ?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MimeTextEdit</name>
<message>
<source>Paste RetroShare Link</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Paste my certificate link</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MsgItem</name>
<message>
@ -11661,6 +11640,10 @@ Make sure you know who you&apos;re talking to.</source>
<source>Chat connection is unauthenticated</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Id: </source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QuickStartWizard</name>