Posted Links:

- cleaned source code
- added auto refresh
Updated english translation

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6506 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2013-07-15 18:39:39 +00:00
parent 11d2701edc
commit 4edcec6fe9
16 changed files with 406 additions and 596 deletions

View File

@ -24,50 +24,54 @@
#include <QMessageBox> #include <QMessageBox>
#include "PostedCreatePostDialog.h" #include "PostedCreatePostDialog.h"
#include "ui_PostedCreatePostDialog.h" #include "ui_PostedCreatePostDialog.h"
#include "PostedUserTypes.h"
#include "util/TokenQueue.h"
#include <iostream> #include <iostream>
PostedCreatePostDialog::PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted *posted, const RsGxsGroupId& grpId, QWidget *parent): PostedCreatePostDialog::PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted *posted, const RsGxsGroupId& grpId, QWidget *parent):
QDialog(parent), mTokenQueue(tokenQ), mPosted(posted), mGrpId(grpId), QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint),
ui(new Ui::PostedCreatePostDialog) mTokenQueue(tokenQ), mPosted(posted), mGrpId(grpId),
ui(new Ui::PostedCreatePostDialog)
{ {
ui->setupUi(this); ui->setupUi(this);
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(createPost()));
/* fill in the available OwnIds for signing */ connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(createPost()));
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, ""); connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(close()));
} /* fill in the available OwnIds for signing */
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, "");
void PostedCreatePostDialog::createPost()
{
RsGxsId authorId;
if (!ui->idChooser->getChosenId(authorId))
{
std::cerr << "PostedCreatePostDialog::createPost() ERROR GETTING AuthorId!, Post Failed";
std::cerr << std::endl;
QMessageBox::warning(this, tr("RetroShare"),tr("Please create or choose a Signing Id first"),
QMessageBox::Ok, QMessageBox::Ok);
return;
}
RsPostedPost post;
post.mMeta.mGroupId = mGrpId;
post.mLink = std::string(ui->linkEdit->text().toUtf8());
post.mNotes = std::string(ui->notesTextEdit->toPlainText().toUtf8());
post.mMeta.mMsgName = std::string(ui->titleEdit->text().toUtf8());
post.mMeta.mAuthorId = authorId;
uint32_t token;
mPosted->createPost(token, post);
mTokenQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, TOKEN_USER_TYPE_POST);
accept();
} }
PostedCreatePostDialog::~PostedCreatePostDialog() PostedCreatePostDialog::~PostedCreatePostDialog()
{ {
delete ui; delete ui;
}
void PostedCreatePostDialog::createPost()
{
RsGxsId authorId;
if (!ui->idChooser->getChosenId(authorId))
{
std::cerr << "PostedCreatePostDialog::createPost() ERROR GETTING AuthorId!, Post Failed";
std::cerr << std::endl;
QMessageBox::warning(this, tr("RetroShare"),tr("Please create or choose a Signing Id first"), QMessageBox::Ok, QMessageBox::Ok);
return;
}
RsPostedPost post;
post.mMeta.mGroupId = mGrpId;
post.mLink = std::string(ui->linkEdit->text().toUtf8());
post.mNotes = std::string(ui->notesTextEdit->toPlainText().toUtf8());
post.mMeta.mMsgName = std::string(ui->titleEdit->text().toUtf8());
post.mMeta.mAuthorId = authorId;
uint32_t token;
mPosted->createPost(token, post);
mTokenQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, TOKEN_USER_TYPE_POST);
accept();
} }

View File

@ -26,12 +26,11 @@
#include <QDialog> #include <QDialog>
#include "retroshare/rsposted.h" #include "retroshare/rsposted.h"
#include "PostedUserTypes.h"
#include "util/TokenQueue.h" class TokenQueue;
namespace Ui { namespace Ui {
class PostedCreatePostDialog; class PostedCreatePostDialog;
} }
class PostedCreatePostDialog : public QDialog class PostedCreatePostDialog : public QDialog
@ -39,26 +38,24 @@ class PostedCreatePostDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
/*!
/*! * @param tokenQ parent callee token
* @param tokenQ parent callee token * @param posted
* @param posted */
*/ explicit PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted* posted, const RsGxsGroupId& grpId, QWidget *parent = 0);
explicit PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted* posted, const RsGxsGroupId& grpId, QWidget *parent = 0); ~PostedCreatePostDialog();
~PostedCreatePostDialog();
private slots: private slots:
void createPost();
void createPost();
private: private:
Ui::PostedCreatePostDialog *ui; QString mLink;
QString mNotes;
TokenQueue* mTokenQueue;
RsPosted* mPosted;
RsGxsGroupId mGrpId;
QString mLink; Ui::PostedCreatePostDialog *ui;
QString mNotes;
RsPosted* mPosted;
RsGxsGroupId mGrpId;
TokenQueue* mTokenQueue;
}; };
#endif // POSTEDCREATEPOSTDIALOG_H #endif // POSTEDCREATEPOSTDIALOG_H

View File

@ -15,9 +15,12 @@
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QGridLayout" name="gridLayout">
<item> <item row="0" column="1">
<widget class="QLabel" name="label_3"> <widget class="QLineEdit" name="titleEdit"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="titleLabel">
<property name="text"> <property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>&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;
@ -27,15 +30,8 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="1" column="0">
<widget class="QLineEdit" name="titleEdit"/> <widget class="QLabel" name="linkLabel">
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>&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;
@ -45,7 +41,7 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="1" column="1">
<widget class="QLineEdit" name="linkEdit"/> <widget class="QLineEdit" name="linkEdit"/>
</item> </item>
</layout> </layout>
@ -81,9 +77,9 @@ p, li { white-space: pre-wrap; }
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="notesLayout">
<item> <item>
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="notesLabel">
<property name="text"> <property name="text">
<string>Notes</string> <string>Notes</string>
</property> </property>
@ -113,9 +109,7 @@ p, li { white-space: pre-wrap; }
<header>gui/gxs/GxsIdChooser.h</header> <header>gui/gxs/GxsIdChooser.h</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources> <resources/>
<include location="../images.qrc"/>
</resources>
<connections> <connections>
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>

View File

@ -28,10 +28,11 @@
#include "gui/gxs/GxsCommentContainer.h" #include "gui/gxs/GxsCommentContainer.h"
#include "gui/Posted/PostedListDialog.h" #include "gui/Posted/PostedListDialog.h"
#include "gui/Posted/PostedItem.h"
class PostedDialog : public GxsCommentContainer class PostedDialog : public GxsCommentContainer
{ {
Q_OBJECT Q_OBJECT
public: public:
PostedDialog(QWidget *parent = 0) PostedDialog(QWidget *parent = 0)
@ -44,7 +45,7 @@ public:
virtual QString getServiceName() virtual QString getServiceName()
{ {
return tr("Posted"); return tr("Posted Links");
} }
virtual RsTokenService *getTokenService() virtual RsTokenService *getTokenService()
@ -57,12 +58,15 @@ public:
return rsPosted; return rsPosted;
} }
virtual QWidget *createHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId) virtual QWidget *createHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId)
{ {
return new PostedItem(NULL, 0, grpId, msgId, true); return new PostedItem(NULL, 0, grpId, msgId, true);
} }
virtual QPixmap getServicePixmap()
{
return QPixmap(":/images/posted_24.png");
}
}; };
#endif #endif

View File

@ -52,19 +52,14 @@ uint32_t PostedCreateDefaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC |
GXS_GROUP_DEFAULTS_COMMENTS_NO | GXS_GROUP_DEFAULTS_COMMENTS_NO |
0); 0);
PostedGroupDialog::PostedGroupDialog(TokenQueue *tokenQueue, QWidget *parent) PostedGroupDialog::PostedGroupDialog(TokenQueue *tokenQueue, QWidget *parent)
:GxsGroupDialog(tokenQueue, PostedCreateEnabledFlags, PostedCreateDefaultsFlags, parent) :GxsGroupDialog(tokenQueue, PostedCreateEnabledFlags, PostedCreateDefaultsFlags, parent)
{ {
} }
PostedGroupDialog::PostedGroupDialog(const RsPostedGroup &group, QWidget *parent) PostedGroupDialog::PostedGroupDialog(const RsPostedGroup &group, QWidget *parent)
:GxsGroupDialog(group.mMeta, MODE_SHOW, parent) :GxsGroupDialog(group.mMeta, MODE_SHOW, parent)
{ {
} }
void PostedGroupDialog::initUi() void PostedGroupDialog::initUi()
@ -96,7 +91,7 @@ bool PostedGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaDa
// Specific Function. // Specific Function.
RsPostedGroup grp; RsPostedGroup grp;
grp.mMeta = meta; grp.mMeta = meta;
grp.mDescription = getDescription().toStdString(); grp.mDescription = getDescription().toStdString();
std::cerr << "PostedGroupDialog::service_CreateGroup() storing to Queue"; std::cerr << "PostedGroupDialog::service_CreateGroup() storing to Queue";
std::cerr << std::endl; std::cerr << std::endl;

View File

@ -21,7 +21,6 @@
* *
*/ */
#ifndef _POSTED_GROUP_DIALOG_H #ifndef _POSTED_GROUP_DIALOG_H
#define _POSTED_GROUP_DIALOG_H #define _POSTED_GROUP_DIALOG_H
@ -42,10 +41,7 @@ protected:
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta); virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
private: private:
RsPostedGroup mTopic;
RsPostedGroup mTopic;
}; };
#endif #endif

View File

@ -21,21 +21,15 @@
* *
*/ */
#include <QDateTime> #include <QDateTime>
#include <QMessageBox>
#include <QMouseEvent>
#include <QBuffer>
#include <time.h>
#include "PostedItem.h" #include "PostedItem.h"
#include "gui/feeds/FeedHolder.h"
#include <retroshare/rsposted.h> #include <retroshare/rsposted.h>
#include <algorithm>
#include <iostream> #include <iostream>
/** Constructor */ /** Constructor */
PostedItem::PostedItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome) PostedItem::PostedItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome)
@ -53,48 +47,41 @@ PostedItem::PostedItem(FeedHolder *parent, uint32_t feedId, const RsPostedPost &
setContent(mPost); setContent(mPost);
} }
void PostedItem::setup() void PostedItem::setup()
{ {
setupUi(this); setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true ); setAttribute(Qt::WA_DeleteOnClose, true);
connect( commentButton, SIGNAL( clicked() ), this, SLOT( loadComments() ) ); connect(commentButton, SIGNAL( clicked()), this, SLOT(loadComments()));
connect( voteUpButton, SIGNAL(clicked()), this, SLOT(makeUpVote())); connect(voteUpButton, SIGNAL(clicked()), this, SLOT(makeUpVote()));
connect( voteDownButton, SIGNAL(clicked()), this, SLOT( makeDownVote())); connect(voteDownButton, SIGNAL(clicked()), this, SLOT( makeDownVote()));
return;
} }
void PostedItem::loadMessage(const uint32_t &token) void PostedItem::loadMessage(const uint32_t &token)
{ {
std::vector<RsPostedPost> posts; std::vector<RsPostedPost> posts;
if (!rsPosted->getPostData(token, posts)) if (!rsPosted->getPostData(token, posts))
{ {
std::cerr << "GxsChannelPostItem::loadMessage() ERROR getting data"; std::cerr << "GxsChannelPostItem::loadMessage() ERROR getting data";
std::cerr << std::endl; std::cerr << std::endl;
return; return;
} }
if (posts.size() != 1) if (posts.size() != 1)
{ {
std::cerr << "GxsChannelPostItem::loadMessage() Wrong number of Items"; std::cerr << "GxsChannelPostItem::loadMessage() Wrong number of Items";
std::cerr << std::endl; std::cerr << std::endl;
return; return;
} }
mPost = posts[0]; mPost = posts[0];
setContent(mPost); setContent(mPost);
return;
} }
void PostedItem::setContent(const RsPostedPost &post) void PostedItem::setContent(const RsPostedPost &post)
{ {
mPost = post; mPost = post;
QDateTime qtime; QDateTime qtime;
qtime.setTime_t(mPost.mMeta.mPublishTs); qtime.setTime_t(mPost.mMeta.mPublishTs);
QString timestamp = qtime.toString("dd.MMMM yyyy hh:mm"); QString timestamp = qtime.toString("dd.MMMM yyyy hh:mm");
@ -169,10 +156,14 @@ void PostedItem::setContent(const RsPostedPost &post)
+ QString::number(nComments) + "</span></p>"); + QString::number(nComments) + "</span></p>");
} }
#endif #endif
} }
RsPostedPost PostedItem::getPost() const const RsPostedPost &PostedItem::getPost() const
{
return mPost;
}
RsPostedPost &PostedItem::post()
{ {
return mPost; return mPost;
} }
@ -185,6 +176,7 @@ void PostedItem::makeDownVote()
voteUpButton->setEnabled(false); voteUpButton->setEnabled(false);
voteDownButton->setEnabled(false); voteDownButton->setEnabled(false);
emit vote(msgId, false); emit vote(msgId, false);
} }
@ -210,6 +202,3 @@ void PostedItem::loadComments()
mParent->openComments(0, mPost.mMeta.mGroupId, mPost.mMeta.mMsgId, title); mParent->openComments(0, mPost.mMeta.mGroupId, mPost.mMeta.mMsgId, title);
} }
} }

View File

@ -27,31 +27,29 @@
#include "ui_PostedItem.h" #include "ui_PostedItem.h"
#include <retroshare/rsposted.h> #include <retroshare/rsposted.h>
#include "gui/feeds/FeedHolder.h"
#include "gui/gxs/GxsFeedItem.h" #include "gui/gxs/GxsFeedItem.h"
class RsPostedPost;
class PostedItem : public GxsFeedItem, private Ui::PostedItem class PostedItem : public GxsFeedItem, private Ui::PostedItem
{ {
Q_OBJECT Q_OBJECT
public: public:
PostedItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome); PostedItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome);
PostedItem(FeedHolder *parent, uint32_t feedId, const RsPostedPost &post, bool isHome); PostedItem(FeedHolder *parent, uint32_t feedId, const RsPostedPost &post, bool isHome);
RsPostedPost getPost() const; const RsPostedPost &getPost() const;
void setContent(const RsPostedPost& post); RsPostedPost &post();
void setContent(const RsPostedPost& post);
// Make this public so we can sort based on it.
RsPostedPost mPost;
private slots: private slots:
void loadComments(); void loadComments();
void makeUpVote(); void makeUpVote();
void makeDownVote(); void makeDownVote();
signals: signals:
void vote(const RsGxsGrpMsgIdPair& msgId, bool up); void vote(const RsGxsGrpMsgIdPair& msgId, bool up);
protected: protected:
virtual void loadMessage(const uint32_t &token); virtual void loadMessage(const uint32_t &token);
@ -59,12 +57,9 @@ protected:
private: private:
void setup(); void setup();
uint32_t mType; uint32_t mType;
bool mSelected; bool mSelected;
RsPostedPost mPost;
}; };
#endif #endif

View File

@ -23,54 +23,37 @@
#include "PostedListDialog.h" #include "PostedListDialog.h"
#include "gui/Posted/PostedGroupDialog.h" #include "PostedGroupDialog.h"
#include "gui/Posted/PostedCreatePostDialog.h" #include "PostedCreatePostDialog.h"
#include "gui/Posted/PostedDialog.h" #include "PostedDialog.h"
#include "PostedItem.h"
#include <retroshare/rsposted.h> #include "PostedUserTypes.h"
#include <retroshare/rsgxsflags.h>
#include <iostream> #include <iostream>
#include <sstream>
#include <algorithm>
#include <QTimer>
#include <QMenu> #include <QMenu>
#include <QMessageBox> #include <QMessageBox>
/**************************************************************** /****************************************************************
*/ */
//#define DEBUG_FORUMS
/* Images for context menu icons */ /* Images for context menu icons */
#define IMAGE_MESSAGE ":/images/folder-draft.png" #define IMAGE_MESSAGE ":/images/folder-draft.png"
#define IMAGE_MESSAGEREPLY ":/images/mail_reply.png"
#define IMAGE_MESSAGEREMOVE ":/images/mail_delete.png"
#define IMAGE_DOWNLOAD ":/images/start.png"
#define IMAGE_DOWNLOADALL ":/images/startall.png"
/* Images for TreeWidget */ /* Images for TreeWidget */
#define IMAGE_FOLDER ":/images/folder16.png" #define IMAGE_FOLDER ":/images/folder16.png"
#define IMAGE_FOLDERGREEN ":/images/folder_green.png" #define IMAGE_FOLDERGREEN ":/images/folder_green.png"
#define IMAGE_FOLDERRED ":/images/folder_red.png" #define IMAGE_FOLDERRED ":/images/folder_red.png"
#define IMAGE_FOLDERYELLOW ":/images/folder_yellow.png" #define IMAGE_FOLDERYELLOW ":/images/folder_yellow.png"
#define IMAGE_FORUM ":/images/konversation16.png"
#define IMAGE_SUBSCRIBE ":/images/edit_add24.png"
#define IMAGE_UNSUBSCRIBE ":/images/cancel.png"
#define IMAGE_INFO ":/images/info16.png"
#define IMAGE_NEWFORUM ":/images/new_forum16.png"
#define IMAGE_FORUMAUTHD ":/images/konv_message2.png"
#define IMAGE_COPYLINK ":/images/copyrslink.png"
// token types to deal with // token types to deal with
#define POSTED_DEFAULT_LISTING_LENGTH 10 #define POSTED_DEFAULT_LISTING_LENGTH 10
#define POSTED_MAX_INDEX 10000 #define POSTED_MAX_INDEX 10000
/** Constructor */ /** Constructor */
PostedListDialog::PostedListDialog(QWidget *parent) PostedListDialog::PostedListDialog(QWidget *parent)
: RsAutoUpdatePage(1000,parent), GxsServiceDialog(dynamic_cast<GxsCommentContainer *>(parent)) : RsGxsUpdateBroadcastPage(rsPosted, parent), GxsServiceDialog(dynamic_cast<GxsCommentContainer *>(parent))
{ {
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this); ui.setupUi(this);
@ -78,9 +61,8 @@ PostedListDialog::PostedListDialog(QWidget *parent)
/* Setup Queue */ /* Setup Queue */
mPostedQueue = new TokenQueue(rsPosted->getTokenService(), this); mPostedQueue = new TokenQueue(rsPosted->getTokenService(), this);
connect( ui.groupTreeWidget, SIGNAL( treeCustomContextMenuRequested( QPoint ) ), this, SLOT( groupListCustomPopupMenu( QPoint ) ) ); connect( ui.groupTreeWidget, SIGNAL(treeCustomContextMenuRequested(QPoint)), this, SLOT(groupListCustomPopupMenu(QPoint)));
connect( ui.groupTreeWidget, SIGNAL(treeCurrentItemChanged(QString)), this, SLOT(changedTopic(QString)));
connect( ui.groupTreeWidget, SIGNAL( treeCurrentItemChanged(QString) ), this, SLOT( changedTopic(QString) ) );
connect(ui.hotSortButton, SIGNAL(clicked()), this, SLOT(getRankings())); connect(ui.hotSortButton, SIGNAL(clicked()), this, SLOT(getRankings()));
connect(ui.newSortButton, SIGNAL(clicked()), this, SLOT(getRankings())); connect(ui.newSortButton, SIGNAL(clicked()), this, SLOT(getRankings()));
@ -102,14 +84,10 @@ PostedListDialog::PostedListDialog(QWidget *parent)
ui.hotSortButton->setChecked(true); ui.hotSortButton->setChecked(true);
connect( ui.newTopicButton, SIGNAL( clicked() ), this, SLOT( newTopic() ) ); connect(ui.newTopicButton, SIGNAL(clicked()), this, SLOT(newTopic()));
connect(ui.refreshButton, SIGNAL(clicked()), this, SLOT(refreshTopics()));
connect(ui.submitPostButton, SIGNAL(clicked()), this, SLOT(newPost())); connect(ui.submitPostButton, SIGNAL(clicked()), this, SLOT(newPost()));
refreshTopics();
} }
void PostedListDialog::showNext() void PostedListDialog::showNext()
{ {
mPostIndex += mPostShow; mPostIndex += mPostShow;
@ -119,7 +97,6 @@ void PostedListDialog::showNext()
updateShowText(); updateShowText();
} }
void PostedListDialog::showPrev() void PostedListDialog::showPrev()
{ {
mPostIndex -= mPostShow; mPostIndex -= mPostShow;
@ -129,7 +106,6 @@ void PostedListDialog::showPrev()
updateShowText(); updateShowText();
} }
void PostedListDialog::updateShowText() void PostedListDialog::updateShowText()
{ {
QString showText = tr("Showing"); QString showText = tr("Showing");
@ -140,8 +116,6 @@ void PostedListDialog::updateShowText()
ui.showLabel->setText(showText); ui.showLabel->setText(showText);
} }
void PostedListDialog::getRankings() void PostedListDialog::getRankings()
{ {
if(mCurrTopicId.empty()) if(mCurrTopicId.empty())
@ -180,25 +154,7 @@ void PostedListDialog::getRankings()
applyRanking(); applyRanking();
} }
void PostedListDialog::groupListCustomPopupMenu(QPoint /*point*/)
void PostedListDialog::refreshTopics()
{
std::cerr << "PostedListDialog::requestGroupSummary()";
std::cerr << std::endl;
RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
uint32_t token;
mPostedQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, TOKEN_USER_TYPE_TOPIC);
/* refresh Id Chooser Too */
RsGxsId currentId = "";
ui.idChooser->getChosenId(currentId);
ui.idChooser->loadIds(IDCHOOSER_ID_REQUIRED, currentId);
}
void PostedListDialog::groupListCustomPopupMenu( QPoint /*point*/ )
{ {
if (mCurrTopicId.empty()) if (mCurrTopicId.empty())
{ {
@ -238,7 +194,6 @@ void PostedListDialog::newPost()
} }
} }
void PostedListDialog::unsubscribeTopic() void PostedListDialog::unsubscribeTopic()
{ {
std::cerr << "PostedListDialog::unsubscribeTopic()"; std::cerr << "PostedListDialog::unsubscribeTopic()";
@ -249,10 +204,9 @@ void PostedListDialog::unsubscribeTopic()
uint32_t token; uint32_t token;
rsPosted->subscribeToGroup(token, mCurrTopicId, false); rsPosted->subscribeToGroup(token, mCurrTopicId, false);
mPostedQueue->queueRequest(token, 0 , RS_TOKREQ_ANSTYPE_ACK, TOKEN_USER_TYPE_SUBSCRIBE_CHANGE); mPostedQueue->queueRequest(token, 0, RS_TOKREQ_ANSTYPE_ACK, TOKEN_USER_TYPE_SUBSCRIBE_CHANGE);
} }
void PostedListDialog::subscribeTopic() void PostedListDialog::subscribeTopic()
{ {
std::cerr << "PostedListDialog::subscribeTopic()"; std::cerr << "PostedListDialog::subscribeTopic()";
@ -263,10 +217,9 @@ void PostedListDialog::subscribeTopic()
uint32_t token; uint32_t token;
rsPosted->subscribeToGroup(token, mCurrTopicId, true); rsPosted->subscribeToGroup(token, mCurrTopicId, true);
mPostedQueue->queueRequest(token, 0 , RS_TOKREQ_ANSTYPE_ACK, TOKEN_USER_TYPE_SUBSCRIBE_CHANGE); mPostedQueue->queueRequest(token, 0, RS_TOKREQ_ANSTYPE_ACK, TOKEN_USER_TYPE_SUBSCRIBE_CHANGE);
} }
void PostedListDialog::submitVote(const RsGxsGrpMsgIdPair &msgId, bool up) void PostedListDialog::submitVote(const RsGxsGrpMsgIdPair &msgId, bool up)
{ {
/* must grab AuthorId from Layout */ /* must grab AuthorId from Layout */
@ -276,8 +229,7 @@ void PostedListDialog::submitVote(const RsGxsGrpMsgIdPair &msgId, bool up)
std::cerr << "PostedListDialog::createPost() ERROR GETTING AuthorId!, Vote Failed"; std::cerr << "PostedListDialog::createPost() ERROR GETTING AuthorId!, Vote Failed";
std::cerr << std::endl; std::cerr << std::endl;
QMessageBox::warning(this, tr("RetroShare"),tr("Please create or choose a Signing Id before Voting"), QMessageBox::warning(this, tr("RetroShare"),tr("Please create or choose a Signing Id before Voting"), QMessageBox::Ok, QMessageBox::Ok);
QMessageBox::Ok, QMessageBox::Ok);
return; return;
} }
@ -311,105 +263,66 @@ void PostedListDialog::submitVote(const RsGxsGrpMsgIdPair &msgId, bool up)
mPostedQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, TOKEN_USER_TYPE_VOTE); mPostedQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, TOKEN_USER_TYPE_VOTE);
} }
/*****************************************************************************************/ /*****************************************************************************************/
// Overloaded from FeedHolder. // Overloaded from FeedHolder.
QScrollArea *PostedListDialog::getScrollArea() QScrollArea *PostedListDialog::getScrollArea()
{ {
return ui.scrollArea; return ui.scrollArea;
} }
void PostedListDialog::deleteFeedItem(QWidget *item, uint32_t type) void PostedListDialog::deleteFeedItem(QWidget */*item*/, uint32_t /*type*/)
{ {
std::cerr << "PostedListDialog::deleteFeedItem() Nah"; std::cerr << "PostedListDialog::deleteFeedItem() Nah";
std::cerr << std::endl; std::cerr << std::endl;
return; return;
} }
void PostedListDialog::openChat(std::string peerId) void PostedListDialog::openChat(std::string /*peerId*/)
{ {
std::cerr << "PostedListDialog::openChat() Nah"; std::cerr << "PostedListDialog::openChat() Nah";
std::cerr << std::endl; std::cerr << std::endl;
return; return;
} }
void PostedListDialog::openComments(uint32_t feed_type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title) void PostedListDialog::openComments(uint32_t /*feed_type*/, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title)
{ {
commentLoad(groupId, msgId, title); commentLoad(groupId, msgId, title);
} }
/*****************************************************************************************/ /*****************************************************************************************/
void PostedListDialog::updateDisplay(bool /*initialFill*/)
void PostedListDialog::updateDisplay()
{ {
if (!rsPosted) std::cerr << "rsPosted->updateDisplay()";
return; std::cerr << std::endl;
/* update List */
insertGroups();
std::list<std::string> groupIds; std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgs = getMsgIds();
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgs; if(!msgs.empty())
if (rsPosted->updated(true, true))
{ {
std::cerr << "rsPosted->updated() returned true"; std::cerr << "rsPosted->msgsChanged():";
std::cerr << std::endl; std::cerr << std::endl;
/* update Forums List */
rsPosted->groupsChanged(groupIds); std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator mit;
if(!groupIds.empty()) mit = msgs.find(mCurrTopicId);
if(mit != msgs.end())
{ {
std::cerr << "rsPosted->groupsChanged():"; std::cerr << "current Group -> updating Displayed Items";
std::cerr << std::endl; std::cerr << std::endl;
std::list<std::string>::iterator it; updateDisplayedItems(mit->second);
for(it = groupIds.begin(); it != groupIds.end(); it++)
{
std::cerr << "\t" << *it;
std::cerr << std::endl;
}
it = std::find(groupIds.begin(), groupIds.end(), mCurrTopicId);
if(it != groupIds.end())
{
std::cerr << "current Group -> requesting Group Summary";
std::cerr << std::endl;
requestGroupSummary();
return;
}
}
rsPosted->msgsChanged(msgs);
if(!msgs.empty())
{
std::cerr << "rsPosted->msgsChanged():";
std::cerr << std::endl;
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator mit;
mit = msgs.find(mCurrTopicId);
if(mit != msgs.end())
{
std::cerr << "current Group -> updating Displayed Items";
std::cerr << std::endl;
updateDisplayedItems(mit->second);
}
} }
} }
} }
void PostedListDialog::updateDisplayedItems(const std::vector<RsGxsMessageId> &msgIds) void PostedListDialog::updateDisplayedItems(const std::vector<RsGxsMessageId> &msgIds)
{ {
RsTokReqOptions opts; RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA; opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
opts.mOptions = RS_TOKREQOPT_MSG_LATEST; opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
GxsMsgReq msgs; GxsMsgReq msgs;
msgs[mCurrTopicId] = msgIds; msgs[mCurrTopicId] = msgIds;
@ -425,25 +338,21 @@ void PostedListDialog::updateDisplayedItems(const std::vector<RsGxsMessageId> &m
uint32_t token; uint32_t token;
mPostedQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgs, TOKEN_USER_TYPE_POST_MOD); mPostedQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgs, TOKEN_USER_TYPE_POST_MOD);
} }
void PostedListDialog::changedTopic(const QString &id) void PostedListDialog::changedTopic(const QString &id)
{ {
mCurrTopicId = id.toStdString(); mCurrTopicId = id.toStdString();
insertThreads(); insertThreads();
} }
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
/** New / Edit Groups ********************************/ /** New / Edit Groups ********************************/
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
void PostedListDialog::newTopic() void PostedListDialog::newTopic()
{ {
PostedGroupDialog cf (mPostedQueue, this); PostedGroupDialog cf (mPostedQueue, this);
cf.exec (); cf.exec ();
} }
@ -458,7 +367,6 @@ void PostedListDialog::showGroupDetails()
cf.exec (); cf.exec ();
} }
void PostedListDialog::insertGroups() void PostedListDialog::insertGroups()
{ {
requestGroupSummary(); requestGroupSummary();
@ -466,13 +374,18 @@ void PostedListDialog::insertGroups()
void PostedListDialog::requestGroupSummary() void PostedListDialog::requestGroupSummary()
{ {
std::cerr << "PostedListDialog::requestGroupSummary()"; std::cerr << "PostedListDialog::requestGroupSummary()";
std::cerr << std::endl; std::cerr << std::endl;
RsTokReqOptions opts; RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META; opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
uint32_t token; uint32_t token;
mPostedQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, TOKEN_USER_TYPE_TOPIC); mPostedQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, TOKEN_USER_TYPE_TOPIC);
/* refresh Id Chooser Too */
RsGxsId currentId = "";
ui.idChooser->getChosenId(currentId);
ui.idChooser->loadIds(IDCHOOSER_ID_REQUIRED, currentId);
} }
void PostedListDialog::acknowledgeGroup(const uint32_t &token) void PostedListDialog::acknowledgeGroup(const uint32_t &token)
@ -482,7 +395,6 @@ void PostedListDialog::acknowledgeGroup(const uint32_t &token)
if(!grpId.empty()) if(!grpId.empty())
{ {
RsTokReqOptions opts; RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META; opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
uint32_t reqToken; uint32_t reqToken;
@ -500,21 +412,21 @@ void PostedListDialog::acknowledgePostMsg(const uint32_t &token)
void PostedListDialog::loadGroupSummary(const uint32_t &token) void PostedListDialog::loadGroupSummary(const uint32_t &token)
{ {
std::cerr << "PostedListDialog::loadGroupSummary()"; std::cerr << "PostedListDialog::loadGroupSummary()";
std::cerr << std::endl;
std::list<RsGroupMetaData> groupInfo;
rsPosted->getGroupSummary(token, groupInfo);
if (groupInfo.size() > 0)
{
insertGroupData(groupInfo);
}
else
{
std::cerr << "PostedListDialog::loadGroupSummary() ERROR No Groups...";
std::cerr << std::endl; std::cerr << std::endl;
}
std::list<RsGroupMetaData> groupInfo;
rsPosted->getGroupSummary(token, groupInfo);
if (groupInfo.size() > 0)
{
insertGroupData(groupInfo);
}
else
{
std::cerr << "PostedListDialog::loadGroupSummary() ERROR No Groups...";
std::cerr << std::endl;
}
} }
void PostedListDialog::loadPostData(const uint32_t &token) void PostedListDialog::loadPostData(const uint32_t &token)
@ -529,7 +441,7 @@ void PostedListDialog::acknowledgeVoteMsg(const uint32_t &token)
rsPosted->acknowledgeVote(token, msgId); rsPosted->acknowledgeVote(token, msgId);
} }
void PostedListDialog::loadVoteData(const uint32_t &token) void PostedListDialog::loadVoteData(const uint32_t &/*token*/)
{ {
return; return;
} }
@ -537,17 +449,15 @@ void PostedListDialog::loadVoteData(const uint32_t &token)
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
void PostedListDialog::requestGroupSummary_CurrentForum(const std::string &forumId) void PostedListDialog::requestGroupSummary_CurrentForum(const std::string &forumId)
{ {
RsTokReqOptions opts; RsTokReqOptions opts;
std::list<std::string> grpIds; std::list<std::string> grpIds;
grpIds.push_back(forumId); grpIds.push_back(forumId);
std::cerr << "PostedListDialog::requestGroupSummary_CurrentForum(" << forumId << ")"; std::cerr << "PostedListDialog::requestGroupSummary_CurrentForum(" << forumId << ")";
std::cerr << std::endl; std::cerr << std::endl;
uint32_t token; uint32_t token;
mPostedQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, grpIds, POSTEDDIALOG_CURRENTFORUM); mPostedQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, grpIds, POSTEDDIALOG_CURRENTFORUM);
@ -555,22 +465,22 @@ void PostedListDialog::requestGroupSummary_CurrentForum(const std::string &forum
void PostedListDialog::loadGroupSummary_CurrentForum(const uint32_t &token) void PostedListDialog::loadGroupSummary_CurrentForum(const uint32_t &token)
{ {
std::cerr << "PostedListDialog::loadGroupSummary_CurrentForum()"; std::cerr << "PostedListDialog::loadGroupSummary_CurrentForum()";
std::cerr << std::endl; std::cerr << std::endl;
std::list<RsGroupMetaData> groupInfo; std::list<RsGroupMetaData> groupInfo;
rsPosted->getGroupSummary(token, groupInfo); rsPosted->getGroupSummary(token, groupInfo);
if (groupInfo.size() == 1) if (groupInfo.size() == 1)
{ {
RsGroupMetaData fi = groupInfo.front(); RsGroupMetaData fi = groupInfo.front();
//insertForumThreads(fi); //insertForumThreads(fi);
} }
else else
{ {
std::cerr << "PostedListDialog::loadGroupSummary_CurrentForum() ERROR Invalid Number of Groups..."; std::cerr << "PostedListDialog::loadGroupSummary_CurrentForum() ERROR Invalid Number of Groups...";
std::cerr << std::endl; std::cerr << std::endl;
} }
} }
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
@ -578,33 +488,29 @@ void PostedListDialog::loadGroupSummary_CurrentForum(const uint32_t &token)
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
void PostedListDialog::insertThreads() void PostedListDialog::insertThreads()
{ {
loadCurrentTopicThreads(mCurrTopicId); loadCurrentTopicThreads(mCurrTopicId);
} }
void PostedListDialog::loadCurrentTopicThreads(const std::string &topicId) void PostedListDialog::loadCurrentTopicThreads(const std::string &topicId)
{ {
std::cerr << "PostedListDialog::loadCurrentForumThreads(" << topicId << ")";
std::cerr << std::endl;
std::cerr << "PostedListDialog::loadCurrentForumThreads(" << topicId << ")"; if (topicId.empty())
std::cerr << std::endl;
if (topicId.empty())
{ {
std::cerr << "PostedListDialog::loadCurrentForumThreads() Empty GroupId .. ignoring Req"; std::cerr << "PostedListDialog::loadCurrentForumThreads() Empty GroupId .. ignoring Req";
std::cerr << std::endl; std::cerr << std::endl;
return; return;
} }
clearPosts(); clearPosts();
/* initiate loading */ /* initiate loading */
requestGroupThreadData_InsertThreads(topicId); requestGroupThreadData_InsertThreads(topicId);
} }
void PostedListDialog::requestGroupThreadData_InsertThreads(const std::string &groupId) void PostedListDialog::requestGroupThreadData_InsertThreads(const std::string &groupId)
{ {
RsTokReqOptions opts; RsTokReqOptions opts;
@ -622,7 +528,6 @@ void PostedListDialog::requestGroupThreadData_InsertThreads(const std::string &g
mPostedQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, TOKEN_USER_TYPE_POST); mPostedQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, TOKEN_USER_TYPE_POST);
} }
void PostedListDialog::loadGroupThreadData_InsertThreads(const uint32_t &token) void PostedListDialog::loadGroupThreadData_InsertThreads(const uint32_t &token)
{ {
std::cerr << "PostedListDialog::loadGroupThreadData_InsertThreads()"; std::cerr << "PostedListDialog::loadGroupThreadData_InsertThreads()";
@ -641,7 +546,6 @@ void PostedListDialog::loadGroupThreadData_InsertThreads(const uint32_t &token)
} }
applyRanking(); applyRanking();
} }
void PostedListDialog::loadPost(const RsPostedPost &post) void PostedListDialog::loadPost(const RsPostedPost &post)
@ -654,33 +558,37 @@ void PostedListDialog::loadPost(const RsPostedPost &post)
mPostList.push_back(item); mPostList.push_back(item);
} }
bool CmpPIHot(const PostedItem *a, const PostedItem *b) bool CmpPIHot(const PostedItem *a, const PostedItem *b)
{ {
if (a->mPost.mHotScore == b->mPost.mHotScore) const RsPostedPost &postA = a->getPost();
const RsPostedPost &postB = b->getPost();
if (postA.mHotScore == postB.mHotScore)
{ {
(a->mPost.mNewScore > b->mPost.mNewScore); return (postA.mNewScore > postB.mNewScore);
} }
return (a->mPost.mHotScore > b->mPost.mHotScore); return (postA.mHotScore > postB.mHotScore);
} }
bool CmpPITop(const PostedItem *a, const PostedItem *b) bool CmpPITop(const PostedItem *a, const PostedItem *b)
{ {
if (a->mPost.mTopScore == b->mPost.mTopScore) const RsPostedPost &postA = a->getPost();
const RsPostedPost &postB = b->getPost();
if (postA.mTopScore == postB.mTopScore)
{ {
(a->mPost.mNewScore > b->mPost.mNewScore); return (postA.mNewScore > postB.mNewScore);
} }
return (a->mPost.mTopScore > b->mPost.mTopScore); return (postA.mTopScore > postB.mTopScore);
} }
bool CmpPINew(const PostedItem *a, const PostedItem *b) bool CmpPINew(const PostedItem *a, const PostedItem *b)
{ {
return (a->mPost.mNewScore > b->mPost.mNewScore); return (a->getPost().mNewScore > b->getPost().mNewScore);
} }
void PostedListDialog::applyRanking() void PostedListDialog::applyRanking()
{ {
/* uses current settings to sort posts, then add to layout */ /* uses current settings to sort posts, then add to layout */
@ -725,7 +633,7 @@ void PostedListDialog::applyRanking()
std::cerr << "PostedListDialog::applyRanking() Item: " << item; std::cerr << "PostedListDialog::applyRanking() Item: " << item;
std::cerr << std::endl; std::cerr << std::endl;
if (item->mPost.mMeta.mPublishTs < min_ts) if (item->getPost().mMeta.mPublishTs < min_ts)
{ {
std::cerr << "\t Skipping OLD"; std::cerr << "\t Skipping OLD";
std::cerr << std::endl; std::cerr << std::endl;
@ -733,7 +641,6 @@ void PostedListDialog::applyRanking()
continue; continue;
} }
if (counter >= mPostIndex + mPostShow) if (counter >= mPostIndex + mPostShow)
{ {
std::cerr << "\t END - Counter too high"; std::cerr << "\t END - Counter too high";
@ -745,8 +652,8 @@ void PostedListDialog::applyRanking()
std::cerr << "\t Adding to Layout"; std::cerr << "\t Adding to Layout";
std::cerr << std::endl; std::cerr << std::endl;
/* add it in! */ /* add it in! */
item->show();
alayout->addWidget(item); alayout->addWidget(item);
item->show();
} }
else else
{ {
@ -764,7 +671,6 @@ void PostedListDialog::applyRanking()
ui.scrollAreaWidgetContents->update(); ui.scrollAreaWidgetContents->update();
} }
void PostedListDialog::clearPosts() void PostedListDialog::clearPosts()
{ {
std::cerr << "PostedListDialog::clearPosts()" << std::endl; std::cerr << "PostedListDialog::clearPosts()" << std::endl;
@ -776,34 +682,34 @@ void PostedListDialog::clearPosts()
int count = alayout->count(); int count = alayout->count();
for(int i = 0; i < count; i++) for(int i = 0; i < count; i++)
{ {
QLayoutItem *litem = alayout->itemAt(i); QLayoutItem *litem = alayout->itemAt(i);
if (!litem) if (!litem)
{ {
std::cerr << "PostedListDialog::clearPosts() missing litem"; std::cerr << "PostedListDialog::clearPosts() missing litem";
std::cerr << std::endl; std::cerr << std::endl;
continue; continue;
} }
PostedItem *item = dynamic_cast<PostedItem *>(litem->widget()); PostedItem *item = dynamic_cast<PostedItem *>(litem->widget());
if (item) if (item)
{ {
std::cerr << "PostedListDialog::clearPosts() item: " << item; std::cerr << "PostedListDialog::clearPosts() item: " << item;
std::cerr << std::endl; std::cerr << std::endl;
postedItems.push_back(item); postedItems.push_back(item);
} }
else else
{ {
std::cerr << "PostedListDialog::clearPosts() Found Child, which is not a PostedItem???"; std::cerr << "PostedListDialog::clearPosts() Found Child, which is not a PostedItem???";
std::cerr << std::endl; std::cerr << std::endl;
} }
} }
for(pit = postedItems.begin(); pit != postedItems.end(); pit++) for(pit = postedItems.begin(); pit != postedItems.end(); pit++)
{ {
PostedItem *item = *pit; PostedItem *item = *pit;
alayout->removeWidget(item); alayout->removeWidget(item);
delete item; delete item;
} }
mPosts.clear(); mPosts.clear();
@ -821,35 +727,34 @@ void PostedListDialog::shallowClearPosts()
int count = alayout->count(); int count = alayout->count();
for(int i = 0; i < count; i++) for(int i = 0; i < count; i++)
{ {
QLayoutItem *litem = alayout->itemAt(i); QLayoutItem *litem = alayout->itemAt(i);
if (!litem) if (!litem)
{ {
std::cerr << "PostedListDialog::shallowClearPosts() missing litem"; std::cerr << "PostedListDialog::shallowClearPosts() missing litem";
std::cerr << std::endl; std::cerr << std::endl;
continue; continue;
} }
PostedItem *item = dynamic_cast<PostedItem *>(litem->widget()); PostedItem *item = dynamic_cast<PostedItem *>(litem->widget());
if (item) if (item)
{ {
std::cerr << "PostedListDialog::shallowClearPosts() item: " << item; std::cerr << "PostedListDialog::shallowClearPosts() item: " << item;
std::cerr << std::endl; std::cerr << std::endl;
postedItems.push_back(item); postedItems.push_back(item);
} }
else else
{ {
std::cerr << "PostedListDialog::shallowClearPosts() Found Child, which is not a PostedItem???"; std::cerr << "PostedListDialog::shallowClearPosts() Found Child, which is not a PostedItem???";
std::cerr << std::endl; std::cerr << std::endl;
} }
} }
for(pit = postedItems.begin(); pit != postedItems.end(); pit++) for(pit = postedItems.begin(); pit != postedItems.end(); pit++)
{ {
PostedItem *item = *pit; PostedItem *item = *pit;
alayout->removeWidget(item); alayout->removeWidget(item);
} }
} }
void PostedListDialog::updateCurrentDisplayComplete(const uint32_t &token) void PostedListDialog::updateCurrentDisplayComplete(const uint32_t &token)
@ -863,7 +768,6 @@ void PostedListDialog::updateCurrentDisplayComplete(const uint32_t &token)
std::vector<RsPostedPost>::iterator vit; std::vector<RsPostedPost>::iterator vit;
for(vit = posts.begin(); vit != posts.end(); vit++) for(vit = posts.begin(); vit != posts.end(); vit++)
{ {
RsPostedPost& p = *vit; RsPostedPost& p = *vit;
// modify post content // modify post content
@ -887,13 +791,12 @@ void PostedListDialog::updateCurrentDisplayComplete(const uint32_t &token)
QMap<RsGxsMessageId, PostedItem*>::iterator pit; QMap<RsGxsMessageId, PostedItem*>::iterator pit;
for(pit = mPosts.begin(); pit != mPosts.end(); pit++) for(pit = mPosts.begin(); pit != mPosts.end(); pit++)
{ {
(*pit)->mPost.calculateScores(now); (*pit)->post().calculateScores(now);
} }
applyRanking(); applyRanking();
} }
void PostedListDialog::acknowledgeSubscribeChange(const uint32_t &token) void PostedListDialog::acknowledgeSubscribeChange(const uint32_t &token)
{ {
std::cerr << "PostedListDialog::acknowledgeSubscribeChange()"; std::cerr << "PostedListDialog::acknowledgeSubscribeChange()";
@ -903,7 +806,7 @@ void PostedListDialog::acknowledgeSubscribeChange(const uint32_t &token)
RsGxsGroupId groupId; RsGxsGroupId groupId;
rsPosted->acknowledgeGrp(token, groupId); rsPosted->acknowledgeGrp(token, groupId);
refreshTopics(); insertGroups();
} }
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
@ -917,10 +820,9 @@ void PostedListDialog::loadRequest(const TokenQueue *queue, const TokenRequest &
if (queue == mPostedQueue) if (queue == mPostedQueue)
{ {
/* now switch on req */ /* now switch on req */
switch(req.mUserType) switch(req.mUserType)
{ {
case TOKEN_USER_TYPE_TOPIC: case TOKEN_USER_TYPE_TOPIC:
switch(req.mAnsType) switch(req.mAnsType)
{ {
@ -988,28 +890,25 @@ void PostedListDialog::loadRequest(const TokenQueue *queue, const TokenRequest &
} }
} }
/* now switch on req */ /* now switch on req */
switch(req.mType) switch(req.mType)
{ {
case TOKENREQ_GROUPINFO: case TOKENREQ_GROUPINFO:
switch(req.mAnsType) switch(req.mAnsType)
{ {
case RS_TOKREQ_ANSTYPE_ACK: case RS_TOKREQ_ANSTYPE_ACK:
acknowledgeGroup(req.mToken); acknowledgeGroup(req.mToken);
break; break;
} }
break; break;
} }
} }
/**************************************************************************************/ /**************************************************************************************/
/**************************************************************************************/ /**************************************************************************************/
/**************************************************************************************/ /**************************************************************************************/
/**************************** Groups **********************/ /**************************** Groups **********************/
void PostedListDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo) void PostedListDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo)
{ {
groupItemInfo.id = QString::fromStdString(groupInfo.mGroupId); groupItemInfo.id = QString::fromStdString(groupInfo.mGroupId);
@ -1017,14 +916,11 @@ void PostedListDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo
//groupItemInfo.description = QString::fromUtf8(groupInfo.forumDesc); //groupItemInfo.description = QString::fromUtf8(groupInfo.forumDesc);
groupItemInfo.popularity = groupInfo.mPop; groupItemInfo.popularity = groupInfo.mPop;
groupItemInfo.lastpost = QDateTime::fromTime_t(groupInfo.mLastPost); groupItemInfo.lastpost = QDateTime::fromTime_t(groupInfo.mLastPost);
groupItemInfo.subscribeFlags = groupInfo.mSubscribeFlags; groupItemInfo.subscribeFlags = groupInfo.mSubscribeFlags;
} }
void PostedListDialog::insertGroupData(const std::list<RsGroupMetaData> &groupList) void PostedListDialog::insertGroupData(const std::list<RsGroupMetaData> &groupList)
{ {
std::list<RsGroupMetaData>::const_iterator it; std::list<RsGroupMetaData>::const_iterator it;
QList<GroupItemInfo> adminList; QList<GroupItemInfo> adminList;
@ -1070,15 +966,15 @@ void PostedListDialog::insertGroupData(const std::list<RsGroupMetaData> &groupLi
std::multimap<uint32_t, GroupItemInfo>::reverse_iterator rit; std::multimap<uint32_t, GroupItemInfo>::reverse_iterator rit;
for(rit = popMap.rbegin(); ((rit != popMap.rend()) && (i < popCount)); rit++, i++) ; for(rit = popMap.rbegin(); ((rit != popMap.rend()) && (i < popCount)); rit++, i++) ;
if (rit != popMap.rend()) { if (rit != popMap.rend()) {
popLimit = rit->first; popLimit = rit->first;
} }
for (rit = popMap.rbegin(); rit != popMap.rend(); rit++) { for (rit = popMap.rbegin(); rit != popMap.rend(); rit++) {
if (rit->second.popularity < (int) popLimit) { if (rit->second.popularity < (int) popLimit) {
otherList.append(rit->second); otherList.append(rit->second);
} else { } else {
popList.append(rit->second); popList.append(rit->second);
} }
} }
/* now we can add them in as a tree! */ /* now we can add them in as a tree! */
@ -1091,5 +987,3 @@ void PostedListDialog::insertGroupData(const std::list<RsGroupMetaData> &groupLi
/**************************************************************************************/ /**************************************************************************************/
/**************************************************************************************/ /**************************************************************************************/
/**************************************************************************************/ /**************************************************************************************/

View File

@ -24,41 +24,36 @@
#ifndef MRK_POSTED_LIST_DIALOG_H #ifndef MRK_POSTED_LIST_DIALOG_H
#define MRK_POSTED_LIST_DIALOG_H #define MRK_POSTED_LIST_DIALOG_H
#include "retroshare-gui/mainpage.h" #include "retroshare-gui/mainpage.h"
#include "ui_PostedListDialog.h" #include "ui_PostedListDialog.h"
#include <retroshare/rsposted.h> #include <retroshare/rsposted.h>
#include <map>
#include "gui/Posted/PostedItem.h"
#include "gui/common/GroupTreeWidget.h"
#include "util/TokenQueue.h" #include "util/TokenQueue.h"
#include "retroshare-gui/RsAutoUpdatePage.h" #include "gui/gxs/RsGxsUpdateBroadcastPage.h"
#include "PostedUserTypes.h"
#include "gui/gxs/GxsCommentContainer.h" #include "gui/gxs/GxsCommentContainer.h"
#include "gui/feeds/FeedHolder.h"
class PostedItem;
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
/** Request / Response of Data ********************************/ /** Request / Response of Data ********************************/
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
#define POSTEDDIALOG_LISTING 1 #define POSTEDDIALOG_LISTING 1
#define POSTEDDIALOG_CURRENTFORUM 2 #define POSTEDDIALOG_CURRENTFORUM 2
#define POSTEDDIALOG_INSERTTHREADS 3 #define POSTEDDIALOG_INSERTTHREADS 3
#define POSTEDDIALOG_INSERTCHILD 4 #define POSTEDDIALOG_INSERTCHILD 4
#define POSTEDDIALOG_INSERT_POST 5 #define POSTEDDIALOG_INSERT_POST 5
#define POSTEDDIALOG_REPLY_MESSAGE 6 #define POSTEDDIALOG_REPLY_MESSAGE 6
class PostedListDialog : public RsAutoUpdatePage, public FeedHolder, public TokenResponse, public GxsServiceDialog class PostedListDialog : public RsGxsUpdateBroadcastPage, public FeedHolder, public TokenResponse, public GxsServiceDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
PostedListDialog(QWidget *parent = 0); PostedListDialog(QWidget *parent = 0);
// Overloaded from FeedHolder. // Overloaded from FeedHolder.
virtual QScrollArea *getScrollArea(); virtual QScrollArea *getScrollArea();
@ -67,109 +62,99 @@ public:
virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title); virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title);
private slots: private slots:
void groupListCustomPopupMenu(QPoint point);
void changedTopic(const QString &id);
void groupListCustomPopupMenu( QPoint /*point*/ ); void newTopic();
void changedTopic(const QString &id); void showGroupDetails();
void newPost();
void newTopic(); void submitVote(const RsGxsGrpMsgIdPair& msgId, bool up);
void showGroupDetails();
void newPost();
void refreshTopics();
void submitVote(const RsGxsGrpMsgIdPair& msgId, bool up); void getRankings();
void getRankings(); void subscribeTopic();
void unsubscribeTopic();
void subscribeTopic(); void showNext();
void unsubscribeTopic(); void showPrev();
protected:
void showNext(); virtual void updateDisplay(bool initialFill);
void showPrev();
private: private:
void updateShowText();
void updateShowText(); void clearPosts();
void clearPosts(); /*!
* Only removes it from layout
*/
void shallowClearPosts();
/*! void loadPost(const RsPostedPost &post);
* Only removes it from layout
*/
void shallowClearPosts();
void updateDisplay(); void insertGroups();
void loadPost(const RsPostedPost &post); void requestGroupSummary();
void acknowledgeGroup(const uint32_t &token);
void loadGroupSummary(const uint32_t &token);
void insertGroups(); void requestGroupSummary_CurrentForum(const std::string &forumId);
void requestGroupSummary(); void loadGroupSummary_CurrentForum(const uint32_t &token);
void acknowledgeGroup(const uint32_t &token);
void loadGroupSummary(const uint32_t &token);
void requestGroupSummary_CurrentForum(const std::string &forumId); // subscribe/unsubscribe ack.
void loadGroupSummary_CurrentForum(const uint32_t &token); void acknowledgeSubscribeChange(const uint32_t &token);
// posts
void acknowledgePostMsg(const uint32_t &token);
void loadPostData(const uint32_t &token);
void insertThreads();
void loadCurrentTopicThreads(const std::string &forumId);
void requestGroupThreadData_InsertThreads(const std::string &forumId);
void loadGroupThreadData_InsertThreads(const uint32_t &token);
// subscribe/unsubscribe ack. // votes
void acknowledgeSubscribeChange(const uint32_t &token); void acknowledgeVoteMsg(const uint32_t& token);
void loadVoteData(const uint32_t &token);
// posts // ranking
void acknowledgePostMsg(const uint32_t &token); //void loadRankings(const uint32_t& token);
void loadPostData(const uint32_t &token); //void applyRanking(const PostedRanking& ranks);
void insertThreads(); void applyRanking();
void loadCurrentTopicThreads(const std::string &forumId);
void requestGroupThreadData_InsertThreads(const std::string &forumId);
void loadGroupThreadData_InsertThreads(const uint32_t &token);
// votes // update displayed item
void updateDisplayedItems(const std::vector<RsGxsMessageId>& msgIds);
void updateCurrentDisplayComplete(const uint32_t& token);
void acknowledgeVoteMsg(const uint32_t& token); void insertGroupData(const std::list<RsGroupMetaData> &groupList);
void loadVoteData(const uint32_t &token); void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo);
// ranking void loadRequest(const TokenQueue *queue, const TokenRequest &req);
//void loadRankings(const uint32_t& token);
//void applyRanking(const PostedRanking& ranks);
void applyRanking();
// update displayed item
void updateDisplayedItems(const std::vector<RsGxsMessageId>& msgIds);
void updateCurrentDisplayComplete(const uint32_t& token);
void insertGroupData(const std::list<RsGroupMetaData> &groupList);
void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo);
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
private: private:
QTreeWidgetItem *yourTopics;
QTreeWidgetItem *subscribedTopics;
QTreeWidgetItem *popularTopics;
QTreeWidgetItem *otherTopics;
QTreeWidgetItem *yourTopics; int mSortMethod;
QTreeWidgetItem *subscribedTopics; int mLastSortMethod;
QTreeWidgetItem *popularTopics; int mPostIndex;
QTreeWidgetItem *otherTopics; int mPostShow;
int mSortMethod; bool mThreadLoading;
int mLastSortMethod; RsGxsGroupId mCurrTopicId;
int mPostIndex;
int mPostShow;
bool mThreadLoading; QMap<RsGxsGroupId, RsPostedGroup> mGroups;
RsGxsGroupId mCurrTopicId; QMap<RsGxsMessageId, PostedItem*> mPosts;
std::list<PostedItem *> mPostList;
QMap<RsGxsGroupId, RsPostedGroup> mGroups; TokenQueue *mPostedQueue;
QMap<RsGxsMessageId, PostedItem*> mPosts;
std::list<PostedItem *> mPostList;
//CommentHolder* mCommentHolder;
TokenQueue *mPostedQueue; /* UI - from Designer */
Ui::PostedListDialog ui;
//CommentHolder* mCommentHolder;
/* UI - from Designer */
Ui::PostedListDialog ui;
}; };
#endif #endif

View File

@ -73,13 +73,6 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QPushButton" name="refreshButton">
<property name="text">
<string>Refresh</string>
</property>
</widget>
</item>
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
@ -224,7 +217,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>443</width> <width>443</width>
<height>162</height> <height>166</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">

View File

@ -25,18 +25,11 @@
#include "gui/gxs/GxsCommentDialog.h" #include "gui/gxs/GxsCommentDialog.h"
#include <iostream> #include <iostream>
#include <sstream>
#include <QTimer>
#include <QMessageBox>
/******
* #define PHOTO_DEBUG 1
*****/
#define MAX_COMMENT_TITLE 32
/**************************************************************** /****************************************************************
* Posted Dialog * GxsCommentContainer
* *
*/ */
@ -45,24 +38,22 @@ GxsCommentContainer::GxsCommentContainer(QWidget *parent)
{ {
ui.setupUi(this); ui.setupUi(this);
connect(ui.tabWidget, SIGNAL(tabCloseRequested( int )), this, SLOT(tabCloseRequested( int ))); connect(ui.tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(tabCloseRequested(int)));
} }
void GxsCommentContainer::setup() void GxsCommentContainer::setup()
{ {
mServiceDialog = createServiceDialog(); mServiceDialog = createServiceDialog();
QString name = getServiceName(); QString name = getServiceName();
ui.titleBarLabel->setText(name);
ui.titleBarPixmap->setPixmap(getServicePixmap());
QString list(name);
QWidget *widget = dynamic_cast<QWidget *>(mServiceDialog); QWidget *widget = dynamic_cast<QWidget *>(mServiceDialog);
ui.tabWidget->addTab(widget, name); int index = ui.tabWidget->addTab(widget, name);
ui.tabWidget->hideCloseButton(index);
} }
#define MAX_COMMENT_TITLE 32
void GxsCommentContainer::commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId, const QString &title) void GxsCommentContainer::commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId, const QString &title)
{ {
QString comments = title; QString comments = title;
@ -72,7 +63,7 @@ void GxsCommentContainer::commentLoad(const RsGxsGroupId &grpId, const RsGxsMess
comments += "..."; comments += "...";
} }
GxsCommentDialog *commentDialog = new GxsCommentDialog(this, getTokenService(), getCommentService()); GxsCommentDialog *commentDialog = new GxsCommentDialog(this, getTokenService(), getCommentService());
QWidget *commentHeader = createHeaderWidget(grpId, msgId); QWidget *commentHeader = createHeaderWidget(grpId, msgId);
commentDialog->setCommentHeader(commentHeader); commentDialog->setCommentHeader(commentHeader);
@ -82,12 +73,11 @@ void GxsCommentContainer::commentLoad(const RsGxsGroupId &grpId, const RsGxsMess
ui.tabWidget->addTab(commentDialog, comments); ui.tabWidget->addTab(commentDialog, comments);
} }
void GxsCommentContainer::tabCloseRequested(int index) void GxsCommentContainer::tabCloseRequested(int index)
{ {
std::cerr << "GxsCommentContainer::tabCloseRequested(" << index << ")"; std::cerr << "GxsCommentContainer::tabCloseRequested(" << index << ")";
std::cerr << std::endl; std::cerr << std::endl;
if (index != 0) if (index != 0)
{ {
QWidget *comments = ui.tabWidget->widget(index); QWidget *comments = ui.tabWidget->widget(index);
@ -100,21 +90,3 @@ void GxsCommentContainer::tabCloseRequested(int index)
std::cerr << std::endl; std::cerr << std::endl;
} }
} }

View File

@ -30,59 +30,50 @@
#include <retroshare/rsgxscommon.h> #include <retroshare/rsgxscommon.h>
#include <retroshare/rstokenservice.h> #include <retroshare/rstokenservice.h>
#include <map>
class GxsServiceDialog; class GxsServiceDialog;
class GxsCommentContainer : public MainPage class GxsCommentContainer : public MainPage
{ {
Q_OBJECT Q_OBJECT
public: public:
GxsCommentContainer(QWidget *parent = 0); GxsCommentContainer(QWidget *parent = 0);
void setup(); void setup();
void commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId, const QString &title); void commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId, const QString &title);
virtual GxsServiceDialog *createServiceDialog() = 0; virtual GxsServiceDialog *createServiceDialog() = 0;
virtual QString getServiceName() = 0; virtual QString getServiceName() = 0;
virtual RsTokenService *getTokenService() = 0; virtual RsTokenService *getTokenService() = 0;
virtual RsGxsCommentService *getCommentService() = 0; virtual RsGxsCommentService *getCommentService() = 0;
virtual QWidget *createHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId) = 0; virtual QWidget *createHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId) = 0;
virtual QPixmap getServicePixmap() = 0;
private slots: private slots:
void tabCloseRequested(int index); void tabCloseRequested(int index);
private: private:
GxsServiceDialog *mServiceDialog; GxsServiceDialog *mServiceDialog;
/* UI - from Designer */ /* UI - from Designer */
Ui::GxsCommentContainer ui; Ui::GxsCommentContainer ui;
}; };
class GxsServiceDialog class GxsServiceDialog
{ {
public: public:
GxsServiceDialog(GxsCommentContainer *container) GxsServiceDialog(GxsCommentContainer *container)
:mContainer(container) { return; } :mContainer(container) { return; }
virtual ~GxsServiceDialog() { return; } virtual ~GxsServiceDialog() { return; }
void commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId, const QString &title) void commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId, const QString &title)
{ {
mContainer->commentLoad(grpId, msgId, title); mContainer->commentLoad(grpId, msgId, title);
} }
private: private:
GxsCommentContainer *mContainer; GxsCommentContainer *mContainer;
}; };
#endif #endif

View File

@ -17,33 +17,30 @@
<item> <item>
<widget class="QFrame" name="titleBarFrame"> <widget class="QFrame" name="titleBarFrame">
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::Box</enum>
</property> </property>
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Raised</enum> <enum>QFrame::Sunken</enum>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin"> <property name="margin">
<number>2</number> <number>2</number>
</property> </property>
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="titleBarPixmap">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>24</width> <width>24</width>
<height>24</height> <height>24</height>
</size> </size>
</property> </property>
<property name="text">
<string/>
</property>
<property name="pixmap"> <property name="pixmap">
<pixmap>:/images/posted_24.png</pixmap> <pixmap>:/images/posted_24.png</pixmap>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="titleBarLabel">
<property name="font"> <property name="font">
<font> <font>
<pointsize>10</pointsize> <pointsize>10</pointsize>
@ -73,7 +70,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTabWidget" name="tabWidget"> <widget class="RSTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>-1</number> <number>-1</number>
</property> </property>
@ -84,8 +81,14 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<resources> <customwidgets>
<include location="Posted_images.qrc"/> <customwidget>
</resources> <class>RSTabWidget</class>
<extends>QTabWidget</extends>
<header>gui/common/RSTabWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/> <connections/>
</ui> </ui>

View File

@ -24,23 +24,21 @@
#ifndef MRK_CHANNEL_DIALOG_H #ifndef MRK_CHANNEL_DIALOG_H
#define MRK_CHANNEL_DIALOG_H #define MRK_CHANNEL_DIALOG_H
#include <retroshare/rsgxschannels.h> #include <retroshare/rsgxschannels.h>
#include "gui/gxs/GxsCommentContainer.h" #include "gui/gxs/GxsCommentContainer.h"
#include "gui/gxschannels/GxsChannelDialog.h" #include "gui/gxschannels/GxsChannelDialog.h"
#include "gui/feeds/GxsChannelPostItem.h" #include "gui/feeds/GxsChannelPostItem.h"
class ChannelDialog : public GxsCommentContainer class ChannelDialog : public GxsCommentContainer
{ {
//Q_OBJECT Q_OBJECT
public: public:
ChannelDialog(QWidget *parent = 0) ChannelDialog(QWidget *parent = 0)
:GxsCommentContainer(parent) { return; } :GxsCommentContainer(parent) { return; }
virtual GxsServiceDialog *createServiceDialog() virtual GxsServiceDialog *createServiceDialog()
{ {
return new GxsChannelDialog(this); return new GxsChannelDialog(this);
} }
@ -50,21 +48,25 @@ public:
return tr("GxsChannels"); return tr("GxsChannels");
} }
virtual RsTokenService *getTokenService() virtual RsTokenService *getTokenService()
{ {
return rsGxsChannels->getTokenService(); return rsGxsChannels->getTokenService();
} }
virtual RsGxsCommentService *getCommentService() virtual RsGxsCommentService *getCommentService()
{ {
return rsGxsChannels; return rsGxsChannels;
} }
virtual QWidget *createHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId) virtual QWidget *createHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId)
{ {
return new GxsChannelPostItem(NULL, 0, grpId, msgId, true); return new GxsChannelPostItem(NULL, 0, grpId, msgId, true);
} }
virtual QPixmap getServicePixmap()
{
return QPixmap(":/images/channels24.png");
}
}; };
#endif #endif

View File

@ -9962,7 +9962,7 @@ p, li { white-space: pre-wrap; }
<context> <context>
<name>PostedDialog</name> <name>PostedDialog</name>
<message> <message>
<source>Posted</source> <source>Posted Links</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
@ -10050,10 +10050,6 @@ p, li { white-space: pre-wrap; }
<source>Top</source> <source>Top</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Refresh</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Today</source> <source>Today</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>