Merge pull request #80 from AsamK/paste_plain_text

Add "Paste as plain text" to context menu of RS text edits
This commit is contained in:
Cyril Soler 2015-09-02 20:32:23 -04:00
commit 0b50aa28f3
2 changed files with 9 additions and 1 deletions

View File

@ -19,6 +19,8 @@
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QApplication>
#include <QClipboard>
#include <QMimeData>
#include <QTextDocumentFragment>
#include <QCompleter>
@ -228,6 +230,7 @@ void MimeTextEdit::contextMenuEvent(QContextMenuEvent *e)
QMenu *contextMenu = createStandardContextMenu(e->pos());
/* Add actions for pasting links */
contextMenu->addAction( tr("Paste as plain text"), this, SLOT(pastePlainText()));
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()));
@ -260,3 +263,8 @@ void MimeTextEdit::pasteOwnCertificateLink()
insertHtml(link.toHtml() + " ");
}
}
void MimeTextEdit::pastePlainText()
{
insertPlainText(QApplication::clipboard()->text());
}

View File

@ -58,7 +58,7 @@ private slots:
void insertCompletion(const QString &completion);
void pasteLink();
void pasteOwnCertificateLink();
void pastePlainText();
private:
QString textUnderCursor() const;