mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-14 12:02:29 -04:00
Major improvements to Comments GUI for channels and posted.
- Split GxsIdWidgetTreeItem into two types. - Added Voter Id into Comment Dialog. - Expanded Comment display to show Votes and Score. - Expanded Comment Context Menu to include Voting and Reputation Options. - Fixed up CreateComment Dialog to include AuthorId, and enabled. - Completed Basic Comment Voting. - Made Comment Windows Closable. - Cleanup up Channel Posts before loading new ones. - Fixed up Channel Post Attachments, and Thumbnails. - Added View Comments button to Channel Posts - Misc other Bugs. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6219 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
b9f2708927
commit
5ba4c8f7ff
19 changed files with 829 additions and 389 deletions
|
@ -726,7 +726,7 @@ void WikiEditDialog::loadBaseHistory(const uint32_t &token)
|
||||||
std::cerr << " ParentId: " << page.mMeta.mParentId;
|
std::cerr << " ParentId: " << page.mMeta.mParentId;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
GxsIdTreeWidgetItem *modItem = new GxsIdTreeWidgetItem(mThreadCompareRole);
|
GxsIdRSTreeWidgetItem *modItem = new GxsIdRSTreeWidgetItem(mThreadCompareRole);
|
||||||
modItem->setData(WET_DATA_COLUMN, WET_ROLE_ORIGPAGEID, QString::fromStdString(page.mMeta.mOrigMsgId));
|
modItem->setData(WET_DATA_COLUMN, WET_ROLE_ORIGPAGEID, QString::fromStdString(page.mMeta.mOrigMsgId));
|
||||||
modItem->setData(WET_DATA_COLUMN, WET_ROLE_PAGEID, QString::fromStdString(page.mMeta.mMsgId));
|
modItem->setData(WET_DATA_COLUMN, WET_ROLE_PAGEID, QString::fromStdString(page.mMeta.mMsgId));
|
||||||
|
|
||||||
|
@ -841,7 +841,7 @@ void WikiEditDialog::loadEditTreeData(const uint32_t &token)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create an Entry */
|
/* create an Entry */
|
||||||
GxsIdTreeWidgetItem *modItem = new GxsIdTreeWidgetItem(mThreadCompareRole);
|
GxsIdRSTreeWidgetItem *modItem = new GxsIdRSTreeWidgetItem(mThreadCompareRole);
|
||||||
modItem->setData(WET_DATA_COLUMN, WET_ROLE_ORIGPAGEID, QString::fromStdString(snapshot.mMeta.mOrigMsgId));
|
modItem->setData(WET_DATA_COLUMN, WET_ROLE_ORIGPAGEID, QString::fromStdString(snapshot.mMeta.mOrigMsgId));
|
||||||
modItem->setData(WET_DATA_COLUMN, WET_ROLE_PAGEID, QString::fromStdString(snapshot.mMeta.mMsgId));
|
modItem->setData(WET_DATA_COLUMN, WET_ROLE_PAGEID, QString::fromStdString(snapshot.mMeta.mMsgId));
|
||||||
modItem->setData(WET_DATA_COLUMN, WET_ROLE_PARENTID, QString::fromStdString(snapshot.mMeta.mParentId));
|
modItem->setData(WET_DATA_COLUMN, WET_ROLE_PARENTID, QString::fromStdString(snapshot.mMeta.mParentId));
|
||||||
|
|
|
@ -93,9 +93,9 @@ void GxsChannelPostItem::setup()
|
||||||
connect(readAndClearButton, SIGNAL(clicked()), this, SLOT(readAndClearItem()));
|
connect(readAndClearButton, SIGNAL(clicked()), this, SLOT(readAndClearItem()));
|
||||||
connect( unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeChannel ( void ) ) );
|
connect( unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeChannel ( void ) ) );
|
||||||
|
|
||||||
//connect( downloadButton, SIGNAL( clicked( void ) ), this, SLOT( download ( void ) ) );
|
connect( downloadButton, SIGNAL( clicked( void ) ), this, SLOT( download ( void ) ) );
|
||||||
// HACK FOR NOW.
|
// HACK FOR NOW.
|
||||||
connect( downloadButton, SIGNAL( clicked( void ) ), this, SLOT( comments ( void ) ) );
|
connect( commentButton, SIGNAL( clicked( void ) ), this, SLOT( comments ( void ) ) );
|
||||||
|
|
||||||
connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( play ( void ) ) );
|
connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( play ( void ) ) );
|
||||||
connect( copyLinkButton, SIGNAL( clicked( void ) ), this, SLOT( copyLink ( void ) ) );
|
connect( copyLinkButton, SIGNAL( clicked( void ) ), this, SLOT( copyLink ( void ) ) );
|
||||||
|
@ -124,6 +124,7 @@ void GxsChannelPostItem::setup()
|
||||||
|
|
||||||
void GxsChannelPostItem::updateItemStatic()
|
void GxsChannelPostItem::updateItemStatic()
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
/* fill in */
|
/* fill in */
|
||||||
#ifdef DEBUG_ITEM
|
#ifdef DEBUG_ITEM
|
||||||
std::cerr << "GxsChannelPostItem::updateItemStatic()";
|
std::cerr << "GxsChannelPostItem::updateItemStatic()";
|
||||||
|
@ -262,6 +263,8 @@ void GxsChannelPostItem::updateItemStatic()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_inUpdateItemStatic = false;
|
m_inUpdateItemStatic = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -298,7 +301,7 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post)
|
||||||
unsubscribeButton->setEnabled(false);
|
unsubscribeButton->setEnabled(false);
|
||||||
}
|
}
|
||||||
readButton->hide();
|
readButton->hide();
|
||||||
newLabel->hide();
|
//newLabel->hide();
|
||||||
copyLinkButton->hide();
|
copyLinkButton->hide();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -338,13 +341,13 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post)
|
||||||
QColor color;
|
QColor color;
|
||||||
if (!IS_MSG_UNREAD(post.mMeta.mMsgStatus))
|
if (!IS_MSG_UNREAD(post.mMeta.mMsgStatus))
|
||||||
{
|
{
|
||||||
newLabel->setVisible(false);
|
//newLabel->setVisible(false);
|
||||||
newState = false;
|
newState = false;
|
||||||
color = COLOR_NORMAL;
|
color = COLOR_NORMAL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newLabel->setVisible(true);
|
//newLabel->setVisible(true);
|
||||||
newState = true;
|
newState = true;
|
||||||
color = COLOR_NEW;
|
color = COLOR_NEW;
|
||||||
}
|
}
|
||||||
|
@ -362,7 +365,7 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
readButton->setVisible(false);
|
readButton->setVisible(false);
|
||||||
newLabel->setVisible(false);
|
//newLabel->setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -382,17 +385,17 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post)
|
||||||
mFileItems.clear();
|
mFileItems.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
std::list<RsGxsFile>::const_iterator it;
|
||||||
std::list<FileInfo>::iterator it;
|
for(it = post.mFiles.begin(); it != post.mFiles.end(); it++)
|
||||||
for(it = cmi.files.begin(); it != cmi.files.end(); it++)
|
|
||||||
{
|
{
|
||||||
/* add file */
|
/* add file */
|
||||||
SubFileItem *fi = new SubFileItem(it->hash, it->fname, it->path, it->size,
|
std::string path;
|
||||||
|
SubFileItem *fi = new SubFileItem(it->mHash, it->mName, path, it->mSize,
|
||||||
SFI_STATE_REMOTE | SFI_TYPE_CHANNEL, "");
|
SFI_STATE_REMOTE | SFI_TYPE_CHANNEL, "");
|
||||||
mFileItems.push_back(fi);
|
mFileItems.push_back(fi);
|
||||||
|
|
||||||
/* check if the file is a media file */
|
/* check if the file is a media file */
|
||||||
if (!misc::isPreviewable(QFileInfo(QString::fromUtf8(it->fname.c_str())).suffix()))
|
if (!misc::isPreviewable(QFileInfo(QString::fromUtf8(it->mName.c_str())).suffix()))
|
||||||
fi->mediatype();
|
fi->mediatype();
|
||||||
|
|
||||||
|
|
||||||
|
@ -400,15 +403,12 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post)
|
||||||
layout->addWidget(fi);
|
layout->addWidget(fi);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cmi.thumbnail.image_thumbnail != NULL)
|
if(post.mThumbnail.mData != NULL)
|
||||||
{
|
{
|
||||||
QPixmap thumbnail;
|
QPixmap thumbnail;
|
||||||
thumbnail.loadFromData(cmi.thumbnail.image_thumbnail, cmi.thumbnail.im_thumbnail_size, "PNG");
|
thumbnail.loadFromData(post.mThumbnail.mData, post.mThumbnail.mSize, "PNG");
|
||||||
|
|
||||||
logoLabel->setPixmap(thumbnail);
|
logoLabel->setPixmap(thumbnail);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsChannelPostItem::setFileCleanUpWarning(uint32_t time_left)
|
void GxsChannelPostItem::setFileCleanUpWarning(uint32_t time_left)
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>629</width>
|
<width>629</width>
|
||||||
<height>172</height>
|
<height>177</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_4">
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
|
@ -224,19 +224,6 @@ p, li { white-space: pre-wrap; }
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="newLabel">
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>21</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>New</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="downloadButton">
|
<widget class="QPushButton" name="downloadButton">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
|
@ -271,6 +258,13 @@ p, li { white-space: pre-wrap; }
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="commentButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Comments</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|
|
@ -44,6 +44,9 @@ GxsCommentContainer::GxsCommentContainer(QWidget *parent)
|
||||||
: MainPage(parent)
|
: MainPage(parent)
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
|
connect(ui.tabWidget, SIGNAL(tabCloseRequested( int )), this, SLOT(tabCloseRequested( int )));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,6 +77,20 @@ void GxsCommentContainer::commentLoad(const RsGxsGroupId &grpId, const RsGxsMess
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void GxsCommentContainer::tabCloseRequested(int index)
|
||||||
|
{
|
||||||
|
std::cerr << "GxsCommentContainer::tabCloseRequested(" << index << ")";
|
||||||
|
if (index != 0)
|
||||||
|
{
|
||||||
|
QWidget *comments = ui.tabWidget->widget(index);
|
||||||
|
ui.tabWidget->removeTab(index);
|
||||||
|
delete comments;
|
||||||
|
}
|
||||||
|
std::cerr << "GxsCommentContainer::tabCloseRequested() Not closing First Tab";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,9 @@ public:
|
||||||
virtual RsGxsCommentService *getCommentService() = 0;
|
virtual RsGxsCommentService *getCommentService() = 0;
|
||||||
virtual GxsCommentHeader *createHeaderWidget() = 0;
|
virtual GxsCommentHeader *createHeaderWidget() = 0;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void tabCloseRequested(int index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
GxsServiceDialog *mServiceDialog;
|
GxsServiceDialog *mServiceDialog;
|
||||||
|
|
|
@ -77,6 +77,9 @@
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>-1</number>
|
<number>-1</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="tabsClosable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
|
@ -40,50 +40,89 @@
|
||||||
GxsCommentDialog::GxsCommentDialog(QWidget *parent, RsTokenService *token_service, RsGxsCommentService *comment_service)
|
GxsCommentDialog::GxsCommentDialog(QWidget *parent, RsTokenService *token_service, RsGxsCommentService *comment_service)
|
||||||
:QWidget(parent)
|
:QWidget(parent)
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
//ui.postFrame->setVisible(false);
|
//ui.postFrame->setVisible(false);
|
||||||
|
|
||||||
ui.treeWidget->setup(token_service, comment_service);
|
ui.treeWidget->setup(token_service, comment_service);
|
||||||
|
|
||||||
|
/* fill in the available OwnIds for signing */
|
||||||
|
ui.idChooser->loadIds(IDCHOOSER_ID_REQUIRED, "");
|
||||||
|
|
||||||
|
connect(ui.refreshButton, SIGNAL(clicked()), this, SLOT(refresh()));
|
||||||
|
connect(ui.idChooser, SIGNAL(currentIndexChanged( int )), this, SLOT(voterSelectionChanged( int )));
|
||||||
|
|
||||||
|
/* force voterId through - first time */
|
||||||
|
voterSelectionChanged( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsCommentDialog::commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId)
|
void GxsCommentDialog::commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId)
|
||||||
{
|
{
|
||||||
std::cerr << "GxsCommentDialog::commentLoad(" << grpId << ", " << msgId << ")";
|
std::cerr << "GxsCommentDialog::commentLoad(" << grpId << ", " << msgId << ")";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
mGrpId = grpId;
|
mGrpId = grpId;
|
||||||
mMsgId = msgId;
|
mMsgId = msgId;
|
||||||
|
|
||||||
RsGxsGrpMsgIdPair threadId;
|
RsGxsGrpMsgIdPair threadId;
|
||||||
|
|
||||||
threadId.first = grpId;
|
threadId.first = grpId;
|
||||||
threadId.second = msgId;
|
threadId.second = msgId;
|
||||||
|
|
||||||
ui.treeWidget->requestComments(threadId);
|
ui.treeWidget->requestComments(threadId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GxsCommentDialog::refresh()
|
||||||
|
{
|
||||||
|
std::cerr << "GxsCommentDialog::refresh()";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
commentLoad(mGrpId, mMsgId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GxsCommentDialog::voterSelectionChanged( int index )
|
||||||
|
{
|
||||||
|
std::cerr << "GxsCommentDialog::voterSelectionChanged(" << index << ")";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
RsGxsId voterId;
|
||||||
|
if (ui.idChooser->getChosenId(voterId))
|
||||||
|
{
|
||||||
|
std::cerr << "GxsCommentDialog::voterSelectionChanged() => " << voterId;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
ui.treeWidget->setVoteId(voterId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "GxsCommentDialog::voterSelectionChanged() ERROR nothing selected";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void GxsCommentDialog::setCommentHeader(GxsCommentHeader *header)
|
void GxsCommentDialog::setCommentHeader(GxsCommentHeader *header)
|
||||||
{
|
{
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
ui.postFrame->setVisible(true);
|
ui.postFrame->setVisible(true);
|
||||||
|
|
||||||
QDateTime qtime;
|
QDateTime qtime;
|
||||||
qtime.setTime_t(mCurrentPost.mMeta.mPublishTs);
|
qtime.setTime_t(mCurrentPost.mMeta.mPublishTs);
|
||||||
QString timestamp = qtime.toString("dd.MMMM yyyy hh:mm");
|
QString timestamp = qtime.toString("dd.MMMM yyyy hh:mm");
|
||||||
ui.dateLabel->setText(timestamp);
|
ui.dateLabel->setText(timestamp);
|
||||||
ui.fromLabel->setText(QString::fromUtf8(mCurrentPost.mMeta.mAuthorId.c_str()));
|
ui.fromLabel->setText(QString::fromUtf8(mCurrentPost.mMeta.mAuthorId.c_str()));
|
||||||
ui.titleLabel->setText("<a href=" + QString::fromStdString(mCurrentPost.mLink) +
|
ui.titleLabel->setText("<a href=" + QString::fromStdString(mCurrentPost.mLink) +
|
||||||
"><span style=\" text-decoration: underline; color:#0000ff;\">" +
|
"><span style=\" text-decoration: underline; color:#0000ff;\">" +
|
||||||
QString::fromStdString(mCurrentPost.mMeta.mMsgName) + "</span></a>");
|
QString::fromStdString(mCurrentPost.mMeta.mMsgName) + "</span></a>");
|
||||||
ui.siteLabel->setText("<a href=" + QString::fromStdString(mCurrentPost.mLink) +
|
ui.siteLabel->setText("<a href=" + QString::fromStdString(mCurrentPost.mLink) +
|
||||||
"><span style=\" text-decoration: underline; color:#0000ff;\">" +
|
"><span style=\" text-decoration: underline; color:#0000ff;\">" +
|
||||||
QString::fromStdString(mCurrentPost.mLink) + "</span></a>");
|
QString::fromStdString(mCurrentPost.mLink) + "</span></a>");
|
||||||
|
|
||||||
ui.scoreLabel->setText(QString("0"));
|
ui.scoreLabel->setText(QString("0"));
|
||||||
|
|
||||||
ui.notesBrowser->setPlainText(QString::fromStdString(mCurrentPost.mNotes));
|
ui.notesBrowser->setPlainText(QString::fromStdString(mCurrentPost.mNotes));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,10 @@ public:
|
||||||
void setCommentHeader(GxsCommentHeader *header);
|
void setCommentHeader(GxsCommentHeader *header);
|
||||||
void commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId);
|
void commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void refresh();
|
||||||
|
void voterSelectionChanged( int index );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
RsGxsGroupId mGrpId;
|
RsGxsGroupId mGrpId;
|
||||||
|
|
|
@ -241,13 +241,6 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QTextBrowser" name="notesBrowser">
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">background-color: rgb(203, 203, 203);</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
|
@ -321,7 +314,17 @@
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_5">
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Voter ID:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="GxsIdChooser" name="idChooser"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="refreshButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Refresh</string>
|
<string>Refresh</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -348,7 +351,17 @@
|
||||||
</column>
|
</column>
|
||||||
<column>
|
<column>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Points</string>
|
<string>Score</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>UpVotes</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>DownVotes</string>
|
||||||
</property>
|
</property>
|
||||||
</column>
|
</column>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -356,6 +369,11 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>GxsIdChooser</class>
|
||||||
|
<extends>QComboBox</extends>
|
||||||
|
<header>gui/gxs/GxsIdChooser.h</header>
|
||||||
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>GxsCommentTreeWidget</class>
|
<class>GxsCommentTreeWidget</class>
|
||||||
<extends>QTreeWidget</extends>
|
<extends>QTreeWidget</extends>
|
||||||
|
|
|
@ -25,197 +25,305 @@
|
||||||
|
|
||||||
#include "gui/gxs/GxsCommentTreeWidget.h"
|
#include "gui/gxs/GxsCommentTreeWidget.h"
|
||||||
#include "gui/gxs/GxsCreateCommentDialog.h"
|
#include "gui/gxs/GxsCreateCommentDialog.h"
|
||||||
|
#include "gui/gxs/GxsIdTreeWidgetItem.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#define PCITEM_COLUMN_COMMENT 0
|
#define PCITEM_COLUMN_COMMENT 0
|
||||||
#define PCITEM_COLUMN_AUTHOR 1
|
#define PCITEM_COLUMN_AUTHOR 1
|
||||||
#define PCITEM_COLUMN_DATE 2
|
#define PCITEM_COLUMN_DATE 2
|
||||||
#define PCITEM_COLUMN_SERVSTRING 3
|
#define PCITEM_COLUMN_SCORE 3
|
||||||
#define PCITEM_COLUMN_MSGID 4
|
#define PCITEM_COLUMN_UPVOTES 4
|
||||||
#define PCITEM_COLUMN_PARENTID 5
|
#define PCITEM_COLUMN_DOWNVOTES 5
|
||||||
|
#define PCITEM_COLUMN_MSGID 6
|
||||||
|
#define PCITEM_COLUMN_PARENTID 7
|
||||||
|
|
||||||
#define GXSCOMMENTS_LOADTHREAD 1
|
#define GXSCOMMENTS_LOADTHREAD 1
|
||||||
|
|
||||||
|
|
||||||
/* Images for context menu icons */
|
/* Images for context menu icons */
|
||||||
#define IMAGE_MESSAGE ":/images/folder-draft.png"
|
#define IMAGE_MESSAGE ":/images/folder-draft.png"
|
||||||
|
|
||||||
GxsCommentTreeWidget::GxsCommentTreeWidget(QWidget *parent)
|
GxsCommentTreeWidget::GxsCommentTreeWidget(QWidget *parent)
|
||||||
:QTreeWidget(parent), mRsTokenService(NULL), mCommentService(NULL), mTokenQueue(NULL)
|
:QTreeWidget(parent), mRsTokenService(NULL), mCommentService(NULL), mTokenQueue(NULL)
|
||||||
{
|
{
|
||||||
// QTreeWidget* widget = this;
|
// QTreeWidget* widget = this;
|
||||||
|
|
||||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
// QFont font = QFont("ARIAL", 10);
|
// QFont font = QFont("ARIAL", 10);
|
||||||
// font.setBold(true);
|
// font.setBold(true);
|
||||||
|
|
||||||
// QString name("test");
|
// QString name("test");
|
||||||
// QTreeWidgetItem *item = new QTreeWidgetItem();
|
// QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||||
// item->setText(0, name);
|
// item->setText(0, name);
|
||||||
// item->setFont(0, font);
|
// item->setFont(0, font);
|
||||||
// item->setSizeHint(0, QSize(18, 18));
|
// item->setSizeHint(0, QSize(18, 18));
|
||||||
// item->setForeground(0, QBrush(QColor(79, 79, 79)));
|
// item->setForeground(0, QBrush(QColor(79, 79, 79)));
|
||||||
|
|
||||||
// addTopLevelItem(item);
|
// addTopLevelItem(item);
|
||||||
// item->setExpanded(true);
|
// item->setExpanded(true);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsCommentTreeWidget::setCurrentMsgId(QTreeWidgetItem *current, QTreeWidgetItem *previous)
|
void GxsCommentTreeWidget::setCurrentMsgId(QTreeWidgetItem *current, QTreeWidgetItem *previous)
|
||||||
{
|
{
|
||||||
|
|
||||||
Q_UNUSED(previous);
|
Q_UNUSED(previous);
|
||||||
|
|
||||||
if(current)
|
if(current)
|
||||||
{
|
{
|
||||||
mCurrentMsgId = current->text(PCITEM_COLUMN_MSGID).toStdString();
|
mCurrentMsgId = current->text(PCITEM_COLUMN_MSGID).toStdString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsCommentTreeWidget::customPopUpMenu(const QPoint& point)
|
void GxsCommentTreeWidget::customPopUpMenu(const QPoint& point)
|
||||||
{
|
{
|
||||||
QMenu contextMnu( this );
|
QMenu contextMnu( this );
|
||||||
QAction* action = contextMnu.addAction(QIcon(IMAGE_MESSAGE), tr("Reply to Comment"), this, SLOT(replyToComment()));
|
QAction* action = contextMnu.addAction(QIcon(IMAGE_MESSAGE), tr("Reply to Comment"), this, SLOT(replyToComment()));
|
||||||
action->setDisabled(mCurrentMsgId.empty());
|
action->setDisabled(mCurrentMsgId.empty());
|
||||||
action = contextMnu.addAction(QIcon(IMAGE_MESSAGE), tr("Submit Comment"), this, SLOT(makeComment()));
|
action = contextMnu.addAction(QIcon(IMAGE_MESSAGE), tr("Submit Comment"), this, SLOT(makeComment()));
|
||||||
action->setDisabled(mThreadId.first.empty());
|
action->setDisabled(mThreadId.first.empty());
|
||||||
contextMnu.exec(QCursor::pos());
|
|
||||||
|
contextMnu.addSeparator();
|
||||||
|
|
||||||
|
action = contextMnu.addAction(QIcon(IMAGE_MESSAGE), tr("Vote Up"), this, SLOT(voteUp()));
|
||||||
|
action->setDisabled(mVoterId.empty());
|
||||||
|
action = contextMnu.addAction(QIcon(IMAGE_MESSAGE), tr("Vote Down"), this, SLOT(voteDown()));
|
||||||
|
action->setDisabled(mVoterId.empty());
|
||||||
|
|
||||||
|
|
||||||
|
if (!mCurrentMsgId.empty())
|
||||||
|
{
|
||||||
|
contextMnu.addSeparator();
|
||||||
|
QMenu *rep_menu = contextMnu.addMenu(tr("Reputation"));
|
||||||
|
|
||||||
|
action = rep_menu->addAction(QIcon(IMAGE_MESSAGE), tr("Show Reputation"), this, SLOT(showReputation()));
|
||||||
|
contextMnu.addSeparator();
|
||||||
|
|
||||||
|
action = rep_menu->addAction(QIcon(IMAGE_MESSAGE), tr("Interesting User"), this, SLOT(markInteresting()));
|
||||||
|
contextMnu.addSeparator();
|
||||||
|
|
||||||
|
action = rep_menu->addAction(QIcon(IMAGE_MESSAGE), tr("Mark Spammy"), this, SLOT(markSpammer()));
|
||||||
|
action = rep_menu->addAction(QIcon(IMAGE_MESSAGE), tr("Ban User"), this, SLOT(banUser()));
|
||||||
|
}
|
||||||
|
|
||||||
|
contextMnu.exec(QCursor::pos());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GxsCommentTreeWidget::voteUp()
|
||||||
|
{
|
||||||
|
std::cerr << "GxsCommentTreeWidget::voteUp()";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
vote(mThreadId.first, mThreadId.second, mCurrentMsgId, mVoterId, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GxsCommentTreeWidget::voteDown()
|
||||||
|
{
|
||||||
|
std::cerr << "GxsCommentTreeWidget::voteDown()";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
vote(mThreadId.first, mThreadId.second, mCurrentMsgId, mVoterId, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GxsCommentTreeWidget::setVoteId(const RsGxsId &voterId)
|
||||||
|
{
|
||||||
|
mVoterId = voterId;
|
||||||
|
std::cerr << "GxsCommentTreeWidget::setVoterId(" << mVoterId << ")";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GxsCommentTreeWidget::vote(const RsGxsGroupId &groupId, const RsGxsMessageId &threadId,
|
||||||
|
const RsGxsMessageId &parentId, const RsGxsId &authorId, bool up)
|
||||||
|
{
|
||||||
|
RsGxsVote vote;
|
||||||
|
|
||||||
|
vote.mMeta.mGroupId = groupId;
|
||||||
|
vote.mMeta.mThreadId = threadId;
|
||||||
|
vote.mMeta.mParentId = parentId;
|
||||||
|
vote.mMeta.mAuthorId = authorId;
|
||||||
|
|
||||||
|
if (up)
|
||||||
|
{
|
||||||
|
vote.mVoteType = GXS_VOTE_UP;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vote.mVoteType = GXS_VOTE_DOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cerr << "GxsCommentTreeWidget::vote()";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
std::cerr << "GroupId : " << vote.mMeta.mGroupId << std::endl;
|
||||||
|
std::cerr << "ThreadId : " << vote.mMeta.mThreadId << std::endl;
|
||||||
|
std::cerr << "ParentId : " << vote.mMeta.mParentId << std::endl;
|
||||||
|
std::cerr << "AuthorId : " << vote.mMeta.mAuthorId << std::endl;
|
||||||
|
|
||||||
|
uint32_t token;
|
||||||
|
mCommentService->createVote(token, vote);
|
||||||
|
mTokenQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GxsCommentTreeWidget::showReputation()
|
||||||
|
{
|
||||||
|
std::cerr << "GxsCommentTreeWidget::showReputation() TODO";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GxsCommentTreeWidget::markInteresting()
|
||||||
|
{
|
||||||
|
std::cerr << "GxsCommentTreeWidget::markInteresting() TODO";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GxsCommentTreeWidget::markSpammer()
|
||||||
|
{
|
||||||
|
std::cerr << "GxsCommentTreeWidget::markSpammer() TODO";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GxsCommentTreeWidget::banUser()
|
||||||
|
{
|
||||||
|
std::cerr << "GxsCommentTreeWidget::banUser() TODO";
|
||||||
|
std::cerr << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsCommentTreeWidget::makeComment()
|
void GxsCommentTreeWidget::makeComment()
|
||||||
{
|
{
|
||||||
GxsCreateCommentDialog pcc(mTokenQueue, mCommentService, mThreadId, mThreadId.second, this);
|
GxsCreateCommentDialog pcc(mTokenQueue, mCommentService, mThreadId, mThreadId.second, this);
|
||||||
pcc.exec();
|
pcc.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsCommentTreeWidget::replyToComment()
|
void GxsCommentTreeWidget::replyToComment()
|
||||||
{
|
{
|
||||||
RsGxsGrpMsgIdPair msgId;
|
RsGxsGrpMsgIdPair msgId;
|
||||||
msgId.first = mThreadId.first;
|
msgId.first = mThreadId.first;
|
||||||
msgId.second = mCurrentMsgId;
|
msgId.second = mCurrentMsgId;
|
||||||
GxsCreateCommentDialog pcc(mTokenQueue, mCommentService, msgId, mThreadId.second, this);
|
GxsCreateCommentDialog pcc(mTokenQueue, mCommentService, msgId, mThreadId.second, this);
|
||||||
pcc.exec();
|
pcc.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsCommentTreeWidget::setup(RsTokenService *token_service, RsGxsCommentService *comment_service)
|
void GxsCommentTreeWidget::setup(RsTokenService *token_service, RsGxsCommentService *comment_service)
|
||||||
{
|
{
|
||||||
mRsTokenService = token_service;
|
mRsTokenService = token_service;
|
||||||
mCommentService = comment_service;
|
mCommentService = comment_service;
|
||||||
mTokenQueue = new TokenQueue(token_service, this);
|
mTokenQueue = new TokenQueue(token_service, this);
|
||||||
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(customPopUpMenu(QPoint)));
|
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(customPopUpMenu(QPoint)));
|
||||||
connect(this, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(setCurrentMsgId(QTreeWidgetItem*, QTreeWidgetItem*)));
|
connect(this, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(setCurrentMsgId(QTreeWidgetItem*, QTreeWidgetItem*)));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Load Comments */
|
/* Load Comments */
|
||||||
void GxsCommentTreeWidget::requestComments(const RsGxsGrpMsgIdPair& threadId)
|
void GxsCommentTreeWidget::requestComments(const RsGxsGrpMsgIdPair& threadId)
|
||||||
{
|
{
|
||||||
/* request comments */
|
/* request comments */
|
||||||
|
|
||||||
mThreadId = threadId;
|
mThreadId = threadId;
|
||||||
service_requestComments(threadId);
|
service_requestComments(threadId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsCommentTreeWidget::service_requestComments(const RsGxsGrpMsgIdPair& threadId)
|
void GxsCommentTreeWidget::service_requestComments(const RsGxsGrpMsgIdPair& threadId)
|
||||||
{
|
{
|
||||||
/* request comments */
|
/* request comments */
|
||||||
std::cerr << "GxsCommentTreeWidget::service_requestComments(" << threadId.second << ")";
|
std::cerr << "GxsCommentTreeWidget::service_requestComments(" << threadId.second << ")";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
RsTokReqOptions opts;
|
RsTokReqOptions opts;
|
||||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_RELATED_DATA;
|
opts.mReqType = GXS_REQUEST_TYPE_MSG_RELATED_DATA;
|
||||||
opts.mOptions = RS_TOKREQOPT_MSG_THREAD | RS_TOKREQOPT_MSG_LATEST;
|
opts.mOptions = RS_TOKREQOPT_MSG_THREAD | RS_TOKREQOPT_MSG_LATEST;
|
||||||
|
|
||||||
std::vector<RsGxsGrpMsgIdPair> msgIds;
|
std::vector<RsGxsGrpMsgIdPair> msgIds;
|
||||||
msgIds.push_back(threadId);
|
msgIds.push_back(threadId);
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mTokenQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, GXSCOMMENTS_LOADTHREAD);
|
mTokenQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, GXSCOMMENTS_LOADTHREAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Generic Handling */
|
/* Generic Handling */
|
||||||
void GxsCommentTreeWidget::clearItems()
|
void GxsCommentTreeWidget::clearItems()
|
||||||
{
|
{
|
||||||
mPendingInsertMap.clear();
|
mPendingInsertMap.clear();
|
||||||
mLoadingMap.clear();
|
mLoadingMap.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GxsCommentTreeWidget::completeItems()
|
void GxsCommentTreeWidget::completeItems()
|
||||||
{
|
{
|
||||||
/* handle pending items */
|
/* handle pending items */
|
||||||
std::string parentId;
|
std::string parentId;
|
||||||
QTreeWidgetItem *parent = NULL;
|
QTreeWidgetItem *parent = NULL;
|
||||||
QList<QTreeWidgetItem *> topLevelItems;
|
QList<QTreeWidgetItem *> topLevelItems;
|
||||||
|
|
||||||
std::map<std::string, QTreeWidgetItem *>::iterator lit;
|
std::map<std::string, QTreeWidgetItem *>::iterator lit;
|
||||||
std::multimap<std::string, QTreeWidgetItem *>::iterator pit;
|
std::multimap<std::string, QTreeWidgetItem *>::iterator pit;
|
||||||
|
|
||||||
std::cerr << "GxsCommentTreeWidget::completeItems() " << mPendingInsertMap.size();
|
std::cerr << "GxsCommentTreeWidget::completeItems() " << mPendingInsertMap.size();
|
||||||
std::cerr << " PendingItems";
|
std::cerr << " PendingItems";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
for(pit = mPendingInsertMap.begin(); pit != mPendingInsertMap.end(); pit++)
|
for(pit = mPendingInsertMap.begin(); pit != mPendingInsertMap.end(); pit++)
|
||||||
{
|
{
|
||||||
std::cerr << "GxsCommentTreeWidget::completeItems() item->parent: " << pit->first;
|
std::cerr << "GxsCommentTreeWidget::completeItems() item->parent: " << pit->first;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
if (pit->first != parentId)
|
if (pit->first != parentId)
|
||||||
{
|
{
|
||||||
/* find parent */
|
/* find parent */
|
||||||
parentId = pit->first;
|
parentId = pit->first;
|
||||||
lit = mLoadingMap.find(pit->first);
|
lit = mLoadingMap.find(pit->first);
|
||||||
if (lit != mLoadingMap.end())
|
if (lit != mLoadingMap.end())
|
||||||
{
|
{
|
||||||
parent = lit->second;
|
parent = lit->second;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
parent = NULL;
|
parent = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parent)
|
if (parent)
|
||||||
{
|
{
|
||||||
std::cerr << "GxsCommentTreeWidget::completeItems() Added to Parent";
|
std::cerr << "GxsCommentTreeWidget::completeItems() Added to Parent";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
parent->addChild(pit->second);
|
parent->addChild(pit->second);
|
||||||
}
|
}
|
||||||
else if (parentId == mThreadId.second)
|
else if (parentId == mThreadId.second)
|
||||||
{
|
{
|
||||||
std::cerr << "GxsCommentTreeWidget::completeItems() Added to topLevelItems";
|
std::cerr << "GxsCommentTreeWidget::completeItems() Added to topLevelItems";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
topLevelItems.append(pit->second);
|
topLevelItems.append(pit->second);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
/* missing parent -> insert At Top Level */
|
/* missing parent -> insert At Top Level */
|
||||||
QTreeWidgetItem *missingItem = service_createMissingItem(pit->first);
|
QTreeWidgetItem *missingItem = service_createMissingItem(pit->first);
|
||||||
|
|
||||||
std::cerr << "GxsCommentTreeWidget::completeItems() Added MissingItem";
|
std::cerr << "GxsCommentTreeWidget::completeItems() Added MissingItem";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
parent = missingItem;
|
parent = missingItem;
|
||||||
parent->addChild(pit->second);
|
parent->addChild(pit->second);
|
||||||
topLevelItems.append(parent);
|
topLevelItems.append(parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now push final tree into Tree */
|
/* now push final tree into Tree */
|
||||||
clear();
|
clear();
|
||||||
insertTopLevelItems(0, topLevelItems);
|
insertTopLevelItems(0, topLevelItems);
|
||||||
|
|
||||||
/* cleanup temp stuff */
|
/* cleanup temp stuff */
|
||||||
mLoadingMap.clear();
|
mLoadingMap.clear();
|
||||||
mPendingInsertMap.clear();
|
mPendingInsertMap.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -257,67 +365,66 @@ void GxsCommentTreeWidget::loadThread(const uint32_t &token)
|
||||||
|
|
||||||
void GxsCommentTreeWidget::acknowledgeComment(const uint32_t &token)
|
void GxsCommentTreeWidget::acknowledgeComment(const uint32_t &token)
|
||||||
{
|
{
|
||||||
RsGxsGrpMsgIdPair msgId;
|
RsGxsGrpMsgIdPair msgId;
|
||||||
mCommentService->acknowledgeComment(token, msgId);
|
mCommentService->acknowledgeComment(token, msgId);
|
||||||
|
|
||||||
// simply reload data
|
// simply reload data
|
||||||
service_requestComments(mThreadId);
|
service_requestComments(mThreadId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GxsCommentTreeWidget::service_loadThread(const uint32_t &token)
|
void GxsCommentTreeWidget::service_loadThread(const uint32_t &token)
|
||||||
{
|
{
|
||||||
std::cerr << "GxsCommentTreeWidget::service_loadThread() ERROR must be overloaded!";
|
std::cerr << "GxsCommentTreeWidget::service_loadThread() ERROR must be overloaded!";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
std::vector<RsGxsComment> comments;
|
std::vector<RsGxsComment> comments;
|
||||||
mCommentService->getRelatedComments(token, comments);
|
mCommentService->getRelatedComments(token, comments);
|
||||||
|
|
||||||
std::vector<RsGxsComment>::iterator vit;
|
std::vector<RsGxsComment>::iterator vit;
|
||||||
|
|
||||||
for(vit = comments.begin(); vit != comments.end(); vit++)
|
for(vit = comments.begin(); vit != comments.end(); vit++)
|
||||||
{
|
{
|
||||||
RsGxsComment &comment = *vit;
|
RsGxsComment &comment = *vit;
|
||||||
/* convert to a QTreeWidgetItem */
|
/* convert to a QTreeWidgetItem */
|
||||||
std::cerr << "GxsCommentTreeWidget::service_loadThread() Got Comment: " << comment.mMeta.mMsgId;
|
std::cerr << "GxsCommentTreeWidget::service_loadThread() Got Comment: " << comment.mMeta.mMsgId;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
GxsIdTreeWidgetItem *item = new GxsIdTreeWidgetItem();
|
||||||
QString text;
|
QString text;
|
||||||
|
|
||||||
{
|
{
|
||||||
QDateTime qtime;
|
QDateTime qtime;
|
||||||
qtime.setTime_t(comment.mMeta.mPublishTs);
|
qtime.setTime_t(comment.mMeta.mPublishTs);
|
||||||
|
|
||||||
text = qtime.toString("yyyy-MM-dd hh:mm:ss");
|
text = qtime.toString("yyyy-MM-dd hh:mm:ss");
|
||||||
item->setText(PCITEM_COLUMN_DATE, text);
|
item->setText(PCITEM_COLUMN_DATE, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
text = QString::fromUtf8(comment.mComment.c_str());
|
text = QString::fromUtf8(comment.mComment.c_str());
|
||||||
item->setText(PCITEM_COLUMN_COMMENT, text);
|
item->setText(PCITEM_COLUMN_COMMENT, text);
|
||||||
|
|
||||||
text = QString::fromUtf8(comment.mMeta.mAuthorId.c_str());
|
RsGxsId authorId = comment.mMeta.mAuthorId;
|
||||||
if (text.isEmpty())
|
item->setId(authorId, PCITEM_COLUMN_AUTHOR);
|
||||||
{
|
|
||||||
item->setText(PCITEM_COLUMN_AUTHOR, tr("Anonymous"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
item->setText(PCITEM_COLUMN_AUTHOR, text);
|
|
||||||
}
|
|
||||||
|
|
||||||
text = QString::fromUtf8(comment.mMeta.mMsgId.c_str());
|
text = QString::number(comment.mScore);
|
||||||
item->setText(PCITEM_COLUMN_MSGID, text);
|
item->setText(PCITEM_COLUMN_SCORE, text);
|
||||||
|
|
||||||
text = QString::fromUtf8(comment.mMeta.mParentId.c_str());
|
text = QString::number(comment.mUpVotes);
|
||||||
item->setText(PCITEM_COLUMN_PARENTID, text);
|
item->setText(PCITEM_COLUMN_UPVOTES, text);
|
||||||
|
|
||||||
text = QString::fromUtf8("0");
|
text = QString::number(comment.mDownVotes);
|
||||||
//text = QString::fromUtf8(comment.mMeta.mServiceString.c_str());
|
item->setText(PCITEM_COLUMN_DOWNVOTES, text);
|
||||||
item->setText(PCITEM_COLUMN_SERVSTRING, text);
|
|
||||||
|
|
||||||
addItem(comment.mMeta.mMsgId, comment.mMeta.mParentId, item);
|
text = QString::fromUtf8(comment.mMeta.mMsgId.c_str());
|
||||||
}
|
item->setText(PCITEM_COLUMN_MSGID, text);
|
||||||
|
|
||||||
|
text = QString::fromUtf8(comment.mMeta.mParentId.c_str());
|
||||||
|
item->setText(PCITEM_COLUMN_PARENTID, text);
|
||||||
|
|
||||||
|
|
||||||
|
addItem(comment.mMeta.mMsgId, comment.mMeta.mParentId, item);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -338,9 +445,8 @@ QTreeWidgetItem *GxsCommentTreeWidget::service_createMissingItem(const RsGxsMess
|
||||||
|
|
||||||
item->setText(PCITEM_COLUMN_MSGID, text);
|
item->setText(PCITEM_COLUMN_MSGID, text);
|
||||||
|
|
||||||
item->setText(PCITEM_COLUMN_SERVSTRING, text);
|
|
||||||
|
|
||||||
text = QString::fromUtf8(parent.c_str());
|
text = QString::fromUtf8(parent.c_str());
|
||||||
item->setText(PCITEM_COLUMN_PARENTID, text);
|
item->setText(PCITEM_COLUMN_PARENTID, text);
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
|
@ -361,26 +467,26 @@ void GxsCommentTreeWidget::loadRequest(const TokenQueue *queue, const TokenReque
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now switch on req */
|
/* now switch on req */
|
||||||
switch(req.mType)
|
switch(req.mType)
|
||||||
{
|
{
|
||||||
|
|
||||||
case TOKENREQ_MSGINFO:
|
case TOKENREQ_MSGINFO:
|
||||||
{
|
{
|
||||||
switch(req.mAnsType)
|
switch(req.mAnsType)
|
||||||
{
|
{
|
||||||
case RS_TOKREQ_ANSTYPE_ACK:
|
case RS_TOKREQ_ANSTYPE_ACK:
|
||||||
acknowledgeComment(req.mToken);
|
acknowledgeComment(req.mToken);
|
||||||
break;
|
break;
|
||||||
case RS_TOKREQ_ANSTYPE_DATA:
|
case RS_TOKREQ_ANSTYPE_DATA:
|
||||||
loadThread(req.mToken);
|
loadThread(req.mToken);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
std::cerr << "GxsCommentTreeWidget::loadRequest() UNKNOWN UserType ";
|
std::cerr << "GxsCommentTreeWidget::loadRequest() UNKNOWN UserType ";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#include "util/TokenQueue.h"
|
#include "util/TokenQueue.h"
|
||||||
#include <retroshare/rsgxscommon.h>
|
#include <retroshare/rsgxscommon.h>
|
||||||
|
#include <retroshare/rsidentity.h>
|
||||||
|
|
||||||
class GxsCommentTreeWidget : public QTreeWidget, public TokenResponse
|
class GxsCommentTreeWidget : public QTreeWidget, public TokenResponse
|
||||||
{
|
{
|
||||||
|
@ -40,6 +41,7 @@ public:
|
||||||
void applyRankings(std::map<RsGxsMessageId, uint32_t>& positions);
|
void applyRankings(std::map<RsGxsMessageId, uint32_t>& positions);
|
||||||
|
|
||||||
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||||
|
void setVoteId(const RsGxsId &voterId);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -64,11 +66,23 @@ public slots:
|
||||||
void makeComment();
|
void makeComment();
|
||||||
void replyToComment();
|
void replyToComment();
|
||||||
|
|
||||||
|
void voteUp();
|
||||||
|
void voteDown();
|
||||||
|
|
||||||
|
void showReputation();
|
||||||
|
void markInteresting();
|
||||||
|
void markSpammer();
|
||||||
|
void banUser();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
void vote(const RsGxsGroupId &groupId, const RsGxsMessageId &threadId,
|
||||||
|
const RsGxsMessageId &parentId, const RsGxsId &authorId, bool up);
|
||||||
|
|
||||||
/* Data */
|
/* Data */
|
||||||
RsGxsGrpMsgIdPair mThreadId;
|
RsGxsGrpMsgIdPair mThreadId;
|
||||||
RsGxsMessageId mCurrentMsgId;
|
RsGxsMessageId mCurrentMsgId;
|
||||||
|
RsGxsId mVoterId;
|
||||||
|
|
||||||
std::map<std::string, QTreeWidgetItem *> mLoadingMap;
|
std::map<std::string, QTreeWidgetItem *> mLoadingMap;
|
||||||
std::multimap<std::string, QTreeWidgetItem *> mPendingInsertMap;
|
std::multimap<std::string, QTreeWidgetItem *> mPendingInsertMap;
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
#include "GxsCreateCommentDialog.h"
|
#include "GxsCreateCommentDialog.h"
|
||||||
#include "ui_GxsCreateCommentDialog.h"
|
#include "ui_GxsCreateCommentDialog.h"
|
||||||
|
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
GxsCreateCommentDialog::GxsCreateCommentDialog(TokenQueue *tokQ, RsGxsCommentService *service,
|
GxsCreateCommentDialog::GxsCreateCommentDialog(TokenQueue *tokQ, RsGxsCommentService *service,
|
||||||
const RsGxsGrpMsgIdPair &parentId, const RsGxsMessageId& threadId, QWidget *parent) :
|
const RsGxsGrpMsgIdPair &parentId, const RsGxsMessageId& threadId, QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
|
@ -9,17 +12,47 @@ GxsCreateCommentDialog::GxsCreateCommentDialog(TokenQueue *tokQ, RsGxsCommentSer
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(createComment()));
|
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(createComment()));
|
||||||
|
|
||||||
|
/* fill in the available OwnIds for signing */
|
||||||
|
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsCreateCommentDialog::createComment()
|
void GxsCreateCommentDialog::createComment()
|
||||||
{
|
{
|
||||||
RsGxsComment comment;
|
RsGxsComment comment;
|
||||||
|
|
||||||
comment.mComment = ui->commentTextEdit->document()->toPlainText().toStdString();
|
comment.mComment = std::string(ui->commentTextEdit->document()->toPlainText().toUtf8());
|
||||||
comment.mMeta.mParentId = mParentId.second;
|
comment.mMeta.mParentId = mParentId.second;
|
||||||
comment.mMeta.mGroupId = mParentId.first;
|
comment.mMeta.mGroupId = mParentId.first;
|
||||||
comment.mMeta.mThreadId = mThreadId;
|
comment.mMeta.mThreadId = mThreadId;
|
||||||
|
|
||||||
|
std::cerr << "GxsCreateCommentDialog::createComment()";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
std::cerr << "GroupId : " << comment.mMeta.mGroupId << std::endl;
|
||||||
|
std::cerr << "ThreadId : " << comment.mMeta.mThreadId << std::endl;
|
||||||
|
std::cerr << "ParentId : " << comment.mMeta.mParentId << std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
RsGxsId authorId;
|
||||||
|
if (ui->idChooser->getChosenId(authorId))
|
||||||
|
{
|
||||||
|
comment.mMeta.mAuthorId = authorId;
|
||||||
|
std::cerr << "AuthorId : " << comment.mMeta.mAuthorId << std::endl;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "GxsCreateCommentDialog::createComment() ERROR GETTING AuthorId!";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
int ret = QMessageBox::information(this, tr("Comment Signing Error"),
|
||||||
|
tr("You need to create an Identity\n"
|
||||||
|
"before you can comment"),
|
||||||
|
QMessageBox::Ok);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mCommentService->createComment(token, comment);
|
mCommentService->createComment(token, comment);
|
||||||
mTokenQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
|
mTokenQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
|
||||||
|
|
|
@ -6,30 +6,53 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>372</width>
|
<width>404</width>
|
||||||
<height>145</height>
|
<height>336</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Make Comment</string>
|
<string>Make Comment</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<widget class="QLabel" name="label">
|
||||||
<item>
|
<property name="text">
|
||||||
<widget class="QLabel" name="label">
|
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
<property name="text">
|
|
||||||
<string><!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">
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
p, li { white-space: pre-wrap; }
|
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;">
|
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">Comment</span></p></body></html></string>
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">Comment</span></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="3">
|
||||||
|
<widget class="GxsIdChooser" name="idChooser"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="4">
|
||||||
|
<widget class="QTextEdit" name="commentTextEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QLabel" name="subjectLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Signed by</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QTextEdit" name="commentTextEdit"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -44,39 +67,13 @@ p, li { white-space: pre-wrap; }
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>GxsIdChooser</class>
|
||||||
|
<extends>QComboBox</extends>
|
||||||
|
<header>gui/gxs/GxsIdChooser.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections/>
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>accepted()</signal>
|
|
||||||
<receiver>PostedCreateCommentDialog</receiver>
|
|
||||||
<slot>accept()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>248</x>
|
|
||||||
<y>254</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>157</x>
|
|
||||||
<y>274</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>rejected()</signal>
|
|
||||||
<receiver>PostedCreateCommentDialog</receiver>
|
|
||||||
<slot>reject()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>316</x>
|
|
||||||
<y>260</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>286</x>
|
|
||||||
<y>274</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -25,19 +25,146 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
static bool MakeIdDesc(const RsGxsId &id, QString &str)
|
||||||
|
{
|
||||||
|
RsIdentityDetails details;
|
||||||
|
|
||||||
|
if (!rsIdentity->getIdDetails(id, details))
|
||||||
|
{
|
||||||
|
std::cerr << "GxsIdRSTreeWidgetItem::MakeIdDesc() FAILED TO GET ID";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
str = "Loading... " + QString::fromStdString(id.substr(0,5));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
str = QString::fromUtf8(details.mNickname.c_str());
|
||||||
|
|
||||||
|
bool addCode = true;
|
||||||
|
if (details.mPgpLinked)
|
||||||
|
{
|
||||||
|
str += " (PGP) [";
|
||||||
|
if (details.mPgpKnown)
|
||||||
|
{
|
||||||
|
/* look up real name */
|
||||||
|
std::string authorName = rsPeers->getPeerName(details.mPgpId);
|
||||||
|
str += QString::fromUtf8(authorName.c_str());
|
||||||
|
str += "]";
|
||||||
|
|
||||||
|
addCode = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
str += " (Anon) [";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (addCode)
|
||||||
|
{
|
||||||
|
str += QString::fromStdString(id.substr(0,5));
|
||||||
|
str += "...]";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cerr << "GxsIdRSTreeWidgetItem::MakeIdDesc() ID Ok";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
GxsIdTreeWidgetItem::GxsIdTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, QTreeWidget *parent)
|
GxsIdRSTreeWidgetItem::GxsIdRSTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, QTreeWidget *parent)
|
||||||
:RSTreeWidgetItem(compareRole, parent), QObject(NULL), mTimer(NULL), mCount(0), mColumn(0)
|
:RSTreeWidgetItem(compareRole, parent), QObject(NULL), mTimer(NULL), mCount(0), mColumn(0)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
GxsIdTreeWidgetItem::GxsIdTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, QTreeWidgetItem *parent)
|
GxsIdRSTreeWidgetItem::GxsIdRSTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, QTreeWidgetItem *parent)
|
||||||
:RSTreeWidgetItem(compareRole, parent), QObject(NULL), mTimer(NULL), mCount(0), mColumn(0)
|
:RSTreeWidgetItem(compareRole, parent), QObject(NULL), mTimer(NULL), mCount(0), mColumn(0)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GxsIdRSTreeWidgetItem::init()
|
||||||
|
{
|
||||||
|
mTimer = new QTimer(this);
|
||||||
|
mTimer->setSingleShot(true);
|
||||||
|
connect(mTimer, SIGNAL(timeout()), this, SLOT(loadId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void GxsIdRSTreeWidgetItem::setId(const RsGxsId &id, int column)
|
||||||
|
{
|
||||||
|
std::cerr << " GxsIdRSTreeWidgetItem::setId(" << id << "," << column << ")";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
mId = id;
|
||||||
|
mColumn = column;
|
||||||
|
if (mId == "")
|
||||||
|
{
|
||||||
|
setText(mColumn, "No Signature");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
loadId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GxsIdRSTreeWidgetItem::getId(RsGxsId &id)
|
||||||
|
{
|
||||||
|
id = mId;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define MAX_ATTEMPTS 5
|
||||||
|
|
||||||
|
void GxsIdRSTreeWidgetItem::loadId()
|
||||||
|
{
|
||||||
|
std::cerr << " GxsIdRSTreeWidgetItem::loadId() Id: " << mId << ", mCount: " << mCount;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
mCount++;
|
||||||
|
|
||||||
|
/* try and get details - if not there ... set callback */
|
||||||
|
QString desc;
|
||||||
|
bool loaded = MakeIdDesc(mId, desc);
|
||||||
|
|
||||||
|
setText(mColumn, desc);
|
||||||
|
|
||||||
|
if (loaded)
|
||||||
|
{
|
||||||
|
std::cerr << " GxsIdRSTreeWidgetItem::loadId() Loaded Okay";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mCount < MAX_ATTEMPTS)
|
||||||
|
{
|
||||||
|
std::cerr << " GxsIdRSTreeWidgetItem::loadId() Starting Timer for re-try";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
/* timer event to try again */
|
||||||
|
mTimer->setInterval(mCount * 1000);
|
||||||
|
mTimer->start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Constructor */
|
||||||
|
GxsIdTreeWidgetItem::GxsIdTreeWidgetItem(QTreeWidget *parent)
|
||||||
|
:QTreeWidgetItem(parent), QObject(NULL), mTimer(NULL), mCount(0), mColumn(0)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GxsIdTreeWidgetItem::GxsIdTreeWidgetItem(QTreeWidgetItem *parent)
|
||||||
|
:QTreeWidgetItem(parent), QObject(NULL), mTimer(NULL), mCount(0), mColumn(0)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
void GxsIdTreeWidgetItem::init()
|
void GxsIdTreeWidgetItem::init()
|
||||||
{
|
{
|
||||||
mTimer = new QTimer(this);
|
mTimer = new QTimer(this);
|
||||||
|
@ -68,47 +195,6 @@ bool GxsIdTreeWidgetItem::getId(RsGxsId &id)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool MakeIdDesc(const RsGxsId &id, QString &str)
|
|
||||||
{
|
|
||||||
RsIdentityDetails details;
|
|
||||||
|
|
||||||
if (!rsIdentity->getIdDetails(id, details))
|
|
||||||
{
|
|
||||||
str = "Loading... " + QString::fromStdString(id.substr(0,5));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
str = QString::fromUtf8(details.mNickname.c_str());
|
|
||||||
|
|
||||||
bool addCode = true;
|
|
||||||
if (details.mPgpLinked)
|
|
||||||
{
|
|
||||||
str += " (PGP) [";
|
|
||||||
if (details.mPgpKnown)
|
|
||||||
{
|
|
||||||
/* look up real name */
|
|
||||||
std::string authorName = rsPeers->getPeerName(details.mPgpId);
|
|
||||||
str += QString::fromUtf8(authorName.c_str());
|
|
||||||
str += "]";
|
|
||||||
|
|
||||||
addCode = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
str += " (Anon) [";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (addCode)
|
|
||||||
{
|
|
||||||
str += QString::fromStdString(id.substr(0,5));
|
|
||||||
str += "...]";
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define MAX_ATTEMPTS 5
|
|
||||||
|
|
||||||
void GxsIdTreeWidgetItem::loadId()
|
void GxsIdTreeWidgetItem::loadId()
|
||||||
{
|
{
|
||||||
|
@ -125,11 +211,16 @@ void GxsIdTreeWidgetItem::loadId()
|
||||||
|
|
||||||
if (loaded)
|
if (loaded)
|
||||||
{
|
{
|
||||||
|
std::cerr << " GxsIdTreeWidgetItem::loadId() Loaded Okay";
|
||||||
|
std::cerr << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mCount < MAX_ATTEMPTS)
|
if (mCount < MAX_ATTEMPTS)
|
||||||
{
|
{
|
||||||
|
std::cerr << " GxsIdTreeWidgetItem::loadId() Starting Timer for re-try";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
/* timer event to try again */
|
/* timer event to try again */
|
||||||
mTimer->setInterval(mCount * 1000);
|
mTimer->setInterval(mCount * 1000);
|
||||||
mTimer->start();
|
mTimer->start();
|
||||||
|
|
|
@ -28,13 +28,50 @@
|
||||||
|
|
||||||
#include "gui/common/RSTreeWidgetItem.h"
|
#include "gui/common/RSTreeWidgetItem.h"
|
||||||
|
|
||||||
class GxsIdTreeWidgetItem : public QObject, public RSTreeWidgetItem
|
/*****
|
||||||
|
* NOTE: I have investigated why the Timer doesn't work in GxsForums.
|
||||||
|
* It appears that the Timer events occur in the Thread they were created in.
|
||||||
|
* GxsForums uses a short term thread to fill the ForumThread - this finishes,
|
||||||
|
* and so the Timer Events don't happen.
|
||||||
|
*
|
||||||
|
* The Timer events work fine in Wiki and Comments Dialog.
|
||||||
|
* because they don't use an additional thread.
|
||||||
|
*
|
||||||
|
***/
|
||||||
|
|
||||||
|
|
||||||
|
class GxsIdRSTreeWidgetItem : public QObject, public RSTreeWidgetItem
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GxsIdTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, QTreeWidget *parent = NULL);
|
GxsIdRSTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, QTreeWidget *parent = NULL);
|
||||||
GxsIdTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, QTreeWidgetItem *parent);
|
GxsIdRSTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, QTreeWidgetItem *parent);
|
||||||
|
|
||||||
|
void setId(const RsGxsId &id, int column);
|
||||||
|
bool getId(RsGxsId &id);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void loadId();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void init();
|
||||||
|
|
||||||
|
QTimer *mTimer;
|
||||||
|
RsGxsId mId;
|
||||||
|
int mCount;
|
||||||
|
int mColumn;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class GxsIdTreeWidgetItem : public QObject, public QTreeWidgetItem
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
GxsIdTreeWidgetItem(QTreeWidget *parent = NULL);
|
||||||
|
GxsIdTreeWidgetItem(QTreeWidgetItem *parent);
|
||||||
|
|
||||||
void setId(const RsGxsId &id, int column);
|
void setId(const RsGxsId &id, int column);
|
||||||
bool getId(RsGxsId &id);
|
bool getId(RsGxsId &id);
|
||||||
|
|
|
@ -31,12 +31,16 @@
|
||||||
#include "CreateGxsChannelMsg.h"
|
#include "CreateGxsChannelMsg.h"
|
||||||
#include "gui/feeds/SubFileItem.h"
|
#include "gui/feeds/SubFileItem.h"
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
|
#include "util/TokenQueue.h"
|
||||||
|
|
||||||
#include <retroshare/rsgxschannels.h>
|
#include <retroshare/rsgxschannels.h>
|
||||||
#include <retroshare/rsfiles.h>
|
#include <retroshare/rsfiles.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#define CREATEMSG_CHANNELINFO 0x002
|
||||||
|
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
CreateGxsChannelMsg::CreateGxsChannelMsg(std::string cId)
|
CreateGxsChannelMsg::CreateGxsChannelMsg(std::string cId)
|
||||||
: QDialog (NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint), mChannelId(cId) ,mCheckAttachment(true), mAutoMediaThumbNail(false)
|
: QDialog (NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint), mChannelId(cId) ,mCheckAttachment(true), mAutoMediaThumbNail(false)
|
||||||
|
@ -44,6 +48,8 @@ CreateGxsChannelMsg::CreateGxsChannelMsg(std::string cId)
|
||||||
/* Invoke the Qt Designer generated object setup routine */
|
/* Invoke the Qt Designer generated object setup routine */
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
|
mChannelQueue = new TokenQueue(rsGxsChannels->getTokenService(), this);
|
||||||
|
|
||||||
headerFrame->setHeaderImage(QPixmap(":/images/channels.png"));
|
headerFrame->setHeaderImage(QPixmap(":/images/channels.png"));
|
||||||
headerFrame->setHeaderText(tr("New GxsChannel Post"));
|
headerFrame->setHeaderText(tr("New GxsChannel Post"));
|
||||||
|
|
||||||
|
@ -371,9 +377,9 @@ void CreateGxsChannelMsg::addExtraFile()
|
||||||
|
|
||||||
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)) {
|
||||||
for (QStringList::iterator fileIt = files.begin(); fileIt != files.end(); fileIt++) {
|
for (QStringList::iterator fileIt = files.begin(); fileIt != files.end(); fileIt++) {
|
||||||
addAttachment((*fileIt).toUtf8().constData());
|
addAttachment((*fileIt).toUtf8().constData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,24 +403,23 @@ void CreateGxsChannelMsg::addAttachment(const std::string &path)
|
||||||
|
|
||||||
if((*it)->FilePath() == path){
|
if((*it)->FilePath() == path){
|
||||||
QMessageBox::warning(this, tr("RetroShare"),
|
QMessageBox::warning(this, tr("RetroShare"),
|
||||||
tr("File already Added and Hashed"),
|
tr("File already Added and Hashed"),
|
||||||
QMessageBox::Ok, QMessageBox::Ok);
|
QMessageBox::Ok, QMessageBox::Ok);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// channels creates copy of file into channels directory and shares this
|
|
||||||
|
|
||||||
FileInfo fInfo;
|
FileInfo fInfo;
|
||||||
#if 0
|
std::string filename;
|
||||||
rsGxsChannels->channelExtraFileHash(path, mChannelId, fInfo);
|
uint64_t size = 0;
|
||||||
#endif
|
std::string hash = "";
|
||||||
|
rsGxsChannels->ExtraFileHash(path, filename);
|
||||||
|
|
||||||
// file is not innitial
|
// only path and filename are valid.
|
||||||
SubFileItem *file = new SubFileItem(fInfo.hash, fInfo.fname, fInfo.path, fInfo.size,
|
// destroyed when fileFrame (this subfileitem) is destroyed
|
||||||
flags, mChannelId); // destroyed when fileFrame (this subfileitem) is destroyed
|
SubFileItem *file = new SubFileItem(hash, filename, path, size, flags, mChannelId);
|
||||||
|
|
||||||
mAttachments.push_back(file);
|
mAttachments.push_back(file);
|
||||||
QLayout *layout = fileFrame->layout();
|
QLayout *layout = fileFrame->layout();
|
||||||
|
@ -525,10 +530,8 @@ void CreateGxsChannelMsg::cancelMsg()
|
||||||
|
|
||||||
std::list<SubFileItem* >::const_iterator it;
|
std::list<SubFileItem* >::const_iterator it;
|
||||||
|
|
||||||
#if 0
|
|
||||||
for(it = mAttachments.begin(); it != mAttachments.end(); it++)
|
for(it = mAttachments.begin(); it != mAttachments.end(); it++)
|
||||||
rsGxsChannels->channelExtraFileRemove((*it)->FileHash(), mChannelId);
|
rsGxsChannels->ExtraFileRemove((*it)->FileHash());
|
||||||
#endif
|
|
||||||
|
|
||||||
close();
|
close();
|
||||||
return;
|
return;
|
||||||
|
@ -539,31 +542,45 @@ void CreateGxsChannelMsg::newChannelMsg()
|
||||||
if (!rsGxsChannels)
|
if (!rsGxsChannels)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if 0
|
mChannelMetaLoaded = false;
|
||||||
GxsChannelInfo ci;
|
|
||||||
if (!rsGxsChannels->getGxsChannelInfo(mChannelId, ci))
|
/* request Data */
|
||||||
{
|
{
|
||||||
|
RsTokReqOptions opts;
|
||||||
|
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
|
||||||
|
|
||||||
return;
|
std::list<std::string> groupIds;
|
||||||
|
groupIds.push_back(mChannelId);
|
||||||
|
|
||||||
|
std::cerr << "CreateGxsChannelMsg::newChannelMsg() Req Group Summary(" << mChannelId << ")";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
uint32_t token;
|
||||||
|
mChannelQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, groupIds, CREATEMSG_CHANNELINFO);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
channelName->setText(QString::fromStdWString(ci.channelName));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
void CreateGxsChannelMsg::saveChannelInfo(const RsGroupMetaData &meta)
|
||||||
|
{
|
||||||
|
mChannelMeta = meta;
|
||||||
|
mChannelMetaLoaded = true;
|
||||||
|
|
||||||
|
channelName->setText(QString::fromUtf8(mChannelMeta.mGroupName.c_str()));
|
||||||
subjectEdit->setFocus();
|
subjectEdit->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CreateGxsChannelMsg::sendMsg()
|
void CreateGxsChannelMsg::sendMsg()
|
||||||
{
|
{
|
||||||
std::cerr << "CreateGxsChannelMsg::sendMsg()";
|
std::cerr << "CreateGxsChannelMsg::sendMsg()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
/* construct message bits */
|
/* construct message bits */
|
||||||
std::wstring subject = misc::removeNewLine(subjectEdit->text()).toStdWString();
|
std::string subject = std::string(misc::removeNewLine(subjectEdit->text()).toUtf8());
|
||||||
std::wstring msg = msgEdit->toPlainText().toStdWString();
|
std::string msg = std::string(msgEdit->toPlainText().toUtf8());
|
||||||
|
|
||||||
std::list<FileInfo> files;
|
std::list<RsGxsFile> files;
|
||||||
|
|
||||||
std::list<SubFileItem *>::iterator fit;
|
std::list<SubFileItem *>::iterator fit;
|
||||||
|
|
||||||
|
@ -571,10 +588,10 @@ void CreateGxsChannelMsg::sendMsg()
|
||||||
{
|
{
|
||||||
if (!(*fit)->isHidden())
|
if (!(*fit)->isHidden())
|
||||||
{
|
{
|
||||||
FileInfo fi;
|
RsGxsFile fi;
|
||||||
fi.hash = (*fit)->FileHash();
|
fi.mHash = (*fit)->FileHash();
|
||||||
fi.fname = (*fit)->FileName();
|
fi.mName = (*fit)->FileName();
|
||||||
fi.size = (*fit)->FileSize();
|
fi.mSize = (*fit)->FileSize();
|
||||||
|
|
||||||
files.push_back(fi);
|
files.push_back(fi);
|
||||||
|
|
||||||
|
@ -595,50 +612,49 @@ void CreateGxsChannelMsg::sendMsg()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateGxsChannelMsg::sendMessage(std::wstring subject, std::wstring msg, std::list<FileInfo> &files)
|
void CreateGxsChannelMsg::sendMessage(const std::string &subject, const std::string &msg, const std::list<RsGxsFile> &files)
|
||||||
{
|
{
|
||||||
QString name = misc::removeNewLine(subjectEdit->text());
|
if(subject.empty())
|
||||||
|
|
||||||
if(name.isEmpty())
|
|
||||||
{ /* error message */
|
{ /* error message */
|
||||||
QMessageBox::warning(this, tr("RetroShare"),
|
QMessageBox::warning(this, tr("RetroShare"),
|
||||||
tr("Please add a Subject"),
|
tr("Please add a Subject"),
|
||||||
QMessageBox::Ok, QMessageBox::Ok);
|
QMessageBox::Ok, QMessageBox::Ok);
|
||||||
|
|
||||||
return; //Don't add an empty Subject!!
|
return; //Don't add an empty Subject!!
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* rsGxsChannels */
|
/* rsGxsChannels */
|
||||||
if (rsGxsChannels)
|
if (rsGxsChannels)
|
||||||
{
|
{
|
||||||
#if 0
|
RsGxsChannelPost post;
|
||||||
GxsChannelMsgInfo msgInfo;
|
|
||||||
|
|
||||||
msgInfo.channelId = mChannelId;
|
post.mMeta.mGroupId = mChannelId;
|
||||||
msgInfo.msgId = "";
|
post.mMeta.mParentId = "";
|
||||||
|
post.mMeta.mThreadId = "";
|
||||||
|
post.mMeta.mMsgId = "";
|
||||||
|
|
||||||
msgInfo.subject = subject;
|
post.mMeta.mMsgName = subject;
|
||||||
msgInfo.msg = msg;
|
post.mMsg = msg;
|
||||||
msgInfo.files = files;
|
post.mFiles = files;
|
||||||
|
|
||||||
QByteArray ba;
|
QByteArray ba;
|
||||||
QBuffer buffer(&ba);
|
QBuffer buffer(&ba);
|
||||||
|
|
||||||
if(!picture.isNull()){
|
if(!picture.isNull())
|
||||||
|
{
|
||||||
// send chan image
|
// send chan image
|
||||||
|
|
||||||
buffer.open(QIODevice::WriteOnly);
|
buffer.open(QIODevice::WriteOnly);
|
||||||
picture.save(&buffer, "PNG"); // writes image into ba in PNG format
|
picture.save(&buffer, "PNG"); // writes image into ba in PNG format
|
||||||
msgInfo.thumbnail.image_thumbnail = (unsigned char*) ba.data();
|
post.mThumbnail.copy((uint8_t *) ba.data(), ba.size());
|
||||||
msgInfo.thumbnail.im_thumbnail_size = ba.size();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rsGxsChannels->GxsChannelMessageSend(msgInfo);
|
uint32_t token;
|
||||||
#endif
|
rsGxsChannels->createPost(token, post);
|
||||||
}
|
}
|
||||||
|
|
||||||
close();
|
close();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -654,3 +670,52 @@ void CreateGxsChannelMsg::addThumbnail()
|
||||||
// to show the selected
|
// to show the selected
|
||||||
thumbnail_label->setPixmap(picture);
|
thumbnail_label->setPixmap(picture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void CreateGxsChannelMsg::loadChannelInfo(const uint32_t &token)
|
||||||
|
{
|
||||||
|
std::cerr << "CreateGxsChannelMsg::loadChannelInfo()";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
std::list<RsGroupMetaData> groupInfo;
|
||||||
|
rsGxsChannels->getGroupSummary(token, groupInfo);
|
||||||
|
|
||||||
|
if (groupInfo.size() == 1)
|
||||||
|
{
|
||||||
|
RsGroupMetaData fi = groupInfo.front();
|
||||||
|
saveChannelInfo(fi);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "CreateGxsChannelMsg::loadForumInfo() ERROR INVALID Number of Forums";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CreateGxsChannelMsg::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||||
|
{
|
||||||
|
std::cerr << "CreateGxsChannelMsg::loadRequest() UserType: " << req.mUserType;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
if (queue == mChannelQueue)
|
||||||
|
{
|
||||||
|
/* now switch on req */
|
||||||
|
switch(req.mUserType)
|
||||||
|
{
|
||||||
|
case CREATEMSG_CHANNELINFO:
|
||||||
|
loadChannelInfo(req.mToken);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
std::cerr << "CreateGxsChannelMsg::loadRequest() UNKNOWN UserType ";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,15 +24,17 @@
|
||||||
|
|
||||||
#include "ui_CreateGxsChannelMsg.h"
|
#include "ui_CreateGxsChannelMsg.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include "util/TokenQueue.h"
|
||||||
|
#include <retroshare/rsgxschannels.h>
|
||||||
|
|
||||||
#ifdef CHANNELS_FRAME_CATCHER
|
#ifdef CHANNELS_FRAME_CATCHER
|
||||||
#include "util/framecatcher.h"
|
#include "util/framecatcher.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class SubFileItem;
|
class SubFileItem;
|
||||||
class FileInfo;
|
class RsGxsFile;
|
||||||
|
|
||||||
class CreateGxsChannelMsg : public QDialog, private Ui::CreateGxsChannelMsg
|
class CreateGxsChannelMsg : public QDialog, public TokenResponse, private Ui::CreateGxsChannelMsg
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -51,6 +53,10 @@ public:
|
||||||
|
|
||||||
QPixmap picture;
|
QPixmap picture;
|
||||||
|
|
||||||
|
// overload from TokenResponse
|
||||||
|
virtual void loadRequest(const TokenQueue*, const TokenRequest&);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void dragEnterEvent(QDragEnterEvent *event);
|
virtual void dragEnterEvent(QDragEnterEvent *event);
|
||||||
virtual void dropEvent(QDropEvent *event);
|
virtual void dropEvent(QDropEvent *event);
|
||||||
|
@ -69,17 +75,23 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void parseRsFileListAttachments(const std::string &attachList);
|
void loadChannelInfo(const uint32_t &token);
|
||||||
void sendMessage(std::wstring subject, std::wstring msg, std::list<FileInfo> &files);
|
void saveChannelInfo(const RsGroupMetaData &group);
|
||||||
bool setThumbNail(const std::string& path, int frame);
|
|
||||||
|
|
||||||
|
void parseRsFileListAttachments(const std::string &attachList);
|
||||||
|
void sendMessage(const std::string &subject, const std::string &msg, const std::list<RsGxsFile> &files);
|
||||||
|
bool setThumbNail(const std::string& path, int frame);
|
||||||
|
|
||||||
std::string mChannelId;
|
std::string mChannelId;
|
||||||
|
RsGroupMetaData mChannelMeta;
|
||||||
|
bool mChannelMetaLoaded;
|
||||||
|
|
||||||
std::list<SubFileItem *> mAttachments;
|
std::list<SubFileItem *> mAttachments;
|
||||||
|
|
||||||
bool mCheckAttachment;
|
bool mCheckAttachment;
|
||||||
bool mAutoMediaThumbNail;
|
bool mAutoMediaThumbNail;
|
||||||
|
|
||||||
|
TokenQueue *mChannelQueue;
|
||||||
|
|
||||||
#ifdef CHANNELS_FRAME_CATCHER
|
#ifdef CHANNELS_FRAME_CATCHER
|
||||||
framecatcher* fCatcher;
|
framecatcher* fCatcher;
|
||||||
|
|
|
@ -1077,6 +1077,13 @@ void GxsChannelDialog::insertChannelPosts(const std::vector<RsGxsChannelPost> &p
|
||||||
// can we add that into the request?
|
// can we add that into the request?
|
||||||
//msgs.sort(sortChannelMsgSummary);
|
//msgs.sort(sortChannelMsgSummary);
|
||||||
|
|
||||||
|
/* replace all the messages with new ones */
|
||||||
|
QList<GxsChannelPostItem *>::iterator mit;
|
||||||
|
for (mit = mChannelPostItems.begin(); mit != mChannelPostItems.end(); mit++) {
|
||||||
|
delete (*mit);
|
||||||
|
}
|
||||||
|
mChannelPostItems.clear();
|
||||||
|
|
||||||
uint32_t subscribeFlags = 0xffffffff;
|
uint32_t subscribeFlags = 0xffffffff;
|
||||||
|
|
||||||
for (it = posts.begin(); it != posts.end(); it++)
|
for (it = posts.begin(); it != posts.end(); it++)
|
||||||
|
|
|
@ -791,7 +791,7 @@ void GxsForumThreadWidget::forceUpdateDisplay()
|
||||||
|
|
||||||
QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForumMsg &msg, bool useChildTS, uint32_t filterColumn)
|
QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForumMsg &msg, bool useChildTS, uint32_t filterColumn)
|
||||||
{
|
{
|
||||||
GxsIdTreeWidgetItem *item = new GxsIdTreeWidgetItem(mThreadCompareRole);
|
GxsIdRSTreeWidgetItem *item = new GxsIdRSTreeWidgetItem(mThreadCompareRole);
|
||||||
QString text;
|
QString text;
|
||||||
|
|
||||||
item->setText(COLUMN_THREAD_TITLE, QString::fromUtf8(msg.mMeta.mMsgName.c_str()));
|
item->setText(COLUMN_THREAD_TITLE, QString::fromUtf8(msg.mMeta.mMsgName.c_str()));
|
||||||
|
@ -871,7 +871,7 @@ QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForum
|
||||||
|
|
||||||
QTreeWidgetItem *GxsForumThreadWidget::generateMissingItem(const std::string &msgId)
|
QTreeWidgetItem *GxsForumThreadWidget::generateMissingItem(const std::string &msgId)
|
||||||
{
|
{
|
||||||
GxsIdTreeWidgetItem *item = new GxsIdTreeWidgetItem(mThreadCompareRole);
|
GxsIdRSTreeWidgetItem *item = new GxsIdRSTreeWidgetItem(mThreadCompareRole);
|
||||||
item->setText(COLUMN_THREAD_TITLE, tr("[ ... Missing Message ... ]"));
|
item->setText(COLUMN_THREAD_TITLE, tr("[ ... Missing Message ... ]"));
|
||||||
item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID, QString::fromStdString(msgId));
|
item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID, QString::fromStdString(msgId));
|
||||||
item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_MISSING, true);
|
item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_MISSING, true);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue