From c9599fa1edaee0d51be5b724bd656de9f05e3a22 Mon Sep 17 00:00:00 2001 From: defnax Date: Tue, 23 Feb 2010 16:55:29 +0000 Subject: [PATCH] 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 --- .../src/gui/forums/CreateForumMsg.cpp | 28 +++++++++++++++++++ .../src/gui/forums/CreateForumMsg.h | 7 +++++ .../src/gui/forums/CreateForumMsg.ui | 23 +++++++++++---- 3 files changed, 53 insertions(+), 5 deletions(-) diff --git a/retroshare-gui/src/gui/forums/CreateForumMsg.cpp b/retroshare-gui/src/gui/forums/CreateForumMsg.cpp index 30e8b3ff5..21b52ccc4 100644 --- a/retroshare-gui/src/gui/forums/CreateForumMsg.cpp +++ b/retroshare-gui/src/gui/forums/CreateForumMsg.cpp @@ -37,6 +37,12 @@ #include #include #include +#include +#include +#include +#include +#include +#include #include "rsiface/rsforums.h" #include "rsiface/rsfiles.h" @@ -56,12 +62,16 @@ 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( ) ) ); connect( ui.emoticonButton, SIGNAL(clicked()), this, SLOT(smileyWidgetForums())); connect( ui.attachFileButton, SIGNAL(clicked() ), this , SLOT(addFile())); connect( ui.pastersButton, SIGNAL(clicked() ), this , SLOT(pasteLink())); + + 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() { diff --git a/retroshare-gui/src/gui/forums/CreateForumMsg.h b/retroshare-gui/src/gui/forums/CreateForumMsg.h index 7606627af..250a60e67 100644 --- a/retroshare-gui/src/gui/forums/CreateForumMsg.h +++ b/retroshare-gui/src/gui/forums/CreateForumMsg.h @@ -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; diff --git a/retroshare-gui/src/gui/forums/CreateForumMsg.ui b/retroshare-gui/src/gui/forums/CreateForumMsg.ui index cc847526d..545970e1f 100644 --- a/retroshare-gui/src/gui/forums/CreateForumMsg.ui +++ b/retroshare-gui/src/gui/forums/CreateForumMsg.ui @@ -109,7 +109,7 @@ border: 1px solid #CCCCCC;} 6 - + @@ -123,10 +123,13 @@ border: 1px solid #CCCCCC;} 24 + + true + - + @@ -140,6 +143,9 @@ border: 1px solid #CCCCCC;} 24 + + true + @@ -176,7 +182,7 @@ border: 1px solid #CCCCCC;} - + Paste retroshare link @@ -185,7 +191,10 @@ border: 1px solid #CCCCCC;} - :/images/copyrslink.png:/images/copyrslink.png + :/images/pasterslink.png:/images/pasterslink.png + + + true @@ -214,7 +223,11 @@ border: 1px solid #CCCCCC;} - + + + Qt::CustomContextMenu + +