From abd6b46ca0546e01032e0cd7c61d561005ee4318 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Mon, 30 Dec 2013 19:12:16 +0000 Subject: [PATCH] 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 --- retroshare-gui/src/gui/RetroShareLink.cpp | 12 - retroshare-gui/src/gui/RetroShareLink.h | 4 - retroshare-gui/src/gui/chat/ChatWidget.cpp | 43 +--- retroshare-gui/src/gui/chat/ChatWidget.h | 4 +- retroshare-gui/src/gui/chat/ChatWidget.ui | 3 - .../src/gui/common/MimeTextEdit.cpp | 237 +++++++++++------- retroshare-gui/src/gui/common/MimeTextEdit.h | 45 ++-- .../src/gui/forums/CreateForumMsg.cpp | 43 ---- .../src/gui/forums/CreateForumMsg.h | 6 - .../src/gui/forums/CreateForumMsg.ui | 20 -- .../src/gui/gxsforums/CreateGxsForumMsg.cpp | 43 ---- .../src/gui/gxsforums/CreateGxsForumMsg.h | 6 - .../src/gui/gxsforums/CreateGxsForumMsg.ui | 44 +--- .../src/gui/msgs/MessageComposer.cpp | 18 -- retroshare-gui/src/gui/msgs/MessageComposer.h | 2 - .../src/gui/msgs/MessageComposer.ui | 3 - retroshare-gui/src/lang/retroshare_en.ts | 47 ++-- 17 files changed, 206 insertions(+), 374 deletions(-) diff --git a/retroshare-gui/src/gui/RetroShareLink.cpp b/retroshare-gui/src/gui/RetroShareLink.cpp index 0213ddfd2..44da7d19c 100644 --- a/retroshare-gui/src/gui/RetroShareLink.cpp +++ b/retroshare-gui/src/gui/RetroShareLink.cpp @@ -1733,18 +1733,6 @@ QString RSLinkClipboard::toHtml() return res ; } -QString RSLinkClipboard::toHtmlFull() -{ - QList links; - parseClipboard(links); - - QString res ; - for(int i = 0; i < links.size(); ++i) - res += links[i].toHtmlFull() + "
" ; - - return res ; -} - bool RSLinkClipboard::empty(RetroShareLink::enumType type /* = RetroShareLink::TYPE_UNKNOWN*/) { QList links; diff --git a/retroshare-gui/src/gui/RetroShareLink.h b/retroshare-gui/src/gui/RetroShareLink.h index 91045a417..582ce0ebc 100644 --- a/retroshare-gui/src/gui/RetroShareLink.h +++ b/retroshare-gui/src/gui/RetroShareLink.h @@ -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(); diff --git a/retroshare-gui/src/gui/chat/ChatWidget.cpp b/retroshare-gui/src/gui/chat/ChatWidget.cpp index 1d19ae093..20b1efb22 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.cpp +++ b/retroshare-gui/src/gui/chat/ChatWidget.cpp @@ -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); diff --git a/retroshare-gui/src/gui/chat/ChatWidget.h b/retroshare-gui/src/gui/chat/ChatWidget.h index 973cbc4eb..99d367104 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.h +++ b/retroshare-gui/src/gui/chat/ChatWidget.h @@ -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(); diff --git a/retroshare-gui/src/gui/chat/ChatWidget.ui b/retroshare-gui/src/gui/chat/ChatWidget.ui index b38536149..e7825959a 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.ui +++ b/retroshare-gui/src/gui/chat/ChatWidget.ui @@ -287,9 +287,6 @@ border-image: url(:/images/closepressed.png) 30 - - Qt::CustomContextMenu - diff --git a/retroshare-gui/src/gui/common/MimeTextEdit.cpp b/retroshare-gui/src/gui/common/MimeTextEdit.cpp index c7d715653..cb081a751 100644 --- a/retroshare-gui/src/gui/common/MimeTextEdit.cpp +++ b/retroshare-gui/src/gui/common/MimeTextEdit.cpp @@ -21,20 +21,24 @@ #include #include -#include "MimeTextEdit.h" -#include "util/HandleRichText.h" #include #include #include #include +#include + +#include "MimeTextEdit.h" +#include "util/HandleRichText.h" +#include "gui/RetroShareLink.h" + +#include 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::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() + " "); + } } diff --git a/retroshare-gui/src/gui/common/MimeTextEdit.h b/retroshare-gui/src/gui/common/MimeTextEdit.h index 13325883f..637b7b603 100644 --- a/retroshare-gui/src/gui/common/MimeTextEdit.h +++ b/retroshare-gui/src/gui/common/MimeTextEdit.h @@ -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 mContextMenuActions; }; #endif // MIMETEXTEDIT_H diff --git a/retroshare-gui/src/gui/forums/CreateForumMsg.cpp b/retroshare-gui/src/gui/forums/CreateForumMsg.cpp index e49a0c185..8b7838844 100644 --- a/retroshare-gui/src/gui/forums/CreateForumMsg.cpp +++ b/retroshare-gui/src/gui/forums/CreateForumMsg.cpp @@ -21,7 +21,6 @@ #include "CreateForumMsg.h" -#include #include #include #include @@ -30,7 +29,6 @@ #include #include -#include #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)), this, SLOT(fileHashingFinished(QList))); // 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 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() + " "); - } -} diff --git a/retroshare-gui/src/gui/forums/CreateForumMsg.h b/retroshare-gui/src/gui/forums/CreateForumMsg.h index 589068152..3c5ddc81e 100644 --- a/retroshare-gui/src/gui/forums/CreateForumMsg.h +++ b/retroshare-gui/src/gui/forums/CreateForumMsg.h @@ -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 hashedFiles); /* actions to take.... */ void createMsg(); - void pasteLink(); - void pasteLinkFull(); - void pasteOwnCertificateLink(); void smileyWidgetForums(); void addSmileys(); diff --git a/retroshare-gui/src/gui/forums/CreateForumMsg.ui b/retroshare-gui/src/gui/forums/CreateForumMsg.ui index 305d2ff55..9696fad99 100644 --- a/retroshare-gui/src/gui/forums/CreateForumMsg.ui +++ b/retroshare-gui/src/gui/forums/CreateForumMsg.ui @@ -195,23 +195,6 @@ - - - - Qt::NoFocus - - - Paste RetroShare Link - - - - :/images/pasterslink.png:/images/pasterslink.png - - - true - - - @@ -223,9 +206,6 @@ - - Qt::CustomContextMenu - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> diff --git a/retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.cpp b/retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.cpp index 29c0370af..1b2815453 100644 --- a/retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.cpp +++ b/retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.cpp @@ -21,7 +21,6 @@ #include "CreateGxsForumMsg.h" -#include #include #include #include @@ -29,7 +28,6 @@ #include #include -#include #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)), this, SLOT(fileHashingFinished(QList))); // 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 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()"; diff --git a/retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.h b/retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.h index e996dcec7..8f82926fd 100644 --- a/retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.h +++ b/retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.h @@ -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 hashedFiles); /* actions to take.... */ void createMsg(); - void pasteLink(); - void pasteLinkFull(); - void pasteOwnCertificateLink(); void smileyWidgetForums(); void addSmileys(); diff --git a/retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.ui b/retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.ui index 7e69a30bf..2ba243dc8 100644 --- a/retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.ui +++ b/retroshare-gui/src/gui/gxsforums/CreateGxsForumMsg.ui @@ -187,26 +187,6 @@ - - - - Qt::NoFocus - - - Paste RetroShare Link - - - - - - - :/images/pasterslink.png:/images/pasterslink.png - - - true - - - @@ -217,10 +197,7 @@ - - - Qt::CustomContextMenu - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> @@ -296,9 +273,15 @@ p, li { white-space: pre-wrap; } - GxsIdChooser - QComboBox -
gui/gxs/GxsIdChooser.h
+ HashBox + QScrollArea +
gui/common/HashBox.h
+ 1 +
+ + MimeTextEdit + QTextEdit +
gui/common/MimeTextEdit.h
HeaderFrame @@ -307,10 +290,9 @@ p, li { white-space: pre-wrap; } 1 - HashBox - QScrollArea -
gui/common/HashBox.h
- 1 + GxsIdChooser + QComboBox +
gui/gxs/GxsIdChooser.h
diff --git a/retroshare-gui/src/gui/msgs/MessageComposer.cpp b/retroshare-gui/src/gui/msgs/MessageComposer.cpp index a73aabf56..d4ca280b5 100644 --- a/retroshare-gui/src/gui/msgs/MessageComposer.cpp +++ b/retroshare-gui/src/gui/msgs/MessageComposer.cpp @@ -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); diff --git a/retroshare-gui/src/gui/msgs/MessageComposer.h b/retroshare-gui/src/gui/msgs/MessageComposer.h index d3a1ed70e..7a58a0e87 100644 --- a/retroshare-gui/src/gui/msgs/MessageComposer.h +++ b/retroshare-gui/src/gui/msgs/MessageComposer.h @@ -84,8 +84,6 @@ protected: private slots: /* toggle Contacts DockWidget */ - void contextMenu(QPoint); - void pasteLink(); void contextMenuFileList(QPoint); void contextMenuMsgSendList(QPoint); void pasteRecommended(); diff --git a/retroshare-gui/src/gui/msgs/MessageComposer.ui b/retroshare-gui/src/gui/msgs/MessageComposer.ui index 57eec1505..d13d0a434 100644 --- a/retroshare-gui/src/gui/msgs/MessageComposer.ui +++ b/retroshare-gui/src/gui/msgs/MessageComposer.ui @@ -671,9 +671,6 @@ 4 - - Qt::CustomContextMenu - Qt::TextEditorInteraction diff --git a/retroshare-gui/src/lang/retroshare_en.ts b/retroshare-gui/src/lang/retroshare_en.ts index ba4185235..efedaa4c7 100644 --- a/retroshare-gui/src/lang/retroshare_en.ts +++ b/retroshare-gui/src/lang/retroshare_en.ts @@ -1870,14 +1870,6 @@ Double click lobbies to enter and chat. Reset font to default - - Paste RetroShare Link - - - - Paste my certificate link - - is typing... @@ -3883,10 +3875,6 @@ p, li { white-space: pre-wrap; } Sign Message - - Paste RetroShare Link - - Forum Post @@ -3903,14 +3891,6 @@ p, li { white-space: pre-wrap; } Start New Thread - - Paste full RetroShare Link - - - - Paste my certificate link - - In Reply to @@ -4094,10 +4074,6 @@ p, li { white-space: pre-wrap; } Sign Message - - Paste RetroShare Link - - Forum Post @@ -4114,14 +4090,6 @@ p, li { white-space: pre-wrap; } Start New Thread - - Paste full RetroShare Link - - - - Paste my certificate link - - No Forum @@ -9659,6 +9627,17 @@ Do you want to save message ? + + MimeTextEdit + + Paste RetroShare Link + + + + Paste my certificate link + + + MsgItem @@ -11661,6 +11640,10 @@ Make sure you know who you're talking to. Chat connection is unauthenticated + + Id: + + QuickStartWizard