void CreatePostWidget::submitMessage()
{
    Wt::WString text = _messageTextArea->text();
    if(text == ""){
        // can use setEmptyText instead of this
        enterDefaultText();
    }else{
        PostMsg msg;
        uint32_t token;

        RsGxsId author = _idChooser->getSelectedId();
        if(author.isNull()){
            return;
        }
        msg.mMeta.mAuthorId = author;

        RsGxsGroupId targetWall = _wallChooser->getSelectedWallId();
        if(targetWall.isNull()){
            return;
        }
        // this is a trick:
        // use the group id to signal the wall the post should appear on
        msg.mMeta.mGroupId = targetWall;

        // todo: circle
        msg.mPostText = text.toUTF8();
        rsWall->createPost(token, msg);
    }
}
void GxsChannelPostsWidget::toggleAutoDownload()
{
    RsGxsGroupId grpId = groupId();
    if (grpId.isNull()) {
        return;
    }

    bool autoDownload ;
    if(!rsGxsChannels->getChannelAutoDownload(grpId,autoDownload) || !rsGxsChannels->setChannelAutoDownload(grpId, !autoDownload))
    {
        std::cerr << "GxsChannelDialog::toggleAutoDownload() Auto Download failed to set";
        std::cerr << std::endl;
    }
}
Example #3
0
void GxsChannelDialog::requestGroupData(const RsGxsGroupId &grpId)
{
#ifdef DEBUG_CHANNEL
	std::cerr << "GxsChannelDialog::requestGroupData()";
	std::cerr << std::endl;
#endif

	mChannelQueue->cancelActiveRequestTokens(TOKEN_TYPE_GROUP_DATA);

	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);

	RsTokReqOptions opts;
	opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;

	uint32_t token;
	mChannelQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds, TOKEN_TYPE_GROUP_DATA);
}
Example #4
0
void GxsChannelDialog::requestPosts(const RsGxsGroupId &grpId)
{
#ifdef DEBUG_CHANNEL
	std::cerr << "GxsChannelDialog::requestPosts()";
	std::cerr << std::endl;
#endif

	/* replace all the messages with new ones */
	QList<GxsChannelPostItem *>::iterator mit;
	for (mit = mChannelPostItems.begin(); mit != mChannelPostItems.end(); mit++) {
		delete (*mit);
	}
	mChannelPostItems.clear();

	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);

	RsTokReqOptions opts;
	opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;

	uint32_t token;
	mChannelQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds, TOKEN_TYPE_POSTS);
}
Example #5
0
void IdDialog::editIdentity()
{
	QTreeWidgetItem *item = ui->idTreeWidget->currentItem();
	if (!item)
	{
#ifdef ID_DEBUG
		std::cerr << "IdDialog::editIdentity() Invalid item";
		std::cerr << std::endl;
#endif
		return;
	}

	RsGxsGroupId keyId = RsGxsGroupId(item->text(RSID_COL_KEYID).toStdString());
	if (keyId.isNull()) {
		return;
	}

	IdEditDialog dlg(this);
	dlg.setupExistingId(keyId);
	dlg.exec();
}