mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 15:39:27 -05:00
GxsForums:
- Fixed expand new messages - Fixed creating of thread/post messages git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6065 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
84c910672e
commit
f12473f7f7
@ -41,118 +41,133 @@
|
||||
#include <sys/stat.h>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
#define CREATEGXSFORUMMSG_FORUMINFO 1
|
||||
#define CREATEGXSFORUMMSG_PARENTMSG 2
|
||||
|
||||
|
||||
/** Constructor */
|
||||
CreateGxsForumMsg::CreateGxsForumMsg(const std::string &fId, const std::string &pId)
|
||||
: QDialog(NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint), mForumId(fId), mParentId(pId)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
/* Setup Queue */
|
||||
mForumQueue = new TokenQueue(rsGxsForums->getTokenService(), this);
|
||||
|
||||
QString text = pId.empty() ? tr("Start New Thread") : tr("Post Forum Message");
|
||||
setWindowTitle(text);
|
||||
QString text = pId.empty() ? tr("Start New Thread") : tr("Post Forum Message");
|
||||
setWindowTitle(text);
|
||||
|
||||
ui.headerFrame->setHeaderImage(QPixmap(":/images/konversation64.png"));
|
||||
ui.headerFrame->setHeaderText(text);
|
||||
ui.headerFrame->setHeaderImage(QPixmap(":/images/konversation64.png"));
|
||||
ui.headerFrame->setHeaderText(text);
|
||||
|
||||
Settings->loadWidgetInformation(this);
|
||||
Settings->loadWidgetInformation(this);
|
||||
|
||||
connect( ui.forumMessage, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( forumMessageCostumPopupMenu( QPoint ) ) );
|
||||
connect(ui.forumMessage, SIGNAL( customContextMenuRequested(QPoint)), this, SLOT(forumMessageCostumPopupMenu(QPoint)));
|
||||
|
||||
connect(ui.hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>)));
|
||||
connect(ui.hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>)));
|
||||
|
||||
// connect up the buttons.
|
||||
connect( ui.buttonBox, SIGNAL(accepted()), this, SLOT(createMsg()));
|
||||
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 up the buttons.
|
||||
connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(createMsg()));
|
||||
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()));
|
||||
|
||||
setAcceptDrops(true);
|
||||
ui.hashBox->setDropWidget(this);
|
||||
ui.hashBox->setAutoHide(false);
|
||||
setAcceptDrops(true);
|
||||
ui.hashBox->setDropWidget(this);
|
||||
ui.hashBox->setAutoHide(false);
|
||||
|
||||
mParentMsgLoaded = false;
|
||||
mForumMetaLoaded = false;
|
||||
|
||||
newMsg();
|
||||
newMsg();
|
||||
}
|
||||
|
||||
CreateGxsForumMsg::~CreateGxsForumMsg()
|
||||
{
|
||||
delete(mForumQueue);
|
||||
}
|
||||
|
||||
/** context menu searchTablewidget2 **/
|
||||
void CreateGxsForumMsg::forumMessageCostumPopupMenu(QPoint point)
|
||||
{
|
||||
QMenu *contextMnu = ui.forumMessage->createStandardContextMenu(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()));
|
||||
contextMnu->addSeparator();
|
||||
|
||||
if (RSLinkClipboard::empty()) {
|
||||
pasteLinkAct->setDisabled (true);
|
||||
pasteLinkFullAct->setDisabled (true);
|
||||
}
|
||||
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()));
|
||||
|
||||
contextMnu->exec(QCursor::pos());
|
||||
delete(contextMnu);
|
||||
if (RSLinkClipboard::empty()) {
|
||||
pasteLinkAct->setDisabled (true);
|
||||
pasteLinkFullAct->setDisabled (true);
|
||||
}
|
||||
|
||||
contextMnu->exec(QCursor::pos());
|
||||
delete(contextMnu);
|
||||
}
|
||||
|
||||
void CreateGxsForumMsg::newMsg()
|
||||
{
|
||||
/* clear all */
|
||||
/* clear all */
|
||||
mParentMsgLoaded = false;
|
||||
mForumMetaLoaded = false;
|
||||
|
||||
/* fill in the available OwnIds for signing */
|
||||
ui.idChooser->loadIds(IDCHOOSER_ID_REQUIRED, "");
|
||||
|
||||
/* lock gui */
|
||||
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
ui.innerFrame->setEnabled(false);
|
||||
|
||||
if (mForumId.empty()) {
|
||||
ui.forumName->setText(tr("No Forum"));
|
||||
return;
|
||||
}
|
||||
ui.forumName->setText(tr("Loading"));
|
||||
|
||||
/* request Data */
|
||||
{
|
||||
RsTokReqOptions opts;
|
||||
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
|
||||
|
||||
std::list<std::string> groupIds;
|
||||
groupIds.push_back(mForumId);
|
||||
|
||||
|
||||
std::cerr << "ForumsV2Dialog::newMsg() Requesting Group Summary(" << mForumId << ")";
|
||||
std::cerr << std::endl;
|
||||
|
||||
|
||||
uint32_t token;
|
||||
mForumQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, groupIds, CREATEGXSFORUMMSG_FORUMINFO);
|
||||
|
||||
}
|
||||
|
||||
if (mParentId != "")
|
||||
|
||||
if (mParentId.empty())
|
||||
{
|
||||
mParentMsgLoaded = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
RsTokReqOptions opts;
|
||||
|
||||
std::list<std::string> msgIds;
|
||||
msgIds.push_back(mParentId);
|
||||
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
|
||||
GxsMsgReq msgIds;
|
||||
std::vector<RsGxsMessageId> &vect = msgIds[mForumId];
|
||||
vect.push_back(mParentId);
|
||||
|
||||
std::cerr << "ForumsV2Dialog::newMsg() Requesting Parent Summary(" << mParentId << ")";
|
||||
std::cerr << std::endl;
|
||||
|
||||
uint32_t token;
|
||||
#ifdef TOGXS
|
||||
mForumQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, CREATEGXSFORUMMSG_PARENTMSG);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t token;
|
||||
mForumQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, CREATEGXSFORUMMSG_PARENTMSG);
|
||||
}
|
||||
}
|
||||
|
||||
void CreateGxsForumMsg::saveForumInfo(const RsGroupMetaData &meta)
|
||||
{
|
||||
mForumMeta = meta;
|
||||
mForumMetaLoaded = true;
|
||||
|
||||
|
||||
loadFormInformation();
|
||||
}
|
||||
|
||||
@ -160,39 +175,42 @@ void CreateGxsForumMsg::saveParentMsg(const RsGxsForumMsg &msg)
|
||||
{
|
||||
mParentMsg = msg;
|
||||
mParentMsgLoaded = true;
|
||||
|
||||
|
||||
loadFormInformation();
|
||||
}
|
||||
|
||||
void CreateGxsForumMsg::loadFormInformation()
|
||||
{
|
||||
if ((!mParentMsgLoaded) && (mParentId != ""))
|
||||
if ((!mParentMsgLoaded) && (!mParentId.empty()))
|
||||
{
|
||||
std::cerr << "CreateGxsForumMsg::loadMsgInformation() ParentMsg not Loaded Yet";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!mForumMetaLoaded)
|
||||
{
|
||||
std::cerr << "CreateGxsForumMsg::loadMsgInformation() ForumMeta not Loaded Yet";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
|
||||
ui.innerFrame->setEnabled(true);
|
||||
|
||||
std::cerr << "CreateGxsForumMsg::loadMsgInformation() Data Available!";
|
||||
std::cerr << std::endl;
|
||||
|
||||
|
||||
QString name = QString::fromUtf8(mForumMeta.mGroupName.c_str());
|
||||
QString subj;
|
||||
if (mParentId != "")
|
||||
if (!mParentId.empty())
|
||||
{
|
||||
QString title = QString::fromUtf8(mParentMsg.mMeta.mMsgName.c_str());
|
||||
name += " " + tr("In Reply to") + ": ";
|
||||
name += title;
|
||||
|
||||
|
||||
QString text = title;
|
||||
|
||||
|
||||
if (text.startsWith("Re:", Qt::CaseInsensitive))
|
||||
{
|
||||
subj = title;
|
||||
@ -201,21 +219,20 @@ void CreateGxsForumMsg::loadFormInformation()
|
||||
{
|
||||
subj = "Re: " + title;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
ui.forumName->setText(misc::removeNewLine(name));
|
||||
ui.forumSubject->setText(misc::removeNewLine(subj));
|
||||
|
||||
if (!ui.forumSubject->text().isEmpty())
|
||||
{
|
||||
ui.forumMessage->setFocus();
|
||||
}
|
||||
else
|
||||
|
||||
if (ui.forumSubject->text().isEmpty())
|
||||
{
|
||||
ui.forumSubject->setFocus();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
ui.forumMessage->setFocus();
|
||||
}
|
||||
|
||||
#ifdef TOGXS
|
||||
if (mForumMeta.mGroupFlags & RS_DISTRIB_AUTHEN_REQ)
|
||||
#else
|
||||
@ -232,25 +249,23 @@ void CreateGxsForumMsg::loadFormInformation()
|
||||
ui.signBox->setEnabled(true);
|
||||
}
|
||||
|
||||
ui.forumMessage->setText("");
|
||||
ui.forumMessage->setText("");
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CreateGxsForumMsg::createMsg()
|
||||
{
|
||||
QString name = misc::removeNewLine(ui.forumSubject->text());
|
||||
QString desc;
|
||||
QString name = misc::removeNewLine(ui.forumSubject->text());
|
||||
QString desc;
|
||||
|
||||
RsHtml::optimizeHtml(ui.forumMessage, desc);
|
||||
|
||||
if(name.isEmpty())
|
||||
{ /* error message */
|
||||
QMessageBox::warning(this, tr("RetroShare"),tr("Please set a Forum Subject and Forum Message"),
|
||||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
if(name.isEmpty())
|
||||
{ /* error message */
|
||||
QMessageBox::warning(this, tr("RetroShare"),tr("Please set a Forum Subject and Forum Message"),
|
||||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
|
||||
return; //Don't add a empty Subject!!
|
||||
}
|
||||
return; //Don't add a empty Subject!!
|
||||
}
|
||||
|
||||
RsGxsForumMsg msg;
|
||||
msg.mMeta.mGroupId = mForumId;
|
||||
@ -260,15 +275,15 @@ void CreateGxsForumMsg::createMsg()
|
||||
{
|
||||
msg.mMeta.mThreadId = mParentMsg.mMeta.mThreadId;
|
||||
}
|
||||
|
||||
|
||||
msg.mMeta.mMsgName = std::string(name.toUtf8());
|
||||
msg.mMsg = std::string(desc.toUtf8());
|
||||
#ifdef TOGXS
|
||||
msg.mMeta.mMsgFlags = RS_DISTRIB_AUTHEN_REQ;
|
||||
#endif
|
||||
|
||||
|
||||
if ((msg.mMsg == "") && (msg.mMeta.mMsgName == ""))
|
||||
return; /* do nothing */
|
||||
return; /* do nothing */
|
||||
|
||||
if (ui.signBox->isChecked())
|
||||
{
|
||||
@ -294,84 +309,55 @@ void CreateGxsForumMsg::createMsg()
|
||||
uint32_t token;
|
||||
rsGxsForums->createMsg(token, msg);
|
||||
close();
|
||||
|
||||
|
||||
// Previous Info - for reference.
|
||||
|
||||
//ForumMsgInfo msgInfo;
|
||||
|
||||
//msgInfo.forumId = mForumId;
|
||||
//msgInfo.threadId = "";
|
||||
//msgInfo.parentId = mParentId;
|
||||
//msgInfo.msgId = "";
|
||||
|
||||
//msgInfo.title = name.toStdWString();
|
||||
//msgInfo.msg = desc.toStdWString();
|
||||
//msgInfo.msgflags = 0;
|
||||
|
||||
//if (ui.signBox->isChecked())
|
||||
//{
|
||||
// msgInfo.msgflags = RS_DISTRIB_AUTHEN_REQ;
|
||||
//}
|
||||
|
||||
//if ((msgInfo.msg == L"") && (msgInfo.title == L""))
|
||||
// return; /* do nothing */
|
||||
|
||||
//if (rsForumsV2->ForumMessageSend(msgInfo) == true) {
|
||||
// close();
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void CreateGxsForumMsg::closeEvent (QCloseEvent * /*event*/)
|
||||
{
|
||||
Settings->saveWidgetInformation(this);
|
||||
Settings->saveWidgetInformation(this);
|
||||
}
|
||||
|
||||
void CreateGxsForumMsg::smileyWidgetForums()
|
||||
{
|
||||
Emoticons::showSmileyWidget(this, ui.emoticonButton, SLOT(addSmileys()), false);
|
||||
Emoticons::showSmileyWidget(this, ui.emoticonButton, SLOT(addSmileys()), false);
|
||||
}
|
||||
|
||||
void CreateGxsForumMsg::addSmileys()
|
||||
{
|
||||
ui.forumMessage->textCursor().insertText(qobject_cast<QPushButton*>(sender())->toolTip().split("|").first());
|
||||
ui.forumMessage->textCursor().insertText(qobject_cast<QPushButton*>(sender())->toolTip().split("|").first());
|
||||
}
|
||||
|
||||
void CreateGxsForumMsg::addFile()
|
||||
{
|
||||
QStringList files;
|
||||
if (misc::getOpenFileNames(this, RshareSettings::LASTDIR_EXTRAFILE, tr("Add Extra File"), "", files)) {
|
||||
ui.hashBox->addAttachments(files,RS_FILE_REQ_ANONYMOUS_ROUTING);
|
||||
}
|
||||
QStringList files;
|
||||
if (misc::getOpenFileNames(this, RshareSettings::LASTDIR_EXTRAFILE, tr("Add Extra File"), "", files)) {
|
||||
ui.hashBox->addAttachments(files,RS_FILE_REQ_ANONYMOUS_ROUTING);
|
||||
}
|
||||
}
|
||||
|
||||
void CreateGxsForumMsg::fileHashingFinished(QList<HashedFile> hashedFiles)
|
||||
{
|
||||
std::cerr << "CreateGxsForumMsg::fileHashingFinished() started." << std::endl;
|
||||
std::cerr << "CreateGxsForumMsg::fileHashingFinished() started." << std::endl;
|
||||
|
||||
QString mesgString;
|
||||
QString mesgString;
|
||||
|
||||
QList<HashedFile>::iterator it;
|
||||
for (it = hashedFiles.begin(); it != hashedFiles.end(); ++it) {
|
||||
HashedFile& hashedFile = *it;
|
||||
RetroShareLink link;
|
||||
if (link.createFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash))) {
|
||||
mesgString += link.toHtmlSize() + "<br>";
|
||||
}
|
||||
}
|
||||
QList<HashedFile>::iterator it;
|
||||
for (it = hashedFiles.begin(); it != hashedFiles.end(); ++it) {
|
||||
HashedFile& hashedFile = *it;
|
||||
RetroShareLink link;
|
||||
if (link.createFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash))) {
|
||||
mesgString += link.toHtmlSize() + "<br>";
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "CreateGxsForumMsg::anchorClicked mesgString : " << mesgString.toStdString() << std::endl;
|
||||
std::cerr << "CreateGxsForumMsg::anchorClicked mesgString : " << mesgString.toStdString() << std::endl;
|
||||
#endif
|
||||
|
||||
if (!mesgString.isEmpty()) {
|
||||
ui.forumMessage->textCursor().insertHtml(mesgString);
|
||||
}
|
||||
if (!mesgString.isEmpty()) {
|
||||
ui.forumMessage->textCursor().insertHtml(mesgString);
|
||||
}
|
||||
|
||||
ui.forumMessage->setFocus( Qt::OtherFocusReason );
|
||||
ui.forumMessage->setFocus( Qt::OtherFocusReason );
|
||||
}
|
||||
|
||||
void CreateGxsForumMsg::pasteLink()
|
||||
@ -393,17 +379,14 @@ void CreateGxsForumMsg::pasteOwnCertificateLink()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void CreateGxsForumMsg::loadForumInfo(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "CreateGxsForumMsg::loadForumInfo()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
|
||||
std::list<RsGroupMetaData> groupInfo;
|
||||
rsGxsForums->getGroupSummary(token, groupInfo);
|
||||
|
||||
|
||||
if (groupInfo.size() == 1)
|
||||
{
|
||||
RsGroupMetaData fi = groupInfo.front();
|
||||
@ -416,12 +399,11 @@ void CreateGxsForumMsg::loadForumInfo(const uint32_t &token)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CreateGxsForumMsg::loadParentMsg(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "CreateGxsForumMsg::loadParentMsg()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
|
||||
// Only grab one.... ignore more (shouldn't be any).
|
||||
std::vector<RsGxsForumMsg> msgs;
|
||||
if (rsGxsForums->getMsgData(token, msgs))
|
||||
@ -431,20 +413,16 @@ void CreateGxsForumMsg::loadParentMsg(const uint32_t &token)
|
||||
/* error */
|
||||
std::cerr << "CreateGxsForumMsg::loadParentMsg() ERROR wrong number of msgs";
|
||||
std::cerr << std::endl;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
saveParentMsg(msgs[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CreateGxsForumMsg::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
{
|
||||
std::cerr << "CreateGxsForum::loadRequest() UserType: " << req.mUserType;
|
||||
std::cerr << std::endl;
|
||||
|
||||
|
||||
if (queue == mForumQueue)
|
||||
{
|
||||
/* now switch on req */
|
||||
@ -453,15 +431,13 @@ void CreateGxsForumMsg::loadRequest(const TokenQueue *queue, const TokenRequest
|
||||
case CREATEGXSFORUMMSG_FORUMINFO:
|
||||
loadForumInfo(req.mToken);
|
||||
break;
|
||||
|
||||
case CREATEGXSFORUMMSG_PARENTMSG:
|
||||
loadParentMsg(req.mToken);
|
||||
break;
|
||||
default:
|
||||
std::cerr << "CreateGxsForum::loadRequest() UNKNOWN UserType ";
|
||||
std::cerr << std::endl;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
|
||||
#ifndef _CREATE_GXSFORUM_MSG_DIALOG_H
|
||||
#define _CREATE_GXSFORUM_MSG_DIALOG_H
|
||||
|
||||
@ -31,31 +30,32 @@
|
||||
|
||||
class CreateGxsForumMsg : public QDialog, public TokenResponse
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CreateGxsForumMsg(const std::string &fId, const std::string &pId);
|
||||
CreateGxsForumMsg(const std::string &fId, const std::string &pId);
|
||||
~CreateGxsForumMsg();
|
||||
|
||||
void newMsg(); /* cleanup */
|
||||
void newMsg(); /* cleanup */
|
||||
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
|
||||
private slots:
|
||||
/** Create the context popup menu and it's submenus */
|
||||
void forumMessageCostumPopupMenu( QPoint point );
|
||||
/** Create the context popup menu and it's submenus */
|
||||
void forumMessageCostumPopupMenu( QPoint point );
|
||||
|
||||
void fileHashingFinished(QList<HashedFile> hashedFiles);
|
||||
/* actions to take.... */
|
||||
void createMsg();
|
||||
void pasteLink();
|
||||
void pasteLinkFull();
|
||||
void pasteOwnCertificateLink();
|
||||
void fileHashingFinished(QList<HashedFile> hashedFiles);
|
||||
/* actions to take.... */
|
||||
void createMsg();
|
||||
void pasteLink();
|
||||
void pasteLinkFull();
|
||||
void pasteOwnCertificateLink();
|
||||
|
||||
void smileyWidgetForums();
|
||||
void addSmileys();
|
||||
void addFile();
|
||||
void smileyWidgetForums();
|
||||
void addSmileys();
|
||||
void addFile();
|
||||
|
||||
protected:
|
||||
void closeEvent (QCloseEvent * event);
|
||||
void closeEvent (QCloseEvent * event);
|
||||
|
||||
private:
|
||||
void saveForumInfo(const RsGroupMetaData &meta);
|
||||
@ -65,8 +65,8 @@ private:
|
||||
void loadForumInfo(const uint32_t &token);
|
||||
void loadParentMsg(const uint32_t &token);
|
||||
|
||||
std::string mForumId;
|
||||
std::string mParentId;
|
||||
std::string mForumId;
|
||||
std::string mParentId;
|
||||
|
||||
bool mParentMsgLoaded;
|
||||
bool mForumMetaLoaded;
|
||||
@ -75,9 +75,8 @@ private:
|
||||
|
||||
TokenQueue *mForumQueue;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::CreateGxsForumMsg ui;
|
||||
/** Qt Designer generated object */
|
||||
Ui::CreateGxsForumMsg ui;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -21,11 +21,22 @@
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="HeaderFrame" name="headerFrame"/>
|
||||
<widget class="HeaderFrame" name="headerFrame">
|
||||
<zorder>buttonBox</zorder>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
@ -37,216 +48,252 @@
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QFrame" name="subjectFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="margin">
|
||||
<widget class="QFrame" name="innerFrame">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="forumLabel">
|
||||
<property name="text">
|
||||
<string>Forum</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="forumName">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="subjectLabel">
|
||||
<property name="text">
|
||||
<string>Subject</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="forumSubject"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="toolBarFrame">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>38</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="margin">
|
||||
<number>6</number>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="attachFileButton">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
<widget class="QFrame" name="subjectFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Attach File</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/add-share24.png</normaloff>:/images/add-share24.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="forumLabel">
|
||||
<property name="text">
|
||||
<string>Forum</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="forumName">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="subjectLabel">
|
||||
<property name="text">
|
||||
<string>Subject</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="forumSubject"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="emoticonButton">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/emoticons/kopete/kopete020.png</normaloff>:/images/emoticons/kopete/kopete020.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<widget class="QFrame" name="toolBarFrame">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
<width>16777215</width>
|
||||
<height>38</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="attachFileButton">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Attach File</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/add-share24.png</normaloff>:/images/add-share24.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="emoticonButton">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/emoticons/kopete/kopete020.png</normaloff>:/images/emoticons/kopete/kopete020.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="signBox">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sign Message</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/pgp.png</normaloff>:/images/pgp.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="GxsIdChooser" name="idChooser"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>15</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="pastersButton">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Paste RetroShare Link</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/pasterslink.png</normaloff>:/images/pasterslink.png</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="signBox">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
<widget class="QGroupBox" name="messageGroupBox">
|
||||
<property name="title">
|
||||
<string>Forum Post</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sign Message</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/pgp.png</normaloff>:/images/pgp.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="GxsIdChooser" name="idChooser"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>15</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="pastersButton">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Paste RetroShare Link</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/pasterslink.png</normaloff>:/images/pasterslink.png</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="messageGroupBox">
|
||||
<property name="title">
|
||||
<string>Forum Post</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTextEdit" name="forumMessage">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTextEdit" name="forumMessage">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string notr="true"><!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">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"></p></body></html></string>
|
||||
</property>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="hashGroupBox">
|
||||
<property name="title">
|
||||
<string>Attach files via drag and drop</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
<item row="0" column="0">
|
||||
<widget class="HashBox" name="hashBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>You can attach files via drag and drop here in this window</string>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="hashGroupBox">
|
||||
<property name="title">
|
||||
<string>Attach files via drag and drop</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
<item row="0" column="0">
|
||||
<widget class="HashBox" name="hashBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>You can attach files via drag and drop here in this window</string>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "GxsForumsFillThread.h"
|
||||
#include "GxsForumThreadWidget.h"
|
||||
|
||||
#include "gxs/rsgxsflags.h"
|
||||
#include <retroshare/rsgxsforums.h>
|
||||
|
||||
#include <iostream>
|
||||
@ -74,6 +75,18 @@ void GxsForumsFillThread::stop()
|
||||
wait();
|
||||
}
|
||||
|
||||
void GxsForumsFillThread::calculateExpand(const RsGxsForumMsg &msg, QTreeWidgetItem *item)
|
||||
{
|
||||
if (mFillComplete && mExpandNewMessages && IS_MSG_UNREAD(msg.mMeta.mMsgStatus)) {
|
||||
QTreeWidgetItem *parentItem = item;
|
||||
while ((parentItem = parentItem->parent()) != NULL) {
|
||||
if (std::find(mItemToExpand.begin(), mItemToExpand.end(), parentItem) == mItemToExpand.end()) {
|
||||
mItemToExpand.push_back(parentItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GxsForumsFillThread::run()
|
||||
{
|
||||
RsTokenService *service = rsGxsForums->getTokenService();
|
||||
@ -162,6 +175,7 @@ void GxsForumsFillThread::run()
|
||||
|
||||
QTreeWidgetItem *item = mParent->convertMsgToThreadWidget(msg, mUseChildTS, mFilterColumn);
|
||||
threadList.push_back(QPair<std::string, QTreeWidgetItem*>(msg.mMeta.mMsgId, item));
|
||||
calculateExpand(msg, item);
|
||||
|
||||
mItems.append(item);
|
||||
emit progress(++pos, count);
|
||||
@ -202,6 +216,7 @@ void GxsForumsFillThread::run()
|
||||
threadPair.second->addChild(item);
|
||||
}
|
||||
|
||||
calculateExpand(msg, item);
|
||||
|
||||
/* add item to process list */
|
||||
threadList.push_back(QPair<std::string, QTreeWidgetItem*>(msg.mMeta.mMsgId, item));
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <QThread>
|
||||
|
||||
class GxsForumThreadWidget;
|
||||
class RsGxsForumMsg;
|
||||
class RSTreeWidgetItemCompareRole;
|
||||
class QTreeWidgetItem;
|
||||
|
||||
@ -39,6 +40,8 @@ public:
|
||||
QList<QTreeWidgetItem*> mItemToExpand;
|
||||
|
||||
private:
|
||||
void calculateExpand(const RsGxsForumMsg &msg, QTreeWidgetItem *item);
|
||||
|
||||
GxsForumThreadWidget *mParent;
|
||||
volatile bool mStopped;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user