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:
thunder2 2013-01-07 22:11:16 +00:00
parent 84c910672e
commit f12473f7f7
5 changed files with 402 additions and 362 deletions

View File

@ -41,82 +41,96 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <iostream> #include <iostream>
#define CREATEGXSFORUMMSG_FORUMINFO 1 #define CREATEGXSFORUMMSG_FORUMINFO 1
#define CREATEGXSFORUMMSG_PARENTMSG 2 #define CREATEGXSFORUMMSG_PARENTMSG 2
/** Constructor */ /** Constructor */
CreateGxsForumMsg::CreateGxsForumMsg(const std::string &fId, const std::string &pId) CreateGxsForumMsg::CreateGxsForumMsg(const std::string &fId, const std::string &pId)
: QDialog(NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint), mForumId(fId), mParentId(pId) : QDialog(NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint), mForumId(fId), mParentId(pId)
{ {
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this); ui.setupUi(this);
setAttribute(Qt::WA_DeleteOnClose, true); setAttribute(Qt::WA_DeleteOnClose, true);
/* Setup Queue */ /* Setup Queue */
mForumQueue = new TokenQueue(rsGxsForums->getTokenService(), this); mForumQueue = new TokenQueue(rsGxsForums->getTokenService(), this);
QString text = pId.empty() ? tr("Start New Thread") : tr("Post Forum Message"); QString text = pId.empty() ? tr("Start New Thread") : tr("Post Forum Message");
setWindowTitle(text); setWindowTitle(text);
ui.headerFrame->setHeaderImage(QPixmap(":/images/konversation64.png")); ui.headerFrame->setHeaderImage(QPixmap(":/images/konversation64.png"));
ui.headerFrame->setHeaderText(text); 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 up the buttons.
connect( ui.buttonBox, SIGNAL(accepted()), this, SLOT(createMsg())); connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(createMsg()));
connect( ui.buttonBox, SIGNAL(rejected()), this, SLOT(close())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(close()));
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()));
setAcceptDrops(true); setAcceptDrops(true);
ui.hashBox->setDropWidget(this); ui.hashBox->setDropWidget(this);
ui.hashBox->setAutoHide(false); ui.hashBox->setAutoHide(false);
mParentMsgLoaded = false; mParentMsgLoaded = false;
mForumMetaLoaded = false; mForumMetaLoaded = false;
newMsg(); newMsg();
}
CreateGxsForumMsg::~CreateGxsForumMsg()
{
delete(mForumQueue);
} }
/** context menu searchTablewidget2 **/
void CreateGxsForumMsg::forumMessageCostumPopupMenu(QPoint point) void CreateGxsForumMsg::forumMessageCostumPopupMenu(QPoint point)
{ {
QMenu *contextMnu = ui.forumMessage->createStandardContextMenu(point); QMenu *contextMnu = ui.forumMessage->createStandardContextMenu(point);
contextMnu->addSeparator(); 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()));
if (RSLinkClipboard::empty()) { QAction *pasteLinkAct = contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste RetroShare Link"), this, SLOT(pasteLink()));
pasteLinkAct->setDisabled (true); QAction *pasteLinkFullAct = contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste full RetroShare Link"), this, SLOT(pasteLinkFull()));
pasteLinkFullAct->setDisabled (true); contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste my certificate link"), this, SLOT(pasteOwnCertificateLink()));
}
contextMnu->exec(QCursor::pos()); if (RSLinkClipboard::empty()) {
delete(contextMnu); pasteLinkAct->setDisabled (true);
pasteLinkFullAct->setDisabled (true);
}
contextMnu->exec(QCursor::pos());
delete(contextMnu);
} }
void CreateGxsForumMsg::newMsg() void CreateGxsForumMsg::newMsg()
{ {
/* clear all */ /* clear all */
mParentMsgLoaded = false; mParentMsgLoaded = false;
mForumMetaLoaded = false; mForumMetaLoaded = false;
/* fill in the available OwnIds for signing */ /* fill in the available OwnIds for signing */
ui.idChooser->loadIds(IDCHOOSER_ID_REQUIRED, ""); 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 */ /* request Data */
{ {
RsTokReqOptions opts; RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
std::list<std::string> groupIds; std::list<std::string> groupIds;
groupIds.push_back(mForumId); groupIds.push_back(mForumId);
@ -126,28 +140,29 @@ void CreateGxsForumMsg::newMsg()
uint32_t token; uint32_t token;
mForumQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, groupIds, CREATEGXSFORUMMSG_FORUMINFO); mForumQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, groupIds, CREATEGXSFORUMMSG_FORUMINFO);
} }
if (mParentId != "") if (mParentId.empty())
{
mParentMsgLoaded = true;
}
else
{ {
RsTokReqOptions opts; RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
std::list<std::string> msgIds; GxsMsgReq msgIds;
msgIds.push_back(mParentId); std::vector<RsGxsMessageId> &vect = msgIds[mForumId];
vect.push_back(mParentId);
std::cerr << "ForumsV2Dialog::newMsg() Requesting Parent Summary(" << mParentId << ")"; std::cerr << "ForumsV2Dialog::newMsg() Requesting Parent Summary(" << mParentId << ")";
std::cerr << std::endl; std::cerr << std::endl;
uint32_t token; uint32_t token;
#ifdef TOGXS mForumQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, CREATEGXSFORUMMSG_PARENTMSG);
mForumQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, CREATEGXSFORUMMSG_PARENTMSG);
#endif
} }
} }
void CreateGxsForumMsg::saveForumInfo(const RsGroupMetaData &meta) void CreateGxsForumMsg::saveForumInfo(const RsGroupMetaData &meta)
{ {
mForumMeta = meta; mForumMeta = meta;
@ -166,7 +181,7 @@ void CreateGxsForumMsg::saveParentMsg(const RsGxsForumMsg &msg)
void CreateGxsForumMsg::loadFormInformation() void CreateGxsForumMsg::loadFormInformation()
{ {
if ((!mParentMsgLoaded) && (mParentId != "")) if ((!mParentMsgLoaded) && (!mParentId.empty()))
{ {
std::cerr << "CreateGxsForumMsg::loadMsgInformation() ParentMsg not Loaded Yet"; std::cerr << "CreateGxsForumMsg::loadMsgInformation() ParentMsg not Loaded Yet";
std::cerr << std::endl; std::cerr << std::endl;
@ -180,12 +195,15 @@ void CreateGxsForumMsg::loadFormInformation()
return; return;
} }
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
ui.innerFrame->setEnabled(true);
std::cerr << "CreateGxsForumMsg::loadMsgInformation() Data Available!"; std::cerr << "CreateGxsForumMsg::loadMsgInformation() Data Available!";
std::cerr << std::endl; std::cerr << std::endl;
QString name = QString::fromUtf8(mForumMeta.mGroupName.c_str()); QString name = QString::fromUtf8(mForumMeta.mGroupName.c_str());
QString subj; QString subj;
if (mParentId != "") if (!mParentId.empty())
{ {
QString title = QString::fromUtf8(mParentMsg.mMeta.mMsgName.c_str()); QString title = QString::fromUtf8(mParentMsg.mMeta.mMsgName.c_str());
name += " " + tr("In Reply to") + ": "; name += " " + tr("In Reply to") + ": ";
@ -201,19 +219,18 @@ void CreateGxsForumMsg::loadFormInformation()
{ {
subj = "Re: " + title; subj = "Re: " + title;
} }
} }
ui.forumName->setText(misc::removeNewLine(name)); ui.forumName->setText(misc::removeNewLine(name));
ui.forumSubject->setText(misc::removeNewLine(subj)); ui.forumSubject->setText(misc::removeNewLine(subj));
if (!ui.forumSubject->text().isEmpty()) if (ui.forumSubject->text().isEmpty())
{ {
ui.forumMessage->setFocus(); ui.forumSubject->setFocus();
} }
else else
{ {
ui.forumSubject->setFocus(); ui.forumMessage->setFocus();
} }
#ifdef TOGXS #ifdef TOGXS
@ -232,25 +249,23 @@ void CreateGxsForumMsg::loadFormInformation()
ui.signBox->setEnabled(true); ui.signBox->setEnabled(true);
} }
ui.forumMessage->setText(""); ui.forumMessage->setText("");
} }
void CreateGxsForumMsg::createMsg() void CreateGxsForumMsg::createMsg()
{ {
QString name = misc::removeNewLine(ui.forumSubject->text()); QString name = misc::removeNewLine(ui.forumSubject->text());
QString desc; QString desc;
RsHtml::optimizeHtml(ui.forumMessage, desc); RsHtml::optimizeHtml(ui.forumMessage, desc);
if(name.isEmpty()) if(name.isEmpty())
{ /* error message */ { /* error message */
QMessageBox::warning(this, tr("RetroShare"),tr("Please set a Forum Subject and Forum Message"), QMessageBox::warning(this, tr("RetroShare"),tr("Please set a Forum Subject and Forum Message"),
QMessageBox::Ok, QMessageBox::Ok); QMessageBox::Ok, QMessageBox::Ok);
return; //Don't add a empty Subject!! return; //Don't add a empty Subject!!
} }
RsGxsForumMsg msg; RsGxsForumMsg msg;
msg.mMeta.mGroupId = mForumId; msg.mMeta.mGroupId = mForumId;
@ -268,7 +283,7 @@ void CreateGxsForumMsg::createMsg()
#endif #endif
if ((msg.mMsg == "") && (msg.mMeta.mMsgName == "")) if ((msg.mMsg == "") && (msg.mMeta.mMsgName == ""))
return; /* do nothing */ return; /* do nothing */
if (ui.signBox->isChecked()) if (ui.signBox->isChecked())
{ {
@ -294,84 +309,55 @@ void CreateGxsForumMsg::createMsg()
uint32_t token; uint32_t token;
rsGxsForums->createMsg(token, msg); rsGxsForums->createMsg(token, msg);
close(); 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*/) void CreateGxsForumMsg::closeEvent (QCloseEvent * /*event*/)
{ {
Settings->saveWidgetInformation(this); Settings->saveWidgetInformation(this);
} }
void CreateGxsForumMsg::smileyWidgetForums() void CreateGxsForumMsg::smileyWidgetForums()
{ {
Emoticons::showSmileyWidget(this, ui.emoticonButton, SLOT(addSmileys()), false); Emoticons::showSmileyWidget(this, ui.emoticonButton, SLOT(addSmileys()), false);
} }
void CreateGxsForumMsg::addSmileys() 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() void CreateGxsForumMsg::addFile()
{ {
QStringList files; QStringList files;
if (misc::getOpenFileNames(this, RshareSettings::LASTDIR_EXTRAFILE, tr("Add Extra File"), "", files)) { if (misc::getOpenFileNames(this, RshareSettings::LASTDIR_EXTRAFILE, tr("Add Extra File"), "", files)) {
ui.hashBox->addAttachments(files,RS_FILE_REQ_ANONYMOUS_ROUTING); ui.hashBox->addAttachments(files,RS_FILE_REQ_ANONYMOUS_ROUTING);
} }
} }
void CreateGxsForumMsg::fileHashingFinished(QList<HashedFile> hashedFiles) 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; QList<HashedFile>::iterator it;
for (it = hashedFiles.begin(); it != hashedFiles.end(); ++it) { for (it = hashedFiles.begin(); it != hashedFiles.end(); ++it) {
HashedFile& hashedFile = *it; HashedFile& hashedFile = *it;
RetroShareLink link; RetroShareLink link;
if (link.createFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash))) { if (link.createFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash))) {
mesgString += link.toHtmlSize() + "<br>"; mesgString += link.toHtmlSize() + "<br>";
} }
} }
#ifdef CHAT_DEBUG #ifdef CHAT_DEBUG
std::cerr << "CreateGxsForumMsg::anchorClicked mesgString : " << mesgString.toStdString() << std::endl; std::cerr << "CreateGxsForumMsg::anchorClicked mesgString : " << mesgString.toStdString() << std::endl;
#endif #endif
if (!mesgString.isEmpty()) { if (!mesgString.isEmpty()) {
ui.forumMessage->textCursor().insertHtml(mesgString); ui.forumMessage->textCursor().insertHtml(mesgString);
} }
ui.forumMessage->setFocus( Qt::OtherFocusReason ); ui.forumMessage->setFocus( Qt::OtherFocusReason );
} }
void CreateGxsForumMsg::pasteLink() void CreateGxsForumMsg::pasteLink()
@ -393,9 +379,6 @@ void CreateGxsForumMsg::pasteOwnCertificateLink()
} }
} }
void CreateGxsForumMsg::loadForumInfo(const uint32_t &token) void CreateGxsForumMsg::loadForumInfo(const uint32_t &token)
{ {
std::cerr << "CreateGxsForumMsg::loadForumInfo()"; std::cerr << "CreateGxsForumMsg::loadForumInfo()";
@ -416,7 +399,6 @@ void CreateGxsForumMsg::loadForumInfo(const uint32_t &token)
} }
} }
void CreateGxsForumMsg::loadParentMsg(const uint32_t &token) void CreateGxsForumMsg::loadParentMsg(const uint32_t &token)
{ {
std::cerr << "CreateGxsForumMsg::loadParentMsg()"; std::cerr << "CreateGxsForumMsg::loadParentMsg()";
@ -431,15 +413,11 @@ void CreateGxsForumMsg::loadParentMsg(const uint32_t &token)
/* error */ /* error */
std::cerr << "CreateGxsForumMsg::loadParentMsg() ERROR wrong number of msgs"; std::cerr << "CreateGxsForumMsg::loadParentMsg() ERROR wrong number of msgs";
std::cerr << std::endl; std::cerr << std::endl;
} }
saveParentMsg(msgs[0]); saveParentMsg(msgs[0]);
} }
} }
void CreateGxsForumMsg::loadRequest(const TokenQueue *queue, const TokenRequest &req) void CreateGxsForumMsg::loadRequest(const TokenQueue *queue, const TokenRequest &req)
{ {
std::cerr << "CreateGxsForum::loadRequest() UserType: " << req.mUserType; std::cerr << "CreateGxsForum::loadRequest() UserType: " << req.mUserType;
@ -453,7 +431,6 @@ void CreateGxsForumMsg::loadRequest(const TokenQueue *queue, const TokenRequest
case CREATEGXSFORUMMSG_FORUMINFO: case CREATEGXSFORUMMSG_FORUMINFO:
loadForumInfo(req.mToken); loadForumInfo(req.mToken);
break; break;
case CREATEGXSFORUMMSG_PARENTMSG: case CREATEGXSFORUMMSG_PARENTMSG:
loadParentMsg(req.mToken); loadParentMsg(req.mToken);
break; break;
@ -464,4 +441,3 @@ void CreateGxsForumMsg::loadRequest(const TokenQueue *queue, const TokenRequest
} }
} }
} }

View File

@ -19,7 +19,6 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
****************************************************************/ ****************************************************************/
#ifndef _CREATE_GXSFORUM_MSG_DIALOG_H #ifndef _CREATE_GXSFORUM_MSG_DIALOG_H
#define _CREATE_GXSFORUM_MSG_DIALOG_H #define _CREATE_GXSFORUM_MSG_DIALOG_H
@ -31,31 +30,32 @@
class CreateGxsForumMsg : public QDialog, public TokenResponse class CreateGxsForumMsg : public QDialog, public TokenResponse
{ {
Q_OBJECT Q_OBJECT
public: 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); virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
private slots: private slots:
/** Create the context popup menu and it's submenus */ /** Create the context popup menu and it's submenus */
void forumMessageCostumPopupMenu( QPoint point ); void forumMessageCostumPopupMenu( QPoint point );
void fileHashingFinished(QList<HashedFile> hashedFiles); void fileHashingFinished(QList<HashedFile> hashedFiles);
/* actions to take.... */ /* actions to take.... */
void createMsg(); void createMsg();
void pasteLink(); void pasteLink();
void pasteLinkFull(); void pasteLinkFull();
void pasteOwnCertificateLink(); void pasteOwnCertificateLink();
void smileyWidgetForums(); void smileyWidgetForums();
void addSmileys(); void addSmileys();
void addFile(); void addFile();
protected: protected:
void closeEvent (QCloseEvent * event); void closeEvent (QCloseEvent * event);
private: private:
void saveForumInfo(const RsGroupMetaData &meta); void saveForumInfo(const RsGroupMetaData &meta);
@ -65,8 +65,8 @@ private:
void loadForumInfo(const uint32_t &token); void loadForumInfo(const uint32_t &token);
void loadParentMsg(const uint32_t &token); void loadParentMsg(const uint32_t &token);
std::string mForumId; std::string mForumId;
std::string mParentId; std::string mParentId;
bool mParentMsgLoaded; bool mParentMsgLoaded;
bool mForumMetaLoaded; bool mForumMetaLoaded;
@ -75,9 +75,8 @@ private:
TokenQueue *mForumQueue; TokenQueue *mForumQueue;
/** Qt Designer generated object */ /** Qt Designer generated object */
Ui::CreateGxsForumMsg ui; Ui::CreateGxsForumMsg ui;
}; };
#endif #endif

View File

@ -21,11 +21,22 @@
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
</property> </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> <number>0</number>
</property> </property>
<item> <item>
<widget class="HeaderFrame" name="headerFrame"/> <widget class="HeaderFrame" name="headerFrame">
<zorder>buttonBox</zorder>
</widget>
</item> </item>
<item> <item>
<widget class="QFrame" name="frame"> <widget class="QFrame" name="frame">
@ -37,216 +48,252 @@
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<widget class="QFrame" name="subjectFrame"> <widget class="QFrame" name="innerFrame">
<property name="frameShape"> <layout class="QVBoxLayout" name="verticalLayout_3">
<enum>QFrame::NoFrame</enum> <property name="leftMargin">
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="margin">
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="0"> <property name="topMargin">
<widget class="QLabel" name="forumLabel"> <number>0</number>
<property name="text"> </property>
<string>Forum</string> <property name="rightMargin">
</property> <number>0</number>
</widget> </property>
</item> <property name="bottomMargin">
<item row="0" column="1"> <number>0</number>
<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> </property>
<item> <item>
<widget class="QToolButton" name="attachFileButton"> <widget class="QFrame" name="subjectFrame">
<property name="focusPolicy"> <property name="frameShape">
<enum>Qt::NoFocus</enum> <enum>QFrame::NoFrame</enum>
</property> </property>
<property name="toolTip"> <property name="frameShadow">
<string>Attach File</string> <enum>QFrame::Raised</enum>
</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> </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> </widget>
</item> </item>
<item> <item>
<widget class="QToolButton" name="emoticonButton"> <widget class="QFrame" name="toolBarFrame">
<property name="focusPolicy"> <property name="maximumSize">
<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> <size>
<width>24</width> <width>16777215</width>
<height>24</height> <height>38</height>
</size> </size>
</property> </property>
<property name="autoRaise"> <property name="frameShape">
<bool>true</bool> <enum>QFrame::Box</enum>
</property> </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> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="signBox"> <widget class="QGroupBox" name="messageGroupBox">
<property name="focusPolicy"> <property name="title">
<enum>Qt::NoFocus</enum> <string>Forum Post</string>
</property> </property>
<property name="text"> <layout class="QGridLayout" name="gridLayout">
<string>Sign Message</string> <item row="0" column="0">
</property> <widget class="QTextEdit" name="forumMessage">
<property name="icon"> <property name="contextMenuPolicy">
<iconset resource="../images.qrc"> <enum>Qt::CustomContextMenu</enum>
<normaloff>:/images/pgp.png</normaloff>:/images/pgp.png</iconset> </property>
</property> <property name="html">
<property name="iconSize"> <string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
<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">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt; &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-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;&quot;&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> &lt;p style=&quot;-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;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget>
</item>
</layout>
</widget> </widget>
</item> </item>
</layout> <item>
</widget> <widget class="QGroupBox" name="hashGroupBox">
</item> <property name="title">
<item> <string>Attach files via drag and drop</string>
<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> </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> </widget>
</item> </item>
</layout> </layout>

View File

@ -25,6 +25,7 @@
#include "GxsForumsFillThread.h" #include "GxsForumsFillThread.h"
#include "GxsForumThreadWidget.h" #include "GxsForumThreadWidget.h"
#include "gxs/rsgxsflags.h"
#include <retroshare/rsgxsforums.h> #include <retroshare/rsgxsforums.h>
#include <iostream> #include <iostream>
@ -74,6 +75,18 @@ void GxsForumsFillThread::stop()
wait(); 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() void GxsForumsFillThread::run()
{ {
RsTokenService *service = rsGxsForums->getTokenService(); RsTokenService *service = rsGxsForums->getTokenService();
@ -162,6 +175,7 @@ void GxsForumsFillThread::run()
QTreeWidgetItem *item = mParent->convertMsgToThreadWidget(msg, mUseChildTS, mFilterColumn); QTreeWidgetItem *item = mParent->convertMsgToThreadWidget(msg, mUseChildTS, mFilterColumn);
threadList.push_back(QPair<std::string, QTreeWidgetItem*>(msg.mMeta.mMsgId, item)); threadList.push_back(QPair<std::string, QTreeWidgetItem*>(msg.mMeta.mMsgId, item));
calculateExpand(msg, item);
mItems.append(item); mItems.append(item);
emit progress(++pos, count); emit progress(++pos, count);
@ -202,6 +216,7 @@ void GxsForumsFillThread::run()
threadPair.second->addChild(item); threadPair.second->addChild(item);
} }
calculateExpand(msg, item);
/* add item to process list */ /* add item to process list */
threadList.push_back(QPair<std::string, QTreeWidgetItem*>(msg.mMeta.mMsgId, item)); threadList.push_back(QPair<std::string, QTreeWidgetItem*>(msg.mMeta.mMsgId, item));

View File

@ -4,6 +4,7 @@
#include <QThread> #include <QThread>
class GxsForumThreadWidget; class GxsForumThreadWidget;
class RsGxsForumMsg;
class RSTreeWidgetItemCompareRole; class RSTreeWidgetItemCompareRole;
class QTreeWidgetItem; class QTreeWidgetItem;
@ -39,6 +40,8 @@ public:
QList<QTreeWidgetItem*> mItemToExpand; QList<QTreeWidgetItem*> mItemToExpand;
private: private:
void calculateExpand(const RsGxsForumMsg &msg, QTreeWidgetItem *item);
GxsForumThreadWidget *mParent; GxsForumThreadWidget *mParent;
volatile bool mStopped; volatile bool mStopped;
}; };