added context action for Paste retroshare Link

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2399 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2010-02-23 16:55:29 +00:00
parent 6943dbc9ac
commit c9599fa1ed
3 changed files with 53 additions and 5 deletions

View File

@ -37,6 +37,12 @@
#include <QtDebug>
#include <QIcon>
#include <QPixmap>
#include <QContextMenuEvent>
#include <QMenu>
#include <QCursor>
#include <QPoint>
#include <QMouseEvent>
#include <QPixmap>
#include "rsiface/rsforums.h"
#include "rsiface/rsfiles.h"
@ -56,6 +62,8 @@ CreateForumMsg::CreateForumMsg(std::string fId, std::string pId)
RshareSettings config;
config.loadWidgetInformation(this);
connect( ui.forumMessage, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( forumMessageCostumPopupMenu( QPoint ) ) );
// connect up the buttons.
connect( ui.postmessage_action, SIGNAL( triggered (bool) ), this, SLOT( createMsg( ) ) );
connect( ui.close_action, SIGNAL( triggered (bool) ), this, SLOT( cancelMsg( ) ) );
@ -63,12 +71,32 @@ CreateForumMsg::CreateForumMsg(std::string fId, std::string pId)
connect( ui.attachFileButton, SIGNAL(clicked() ), this , SLOT(addFile()));
connect( ui.pastersButton, SIGNAL(clicked() ), this , SLOT(pasteLink()));
newMsg();
loadEmoticonsForums();
}
/** context menu searchTablewidget2 **/
void CreateForumMsg::forumMessageCostumPopupMenu( QPoint point )
{
contextMnu = new QMenu( this );
pasteLinkAct = new QAction(QIcon(":/images/pasterslink.png"), tr( "Paste retroshare Link" ), this );
connect( pasteLinkAct , SIGNAL( triggered() ), this, SLOT( pasteLink() ) );
//pasteLinkAct->setShortcut(QKeySequence::Paste);
contextMnu->clear();
contextMnu->addAction( pasteLinkAct);
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
contextMnu->exec( mevent->globalPos() );
}
void CreateForumMsg::newMsg()
{

View File

@ -43,6 +43,8 @@ public:
void loadEmoticonsForums();
private slots:
/** Create the context popup menu and it's submenus */
void forumMessageCostumPopupMenu( QPoint point );
void fileHashingFinished(AttachFileItem* file);
/* actions to take.... */
@ -58,6 +60,11 @@ private slots:
private:
/** Define the popup menus for the Context menu */
QMenu* contextMnu;
/** Defines the actions for the context menu */
QAction* pasteLinkAct;
std::string mForumId;
std::string mParentId;

View File

@ -109,7 +109,7 @@ border: 1px solid #CCCCCC;}</string>
<number>6</number>
</property>
<item>
<widget class="QPushButton" name="attachFileButton">
<widget class="QToolButton" name="attachFileButton">
<property name="text">
<string/>
</property>
@ -123,10 +123,13 @@ border: 1px solid #CCCCCC;}</string>
<height>24</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="emoticonButton">
<widget class="QToolButton" name="emoticonButton">
<property name="text">
<string/>
</property>
@ -140,6 +143,9 @@ border: 1px solid #CCCCCC;}</string>
<height>24</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
@ -176,7 +182,7 @@ border: 1px solid #CCCCCC;}</string>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pastersButton">
<widget class="QToolButton" name="pastersButton">
<property name="toolTip">
<string>Paste retroshare link</string>
</property>
@ -185,7 +191,10 @@ border: 1px solid #CCCCCC;}</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/copyrslink.png</normaloff>:/images/copyrslink.png</iconset>
<normaloff>:/images/pasterslink.png</normaloff>:/images/pasterslink.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
@ -214,7 +223,11 @@ border: 1px solid #CCCCCC;}</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTextEdit" name="forumMessage"/>
<widget class="QTextEdit" name="forumMessage">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
</widget>
</item>
</layout>
</widget>