mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-07 06:02:41 -04:00
GxsChannels:
- cleaned source code - added auto refresh - added todo button - removed some debug output Updated english translation git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6517 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
2b9a211184
commit
9c40fb878f
22 changed files with 429 additions and 545 deletions
|
@ -92,7 +92,7 @@ void CirclesDialog::todo()
|
|||
"</ul>");
|
||||
}
|
||||
|
||||
void CirclesDialog::updateDisplay(bool /*initialFill*/)
|
||||
void CirclesDialog::updateDisplay(bool /*complete*/)
|
||||
{
|
||||
reloadAll();
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
|
||||
protected:
|
||||
virtual void updateDisplay(bool initialFill);
|
||||
virtual void updateDisplay(bool complete);
|
||||
|
||||
private slots:
|
||||
void todo();
|
||||
|
|
|
@ -505,7 +505,7 @@ void IdDialog::insertIdDetails(uint32_t token)
|
|||
requestRepList(data.mMeta.mGroupId);
|
||||
}
|
||||
|
||||
void IdDialog::updateDisplay(bool /*initialFill*/)
|
||||
void IdDialog::updateDisplay(bool /*complete*/)
|
||||
{
|
||||
/* Update identity list */
|
||||
requestIdList();
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
|
||||
protected:
|
||||
virtual void updateDisplay(bool initialFill);
|
||||
virtual void updateDisplay(bool complete);
|
||||
|
||||
private slots:
|
||||
void filterComboBoxChanged();
|
||||
|
|
|
@ -291,7 +291,7 @@ void PostedListDialog::openComments(uint32_t /*feed_type*/, const RsGxsGroupId &
|
|||
|
||||
/*****************************************************************************************/
|
||||
|
||||
void PostedListDialog::updateDisplay(bool /*initialFill*/)
|
||||
void PostedListDialog::updateDisplay(bool /*complete*/)
|
||||
{
|
||||
std::cerr << "rsPosted->updateDisplay()";
|
||||
std::cerr << std::endl;
|
||||
|
|
|
@ -80,7 +80,7 @@ private slots:
|
|||
void showPrev();
|
||||
|
||||
protected:
|
||||
virtual void updateDisplay(bool initialFill);
|
||||
virtual void updateDisplay(bool complete);
|
||||
|
||||
private:
|
||||
void updateShowText();
|
||||
|
|
|
@ -25,7 +25,7 @@ protected:
|
|||
void showEvent(QShowEvent *e);
|
||||
|
||||
signals:
|
||||
void fillDisplay(bool initialFill);
|
||||
void fillDisplay(bool complete);
|
||||
|
||||
private slots:
|
||||
void updateBroadcastChanged();
|
||||
|
|
|
@ -27,9 +27,9 @@ std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &RsGxsUpdateBroadcastPage::
|
|||
return mBase->getMsgIds();
|
||||
}
|
||||
|
||||
void RsGxsUpdateBroadcastPage::fillDisplay(bool initialFill)
|
||||
void RsGxsUpdateBroadcastPage::fillDisplay(bool complete)
|
||||
{
|
||||
updateDisplay(initialFill);
|
||||
updateDisplay(complete);
|
||||
update(); // Qt flush
|
||||
}
|
||||
|
||||
|
|
|
@ -30,10 +30,10 @@ protected:
|
|||
virtual void showEvent(QShowEvent *event);
|
||||
|
||||
// This is overloaded in subclasses.
|
||||
virtual void updateDisplay(bool initialFill) = 0;
|
||||
virtual void updateDisplay(bool complete) = 0;
|
||||
|
||||
private slots:
|
||||
void fillDisplay(bool initialFill);
|
||||
void fillDisplay(bool complete);
|
||||
|
||||
private:
|
||||
RsGxsUpdateBroadcastBase *mBase;
|
||||
|
|
|
@ -27,9 +27,9 @@ std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &RsGxsUpdateBroadcastWidget
|
|||
return mBase->getMsgIds();
|
||||
}
|
||||
|
||||
void RsGxsUpdateBroadcastWidget::fillDisplay(bool initialFill)
|
||||
void RsGxsUpdateBroadcastWidget::fillDisplay(bool complete)
|
||||
{
|
||||
updateDisplay(initialFill);
|
||||
updateDisplay(complete);
|
||||
update(); // Qt flush
|
||||
}
|
||||
|
||||
|
|
|
@ -30,10 +30,10 @@ protected:
|
|||
virtual void showEvent(QShowEvent *event);
|
||||
|
||||
// This is overloaded in subclasses.
|
||||
virtual void updateDisplay(bool initialFill) = 0;
|
||||
virtual void updateDisplay(bool complete) = 0;
|
||||
|
||||
private slots:
|
||||
void fillDisplay(bool initialFill);
|
||||
void fillDisplay(bool complete);
|
||||
|
||||
private:
|
||||
RsGxsUpdateBroadcastBase *mBase;
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
****************************************************************/
|
||||
|
||||
#include <QDragEnterEvent>
|
||||
#include <QUrl>
|
||||
#include <QTimer>
|
||||
#include <QMessageBox>
|
||||
#include <QBuffer>
|
||||
#include <QMenu>
|
||||
|
@ -31,19 +29,16 @@
|
|||
#include "CreateGxsChannelMsg.h"
|
||||
#include "gui/feeds/SubFileItem.h"
|
||||
#include "util/misc.h"
|
||||
#include "util/TokenQueue.h"
|
||||
|
||||
#include <retroshare/rsgxschannels.h>
|
||||
#include <retroshare/rsfiles.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#define CREATEMSG_CHANNELINFO 0x002
|
||||
|
||||
|
||||
/** Constructor */
|
||||
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)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
setupUi(this);
|
||||
|
@ -92,7 +87,6 @@ void CreateGxsChannelMsg::contextMenu(QPoint /*point*/)
|
|||
QMenu contextMnu(this) ;
|
||||
|
||||
QAction *action ;
|
||||
|
||||
if(n_file > 1)
|
||||
action = contextMnu.addAction(QIcon(":/images/pasterslink.png"), tr("Paste RetroShare Links"), this, SLOT(pasteLink()));
|
||||
else
|
||||
|
@ -135,12 +129,11 @@ void CreateGxsChannelMsg::pasteLink()
|
|||
}
|
||||
}
|
||||
|
||||
CreateGxsChannelMsg::~CreateGxsChannelMsg(){
|
||||
|
||||
CreateGxsChannelMsg::~CreateGxsChannelMsg()
|
||||
{
|
||||
#ifdef CHANNELS_FRAME_CATCHER
|
||||
delete fCatcher;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/* Dropping */
|
||||
|
@ -325,13 +318,11 @@ void CreateGxsChannelMsg::parseRsFileListAttachments(const std::string &attachLi
|
|||
// TEMP NOT ALLOWED UNTIL FT WORKING.
|
||||
addAttachment(hash, fname, size, false, source);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Error Decode: Hash size: " << hash.size() << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -368,7 +359,6 @@ void CreateGxsChannelMsg::addAttachment(const std::string &hash, const std::stri
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
void CreateGxsChannelMsg::addExtraFile()
|
||||
{
|
||||
/* add a SubFileItem to the attachment section */
|
||||
|
@ -383,7 +373,6 @@ void CreateGxsChannelMsg::addExtraFile()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void CreateGxsChannelMsg::addAttachment(const std::string &path)
|
||||
{
|
||||
/* add a SubFileItem to the attachment section */
|
||||
|
@ -402,13 +391,10 @@ void CreateGxsChannelMsg::addAttachment(const std::string &path)
|
|||
for(it= mAttachments.begin(); it != mAttachments.end(); it++){
|
||||
|
||||
if((*it)->FilePath() == path){
|
||||
QMessageBox::warning(this, tr("RetroShare"),
|
||||
tr("File already Added and Hashed"),
|
||||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
QMessageBox::warning(this, tr("RetroShare"), tr("File already Added and Hashed"), QMessageBox::Ok, QMessageBox::Ok);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FileInfo fInfo;
|
||||
|
@ -481,8 +467,8 @@ bool CreateGxsChannelMsg::setThumbNail(const std::string& path, int frame){
|
|||
return true;
|
||||
}
|
||||
|
||||
void CreateGxsChannelMsg::allowAutoMediaThumbNail(bool allowThumbNail){
|
||||
|
||||
void CreateGxsChannelMsg::allowAutoMediaThumbNail(bool allowThumbNail)
|
||||
{
|
||||
mAutoMediaThumbNail = allowThumbNail;
|
||||
}
|
||||
|
||||
|
@ -520,7 +506,6 @@ void CreateGxsChannelMsg::checkAttachmentReady()
|
|||
QTimer::singleShot( msec_rate, this, SLOT(checkAttachmentReady(void)));
|
||||
}
|
||||
|
||||
|
||||
void CreateGxsChannelMsg::cancelMsg()
|
||||
{
|
||||
std::cerr << "CreateGxsChannelMsg::cancelMsg() :"
|
||||
|
@ -533,8 +518,7 @@ void CreateGxsChannelMsg::cancelMsg()
|
|||
for(it = mAttachments.begin(); it != mAttachments.end(); it++)
|
||||
rsGxsChannels->ExtraFileRemove((*it)->FileHash());
|
||||
|
||||
close();
|
||||
return;
|
||||
reject();
|
||||
}
|
||||
|
||||
void CreateGxsChannelMsg::newChannelMsg()
|
||||
|
@ -560,7 +544,6 @@ void CreateGxsChannelMsg::newChannelMsg()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void CreateGxsChannelMsg::saveChannelInfo(const RsGroupMetaData &meta)
|
||||
{
|
||||
mChannelMeta = meta;
|
||||
|
@ -570,7 +553,6 @@ void CreateGxsChannelMsg::saveChannelInfo(const RsGroupMetaData &meta)
|
|||
subjectEdit->setFocus();
|
||||
}
|
||||
|
||||
|
||||
void CreateGxsChannelMsg::sendMsg()
|
||||
{
|
||||
std::cerr << "CreateGxsChannelMsg::sendMsg()";
|
||||
|
@ -609,16 +591,13 @@ void CreateGxsChannelMsg::sendMsg()
|
|||
}
|
||||
|
||||
sendMessage(subject, msg, files);
|
||||
|
||||
}
|
||||
|
||||
void CreateGxsChannelMsg::sendMessage(const std::string &subject, const std::string &msg, const std::list<RsGxsFile> &files)
|
||||
{
|
||||
if(subject.empty())
|
||||
{ /* error message */
|
||||
QMessageBox::warning(this, tr("RetroShare"),
|
||||
tr("Please add a Subject"),
|
||||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
QMessageBox::warning(this, tr("RetroShare"), tr("Please add a Subject"), QMessageBox::Ok, QMessageBox::Ok);
|
||||
|
||||
return; //Don't add an empty Subject!!
|
||||
}
|
||||
|
@ -653,9 +632,7 @@ void CreateGxsChannelMsg::sendMessage(const std::string &subject, const std::str
|
|||
rsGxsChannels->createPost(token, post);
|
||||
}
|
||||
|
||||
close();
|
||||
return;
|
||||
|
||||
accept();
|
||||
}
|
||||
|
||||
void CreateGxsChannelMsg::addThumbnail()
|
||||
|
@ -671,8 +648,6 @@ void CreateGxsChannelMsg::addThumbnail()
|
|||
thumbnail_label->setPixmap(picture);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CreateGxsChannelMsg::loadChannelInfo(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "CreateGxsChannelMsg::loadChannelInfo()";
|
||||
|
@ -693,7 +668,6 @@ void CreateGxsChannelMsg::loadChannelInfo(const uint32_t &token)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void CreateGxsChannelMsg::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
{
|
||||
std::cerr << "CreateGxsChannelMsg::loadRequest() UserType: " << req.mUserType;
|
||||
|
@ -710,12 +684,6 @@ void CreateGxsChannelMsg::loadRequest(const TokenQueue *queue, const TokenReques
|
|||
default:
|
||||
std::cerr << "CreateGxsChannelMsg::loadRequest() UNKNOWN UserType ";
|
||||
std::cerr << std::endl;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#define _CREATE_GXSCHANNEL_MSG_H
|
||||
|
||||
#include "ui_CreateGxsChannelMsg.h"
|
||||
#include <stdint.h>
|
||||
#include "util/TokenQueue.h"
|
||||
#include <retroshare/rsgxschannels.h>
|
||||
|
||||
|
@ -32,7 +31,6 @@
|
|||
#endif
|
||||
|
||||
class SubFileItem;
|
||||
class RsGxsFile;
|
||||
|
||||
class CreateGxsChannelMsg : public QDialog, public TokenResponse, private Ui::CreateGxsChannelMsg
|
||||
{
|
||||
|
@ -42,7 +40,6 @@ public:
|
|||
/** Default Constructor */
|
||||
CreateGxsChannelMsg(std::string cId);
|
||||
|
||||
|
||||
/** Default Destructor */
|
||||
~CreateGxsChannelMsg();
|
||||
|
||||
|
@ -54,12 +51,11 @@ public:
|
|||
QPixmap picture;
|
||||
|
||||
// overload from TokenResponse
|
||||
virtual void loadRequest(const TokenQueue*, const TokenRequest&);
|
||||
|
||||
virtual void loadRequest(const TokenQueue*, const TokenRequest&);
|
||||
|
||||
protected:
|
||||
virtual void dragEnterEvent(QDragEnterEvent *event);
|
||||
virtual void dropEvent(QDropEvent *event);
|
||||
virtual void dragEnterEvent(QDragEnterEvent *event);
|
||||
virtual void dropEvent(QDropEvent *event);
|
||||
|
||||
private slots:
|
||||
void addExtraFile();
|
||||
|
@ -74,7 +70,6 @@ private slots:
|
|||
void allowAutoMediaThumbNail(bool);
|
||||
|
||||
private:
|
||||
|
||||
void loadChannelInfo(const uint32_t &token);
|
||||
void saveChannelInfo(const RsGroupMetaData &group);
|
||||
|
||||
|
@ -96,8 +91,6 @@ private:
|
|||
#ifdef CHANNELS_FRAME_CATCHER
|
||||
framecatcher* fCatcher;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -20,33 +20,16 @@
|
|||
****************************************************************/
|
||||
|
||||
#include <QMenu>
|
||||
#include <QTimer>
|
||||
#include <QStandardItemModel>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
#include <map>
|
||||
|
||||
#include "GxsChannelDialog.h"
|
||||
|
||||
#include "gui/feeds/GxsChannelPostItem.h"
|
||||
|
||||
#include "../common/PopularityDefs.h"
|
||||
#include "../settings/rsharesettings.h"
|
||||
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "gui/gxschannels/GxsChannelGroupDialog.h"
|
||||
#include "gui/gxschannels/CreateGxsChannelMsg.h"
|
||||
|
||||
//#include "../channels/ChannelDetails.h"
|
||||
//#include "../channels/EditChanDetails.h"
|
||||
#include "../channels/ShareKey.h"
|
||||
#include "../channels/ChannelUserNotify.h"
|
||||
|
||||
|
||||
#include "../notifyqt.h"
|
||||
#include "../RetroShareLink.h"
|
||||
#include "gui/common/UIStateHelper.h"
|
||||
|
||||
#define CHAN_DEFAULT_IMAGE ":/images/channels.png"
|
||||
|
||||
|
@ -59,12 +42,11 @@
|
|||
#define IMAGE_CHANNELYELLOW ":/images/channelsyellow.png"
|
||||
|
||||
/****
|
||||
* #define CHAN_DEBUG
|
||||
* #define DEBUG_CHANNEL
|
||||
***/
|
||||
|
||||
#define USE_THREAD
|
||||
|
||||
|
||||
#define TOKEN_TYPE_GROUP_CHANGE 1 // THIS MUST MIRROR GxsGroupDialog parameters.
|
||||
|
||||
#define TOKEN_TYPE_MESSAGE_CHANGE 4
|
||||
|
@ -74,24 +56,33 @@
|
|||
|
||||
/** Constructor */
|
||||
GxsChannelDialog::GxsChannelDialog(QWidget *parent)
|
||||
: RsAutoUpdatePage(1000,parent), GxsServiceDialog(dynamic_cast<GxsCommentContainer *>(parent))
|
||||
: RsGxsUpdateBroadcastPage(rsGxsChannels, parent), GxsServiceDialog(dynamic_cast<GxsCommentContainer *>(parent))
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
/* Setup UI helper */
|
||||
mStateHelper = new UIStateHelper(this);
|
||||
|
||||
mStateHelper->addWidget(TOKEN_TYPE_POSTS, ui.progressBar, UISTATE_LOADING_VISIBLE);
|
||||
mStateHelper->addWidget(TOKEN_TYPE_POSTS, ui.progressLabel, UISTATE_LOADING_VISIBLE);
|
||||
|
||||
mStateHelper->addLoadPlaceholder(TOKEN_TYPE_GROUP_DATA, ui.nameLabel);
|
||||
|
||||
mStateHelper->addWidget(TOKEN_TYPE_GROUP_DATA, ui.postButton);
|
||||
mStateHelper->addWidget(TOKEN_TYPE_GROUP_DATA, ui.logoLabel);
|
||||
|
||||
mChannelQueue = new TokenQueue(rsGxsChannels->getTokenService(), this);
|
||||
|
||||
connect(ui.newChannelButton, SIGNAL(clicked()), this, SLOT(createChannel()));
|
||||
connect(ui.postButton, SIGNAL(clicked()), this, SLOT(createMsg()));
|
||||
connect(NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)));
|
||||
|
||||
connect(ui.refreshButton, SIGNAL(clicked()), this, SLOT(forceUpdateDisplay()));
|
||||
|
||||
// connect(NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)));
|
||||
|
||||
/*************** Setup Left Hand Side (List of Channels) ****************/
|
||||
|
||||
connect(ui.treeWidget, SIGNAL(treeCustomContextMenuRequested(QPoint)), this, SLOT( channelListCustomPopupMenu( QPoint ) ) );
|
||||
connect(ui.treeWidget, SIGNAL(treeCustomContextMenuRequested(QPoint)), this, SLOT(channelListCustomPopupMenu(QPoint)));
|
||||
connect(ui.treeWidget, SIGNAL(treeCurrentItemChanged(QString)), this, SLOT(selectChannel(QString)));
|
||||
connect(ui.todoPushButton, SIGNAL(clicked()), this, SLOT(todo()));
|
||||
|
||||
mChannelId.clear();
|
||||
|
||||
|
@ -105,22 +96,19 @@ GxsChannelDialog::GxsChannelDialog(QWidget *parent)
|
|||
|
||||
ownChannels = ui.treeWidget->addCategoryItem(tr("My Channels"), QIcon(IMAGE_CHANNELBLUE), true);
|
||||
subcribedChannels = ui.treeWidget->addCategoryItem(tr("Subscribed Channels"), QIcon(IMAGE_CHANNELRED), true);
|
||||
popularChannels = ui.treeWidget->addCategoryItem(tr("Popular Channels"), QIcon(IMAGE_CHANNELGREEN ), false);
|
||||
popularChannels = ui.treeWidget->addCategoryItem(tr("Popular Channels"), QIcon(IMAGE_CHANNELGREEN), false);
|
||||
otherChannels = ui.treeWidget->addCategoryItem(tr("Other Channels"), QIcon(IMAGE_CHANNELYELLOW), false);
|
||||
|
||||
ui.progressLabel->hide();
|
||||
ui.progressBar->hide();
|
||||
|
||||
//added from ahead
|
||||
//updateChannelList();
|
||||
forceUpdateDisplay();
|
||||
|
||||
ui.nameLabel->setMinimumWidth(20);
|
||||
|
||||
/* load settings */
|
||||
processSettings(true);
|
||||
|
||||
insertChannels();
|
||||
/* Initialize empty GUI */
|
||||
requestGroupData(mChannelId);
|
||||
}
|
||||
|
||||
GxsChannelDialog::~GxsChannelDialog()
|
||||
|
@ -129,34 +117,34 @@ GxsChannelDialog::~GxsChannelDialog()
|
|||
processSettings(false);
|
||||
}
|
||||
|
||||
|
||||
void GxsChannelDialog::updateDisplay()
|
||||
void GxsChannelDialog::todo()
|
||||
{
|
||||
if (!rsGxsChannels)
|
||||
return;
|
||||
QMessageBox::information(this, "Todo",
|
||||
"<b>Open points:</b><ul>"
|
||||
"<li>Threaded load of messages"
|
||||
"<li>Share key"
|
||||
"<li>Restore channel keys"
|
||||
"<li>Copy/navigate channel link"
|
||||
"<li>Display count of unread messages"
|
||||
"<li>Show/Edit channel details"
|
||||
"<li>Set all as read"
|
||||
"<li>Set read/unread status"
|
||||
"</ul>");
|
||||
}
|
||||
|
||||
std::list<std::string> groupIds;
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgs;
|
||||
|
||||
if (rsGxsChannels->updated(true, true))
|
||||
{
|
||||
/* update Forums List */
|
||||
|
||||
rsGxsChannels->groupsChanged(groupIds);
|
||||
if(!groupIds.empty())
|
||||
{
|
||||
// just always update.
|
||||
void GxsChannelDialog::updateDisplay(bool complete)
|
||||
{
|
||||
std::list<RsGxsGroupId> &grpIds = getGrpIds();
|
||||
if (complete || !grpIds.empty()) {
|
||||
/* Update channel list */
|
||||
insertChannels();
|
||||
//std::list<std::string>::iterator it = std::find(groupIds.begin(), groupIds.end(), mChannelId);
|
||||
|
||||
//if(it != groupIds.end()){
|
||||
// requestGroupSummary();
|
||||
// return;
|
||||
//}
|
||||
}
|
||||
if (!mChannelId.empty() && std::find(grpIds.begin(), grpIds.end(), mChannelId) != grpIds.end()) {
|
||||
requestGroupData(mChannelId);
|
||||
}
|
||||
|
||||
rsGxsChannels->msgsChanged(msgs);
|
||||
if(!msgs.empty())
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgs = getMsgIds();
|
||||
if (!msgs.empty())
|
||||
{
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator mit = msgs.find(mChannelId);
|
||||
if(mit != msgs.end())
|
||||
|
@ -164,27 +152,18 @@ void GxsChannelDialog::updateDisplay()
|
|||
requestPosts(mChannelId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Callback from Widget->FeedHolder->ServiceDialog->CommentContainer->CommentDialog,
|
||||
void GxsChannelDialog::openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title)
|
||||
void GxsChannelDialog::openComments(uint32_t /*type*/, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title)
|
||||
{
|
||||
commentLoad(groupId, msgId, title);
|
||||
}
|
||||
|
||||
|
||||
UserNotify *GxsChannelDialog::getUserNotify(QObject *parent)
|
||||
{
|
||||
return new ChannelUserNotify(parent);
|
||||
return NULL;
|
||||
}
|
||||
//UserNotify *GxsChannelDialog::getUserNotify(QObject *parent)
|
||||
//{
|
||||
// return new ChannelUserNotify(parent);
|
||||
//}
|
||||
|
||||
void GxsChannelDialog::processSettings(bool load)
|
||||
{
|
||||
|
@ -233,7 +212,6 @@ void GxsChannelDialog::channelListCustomPopupMenu( QPoint /*point*/ )
|
|||
|
||||
if (isSubscribed)
|
||||
{
|
||||
|
||||
QAction *setallasreadchannelAct = new QAction(QIcon(":/images/message-mail-read.png"), tr( "Set all as read" ), &contextMnu);
|
||||
connect( setallasreadchannelAct , SIGNAL( triggered() ), this, SLOT( setAllAsReadClicked() ) );
|
||||
contextMnu.addAction( setallasreadchannelAct );
|
||||
|
@ -254,7 +232,6 @@ void GxsChannelDialog::channelListCustomPopupMenu( QPoint /*point*/ )
|
|||
QAction *unsubscribechannelAct = new QAction(QIcon(":/images/cancel.png"), tr( "Unsubscribe to Channel" ), &contextMnu);
|
||||
connect( unsubscribechannelAct , SIGNAL( triggered() ), this, SLOT( unsubscribeChannel() ) );
|
||||
contextMnu.addAction( unsubscribechannelAct );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -263,7 +240,6 @@ void GxsChannelDialog::channelListCustomPopupMenu( QPoint /*point*/ )
|
|||
contextMnu.addAction( subscribechannelAct );
|
||||
}
|
||||
|
||||
|
||||
if (isAdmin)
|
||||
{
|
||||
QAction *editChannelDetailAct = new QAction(QIcon(":/images/edit_16.png"), tr("Edit Channel Details"), &contextMnu);
|
||||
|
@ -296,7 +272,6 @@ void GxsChannelDialog::channelListCustomPopupMenu( QPoint /*point*/ )
|
|||
|
||||
contextMnu.exec(QCursor::pos());
|
||||
|
||||
|
||||
#if 0
|
||||
ChannelInfo ci;
|
||||
if (!rsChannels->getChannelInfo(mChannelId, ci)) {
|
||||
|
@ -363,7 +338,7 @@ void GxsChannelDialog::channelListCustomPopupMenu( QPoint /*point*/ )
|
|||
QAction *action = contextMnu.addAction(QIcon(":/images/copyrslink.png"), tr("Copy RetroShare Link"), this, SLOT(copyChannelLink()));
|
||||
action->setEnabled(!mChannelId.empty());
|
||||
|
||||
#ifdef CHAN_DEBUG
|
||||
#ifdef DEBUG_CHANNEL
|
||||
contextMnu.addSeparator();
|
||||
action = contextMnu.addAction("Generate mass data", this, SLOT(generateMassData()));
|
||||
action->setEnabled (!mChannelId.empty() && (ci.channelFlags & RS_DISTRIB_PUBLISH));
|
||||
|
@ -372,7 +347,6 @@ void GxsChannelDialog::channelListCustomPopupMenu( QPoint /*point*/ )
|
|||
contextMnu.exec(QCursor::pos());
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void GxsChannelDialog::createChannel()
|
||||
|
@ -396,7 +370,6 @@ void GxsChannelDialog::deleteFeedItem(QWidget * /*item*/, uint32_t /*type*/)
|
|||
|
||||
void GxsChannelDialog::openChat(std::string /*peerId*/)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void GxsChannelDialog::editChannelDetail()
|
||||
|
@ -413,12 +386,10 @@ void GxsChannelDialog::shareKey()
|
|||
ShareKey shareUi(this, mChannelId, CHANNEL_KEY_SHARE);
|
||||
shareUi.exec();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void GxsChannelDialog::copyChannelLink()
|
||||
{
|
||||
|
||||
#if 0
|
||||
if (mChannelId.empty()) {
|
||||
return;
|
||||
|
@ -434,7 +405,6 @@ void GxsChannelDialog::copyChannelLink()
|
|||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void GxsChannelDialog::createMsg()
|
||||
|
@ -445,18 +415,18 @@ void GxsChannelDialog::createMsg()
|
|||
|
||||
CreateGxsChannelMsg *msgDialog = new CreateGxsChannelMsg(mChannelId);
|
||||
msgDialog->show();
|
||||
|
||||
/* window will destroy itself! */
|
||||
}
|
||||
|
||||
void GxsChannelDialog::restoreChannelKeys()
|
||||
{
|
||||
|
||||
#if 0
|
||||
if(rsChannels->channelRestoreKeys(mChannelId))
|
||||
QMessageBox::information(NULL,tr("Publish rights restored."),tr("Publish rights have been restored for this channel.")) ;
|
||||
else
|
||||
QMessageBox::warning(NULL,tr("Publish not restored."),tr("Publish rights can't be restored for this channel.<br/>You're not the creator of this channel.")) ;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void GxsChannelDialog::selectChannel(const QString &id)
|
||||
|
@ -466,16 +436,8 @@ void GxsChannelDialog::selectChannel(const QString &id)
|
|||
bool autoDl = rsGxsChannels->getChannelAutoDownload(mChannelId);
|
||||
setAutoDownloadButton(autoDl);
|
||||
|
||||
requestGroupData(mChannelId);
|
||||
requestPosts(mChannelId);
|
||||
//updateChannelMsgs();
|
||||
}
|
||||
|
||||
void GxsChannelDialog::forceUpdateDisplay()
|
||||
{
|
||||
std::cerr << "GxsChannelDialog::forceUpdateDisplay()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
insertChannels();
|
||||
}
|
||||
|
||||
static void channelInfoToGroupItemInfo(const RsGroupMetaData &channelInfo, GroupItemInfo &groupItemInfo)
|
||||
|
@ -558,15 +520,13 @@ void GxsChannelDialog::insertChannelData(const std::list<RsGroupMetaData> &chann
|
|||
updateMessageSummaryList("");
|
||||
}
|
||||
|
||||
|
||||
void GxsChannelDialog::channelMsgReadSatusChanged(const QString& channelId, const QString& /*msgId*/, int /*status*/)
|
||||
{
|
||||
updateMessageSummaryList(channelId.toStdString());
|
||||
}
|
||||
//void GxsChannelDialog::channelMsgReadSatusChanged(const QString& channelId, const QString& /*msgId*/, int /*status*/)
|
||||
//{
|
||||
// updateMessageSummaryList(channelId.toStdString());
|
||||
//}
|
||||
|
||||
void GxsChannelDialog::updateMessageSummaryList(const std::string &channelId)
|
||||
{
|
||||
|
||||
#if 0
|
||||
QTreeWidgetItem *items[2] = { ownChannels, subcribedChannels };
|
||||
|
||||
|
@ -596,7 +556,6 @@ void GxsChannelDialog::updateMessageSummaryList(const std::string &channelId)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -606,11 +565,63 @@ static bool sortChannelMsgSummary(const ChannelMsgSummary &msg1, const ChannelMs
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
void GxsChannelDialog::insertChannelDetails(const RsGxsChannelGroup &group)
|
||||
{
|
||||
/* IMAGE */
|
||||
QPixmap chanImage;
|
||||
if (group.mImage.mData != NULL) {
|
||||
chanImage.loadFromData(group.mImage.mData, group.mImage.mSize, "PNG");
|
||||
} else {
|
||||
chanImage = QPixmap(CHAN_DEFAULT_IMAGE);
|
||||
}
|
||||
ui.logoLabel->setPixmap(chanImage);
|
||||
|
||||
/* set Channel name */
|
||||
ui.nameLabel->setText(QString::fromUtf8(group.mMeta.mGroupName.c_str()));
|
||||
|
||||
if (group.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_PUBLISH)
|
||||
{
|
||||
mStateHelper->setWidgetEnabled(ui.postButton, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
mStateHelper->setWidgetEnabled(ui.postButton, false);
|
||||
}
|
||||
|
||||
if (group.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED)
|
||||
{
|
||||
ui.actionEnable_Auto_Download->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.actionEnable_Auto_Download->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void GxsChannelDialog::insertChannelPosts(const std::vector<RsGxsChannelPost> &posts)
|
||||
{
|
||||
std::vector<RsGxsChannelPost>::const_iterator it;
|
||||
|
||||
// Do these need sorting? probably.
|
||||
// can we add that into the request?
|
||||
//msgs.sort(sortChannelMsgSummary);
|
||||
|
||||
uint32_t subscribeFlags = 0xffffffff;
|
||||
|
||||
for (it = posts.begin(); it != posts.end(); it++)
|
||||
{
|
||||
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, *it, subscribeFlags, true);
|
||||
mChannelPostItems.push_back(item);
|
||||
ui.verticalLayout->addWidget(item);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
void GxsChannelDialog::updateChannelMsgs()
|
||||
{
|
||||
if (fillThread) {
|
||||
#ifdef CHAN_DEBUG
|
||||
#ifdef DEBUG_CHANNEL
|
||||
std::cerr << "GxsChannelDialog::updateChannelMsgs() stop current fill thread" << std::endl;
|
||||
#endif
|
||||
// stop current fill thread
|
||||
|
@ -680,7 +691,7 @@ void GxsChannelDialog::updateChannelMsgs()
|
|||
connect(fillThread, SIGNAL(finished()), this, SLOT(fillThreadFinished()), Qt::BlockingQueuedConnection);
|
||||
connect(fillThread, SIGNAL(addMsg(QString,QString,int,int)), this, SLOT(fillThreadAddMsg(QString,QString,int,int)), Qt::BlockingQueuedConnection);
|
||||
|
||||
#ifdef CHAN_DEBUG
|
||||
#ifdef DEBUG_CHANNEL
|
||||
std::cerr << "GxsChannelDialog::updateChannelMsgs() Start fill thread" << std::endl;
|
||||
#endif
|
||||
|
||||
|
@ -703,7 +714,7 @@ void GxsChannelDialog::updateChannelMsgs()
|
|||
|
||||
void GxsChannelDialog::fillThreadFinished()
|
||||
{
|
||||
#ifdef CHAN_DEBUG
|
||||
#ifdef DEBUG_CHANNEL
|
||||
std::cerr << "GxsChannelDialog::fillThreadFinished()" << std::endl;
|
||||
#endif
|
||||
|
||||
|
@ -717,14 +728,14 @@ void GxsChannelDialog::fillThreadFinished()
|
|||
fillThread = NULL;
|
||||
}
|
||||
|
||||
#ifdef CHAN_DEBUG
|
||||
#ifdef DEBUG_CHANNEL
|
||||
if (thread->wasStopped()) {
|
||||
// thread was stopped
|
||||
std::cerr << "GxsChannelDialog::fillThreadFinished() Thread was stopped" << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CHAN_DEBUG
|
||||
#ifdef DEBUG_CHANNEL
|
||||
std::cerr << "GxsChannelDialog::fillThreadFinished() Delete thread" << std::endl;
|
||||
#endif
|
||||
|
||||
|
@ -732,7 +743,7 @@ void GxsChannelDialog::fillThreadFinished()
|
|||
thread = NULL;
|
||||
}
|
||||
|
||||
#ifdef CHAN_DEBUG
|
||||
#ifdef DEBUG_CHANNEL
|
||||
std::cerr << "GxsChannelDialog::fillThreadFinished done()" << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
@ -758,15 +769,14 @@ void GxsChannelDialog::fillThreadAddMsg(const QString &channelId, const QString
|
|||
|
||||
#endif
|
||||
|
||||
|
||||
void GxsChannelDialog::unsubscribeChannel()
|
||||
{
|
||||
#ifdef CHAN_DEBUG
|
||||
#ifdef DEBUG_CHANNEL
|
||||
std::cerr << "GxsChannelDialog::unsubscribeChannel()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
if(mChannelId.empty())
|
||||
if (mChannelId.empty())
|
||||
return;
|
||||
|
||||
uint32_t token = 0;
|
||||
|
@ -774,15 +784,14 @@ void GxsChannelDialog::unsubscribeChannel()
|
|||
mChannelQueue->queueRequest(token, 0 , RS_TOKREQ_ANSTYPE_ACK, TOKEN_TYPE_GROUP_CHANGE);
|
||||
}
|
||||
|
||||
|
||||
void GxsChannelDialog::subscribeChannel()
|
||||
{
|
||||
#ifdef CHAN_DEBUG
|
||||
#ifdef DEBUG_CHANNEL
|
||||
std::cerr << "GxsChannelDialog::subscribeChannel()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
if(mChannelId.empty())
|
||||
if (mChannelId.empty())
|
||||
return;
|
||||
|
||||
uint32_t token = 0;
|
||||
|
@ -806,7 +815,6 @@ void GxsChannelDialog::showChannelDetails()
|
|||
channelui.showDetails(mChannelId);
|
||||
channelui.exec();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void GxsChannelDialog::setAllAsReadClicked()
|
||||
|
@ -840,13 +848,10 @@ void GxsChannelDialog::setAllAsReadClicked()
|
|||
|
||||
void GxsChannelDialog::toggleAutoDownload()
|
||||
{
|
||||
if(mChannelId.empty())
|
||||
if (mChannelId.empty())
|
||||
return;
|
||||
|
||||
bool autoDl = true;
|
||||
|
||||
|
||||
autoDl = rsGxsChannels->getChannelAutoDownload(mChannelId);
|
||||
bool autoDl = rsGxsChannels->getChannelAutoDownload(mChannelId);
|
||||
if (rsGxsChannels->setChannelAutoDownload(mChannelId, !autoDl))
|
||||
{
|
||||
setAutoDownloadButton(!autoDl);
|
||||
|
@ -860,7 +865,6 @@ void GxsChannelDialog::toggleAutoDownload()
|
|||
|
||||
bool GxsChannelDialog::navigate(const std::string& channelId, const std::string& msgId)
|
||||
{
|
||||
|
||||
#if 0
|
||||
if (channelId.empty()) {
|
||||
return false;
|
||||
|
@ -906,8 +910,6 @@ void GxsChannelDialog::setAutoDownloadButton(bool autoDl)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**********************************************************************************************
|
||||
* New Stuff here.
|
||||
*************/
|
||||
|
@ -923,20 +925,14 @@ void GxsChannelDialog::insertChannels()
|
|||
|
||||
void GxsChannelDialog::requestGroupSummary()
|
||||
{
|
||||
mStateHelper->setLoading(TOKEN_TYPE_LISTING, true);
|
||||
|
||||
#ifdef DEBUG_CHANNEL
|
||||
std::cerr << "GxsChannelDialog::requestGroupSummary()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
std::list<uint32_t> tokens;
|
||||
mChannelQueue->activeRequestTokens(TOKEN_TYPE_LISTING, tokens);
|
||||
if (!tokens.empty()) {
|
||||
std::list<uint32_t>::iterator tokenIt;
|
||||
for (tokenIt = tokens.begin(); tokenIt != tokens.end(); ++tokenIt) {
|
||||
std::cerr << "GxsChannelDialog::requestGroupSummary() Canceling Request: " << *tokenIt;
|
||||
std::cerr << std::endl;
|
||||
|
||||
mChannelQueue->cancelRequest(*tokenIt);
|
||||
}
|
||||
}
|
||||
mChannelQueue->cancelActiveRequestTokens(TOKEN_TYPE_LISTING);
|
||||
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
|
||||
|
@ -947,41 +943,54 @@ void GxsChannelDialog::requestGroupSummary()
|
|||
|
||||
void GxsChannelDialog::loadGroupSummary(const uint32_t &token)
|
||||
{
|
||||
#ifdef DEBUG_CHANNEL
|
||||
std::cerr << "GxsChannelDialog::loadGroupSummary()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
std::list<RsGroupMetaData> groupInfo;
|
||||
rsGxsChannels->getGroupSummary(token, groupInfo);
|
||||
|
||||
if (groupInfo.size() > 0)
|
||||
{
|
||||
mStateHelper->setActive(TOKEN_TYPE_LISTING, true);
|
||||
|
||||
insertChannelData(groupInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "GxsChannelDialog::loadGroupSummary() ERROR No Groups...";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
mStateHelper->setActive(TOKEN_TYPE_LISTING, false);
|
||||
mStateHelper->clear(TOKEN_TYPE_LISTING);
|
||||
}
|
||||
|
||||
mStateHelper->setLoading(TOKEN_TYPE_LISTING, false);
|
||||
}
|
||||
|
||||
void GxsChannelDialog::requestGroupData(const RsGxsGroupId &grpId)
|
||||
{
|
||||
#ifdef DEBUG_CHANNEL
|
||||
std::cerr << "GxsChannelDialog::requestGroupData()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
std::list<uint32_t> tokens;
|
||||
mChannelQueue->activeRequestTokens(TOKEN_TYPE_GROUP_DATA, tokens);
|
||||
if (!tokens.empty()) {
|
||||
std::list<uint32_t>::iterator tokenIt;
|
||||
for (tokenIt = tokens.begin(); tokenIt != tokens.end(); ++tokenIt) {
|
||||
std::cerr << "GxsChannelDialog::requestGroupData() Canceling Request: " << *tokenIt;
|
||||
std::cerr << std::endl;
|
||||
mChannelQueue->cancelActiveRequestTokens(TOKEN_TYPE_GROUP_DATA);
|
||||
|
||||
mChannelQueue->cancelRequest(*tokenIt);
|
||||
}
|
||||
if (grpId.empty()) {
|
||||
mStateHelper->setActive(TOKEN_TYPE_GROUP_DATA, false);
|
||||
mStateHelper->setLoading(TOKEN_TYPE_GROUP_DATA, false);
|
||||
mStateHelper->clear(TOKEN_TYPE_GROUP_DATA);
|
||||
|
||||
ui.nameLabel->setText(tr("No Channel Selected"));
|
||||
ui.logoLabel->setPixmap(QPixmap(":/images/channels.png"));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
mStateHelper->setLoading(TOKEN_TYPE_GROUP_DATA, true);
|
||||
|
||||
std::list<RsGxsGroupId> groupIds;
|
||||
groupIds.push_back(grpId);
|
||||
|
||||
|
@ -990,46 +999,61 @@ void GxsChannelDialog::requestGroupData(const RsGxsGroupId &grpId)
|
|||
|
||||
uint32_t token;
|
||||
mChannelQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds, TOKEN_TYPE_GROUP_DATA);
|
||||
|
||||
}
|
||||
|
||||
void GxsChannelDialog::loadGroupData(const uint32_t &token)
|
||||
{
|
||||
#ifdef DEBUG_CHANNEL
|
||||
std::cerr << "GxsChannelDialog::loadGroupData()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
std::vector<RsGxsChannelGroup> groups;
|
||||
rsGxsChannels->getGroupData(token, groups);
|
||||
|
||||
mStateHelper->setLoading(TOKEN_TYPE_GROUP_DATA, false);
|
||||
|
||||
if (groups.size() == 1)
|
||||
{
|
||||
mStateHelper->setActive(TOKEN_TYPE_GROUP_DATA, true);
|
||||
|
||||
insertChannelDetails(groups[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "GxsChannelDialog::loadGroupData() ERROR Not just one Group";
|
||||
std::cerr << std::endl;
|
||||
|
||||
mStateHelper->setActive(TOKEN_TYPE_GROUP_DATA, false);
|
||||
mStateHelper->clear(TOKEN_TYPE_GROUP_DATA);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GxsChannelDialog::requestPosts(const RsGxsGroupId &grpId)
|
||||
{
|
||||
#ifdef DEBUG_CHANNEL
|
||||
std::cerr << "GxsChannelDialog::requestPosts()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
std::list<uint32_t> tokens;
|
||||
mChannelQueue->activeRequestTokens(TOKEN_TYPE_POSTS, tokens);
|
||||
if (!tokens.empty()) {
|
||||
std::list<uint32_t>::iterator tokenIt;
|
||||
for (tokenIt = tokens.begin(); tokenIt != tokens.end(); ++tokenIt) {
|
||||
std::cerr << "GxsChannelDialog::requestPosts() Canceling Request: " << *tokenIt;
|
||||
std::cerr << std::endl;
|
||||
/* replace all the messages with new ones */
|
||||
QList<GxsChannelPostItem *>::iterator mit;
|
||||
for (mit = mChannelPostItems.begin(); mit != mChannelPostItems.end(); mit++) {
|
||||
delete (*mit);
|
||||
}
|
||||
mChannelPostItems.clear();
|
||||
|
||||
mChannelQueue->cancelRequest(*tokenIt);
|
||||
}
|
||||
mChannelQueue->cancelActiveRequestTokens(TOKEN_TYPE_POSTS);
|
||||
|
||||
if (grpId.empty()) {
|
||||
mStateHelper->setActive(TOKEN_TYPE_POSTS, false);
|
||||
mStateHelper->setLoading(TOKEN_TYPE_POSTS, false);
|
||||
mStateHelper->clear(TOKEN_TYPE_POSTS);
|
||||
return;
|
||||
}
|
||||
|
||||
mStateHelper->setLoading(TOKEN_TYPE_POSTS, true);
|
||||
|
||||
std::list<RsGxsGroupId> groupIds;
|
||||
groupIds.push_back(grpId);
|
||||
|
||||
|
@ -1042,31 +1066,39 @@ void GxsChannelDialog::requestPosts(const RsGxsGroupId &grpId)
|
|||
|
||||
void GxsChannelDialog::loadPosts(const uint32_t &token)
|
||||
{
|
||||
#ifdef DEBUG_CHANNEL
|
||||
std::cerr << "GxsChannelDialog::loadPosts()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
std::vector<RsGxsChannelPost> posts;
|
||||
rsGxsChannels->getPostData(token, posts);
|
||||
|
||||
insertChannelPosts(posts);
|
||||
}
|
||||
mStateHelper->setActive(TOKEN_TYPE_POSTS, true);
|
||||
|
||||
insertChannelPosts(posts);
|
||||
|
||||
mStateHelper->setLoading(TOKEN_TYPE_POSTS, false);
|
||||
}
|
||||
|
||||
void GxsChannelDialog::acknowledgeGroupUpdate(const uint32_t &token)
|
||||
{
|
||||
#ifdef DEBUG_CHANNEL
|
||||
std::cerr << "GxsChannelDialog::acknowledgeGroupUpdate()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
RsGxsGroupId grpId;
|
||||
rsGxsChannels->acknowledgeGrp(token, grpId);
|
||||
insertChannels();
|
||||
}
|
||||
|
||||
|
||||
void GxsChannelDialog::acknowledgeMessageUpdate(const uint32_t &token)
|
||||
{
|
||||
#ifdef DEBUG_CHANNEL
|
||||
std::cerr << "GxsChannelDialog::acknowledgeMessageUpdate() TODO";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
std::pair<RsGxsGroupId, RsGxsMessageId> msgId;
|
||||
rsGxsChannels->acknowledgeMsg(token, msgId);
|
||||
|
@ -1076,11 +1108,12 @@ void GxsChannelDialog::acknowledgeMessageUpdate(const uint32_t &token)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void GxsChannelDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
{
|
||||
#ifdef DEBUG_CHANNEL
|
||||
std::cerr << "GxsChannelDialog::loadRequest() UserType: " << req.mUserType;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
if (queue == mChannelQueue)
|
||||
{
|
||||
|
@ -1109,77 +1142,3 @@ void GxsChannelDialog::loadRequest(const TokenQueue *queue, const TokenRequest &
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GxsChannelDialog::insertChannelDetails(const RsGxsChannelGroup &group)
|
||||
{
|
||||
/* replace all the messages with new ones */
|
||||
QList<GxsChannelPostItem *>::iterator mit;
|
||||
for (mit = mChannelPostItems.begin(); mit != mChannelPostItems.end(); mit++) {
|
||||
delete (*mit);
|
||||
}
|
||||
|
||||
mChannelPostItems.clear();
|
||||
|
||||
/* IMAGE */
|
||||
QPixmap chanImage;
|
||||
if (group.mImage.mData != NULL) {
|
||||
chanImage.loadFromData(group.mImage.mData, group.mImage.mSize, "PNG");
|
||||
} else {
|
||||
chanImage = QPixmap(CHAN_DEFAULT_IMAGE);
|
||||
}
|
||||
ui.logoLabel->setPixmap(chanImage);
|
||||
ui.logoLabel->setEnabled(true);
|
||||
|
||||
/* set Channel name */
|
||||
ui.nameLabel->setText(QString::fromUtf8(group.mMeta.mGroupName.c_str()));
|
||||
|
||||
if (group.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_PUBLISH)
|
||||
{
|
||||
ui.postButton->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.postButton->setEnabled(false);
|
||||
}
|
||||
|
||||
if (group.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED)
|
||||
{
|
||||
ui.actionEnable_Auto_Download->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.actionEnable_Auto_Download->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GxsChannelDialog::insertChannelPosts(const std::vector<RsGxsChannelPost> &posts)
|
||||
{
|
||||
std::vector<RsGxsChannelPost>::const_iterator it;
|
||||
|
||||
// Do these need sorting? probably.
|
||||
// can we add that into the request?
|
||||
//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;
|
||||
|
||||
for (it = posts.begin(); it != posts.end(); it++)
|
||||
{
|
||||
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, *it, subscribeFlags, true);
|
||||
mChannelPostItems.push_back(item);
|
||||
ui.verticalLayout->addWidget(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -22,14 +22,9 @@
|
|||
#ifndef _GXS_CHANNEL_DIALOG_H
|
||||
#define _GXS_CHANNEL_DIALOG_H
|
||||
|
||||
#include <retroshare/rsgxschannels.h>
|
||||
|
||||
#include <QStandardItemModel>
|
||||
#include <QThread>
|
||||
#include <map>
|
||||
|
||||
#include "mainpage.h"
|
||||
#include "RsAutoUpdatePage.h"
|
||||
#include "gui/gxs/RsGxsUpdateBroadcastPage.h"
|
||||
|
||||
#include "ui_GxsChannelDialog.h"
|
||||
|
||||
|
@ -41,9 +36,9 @@
|
|||
//class ChanMsgItem;
|
||||
class GxsChannelPostItem;
|
||||
class QTreeWidgetItem;
|
||||
class UIStateHelper;
|
||||
|
||||
class GxsChannelDialog : public RsAutoUpdatePage, public TokenResponse, public GxsServiceDialog,
|
||||
public FeedHolder
|
||||
class GxsChannelDialog : public RsGxsUpdateBroadcastPage, public TokenResponse, public GxsServiceDialog, public FeedHolder
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -53,7 +48,7 @@ public:
|
|||
/** Default Destructor */
|
||||
~GxsChannelDialog();
|
||||
|
||||
virtual UserNotify *getUserNotify(QObject *parent);
|
||||
// virtual UserNotify *getUserNotify(QObject *parent);
|
||||
|
||||
/* FeedHolder */
|
||||
virtual QScrollArea *getScrollArea();
|
||||
|
@ -63,16 +58,15 @@ public:
|
|||
|
||||
bool navigate(const std::string& channelId, const std::string& msgId);
|
||||
|
||||
/* overloaded from RsAuthUpdatePage */
|
||||
virtual void updateDisplay();
|
||||
|
||||
|
||||
/* NEW GXS FNS */
|
||||
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
|
||||
protected:
|
||||
virtual void updateDisplay(bool complete);
|
||||
|
||||
private slots:
|
||||
void channelListCustomPopupMenu( QPoint point );
|
||||
void todo();
|
||||
void channelListCustomPopupMenu(QPoint point);
|
||||
void selectChannel(const QString &id);
|
||||
|
||||
void createChannel();
|
||||
|
@ -90,18 +84,13 @@ private slots:
|
|||
void shareKey();
|
||||
void copyChannelLink();
|
||||
|
||||
void channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status);
|
||||
// void channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status);
|
||||
|
||||
//void generateMassData();
|
||||
|
||||
//void fillThreadFinished();
|
||||
//void fillThreadAddMsg(const QString &channelId, const QString &channelMsgId, int current, int count);
|
||||
|
||||
/* NEW GXS FNS */
|
||||
void forceUpdateDisplay();
|
||||
|
||||
|
||||
|
||||
private:
|
||||
//void updateChannelList();
|
||||
//void updateChannelMsgs();
|
||||
|
@ -134,7 +123,6 @@ private:
|
|||
std::string mChannelId; /* current Channel */
|
||||
TokenQueue *mChannelQueue;
|
||||
|
||||
|
||||
/* Layout Pointers */
|
||||
QBoxLayout *mMsgLayout;
|
||||
|
||||
|
@ -148,6 +136,8 @@ private:
|
|||
QTreeWidgetItem *popularChannels;
|
||||
QTreeWidgetItem *otherChannels;
|
||||
|
||||
UIStateHelper *mStateHelper;
|
||||
|
||||
/* UI - from Designer */
|
||||
Ui::GxsChannelDialog ui;
|
||||
};
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap>:/images/channels32.png</pixmap>
|
||||
<pixmap resource="../images.qrc">:/images/channels32.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
|
@ -89,9 +89,9 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="refreshButton">
|
||||
<widget class="QPushButton" name="todoPushButton">
|
||||
<property name="text">
|
||||
<string>refresh</string>
|
||||
<string>Todo</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -104,7 +104,7 @@
|
|||
<string>Display</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/looknfeel.png</normaloff>:/images/looknfeel.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
|
@ -133,7 +133,7 @@
|
|||
<string>Create Channel</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/add_channel24.png</normaloff>:/images/add_channel24.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
|
@ -194,7 +194,7 @@
|
|||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap>:/images/channels.png</pixmap>
|
||||
<pixmap resource="../images.qrc">:/images/channels.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
|
@ -236,7 +236,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>380</width>
|
||||
<width>362</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -299,7 +299,7 @@
|
|||
<string>Post to Channel</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/mail_send.png</normaloff>:/images/mail_send.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
|
@ -360,7 +360,7 @@
|
|||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="images.qrc"/>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
|
@ -309,9 +309,9 @@ void GxsForumThreadWidget::changeEvent(QEvent *e)
|
|||
}
|
||||
}
|
||||
|
||||
void GxsForumThreadWidget::updateDisplay(bool initialFill)
|
||||
void GxsForumThreadWidget::updateDisplay(bool complete)
|
||||
{
|
||||
if (initialFill) {
|
||||
if (complete) {
|
||||
/* Not needed */
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ signals:
|
|||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *ev);
|
||||
void changeEvent(QEvent *e);
|
||||
virtual void updateDisplay(bool initialFill);
|
||||
virtual void updateDisplay(bool complete);
|
||||
|
||||
private slots:
|
||||
/** Create the context popup menu and it's submenus */
|
||||
|
|
|
@ -257,10 +257,12 @@ void GxsForumsDialog::restoreForumKeys(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
void GxsForumsDialog::updateDisplay(bool /*initialFill*/)
|
||||
void GxsForumsDialog::updateDisplay(bool complete)
|
||||
{
|
||||
if (complete || !getGrpIds().empty()) {
|
||||
/* Update forums list */
|
||||
insertForums();
|
||||
}
|
||||
}
|
||||
|
||||
void GxsForumsDialog::forumInfoToGroupItemInfo(const RsGroupMetaData &forumInfo, GroupItemInfo &groupItemInfo)
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
|
||||
protected:
|
||||
virtual void updateDisplay(bool initialFill);
|
||||
virtual void updateDisplay(bool complete);
|
||||
|
||||
private slots:
|
||||
void settingsChanged();
|
||||
|
|
|
@ -5039,10 +5039,6 @@ p, li { white-space: pre-wrap; }
|
|||
<source>Message Group</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Add Friend</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Edit Group</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -5051,10 +5047,6 @@ p, li { white-space: pre-wrap; }
|
|||
<source>Remove Group</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Chat lobbies</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Chat</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -5071,10 +5063,6 @@ p, li { white-space: pre-wrap; }
|
|||
<source>Recommend this Friend to...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Connect To Friend</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Copy certificate link</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -5115,26 +5103,6 @@ p, li { white-space: pre-wrap; }
|
|||
<source>Remove from all groups</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Create new</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Invite this group</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Invite this friend</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unsubscribe</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Expand all</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -5151,22 +5119,10 @@ p, li { white-space: pre-wrap; }
|
|||
<source>Do you want to remove this Friend?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unsubscribe to lobby</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>You are about to unsubscribe a chat lobby<br>You can only re-enter if your friends invite you again.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Columns</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Sort by</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>IP</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -5179,6 +5135,22 @@ p, li { white-space: pre-wrap; }
|
|||
<source>Show IP Column</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Attempt to connect</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Create new group</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Recommend many friends to each others</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Service permissions matrix</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FriendRecommendDialog</name>
|
||||
|
@ -5255,10 +5227,6 @@ p, li { white-space: pre-wrap; }
|
|||
<source>Display</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Add</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Edit status message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -5375,10 +5343,6 @@ p, li { white-space: pre-wrap; }
|
|||
<source>Local network</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Known people</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Welcome to RetroShare's group chat.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -5411,6 +5375,10 @@ p, li { white-space: pre-wrap; }
|
|||
<source>Text File (*.txt );;All Files (*)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Keyring</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>GamesDialog</name>
|
||||
|
@ -6254,10 +6222,6 @@ p, li { white-space: pre-wrap; }
|
|||
<source>Channels</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>refresh</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Display</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -6350,6 +6314,10 @@ p, li { white-space: pre-wrap; }
|
|||
<source>No Channel Selected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Todo</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>GxsChannelGroupDialog</name>
|
||||
|
@ -8902,10 +8870,6 @@ Do you want to save message ?</source>
|
|||
<source>Search Network</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show all accessible keys</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -9112,6 +9076,10 @@ Right-click and select 'make friend' to be able to connect.</source>
|
|||
<source>Data inconsistency in the keyring. This is most probably a bug. Please contact the developers.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Only show people you trusted</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>NetworkPage</name>
|
||||
|
@ -9176,6 +9144,10 @@ Right-click and select 'make friend' to be able to connect.</source>
|
|||
<source>This is a test.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> <h1><img width="32" src=":/images/64px_help.png">&nbsp;&nbsp;News Feed</h1> <p>The News Feed displays the last events on your network, sorted by the time you received them. This gives you a summary of the activity of your friends. You can configure which events to show by pressing on <b>Options</b>. </p> <p>The various events shown are: <ul> <li>Connection attempts (useful to make friends with new people and control who's trying to reach you)</li> <li>Channel and Forum posts</li> <li>New Channels and Forums you can subscribe to</li> <li>Private messages from your friends</li> </ul> </p> </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>NotifyPage</name>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue