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 <QtDebug>
#include <QIcon> #include <QIcon>
#include <QPixmap> #include <QPixmap>
#include <QContextMenuEvent>
#include <QMenu>
#include <QCursor>
#include <QPoint>
#include <QMouseEvent>
#include <QPixmap>
#include "rsiface/rsforums.h" #include "rsiface/rsforums.h"
#include "rsiface/rsfiles.h" #include "rsiface/rsfiles.h"
@ -56,12 +62,16 @@ CreateForumMsg::CreateForumMsg(std::string fId, std::string pId)
RshareSettings config; RshareSettings config;
config.loadWidgetInformation(this); config.loadWidgetInformation(this);
connect( ui.forumMessage, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( forumMessageCostumPopupMenu( QPoint ) ) );
// connect up the buttons. // connect up the buttons.
connect( ui.postmessage_action, SIGNAL( triggered (bool) ), this, SLOT( createMsg( ) ) ); connect( ui.postmessage_action, SIGNAL( triggered (bool) ), this, SLOT( createMsg( ) ) );
connect( ui.close_action, SIGNAL( triggered (bool) ), this, SLOT( cancelMsg( ) ) ); connect( ui.close_action, SIGNAL( triggered (bool) ), this, SLOT( cancelMsg( ) ) );
connect( ui.emoticonButton, SIGNAL(clicked()), this, SLOT(smileyWidgetForums())); connect( ui.emoticonButton, SIGNAL(clicked()), this, SLOT(smileyWidgetForums()));
connect( ui.attachFileButton, SIGNAL(clicked() ), this , SLOT(addFile())); connect( ui.attachFileButton, SIGNAL(clicked() ), this , SLOT(addFile()));
connect( ui.pastersButton, SIGNAL(clicked() ), this , SLOT(pasteLink())); connect( ui.pastersButton, SIGNAL(clicked() ), this , SLOT(pasteLink()));
newMsg(); newMsg();
@ -69,6 +79,24 @@ CreateForumMsg::CreateForumMsg(std::string fId, std::string pId)
} }
/** 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() void CreateForumMsg::newMsg()
{ {

View File

@ -43,6 +43,8 @@ public:
void loadEmoticonsForums(); void loadEmoticonsForums();
private slots: private slots:
/** Create the context popup menu and it's submenus */
void forumMessageCostumPopupMenu( QPoint point );
void fileHashingFinished(AttachFileItem* file); void fileHashingFinished(AttachFileItem* file);
/* actions to take.... */ /* actions to take.... */
@ -58,6 +60,11 @@ private slots:
private: 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 mForumId;
std::string mParentId; std::string mParentId;

View File

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