CreateForumMsg:

- removed memory leak in context menu
- cleaned includes

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3295 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-07-17 12:40:19 +00:00
parent 0ab77d8a40
commit de57423733
2 changed files with 122 additions and 136 deletions

View File

@ -21,19 +21,22 @@
#include "CreateForumMsg.h" #include "CreateForumMsg.h"
#include <gui/settings/rsharesettings.h> #include <QMenu>
#include <QMessageBox>
#include <QFile>
#include <QFileDialog>
#include <QDesktopWidget>
#include <QDropEvent>
#include <gui/RetroShareLink.h>
#include <QtGui>
#include "rsiface/rsforums.h" #include "rsiface/rsforums.h"
#include "rsiface/rsfiles.h" #include "rsiface/rsfiles.h"
#include <sys/stat.h> #include "gui/settings/rsharesettings.h"
#include "gui/RetroShareLink.h"
#include "gui/feeds/AttachFileItem.h" #include "gui/feeds/AttachFileItem.h"
#include <sstream> #include <sys/stat.h>
/** Constructor */ /** Constructor */
@ -55,34 +58,31 @@ CreateForumMsg::CreateForumMsg(std::string fId, std::string pId)
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();
loadEmoticonsForums(); loadEmoticonsForums();
} }
/** context menu searchTablewidget2 **/ /** context menu searchTablewidget2 **/
void CreateForumMsg::forumMessageCostumPopupMenu( QPoint point ) void CreateForumMsg::forumMessageCostumPopupMenu( QPoint point )
{ {
QMenu contextMnu (this);
if(RSLinkClipboard::empty()) QAction *pasteLinkAct = new QAction(QIcon(":/images/pasterslink.png"), tr( "Paste retroshare Link" ), &contextMnu );
return ; QAction *pasteLinkFullAct = new QAction(QIcon(":/images/pasterslink.png"), tr( "Paste retroshare Link Full" ), &contextMnu );
contextMnu = new QMenu( this ); if (RSLinkClipboard::empty()) {
pasteLinkAct->setDisabled (true);
pasteLinkAct = new QAction(QIcon(":/images/pasterslink.png"), tr( "Paste retroshare Link" ), this ); pasteLinkFullAct->setDisabled (true);
} else {
connect(pasteLinkAct , SIGNAL(triggered()), this, SLOT(pasteLink())); connect(pasteLinkAct , SIGNAL(triggered()), this, SLOT(pasteLink()));
pasteLinkFullAct = new QAction(QIcon(":/images/pasterslink.png"), tr( "Paste retroshare Link Full" ), this );
connect(pasteLinkFullAct , SIGNAL(triggered()), this, SLOT(pasteLinkFull())); connect(pasteLinkFullAct , SIGNAL(triggered()), this, SLOT(pasteLinkFull()));
}
contextMnu->clear(); contextMnu.addAction(pasteLinkAct);
contextMnu->addAction( pasteLinkAct); contextMnu.addAction(pasteLinkFullAct);
contextMnu->addAction( pasteLinkFullAct);
contextMnu->exec(QCursor::pos()); contextMnu.exec(QCursor::pos());
} }
@ -96,8 +96,7 @@ void CreateForumMsg::newMsg()
QString name = QString::fromStdWString(fi.forumName); QString name = QString::fromStdWString(fi.forumName);
QString subj; QString subj;
if ((mParentId != "") && (rsForums->getForumMessage( if ((mParentId != "") && (rsForums->getForumMessage(mForumId, mParentId, msg)))
mForumId, mParentId, msg)))
{ {
name += " In Reply to: "; name += " In Reply to: ";
name += QString::fromStdWString(msg.title); name += QString::fromStdWString(msg.title);
@ -154,7 +153,6 @@ void CreateForumMsg::createMsg()
return; //Don't add a empty Subject!! return; //Don't add a empty Subject!!
} }
ForumMsgInfo msgInfo; ForumMsgInfo msgInfo;
msgInfo.forumId = mForumId; msgInfo.forumId = mForumId;
@ -171,7 +169,6 @@ void CreateForumMsg::createMsg()
msgInfo.msgflags = RS_DISTRIB_AUTHEN_REQ; msgInfo.msgflags = RS_DISTRIB_AUTHEN_REQ;
} }
if ((msgInfo.msg == L"") && (msgInfo.title == L"")) if ((msgInfo.msg == L"") && (msgInfo.title == L""))
return; /* do nothing */ return; /* do nothing */

View File

@ -23,14 +23,10 @@
#ifndef _CREATE_FORUM_MSG_DIALOG_H #ifndef _CREATE_FORUM_MSG_DIALOG_H
#define _CREATE_FORUM_MSG_DIALOG_H #define _CREATE_FORUM_MSG_DIALOG_H
#include <QtGui>
#include <QWidget>
#include <string>
#include "gui/feeds/AttachFileItem.h"
#include "ui_CreateForumMsg.h" #include "ui_CreateForumMsg.h"
class AttachFileItem;
class CreateForumMsg : public QMainWindow class CreateForumMsg : public QMainWindow
{ {
Q_OBJECT Q_OBJECT
@ -65,13 +61,6 @@ protected:
private: private:
/** Define the popup menus for the Context menu */
QMenu* contextMnu;
/** Defines the actions for the context menu */
QAction* pasteLinkAct;
QAction* pasteLinkFullAct;
std::string mForumId; std::string mForumId;
std::string mParentId; std::string mParentId;