Removed Forums / Channels / Blogs stuff.

and made GUI recompile.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-initdev@6702 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2013-09-07 04:21:48 +00:00
parent 561cfcf189
commit 683e75aeef
84 changed files with 160 additions and 17419 deletions

View File

@ -1,927 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QMenu>
#include <QTimer>
#include <QFile>
#include <QStandardItemModel>
#include <QMessageBox>
#include <QFileDialog>
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <retroshare/rsfiles.h>
#include "ChannelFeed.h"
#include "feeds/ChanMsgItem.h"
#include "common/PopularityDefs.h"
#include "settings/rsharesettings.h"
#include "channels/CreateChannel.h"
#include "channels/ChannelDetails.h"
#include "channels/CreateChannelMsg.h"
#include "channels/EditChanDetails.h"
#include "channels/ShareKey.h"
#include "channels/ChannelUserNotify.h"
#include "notifyqt.h"
#include "RetroShareLink.h"
#define CHAN_DEFAULT_IMAGE ":/images/channels.png"
#define WARNING_LIMIT 3600*24*2
/* Images for TreeWidget */
#define IMAGE_CHANNELBLUE ":/images/channelsblue.png"
#define IMAGE_CHANNELGREEN ":/images/channelsgreen.png"
#define IMAGE_CHANNELRED ":/images/channelsred.png"
#define IMAGE_CHANNELYELLOW ":/images/channelsyellow.png"
/****
* #define CHAN_DEBUG
***/
#define USE_THREAD
/** Constructor */
ChannelFeed::ChannelFeed(QWidget *parent)
: RsAutoUpdatePage(1000,parent)
{
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
connect(postButton, SIGNAL(clicked()), this, SLOT(createMsg()));
connect(NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)));
/*************** Setup Left Hand Side (List of Channels) ****************/
connect(treeWidget, SIGNAL(treeCustomContextMenuRequested(QPoint)), this, SLOT( channelListCustomPopupMenu( QPoint ) ) );
connect(treeWidget, SIGNAL(treeCurrentItemChanged(QString)), this, SLOT(selectChannel(QString)));
mChannelId.clear();
/* Set initial size the splitter */
QList<int> sizes;
sizes << 300 << width(); // Qt calculates the right sizes
splitter->setSizes(sizes);
/* Initialize group tree */
QToolButton *newChannelButton = new QToolButton(this);
newChannelButton->setIcon(QIcon(":/images/add_channel24.png"));
newChannelButton->setToolTip(tr("Create Channel"));
connect(newChannelButton, SIGNAL(clicked()), this, SLOT(createChannel()));
treeWidget->addToolButton(newChannelButton);
ownChannels = treeWidget->addCategoryItem(tr("My Channels"), QIcon(IMAGE_CHANNELBLUE), true);
subcribedChannels = treeWidget->addCategoryItem(tr("Subscribed Channels"), QIcon(IMAGE_CHANNELRED), true);
popularChannels = treeWidget->addCategoryItem(tr("Popular Channels"), QIcon(IMAGE_CHANNELGREEN ), false);
otherChannels = treeWidget->addCategoryItem(tr("Other Channels"), QIcon(IMAGE_CHANNELYELLOW), false);
progressLabel->hide();
progressBar->hide();
fillThread = NULL;
//added from ahead
updateChannelList();
nameLabel->setMinimumWidth(20);
/* load settings */
processSettings(true);
updateChannelMsgs();
QString help_str = tr(
" <h1><img width=\"32\" src=\":/images/64px_help.png\">&nbsp;&nbsp;Channels</h1> \
<p>Channels allow you to post data (e.g. movies, music) that will spread in the network \
among people who subscribed your channel. If you activate auto-download on a channel, files attached to each post will start \
downloading automatically when the post is received.</p> \
<p>You see channels your friends are subscribed to, and forward subscribed channels to \
your friends. This promotes good channels in the network. \
When you first connect to a new friend, it's likely \
you will receive many such cache files, and new channels will appear. \
</p> \
<p>Only the channel's creator can post on that channel. Other peers \
in the network can only read from it, unless the channel is private. You can however share the posting rights or the reading rights \
with your friends.</p> \
") ;
registerHelpButton(helpButton,help_str) ;
}
ChannelFeed::~ChannelFeed()
{
if (fillThread) {
fillThread->stop();
delete(fillThread);
fillThread = NULL;
}
// save settings
processSettings(false);
}
UserNotify *ChannelFeed::getUserNotify(QObject *parent)
{
return new ChannelUserNotify(parent);
}
void ChannelFeed::processSettings(bool load)
{
Settings->beginGroup(QString("ChannelFeed"));
if (load) {
// load settings
// state of splitter
splitter->restoreState(Settings->value("Splitter").toByteArray());
} else {
// save settings
// state of splitter
Settings->setValue("Splitter", splitter->saveState());
}
treeWidget->processSettings(Settings, load);
Settings->endGroup();
}
void ChannelFeed::channelListCustomPopupMenu( QPoint /*point*/ )
{
ChannelInfo ci;
if (!rsChannels->getChannelInfo(mChannelId, ci)) {
return;
}
QMenu contextMnu(this);
QAction *postchannelAct = new QAction(QIcon(":/images/mail_reply.png"), tr( "Post to Channel" ), &contextMnu);
connect( postchannelAct , SIGNAL( triggered() ), this, SLOT( createMsg() ) );
QAction *subscribechannelAct = new QAction(QIcon(":/images/edit_add24.png"), tr( "Subscribe to Channel" ), &contextMnu);
connect( subscribechannelAct , SIGNAL( triggered() ), this, SLOT( subscribeChannel() ) );
QAction *unsubscribechannelAct = new QAction(QIcon(":/images/cancel.png"), tr( "Unsubscribe to Channel" ), &contextMnu);
connect( unsubscribechannelAct , SIGNAL( triggered() ), this, SLOT( unsubscribeChannel() ) );
QAction *setallasreadchannelAct = new QAction(QIcon(":/images/message-mail-read.png"), tr( "Set all as read" ), &contextMnu);
connect( setallasreadchannelAct , SIGNAL( triggered() ), this, SLOT( setAllAsReadClicked() ) );
bool autoDl = false;
rsChannels->channelGetAutoDl(mChannelId, autoDl);
QAction *autochannelAct = autoDl? (new QAction(QIcon(":/images/redled.png"), tr( "Disable Auto-Download" ), &contextMnu))
: (new QAction(QIcon(":/images/start.png"),tr( "Enable Auto-Download" ), &contextMnu)) ;
connect( autochannelAct , SIGNAL( triggered() ), this, SLOT( toggleAutoDownload() ) );
QAction *channeldetailsAct = new QAction(QIcon(":/images/info16.png"), tr( "Show Channel Details" ), &contextMnu);
connect( channeldetailsAct , SIGNAL( triggered() ), this, SLOT( showChannelDetails() ) );
QAction *restoreKeysAct = new QAction(QIcon(":/images/settings16.png"), tr("Restore Publish Rights for Channel" ), &contextMnu);
connect( restoreKeysAct , SIGNAL( triggered() ), this, SLOT( restoreChannelKeys() ) );
QAction *editChannelDetailAct = new QAction(QIcon(":/images/edit_16.png"), tr("Edit Channel Details"), &contextMnu);
connect( editChannelDetailAct, SIGNAL( triggered() ), this, SLOT( editChannelDetail() ) );
QAction *shareKeyAct = new QAction(QIcon(":/images/gpgp_key_generate.png"), tr("Share Channel"), &contextMnu);
connect( shareKeyAct, SIGNAL( triggered() ), this, SLOT( shareKey() ) );
if((ci.channelFlags & RS_DISTRIB_ADMIN) && (ci.channelFlags & RS_DISTRIB_SUBSCRIBED))
contextMnu.addAction( editChannelDetailAct);
else
contextMnu.addAction( channeldetailsAct );
if((ci.channelFlags & RS_DISTRIB_PUBLISH) && (ci.channelFlags & RS_DISTRIB_SUBSCRIBED))
{
contextMnu.addAction( postchannelAct );
contextMnu.addAction( shareKeyAct );
}
if(ci.channelFlags & RS_DISTRIB_SUBSCRIBED)
{
QMenu *directoryMenu = contextMnu.addMenu(QIcon(":/images/folderopen.png"),tr("Set destination directory")) ;
QAction *specifyDestinationDirectoryAct = new QAction(QIcon(":/images/filefind.png"), tr("Other..."), &contextMnu);
directoryMenu->addAction(specifyDestinationDirectoryAct);
connect(specifyDestinationDirectoryAct,SIGNAL(triggered()),this,SLOT(chooseDestinationDirectory())) ;
// Now get the list of existing directories.
std::list<SharedDirInfo> dirs ;
rsFiles->getSharedDirectories(dirs) ;
bool found = false ;
for(std::list<SharedDirInfo>::const_iterator it(dirs.begin());it!=dirs.end();++it)
{
// check for existence of directory name
QFile directory(QString::fromUtf8((*it).filename.c_str())) ;
if(!directory.exists()) continue ;
if(!(directory.permissions() & QFile::WriteOwner)) continue ;
QAction *act ;
if(ci.destination_directory == (*it).filename)
{
act = new QAction(QIcon(":/images/start.png"),QString::fromUtf8((*it).virtualname.c_str()),directoryMenu) ;
found = true ;
}
else
act = new QAction(QString::fromUtf8((*it).virtualname.c_str()),directoryMenu) ;
act->setData(QString::fromUtf8((*it).filename.c_str())) ;
connect(act,SIGNAL(triggered()),this,SLOT(setDestinationDirectory())) ;
directoryMenu->addAction(act) ;
}
QAction *defaultDestinationDirectoryAct = new QAction(tr("[Default]"), &contextMnu);
defaultDestinationDirectoryAct->setData(QString()) ;
connect(defaultDestinationDirectoryAct,SIGNAL(triggered()),this,SLOT(setDestinationDirectory())) ;
directoryMenu->addAction(defaultDestinationDirectoryAct);
if(ci.destination_directory.empty())
defaultDestinationDirectoryAct->setIcon(QIcon(":/images/start.png")) ;
else if(!found)
specifyDestinationDirectoryAct->setIcon(QIcon(":/images/start.png")) ;
}
if(ci.channelFlags & RS_DISTRIB_SUBSCRIBED)
{
contextMnu.addAction( unsubscribechannelAct );
contextMnu.addAction( restoreKeysAct );
contextMnu.addSeparator();
contextMnu.addAction( autochannelAct );
contextMnu.addAction( setallasreadchannelAct );
}
else
contextMnu.addAction( subscribechannelAct );
contextMnu.addSeparator();
QAction *action = contextMnu.addAction(QIcon(":/images/copyrslink.png"), tr("Copy RetroShare Link"), this, SLOT(copyChannelLink()));
action->setEnabled(!mChannelId.empty());
#ifdef CHAN_DEBUG
contextMnu.addSeparator();
action = contextMnu.addAction("Generate mass data", this, SLOT(generateMassData()));
action->setEnabled (!mChannelId.empty() && (ci.channelFlags & RS_DISTRIB_PUBLISH));
#endif
contextMnu.exec(QCursor::pos());
}
void ChannelFeed::setDestinationDirectory()
{
ChannelInfo ci;
if (!rsChannels->getChannelInfo(mChannelId, ci))
return;
std::string dest_dir(qobject_cast<QAction*>(sender())->data().toString().toUtf8().data()) ;
std::cerr << "Setting new directory " << dest_dir << " to channel " << mChannelId << std::endl;
rsChannels->channelSetDestinationDirectory(mChannelId,dest_dir) ;
}
void ChannelFeed::chooseDestinationDirectory()
{
ChannelInfo ci;
if (!rsChannels->getChannelInfo(mChannelId, ci))
return;
QString dirname = QFileDialog::getExistingDirectory(NULL,tr("Select channel destination directory"),QString::fromStdString(ci.destination_directory),QFileDialog::ShowDirsOnly) ;
if(dirname.isNull())
return ;
std::cerr << "Setting new directory " << dirname.toStdString() << " to channel " << mChannelId << std::endl;
rsChannels->channelSetDestinationDirectory(mChannelId,dirname.toStdString()) ;
}
void ChannelFeed::createChannel()
{
CreateChannel *cf = new CreateChannel();
cf->show();
/* window will destroy itself! */
}
/*************************************************************************************/
/*************************************************************************************/
/*************************************************************************************/
QScrollArea *ChannelFeed::getScrollArea()
{
return scrollArea;
}
void ChannelFeed::deleteFeedItem(QWidget */*item*/, uint32_t /*type*/)
{
}
void ChannelFeed::openChat(std::string /*peerId*/)
{
}
void ChannelFeed::openComments(uint32_t /*type*/ , const RsGxsGroupId & /*grpId */, const RsGxsMessageId & /*msgId*/, const QString & /* title */)
{
}
void ChannelFeed::editChannelDetail(){
EditChanDetails editUi(this, mChannelId);
editUi.exec();
}
void ChannelFeed::shareKey()
{
ShareKey shareUi(this, mChannelId, CHANNEL_KEY_SHARE);
shareUi.exec();
}
void ChannelFeed::copyChannelLink()
{
if (mChannelId.empty()) {
return;
}
ChannelInfo ci;
if (rsChannels->getChannelInfo(mChannelId, ci)) {
RetroShareLink link;
if (link.createChannel(ci.channelId, "")) {
QList<RetroShareLink> urls;
urls.push_back(link);
RSLinkClipboard::copyLinks(urls);
}
}
}
void ChannelFeed::createMsg()
{
if (mChannelId.empty()) {
return;
}
CreateChannelMsg *msgDialog = new CreateChannelMsg(mChannelId);
msgDialog->show();
/* window will destroy itself! */
}
void ChannelFeed::restoreChannelKeys()
{
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.")) ;
}
void ChannelFeed::selectChannel(const QString &id)
{
mChannelId = id.toStdString();
bool autoDl = false;
rsChannels->channelGetAutoDl(mChannelId, autoDl);
setAutoDownloadButton(autoDl);
updateChannelMsgs();
}
void ChannelFeed::updateDisplay()
{
if (!rsChannels) {
return;
}
std::list<std::string> chanIds;
std::list<std::string>::iterator it;
if (rsChannels->channelsChanged(chanIds)) {
/* update channel list */
updateChannelList();
it = std::find(chanIds.begin(), chanIds.end(), mChannelId);
if (it != chanIds.end()) {
updateChannelMsgs();
}
}
}
static void channelInfoToGroupItemInfo(const ChannelInfo &channelInfo, GroupItemInfo &groupItemInfo)
{
groupItemInfo.id = QString::fromStdString(channelInfo.channelId);
groupItemInfo.name = QString::fromStdWString(channelInfo.channelName);
groupItemInfo.description = QString::fromStdWString(channelInfo.channelDesc);
groupItemInfo.popularity = channelInfo.pop;
groupItemInfo.lastpost = QDateTime::fromTime_t(channelInfo.lastPost);
QPixmap chanImage;
if (channelInfo.pngImageLen) {
chanImage.loadFromData(channelInfo.pngChanImage, channelInfo.pngImageLen, "PNG");
} else {
chanImage = QPixmap(CHAN_DEFAULT_IMAGE);
}
groupItemInfo.icon = QIcon(chanImage);
}
void ChannelFeed::updateChannelList()
{
if (!rsChannels) {
return;
}
std::list<ChannelInfo> channelList;
std::list<ChannelInfo>::iterator it;
rsChannels->getChannelList(channelList);
std::list<std::string> keysAvailable;
std::list<std::string>::iterator keyIt;
rsChannels->getPubKeysAvailableGrpIds(keysAvailable);
/* get the ids for our lists */
QList<GroupItemInfo> adminList;
QList<GroupItemInfo> subList;
QList<GroupItemInfo> popList;
QList<GroupItemInfo> otherList;
std::multimap<uint32_t, GroupItemInfo> popMap;
for(it = channelList.begin(); it != channelList.end(); it++) {
/* sort it into Publish (Own), Subscribed, Popular and Other */
uint32_t flags = it->channelFlags;
GroupItemInfo groupItemInfo;
channelInfoToGroupItemInfo(*it, groupItemInfo);
if ((flags & RS_DISTRIB_ADMIN) && (flags & RS_DISTRIB_PUBLISH) && (flags & RS_DISTRIB_SUBSCRIBED)) {
adminList.push_back(groupItemInfo);
} else {
for (keyIt = keysAvailable.begin(); keyIt != keysAvailable.end(); keyIt++) {
if (it->channelId == *keyIt) {
/* Found Key, set title text to bold and colored blue */
groupItemInfo.privatekey = true;
break;
}
}
if ((flags & RS_DISTRIB_SUBSCRIBED) || ((flags & RS_DISTRIB_SUBSCRIBED) && (flags & RS_DISTRIB_PUBLISH)) ) {
subList.push_back(groupItemInfo);
} else {
/* rate the others by popularity */
popMap.insert(std::make_pair(it->pop, groupItemInfo));
}
}
}
/* iterate backwards through popMap - take the top 5 or 10% of list */
uint32_t popCount = 5;
if (popCount < popMap.size() / 10) {
popCount = popMap.size() / 10;
}
uint32_t i = 0;
std::multimap<uint32_t, GroupItemInfo>::reverse_iterator rit;
for (rit = popMap.rbegin(); rit != popMap.rend(); rit++) {
if (i < popCount) {
popList.push_back(rit->second);
i++;
} else {
otherList.push_back(rit->second);
}
}
/* now we have our lists ---> update entries */
treeWidget->fillGroupItems(ownChannels, adminList);
treeWidget->fillGroupItems(subcribedChannels, subList);
treeWidget->fillGroupItems(popularChannels, popList);
treeWidget->fillGroupItems(otherChannels, otherList);
updateMessageSummaryList("");
}
void ChannelFeed::channelMsgReadSatusChanged(const QString& channelId, const QString& /*msgId*/, int /*status*/)
{
updateMessageSummaryList(channelId.toStdString());
}
void ChannelFeed::updateMessageSummaryList(const std::string &channelId)
{
QTreeWidgetItem *items[2] = { ownChannels, subcribedChannels };
for (int item = 0; item < 2; item++) {
int child;
int childCount = items[item]->childCount();
for (child = 0; child < childCount; child++) {
QTreeWidgetItem *childItem = items[item]->child(child);
std::string childId = treeWidget->itemId(childItem).toStdString();
if (childId.empty()) {
continue;
}
if (channelId.empty() || childId == channelId) {
/* Calculate unread messages */
unsigned int newMessageCount = 0;
unsigned int unreadMessageCount = 0;
rsChannels->getMessageCount(childId, newMessageCount, unreadMessageCount);
treeWidget->setUnreadCount(childItem, unreadMessageCount);
if (channelId.empty() == false) {
/* Calculate only this channel */
break;
}
}
}
}
}
static bool sortChannelMsgSummary(const ChannelMsgSummary &msg1, const ChannelMsgSummary &msg2)
{
return (msg1.ts > msg2.ts);
}
void ChannelFeed::updateChannelMsgs()
{
if (fillThread) {
#ifdef CHAN_DEBUG
std::cerr << "ChannelFeed::updateChannelMsgs() stop current fill thread" << std::endl;
#endif
// stop current fill thread
ChannelFillThread *thread = fillThread;
fillThread = NULL;
thread->stop();
delete(thread);
progressLabel->hide();
progressBar->hide();
}
if (!rsChannels) {
return;
}
/* replace all the messages with new ones */
QList<ChanMsgItem *>::iterator mit;
for (mit = mChanMsgItems.begin(); mit != mChanMsgItems.end(); mit++) {
delete (*mit);
}
mChanMsgItems.clear();
ChannelInfo ci;
if (!rsChannels->getChannelInfo(mChannelId, ci)) {
postButton->setEnabled(false);
nameLabel->setText(tr("No Channel Selected"));
logoLabel->setPixmap(QPixmap(":/images/channels.png"));
logoLabel->setEnabled(false);
return;
}
QPixmap chanImage;
if (ci.pngImageLen != 0) {
chanImage.loadFromData(ci.pngChanImage, ci.pngImageLen, "PNG");
} else {
chanImage = QPixmap(CHAN_DEFAULT_IMAGE);
}
logoLabel->setPixmap(chanImage);
logoLabel->setEnabled(true);
/* set Channel name */
nameLabel->setText(QString::fromStdWString(ci.channelName));
if (ci.channelFlags & RS_DISTRIB_PUBLISH) {
postButton->setEnabled(true);
} else {
postButton->setEnabled(false);
}
if (ci.channelFlags & RS_DISTRIB_SUBSCRIBED) {
actionEnable_Auto_Download->setEnabled(true);
} else {
actionEnable_Auto_Download->setEnabled(false);
}
#ifdef USE_THREAD
progressLabel->show();
progressBar->reset();
progressBar->show();
// create fill thread
fillThread = new ChannelFillThread(this, mChannelId);
// connect thread
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
std::cerr << "ChannelFeed::updateChannelMsgs() Start fill thread" << std::endl;
#endif
// start thread
fillThread->start();
#else
std::list<ChannelMsgSummary> msgs;
std::list<ChannelMsgSummary>::iterator it;
rsChannels->getChannelMsgList(mChannelId, msgs);
msgs.sort(sortChannelMsgSummary);
for (it = msgs.begin(); it != msgs.end(); it++) {
ChanMsgItem *cmi = new ChanMsgItem(this, 0, mChannelId, it->msgId, true);
mChanMsgItems.push_back(cmi);
verticalLayout_2->addWidget(cmi);
}
#endif
}
void ChannelFeed::fillThreadFinished()
{
#ifdef CHAN_DEBUG
std::cerr << "ChannelFeed::fillThreadFinished()" << std::endl;
#endif
// thread has finished
ChannelFillThread *thread = dynamic_cast<ChannelFillThread*>(sender());
if (thread) {
if (thread == fillThread) {
// current thread has finished, hide progressbar and release thread
progressBar->hide();
progressLabel->hide();
fillThread = NULL;
}
#ifdef CHAN_DEBUG
if (thread->wasStopped()) {
// thread was stopped
std::cerr << "ChannelFeed::fillThreadFinished() Thread was stopped" << std::endl;
}
#endif
#ifdef CHAN_DEBUG
std::cerr << "ChannelFeed::fillThreadFinished() Delete thread" << std::endl;
#endif
thread->deleteLater();
thread = NULL;
}
#ifdef CHAN_DEBUG
std::cerr << "ChannelFeed::fillThreadFinished done()" << std::endl;
#endif
}
void ChannelFeed::fillThreadAddMsg(const QString &channelId, const QString &channelMsgId, int current, int count)
{
if (sender() == fillThread) {
// show fill progress
if (count) {
progressBar->setValue(current * progressBar->maximum() / count);
}
lockLayout(NULL, true);
ChanMsgItem *cmi = new ChanMsgItem(this, 0, channelId.toStdString(), channelMsgId.toStdString(), true);
mChanMsgItems.push_back(cmi);
verticalLayout->addWidget(cmi);
cmi->show();
lockLayout(cmi, false);
}
}
void ChannelFeed::unsubscribeChannel()
{
#ifdef CHAN_DEBUG
std::cerr << "ChannelFeed::unsubscribeChannel()";
std::cerr << std::endl;
#endif
if (rsChannels) {
rsChannels->channelSubscribe(mChannelId, false, false);
}
updateChannelMsgs();
}
void ChannelFeed::subscribeChannel()
{
#ifdef CHAN_DEBUG
std::cerr << "ChannelFeed::subscribeChannel()";
std::cerr << std::endl;
#endif
if (rsChannels) {
rsChannels->channelSubscribe(mChannelId, true, false);
}
updateChannelMsgs();
}
void ChannelFeed::showChannelDetails()
{
if (mChannelId.empty()) {
return;
}
if (!rsChannels) {
return;
}
ChannelDetails channelui (this);
channelui.showDetails(mChannelId);
channelui.exec();
}
void ChannelFeed::setAllAsReadClicked()
{
if (mChannelId.empty()) {
return;
}
if (!rsChannels) {
return;
}
ChannelInfo ci;
if (rsChannels->getChannelInfo(mChannelId, ci) == false) {
return;
}
if (ci.channelFlags & RS_DISTRIB_SUBSCRIBED) {
std::list<ChannelMsgSummary> msgs;
std::list<ChannelMsgSummary>::iterator it;
rsChannels->getChannelMsgList(mChannelId, msgs);
for(it = msgs.begin(); it != msgs.end(); it++) {
rsChannels->setMessageStatus(mChannelId, it->msgId, CHANNEL_MSG_STATUS_READ, CHANNEL_MSG_STATUS_READ | CHANNEL_MSG_STATUS_UNREAD_BY_USER);
}
}
}
void ChannelFeed::toggleAutoDownload(){
if(mChannelId.empty())
return;
bool autoDl = true;
if(rsChannels->channelGetAutoDl(mChannelId, autoDl)){
// if auto dl is set true, then set false
if(autoDl){
rsChannels->channelSetAutoDl(mChannelId, false);
}else{
rsChannels->channelSetAutoDl(mChannelId, true);
}
setAutoDownloadButton(!autoDl);
}
else{
std::cerr << "Auto Download failed to set"
<< std::endl;
}
}
bool ChannelFeed::navigate(const std::string& channelId, const std::string& msgId)
{
if (channelId.empty()) {
return false;
}
if (treeWidget->activateId(QString::fromStdString(channelId), msgId.empty()) == NULL) {
return false;
}
/* Messages are filled in selectChannel */
if (mChannelId != channelId) {
return false;
}
if (msgId.empty()) {
return true;
}
/* Search exisiting item */
QList<ChanMsgItem*>::iterator mit;
for (mit = mChanMsgItems.begin(); mit != mChanMsgItems.end(); mit++) {
ChanMsgItem *item = *mit;
if (item->msgId() == msgId) {
// the next two lines are necessary to calculate the layout of the widgets in the scroll area (maybe there is a better solution)
item->show();
QCoreApplication::processEvents();
scrollArea->ensureWidgetVisible(item, 0, 0);
return true;
}
}
return false;
}
void ChannelFeed::setAutoDownloadButton(bool autoDl)
{
if (autoDl) {
actionEnable_Auto_Download->setText(tr("Disable Auto-Download"));
}else{
actionEnable_Auto_Download->setText(tr("Enable Auto-Download"));
}
}
void ChannelFeed::generateMassData()
{
#ifdef CHAN_DEBUG
if (mChannelId.empty ()) {
return;
}
if (QMessageBox::question(this, "Generate mass data", "Do you really want to generate mass data ?", QMessageBox::Yes|QMessageBox::No, QMessageBox::No) == QMessageBox::No) {
return;
}
for (int thread = 1; thread < 1000; thread++) {
ChannelMsgInfo msgInfo;
msgInfo.channelId = mChannelId;
msgInfo.subject = QString("Test %1").arg(thread, 3, 10, QChar('0')).toStdWString();
msgInfo.msg = QString("That is only a test").toStdWString();
if (rsChannels->ChannelMessageSend(msgInfo) == false) {
return;
}
}
#endif
}
// ForumsFillThread
ChannelFillThread::ChannelFillThread(ChannelFeed *parent, const std::string &channelId)
: QThread(parent)
{
stopped = false;
this->channelId = channelId;
}
ChannelFillThread::~ChannelFillThread()
{
#ifdef CHAN_DEBUG
std::cerr << "ChannelFillThread::~ChannelFillThread" << std::endl;
#endif
}
void ChannelFillThread::stop()
{
disconnect();
stopped = true;
QApplication::processEvents();
wait();
}
void ChannelFillThread::run()
{
#ifdef CHAN_DEBUG
std::cerr << "ChannelFillThread::run()" << std::endl;
#endif
std::list<ChannelMsgSummary> msgs;
std::list<ChannelMsgSummary>::iterator it;
rsChannels->getChannelMsgList(channelId, msgs);
msgs.sort(sortChannelMsgSummary);
int count = msgs.size();
int pos = 0;
for (it = msgs.begin(); it != msgs.end(); it++) {
if (stopped) {
break;
}
emit addMsg(QString::fromStdString(channelId), QString::fromStdString(it->msgId), ++pos, count);
}
#ifdef CHAN_DEBUG
std::cerr << "ChannelFillThread::run() stopped: " << (wasStopped() ? "yes" : "no") << std::endl;
#endif
}

View File

@ -1,139 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _CHANNEL_FEED_DIALOG_H
#define _CHANNEL_FEED_DIALOG_H
#include <retroshare/rschannels.h>
#include <QStandardItemModel>
#include <QThread>
#include <map>
#include "mainpage.h"
#include "RsAutoUpdatePage.h"
#include "ui_ChannelFeed.h"
#include "gui/feeds/FeedHolder.h"
class ChanMsgItem;
class QTreeWidgetItem;
class ChannelFillThread;
class ChannelFeed : public RsAutoUpdatePage, public FeedHolder, private Ui::ChannelFeed
{
Q_OBJECT
public:
/** Default Constructor */
ChannelFeed(QWidget *parent = 0);
/** Default Destructor */
~ChannelFeed();
virtual UserNotify *getUserNotify(QObject *parent);
/* FeedHolder */
virtual QScrollArea *getScrollArea();
virtual void deleteFeedItem(QWidget *item, uint32_t type);
virtual void openChat(std::string peerId);
virtual void openComments(uint32_t /*type*/ , const RsGxsGroupId & /*grpId */, const RsGxsMessageId & /*msgId*/, const QString & /*title */);
bool navigate(const std::string& channelId, const std::string& msgId);
/* overloaded from RsAuthUpdatePage */
virtual void updateDisplay();
private slots:
void channelListCustomPopupMenu( QPoint point );
void selectChannel(const QString &id);
void createChannel();
void subscribeChannel();
void unsubscribeChannel();
void setAllAsReadClicked();
void toggleAutoDownload();
void createMsg();
void showChannelDetails();
void restoreChannelKeys();
void editChannelDetail();
void shareKey();
void copyChannelLink();
void setDestinationDirectory();
void chooseDestinationDirectory();
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);
private:
void updateChannelList();
void updateChannelMsgs();
void updateMessageSummaryList(const std::string &channelId);
void processSettings(bool load);
void setAutoDownloadButton(bool autoDl);
std::string mChannelId; /* current Channel */
/* Layout Pointers */
QBoxLayout *mMsgLayout;
QList<ChanMsgItem *> mChanMsgItems;
std::map<std::string, uint32_t> mChanSearchScore; //chanId, score
QTreeWidgetItem *ownChannels;
QTreeWidgetItem *subcribedChannels;
QTreeWidgetItem *popularChannels;
QTreeWidgetItem *otherChannels;
ChannelFillThread *fillThread;
};
class ChannelFillThread : public QThread
{
Q_OBJECT
public:
ChannelFillThread(ChannelFeed *parent, const std::string &channelId);
~ChannelFillThread();
void run();
void stop();
bool wasStopped() { return stopped; }
signals:
void addMsg(const QString &channelId, const QString &channelMsgId, int current, int count);
public:
std::string channelId;
private:
volatile bool stopped;
};
#endif

View File

@ -1,314 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ChannelFeed</class>
<widget class="QWidget" name="ChannelFeed">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>681</width>
<height>476</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QFrame" name="titleBarFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="titleBarPixmap">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="images.qrc">:/images/channels32.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="titleBarLabel">
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Channels</string>
</property>
</widget>
</item>
<item>
<spacer name="spacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="helpButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/64px_help.png</normaloff>:/images/64px_help.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="GroupTreeWidget" name="treeWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QFrame" name="headFrame">
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="margin">
<number>4</number>
</property>
<item>
<widget class="QLabel" name="logoLabel">
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="images.qrc">:/images/channels.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="nameLabel">
<property name="palette">
<palette>
<active/>
<inactive/>
<disabled/>
</palette>
</property>
<property name="font">
<font>
<pointsize>21</pointsize>
</font>
</property>
<property name="text">
<string notr="true">Channel Name</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="toolBarFrame">
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="margin">
<number>2</number>
</property>
<item>
<widget class="QToolButton" name="postButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Post to Channel</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/mail_send.png</normaloff>:/images/mail_send.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>16</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>314</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="progressLayout">
<item>
<widget class="QLabel" name="progressLabel">
<property name="text">
<string>Loading</string>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>513</width>
<height>16</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
<action name="actionsetAllAsRead">
<property name="text">
<string>Set all as read</string>
</property>
<property name="toolTip">
<string>Set all as read</string>
</property>
</action>
<action name="actionEnable_Auto_Download">
<property name="text">
<string>Enable Auto-Download</string>
</property>
<property name="toolTip">
<string>Enable Auto-Download</string>
</property>
</action>
<zorder>splitter</zorder>
<zorder>titleBarFrame</zorder>
</widget>
<customwidgets>
<customwidget>
<class>GroupTreeWidget</class>
<extends>QWidget</extends>
<header>gui/common/GroupTreeWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -222,7 +222,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
case COLUMN_LASTDL:
qi64Value = index.data().value<qint64>();
if (qi64Value < std::numeric_limits<qint64>::max()){
QDateTime qdtLastDL = QDateTime::fromTime_t(qi64Value/1000);
QDateTime qdtLastDL = QDateTime::fromTime_t(qi64Value);
painter->drawText(option.rect, Qt::AlignCenter, qdtLastDL.toString("yyyy-MM-dd_hh:mm:ss"));
} else {
painter->drawText(option.rect, Qt::AlignCenter, tr("File Never Seen"));

View File

@ -945,7 +945,7 @@ int TransfersDialog::addItem(int row, const FileInfo &fileInfo, const std::map<s
}
/*Get Last Access on File */
if (file.exists()) {
qi64LastDL = file.lastModified().toMSecsSinceEpoch();
qi64LastDL = file.lastModified().toTime_t();
}
}
QString strPath = QString::fromUtf8(fileInfo.path.c_str());

File diff suppressed because it is too large Load Diff

View File

@ -1,214 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _FORUMSDIALOG_H
#define _FORUMSDIALOG_H
#include <QThread>
#include "mainpage.h"
#include "RsAutoUpdatePage.h"
#include "ui_ForumsDialog.h"
class ForumInfo;
class ForumsFillThread;
class ForumMsgInfo;
class RSTreeWidgetItemCompareRole;
class ForumsDialog : public RsAutoUpdatePage
{
Q_OBJECT
Q_PROPERTY(QColor textColorRead READ textColorRead WRITE setTextColorRead)
Q_PROPERTY(QColor textColorUnread READ textColorUnread WRITE setTextColorUnread)
Q_PROPERTY(QColor textColorUnreadChildren READ textColorUnreadChildren WRITE setTextColorUnreadChildren)
Q_PROPERTY(QColor textColorNotSubscribed READ textColorNotSubscribed WRITE setTextColorNotSubscribed)
Q_PROPERTY(QColor textColorMissing READ textColorMissing WRITE setTextColorMissing)
public:
ForumsDialog(QWidget *parent = 0);
~ForumsDialog();
virtual UserNotify *getUserNotify(QObject *parent);
bool navigate(const std::string& forumId, const std::string& msgId);
/* overloaded from RsAuthUpdatePage */
virtual void updateDisplay();
static QString titleFromInfo(ForumMsgInfo &msgInfo);
static QString messageFromInfo(ForumMsgInfo &msgInfo);
QColor textColorRead() const { return mTextColorRead; }
QColor textColorUnread() const { return mTextColorUnread; }
QColor textColorUnreadChildren() const { return mTextColorUnreadChildren; }
QColor textColorNotSubscribed() const { return mTextColorNotSubscribed; }
QColor textColorMissing() const { return mTextColorMissing; }
void setTextColorRead(QColor color) { mTextColorRead = color; }
void setTextColorUnread(QColor color) { mTextColorUnread = color; }
void setTextColorUnreadChildren(QColor color) { mTextColorUnreadChildren = color; }
void setTextColorNotSubscribed(QColor color) { mTextColorNotSubscribed = color; }
void setTextColorMissing(QColor color) { mTextColorMissing = color; }
protected:
bool eventFilter(QObject *obj, QEvent *ev);
void changeEvent(QEvent *e);
private slots:
/** Create the context popup menu and it's submenus */
void forumListCustomPopupMenu( QPoint point );
void threadListCustomPopupMenu( QPoint point );
void restoreForumKeys();
void newforum();
void changedForum(const QString &id);
void changedThread();
void clickedThread (QTreeWidgetItem *item, int column);
void forumMsgReadSatusChanged(const QString &forumId, const QString &msgId, int status);
void replytomessage();
//void print();
//void printpreview();
//void removemessage();
void markMsgAsRead();
void markMsgAsReadChildren();
void markMsgAsReadAll();
void markMsgAsUnread();
void markMsgAsUnreadAll();
void markMsgAsUnreadChildren();
void copyForumLink();
void copyMessageLink();
/* handle splitter */
void togglethreadview();
void createthread();
void createmessage();
void subscribeToForum();
void unsubscribeToForum();
void showForumDetails();
void editForumDetails();
void previousMessage ();
void nextMessage ();
void nextUnreadMessage();
void downloadAllFiles();
void changedViewBox();
void filterColumnChanged(int column);
void filterItems(const QString &text);
void generateMassData();
void fillThreadFinished();
void fillThreadProgress(int current, int count);
void shareKey();
private:
void insertForums();
void insertThreads();
void insertPost();
void updateMessageSummaryList(std::string forumId);
void forumInfoToGroupItemInfo(const ForumInfo &forumInfo, GroupItemInfo &groupItemInfo);
void forumSubscribe(bool subscribe);
void FillThreads(QList<QTreeWidgetItem *> &ThreadList, bool bExpandNewMessages, QList<QTreeWidgetItem*> &itemToExpand);
void FillChildren(QTreeWidgetItem *Parent, QTreeWidgetItem *NewParent, bool bExpandNewMessages, QList<QTreeWidgetItem*> &itemToExpand);
int getSelectedMsgCount(QList<QTreeWidgetItem*> *pRows, QList<QTreeWidgetItem*> *pRowsRead, QList<QTreeWidgetItem*> *pRowsUnread);
void setMsgAsReadUnread(QList<QTreeWidgetItem*> &Rows, bool bRead);
void markMsgAsReadUnread(bool bRead, bool bChildren, bool bForum);
void CalculateIconsAndFonts(QTreeWidgetItem *pItem = NULL);
void CalculateIconsAndFonts(QTreeWidgetItem *pItem, bool &bHasReadChilddren, bool &bHasUnreadChilddren);
void processSettings(bool bLoad);
void togglethreadview_internal();
bool filterItem(QTreeWidgetItem *pItem, const QString &text, int filterColumn);
bool m_bProcessSettings;
bool inMsgAsReadUnread;
QTreeWidgetItem *yourForums;
QTreeWidgetItem *subscribedForums;
QTreeWidgetItem *popularForums;
QTreeWidgetItem *otherForums;
RSTreeWidgetItemCompareRole *threadCompareRole;
std::string mCurrForumId;
std::string mCurrThreadId;
int subscribeFlags;
int lastViewType;
std::string lastForumID;
ForumsFillThread *fillThread;
/* Color definitions (for standard see qss.default) */
QColor mTextColorRead;
QColor mTextColorUnread;
QColor mTextColorUnreadChildren;
QColor mTextColorNotSubscribed;
QColor mTextColorMissing;
/** Qt Designer generated object */
Ui::ForumsDialog ui;
};
class ForumsFillThread : public QThread
{
Q_OBJECT
public:
ForumsFillThread(ForumsDialog *parent);
~ForumsFillThread();
void run();
void stop();
bool wasStopped() { return stopped; }
signals:
void progress(int current, int count);
public:
std::string forumId;
int filterColumn;
int subscribeFlags;
bool fillComplete;
int viewType;
bool expandNewMessages;
std::string focusMsgId;
RSTreeWidgetItemCompareRole *compareRole;
QList<QTreeWidgetItem*> items;
QList<QTreeWidgetItem*> itemToExpand;
private:
volatile bool stopped;
};
#endif

View File

@ -1,591 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ForumsDialog</class>
<widget class="QWidget" name="ForumsDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>769</width>
<height>519</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QFrame" name="titleBarFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="margin">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="titleBarPixmap">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="images.qrc">:/images/konversation.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="titleBarLabel">
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Forums</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>123</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="helpButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/64px_help.png</normaloff>:/images/64px_help.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="GroupTreeWidget" name="forumTreeWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QSplitter" name="threadSplitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QWidget" name="layoutWidget">
<layout class="QGridLayout">
<item row="1" column="0">
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="label_17">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Forum:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="forumName">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="viewBox">
<item>
<property name="text">
<string>Last Post</string>
</property>
</item>
<item>
<property name="text">
<string>Threaded View</string>
</property>
</item>
<item>
<property name="text">
<string>Flat View</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QTreeWidget" name="threadTreeWidget">
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Title</string>
</property>
</column>
<column>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/message-state-header.png</normaloff>:/images/message-state-header.png</iconset>
</property>
</column>
<column>
<property name="text">
<string>Date</string>
</property>
</column>
<column>
<property name="text">
<string>Author</string>
</property>
</column>
<column>
<property name="text">
<string>Signed</string>
</property>
</column>
</widget>
</item>
<item row="5" column="0">
<layout class="QGridLayout">
<item row="0" column="1">
<widget class="QLabel" name="threadlabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Thread:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="threadTitle">
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="previousButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Previous Thread</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/back.png</normaloff>:/images/back.png</iconset>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QPushButton" name="nextButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Next Thread</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/forward.png</normaloff>:/images/forward.png</iconset>
</property>
</widget>
</item>
<item row="0" column="7">
<widget class="QPushButton" name="expandButton">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/edit_remove24.png</normaloff>:/images/edit_remove24.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="6">
<widget class="QPushButton" name="downloadButton">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Download all files</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/down.png</normaloff>:/images/down.png</iconset>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QPushButton" name="nextUnreadButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Next unread</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QFrame" name="toolBarFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="margin">
<number>2</number>
</property>
<item>
<widget class="QToolButton" name="newthreadButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Start new Thread for Selected Forum</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/mail_new.png</normaloff>:/images/mail_new.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>16</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="newmessageButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Reply Message</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/mail_reply.png</normaloff>:/images/mail_reply.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>16</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="LineEditClear" name="filterLineEdit"/>
</item>
</layout>
</widget>
</item>
<item row="4" column="0">
<layout class="QHBoxLayout" name="progressBarLayOut">
<item>
<widget class="QLabel" name="progLayOutTxt">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Loading</string>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>25</height>
</size>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="LinkTextBrowser" name="postText">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>10</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
</widget>
</widget>
</widget>
</item>
</layout>
<action name="actionPrint">
<property name="text">
<string>Print</string>
</property>
</action>
<action name="actionPrintPreview">
<property name="text">
<string>PrintPreview</string>
</property>
</action>
<zorder>splitter</zorder>
<zorder>titleBarFrame</zorder>
</widget>
<customwidgets>
<customwidget>
<class>GroupTreeWidget</class>
<extends>QWidget</extends>
<header>gui/common/GroupTreeWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>LineEditClear</class>
<extends>QLineEdit</extends>
<header location="global">gui/common/LineEditClear.h</header>
</customwidget>
<customwidget>
<class>LinkTextBrowser</class>
<extends>QTextBrowser</extends>
<header>gui/common/LinkTextBrowser.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -48,12 +48,12 @@
#include "NewsFeed.h"
#include "ShareManager.h"
#include "NetworkView.h"
#include "ForumsDialog.h"
//#include "ForumsDialog.h"
#include "FriendsDialog.h"
#include "ChatLobbyWidget.h"
#include "HelpDialog.h"
#include "AboutDialog.h"
#include "ChannelFeed.h"
//#include "ChannelFeed.h"
#include "bwgraph/bwgraph.h"
#include "help/browser/helpbrowser.h"
#include "chat/ChatDialog.h"
@ -87,8 +87,6 @@
#include <retroshare/rsiface.h>
#include <retroshare/rspeers.h>
#include <retroshare/rsfiles.h>
#include <retroshare/rsforums.h>
#include <retroshare/rschannels.h>
#include <retroshare/rsnotify.h>
#include "gui/connect/ConnectFriendWizard.h"
@ -267,17 +265,21 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
action = createPageAction(QIcon(IMAGE_MESSAGES), tr("Messages"), grp));
notify.push_back(QPair<MainPage*, QAction*>(messagesDialog, action));
#if 0
ui->stackPages->add(channelFeed = new ChannelFeed(ui->stackPages),
action = createPageAction(QIcon(IMAGE_CHANNELS), tr("Channels"), grp));
notify.push_back(QPair<MainPage*, QAction*>(channelFeed, action));
#endif
#ifdef BLOGS
ui->stackPages->add(blogsFeed = new BlogsDialog(ui->stackPages), createPageAction(QIcon(IMAGE_BLOGS), tr("Blogs"), grp));
#endif
#if 0
ui->stackPages->add(forumsDialog = new ForumsDialog(ui->stackPages),
action = createPageAction(QIcon(IMAGE_FORUMS), tr("Forums"), grp));
notify.push_back(QPair<MainPage*, QAction*>(forumsDialog, action));
#endif
std::cerr << "Looking for interfaces in existing plugins:" << std::endl;
for(int i = 0;i<rsPlugins->nbPlugins();++i)
@ -815,12 +817,14 @@ void SetForegroundWindowInternal(HWND hWnd)
case Messages:
_instance->ui->stackPages->setCurrentPage( _instance->messagesDialog );
break;
#if 0
case Channels:
_instance->ui->stackPages->setCurrentPage( _instance->channelFeed );
return true ;
case Forums:
_instance->ui->stackPages->setCurrentPage( _instance->forumsDialog );
return true ;
#endif
#ifdef BLOGS
case Blogs:
Page = _instance->blogsFeed;
@ -865,12 +869,14 @@ void SetForegroundWindowInternal(HWND hWnd)
return Links;
}
#endif
#if 0
if (page == _instance->channelFeed) {
return Channels;
}
if (page == _instance->forumsDialog) {
return Forums;
}
#endif
#ifdef BLOGS
if (page == _instance->blogsFeed) {
return Blogs;
@ -907,10 +913,12 @@ void SetForegroundWindowInternal(HWND hWnd)
case Links:
return _instance->linksDialog;
#endif
#if 0
case Channels:
return _instance->channelFeed;
case Forums:
return _instance->forumsDialog;
#endif
#ifdef BLOGS
case Blogs:
return _instance->blogsFeed;

View File

@ -41,7 +41,7 @@ class RatesStatus;
class DiscStatus;
class DHTStatus;
class HashingStatus;
class ForumsDialog;
//class ForumsDialog;
class FriendsDialog;
class ChatLobbyWidget;
class ChatDialog;
@ -52,7 +52,7 @@ class MessagesDialog;
class SharedFilesDialog;
class MessengerWindow;
class PluginsPage;
class ChannelFeed;
//class ChannelFeed;
class BandwidthGraph;
class MainPage;
class NewsFeed;
@ -84,8 +84,8 @@ public:
Transfers = 3, /** Transfers page. */
SharedDirectories = 4, /** Shared Directories page. */
Messages = 5, /** Messages page. */
Channels = 6, /** Channels page. */
Forums = 7, /** Forums page. */
// Channels = 6, /** Channels page. */
// Forums = 7, /** Forums page. */
Search = 8, /** Search page. */
#ifdef BLOGS
Blogs = 9, /** Blogs page. */
@ -129,8 +129,8 @@ public:
ChatLobbyWidget *chatLobbyDialog;
MessagesDialog *messagesDialog;
SharedFilesDialog *sharedfilesDialog;
ForumsDialog *forumsDialog;
ChannelFeed *channelFeed;
// ForumsDialog *forumsDialog;
// ChannelFeed *channelFeed;
Idle *idle;
#ifdef RS_USE_LINKS

View File

@ -25,15 +25,17 @@
#include <retroshare/rsnotify.h>
#include <retroshare/rspeers.h>
#include <retroshare/rschannels.h>
#include <retroshare/rsforums.h>
//#include <retroshare/rschannels.h>
//#include <retroshare/rsforums.h>
#include <retroshare/rsmsgs.h>
#include <retroshare/rsplugin.h>
#if 0
#include "feeds/ChanNewItem.h"
#include "feeds/ChanMsgItem.h"
#include "feeds/ForumNewItem.h"
#include "feeds/ForumMsgItem.h"
#endif
#include "settings/rsettingswin.h"
#ifdef BLOGS
@ -53,12 +55,16 @@
#include "common/FeedNotify.h"
const uint32_t NEWSFEED_PEERLIST = 0x0001;
#if 0
const uint32_t NEWSFEED_FORUMNEWLIST = 0x0002;
const uint32_t NEWSFEED_FORUMMSGLIST = 0x0003;
const uint32_t NEWSFEED_CHANNEWLIST = 0x0004;
const uint32_t NEWSFEED_CHANMSGLIST = 0x0005;
const uint32_t NEWSFEED_BLOGNEWLIST = 0x0006;
const uint32_t NEWSFEED_BLOGMSGLIST = 0x0007;
#endif
const uint32_t NEWSFEED_MESSAGELIST = 0x0008;
const uint32_t NEWSFEED_CHATMSGLIST = 0x0009;
const uint32_t NEWSFEED_SECLIST = 0x000a;
@ -164,6 +170,7 @@ void NewsFeed::updateDisplay()
addFeedItemSecurityUnknownOut(fi);
break;
#if 0
case RS_FEED_ITEM_CHAN_NEW:
if (flags & RS_FEED_TYPE_CHAN)
addFeedItemChanNew(fi);
@ -198,6 +205,7 @@ void NewsFeed::updateDisplay()
if (flags & RS_FEED_TYPE_BLOG)
addFeedItemBlogMsg(fi);
break;
#endif
case RS_FEED_ITEM_CHAT_NEW:
if (flags & RS_FEED_TYPE_CHAT)
@ -270,6 +278,7 @@ void NewsFeed::testFeeds(uint notifyFlags)
instance->addFeedItemSecurityUnknownOut(fi);
break;
#if 0
case RS_FEED_TYPE_CHAN:
{
std::list<ChannelInfo> channelList;
@ -385,6 +394,7 @@ void NewsFeed::testFeeds(uint notifyFlags)
// instance->addFeedItemBlogNew(fi);
// instance->addFeedItemBlogMsg(fi);
break;
#endif
case RS_FEED_TYPE_CHAT:
fi.mId1 = rsPeers->getOwnId();
@ -618,8 +628,10 @@ void NewsFeed::addFeedItemSecurityUnknownOut(RsFeedItem &fi)
#endif
}
#if 0
void NewsFeed::addFeedItemChanNew(RsFeedItem &fi)
{
/* make new widget */
ChanNewItem *cni = new ChanNewItem(this, NEWSFEED_CHANNEWLIST, fi.mId1, false, true);
@ -756,6 +768,8 @@ void NewsFeed::addFeedItemBlogMsg(RsFeedItem &fi)
#endif
}
#endif
void NewsFeed::addFeedItemChatNew(RsFeedItem &fi, bool addWithoutCheck)
{
#ifdef NEWS_DEBUG

View File

@ -80,6 +80,7 @@ private:
void addFeedItemSecurityUnknownIn(RsFeedItem &fi);
void addFeedItemSecurityUnknownOut(RsFeedItem &fi);
#if 0
void addFeedItemChanNew(RsFeedItem &fi);
void addFeedItemChanUpdate(RsFeedItem &fi);
void addFeedItemChanMsg(RsFeedItem &fi);
@ -88,6 +89,8 @@ private:
void addFeedItemForumMsg(RsFeedItem &fi);
void addFeedItemBlogNew(RsFeedItem &fi);
void addFeedItemBlogMsg(RsFeedItem &fi);
#endif
void addFeedItemChatNew(RsFeedItem &fi, bool addWithoutCheck);
void addFeedItemMessage(RsFeedItem &fi);
void addFeedItemFilesNew(RsFeedItem &fi);

View File

@ -30,8 +30,8 @@
#include "RetroShareLink.h"
#include "MainWindow.h"
#include "ForumsDialog.h"
#include "ChannelFeed.h"
//#include "ForumsDialog.h"
//#include "ChannelFeed.h"
#include "SearchDialog.h"
#include "msgs/MessageComposer.h"
#include "util/misc.h"
@ -44,8 +44,8 @@
#include <retroshare/rsfiles.h>
#include <retroshare/rsmsgs.h>
#include <retroshare/rspeers.h>
#include <retroshare/rsforums.h>
#include <retroshare/rschannels.h>
//#include <retroshare/rsforums.h>
//#include <retroshare/rschannels.h>
//#define DEBUG_RSLINK 1
@ -470,6 +470,7 @@ bool RetroShareLink::createForum(const std::string& id, const std::string& msgId
{
clear();
#if 0
if (!id.empty()) {
_hash = QString::fromStdString(id);
_msgId = QString::fromStdString(msgId);
@ -488,6 +489,7 @@ bool RetroShareLink::createForum(const std::string& id, const std::string& msgId
}
}
}
#endif
check();
@ -498,6 +500,7 @@ bool RetroShareLink::createChannel(const std::string& id, const std::string& msg
{
clear();
#if 0
if (!id.empty()) {
_hash = QString::fromStdString(id);
_msgId = QString::fromStdString(msgId);
@ -516,6 +519,7 @@ bool RetroShareLink::createChannel(const std::string& id, const std::string& msg
}
}
}
#endif
check();
@ -1365,6 +1369,7 @@ static void processList(const QStringList &list, const QString &textSingular, co
break;
}
#if 0
case TYPE_FORUM:
{
#ifdef DEBUG_RSLINK
@ -1456,6 +1461,7 @@ static void processList(const QStringList &list, const QString &textSingular, co
}
break;
}
#endif
case TYPE_SEARCH:
{

View File

@ -1,117 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2009 RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "ChannelDetails.h"
#include "util/DateTime.h"
#include <retroshare/rsiface.h>
#include <retroshare/rspeers.h>
#include <retroshare/rsdisc.h>
#include <retroshare/rschannels.h>
#include <QTime>
#include <QDateTime>
#include <list>
#include <iostream>
#include <string>
/** Default constructor */
ChannelDetails::ChannelDetails(QWidget *parent)
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
{
/* Invoke Qt Designer generated QObject setup routine */
ui.setupUi(this);
connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(close()));
ui.nameline ->setReadOnly(true);
ui.popline ->setReadOnly(true);
ui.postline ->setReadOnly(true);
ui.IDline ->setReadOnly(true);
ui.DescriptiontextEdit ->setReadOnly(true);
ui.typeEncrypted->setEnabled(false);
ui.typePrivate->setEnabled(false);
}
/**
Overloads the default show() slot so we can set opacity*/
void
ChannelDetails::show()
{
//loadSettings();
if(!this->isVisible()) {
QDialog::show();
}
}
void ChannelDetails::showDetails(std::string mChannelId)
{
cId = mChannelId;
loadChannel();
}
void ChannelDetails::loadChannel()
{
if (!rsChannels)
{
return;
}
uint32_t flags = 0;
ChannelInfo ci;
rsChannels->getChannelInfo(cId, ci);
flags = ci.channelFlags;
// Set Channel Name
ui.nameline->setText(QString::fromStdWString(ci.channelName));
// Set Channel Popularity
{
ui.popline -> setText(QString::number(ci.pop));
}
// Set Last Channel Post Date
if (ci.lastPost) {
ui.postline->setText(DateTime::formatLongDateTime(ci.lastPost));
}
// Set Channel ID
ui.IDline->setText(QString::fromStdString(ci.channelId));
// Set Channel Description
ui.DescriptiontextEdit->setText(QString::fromStdWString(ci.channelDesc));
if (flags |= RS_DISTRIB_PRIVATE)
{
ui.typeEncrypted->setChecked(false);
ui.typePrivate->setChecked(true);
}
else if (flags |= RS_DISTRIB_ENCRYPTED)
{
ui.typeEncrypted->setChecked(true);
ui.typePrivate->setChecked(false);
}
}

View File

@ -1,57 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2009 RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _CHANNELDETAILS_H
#define _CHANNELDETAILS_H
#include <QDialog>
#include "ui_ChannelDetails.h"
class ChannelDetails : public QDialog
{
Q_OBJECT
public:
/** Default constructor */
ChannelDetails(QWidget *parent = 0);
void showDetails(std::string mChannelId);
signals:
void configChanged() ;
public slots:
/** Overloaded QWidget.show */
void show();
private:
void loadChannel();
std::string cId;
/** Qt Designer generated object */
Ui::ChannelDetails ui;
};
#endif

View File

@ -1,148 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ChannelDetails</class>
<widget class="QDialog" name="ChannelDetails">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>455</width>
<height>408</height>
</rect>
</property>
<property name="windowTitle">
<string>Channel Details</string>
</property>
<property name="windowIcon">
<iconset resource="../images.qrc">
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QTabWidget" name="stabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/info16.png</normaloff>:/images/info16.png</iconset>
</attribute>
<attribute name="title">
<string>Channel Details</string>
</attribute>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Channel Info</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Channel Name</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="nameline"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Popularity</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="popline">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Last Post</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="postline">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Channel ID</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="IDline"/>
</item>
<item row="5" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Channel Description</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QTextEdit" name="DescriptiontextEdit"/>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Type</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QRadioButton" name="typePrivate">
<property name="text">
<string>Restricted - Anyone can read, limited publishing (Private Publish Key)</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="typeEncrypted">
<property name="text">
<string>Private - (Private Publish Key required to view Messages)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="_2">
<item row="0" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1,106 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2012 RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "ChannelUserNotify.h"
#include "gui/settings/rsharesettings.h"
#include "gui/notifyqt.h"
#include "gui/MainWindow.h"
#include <retroshare/rschannels.h>
ChannelUserNotify::ChannelUserNotify(QObject *parent) :
UserNotify(parent)
{
connect(NotifyQt::getInstance(), SIGNAL(channelsChanged(int)), this, SLOT(updateIcon()), Qt::QueuedConnection);
}
bool ChannelUserNotify::hasSetting(QString &name)
{
name = tr("Channel Post");
return true;
}
bool ChannelUserNotify::notifyEnabled()
{
return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_CHANNELS);
}
bool ChannelUserNotify::notifyCombined()
{
return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_CHANNELS_COMBINED);
}
bool ChannelUserNotify::notifyBlink()
{
return (Settings->getTrayNotifyBlinkFlags() & TRAYNOTIFY_BLINK_CHANNELS);
}
void ChannelUserNotify::setNotifyEnabled(bool enabled, bool combined, bool blink)
{
uint notifyFlags = Settings->getTrayNotifyFlags();
uint blinkFlags = Settings->getTrayNotifyBlinkFlags();
if (enabled) {
notifyFlags |= TRAYNOTIFY_CHANNELS;
} else {
notifyFlags &= ~TRAYNOTIFY_CHANNELS;
}
if (combined) {
notifyFlags |= TRAYNOTIFY_CHANNELS_COMBINED;
} else {
notifyFlags &= ~TRAYNOTIFY_CHANNELS_COMBINED;
}
if (blink) {
blinkFlags |= TRAYNOTIFY_BLINK_CHANNELS;
} else {
blinkFlags &= ~TRAYNOTIFY_BLINK_CHANNELS;
}
Settings->setTrayNotifyFlags(notifyFlags);
Settings->setTrayNotifyBlinkFlags(blinkFlags);
}
QIcon ChannelUserNotify::getIcon()
{
return QIcon(":/images/channels16.png");
}
QIcon ChannelUserNotify::getMainIcon(bool hasNew)
{
return hasNew ? QIcon(":/images/channels_new.png") : QIcon(":/images/channels.png");
}
unsigned int ChannelUserNotify::getNewCount()
{
unsigned int newMessageCount = 0;
unsigned int unreadMessageCount = 0;
rsChannels->getMessageCount("", newMessageCount, unreadMessageCount);
return newMessageCount;
}
void ChannelUserNotify::iconClicked()
{
MainWindow::showWindow(MainWindow::Channels);
}

View File

@ -1,47 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2012 RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef CHANNELUSERNOTIFY_H
#define CHANNELUSERNOTIFY_H
#include "gui/common/UserNotify.h"
class ChannelUserNotify : public UserNotify
{
Q_OBJECT
public:
ChannelUserNotify(QObject *parent = 0);
virtual bool hasSetting(QString &name);
virtual bool notifyEnabled();
virtual bool notifyCombined();
virtual bool notifyBlink();
virtual void setNotifyEnabled(bool enabled, bool combined, bool blink);
private:
virtual QIcon getIcon();
virtual QIcon getMainIcon(bool hasNew);
virtual unsigned int getNewCount();
virtual void iconClicked();
};
#endif // CHANNELUSERNOTIFY_H

View File

@ -1,151 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QMessageBox>
#include <QBuffer>
#include <algorithm>
#include "CreateChannel.h"
#include "gui/common/PeerDefs.h"
#include "util/misc.h"
#include <retroshare/rschannels.h>
#include <retroshare/rspeers.h>
/** Constructor */
CreateChannel::CreateChannel()
: QDialog(NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
setAttribute(Qt::WA_DeleteOnClose, true);
ui.headerFrame->setHeaderImage(QPixmap(":/images/add_channel64.png"));
ui.headerFrame->setHeaderText(tr("New Channel"));
picture = NULL;
// connect up the buttons.
connect( ui.buttonBox, SIGNAL(accepted()), this, SLOT(createChannel()));
connect( ui.buttonBox, SIGNAL(rejected()), this, SLOT(close()));
connect( ui.logoButton, SIGNAL(clicked() ), this , SLOT(addChannelLogo()));
connect( ui.pubKeyShare_cb, SIGNAL( clicked() ), this, SLOT( setShareList( ) ));
if (!ui.pubKeyShare_cb->isChecked()) {
ui.contactsdockWidget->hide();
this->resize(this->size().width() - ui.contactsdockWidget->size().width(), this->size().height());
}
/* initialize key share list */
ui.keyShareList->setHeaderText(tr("Contacts:"));
ui.keyShareList->setModus(FriendSelectionWidget::MODUS_CHECK);
ui.keyShareList->setShowType(FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_SSL);
ui.keyShareList->start();
newChannel();
}
void CreateChannel::setShareList(){
if (ui.pubKeyShare_cb->isChecked()){
this->resize(this->size().width() + ui.contactsdockWidget->size().width(), this->size().height());
ui.contactsdockWidget->show();
} else {
ui.contactsdockWidget->hide();
this->resize(this->size().width() - ui.contactsdockWidget->size().width(), this->size().height());
}
}
void CreateChannel::newChannel()
{
/* enforce Private for the moment */
ui.typePrivate->setChecked(true);
ui.typeEncrypted->setEnabled(true);
ui.msgAnon->setChecked(true);
ui.msgAuth->setEnabled(false);
ui.msgGroupBox->hide();
ui.channelName->setFocus();
}
void CreateChannel::createChannel()
{
QString name = misc::removeNewLine(ui.channelName->text());
QString desc = ui.channelDesc->toPlainText();
uint32_t flags = 0;
if (name.isEmpty()) {
/* error message */
QMessageBox::warning(this, "RetroShare", tr("Please add a Name"), QMessageBox::Ok, QMessageBox::Ok);
return; //Don't add a empty name!!
}
if (ui.typePrivate->isChecked()) {
flags |= RS_DISTRIB_PRIVATE;
} else if (ui.typeEncrypted->isChecked()) {
flags |= RS_DISTRIB_ENCRYPTED;
}
if (ui.msgAuth->isChecked()) {
flags |= RS_DISTRIB_AUTHEN_REQ;
} else if (ui.msgAnon->isChecked()) {
flags |= RS_DISTRIB_AUTHEN_ANON;
}
QByteArray ba;
QBuffer buffer(&ba);
if (!picture.isNull()) {
// send chan image
buffer.open(QIODevice::WriteOnly);
picture.save(&buffer, "PNG"); // writes image into ba in PNG format
}
if (rsChannels) {
std::string chId = rsChannels->createChannel(name.toStdWString(), desc.toStdWString(), flags, (unsigned char*)ba.data(), ba.size());
if (ui.pubKeyShare_cb->isChecked()) {
std::list<std::string> shareList;
ui.keyShareList->selectedSslIds(shareList, false);
rsChannels->channelShareKeys(chId, shareList);
}
}
close();
}
void CreateChannel::addChannelLogo() // the same function as in EditChanDetails
{
QPixmap img = misc::getOpenThumbnailedPicture(this, tr("Load channel logo"), 64, 64);
if (img.isNull())
return;
picture = img;
// to show the selected
ui.logoLabel->setPixmap(picture);
}

View File

@ -1,51 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _CREATE_CHANNEL_DIALOG_H
#define _CREATE_CHANNEL_DIALOG_H
#include "ui_CreateChannel.h"
class CreateChannel : public QDialog
{
Q_OBJECT
public:
CreateChannel();
void newChannel(); /* cleanup */
private slots:
/* actions to take.... */
void createChannel();
void addChannelLogo();
void setShareList();
private:
QPixmap picture;
/** Qt Designer generated object */
Ui::CreateChannel ui;
};
#endif

View File

@ -1,371 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CreateChannel</class>
<widget class="QDialog" name="CreateChannel">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>703</width>
<height>611</height>
</rect>
</property>
<property name="windowTitle">
<string>Create a new Channel</string>
</property>
<property name="windowIcon">
<iconset resource="../images.qrc">
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="HeaderFrame" name="headerFrame"/>
</item>
<item>
<widget class="QFrame" name="frame">
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="channelName"/>
</item>
</layout>
</item>
<item row="0" column="1" rowspan="6">
<widget class="QDockWidget" name="contactsdockWidget">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>524287</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>220</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>check peers you would like to share private publish key with</string>
</property>
<property name="floating">
<bool>false</bool>
</property>
<property name="features">
<set>QDockWidget::NoDockWidgetFeatures</set>
</property>
<property name="windowTitle">
<string>Share Key With</string>
</property>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QGridLayout" name="_2">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="FriendSelectionWidget" name="keyShareList" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>4</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>16777215</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>220</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="1" column="0">
<layout class="QVBoxLayout">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Description</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="channelDesc"/>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="tyoeGroupBox">
<property name="title">
<string>Type:</string>
</property>
<layout class="QVBoxLayout" name="_3">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>6</number>
</property>
<item>
<widget class="QRadioButton" name="typePrivate">
<property name="text">
<string>Restricted - Anyone can read, limited publishing (Private Publish Key)</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="typeEncrypted">
<property name="text">
<string>Private - (Private Publish Key required to view Messages)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QGroupBox" name="msgGroupBox">
<property name="title">
<string>Allowed Messages</string>
</property>
<layout class="QVBoxLayout" name="_4">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>6</number>
</property>
<item>
<widget class="QRadioButton" name="msgAnon">
<property name="text">
<string>Anonymous Messages</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="msgAuth">
<property name="text">
<string>Authenticated Messages</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="0">
<widget class="QGroupBox" name="msgGroupBox_2">
<property name="title">
<string>Key Sharing</string>
</property>
<layout class="QVBoxLayout" name="_5">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>6</number>
</property>
<item>
<widget class="QCheckBox" name="pubKeyShare_cb">
<property name="toolTip">
<string>Key recipients can publish to restricted-type channels, and can view and publish for private-type channels</string>
</property>
<property name="text">
<string>Share Private Publish Key</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="5" column="0">
<widget class="QGroupBox" name="groupBoxLogo">
<property name="title">
<string>Channel Logo</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" rowspan="2">
<widget class="QLabel" name="logoLabel">
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/channels.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="logoButton">
<property name="text">
<string>Add Channel Logo</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/add_image24.png</normaloff>:/images/add_image24.png</iconset>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>118</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="6" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>HeaderFrame</class>
<extends>QFrame</extends>
<header>gui/common/HeaderFrame.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>FriendSelectionWidget</class>
<extends>QWidget</extends>
<header>gui/common/FriendSelectionWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1,648 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QDragEnterEvent>
#include <QUrl>
#include <QTimer>
#include <QMessageBox>
#include <QBuffer>
#include <QMenu>
#include <QDir>
#include <gui/RetroShareLink.h>
#include "CreateChannelMsg.h"
#include "gui/feeds/SubFileItem.h"
#include "util/misc.h"
#include <retroshare/rschannels.h>
#include <retroshare/rsfiles.h>
#include <iostream>
/** Constructor */
CreateChannelMsg::CreateChannelMsg(std::string cId)
: 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);
headerFrame->setHeaderImage(QPixmap(":/images/channels.png"));
headerFrame->setHeaderText(tr("New Channel Post"));
setAttribute ( Qt::WA_DeleteOnClose, true );
connect(buttonBox, SIGNAL(accepted()), this, SLOT(sendMsg()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(cancelMsg()));
connect(addFileButton, SIGNAL(clicked() ), this , SLOT(addExtraFile()));
connect(addfilepushButton, SIGNAL(clicked() ), this , SLOT(addExtraFile()));
connect(addThumbnailButton, SIGNAL(clicked() ), this , SLOT(addThumbnail()));
connect(thumbNailCb, SIGNAL(toggled(bool)), this, SLOT(allowAutoMediaThumbNail(bool)));
connect(tabWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint)));
thumbNailCb->setVisible(false);
thumbNailCb->setEnabled(false);
#ifdef CHANNELS_FRAME_CATCHER
fCatcher = new framecatcher();
thumbNailCb->setVisible(true);
thumbNailCb->setEnabled(true);
#endif
//buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
setAcceptDrops(true);
newChannelMsg();
}
void CreateChannelMsg::contextMenu(QPoint /*point*/)
{
QList<RetroShareLink> links ;
RSLinkClipboard::pasteLinks(links) ;
int n_file = 0 ;
for(QList<RetroShareLink>::const_iterator it(links.begin());it!=links.end();++it)
if((*it).type() == RetroShareLink::TYPE_FILE)
n_file++ ;
QMenu contextMnu(this) ;
QAction *action ;
if(n_file > 1)
action = contextMnu.addAction(QIcon(":/images/pasterslink.png"), tr("Paste RetroShare Links"), this, SLOT(pasteLink()));
else
action = contextMnu.addAction(QIcon(":/images/pasterslink.png"), tr("Paste RetroShare Link"), this, SLOT(pasteLink()));
action->setDisabled(n_file < 1) ;
contextMnu.exec(QCursor::pos());
}
void CreateChannelMsg::pasteLink()
{
std::cerr << "Pasting links: " << std::endl;
QList<RetroShareLink> links,not_have ;
RSLinkClipboard::pasteLinks(links) ;
for(QList<RetroShareLink>::const_iterator it(links.begin());it!=links.end();++it)
if((*it).type() == RetroShareLink::TYPE_FILE)
{
// 0 - check that we actually have the file!
//
std::cerr << "Pasting " << (*it).toString().toStdString() << std::endl;
FileInfo info ;
if(rsFiles->alreadyHaveFile( (*it).hash().toStdString(),info ) )
addAttachment((*it).hash().toStdString(), (*it).name().toUtf8().constData(), (*it).size(), true, "") ;
else
not_have.push_back( *it ) ;
}
if(!not_have.empty())
{
QString msg = tr("You are about to add files you're not actually sharing. Do you still want this to happen?")+"<br><br>" ;
for(QList<RetroShareLink>::const_iterator it(not_have.begin());it!=not_have.end();++it)
msg += (*it).toString() + "<br>" ;
if(QMessageBox::YesToAll == QMessageBox::question(NULL,tr("About to post un-owned files to a channel."),msg,QMessageBox::YesToAll | QMessageBox::No))
for(QList<RetroShareLink>::const_iterator it(not_have.begin());it!=not_have.end();++it)
addAttachment((*it).hash().toStdString(), (*it).name().toUtf8().constData(), (*it).size(), false, "") ;
}
}
CreateChannelMsg::~CreateChannelMsg(){
#ifdef CHANNELS_FRAME_CATCHER
delete fCatcher;
#endif
}
/* Dropping */
void CreateChannelMsg::dragEnterEvent(QDragEnterEvent *event)
{
/* print out mimeType */
std::cerr << "CreateChannelMsg::dragEnterEvent() Formats";
std::cerr << std::endl;
QStringList formats = event->mimeData()->formats();
QStringList::iterator it;
for(it = formats.begin(); it != formats.end(); it++)
{
std::cerr << "Format: " << (*it).toStdString();
std::cerr << std::endl;
}
if (event->mimeData()->hasFormat("text/plain"))
{
std::cerr << "CreateChannelMsg::dragEnterEvent() Accepting PlainText";
std::cerr << std::endl;
event->acceptProposedAction();
}
else if (event->mimeData()->hasUrls())
{
std::cerr << "CreateChannelMsg::dragEnterEvent() Accepting Urls";
std::cerr << std::endl;
event->acceptProposedAction();
}
else if (event->mimeData()->hasFormat("application/x-rsfilelist"))
{
std::cerr << "CreateChannelMsg::dragEnterEvent() accepting Application/x-qabs...";
std::cerr << std::endl;
event->acceptProposedAction();
}
else
{
std::cerr << "CreateChannelMsg::dragEnterEvent() No PlainText/Urls";
std::cerr << std::endl;
}
}
void CreateChannelMsg::dropEvent(QDropEvent *event)
{
if (!(Qt::CopyAction & event->possibleActions()))
{
std::cerr << "CreateChannelMsg::dropEvent() Rejecting uncopyable DropAction";
std::cerr << std::endl;
/* can't do it */
return;
}
std::cerr << "CreateChannelMsg::dropEvent() Formats" << std::endl;
QStringList formats = event->mimeData()->formats();
QStringList::iterator it;
for(it = formats.begin(); it != formats.end(); it++)
{
std::cerr << "Format: " << (*it).toStdString();
std::cerr << std::endl;
}
if (event->mimeData()->hasText())
{
std::cerr << "CreateChannelMsg::dropEvent() Plain Text:";
std::cerr << std::endl;
std::cerr << event->mimeData()->text().toStdString();
std::cerr << std::endl;
}
if (event->mimeData()->hasUrls())
{
std::cerr << "CreateChannelMsg::dropEvent() Urls:" << std::endl;
QList<QUrl> urls = event->mimeData()->urls();
QList<QUrl>::iterator uit;
for(uit = urls.begin(); uit != urls.end(); uit++)
{
QString localpath = uit->toLocalFile();
std::cerr << "Whole URL: " << uit->toString().toStdString() << std::endl;
std::cerr << "or As Local File: " << localpath.toStdString() << std::endl;
if (localpath.isEmpty() == false)
{
// Check that the file does exist and is not a directory
QDir dir(localpath);
if (dir.exists()) {
std::cerr << "CreateChannelMsg::dropEvent() directory not accepted."<< std::endl;
QMessageBox mb(tr("Drop file error."), tr("Directory can't be dropped, only files are accepted."),QMessageBox::Information,QMessageBox::Ok,0,0,this);
mb.exec();
} else if (QFile::exists(localpath)) {
addAttachment(localpath.toUtf8().constData());
} else {
std::cerr << "CreateChannelMsg::dropEvent() file does not exists."<< std::endl;
QMessageBox mb(tr("Drop file error."), tr("File not found or file name not accepted."),QMessageBox::Information,QMessageBox::Ok,0,0,this);
mb.exec();
}
}
}
}
else if (event->mimeData()->hasFormat("application/x-rsfilelist"))
{
std::cerr << "CreateChannelMsg::dropEvent() Application/x-rsfilelist";
std::cerr << std::endl;
QByteArray data = event->mimeData()->data("application/x-rsfilelist");
std::cerr << "Data Len:" << data.length();
std::cerr << std::endl;
std::cerr << "Data is:" << data.data();
std::cerr << std::endl;
std::string newattachments(data.data());
parseRsFileListAttachments(newattachments);
}
event->setDropAction(Qt::CopyAction);
event->accept();
}
void CreateChannelMsg::parseRsFileListAttachments(const std::string &attachList)
{
/* split into lines */
QString input = QString::fromStdString(attachList);
QStringList attachItems = input.split("\n");
QStringList::iterator it;
QStringList::iterator it2;
for(it = attachItems.begin(); it != attachItems.end(); it++)
{
std::cerr << "CreateChannelMsg::parseRsFileListAttachments() Entry: ";
QStringList parts = (*it).split("/");
bool ok = false;
quint64 qsize = 0;
std::string fname;
std::string hash;
uint64_t size = 0;
std::string source;
int i = 0;
for(it2 = parts.begin(); it2 != parts.end(); it2++, i++)
{
std::cerr << "\"" << it2->toStdString() << "\" ";
switch(i)
{
case 0:
fname = it2->toStdString();
break;
case 1:
hash = it2->toStdString();
break;
case 2:
qsize = it2->toULongLong(&ok, 10);
size = qsize;
break;
case 3:
source = it2->toStdString();
break;
}
}
std::cerr << std::endl;
std::cerr << "\tfname: " << fname << std::endl;
std::cerr << "\thash: " << hash << std::endl;
std::cerr << "\tsize: " << size << std::endl;
std::cerr << "\tsource: " << source << std::endl;
/* basic error checking */
if ((ok) && (hash.size() == 40))
{
std::cerr << "Item Ok" << std::endl;
if (source == "Local")
{
addAttachment(hash, fname, size, true, "");
}
else
{
// TEMP NOT ALLOWED UNTIL FT WORKING.
addAttachment(hash, fname, size, false, source);
}
}
else
{
std::cerr << "Error Decode: Hash size: " << hash.size() << std::endl;
}
}
}
void CreateChannelMsg::addAttachment(const std::string &hash, const std::string &fname, uint64_t size, bool local, const std::string &srcId)
{
/* add a SubFileItem to the attachment section */
std::cerr << "CreateChannelMsg::addAttachment()";
std::cerr << std::endl;
/* add widget in for new destination */
uint32_t flags = SFI_TYPE_CHANNEL;
if (local)
{
flags |= SFI_STATE_LOCAL;
}
else
{
flags |= SFI_STATE_REMOTE;
}
SubFileItem *file = new SubFileItem(hash, fname, "", size, flags, srcId); // destroyed when fileFrame (this subfileitem) is destroyed
mAttachments.push_back(file);
QLayout *layout = fileFrame->layout();
layout->addWidget(file);
if (mCheckAttachment)
{
checkAttachmentReady();
}
return;
}
void CreateChannelMsg::addExtraFile()
{
/* add a SubFileItem to the attachment section */
std::cerr << "CreateChannelMsg::addExtraFile() opening file dialog";
std::cerr << std::endl;
QStringList files;
if (misc::getOpenFileNames(this, RshareSettings::LASTDIR_EXTRAFILE, tr("Add Extra File"), "", files)) {
for (QStringList::iterator fileIt = files.begin(); fileIt != files.end(); fileIt++) {
addAttachment((*fileIt).toUtf8().constData());
}
}
}
void CreateChannelMsg::addAttachment(const std::string &path)
{
/* add a SubFileItem to the attachment section */
std::cerr << "CreateChannelMsg::addAttachment()";
std::cerr << std::endl;
if(mAutoMediaThumbNail)
setThumbNail(path, 2000);
/* add widget in for new destination */
uint32_t flags = SFI_TYPE_CHANNEL | SFI_STATE_EXTRA | SFI_FLAG_CREATE;
// check attachment if hash exists already
std::list<SubFileItem* >::iterator it;
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);
return;
}
}
// channels creates copy of file into channels directory and shares this
FileInfo fInfo;
rsChannels->channelExtraFileHash(path, mChannelId, fInfo);
// file is not innitial
SubFileItem *file = new SubFileItem(fInfo.hash, fInfo.fname, fInfo.path, fInfo.size,
flags, mChannelId); // destroyed when fileFrame (this subfileitem) is destroyed
mAttachments.push_back(file);
QLayout *layout = fileFrame->layout();
layout->addWidget(file);
if (mCheckAttachment)
{
checkAttachmentReady();
}
return;
}
bool CreateChannelMsg::setThumbNail(const std::string& path, int frame){
#ifdef CHANNELS_FRAME_CATCHER
unsigned char* imageBuffer = NULL;
int width = 0, height = 0, errCode = 0;
int length;
std::string errString;
if(1 != (errCode = fCatcher->open(path))){
fCatcher->getError(errCode, errString);
std::cerr << errString << std::endl;
return false;
}
length = fCatcher->getLength();
// make sure frame chosen is at lease a quarter length of video length if not choose quarter length
if(frame < (int) (0.25 * length))
frame = 0.25 * length;
if(1 != (errCode = fCatcher->getRGBImage(frame, imageBuffer, width, height))){
fCatcher->getError(errCode, errString);
std::cerr << errString << std::endl;
return false;
}
if(imageBuffer == NULL)
return false;
QImage tNail(imageBuffer, width, height, QImage::Format_RGB32);
QByteArray ba;
QBuffer buffer(&ba);
buffer.open(QIODevice::WriteOnly);
tNail.save(&buffer, "PNG");
QPixmap img;
img.loadFromData(ba, "PNG");
img = img.scaled(thumbnail_label->width(), thumbnail_label->height(), Qt::KeepAspectRatio);
thumbnail_label->setPixmap(img);
delete[] imageBuffer;
#else
Q_UNUSED(path);
Q_UNUSED(frame);
#endif
return true;
}
void CreateChannelMsg::allowAutoMediaThumbNail(bool allowThumbNail){
mAutoMediaThumbNail = allowThumbNail;
}
void CreateChannelMsg::checkAttachmentReady()
{
std::list<SubFileItem *>::iterator fit;
mCheckAttachment = false;
for(fit = mAttachments.begin(); fit != mAttachments.end(); fit++)
{
if (!(*fit)->isHidden())
{
if (!(*fit)->ready())
{
/* ensure file is hashed or file will be hashed, thus
* recognized by librs but not correctly by gui (can't
* formally remove it)
*/
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
buttonBox->button(QDialogButtonBox::Cancel)->setEnabled(false);
break;
}
}
}
if (fit == mAttachments.end())
{
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
buttonBox->button(QDialogButtonBox::Cancel)->setEnabled(true);
}
/* repeat... */
int msec_rate = 1000;
QTimer::singleShot( msec_rate, this, SLOT(checkAttachmentReady(void)));
}
void CreateChannelMsg::cancelMsg()
{
std::cerr << "CreateChannelMsg::cancelMsg() :"
<< "Deleting EXTRA attachments" << std::endl;
std::cerr << std::endl;
std::list<SubFileItem* >::const_iterator it;
for(it = mAttachments.begin(); it != mAttachments.end(); it++)
rsChannels->channelExtraFileRemove((*it)->FileHash(), mChannelId);
close();
return;
}
void CreateChannelMsg::newChannelMsg()
{
if (!rsChannels)
return;
ChannelInfo ci;
if (!rsChannels->getChannelInfo(mChannelId, ci))
{
return;
}
channelName->setText(QString::fromStdWString(ci.channelName));
subjectEdit->setFocus();
}
void CreateChannelMsg::sendMsg()
{
std::cerr << "CreateChannelMsg::sendMsg()";
std::cerr << std::endl;
/* construct message bits */
std::wstring subject = misc::removeNewLine(subjectEdit->text()).toStdWString();
std::wstring msg = msgEdit->toPlainText().toStdWString();
std::list<FileInfo> files;
std::list<SubFileItem *>::iterator fit;
for(fit = mAttachments.begin(); fit != mAttachments.end(); fit++)
{
if (!(*fit)->isHidden())
{
FileInfo fi;
fi.hash = (*fit)->FileHash();
fi.fname = (*fit)->FileName();
fi.size = (*fit)->FileSize();
files.push_back(fi);
/* commence downloads - if we don't have the file */
if (!(*fit)->done())
{
if ((*fit)->ready())
{
(*fit)->download();
}
// Skips unhashed files.
}
}
}
sendMessage(subject, msg, files);
}
void CreateChannelMsg::sendMessage(std::wstring subject, std::wstring msg, std::list<FileInfo> &files)
{
QString name = misc::removeNewLine(subjectEdit->text());
if(name.isEmpty())
{ /* error message */
QMessageBox::warning(this, tr("RetroShare"),
tr("Please add a Subject"),
QMessageBox::Ok, QMessageBox::Ok);
return; //Don't add an empty Subject!!
}
else
/* rsChannels */
if (rsChannels)
{
ChannelMsgInfo msgInfo;
msgInfo.channelId = mChannelId;
msgInfo.msgId = "";
msgInfo.subject = subject;
msgInfo.msg = msg;
msgInfo.files = files;
QByteArray ba;
QBuffer buffer(&ba);
if(!picture.isNull()){
// send chan image
buffer.open(QIODevice::WriteOnly);
picture.save(&buffer, "PNG"); // writes image into ba in PNG format
msgInfo.thumbnail.image_thumbnail = (unsigned char*) ba.data();
msgInfo.thumbnail.im_thumbnail_size = ba.size();
}
rsChannels->ChannelMessageSend(msgInfo);
}
close();
return;
}
void CreateChannelMsg::addThumbnail()
{
QPixmap img = misc::getOpenThumbnailedPicture(this, tr("Load thumbnail picture"), 156, 107);
if (img.isNull())
return;
picture = img;
// to show the selected
thumbnail_label->setPixmap(picture);
}

View File

@ -1,91 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _CREATECHANNELMSG_H
#define _CREATECHANNELMSG_H
#include "ui_CreateChannelMsg.h"
#include <stdint.h>
#ifdef CHANNELS_FRAME_CATCHER
#include "util/framecatcher.h"
#endif
class SubFileItem;
class FileInfo;
class CreateChannelMsg : public QDialog, private Ui::CreateChannelMsg
{
Q_OBJECT
public:
/** Default Constructor */
CreateChannelMsg(std::string cId);
/** Default Destructor */
~CreateChannelMsg();
void addAttachment(const std::string &path);
void addAttachment(const std::string &hash, const std::string &fname, uint64_t size, bool local, const std::string &srcId);
void newChannelMsg();
QPixmap picture;
protected:
virtual void dragEnterEvent(QDragEnterEvent *event);
virtual void dropEvent(QDropEvent *event);
private slots:
void addExtraFile();
void checkAttachmentReady();
void cancelMsg();
void sendMsg();
void pasteLink() ;
void contextMenu(QPoint) ;
void addThumbnail();
void allowAutoMediaThumbNail(bool);
private:
void parseRsFileListAttachments(const std::string &attachList);
void sendMessage(std::wstring subject, std::wstring msg, std::list<FileInfo> &files);
bool setThumbNail(const std::string& path, int frame);
std::string mChannelId;
std::list<SubFileItem *> mAttachments;
bool mCheckAttachment;
bool mAutoMediaThumbNail;
#ifdef CHANNELS_FRAME_CATCHER
framecatcher* fCatcher;
#endif
};
#endif

View File

@ -1,365 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CreateChannelMsg</class>
<widget class="QDialog" name="CreateChannelMsg">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>581</width>
<height>479</height>
</rect>
</property>
<property name="acceptDrops">
<bool>true</bool>
</property>
<property name="windowTitle">
<string>New Channel Post</string>
</property>
<property name="windowIcon">
<iconset resource="../images.qrc">
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout_8">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="HeaderFrame" name="headerFrame"/>
</item>
<item row="1" column="0">
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Channel Post</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_8">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Channel Post to:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="channelName">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<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;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:10pt; font-weight:600;&quot;&gt;Attachments:&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;img src=&quot;:/images/feedback_arrow.png&quot; /&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt; Use Drag and Drop / Add Files button, to Hash new files.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;img src=&quot;:/images/feedback_arrow.png&quot; /&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt; Copy/Paste RetroShare links from your shares&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="addfilepushButton">
<property name="text">
<string>Add File to Attach</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/add-share24.png</normaloff>:/images/add-share24.png</iconset>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="addThumbnailButton">
<property name="text">
<string>Add Channel Thumbnail</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/add_image24.png</normaloff>:/images/add_image24.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<widget class="QLabel" name="thumbnail_label">
<property name="maximumSize">
<size>
<width>156</width>
<height>107</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/thumb-default-video.png</pixmap>
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>12</width>
<height>98</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0" colspan="3">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Message</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0" colspan="2">
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Subject :</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="subjectEdit"/>
</item>
</layout>
</item>
<item row="2" column="0" colspan="2">
<widget class="QTextEdit" name="msgEdit"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/attachment.png</normaloff>:/images/attachment.png</iconset>
</attribute>
<attribute name="title">
<string>Attachments</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/attachment.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_4">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>26</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Attachments</string>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>334</width>
<height>26</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="addFileButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/add-share24.png</normaloff>:/images/add-share24.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QCheckBox" name="thumbNailCb">
<property name="toolTip">
<string>Allow channels to get frame for message thumbnail from movie media attachments or not</string>
</property>
<property name="text">
<string>Auto Thumbnail</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="5">
<widget class="QScrollArea" name="scrollArea">
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>98</width>
<height>24</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>3</number>
</property>
<property name="margin">
<number>3</number>
</property>
<item>
<widget class="QFrame" name="fileFrame">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="acceptDrops">
<bool>true</bool>
</property>
<property name="toolTip">
<string>Drag and Drop Files from Search Results</string>
</property>
<layout class="QGridLayout" name="gridLayout_3"/>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="1" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>HeaderFrame</class>
<extends>QFrame</extends>
<header>gui/common/HeaderFrame.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1,118 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2010 Christopher Evi-Parker
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "EditChanDetails.h"
#include <QFileDialog>
#include <retroshare/rschannels.h>
#include "util/misc.h"
#include <list>
#include <iostream>
#include <string>
#define CHAN_DEFAULT_IMAGE ":/images/channels.png"
/** Default constructor */
EditChanDetails::EditChanDetails(QWidget *parent, std::string cId)
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), mChannelId(cId)
{
/* Invoke Qt Designer generated QObject setup routine */
ui.setupUi(this);
connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(applyDialog()));
connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(close()));
connect( ui.logoButton, SIGNAL(clicked() ), this , SLOT(addChannelLogo()));
ui.logoButton->setDisabled(true);
ui.logoLabel->setDisabled(true);
loadChannel();
}
void EditChanDetails::loadChannel()
{
if (!rsChannels)
{
return;
}
ChannelInfo ci;
rsChannels->getChannelInfo(mChannelId, ci);
// Set Channel Name
ui.nameline->setText(QString::fromStdWString(ci.channelName));
// Set Channel Description
ui.DescriptiontextEdit->setText(QString::fromStdWString(ci.channelDesc));
// Set Channel Logo
QPixmap chanImage;
if(ci.pngImageLen != 0)
{
chanImage.loadFromData(ci.pngChanImage, ci.pngImageLen, "PNG");
}
else
{
chanImage = QPixmap(CHAN_DEFAULT_IMAGE);
}
ui.logoLabel->setPixmap(chanImage);
}
void EditChanDetails::applyDialog()
{
if(!rsChannels)
return;
// if text boxes have not been edited leave alone
if(!ui.nameline->isModified() && !ui.DescriptiontextEdit->document()->isModified())
return;
ChannelInfo ci;
ci.channelName = misc::removeNewLine(ui.nameline->text()).toStdWString();
ci.channelDesc = ui.DescriptiontextEdit->document()->toPlainText().toStdWString();
/* reload now */
rsChannels->channelEditInfo(mChannelId, ci);
/* close the Dialog after the Changes applied */
close();
return;
}
void EditChanDetails::addChannelLogo() // the same function as in CreateChannel
{
QPixmap img = misc::getOpenThumbnailedPicture(this, tr("Load channel logo"), 64, 64);
if (img.isNull())
return;
picture = img;
// to show the selected
ui.logoLabel->setPixmap(picture);
}

View File

@ -1,55 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2010 Christopher Evi-Parker
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _EDITCHANDETAILS_H
#define _EDITCHANDETAILS_H
#include <QDialog>
#include "ui_EditChanDetails.h"
class EditChanDetails : public QDialog
{
Q_OBJECT
public:
/** Default constructor */
EditChanDetails(QWidget *parent = 0, std::string cId = 0);
signals:
void configChanged();
private slots:
void applyDialog();
void addChannelLogo();
private:
void loadChannel();
std::string mChannelId;
QPixmap picture;
/** Qt Designer generated object */
Ui::EditChanDetails ui;
};
#endif

View File

@ -1,143 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EditChanDetails</class>
<widget class="QDialog" name="EditChanDetails">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>436</width>
<height>355</height>
</rect>
</property>
<property name="windowTitle">
<string>Channel Details</string>
</property>
<property name="windowIcon">
<iconset resource="../images.qrc">
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0">
<layout class="QGridLayout" name="_2">
<item row="0" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QTabWidget" name="stabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/info16.png</normaloff>:/images/info16.png</iconset>
</attribute>
<attribute name="title">
<string>Edit Channel Details</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Channel Info</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Channel Name</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="nameline"/>
</item>
<item row="1" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Channel Description</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTextEdit" name="DescriptiontextEdit"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout_4">
<item row="1" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>118</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="logoButton">
<property name="text">
<string>Add Channel Logo</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/add_image24.png</normaloff>:/images/add_image24.png</iconset>
</property>
</widget>
</item>
<item row="0" column="0" rowspan="2">
<widget class="QLabel" name="logoLabel">
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/channels.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -24,8 +24,8 @@
#include <QMessageBox>
#include <algorithm>
#include <retroshare/rschannels.h>
#include <retroshare/rsforums.h>
//#include <retroshare/rschannels.h>
//#include <retroshare/rsforums.h>
#include <retroshare/rspeers.h>
#include "gui/common/PeerDefs.h"
@ -77,6 +77,7 @@ void ShareKey::shareKey()
return;
}
#if 0
if (mGrpType & CHANNEL_KEY_SHARE) {
if (!rsChannels)
return;
@ -97,6 +98,7 @@ void ShareKey::shareKey()
// incorrect type
return;
}
#endif
close();
}

View File

@ -144,9 +144,6 @@ QString StatusDefs::connectStateString(RsPeerDetails &details)
case 0:
stateString = peerStateString(details.state);
break;
case RS_PEER_CONNECTSTATE_TRYING_TUNNEL:
stateString = qApp->translate("StatusDefs", "Trying tunnel connection");
break;
case RS_PEER_CONNECTSTATE_TRYING_TCP:
stateString = qApp->translate("StatusDefs", "Trying TCP");
break;
@ -159,9 +156,6 @@ QString StatusDefs::connectStateString(RsPeerDetails &details)
case RS_PEER_CONNECTSTATE_CONNECTED_UDP:
stateString = qApp->translate("StatusDefs", "Connected: UDP");
break;
case RS_PEER_CONNECTSTATE_CONNECTED_TUNNEL:
stateString = qApp->translate("StatusDefs", "Connected: Tunnel");
break;
case RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN:
stateString = qApp->translate("StatusDefs", "Connected: Unknown");
break;

View File

@ -1,189 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QTimer>
#include "BlogMsgItem.h"
#include "FeedHolder.h"
#include "SubFileItem.h"
/****
* #define DEBUG_ITEM 1
****/
/** Constructor */
BlogMsgItem::BlogMsgItem(FeedHolder *parent, uint32_t feedId, std::string peerId, std::string msgId, bool isHome)
:QWidget(NULL), mParent(parent), mFeedId(feedId),
mPeerId(peerId), mMsgId(msgId), mIsHome(isHome)
{
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
/* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
//connect( gotoButton, SIGNAL( clicked( void ) ), this, SLOT( gotoHome ( void ) ) );
/* specific ones */
connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( playMedia ( void ) ) );
small();
updateItemStatic();
updateItem();
}
void BlogMsgItem::updateItemStatic()
{
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "BlogMsgItem::updateItemStatic()";
std::cerr << std::endl;
#endif
msgLabel->setText("What did you expect? \nThe Blogs will be up and running shortly!");
titleLabel->setText("Blog Feed: Jacki @ Friday");
subjectLabel->setText("Brand new exciting Blog stuff");
/* add Files */
int total = (int) (10.0 * (rand() / (RAND_MAX + 1.0)));
int i;
total = 0;
for(i = 0; i < total; i++)
{
/* add file */
SubFileItem *fi = new SubFileItem("dummyHash", "dummy_File", "", 1283918, SFI_STATE_REMOTE, mPeerId);
mFileItems.push_back(fi);
QLayout *layout = expandFrame->layout();
layout->addWidget(fi);
}
playButton->setEnabled(false);
if (mIsHome)
{
/* disable buttons */
clearButton->setEnabled(false);
//gotoButton->setEnabled(false);
clearButton->hide();
}
}
void BlogMsgItem::updateItem()
{
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "BlogMsgItem::updateItem()";
std::cerr << std::endl;
#endif
int msec_rate = 10000;
/* Very slow Tick to check when all files are downloaded */
std::list<SubFileItem *>::iterator it;
for(it = mFileItems.begin(); it != mFileItems.end(); it++)
{
if (!(*it)->done())
{
/* loop again */
QTimer::singleShot( msec_rate, this, SLOT(updateItem( void ) ));
return;
}
}
if (mFileItems.size() > 0)
{
playButton->setEnabled(true);
}
}
void BlogMsgItem::small()
{
expandFrame->hide();
}
void BlogMsgItem::toggle()
{
mParent->lockLayout(this, true);
if (expandFrame->isHidden())
{
expandFrame->show();
expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
expandButton->setToolTip(tr("Hide"));
}
else
{
expandFrame->hide();
expandButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
expandButton->setToolTip(tr("Expand"));
}
mParent->lockLayout(this, false);
}
void BlogMsgItem::removeItem()
{
#ifdef DEBUG_ITEM
std::cerr << "BlogMsgItem::removeItem()";
std::cerr << std::endl;
#endif
mParent->lockLayout(this, true);
hide();
mParent->lockLayout(this, false);
if (mParent)
{
mParent->deleteFeedItem(this, mFeedId);
}
}
void BlogMsgItem::gotoHome()
{
#ifdef DEBUG_ITEM
std::cerr << "BlogMsgItem::gotoHome()";
std::cerr << std::endl;
#endif
}
/*********** SPECIFIC FUNCTIOSN ***********************/
void BlogMsgItem::playMedia()
{
#ifdef DEBUG_ITEM
std::cerr << "BlogMsgItem::playMedia()";
std::cerr << std::endl;
#endif
}

View File

@ -1,65 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _BLOG_MSG_ITEM_DIALOG_H
#define _BLOG_MSG_ITEM_DIALOG_H
#include "ui_BlogMsgItem.h"
#include <stdint.h>
class FeedHolder;
class SubFileItem;
class BlogMsgItem : public QWidget, private Ui::BlogMsgItem
{
Q_OBJECT
public:
/** Default Constructor */
BlogMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &peerId, const std::string &msgId, bool isHome);
void updateItemStatic();
void small();
private slots:
/* default stuff */
void gotoHome();
void removeItem();
void toggle();
void playMedia();
void updateItem();
private:
FeedHolder *mParent;
uint32_t mFeedId;
std::string mPeerId;
std::string mMsgId;
bool mIsHome;
std::list<SubFileItem *> mFileItems;
};
#endif

View File

@ -1,242 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>BlogMsgItem</class>
<widget class="QWidget" name="BlogMsgItem">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>552</width>
<height>238</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">QFrame#frame{
border: 2px solid #6ACEFF;
border-radius: 10px;
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #0076B1, stop:1 #12A3EB);}</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout">
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QPushButton" name="clearButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Remove Item</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/close_normal.png</normaloff>:/images/close_normal.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>16</width>
<height>26</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="titleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">Blog</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>1000</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="expandButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Expand</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Subject</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="subjectLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">subjectLabel</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>500</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="playButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Play Media</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/startall.png</normaloff>:/images/startall.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QFrame" name="expandFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QLabel" name="msgLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">Long
message here</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1,219 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "BlogNewItem.h"
#include "FeedHolder.h"
#include <retroshare/rsblogs.h>
#define BLOG_DEFAULT_IMAGE ":/images/hi64-app-kblogger.png"
/****
* #define DEBUG_ITEM 1
****/
/** Constructor */
BlogNewItem::BlogNewItem(FeedHolder *parent, uint32_t feedId, std::string blogId, bool isHome, bool isNew)
:QWidget(NULL), mParent(parent), mFeedId(feedId),
mBlogId(blogId), mIsHome(isHome), mIsNew(isNew)
{
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
/* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
/* specific ones */
connect( subscribeButton, SIGNAL( clicked( void ) ), this, SLOT( subscribeBlog ( void ) ) );
small();
updateItemStatic();
updateItem();
}
void BlogNewItem::updateItemStatic()
{
if (!rsBlogs)
return;
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "BlogNewItem::updateItemStatic()";
std::cerr << std::endl;
#endif
BlogInfo bi;
if (rsBlogs->getBlogInfo(mBlogId, bi))
{
nameLabel->setText(QString::fromStdWString(bi.blogName));
descLabel->setText(QString::fromStdWString(bi.blogDesc));
if(bi.pngImageLen != 0){
QPixmap blogImage;
blogImage.loadFromData(bi.pngChanImage, bi.pngImageLen, "PNG");
logo_label->setPixmap(QPixmap(blogImage));
}else{
QPixmap defaulImage(BLOG_DEFAULT_IMAGE);
logo_label->setPixmap(QPixmap(defaulImage));
}
if (bi.blogFlags & RS_DISTRIB_SUBSCRIBED)
{
subscribeButton->setEnabled(false);
//postButton->setEnabled(true);
}
else
{
subscribeButton->setEnabled(true);
//postButton->setEnabled(false);
}
/* should also check the other flags */
}
else
{
nameLabel->setText(tr("Unknown Blog"));
titleLabel->setText("Blog ???");
descLabel->setText("");
}
if (mIsNew)
{
titleLabel->setText(tr("New Blog"));
}
else
{
titleLabel->setText(tr("Updated Blog"));
}
if (mIsHome)
{
/* disable buttons */
clearButton->setEnabled(false);
//gotoButton->setEnabled(false);
}
}
void BlogNewItem::updateItem()
{
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "BlogNewItem::updateItem()";
std::cerr << std::endl;
#endif
}
void BlogNewItem::small()
{
expandFrame->hide();
}
void BlogNewItem::toggle()
{
mParent->lockLayout(this, true);
if (expandFrame->isHidden())
{
expandFrame->show();
expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
expandButton->setToolTip(tr("Hide"));
}
else
{
expandFrame->hide();
expandButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
expandButton->setToolTip(tr("Expand"));
}
mParent->lockLayout(this, false);
}
void BlogNewItem::removeItem()
{
#ifdef DEBUG_ITEM
std::cerr << "BlogNewItem::removeItem()";
std::cerr << std::endl;
#endif
mParent->lockLayout(this, true);
hide();
mParent->lockLayout(this, false);
if (mParent)
{
mParent->deleteFeedItem(this, mFeedId);
}
}
void BlogNewItem::gotoHome()
{
#ifdef DEBUG_ITEM
std::cerr << "BlogNewItem::gotoHome()";
std::cerr << std::endl;
#endif
}
/*********** SPECIFIC FUNCTIOSN ***********************/
void BlogNewItem::unsubscribeBlog()
{
#ifdef DEBUG_ITEM
std::cerr << "BlogNewItem::unsubscribeBlog()";
std::cerr << std::endl;
#endif
if (rsBlogs)
{
rsBlogs->blogSubscribe(mBlogId, false);
}
updateItemStatic();
}
void BlogNewItem::subscribeBlog()
{
#ifdef DEBUG_ITEM
std::cerr << "BlogNewItem::subscribeBlog()";
std::cerr << std::endl;
#endif
if (rsBlogs)
{
rsBlogs->blogSubscribe(mBlogId, true);
}
updateItemStatic();
}

View File

@ -1,62 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _BLOG_NEW_ITEM_DIALOG_H
#define _BLOG_NEW_ITEM_DIALOG_H
#include "ui_BlogNewItem.h"
#include <stdint.h>
class FeedHolder;
class BlogNewItem : public QWidget, private Ui::BlogNewItem
{
Q_OBJECT
public:
/** Default Constructor */
BlogNewItem(FeedHolder *parent, uint32_t feedId, const std::string &blogId, bool isHome, bool isNew);
void updateItemStatic();
void small();
private slots:
/* default stuff */
void gotoHome();
void removeItem();
void toggle();
void unsubscribeBlog();
void subscribeBlog();
void updateItem();
private:
FeedHolder *mParent;
uint32_t mFeedId;
std::string mBlogId;
bool mIsHome;
bool mIsNew;
};
#endif

View File

@ -1,260 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>BlogNewItem</class>
<widget class="QWidget" name="BlogNewItem">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>643</width>
<height>109</height>
</rect>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">QFrame#frame{
border: 2px solid #6ACEFF;
border-radius: 10px;
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #0076B1, stop:1 #12A3EB);}</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout">
<property name="topMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QPushButton" name="clearButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Remove Item</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/close_normal.png</normaloff>:/images/close_normal.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="titleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">New Blog</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="logo_label">
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="text">
<string notr="true">Logo</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="nameLabel">
<property name="text">
<string notr="true">name</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>500</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="subscribeButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Subscribe to Blog</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/directoryadd_24x24_shadow.png</normaloff>:/images/directoryadd_24x24_shadow.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="expandButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Expand</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QFrame" name="expandFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Blog Description</string>
</property>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="iconLabel">
<property name="text">
<string notr="true"/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/contacts24.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="descLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">Description
of Blog</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1,466 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QDateTime>
#include <QTimer>
#include <QFileInfo>
#include "rshare.h"
#include "ChanMsgItem.h"
#include "FeedHolder.h"
#include "SubFileItem.h"
#include "gui/notifyqt.h"
#include "util/misc.h"
#include "gui/RetroShareLink.h"
#include "util/HandleRichText.h"
#include "util/DateTime.h"
#include <retroshare/rschannels.h>
/****
* #define DEBUG_ITEM 1
****/
#define COLOR_NORMAL QColor(248, 248, 248)
#define COLOR_NEW QColor(220, 236, 253)
/** Constructor */
ChanMsgItem::ChanMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &chanId, const std::string &msgId, bool isHome)
:QWidget(NULL), mParent(parent), mFeedId(feedId),
mChanId(chanId), mMsgId(msgId), mIsHome(isHome)
{
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
m_inUpdateItemStatic = false;
/* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
/* specific */
connect(readAndClearButton, SIGNAL(clicked()), this, SLOT(readAndClearItem()));
connect( unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeChannel ( void ) ) );
connect( downloadButton, SIGNAL( clicked( void ) ), this, SLOT( download ( void ) ) );
connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( play ( void ) ) );
connect( copyLinkButton, SIGNAL( clicked( void ) ), this, SLOT( copyLink ( void ) ) );
connect( readButton, SIGNAL( toggled(bool) ), this, SLOT( readToggled(bool) ) );
connect( NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection);
downloadButton->hide();
playButton->hide();
warn_image_label->hide();
warning_label->hide();
titleLabel->setMinimumWidth(100);
subjectLabel->setMinimumWidth(100);
warning_label->setMinimumWidth(100);
frame->setProperty("state", "");
QPalette palette = frame->palette();
palette.setColor(frame->backgroundRole(), COLOR_NORMAL);
frame->setPalette(palette);
expandFrame->hide();
updateItemStatic();
updateItem();
}
void ChanMsgItem::updateItemStatic()
{
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "ChanMsgItem::updateItemStatic()";
std::cerr << std::endl;
#endif
ChannelMsgInfo cmi;
if (!rsChannels)
return;
if (!rsChannels->getChannelMessage(mChanId, mMsgId, cmi))
return;
m_inUpdateItemStatic = true;
QString title;
ChannelInfo ci;
rsChannels->getChannelInfo(mChanId, ci);
if (!mIsHome)
{
title = tr("Channel Feed") + ": ";
RetroShareLink link;
link.createChannel(ci.channelId, "");
title += link.toHtml();
titleLabel->setText(title);
RetroShareLink msgLink;
msgLink.createChannel(cmi.channelId, cmi.msgId);
subjectLabel->setText(msgLink.toHtml());
if ((ci.channelFlags & RS_DISTRIB_SUBSCRIBED) || (ci.channelFlags & RS_DISTRIB_ADMIN)) {
unsubscribeButton->setEnabled(true);
} else {
unsubscribeButton->setEnabled(false);
}
readButton->hide();
newLabel->hide();
copyLinkButton->hide();
}
else
{
/* subject */
titleLabel->setText(QString::fromStdWString(cmi.subject));
subjectLabel->setText(RsHtml().formatText(NULL, QString::fromStdWString(cmi.msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
/* disable buttons: deletion facility not enabled with cache services yet */
clearButton->setEnabled(false);
unsubscribeButton->setEnabled(false);
clearButton->hide();
readAndClearButton->hide();
unsubscribeButton->hide();
copyLinkButton->show();
if ((ci.channelFlags & RS_DISTRIB_SUBSCRIBED) || (ci.channelFlags & RS_DISTRIB_ADMIN)) {
readButton->setVisible(true);
uint32_t status = 0;
rsChannels->getMessageStatus(mChanId, mMsgId, status);
if ((status & CHANNEL_MSG_STATUS_READ) == 0 || (status & CHANNEL_MSG_STATUS_UNREAD_BY_USER)) {
readButton->setChecked(true);
readButton->setIcon(QIcon(":/images/message-state-unread.png"));
} else {
readButton->setChecked(false);
readButton->setIcon(QIcon(":/images/message-state-read.png"));
}
bool newState;
QColor color;
if (status & CHANNEL_MSG_STATUS_READ) {
newLabel->setVisible(false);
newState = false;
color = COLOR_NORMAL;
} else {
newLabel->setVisible(true);
newState = true;
color = COLOR_NEW;
}
/* unpolish widget to clear the stylesheet's palette cache */
frame->style()->unpolish(frame);
QPalette palette = frame->palette();
palette.setColor(frame->backgroundRole(), color);
frame->setPalette(palette);
frame->setProperty("new", newState);
Rshare::refreshStyleSheet(frame, false);
} else {
readButton->setVisible(false);
newLabel->setVisible(false);
}
}
msgLabel->setText(RsHtml().formatText(NULL, QString::fromStdWString(cmi.msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
msgFrame->setVisible(!cmi.msg.empty());
datetimelabel->setText(DateTime::formatLongDateTime(cmi.ts));
filelabel->setText(QString("(%1 %2) %3").arg(cmi.count).arg(tr("Files")).arg(misc::friendlyUnit(cmi.size)));
if (mFileItems.empty() == false) {
std::list<SubFileItem *>::iterator it;
for(it = mFileItems.begin(); it != mFileItems.end(); it++)
{
delete(*it);
}
mFileItems.clear();
}
std::list<FileInfo>::iterator it;
for(it = cmi.files.begin(); it != cmi.files.end(); it++)
{
/* add file */
SubFileItem *fi = new SubFileItem(it->hash, it->fname, it->path, it->size,
SFI_STATE_REMOTE | SFI_TYPE_CHANNEL, "");
mFileItems.push_back(fi);
/* check if the file is a media file */
if (!misc::isPreviewable(QFileInfo(QString::fromUtf8(it->fname.c_str())).suffix()))
fi->mediatype();
QLayout *layout = expandFrame->layout();
layout->addWidget(fi);
}
if(cmi.thumbnail.image_thumbnail != NULL)
{
QPixmap thumbnail;
thumbnail.loadFromData(cmi.thumbnail.image_thumbnail, cmi.thumbnail.im_thumbnail_size, "PNG");
logoLabel->setPixmap(thumbnail);
}
m_inUpdateItemStatic = false;
}
void ChanMsgItem::setFileCleanUpWarning(uint32_t time_left)
{
int hours = (int)time_left/3600;
int minutes = (time_left - hours*3600)%60;
warning_label->setText(tr("Warning! You have less than %1 hours and %2 minute before this file is deleted Consider saving it.").arg(
QString::number(hours)).arg(QString::number(minutes)));
QFont warnFont = warning_label->font();
warnFont.setBold(true);
warning_label->setFont(warnFont);
warn_image_label->setVisible(true);
warning_label->setVisible(true);
return;
}
void ChanMsgItem::updateItem()
{
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "ChanMsgItem::updateItem()";
std::cerr << std::endl;
#endif
int msec_rate = 10000;
int downloadCount = 0;
int downloadStartable = 0;
int playCount = 0;
int playStartable = 0;
bool startable;
bool loopAgain = false;
/* Very slow Tick to check when all files are downloaded */
std::list<SubFileItem *>::iterator it;
for(it = mFileItems.begin(); it != mFileItems.end(); it++)
{
SubFileItem *item = *it;
if (item->isDownloadable(startable)) {
downloadCount++;
if (startable) {
downloadStartable++;
}
}
if (item->isPlayable(startable)) {
playCount++;
if (startable) {
playStartable++;
}
}
if (!item->done())
{
/* loop again */
loopAgain = true;
}
}
if (downloadCount) {
downloadButton->show();
if (downloadStartable) {
downloadButton->setEnabled(true);
} else {
downloadButton->setEnabled(false);
}
} else {
downloadButton->hide();
}
if (playCount) {
/* one file is playable */
playButton->show();
if (playStartable == 1) {
playButton->setEnabled(true);
} else {
playButton->setEnabled(false);
}
} else {
playButton->hide();
}
if (loopAgain) {
QTimer::singleShot( msec_rate, this, SLOT(updateItem( void ) ));
}
}
void ChanMsgItem::toggle()
{
mParent->lockLayout(this, true);
if (expandFrame->isHidden())
{
expandFrame->show();
expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
expandButton->setToolTip(tr("Hide"));
readToggled(false);
}
else
{
expandFrame->hide();
expandButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
expandButton->setToolTip(tr("Expand"));
}
mParent->lockLayout(this, false);
}
void ChanMsgItem::removeItem()
{
#ifdef DEBUG_ITEM
std::cerr << "ChanMsgItem::removeItem()";
std::cerr << std::endl;
#endif
mParent->lockLayout(this, true);
hide();
mParent->lockLayout(this, false);
if (mParent)
{
mParent->deleteFeedItem(this, mFeedId);
}
}
/*********** SPECIFIC FUNCTIONS ***********************/
void ChanMsgItem::readAndClearItem()
{
#ifdef DEBUG_ITEM
std::cerr << "ChanMsgItem::readAndClearItem()";
std::cerr << std::endl;
#endif
readToggled(false);
removeItem();
}
void ChanMsgItem::unsubscribeChannel()
{
#ifdef DEBUG_ITEM
std::cerr << "ChanMsgItem::unsubscribeChannel()";
std::cerr << std::endl;
#endif
if (rsChannels)
{
rsChannels->channelSubscribe(mChanId, false, false);
}
updateItemStatic();
}
void ChanMsgItem::download()
{
readToggled(false);
std::list<SubFileItem *>::iterator it;
for(it = mFileItems.begin(); it != mFileItems.end(); it++)
{
(*it)->download();
}
updateItem();
}
void ChanMsgItem::play()
{
std::list<SubFileItem *>::iterator it;
for(it = mFileItems.begin(); it != mFileItems.end(); it++)
{
bool startable;
if ((*it)->isPlayable(startable) && startable) {
(*it)->play();
}
}
}
void ChanMsgItem::readToggled(bool checked)
{
if (m_inUpdateItemStatic) {
return;
}
/* set always as read ... */
uint32_t statusNew = CHANNEL_MSG_STATUS_READ;
if (checked) {
/* ... and as unread by user */
statusNew |= CHANNEL_MSG_STATUS_UNREAD_BY_USER;
} else {
/* ... and as read by user */
statusNew &= ~CHANNEL_MSG_STATUS_UNREAD_BY_USER;
}
if (!mIsHome) {
disconnect( NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)));
}
rsChannels->setMessageStatus(mChanId, mMsgId, statusNew, CHANNEL_MSG_STATUS_READ | CHANNEL_MSG_STATUS_UNREAD_BY_USER);
if (!mIsHome) {
connect( NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection);
}
}
void ChanMsgItem::channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status)
{
if (channelId.toStdString() == mChanId && msgId.toStdString() == mMsgId) {
if (!mIsHome) {
if (status & CHANNEL_MSG_STATUS_READ) {
close();
return;
}
}
updateItemStatic();
}
}
void ChanMsgItem::copyLink()
{
if (mChanId.empty() || mMsgId.empty()) {
return;
}
ChannelMsgInfo cmi;
if (rsChannels->getChannelMessage(mChanId, mMsgId, cmi)) {
RetroShareLink link;
if (link.createChannel(cmi.channelId, cmi.msgId)) {
QList<RetroShareLink> urls;
urls.push_back(link);
RSLinkClipboard::copyLinks(urls);
}
}
}

View File

@ -1,74 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _CHAN_MSG_ITEM_DIALOG_H
#define _CHAN_MSG_ITEM_DIALOG_H
#include "ui_ChanMsgItem.h"
#include <stdint.h>
class FeedHolder;
class SubFileItem;
class ChanMsgItem : public QWidget, private Ui::ChanMsgItem
{
Q_OBJECT
public:
/** Default Constructor */
ChanMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &chanId, const std::string &msgId, bool isHome);
void updateItemStatic();
void setFileCleanUpWarning(uint32_t time_left);
const std::string &msgId() { return mMsgId; }
private slots:
/* default stuff */
void removeItem();
void toggle();
void readAndClearItem();
void unsubscribeChannel();
void download();
void play();
void copyLink();
void readToggled(bool checked);
void channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status);
void updateItem();
private:
FeedHolder *mParent;
uint32_t mFeedId;
std::string mChanId;
std::string mMsgId;
bool mIsHome;
bool m_inUpdateItemStatic;
std::list<SubFileItem *> mFileItems;
};
#endif

View File

@ -1,481 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ChanMsgItem</class>
<widget class="QWidget" name="ChanMsgItem">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>629</width>
<height>172</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>1</number>
</property>
<property name="margin">
<number>1</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="logoLabel">
<property name="maximumSize">
<size>
<width>156</width>
<height>107</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/thumb-default-video.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="titleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>11</pointsize>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="text">
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:11pt; font-weight:600; font-style:italic;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:normal; color:#656565;&quot;&gt;Channel Subject&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="datetimelabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="text">
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:600; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt; color:#666666;&quot;&gt;DateTime&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="subjectLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>60</height>
</size>
</property>
<property name="text">
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt; color:#666666;&quot;&gt;Short Description&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="filelabel">
<property name="font">
<font>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="text">
<string notr="true">fileLabel</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="warn_image_label">
<property name="maximumSize">
<size>
<width>24</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/status_unknown.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="warning_label">
<property name="text">
<string notr="true">TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>8</number>
</property>
<item>
<widget class="QPushButton" name="readButton">
<property name="maximumSize">
<size>
<width>24</width>
<height>16777215</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Toggle Message Read Status</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/message-state-unread.png</normaloff>:/images/message-state-unread.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="newLabel">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>21</height>
</size>
</property>
<property name="text">
<string>New</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="downloadButton">
<property name="font">
<font/>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Download</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/download16.png</normaloff>:/images/download16.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="playButton">
<property name="font">
<font/>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Play</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/player_play.png</normaloff>:/images/player_play.png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="copyLinkButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>16777215</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Copy RetroShare Link</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/copyrslink.png</normaloff>:/images/copyrslink.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="unsubscribeButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>16777215</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Unsubscribe From Channel</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/mail_delete.png</normaloff>:/images/mail_delete.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="expandButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>16777215</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Expand</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="readAndClearButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>16777215</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Set as read and remove item</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/cancel.png</normaloff>:/images/cancel.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="clearButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>16777215</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Remove Item</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/close_normal.png</normaloff>:/images/close_normal.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QFrame" name="expandFrame">
<layout class="QVBoxLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="msgFrame">
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>5</number>
</property>
<item>
<widget class="QLabel" name="msgLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>6</number>
</property>
<property name="indent">
<number>-1</number>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1,205 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "ChanNewItem.h"
#include "FeedHolder.h"
#include "gui/RetroShareLink.h"
#include <retroshare/rschannels.h>
#define CHAN_DEFAULT_IMAGE ":/images/channels.png"
/****
* #define DEBUG_ITEM 1
****/
/** Constructor */
ChanNewItem::ChanNewItem(FeedHolder *parent, uint32_t feedId, const std::string &chanId, bool isHome, bool isNew)
:QWidget(NULL), mParent(parent), mFeedId(feedId),
mChanId(chanId), mIsHome(isHome), mIsNew(isNew)
{
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
/* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
/* specific ones */
connect( subscribeButton, SIGNAL( clicked( void ) ), this, SLOT( subscribeChannel ( void ) ) );
expandFrame->hide();
updateItemStatic();
updateItem();
}
void ChanNewItem::updateItemStatic()
{
if (!rsChannels)
return;
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "ChanNewItem::updateItemStatic()";
std::cerr << std::endl;
#endif
ChannelInfo ci;
if (rsChannels->getChannelInfo(mChanId, ci))
{
RetroShareLink link;
link.createChannel(ci.channelId, "");
nameLabel->setText(link.toHtml());
descLabel->setText(QString::fromStdWString(ci.channelDesc));
if(ci.pngImageLen != 0){
QPixmap chanImage;
chanImage.loadFromData(ci.pngChanImage, ci.pngImageLen, "PNG");
logoLabel->setPixmap(QPixmap(chanImage));
} else {
QPixmap defaulImage(CHAN_DEFAULT_IMAGE);
logoLabel->setPixmap(QPixmap(defaulImage));
}
if (ci.channelFlags & RS_DISTRIB_SUBSCRIBED)
{
subscribeButton->setEnabled(false);
//postButton->setEnabled(true);
}
else
{
subscribeButton->setEnabled(true);
//postButton->setEnabled(false);
}
/* should also check the other flags */
}
else
{
nameLabel->setText(tr("Unknown Channel"));
titleLabel->setText("Channel ???");
descLabel->setText("");
}
if (mIsNew)
{
titleLabel->setText(tr("New Channel"));
}
else
{
titleLabel->setText(tr("Updated Channel"));
}
if (mIsHome)
{
/* disable buttons */
clearButton->setEnabled(false);
}
}
void ChanNewItem::updateItem()
{
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "ChanNewItem::updateItem()";
std::cerr << std::endl;
#endif
}
void ChanNewItem::toggle()
{
mParent->lockLayout(this, true);
if (expandFrame->isHidden())
{
expandFrame->show();
expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
expandButton->setToolTip(tr("Hide"));
}
else
{
expandFrame->hide();
expandButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
expandButton->setToolTip(tr("Expand"));
}
mParent->lockLayout(this, false);
}
void ChanNewItem::removeItem()
{
#ifdef DEBUG_ITEM
std::cerr << "ChanNewItem::removeItem()";
std::cerr << std::endl;
#endif
mParent->lockLayout(this, true);
hide();
mParent->lockLayout(this, false);
if (mParent)
{
mParent->deleteFeedItem(this, mFeedId);
}
}
/*********** SPECIFIC FUNCTIOSN ***********************/
void ChanNewItem::unsubscribeChannel()
{
#ifdef DEBUG_ITEM
std::cerr << "ChanNewItem::unsubscribeChannel()";
std::cerr << std::endl;
#endif
if (rsChannels)
{
rsChannels->channelSubscribe(mChanId, false, false);
}
updateItemStatic();
}
void ChanNewItem::subscribeChannel()
{
#ifdef DEBUG_ITEM
std::cerr << "ChanNewItem::subscribeChannel()";
std::cerr << std::endl;
#endif
if (rsChannels)
{
rsChannels->channelSubscribe(mChanId, true, true);
}
updateItemStatic();
}

View File

@ -1,60 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _CHANNEL_NEW_ITEM_DIALOG_H
#define _CHANNEL_NEW_ITEM_DIALOG_H
#include "ui_ChanNewItem.h"
#include <stdint.h>
class FeedHolder;
class ChanNewItem : public QWidget, private Ui::ChanNewItem
{
Q_OBJECT
public:
/** Default Constructor */
ChanNewItem(FeedHolder *parent, uint32_t feedId, const std::string &chanId, bool isHome, bool isNew);
void updateItemStatic();
private slots:
/* default stuff */
void removeItem();
void toggle();
void unsubscribeChannel();
void subscribeChannel();
void updateItem();
private:
FeedHolder *mParent;
uint32_t mFeedId;
std::string mChanId;
bool mIsHome;
bool mIsNew;
};
#endif

View File

@ -1,284 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ChanNewItem</class>
<widget class="QWidget" name="ChanNewItem">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>643</width>
<height>155</height>
</rect>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>248</red>
<green>248</green>
<blue>248</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>248</red>
<green>248</green>
<blue>248</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>248</red>
<green>248</green>
<blue>248</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QGridLayout">
<item row="0" column="0" rowspan="2">
<layout class="QGridLayout">
<item row="0" column="0" rowspan="2">
<widget class="QLabel" name="logoLabel">
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="nameLabel">
<property name="text">
<string notr="true">name</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="titleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">New Channel</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>338</width>
<height>28</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="subscribeButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Subscribe to Channel</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/directoryadd_24x24_shadow.png</normaloff>:/images/directoryadd_24x24_shadow.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="expandButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Expand</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="clearButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Remove Item</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/close_normal.png</normaloff>:/images/close_normal.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>455</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0" colspan="2">
<widget class="QFrame" name="expandFrame">
<layout class="QVBoxLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Channel Description</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="iconLabel">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/contacts24.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="descLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">Description
of Channel</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1,436 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QDateTime>
#include <QMessageBox>
#include "ForumMsgItem.h"
#include "FeedHolder.h"
#include "gui/RetroShareLink.h"
#include <retroshare/rsforums.h>
#include <retroshare/rsmsgs.h>
#include <retroshare/rspeers.h>
#include "gui/forums/CreateForumMsg.h"
#include "util/HandleRichText.h"
#include "util/DateTime.h"
#include "gui/common/AvatarDefs.h"
#include "gui/notifyqt.h"
#include "gui/ForumsDialog.h"
//#include "gui/settings/rsharesettings.h"
/****
* #define DEBUG_ITEM 1
****/
/** Constructor */
ForumMsgItem::ForumMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &forumId, const std::string &postId, bool isHome)
:QWidget(NULL), mParent(parent), mFeedId(feedId), mForumId(forumId), mPostId(postId), mIsHome(isHome), mIsTop(false)
{
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
/* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
/* specific ones */
connect(readAndClearButton, SIGNAL(clicked()), this, SLOT(readAndClearItem()));
connect( unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeForum ( void ) ) );
connect( replyButton, SIGNAL( clicked( void ) ), this, SLOT( replyToPost ( void ) ) );
connect( sendButton, SIGNAL( clicked( ) ), this, SLOT( sendMsg() ) );
connect(NotifyQt::getInstance(), SIGNAL(forumMsgReadSatusChanged(QString,QString,int)), this, SLOT(forumMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection);
subjectLabel->setMinimumWidth(20);
nextFrame->hide();
prevFrame->hide();
updateItemStatic();
updateItem();
textEdit->hide();
sendButton->hide();
signedcheckBox->hide();
}
void ForumMsgItem::updateItemStatic()
{
if (!rsForums)
return;
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "ForumMsgItem::updateItemStatic()";
std::cerr << std::endl;
#endif
canReply = false;
ForumInfo fi;
if (rsForums->getForumInfo(mForumId, fi))
{
RetroShareLink link;
link.createForum(fi.forumId, "");
QString title = tr("Forum Post") + ": ";
title += link.toHtml();
titleLabel->setText(title);
if (fi.subscribeFlags & (RS_DISTRIB_ADMIN | RS_DISTRIB_SUBSCRIBED))
{
unsubscribeButton->setEnabled(true);
replyButton->setEnabled(true);
if (fi.forumFlags & RS_DISTRIB_AUTHEN_REQ)
{
signedcheckBox->setChecked(true);
signedcheckBox->setEnabled(false);
}
canReply = true;
}
else
{
unsubscribeButton->setEnabled(false);
replyButton->setEnabled(false);
}
}
else
{
titleLabel->setText(tr("Unknown Forum Post"));
}
/* get actual Message */
ForumMsgInfo msg;
if (rsForums->getForumMessage(mForumId, mPostId, msg))
{
#ifdef DEBUG_ITEM
std::cerr << "Ids: MsgId: " << msg.msgId;
std::cerr << std::endl;
std::cerr << "Ids: ParentId: " << msg.parentId;
std::cerr << std::endl;
std::cerr << "Ids: ThreadId: " << msg.threadId;
std::cerr << std::endl;
#endif
/* decide if top or not */
if ((msg.msgId == msg.threadId) || (msg.threadId == ""))
{
mIsTop = true;
}
RetroShareLink link;
link.createForum(msg.forumId, msg.msgId);
if (mIsTop)
{
avatar->setId(msg.srcId, true);
if (rsPeers->getPeerName(msg.srcId) !="")
{
RetroShareLink linkMessage;
linkMessage.createMessage(msg.srcId, "");
nameLabel->setText(linkMessage.toHtml());
}
else
{
nameLabel->setText(tr("Anonymous"));
}
prevSubLabel->setText(link.toHtml());
prevMsgLabel->setText(RsHtml().formatText(NULL, ForumsDialog::messageFromInfo(msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
timestamplabel->setText(DateTime::formatLongDateTime(msg.ts));
nextFrame->hide();
}
else
{
nextAvatar->setId(msg.srcId, true);
if (rsPeers->getPeerName(msg.srcId) !="")
{
RetroShareLink linkMessage;
linkMessage.createMessage(msg.srcId, "");
nextNameLabel->setText(linkMessage.toHtml());
}
else
{
nextNameLabel->setText(tr("Anonymous"));
}
nextSubLabel->setText(link.toHtml());
nextMsgLabel->setText(RsHtml().formatText(NULL, ForumsDialog::messageFromInfo(msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
timestamplabel->setText(DateTime::formatLongDateTime(msg.ts));
prevSHLabel->setText(tr("In Reply to") + ": ");
ForumMsgInfo msgParent;
if (rsForums->getForumMessage(mForumId, msg.parentId, msgParent))
{
avatar->setId(msgParent.srcId, true);
RetroShareLink linkParent;
linkParent.createForum(msgParent.forumId, msgParent.msgId);
prevSubLabel->setText(linkParent.toHtml());
prevMsgLabel->setText(RsHtml().formatText(NULL, ForumsDialog::messageFromInfo(msgParent), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
if (rsPeers->getPeerName(msgParent.srcId) !="")
{
RetroShareLink linkMessage;
linkMessage.createMessage(msgParent.srcId, "");
nameLabel->setText(linkMessage.toHtml());
}
else
{
nameLabel->setText(tr("Anonymous"));
}
}
else
{
prevSubLabel->setText("???");
prevMsgLabel->setText("???");
}
}
/* header stuff */
subjectLabel->setText(link.toHtml());
//srcLabel->setText(QString::fromStdString(msg.srcId));
}
if (mIsHome)
{
/* disable buttons */
clearButton->setEnabled(false);
//gotoButton->setEnabled(false);
clearButton->hide();
}
unsubscribeButton->hide();
}
void ForumMsgItem::updateItem()
{
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "ForumMsgItem::updateItem()";
std::cerr << std::endl;
#endif
}
void ForumMsgItem::toggle()
{
mParent->lockLayout(this, true);
if (prevFrame->isHidden())
{
prevFrame->show();
textEdit->setVisible(canReply);
sendButton->setVisible(canReply);
signedcheckBox->setVisible(canReply);
expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
expandButton->setToolTip(tr("Hide"));
if (!mIsTop)
{
nextFrame->show();
}
setAsRead();
}
else
{
prevFrame->hide();
nextFrame->hide();
textEdit->hide();
sendButton->hide();
signedcheckBox->hide();
expandButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
expandButton->setToolTip(tr("Expand"));
}
mParent->lockLayout(this, false);
}
void ForumMsgItem::removeItem()
{
#ifdef DEBUG_ITEM
std::cerr << "ForumMsgItem::removeItem()";
std::cerr << std::endl;
#endif
mParent->lockLayout(this, true);
hide();
mParent->lockLayout(this, false);
if (mParent)
{
mParent->deleteFeedItem(this, mFeedId);
}
}
/*********** SPECIFIC FUNCTIOSN ***********************/
void ForumMsgItem::readAndClearItem()
{
#ifdef DEBUG_ITEM
std::cerr << "ForumMsgItem::readAndClearItem()";
std::cerr << std::endl;
#endif
setAsRead();
removeItem();
}
void ForumMsgItem::unsubscribeForum()
{
#ifdef DEBUG_ITEM
std::cerr << "ForumMsgItem::unsubscribeForum()";
std::cerr << std::endl;
#endif
if (rsForums)
{
rsForums->forumSubscribe(mForumId, false);
}
updateItemStatic();
}
void ForumMsgItem::subscribeForum()
{
#ifdef DEBUG_ITEM
std::cerr << "ForumMsgItem::subscribeForum()";
std::cerr << std::endl;
#endif
if (rsForums)
{
rsForums->forumSubscribe(mForumId, true);
}
updateItemStatic();
}
void ForumMsgItem::replyToPost()
{
if (canReply == false) {
return;
}
#ifdef DEBUG_ITEM
std::cerr << "ForumMsgItem::replyToPost()";
std::cerr << std::endl;
#endif
if (mParent)
{
CreateForumMsg *cfm = new CreateForumMsg(mForumId, mPostId);
cfm->show();
}
}
void ForumMsgItem::sendMsg()
{
if (canReply == false) {
return;
}
if(textEdit->toPlainText().isEmpty())
{ /* error message */
QMessageBox::warning(this, "RetroShare",tr("Please give a Text Message"),
QMessageBox::Ok, QMessageBox::Ok);
return; //Don't add a empty Message!!
}
ForumMsgInfo msg;
/* get message */
if (rsForums->getForumMessage(mForumId, mPostId, msg)) {
ForumMsgInfo msgInfo;
msgInfo.forumId = mForumId;
msgInfo.threadId = "";
msgInfo.parentId = mPostId;
msgInfo.msgId = "";
/* modify title */
QString text = QString::fromStdWString(msg.title);
if (text.startsWith("Re:", Qt::CaseInsensitive)) {
msgInfo.title = msg.title;
} else {
msgInfo.title = L"Re: " + msg.title;
}
QString desc;
RsHtml::optimizeHtml(textEdit, desc);
msgInfo.msg = desc.toStdWString();
msgInfo.msgflags = 0;
if (signedcheckBox->isChecked())
{
msgInfo.msgflags = RS_DISTRIB_AUTHEN_REQ;
}
if ((msgInfo.msg == L"") && (msgInfo.title == L""))
return; /* do nothing */
if (rsForums->ForumMessageSend(msgInfo) == true) {
textEdit->clear();
}
}
}
void ForumMsgItem::forumMsgReadSatusChanged(const QString &forumId, const QString &msgId, int status)
{
if (mForumId == forumId.toStdString() && mPostId == msgId.toStdString()) {
if (status & FORUM_MSG_STATUS_READ) {
close();
}
}
}
void ForumMsgItem::setAsRead()
{
if (canReply) {
uint32_t status;
rsForums->getMessageStatus(mForumId, mPostId, status);
/* set always to read ... */
uint32_t statusNew = status | FORUM_MSG_STATUS_READ;
// bool setToReadOnActive = Settings->getForumMsgSetToReadOnActivate();
// if (setToReadOnActive) {
/* ... and to read by user */
statusNew &= ~FORUM_MSG_STATUS_UNREAD_BY_USER;
// } else {
// /* ... and to unread by user */
// statusNew |= FORUM_MSG_STATUS_UNREAD_BY_USER;
// }
if (status != statusNew) {
disconnect(NotifyQt::getInstance(), SIGNAL(forumMsgReadSatusChanged(QString,QString,int)), this, SLOT(forumMsgReadSatusChanged(QString,QString,int)));
rsForums->setMessageStatus(mForumId, mPostId, statusNew, FORUM_MSG_STATUS_READ | FORUM_MSG_STATUS_UNREAD_BY_USER);
connect(NotifyQt::getInstance(), SIGNAL(forumMsgReadSatusChanged(QString,QString,int)), this, SLOT(forumMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection);
}
}
}

View File

@ -1,69 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _FORUM_MSG_ITEM_DIALOG_H
#define _FORUM_MSG_ITEM_DIALOG_H
#include "ui_ForumMsgItem.h"
class FeedHolder;
#include <stdint.h>
class ForumMsgItem : public QWidget, private Ui::ForumMsgItem
{
Q_OBJECT
public:
/** Default Constructor */
ForumMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &forumId, const std::string &postId, bool isHome);
void updateItemStatic();
private slots:
/* default stuff */
void removeItem();
void toggle();
void readAndClearItem();
void unsubscribeForum();
void subscribeForum();
void replyToPost();
void sendMsg();
void forumMsgReadSatusChanged(const QString &forumId, const QString &msgId, int status);
void updateItem();
private:
void setAsRead();
FeedHolder *mParent;
uint32_t mFeedId;
bool canReply;
std::string mForumId;
std::string mPostId;
bool mIsHome;
bool mIsTop;
};
#endif

View File

@ -1,664 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ForumMsgItem</class>
<widget class="QWidget" name="ForumMsgItem">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>577</width>
<height>387</height>
</rect>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<item row="2" column="0">
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>215</red>
<green>215</green>
<blue>215</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>215</red>
<green>215</green>
<blue>215</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>215</red>
<green>215</green>
<blue>215</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="iconLabel">
<property name="minimumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/konversation.png</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="titleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">Forum Name</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<layout class="QGridLayout">
<item row="0" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>358</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1" colspan="2">
<widget class="QLabel" name="timestamplabel">
<property name="font">
<font>
<pointsize>9</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">Timestamp</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="1" column="0" colspan="4">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>518</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Subject: </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="subjectLabel">
<property name="text">
<string notr="true">Subject...</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="unsubscribeButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Unsubscribe To Forum</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/mail_delete.png</normaloff>:/images/mail_delete.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="replyButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Reply</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/replymail24.png</normaloff>:/images/replymail24.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="expandButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Expand</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="readAndClearButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Set as read and remove item</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/cancel.png</normaloff>:/images/cancel.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="clearButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Remove Item</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/close_normal.png</normaloff>:/images/close_normal.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0" colspan="2">
<widget class="QFrame" name="prevFrame">
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QGridLayout">
<item row="0" column="0" rowspan="2">
<widget class="AvatarWidget" name="avatar">
<property name="minimumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="nameLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">Friend Name</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1" rowspan="2">
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="prevSHLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Subject: </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="prevSubLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">Message is about ???</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="0" rowspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>9</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1">
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="prevMsgLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">Previous Message...</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QFrame" name="nextFrame">
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QGridLayout">
<item row="0" column="0" rowspan="3">
<widget class="AvatarWidget" name="nextAvatar">
<property name="minimumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="nextNameLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">Next Name</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="2">
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="label_9">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Subject: </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="nextSubLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">Message is about ???</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>27</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="2" rowspan="2">
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="nextMsgLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">Current Message..</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QTextEdit" name="textEdit">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>40</height>
</size>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<layout class="QGridLayout">
<item row="0" column="0">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>2</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="sendButton">
<property name="text">
<string>Send</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="signedcheckBox">
<property name="text">
<string>Signed</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>AvatarWidget</class>
<extends>QLabel</extends>
<header>gui/common/AvatarWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1,206 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "ForumNewItem.h"
#include "FeedHolder.h"
#include <retroshare/rsforums.h>
#include "gui/forums/CreateForumMsg.h"
#include "gui/RetroShareLink.h"
/****
* #define DEBUG_ITEM 1
****/
/** Constructor */
ForumNewItem::ForumNewItem(FeedHolder *parent, uint32_t feedId, const std::string &forumId, bool isHome, bool isNew)
:QWidget(NULL), mParent(parent), mFeedId(feedId),
mForumId(forumId), mIsHome(isHome), mIsNew(isNew)
{
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
/* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
/* specific ones */
connect( subscribeButton, SIGNAL( clicked( void ) ), this, SLOT( subscribeForum ( void ) ) );
// To Cheeky to post on a brand new forum....
connect( postButton, SIGNAL( clicked( void ) ), this, SLOT( postToForum ( void ) ) );
expandFrame->hide();
updateItemStatic();
updateItem();
}
void ForumNewItem::updateItemStatic()
{
if (!rsForums)
return;
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "ForumNewItem::updateItemStatic()";
std::cerr << std::endl;
#endif
ForumInfo fi;
if (rsForums->getForumInfo(mForumId, fi))
{
RetroShareLink link;
link.createForum(fi.forumId, "");
nameLabel->setText(link.toHtml());
descLabel->setText(QString::fromStdWString(fi.forumDesc));
if (fi.subscribeFlags & RS_DISTRIB_SUBSCRIBED)
{
subscribeButton->setEnabled(false);
postButton->setEnabled(true);
}
else
{
subscribeButton->setEnabled(true);
postButton->setEnabled(false);
}
/* should also check the other flags */
}
else
{
nameLabel->setText(tr("Unknown Forum"));
titleLabel->setText(tr("New Forum"));
descLabel->setText("");
}
if (mIsNew)
{
titleLabel->setText(tr("New Forum"));
}
else
{
titleLabel->setText(tr("Updated Forum"));
}
if (mIsHome)
{
/* disable buttons */
clearButton->setEnabled(false);
}
}
void ForumNewItem::updateItem()
{
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "ForumNewItem::updateItem()";
std::cerr << std::endl;
#endif
}
void ForumNewItem::toggle()
{
mParent->lockLayout(this, true);
if (expandFrame->isHidden())
{
expandFrame->show();
expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
expandButton->setToolTip(tr("Hide"));
}
else
{
expandFrame->hide();
expandButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
expandButton->setToolTip(tr("Expand"));
}
mParent->lockLayout(this, false);
}
void ForumNewItem::removeItem()
{
#ifdef DEBUG_ITEM
std::cerr << "ForumNewItem::removeItem()";
std::cerr << std::endl;
#endif
mParent->lockLayout(this, true);
hide();
mParent->lockLayout(this, false);
if (mParent)
{
mParent->deleteFeedItem(this, mFeedId);
}
}
/*********** SPECIFIC FUNCTIOSN ***********************/
void ForumNewItem::unsubscribeForum()
{
#ifdef DEBUG_ITEM
std::cerr << "ForumNewItem::unsubscribeForum()";
std::cerr << std::endl;
#endif
if (rsForums)
{
rsForums->forumSubscribe(mForumId, false);
}
updateItemStatic();
}
void ForumNewItem::subscribeForum()
{
#ifdef DEBUG_ITEM
std::cerr << "ForumNewItem::subscribeForum()";
std::cerr << std::endl;
#endif
if (rsForums)
{
rsForums->forumSubscribe(mForumId, true);
}
updateItemStatic();
}
void ForumNewItem::postToForum()
{
#ifdef DEBUG_ITEM
std::cerr << "ForumNewItem::subscribeForum()";
std::cerr << std::endl;
#endif
if (mParent)
{
//mParent->openMsg(FEEDHOLDER_MSG_FORUM, mForumId, "");
CreateForumMsg *cfm = new CreateForumMsg(mForumId, "");
cfm->show();
}
}

View File

@ -1,61 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _FORUM_NEW_ITEM_DIALOG_H
#define _FORUM_NEW_ITEM_DIALOG_H
#include "ui_ForumNewItem.h"
#include <stdint.h>
class FeedHolder;
class ForumNewItem : public QWidget, private Ui::ForumNewItem
{
Q_OBJECT
public:
/** Default Constructor */
ForumNewItem(FeedHolder *parent, uint32_t feedId, const std::string &forumId, bool isHome, bool isNew);
void updateItemStatic();
private slots:
/* default stuff */
void removeItem();
void toggle();
void unsubscribeForum();
void subscribeForum();
void postToForum();
void updateItem();
private:
FeedHolder *mParent;
uint32_t mFeedId;
std::string mForumId;
bool mIsHome;
bool mIsNew;
};
#endif

View File

@ -1,325 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ForumNewItem</class>
<widget class="QWidget" name="ForumNewItem">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>618</width>
<height>117</height>
</rect>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>215</red>
<green>215</green>
<blue>215</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>215</red>
<green>215</green>
<blue>215</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>215</red>
<green>215</green>
<blue>215</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>215</red>
<green>215</green>
<blue>215</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QVBoxLayout">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/konversation.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="titleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">Forum</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="nameLabel">
<property name="text">
<string notr="true">name</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>500</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="subscribeButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Subscribe to Forum</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/directoryadd_24x24_shadow.png</normaloff>:/images/directoryadd_24x24_shadow.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="postButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/mail_new.png</normaloff>:/images/mail_new.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="expandButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Expand</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="clearButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Remove Item</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/close_normal.png</normaloff>:/images/close_normal.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QFrame" name="expandFrame">
<layout class="QVBoxLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Forum Description</string>
</property>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="iconLabel">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/contacts24.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="descLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">Description
of Forum</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1,134 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QMessageBox>
#include "util/misc.h"
#include "CreateForum.h"
#include "gui/common/PeerDefs.h"
#include <algorithm>
#include <retroshare/rsforums.h>
#include <retroshare/rspeers.h>
/** Constructor */
CreateForum::CreateForum()
: QDialog(NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
setAttribute(Qt::WA_DeleteOnClose, true);
ui.headerFrame->setHeaderImage(QPixmap(":/images/konversation64.png"));
ui.headerFrame->setHeaderText(tr("New Forum"));
// connect up the buttons.
connect( ui.buttonBox, SIGNAL(accepted()), this, SLOT(createForum()));
connect( ui.buttonBox, SIGNAL(rejected()), this, SLOT(close()));
connect( ui.pubKeyShare_cb, SIGNAL( clicked() ), this, SLOT( setShareList( ) ));
if (!ui.pubKeyShare_cb->isChecked()) {
ui.contactsdockWidget->hide();
this->resize(this->size().width() - ui.contactsdockWidget->size().width(), this->size().height());
}
/* initialize key share list */
ui.keyShareList->setHeaderText(tr("Contacts:"));
ui.keyShareList->setModus(FriendSelectionWidget::MODUS_CHECK);
ui.keyShareList->setShowType(FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_SSL);
ui.keyShareList->start();
newForum();
}
void CreateForum::newForum()
{
/* enforce Public for the moment */
ui.typePublic->setChecked(true);
ui.typePrivate->setEnabled(false);
ui.typeEncrypted->setEnabled(true);
#ifdef RS_RELEASE_VERSION
ui.typePrivate->setVisible(false);
ui.typeEncrypted->setVisible(true);
#endif
ui.msgAnon->setChecked(true);
//ui.msgAuth->setEnabled(false);
ui.forumName->clear();
ui.forumDesc->clear();
ui.forumName->setFocus();
}
void CreateForum::createForum()
{
QString name = misc::removeNewLine(ui.forumName->text());
QString desc = ui.forumDesc->toPlainText(); //toHtml();
uint32_t flags = 0;
if(name.isEmpty()) {
/* error message */
QMessageBox::warning(this, "RetroShare", tr("Please add a Name"), QMessageBox::Ok, QMessageBox::Ok);
return; //Don't add a empty name!!
}
if (ui.typePublic->isChecked()) {
flags |= RS_DISTRIB_PUBLIC;
} else if (ui.typePrivate->isChecked()) {
flags |= RS_DISTRIB_PRIVATE;
} else if (ui.typeEncrypted->isChecked()) {
flags |= RS_DISTRIB_ENCRYPTED;
}
if (ui.msgAuth->isChecked()) {
flags |= RS_DISTRIB_AUTHEN_REQ;
} else if (ui.msgAnon->isChecked()) {
flags |= RS_DISTRIB_AUTHEN_ANON;
}
if (rsForums) {
std::string forumId = rsForums->createForum(name.toStdWString(), desc.toStdWString(), flags);
if (ui.pubKeyShare_cb->isChecked()) {
std::list<std::string> shareList;
ui.keyShareList->selectedSslIds(shareList, false);
rsForums->forumShareKeys(forumId, shareList);
}
}
close();
}
void CreateForum::setShareList()
{
if (ui.pubKeyShare_cb->isChecked()){
this->resize(this->size().width() + ui.contactsdockWidget->size().width(), this->size().height());
ui.contactsdockWidget->show();
} else { // hide share widget
ui.contactsdockWidget->hide();
this->resize(this->size().width() - ui.contactsdockWidget->size().width(), this->size().height());
}
}

View File

@ -1,54 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _CREATE_FORUM_DIALOG_H
#define _CREATE_FORUM_DIALOG_H
#include "ui_CreateForum.h"
class CreateForum : public QDialog
{
Q_OBJECT
public:
CreateForum();
void newForum(); /* cleanup */
private slots:
/* actions to take.... */
void createForum();
// set private forum key share list
void setShareList();
private:
std::list<std::string> mShareList;
QPixmap picture;
/** Qt Designer generated object */
Ui::CreateForum ui;
};
#endif

View File

@ -1,314 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CreateForum</class>
<widget class="QDialog" name="CreateForum">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>672</width>
<height>495</height>
</rect>
</property>
<property name="windowTitle">
<string>Create new Forum</string>
</property>
<property name="windowIcon">
<iconset resource="../images.qrc">
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="HeaderFrame" name="headerFrame"/>
</item>
<item>
<widget class="QFrame" name="frame">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="forumName"/>
</item>
</layout>
</item>
<item row="0" column="1" rowspan="5">
<widget class="QDockWidget" name="contactsdockWidget">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>524287</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>220</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>check peers you would like to share private publish key with</string>
</property>
<property name="floating">
<bool>false</bool>
</property>
<property name="features">
<set>QDockWidget::NoDockWidgetFeatures</set>
</property>
<property name="windowTitle">
<string>Share Key With</string>
</property>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QGridLayout" name="_2">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="FriendSelectionWidget" name="keyShareList" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>4</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>16777215</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>220</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="1" column="0">
<layout class="QVBoxLayout">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Description</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="forumDesc"/>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="tyoeGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Type:</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QRadioButton" name="typePublic">
<property name="text">
<string>Public - Anyone can read and publish (Shared Publish Key)</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="typePrivate">
<property name="text">
<string>Restricted - Anyone can read, limited publishing (Private Publish Key)</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QRadioButton" name="typeEncrypted">
<property name="text">
<string>Private - (Private Publish Key required to view Messages)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QGroupBox" name="msgGroupBox_2">
<property name="title">
<string>Key Sharing</string>
</property>
<layout class="QVBoxLayout" name="_5">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>6</number>
</property>
<item>
<widget class="QCheckBox" name="pubKeyShare_cb">
<property name="toolTip">
<string>Key recipients can publish to restricted-type channels, and can view and publish for private-type channels</string>
</property>
<property name="text">
<string>Share Private Publish Key</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="4" column="0">
<widget class="QGroupBox" name="msgGroupBox">
<property name="title">
<string>Allowed Messages</string>
</property>
<layout class="QVBoxLayout" name="_4">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>6</number>
</property>
<item>
<widget class="QRadioButton" name="msgAuth">
<property name="text">
<string>Authenticated Messages</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="msgAnon">
<property name="text">
<string>Anonymous Messages</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="5" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>HeaderFrame</class>
<extends>QFrame</extends>
<header>gui/common/HeaderFrame.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>FriendSelectionWidget</class>
<extends>QWidget</extends>
<header>gui/common/FriendSelectionWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1,259 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "CreateForumMsg.h"
#include <QMenu>
#include <QMessageBox>
#include <QFile>
#include <QDesktopWidget>
#include <QDropEvent>
#include <QPushButton>
#include <retroshare/rsforums.h>
#include <retroshare/rspeers.h>
#include "gui/settings/rsharesettings.h"
#include "gui/RetroShareLink.h"
#include "gui/common/Emoticons.h"
#include "util/HandleRichText.h"
#include "util/misc.h"
#include <sys/stat.h>
/** Constructor */
CreateForumMsg::CreateForumMsg(const std::string &fId, const std::string &pId)
: QDialog(NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint), mForumId(fId), mParentId(pId)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
setAttribute(Qt::WA_DeleteOnClose, true);
QString text = pId.empty() ? tr("Start New Thread") : tr("Post Forum Message");
setWindowTitle(text);
ui.headerFrame->setHeaderImage(QPixmap(":/images/konversation64.png"));
ui.headerFrame->setHeaderText(text);
Settings->loadWidgetInformation(this);
connect( ui.forumMessage, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( forumMessageCostumPopupMenu( QPoint ) ) );
connect(ui.hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>)));
// connect up the buttons.
connect( ui.buttonBox, SIGNAL(accepted()), this, SLOT(createMsg()));
connect( ui.buttonBox, SIGNAL(rejected()), this, SLOT(close()));
connect( ui.emoticonButton, SIGNAL(clicked()), this, SLOT(smileyWidgetForums()));
connect( ui.attachFileButton, SIGNAL(clicked() ), this , SLOT(addFile()));
connect( ui.pastersButton, SIGNAL(clicked() ), this , SLOT(pasteLink()));
setAcceptDrops(true);
ui.hashBox->setDropWidget(this);
ui.hashBox->setAutoHide(false);
newMsg();
}
/** context menu searchTablewidget2 **/
void CreateForumMsg::forumMessageCostumPopupMenu(QPoint point)
{
QMenu *contextMnu = ui.forumMessage->createStandardContextMenu(point);
contextMnu->addSeparator();
QAction *pasteLinkAct = contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste RetroShare Link"), this, SLOT(pasteLink()));
QAction *pasteLinkFullAct = contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste full RetroShare Link"), this, SLOT(pasteLinkFull()));
contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste my certificate link"), this, SLOT(pasteOwnCertificateLink()));
if (RSLinkClipboard::empty()) {
pasteLinkAct->setDisabled (true);
pasteLinkFullAct->setDisabled (true);
}
contextMnu->exec(QCursor::pos());
delete(contextMnu);
}
void CreateForumMsg::newMsg()
{
/* clear all */
ForumInfo fi;
if (rsForums->getForumInfo(mForumId, fi))
{
ForumMsgInfo msg;
QString name = QString::fromStdWString(fi.forumName);
QString subj;
if ((mParentId != "") && (rsForums->getForumMessage(mForumId, mParentId, msg)))
{
QString title = QString::fromStdWString(msg.title);
name += " " + tr("In Reply to") + ": ";
name += title;
QString text = title;
if (text.startsWith("Re:", Qt::CaseInsensitive))
{
subj = title;
}
else
{
subj = "Re: " + title;
}
}
ui.forumName->setText(misc::removeNewLine(name));
ui.forumSubject->setText(misc::removeNewLine(subj));
if (!ui.forumSubject->text().isEmpty())
{
ui.forumMessage->setFocus();
}
else
{
ui.forumSubject->setFocus();
}
if (fi.forumFlags & RS_DISTRIB_AUTHEN_REQ)
{
ui.signBox->setChecked(true);
ui.signBox->setEnabled(false);
}
else
{
/* Uncheck sign box by default for anonymous forums */
ui.signBox->setChecked(false);
ui.signBox->setEnabled(true);
}
}
ui.forumMessage->setText("");
}
void CreateForumMsg::createMsg()
{
QString name = misc::removeNewLine(ui.forumSubject->text());
QString desc;
RsHtml::optimizeHtml(ui.forumMessage, desc);
if(name.isEmpty())
{ /* error message */
QMessageBox::warning(this, tr("RetroShare"),tr("Please set a Forum Subject and Forum Message"),
QMessageBox::Ok, QMessageBox::Ok);
return; //Don't add a empty Subject!!
}
ForumMsgInfo msgInfo;
msgInfo.forumId = mForumId;
msgInfo.threadId = "";
msgInfo.parentId = mParentId;
msgInfo.msgId = "";
msgInfo.title = name.toStdWString();
msgInfo.msg = desc.toStdWString();
msgInfo.msgflags = 0;
if (ui.signBox->isChecked())
{
msgInfo.msgflags = RS_DISTRIB_AUTHEN_REQ;
}
if ((msgInfo.msg == L"") && (msgInfo.title == L""))
return; /* do nothing */
if (rsForums->ForumMessageSend(msgInfo) == true) {
close();
}
}
void CreateForumMsg::closeEvent (QCloseEvent * /*event*/)
{
Settings->saveWidgetInformation(this);
}
void CreateForumMsg::smileyWidgetForums()
{
Emoticons::showSmileyWidget(this, ui.emoticonButton, SLOT(addSmileys()), false);
}
void CreateForumMsg::addSmileys()
{
ui.forumMessage->textCursor().insertText(qobject_cast<QPushButton*>(sender())->toolTip().split("|").first());
}
void CreateForumMsg::addFile()
{
QStringList files;
if (misc::getOpenFileNames(this, RshareSettings::LASTDIR_EXTRAFILE, tr("Add Extra File"), "", files)) {
ui.hashBox->addAttachments(files,RS_FILE_REQ_ANONYMOUS_ROUTING);
}
}
void CreateForumMsg::fileHashingFinished(QList<HashedFile> hashedFiles)
{
std::cerr << "CreateForumMsg::fileHashingFinished() started." << std::endl;
QString mesgString;
QList<HashedFile>::iterator it;
for (it = hashedFiles.begin(); it != hashedFiles.end(); ++it) {
HashedFile& hashedFile = *it;
RetroShareLink link;
if (link.createFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash))) {
mesgString += link.toHtmlSize() + "<br>";
}
}
#ifdef CHAT_DEBUG
std::cerr << "CreateForumMsg::anchorClicked mesgString : " << mesgString.toStdString() << std::endl;
#endif
if (!mesgString.isEmpty()) {
ui.forumMessage->textCursor().insertHtml(mesgString);
}
ui.forumMessage->setFocus( Qt::OtherFocusReason );
}
void CreateForumMsg::pasteLink()
{
ui.forumMessage->insertHtml(RSLinkClipboard::toHtml()) ;
}
void CreateForumMsg::pasteLinkFull()
{
ui.forumMessage->insertHtml(RSLinkClipboard::toHtmlFull()) ;
}
void CreateForumMsg::pasteOwnCertificateLink()
{
RetroShareLink link ;
std::string ownId = rsPeers->getOwnId() ;
if( link.createCertificate(ownId) ) {
ui.forumMessage->insertHtml(link.toHtml() + " ");
}
}

View File

@ -1,64 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _CREATE_FORUM_MSG_DIALOG_H
#define _CREATE_FORUM_MSG_DIALOG_H
#include "ui_CreateForumMsg.h"
class CreateForumMsg : public QDialog
{
Q_OBJECT
public:
CreateForumMsg(const std::string &fId, const std::string &pId);
void newMsg(); /* cleanup */
private slots:
/** Create the context popup menu and it's submenus */
void forumMessageCostumPopupMenu( QPoint point );
void fileHashingFinished(QList<HashedFile> hashedFiles);
/* actions to take.... */
void createMsg();
void pasteLink();
void pasteLinkFull();
void pasteOwnCertificateLink();
void smileyWidgetForums();
void addSmileys();
void addFile();
protected:
void closeEvent (QCloseEvent * event);
private:
std::string mForumId;
std::string mParentId;
/** Qt Designer generated object */
Ui::CreateForumMsg ui;
};
#endif

View File

@ -1,282 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CreateForumMsg</class>
<widget class="QDialog" name="CreateForumMsg">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>482</width>
<height>448</height>
</rect>
</property>
<property name="windowTitle">
<string>Post Forum Message</string>
</property>
<property name="windowIcon">
<iconset resource="../images.qrc">
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="HeaderFrame" name="headerFrame"/>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QFrame" name="subjectFrame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="forumLabel">
<property name="text">
<string>Forum</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="forumName">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="subjectLabel">
<property name="text">
<string>Subject</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="forumSubject"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="toolBarFrame">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>38</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout">
<property name="margin">
<number>6</number>
</property>
<item>
<widget class="QToolButton" name="attachFileButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Attach File</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/add-share24.png</normaloff>:/images/add-share24.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="emoticonButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/emoticons/kopete/kopete020.png</normaloff>:/images/emoticons/kopete/kopete020.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="signBox">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Sign Message</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/pgp.png</normaloff>:/images/pgp.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>15</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="pastersButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Paste RetroShare Link</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/pasterslink.png</normaloff>:/images/pasterslink.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="messageGroupBox">
<property name="title">
<string>Forum Post</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTextEdit" name="forumMessage">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="html">
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="hashGroupBox">
<property name="title">
<string>Attach files via drag and drop</string>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<widget class="HashBox" name="hashBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>You can attach files via drag and drop here in this window</string>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>HeaderFrame</class>
<extends>QFrame</extends>
<header>gui/common/HeaderFrame.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>HashBox</class>
<extends>QScrollArea</extends>
<header location="global">gui/common/HashBox.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1,82 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2010 RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "EditForumDetails.h"
#include <retroshare/rsforums.h>
#include "util/misc.h"
#include <list>
#include <iostream>
#include <string>
/** Default constructor */
EditForumDetails::EditForumDetails(std::string forumId, QWidget *parent)
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), m_forumId(forumId)
{
/* Invoke Qt Designer generated QObject setup routine */
ui.setupUi(this);
connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(applyDialog()));
connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(close()));
loadForum();
}
void EditForumDetails::loadForum()
{
if (!rsForums) {
return;
}
ForumInfo info;
rsForums->getForumInfo(m_forumId, info);
// set name
ui.nameline->setText(QString::fromStdWString(info.forumName));
// set description
ui.DescriptiontextEdit->setText(QString::fromStdWString(info.forumDesc));
}
void EditForumDetails::applyDialog()
{
if (!rsForums) {
return;
}
// if text boxes have not been edited leave alone
if (!ui.nameline->isModified() && !ui.DescriptiontextEdit->document()->isModified()) {
return;
}
ForumInfo info;
info.forumName = misc::removeNewLine(ui.nameline->text()).toStdWString();
info.forumDesc = ui.DescriptiontextEdit->document()->toPlainText().toStdWString();
rsForums->setForumInfo(m_forumId, info);
/* close the Dialog after the Changes applied */
close();
}

View File

@ -1,53 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2010 RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _EDITFORUMDETAILS_H
#define _EDITFORUMDETAILS_H
#include <QDialog>
#include "ui_EditForumDetails.h"
class EditForumDetails : public QDialog
{
Q_OBJECT
public:
/** Default constructor */
EditForumDetails(std::string forumId = "", QWidget *parent = 0);
signals:
void configChanged();
private slots:
void applyDialog();
private:
void loadForum();
std::string m_forumId;
/** Qt Designer generated object */
Ui::EditForumDetails ui;
};
#endif

View File

@ -1,87 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EditForumDetails</class>
<widget class="QDialog" name="EditForumDetails">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>436</width>
<height>355</height>
</rect>
</property>
<property name="windowTitle">
<string>Forum Details</string>
</property>
<property name="windowIcon">
<iconset resource="../images.qrc">
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0">
<layout class="QGridLayout" name="_2">
<item row="0" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QTabWidget" name="stabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/info16.png</normaloff>:/images/info16.png</iconset>
</attribute>
<attribute name="title">
<string>Edit Forum Details</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Forum Info</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Forum Name</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="nameline"/>
</item>
<item row="1" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Forum Description</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTextEdit" name="DescriptiontextEdit"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1,112 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2009 RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "ForumDetails.h"
#include "util/DateTime.h"
#include <retroshare/rsiface.h>
#include <retroshare/rspeers.h>
#include <retroshare/rsdisc.h>
#include <retroshare/rsforums.h>
#include <QTime>
#include <QDateTime>
#include <list>
#include <iostream>
#include <string>
/** Default constructor */
ForumDetails::ForumDetails(QWidget *parent)
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
{
/* Invoke Qt Designer generated QObject setup routine */
ui.setupUi(this);
connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(close()));
ui.nameline ->setReadOnly(true);
ui.popline ->setReadOnly(true);
ui.postline ->setReadOnly(true);
ui.IDline ->setReadOnly(true);
ui.DescriptiontextEdit ->setReadOnly(true);
ui.radioButton_authd->setEnabled(false);
ui.radioButton_anonymous->setEnabled(false);
}
/**
Overloads the default show() slot so we can set opacity*/
void
ForumDetails::show()
{
//loadSettings();
if(!this->isVisible()) {
QDialog::show();
}
}
void ForumDetails::showDetails(std::string mCurrForumId)
{
fId = mCurrForumId;
loadDialog();
}
void ForumDetails::loadDialog()
{
if (!rsForums)
{
return;
}
ForumInfo fi;
rsForums->getForumInfo(fId, fi);
// Set Forum Name
ui.nameline->setText(QString::fromStdWString(fi.forumName));
// Set Popularity
ui.popline->setText(QString::number(fi.pop));
// Set Last Post Date
if (fi.lastPost) {
ui.postline->setText(DateTime::formatLongDateTime(fi.lastPost));
}
// Set Forum ID
ui.IDline->setText(QString::fromStdString(fi.forumId));
// Set Forum Description
ui.DescriptiontextEdit->setText(QString::fromStdWString(fi.forumDesc));
if (fi.forumFlags & RS_DISTRIB_AUTHEN_REQ)
{
ui.radioButton_authd->setChecked(true);
ui.radioButton_anonymous->setChecked(false);
}
if (fi.forumFlags & RS_DISTRIB_AUTHEN_ANON)
{
ui.radioButton_authd->setChecked(false);
ui.radioButton_anonymous->setChecked(true);
}
}

View File

@ -1,57 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2009 RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _FORUMDETAILS_H
#define _FORUMDETAILS_H
#include <QDialog>
#include "ui_ForumDetails.h"
class ForumDetails : public QDialog
{
Q_OBJECT
public:
/** Default constructor */
ForumDetails(QWidget *parent = 0);
void showDetails(std::string mCurrForumId);
signals:
void configChanged() ;
public slots:
/** Overloaded QWidget.show */
void show();
private:
void loadDialog();
std::string fId;
/** Qt Designer generated object */
Ui::ForumDetails ui;
};
#endif

View File

@ -1,175 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ForumDetails</class>
<widget class="QDialog" name="ForumDetails">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>436</width>
<height>355</height>
</rect>
</property>
<property name="windowTitle">
<string>Forum Details</string>
</property>
<property name="windowIcon">
<iconset resource="../images.qrc">
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QTabWidget" name="stabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/info16.png</normaloff>:/images/info16.png</iconset>
</attribute>
<attribute name="title">
<string>Forum Details</string>
</attribute>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Forum Info</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Forum Name</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="nameline"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Popularity</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="popline">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Last Post</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="postline">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Forum ID</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="IDline"/>
</item>
<item row="4" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Forum Description</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QTextEdit" name="DescriptiontextEdit"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="Seite">
<attribute name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/encrypted22.png</normaloff>:/images/encrypted22.png</iconset>
</attribute>
<attribute name="title">
<string>Security</string>
</attribute>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Allowed Messages</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QRadioButton" name="radioButton_authd">
<property name="text">
<string>Authenticated Messages</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="radioButton_anonymous">
<property name="text">
<string>Anonymous Messages</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>358</width>
<height>172</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
<item row="1" column="0">
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1,106 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2012 RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "ForumUserNotify.h"
#include "gui/settings/rsharesettings.h"
#include "gui/notifyqt.h"
#include "gui/MainWindow.h"
#include <retroshare/rsforums.h>
ForumUserNotify::ForumUserNotify(QObject *parent) :
UserNotify(parent)
{
connect(NotifyQt::getInstance(), SIGNAL(forumsChanged()), this, SLOT(updateIcon()), Qt::QueuedConnection);
}
bool ForumUserNotify::hasSetting(QString &name)
{
name = tr("Forum Post");
return true;
}
bool ForumUserNotify::notifyEnabled()
{
return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_FORUMS);
}
bool ForumUserNotify::notifyCombined()
{
return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_FORUMS_COMBINED);
}
bool ForumUserNotify::notifyBlink()
{
return (Settings->getTrayNotifyBlinkFlags() & TRAYNOTIFY_BLINK_FORUMS);
}
void ForumUserNotify::setNotifyEnabled(bool enabled, bool combined, bool blink)
{
uint notifyFlags = Settings->getTrayNotifyFlags();
uint blinkFlags = Settings->getTrayNotifyBlinkFlags();
if (enabled) {
notifyFlags |= TRAYNOTIFY_FORUMS;
} else {
notifyFlags &= ~TRAYNOTIFY_FORUMS;
}
if (combined) {
notifyFlags |= TRAYNOTIFY_FORUMS_COMBINED;
} else {
notifyFlags &= ~TRAYNOTIFY_FORUMS_COMBINED;
}
if (blink) {
blinkFlags |= TRAYNOTIFY_BLINK_FORUMS;
} else {
blinkFlags &= ~TRAYNOTIFY_BLINK_FORUMS;
}
Settings->setTrayNotifyFlags(notifyFlags);
Settings->setTrayNotifyBlinkFlags(blinkFlags);
}
QIcon ForumUserNotify::getIcon()
{
return QIcon(":/images/konversation16.png");
}
QIcon ForumUserNotify::getMainIcon(bool hasNew)
{
return hasNew ? QIcon(":/images/forums_new.png") : QIcon(":/images/konversation.png");
}
unsigned int ForumUserNotify::getNewCount()
{
unsigned int newMessageCount = 0;
unsigned int unreadMessageCount = 0;
rsForums->getMessageCount("", newMessageCount, unreadMessageCount);
return newMessageCount;
}
void ForumUserNotify::iconClicked()
{
MainWindow::showWindow(MainWindow::Forums);
}

View File

@ -1,47 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2012 RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef FORUMUSERNOTIFY_H
#define FORUMUSERNOTIFY_H
#include "gui/common/UserNotify.h"
class ForumUserNotify : public UserNotify
{
Q_OBJECT
public:
ForumUserNotify(QObject *parent = 0);
virtual bool hasSetting(QString &name);
virtual bool notifyEnabled();
virtual bool notifyCombined();
virtual bool notifyBlink();
virtual void setNotifyEnabled(bool enabled, bool combined, bool blink);
private:
virtual QIcon getIcon();
virtual QIcon getMainIcon(bool hasNew);
virtual unsigned int getNewCount();
virtual void iconClicked();
};
#endif // FORUMUSERNOTIFY_H

View File

@ -1,58 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006, crypton
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "ForumPage.h"
#include "rshare.h"
#include "rsharesettings.h"
#include "../MainWindow.h"
#include "../ForumsDialog.h"
ForumPage::ForumPage(QWidget * parent, Qt::WFlags flags)
: ConfigPage(parent, flags)
{
ui.setupUi(this);
setAttribute(Qt::WA_QuitOnClose, false);
}
ForumPage::~ForumPage()
{
}
/** Saves the changes on this page */
bool
ForumPage::save(QString &/*errmsg*/)
{
Settings->setForumMsgSetToReadOnActivate(ui.setMsgToReadOnActivate->isChecked());
Settings->setForumExpandNewMessages(ui.expandNewMessages->isChecked());
Settings->setForumOpenAllInNewTab(ui.openAllInNewTabCheckBox->isChecked());
return true;
}
/** Loads the settings for this page */
void
ForumPage::load()
{
ui.setMsgToReadOnActivate->setChecked(Settings->getForumMsgSetToReadOnActivate());
ui.expandNewMessages->setChecked(Settings->getForumExpandNewMessages());
ui.openAllInNewTabCheckBox->setChecked(Settings->getForumOpenAllInNewTab());
}

View File

@ -1,49 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006, crypton
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef FORUMPAGE_H
#define FORUMPAGE_H
#include <retroshare-gui/configpage.h>
#include "ui_ForumPage.h"
class ForumPage : public ConfigPage
{
Q_OBJECT
public:
ForumPage(QWidget * parent = 0, Qt::WFlags flags = 0);
~ForumPage();
/** Saves the changes on this page */
virtual bool save(QString &errmsg);
/** Loads the settings for this page */
virtual void load();
virtual QPixmap iconPixmap() const { return QPixmap(":/images/konversation.png") ; }
virtual QString pageName() const { return tr("Forum") ; }
private:
Ui::ForumPage ui;
};
#endif // !FORUMPAGE_H

View File

@ -1,70 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ForumPage</class>
<widget class="QWidget" name="ForumPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>423</width>
<height>340</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Misc</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QCheckBox" name="setMsgToReadOnActivate">
<property name="text">
<string>Set message to read on activate</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="expandNewMessages">
<property name="text">
<string>Expand new messages</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="gxsGroupBox">
<property name="title">
<string>New forum</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="openAllInNewTabCheckBox">
<property name="text">
<string>Open all forums in new tab</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -110,12 +110,14 @@ uint NotifyPage::getNewsFlags()
if (ui.notify_Peers->isChecked())
newsFlags |= RS_FEED_TYPE_PEER;
#if 0
if (ui.notify_Channels->isChecked())
newsFlags |= RS_FEED_TYPE_CHAN;
if (ui.notify_Forums->isChecked())
newsFlags |= RS_FEED_TYPE_FORUM;
if (ui.notify_Blogs->isChecked())
newsFlags |= RS_FEED_TYPE_BLOG;
#endif
if (ui.notify_Messages->isChecked())
newsFlags |= RS_FEED_TYPE_MSG;
if (ui.notify_Chat->isChecked())
@ -210,9 +212,11 @@ void NotifyPage::load()
ui.popup_ConnectAttempt->setChecked(notifyflags & RS_POPUP_CONNECT_ATTEMPT);
ui.notify_Peers->setChecked(newsflags & RS_FEED_TYPE_PEER);
#if 0
ui.notify_Channels->setChecked(newsflags & RS_FEED_TYPE_CHAN);
ui.notify_Forums->setChecked(newsflags & RS_FEED_TYPE_FORUM);
ui.notify_Blogs->setChecked(newsflags & RS_FEED_TYPE_BLOG);
#endif
ui.notify_Chat->setChecked(newsflags & RS_FEED_TYPE_CHAT);
ui.notify_Messages->setChecked(newsflags & RS_FEED_TYPE_MSG);
ui.notify_Chat->setChecked(newsflags & RS_FEED_TYPE_CHAT);

View File

@ -112,7 +112,7 @@ void ServerPage::toggleIpDetermination(bool b)
void ServerPage::toggleTunnelConnection(bool b)
{
std::cerr << "ServerPage::toggleTunnelConnection() set tunnel to : " << b << std::endl;
rsPeers->allowTunnelConnection(b) ;
//rsPeers->allowTunnelConnection(b) ;
}
/** Saves the changes on this page */

View File

@ -36,7 +36,7 @@
#include "RelayPage.h"
#include "ChatPage.h"
#include "MessagePage.h"
#include "ForumPage.h"
//#include "ForumPage.h"
#include "PluginsPage.h"
#include "rsharesettings.h"
#include "gui/notifyqt.h"
@ -127,7 +127,7 @@ RSettingsWin::initStackedWidget()
addPage(new NotifyPage());
addPage(new CryptoPage());
addPage(new MessagePage());
addPage(new ForumPage());
//addPage(new ForumPage());
addPage(new ChatPage());
addPage(new AppearancePage());
addPage(new SoundPage() );

View File

@ -123,8 +123,8 @@ void RshareSettings::initSettings()
uint defNotify = (RS_POPUP_CONNECT | RS_POPUP_MSG);
uint defNewsFeed = (RS_FEED_TYPE_PEER | RS_FEED_TYPE_CHAN |
RS_FEED_TYPE_FORUM | RS_FEED_TYPE_BLOG |
uint defNewsFeed = (RS_FEED_TYPE_PEER |
// RS_FEED_TYPE_CHAN | RS_FEED_TYPE_FORUM | RS_FEED_TYPE_BLOG |
RS_FEED_TYPE_CHAT | RS_FEED_TYPE_MSG |
RS_FEED_TYPE_FILES | RS_FEED_TYPE_SECURITY);

View File

@ -1,147 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2009 RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "BlogDetails.h"
#include <retroshare/rsiface.h>
#include <retroshare/rspeers.h>
#include <retroshare/rsdisc.h>
#include <retroshare/rsblogs.h>
#include <QTime>
#include <QDateTime>
#include <list>
#include <iostream>
#include <string>
/** Default constructor */
BlogDetails::BlogDetails(QWidget *parent, Qt::WFlags flags)
: QDialog(parent, flags)
{
/* Invoke Qt Designer generated QObject setup routine */
ui.setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
connect(ui.applyButton, SIGNAL(clicked()), this, SLOT(applyDialog()));
connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(closeinfodlg()));
ui.applyButton->setToolTip(tr("Close"));
ui.nameline ->setReadOnly(true);
ui.popline ->setReadOnly(true);
ui.postline ->setReadOnly(true);
ui.IDline ->setReadOnly(true);
ui.DescriptiontextEdit ->setReadOnly(true);
}
/** Overloads the default show() */
void
BlogDetails::show()
{
if(!this->isVisible()) {
QDialog::show();
}
}
void BlogDetails::closeEvent (QCloseEvent * event)
{
QWidget::closeEvent(event);
}
void BlogDetails::closeinfodlg()
{
close();
}
void BlogDetails::showDetails(std::string mBlogId)
{
bId = mBlogId;
loadBlog();
}
void BlogDetails::loadBlog()
{
if (!rsBlogs)
{
return;
}
std::list<BlogInfo> channelList;
std::list<BlogInfo>::iterator it;
BlogInfo bi;
rsBlogs->getBlogInfo(bId, bi);
rsBlogs->getBlogList(channelList);
for(it = channelList.begin(); it != channelList.end(); it++)
{
// Set Blog Name
ui.nameline->setText(QString::fromStdWString(bi.blogName));
// Set Blog Popularity
{
std::ostringstream out;
out << it->pop;
ui.popline -> setText(QString::fromStdString(out.str()));
}
// Set Last Blog Post Date
{
QDateTime qtime;
qtime.setTime_t(it->lastPost);
QString timestamp = qtime.toString(Qt::DefaultLocaleShortDate);
ui.postline -> setText(timestamp);
}
// Set Blog ID
ui.IDline->setText(QString::fromStdString(bi.blogId));
// Set Blog Description
ui.DescriptiontextEdit->setText(QString::fromStdWString(bi.blogDesc));
}
}
void BlogDetails::applyDialog()
{
/* reload now */
loadBlog();
/* close the Dialog after the Changes applied */
closeinfodlg();
}

View File

@ -1,68 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2009 RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _BLOGDETAILS_H
#define _BLOGDETAILS_H
#include <QDialog>
#include "ui_BlogDetails.h"
class BlogDetails : public QDialog
{
Q_OBJECT
public:
/** Default constructor */
BlogDetails(QWidget *parent = 0, Qt::WFlags flags = 0);
/** Default destructor */
void showDetails(std::string mChannelId);
signals:
void configChanged() ;
public slots:
/** Overloaded QWidget.show */
void show();
protected:
void closeEvent (QCloseEvent * event);
private slots:
void closeinfodlg();
void applyDialog();
private:
void loadBlog();
std::string bId;
/** Qt Designer generated object */
Ui::BlogDetails ui;
};
#endif

View File

@ -1,151 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>BlogDetails</class>
<widget class="QDialog" name="BlogDetails">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>436</width>
<height>355</height>
</rect>
</property>
<property name="windowTitle">
<string>Blog Details</string>
</property>
<property name="windowIcon">
<iconset resource="../../images.qrc">
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QTabWidget" name="stabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/info16.png</normaloff>:/images/info16.png</iconset>
</attribute>
<attribute name="title">
<string>Blog Details</string>
</attribute>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Blog Info</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Blog Name</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="nameline"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Popularity</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="popline">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Last Post</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="postline">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Blog ID</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="IDline"/>
</item>
<item row="4" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Blog Description</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTextEdit" name="DescriptiontextEdit"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="_2">
<item row="0" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>311</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="applyButton">
<property name="text">
<string>OK</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1,588 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QMenu>
#include <QTimer>
#include <QStandardItemModel>
#include <algorithm>
#include <retroshare/rsblogs.h>
#include <retroshare/rspeers.h> //to retrieve peer/usrId info
#include "BlogsDialog.h"
#include "BlogsMsgItem.h"
#include "CreateBlog.h"
#include "CreateBlogMsg.h"
#include "BlogDetails.h"
#include "gui/ChanGroupDelegate.h"
#define BLOG_DEFAULT_IMAGE ":/images/hi64-app-kblogger.png"
/** Constructor */
BlogsDialog::BlogsDialog(QWidget *parent)
: MainPage (parent)
{
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
connect(actionCreate_Blog, SIGNAL(triggered()), this, SLOT(createBlog()));
connect(postButton, SIGNAL(clicked()), this, SLOT(createMsg()));
connect(subscribeButton, SIGNAL( clicked( void ) ), this, SLOT( subscribeBlog ( void ) ) );
connect(unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeBlog ( void ) ) );
connect(treeView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(selectBlog(const QModelIndex &)));
connect(treeView, SIGNAL(activated(const QModelIndex &)), this, SLOT(toggleSelection(const QModelIndex &)));
connect(treeView, SIGNAL(customContextMenuRequested( QPoint ) ), this, SLOT( blogListCustomPopupMenu( QPoint ) ) );
mBlogId = "";
mPeerId = rsPeers->getOwnId(); // add your id
model = new QStandardItemModel(0, 2, this);
model->setHeaderData(0, Qt::Horizontal, tr("Name"), Qt::DisplayRole);
model->setHeaderData(1, Qt::Horizontal, tr("ID"), Qt::DisplayRole);
treeView->setModel(model);
treeView->setEditTriggers(QAbstractItemView::NoEditTriggers);
treeView->setItemDelegate(new ChanGroupDelegate());
// hide header and id column
treeView->setHeaderHidden(true);
treeView->hideColumn(1);
itemFont = QFont("ARIAL", 10);
itemFont.setBold(true);
QStandardItem *OwnBlogs = new QStandardItem(tr("My Blogs"));
OwnBlogs->setForeground(QBrush(QColor(79, 79, 79)));
OwnBlogs->setFont(itemFont);
QStandardItem *SubscribedBlogs = new QStandardItem(tr("Subscribed Blogs"));
SubscribedBlogs->setForeground(QBrush(QColor(79, 79, 79)));
SubscribedBlogs->setFont(itemFont);
QStandardItem *PopularBlogs = new QStandardItem(tr("Popular Blogs"));
PopularBlogs->setForeground(QBrush(QColor(79, 79, 79)));
PopularBlogs->setFont(itemFont);
QStandardItem *OtherBlogs = new QStandardItem(tr("Other Blogs"));
OtherBlogs->setForeground(QBrush(QColor(79, 79, 79)));
OtherBlogs->setFont(itemFont);
model->appendRow(OwnBlogs);
model->appendRow(SubscribedBlogs);
model->appendRow(PopularBlogs);
model->appendRow(OtherBlogs);
//added from ahead
updateBlogList();
mBlogFont = QFont("MS SANS SERIF", 22);
nameLabel->setFont(mBlogFont);
nameLabel->setMinimumWidth(20);
QMenu *blogmenu = new QMenu();
blogmenu->addAction(actionCreate_Blog);
blogmenu->addSeparator();
blogpushButton->setMenu(blogmenu);
QTimer *timer = new QTimer(this);
timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
timer->start(1000);
}
void BlogsDialog::blogListCustomPopupMenu( QPoint point )
{
BlogInfo bi;
if (!rsBlogs->getBlogInfo(mBlogId, bi))
{
return;
}
QMenu contextMnu( this );
QAction *createblogpostAct = new QAction(QIcon(":/images/mail_reply.png"), tr( "Post to Blog" ), this );
connect( createblogpostAct , SIGNAL( triggered() ), this, SLOT( createMsg() ) );
QAction *subscribeblogAct = new QAction(QIcon(":/images/edit_add24.png"), tr( "Subscribe to Blog" ), this );
connect( subscribeblogAct , SIGNAL( triggered() ), this, SLOT( subscribeBlog() ) );
QAction *unsubscribeblogAct = new QAction(QIcon(":/images/cancel.png"), tr( "Unsubscribe to Blog" ), this );
connect( unsubscribeblogAct , SIGNAL( triggered() ), this, SLOT( unsubscribeBlog() ) );
QAction *blogdetailsAct = new QAction(QIcon(":/images/info16.png"), tr( "Show Blog Details" ), this );
connect( blogdetailsAct , SIGNAL( triggered() ), this, SLOT( showBlogDetails() ) );
contextMnu.clear();
if (bi.blogFlags & RS_DISTRIB_PUBLISH)
{
contextMnu.addAction( createblogpostAct );
contextMnu.addSeparator();
contextMnu.addAction( blogdetailsAct );
}
else if (bi.blogFlags & RS_DISTRIB_SUBSCRIBED)
{
contextMnu.addAction( unsubscribeblogAct );
contextMnu.addSeparator();
contextMnu.addAction( blogdetailsAct );;
}
else
{
contextMnu.addAction( subscribeblogAct );
contextMnu.addSeparator();
contextMnu.addAction( blogdetailsAct );
}
contextMnu.exec(QCursor::pos());
}
void BlogsDialog::createBlog()
{
CreateBlog cf (this, false);
cf.setWindowTitle(tr("Create a new Blog"));
cf.exec();
}
void BlogsDialog::blogSelection()
{
/* which item was selected? */
/* update mBlogId */
updateBlogMsgs();
}
/*************************************************************************************/
/*************************************************************************************/
/*************************************************************************************/
void BlogsDialog::deleteFeedItem(QWidget *item, uint32_t type)
{
return;
}
void BlogsDialog::openChat(std::string peerId)
{
return;
}
void BlogsDialog::createMsg()
{
if (mBlogId == "")
{
return;
}
CreateBlogMsg *msgDialog = new CreateBlogMsg(mBlogId);
msgDialog->show();
/* window will destroy itself! */
}
void BlogsDialog::selectBlog( std::string bId)
{
mBlogId = bId;
updateBlogMsgs();
}
void BlogsDialog::selectBlog(const QModelIndex &index)
{
int row = index.row();
int col = index.column();
if (col != 1) {
QModelIndex sibling = index.sibling(row, 1);
if (sibling.isValid())
mBlogId = sibling.data().toString().toStdString();
} else
mBlogId = index.data().toString().toStdString();
updateBlogMsgs();
}
void BlogsDialog::checkUpdate()
{
std::list<std::string> blogIds;
std::list<std::string>::iterator it;
if (!rsBlogs)
return;
if (rsBlogs->blogsChanged(blogIds))
{
/* update Blogs List */
updateBlogList();
it = std::find(blogIds.begin(), blogIds.end(), mBlogId);
if (it != blogIds.end())
{
updateBlogMsgs();
}
}
}
void BlogsDialog::updateBlogList()
{
std::list<BlogInfo> channelList;
std::list<BlogInfo>::iterator it;
if (!rsBlogs)
{
return;
}
rsBlogs->getBlogList(channelList);
/* get the ids for our lists */
std::list<std::string> adminIds;
std::list<std::string> subIds;
std::list<std::string> popIds;
std::list<std::string> otherIds;
std::multimap<uint32_t, std::string> popMap;
for(it = channelList.begin(); it != channelList.end(); it++)
{
/* sort it into Publish (Own), Subscribed, Popular and Other */
uint32_t flags = it->blogFlags;
if (flags & RS_DISTRIB_ADMIN)
{
adminIds.push_back(it->blogId);
}
else if (flags & RS_DISTRIB_SUBSCRIBED)
{
subIds.push_back(it->blogId);
}
else
{
/* rate the others by popularity */
popMap.insert(std::make_pair(it->pop, it->blogId));
}
}
/* iterate backwards through popMap - take the top 5 or 10% of list */
uint32_t popCount = 5;
if (popCount < popMap.size() / 10)
{
popCount = popMap.size() / 10;
}
uint32_t i = 0;
std::multimap<uint32_t, std::string>::reverse_iterator rit;
for(rit = popMap.rbegin(); rit != popMap.rend(); rit++)
{
if(i < popCount){
popIds.push_back(rit->second);
i++;
}else{
otherIds.push_back(rit->second);
}
}
/* now we have our lists ---> update entries */
updateBlogListOwn(adminIds);
updateBlogListSub(subIds);
updateBlogListPop(popIds);
updateBlogListOther(otherIds);
}
void BlogsDialog::updateBlogListOwn(std::list<std::string> &ids)
{
std::list<std::string>::iterator iit;
/* remove rows with groups before adding new ones */
model->item(OWN)->removeRows(0, model->item(OWN)->rowCount());
for (iit = ids.begin(); iit != ids.end(); iit ++) {
#ifdef BLOG_DEBUG
std::cerr << "BlogsDialog::updateBlogListOwn(): " << *iit << std::endl;
#endif
QStandardItem *ownGroup = model->item(OWN);
QList<QStandardItem *> blog;
QStandardItem *blogNameitem = new QStandardItem();
QStandardItem *blogIditem = new QStandardItem();
BlogInfo bi;
if (rsBlogs && rsBlogs->getBlogInfo(*iit, bi)) {
blogNameitem->setData(QVariant(QString::fromStdWString(bi.blogName)), Qt::DisplayRole);
blogIditem->setData(QVariant(QString::fromStdString(bi.blogId)), Qt::DisplayRole);
blogNameitem->setToolTip(tr("Popularity: %1\nFetches: %2\nAvailable: %3"
).arg(QString::number(bi.pop)).arg(9999).arg(9999));
} else {
blogNameitem->setData(QVariant(QString("Unknown Blog")), Qt::DisplayRole);
blogIditem->setData(QVariant(QString::fromStdString(*iit)), Qt::DisplayRole);
blogNameitem->setToolTip("Unknown Blog\nNo Description");
}
blog.append(blogNameitem);
blog.append(blogIditem);
ownGroup->appendRow(blog);
}
}
void BlogsDialog::updateBlogListSub(std::list<std::string> &ids)
{
std::list<std::string>::iterator iit;
/* remove rows with groups before adding new ones */
model->item(SUBSCRIBED)->removeRows(0, model->item(SUBSCRIBED)->rowCount());
for (iit = ids.begin(); iit != ids.end(); iit ++) {
#ifdef BLOG_DEBUG
std::cerr << "BlogsDialog::updateBlogListSub(): " << *iit << std::endl;
#endif
QStandardItem *ownGroup = model->item(SUBSCRIBED);
QList<QStandardItem *> blog;
QStandardItem *blogNameitem = new QStandardItem();
QStandardItem *blogIditem = new QStandardItem();
BlogInfo bi;
if (rsBlogs && rsBlogs->getBlogInfo(*iit, bi)) {
blogNameitem->setData(QVariant(QString::fromStdWString(bi.blogName)), Qt::DisplayRole);
blogIditem->setData(QVariant(QString::fromStdString(bi.blogId)), Qt::DisplayRole);
blogNameitem->setToolTip(tr("Popularity: %1\nFetches: %2\nAvailable: %3"
).arg(QString::number(bi.pop)).arg(9999).arg(9999));
} else {
blogNameitem->setData(QVariant(QString("Unknown Blog")), Qt::DisplayRole);
blogIditem->setData(QVariant(QString::fromStdString(*iit)), Qt::DisplayRole);
blogNameitem->setToolTip("Unknown Blog\nNo Description");
}
blog.append(blogNameitem);
blog.append(blogIditem);
ownGroup->appendRow(blog);
}
}
void BlogsDialog::updateBlogListPop(std::list<std::string> &ids)
{
std::list<std::string>::iterator iit;
/* remove rows with groups before adding new ones */
model->item(POPULAR)->removeRows(0, model->item(POPULAR)->rowCount());
for (iit = ids.begin(); iit != ids.end(); iit ++) {
#ifdef BLOG_DEBUG
std::cerr << "BlogsDialog::updateBlogListPop(): " << *iit << std::endl;
#endif
QStandardItem *ownGroup = model->item(POPULAR);
QList<QStandardItem *> blog;
QStandardItem *blogNameitem = new QStandardItem();
QStandardItem *blogIditem = new QStandardItem();
BlogInfo bi;
if (rsBlogs && rsBlogs->getBlogInfo(*iit, bi)) {
blogNameitem->setData(QVariant(QString::fromStdWString(bi.blogName)), Qt::DisplayRole);
blogIditem->setData(QVariant(QString::fromStdString(bi.blogId)), Qt::DisplayRole);
blogNameitem->setToolTip(tr("Popularity: %1\nFetches: %2\nAvailable: %3"
).arg(QString::number(bi.pop)).arg(9999).arg(9999));
} else {
blogNameitem->setData(QVariant(QString("Unknown Blog")), Qt::DisplayRole);
blogIditem->setData(QVariant(QString::fromStdString(*iit)), Qt::DisplayRole);
blogNameitem->setToolTip("Unknown Blog\nNo Description");
}
blog.append(blogNameitem);
blog.append(blogIditem);
ownGroup->appendRow(blog);
}
}
void BlogsDialog::updateBlogListOther(std::list<std::string> &ids)
{
std::list<std::string>::iterator iit;
/* remove rows with groups before adding new ones */
model->item(OTHER)->removeRows(0, model->item(OTHER)->rowCount());
for (iit = ids.begin(); iit != ids.end(); iit ++) {
#ifdef BLOG_DEBUG
std::cerr << "BlogsDialog::updateBlogListOther(): " << *iit << std::endl;
#endif
QStandardItem *ownGroup = model->item(OTHER);
QList<QStandardItem *> blog;
QStandardItem *blogNameitem = new QStandardItem();
QStandardItem *blogIditem = new QStandardItem();
BlogInfo bi;
if (rsBlogs && rsBlogs->getBlogInfo(*iit, bi)) {
blogNameitem->setData(QVariant(QString::fromStdWString(bi.blogName)), Qt::DisplayRole);
blogIditem->setData(QVariant(QString::fromStdString(bi.blogId)), Qt::DisplayRole);
blogNameitem->setToolTip(tr("Popularity: %1\nFetches: %2\nAvailable: %3"
).arg(QString::number(bi.pop)).arg(9999).arg(9999));
} else {
blogNameitem->setData(QVariant(QString("Unknown Blog")), Qt::DisplayRole);
blogIditem->setData(QVariant(QString::fromStdString(*iit)), Qt::DisplayRole);
blogNameitem->setToolTip("Unknown Blog\nNo Description");
}
blog.append(blogNameitem);
blog.append(blogIditem);
ownGroup->appendRow(blog);
}
}
void BlogsDialog::updateBlogMsgs()
{
if (!rsBlogs)
return;
BlogInfo bi;
if (!rsBlogs->getBlogInfo(mBlogId, bi))
{
postButton->setEnabled(false);
subscribeButton->setEnabled(false);
unsubscribeButton->setEnabled(false);
nameLabel->setText("No Blog Selected");
iconLabel->setPixmap(QPixmap(":/images/hi64-app-kblogger.png"));
iconLabel->setEnabled(false);
frame->setStyleSheet("QFrame#frame{ border: 2px solid #808080;border-radius: 10px;background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #C0C0C0, stop:1 #A0A0A0); }");
return;
}
if(bi.pngImageLen != 0){
QPixmap blogImage;
blogImage.loadFromData(bi.pngChanImage, bi.pngImageLen, "PNG");
iconLabel->setPixmap(blogImage);
iconLabel->setStyleSheet("QLabel{border: 2px solid white;}");
}else{
QPixmap defaultImage(BLOG_DEFAULT_IMAGE);
iconLabel->setPixmap(defaultImage);
iconLabel->setStyleSheet("QLabel{border: 2px solid white;border-radius: 10px;}");
}
iconLabel->setEnabled(true);
/* set textcolor for Blog name */
QString blogStr("<span style=\"font-size:22pt; font-weight:500;"
"color:white;\">%1</span>");
/* set Blog name */
QString bname = QString::fromStdWString(bi.blogName);
nameLabel->setText(blogStr.arg(bname));
/* do buttons */
if (bi.blogFlags & RS_DISTRIB_SUBSCRIBED)
{
subscribeButton->setEnabled(false);
unsubscribeButton->setEnabled(true);
frame->setStyleSheet("QFrame#frame{ border: 2px solid #FF0000;border-radius: 10px;background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #B61407, stop:1 #A91106); }");
}
else
{
subscribeButton->setEnabled(true);
unsubscribeButton->setEnabled(false);
frame->setStyleSheet("QFrame#frame{ border: 2px solid #267F00;border-radius: 10px;background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #89D51D, stop:1 #579E10); }");
}
if (bi.blogFlags & RS_DISTRIB_PUBLISH)
{
postButton->setEnabled(true);
frame->setStyleSheet("QFrame#frame{ border: 2px solid #6ACEFF;border-radius: 10px;background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #0076B1, stop:1 #12A3EB); }");
}
else
{
postButton->setEnabled(false);
}
/* replace all the messages with new ones */
std::list<BlogsMsgItem *>::iterator mit;
for(mit = mBlogMsgItems.begin(); mit != mBlogMsgItems.end(); mit++)
{
delete (*mit);
}
mBlogMsgItems.clear();
std::list<BlogMsgSummary> msgs;
std::list<BlogMsgSummary>::iterator it;
rsBlogs->getBlogMsgList(mBlogId, msgs);
for(it = msgs.begin(); it != msgs.end(); it++)
{
BlogsMsgItem *cmi = new BlogsMsgItem(this, 0, mPeerId, mBlogId, it->msgId, true);
mBlogMsgItems.push_back(cmi);
verticalLayout_2->addWidget(cmi);
}
}
void BlogsDialog::unsubscribeBlog()
{
#ifdef BLOG_DEBUG
std::cerr << "BlogsDialog::unsubscribeBlog()";
std::cerr << std::endl;
#endif
if (rsBlogs)
{
rsBlogs->blogSubscribe(mBlogId, false);
}
updateBlogMsgs();
}
void BlogsDialog::subscribeBlog()
{
#ifdef BLOG_DEBUG
std::cerr << "BlogsDialog::subscribeBlog()";
std::cerr << std::endl;
#endif
if (rsBlogs)
{
rsBlogs->blogSubscribe(mBlogId, true);
}
updateBlogMsgs();
}
void BlogsDialog::toggleSelection(const QModelIndex &index)
{
QItemSelectionModel *selectionModel = treeView->selectionModel();
if (index.child(0, 0).isValid())
selectionModel->select(index, QItemSelectionModel::Toggle);
}
void BlogsDialog::showBlogDetails()
{
if (mBlogId == "")
{
return;
}
if (!rsBlogs)
return;
BlogDetails *blogui = new BlogDetails();
blogui->showDetails(mBlogId);
blogui->show();
/* window will destroy itself! */
}

View File

@ -1,107 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _BLOGSDIALOG_H
#define _BLOGSDIALOG_H
#include "gui/mainpage.h"
#include "ui_BlogsDialog.h"
#include "gui/feeds/FeedHolder.h"
class QStandardItemModel;
#define OWN 0
#define SUBSCRIBED 1
#define POPULAR 2
#define OTHER 3
class BlogsMsgItem;
class BlogsDialog : public MainPage, public FeedHolder, private Ui::BlogsDialog
{
Q_OBJECT
public:
/** Default Constructor */
BlogsDialog(QWidget *parent = 0);
/** Default Destructor */
virtual void deleteFeedItem(QWidget *item, uint32_t type);
virtual void openChat(std::string peerId);
public slots:
void selectBlog( std::string );
void selectBlog(const QModelIndex &);
void toggleSelection(const QModelIndex &);
private slots:
void blogListCustomPopupMenu( QPoint point );
void checkUpdate();
void createBlog();
//void sendMsg();
void blogSelection();
void subscribeBlog();
void unsubscribeBlog();
void createMsg();
void showBlogDetails();
private:
void updateBlogList();
void updateBlogListOwn(std::list<std::string> &ids);
void updateBlogListSub(std::list<std::string> &ids);
void updateBlogListPop(std::list<std::string> &ids);
void updateBlogListOther(std::list<std::string> &ids);
void updateBlogMsgs();
QStandardItemModel *model;
std::string mBlogId; /* current Blog */
std::string mPeerId;
/* Layout Pointers */
QBoxLayout *mMsgLayout;
std::list<BlogsMsgItem *> mBlogMsgItems;
QFont mBlogFont;
QFont itemFont;
};
#endif

View File

@ -1,568 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>BlogsDialog</class>
<widget class="QWidget" name="BlogsDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>681</width>
<height>476</height>
</rect>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<widget class="QFrame" name="chanFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>222</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>222</width>
<height>16777215</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>221</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="chheaderframe">
<property name="minimumSize">
<size>
<width>220</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>220</width>
<height>38</height>
</size>
</property>
<property name="baseSize">
<size>
<width>220</width>
<height>0</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"> QFrame#chheaderframe{
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #FEFEFE, stop:1 #E8E8E8);
border: 1px solid #CCCCCC;}
</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<property name="margin">
<number>2</number>
</property>
<item row="0" column="0">
<layout class="QGridLayout" name="_2">
<property name="verticalSpacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../images.qrc">:/images/kblogger.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<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;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Arial'; font-size:10pt; font-weight:600;&quot;&gt;Blogs&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>123</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="blogpushButton">
<property name="toolTip">
<string>Add</string>
</property>
<property name="styleSheet">
<string notr="true">QPushButton::menu-indicator {
subcontrol-origin: padding;
subcontrol-position: bottom right;
}
QPushButton::menu-indicator:pressed, QPushButton::menu-indicator:open {
position: relative;
top: 2px; left: 2px; /* shift the arrow by 2 px */
}
QPushButton:hover {
border: 1px solid #CCCCCC;
}</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.png</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="default">
<bool>false</bool>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="postButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<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;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Post To Blog&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/mail_send.png</normaloff>:/images/mail_send.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QTreeView" name="treeView">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QFrame" name="frame">
<property name="styleSheet">
<string notr="true">QFrame#frame{
border: 2px solid #6ACEFF;
border-radius: 10px;
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #0076B1, stop:1 #12A3EB);}</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="verticalSpacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<property name="horizontalSpacing">
<number>16</number>
</property>
<property name="margin">
<number>9</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="iconLabel">
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QLabel{
border: 2px solid white;
border-radius: 10px;
}</string>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../images.qrc">:/images/hi64-app-kblogger.png</pixmap>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="nameLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<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;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:600; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'DejaVu Sans'; font-size:14pt; color:#ffffff;&quot;&gt;Blog Name&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<item row="0" column="3">
<widget class="QPushButton" name="unsubscribeButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="toolTip">
<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;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;Unsubscribe To Blog&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="styleSheet">
<string notr="true">QToolButton, QPushButton, QComboBox {
border-image: url(:/images/btn_26.png) 4;
border-width: 4;
padding: 0px 6px;
font-size: 12px;
}
QToolButton:hover, QPushButton:hover, QComboBox:hover {
border-image: url(:/images/btn_26_hover.png) 4;
}
QToolButton:disabled, QPushButton:disabled, QComboBox::disabled {
color:gray;
}
QToolButton:pressed, QPushButton:pressed{
border-image: url(:/images/btn_26_pressed.png) 4;
}</string>
</property>
<property name="text">
<string>Unsubscribe</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="subscribeButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>26</height>
</size>
</property>
<property name="toolTip">
<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;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;Subscribe To Blog&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="styleSheet">
<string notr="true">QToolButton, QPushButton, QComboBox {
border-image: url(:/images/btn_26.png) 4;
border-width: 4;
padding: 0px 6px;
font-size: 12px;
}
QToolButton:hover, QPushButton:hover, QComboBox:hover {
border-image: url(:/images/btn_26_hover.png) 4;
}
QToolButton:disabled, QPushButton:disabled, QComboBox::disabled {
color:gray;
}
QToolButton:pressed, QPushButton:pressed{
border-image: url(:/images/btn_26_pressed.png) 4;
}</string>
</property>
<property name="text">
<string>Subscribe</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QFrame" name="msgFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_8">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>429</width>
<height>332</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QWidget#scrollAreaWidgetContents{border: none;}</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2"/>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>391</width>
<height>266</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
<action name="actionCreate_Blog">
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/kblogger.png</normaloff>:/images/kblogger.png</iconset>
</property>
<property name="text">
<string>Create New Blog</string>
</property>
<property name="toolTip">
<string>Create New Blog</string>
</property>
</action>
</widget>
<resources>
<include location="../../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1,192 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QDateTime>
#include "BlogsMsgItem.h"
#include "gui/feeds/FeedHolder.h"
#include <retroshare/rsblogs.h>
#include "rshare.h"
/****
* #define DEBUG_ITEM 1
****/
/** Constructor */
BlogsMsgItem::BlogsMsgItem(FeedHolder *parent, uint32_t feedId, std::string peerId, std::string blogId, std::string msgId, bool isHome)
:QWidget(NULL), mParent(parent), mFeedId(feedId),
mPeerId(peerId), mBlogId(blogId), mMsgId(msgId), mIsHome(isHome)
{
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
/* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
//connect( gotoButton, SIGNAL( clicked( void ) ), this, SLOT( gotoHome ( void ) ) );
/* specific ones */
//connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( playMedia ( void ) ) );
connect( unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeChannel ( void ) ) );
small();
updateItemStatic();
updateItem();
}
void BlogsMsgItem::updateItemStatic()
{
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "ChanMsgItem::updateItemStatic()";
std::cerr << std::endl;
#endif
BlogMsgInfo cmi;
if (!rsBlogs)
return;
if (!rsBlogs->getBlogMessage(mBlogId, mMsgId, cmi))
return;
QString title;
if (!mIsHome)
{
BlogInfo ci;
rsBlogs->getBlogInfo(mBlogId, ci);
title = "Channel Feed: ";
title += QString::fromStdWString(ci.blogName);
titleLabel->setText(title);
//subjectLabel->setText(QString::fromStdWString(cmi.subject));
}
else
{
/* subject */
titleLabel->setText(QString::fromStdWString(cmi.subject));
/* Blog Message */
textBrowser->setHtml( QString::fromStdWString(cmi.msg));
}
//msgLabel->setText(QString::fromStdWString(cmi.msg));
//msgcommentstextEdit->setHtml(QString::fromStdWString(cmi.msg));
datetimelabel->setText(Rshare::customDate(cmi.ts));
//playButton->setEnabled(false);
if (mIsHome)
{
/* disable buttons */
clearButton->setEnabled(false);
//gotoButton->setEnabled(false);
unsubscribeButton->setEnabled(false);
clearButton->hide();
}
/* don't really want this at all! */
unsubscribeButton->hide();
//playButton->hide();
}
void BlogsMsgItem::updateItem()
{
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "BlogMsgItem::updateItem()";
std::cerr << std::endl;
#endif
}
void BlogsMsgItem::small()
{
expandFrame->hide();
}
void BlogsMsgItem::toggle()
{
if (expandFrame->isHidden())
{
expandFrame->show();
expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
expandButton->setToolTip(tr("Hide"));
}
else
{
expandFrame->hide();
expandButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
expandButton->setToolTip(tr("Expand"));
}
}
void BlogsMsgItem::removeItem()
{
#ifdef DEBUG_ITEM
std::cerr << "ChanMsgItem::removeItem()";
std::cerr << std::endl;
#endif
hide();
if (mParent)
{
mParent->deleteFeedItem(this, mFeedId);
}
}
void BlogsMsgItem::gotoHome()
{
#ifdef DEBUG_ITEM
std::cerr << "ChanMsgItem::gotoHome()";
std::cerr << std::endl;
#endif
}
/*********** SPECIFIC FUNCTIOSN ***********************/
void BlogsMsgItem::unsubscribeChannel()
{
#ifdef DEBUG_ITEM
std::cerr << "ChanMsgItem::unsubscribeChannel()";
std::cerr << std::endl;
#endif
}
void BlogsMsgItem::playMedia()
{
#ifdef DEBUG_ITEM
std::cerr << "ChanMsgItem::playMedia()";
std::cerr << std::endl;
#endif
}

View File

@ -1,71 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _BLOGS_MSG_ITEM_DIALOG_H
#define _BLOGS_MSG_ITEM_DIALOG_H
#include "ui_BlogsMsgItem.h"
#include <stdint.h>
class FeedHolder;
class SubFileItem;
class BlogsMsgItem : public QWidget, private Ui::BlogsMsgItem
{
Q_OBJECT
public:
/** Default Constructor */
BlogsMsgItem(FeedHolder *parent, uint32_t feedId, std::string peerId, std::string blogId, std::string msgId, bool isHome);
/** Default Destructor */
void updateItemStatic();
void small();
private slots:
/* default stuff */
void gotoHome();
void removeItem();
void toggle();
void playMedia();
void unsubscribeChannel();
void updateItem();
private:
FeedHolder *mParent;
uint32_t mFeedId;
std::string mBlogId;
std::string mMsgId;
std::string mPeerId;
bool mIsHome;
};
#endif

View File

@ -1,274 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>BlogsMsgItem</class>
<widget class="QWidget" name="BlogsMsgItem">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>516</width>
<height>294</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="styleSheet">
<string notr="true">QToolButton, QPushButton, QComboBox {
border-image: url(:/images/btn_26.png) 4;
border-width: 4;
padding: 0px 6px;
font-size: 12px;
}
QToolButton:hover, QPushButton:hover, QComboBox:hover {
border-image: url(:/images/btn_26_hover.png) 4;
}
QToolButton:disabled, QPushButton:disabled, QComboBox::disabled {
color:gray;
}
QToolButton:pressed, QPushButton:pressed{
border-image: url(:/images/btn_26_pressed.png) 4;
}</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="horizontalSpacing">
<number>0</number>
</property>
<property name="margin">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">QFrame#frame{border: 3px solid #407AC1;
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #FFFFFF, stop:1 #F2F2F2);;
border-radius: 10px;}</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="3">
<widget class="QLabel" name="titleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>11</pointsize>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<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;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:11pt; font-weight:600; font-style:italic;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; color:#656565;&quot;&gt;Blog Subject&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="3" colspan="2">
<widget class="QLabel" name="datetimelabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<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;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:600; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt; color:#666666;&quot;&gt;DateTime&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>288</width>
<height>21</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="4">
<widget class="QPushButton" name="expandButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Expand</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.png</iconset>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="clearButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Remove Item</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/close_normal.png</normaloff>:/images/close_normal.png</iconset>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="unsubscribeButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Unsubscribe From Channel</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/mail_delete.png</normaloff>:/images/mail_delete.png</iconset>
</property>
</widget>
</item>
<item row="1" column="0" colspan="5">
<widget class="QTextBrowser" name="textBrowser">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">QTextBrowser#textBrowser{border: 2px solid #D3D3D3;
background-color: transparent;
border-radius: 10px;}</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<widget class="QFrame" name="expandFrame">
<property name="styleSheet">
<string notr="true">QFrame#expandFrame{border: 2px solid #D3D3D3;
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #FFFFFF, stop:1 #F2F2F2);;
border-radius: 10px;}</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QLabel" name="msgLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Comments here</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QTextEdit" name="commentEdit">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>60</height>
</size>
</property>
</widget>
</item>
<item row="3" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>398</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="commentButton">
<property name="text">
<string>Comment</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1,173 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QMessageBox>
#include <QBuffer>
#include "CreateBlog.h"
#include "util/misc.h"
#include <retroshare/rsblogs.h>
/** Constructor */
CreateBlog::CreateBlog(QWidget *parent, bool isForum)
: QDialog(parent), mIsForum(isForum)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
// connect up the buttons.
connect( ui.cancelButton, SIGNAL( clicked ( bool ) ), this, SLOT( cancelBlog( ) ) );
connect( ui.createButton, SIGNAL( clicked ( bool ) ), this, SLOT( createBlog( ) ) );
connect( ui.LogoButton, SIGNAL(clicked() ), this , SLOT(addBlogLogo()));
connect( ui.blogLogoButton, SIGNAL(clicked() ), this , SLOT(addBlogLogo()));
newBlog();
}
void CreateBlog::show()
{
//loadSettings();
if(!this->isVisible()) {
QWidget::show();
}
}
void CreateBlog::newBlog()
{
if (mIsForum)
{
/* enforce Public for the moment */
ui.typePublic->setChecked(true);
ui.typePrivate->setEnabled(false);
ui.typeEncrypted->setEnabled(false);
ui.msgAnon->setChecked(true);
//ui.msgAuth->setEnabled(false);
}
else
{
/* enforce Private for the moment */
ui.typePrivate->setChecked(true);
ui.typePublic->setEnabled(false);
ui.typeEncrypted->setEnabled(false);
ui.msgAnon->setChecked(true);
ui.msgAuth->setEnabled(false);
ui.msgGroupBox->hide();
}
}
void CreateBlog::createBlog()
{
QString name = ui.forumName->text();
QString desc = ui.forumDesc->toPlainText(); //toHtml();
uint32_t flags = 0;
if(name.isEmpty())
{ /* error message */
QMessageBox::warning(this, tr("RetroShare"),
tr("Please add a Name"),
QMessageBox::Ok, QMessageBox::Ok);
return; //Don't add a empty name!!
}
else
if (ui.typePublic->isChecked())
{
flags |= RS_DISTRIB_PUBLIC;
}
else if (ui.typePrivate->isChecked())
{
flags |= RS_DISTRIB_PRIVATE;
}
else if (ui.typeEncrypted->isChecked())
{
flags |= RS_DISTRIB_ENCRYPTED;
}
if (ui.msgAuth->isChecked())
{
flags |= RS_DISTRIB_AUTHEN_REQ;
}
else if (ui.msgAnon->isChecked())
{
flags |= RS_DISTRIB_AUTHEN_ANON;
}
QByteArray ba;
QBuffer buffer(&ba);
if(!picture.isNull()){
// send chan image
buffer.open(QIODevice::WriteOnly);
picture.save(&buffer, "PNG"); // writes image into ba in PNG format
}
if (rsBlogs)
{
rsBlogs->createBlog(name.toStdWString(), desc.toStdWString(), flags,
(unsigned char*) ba.data(), ba.size());
}
close();
return;
}
void CreateBlog::addBlogLogo(){
QString fileName;
if (misc::getOpenFileName(this, RshareSettings::LASTDIR_IMAGES, tr("Load File"), tr("Pictures (*.png *.xpm *.jpg)"), fileName))
{
picture = QPixmap(fileName).scaled(64,64, Qt::IgnoreAspectRatio,Qt::SmoothTransformation);
// to show the selected
ui.blogLogoButton->setIcon(picture);
std::cerr << "Sending avatar image down the pipe" << std::endl ;
// send avatar down the pipe for other peers to get it.
QByteArray ba;
QBuffer buffer(&ba);
buffer.open(QIODevice::WriteOnly);
picture.save(&buffer, "PNG"); // writes image into ba in PNG format
std::cerr << "Image size = " << ba.size() << std::endl ;
}
}
void CreateBlog::cancelBlog()
{
close();
return;
}

View File

@ -1,60 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _CREATE_BLOG_DIALOG_H
#define _CREATE_BLOG_DIALOG_H
#include "ui_CreateBlog.h"
class CreateBlog : public QDialog
{
Q_OBJECT
public:
CreateBlog(QWidget *parent = 0, bool isForum = true);
void newBlog(); /* cleanup */
/** Qt Designer generated object */
Ui::CreateBlog ui;
QPixmap picture;
public slots:
/** Overloaded QWidget.show */
void show();
private slots:
/* actions to take.... */
void createBlog();
void cancelBlog();
void addBlogLogo();
private:
bool mIsForum;
};
#endif

View File

@ -1,329 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CreateBlog</class>
<widget class="QDialog" name="CreateBlog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>534</width>
<height>545</height>
</rect>
</property>
<property name="windowTitle">
<string>Create new Blog</string>
</property>
<property name="windowIcon">
<iconset resource="../../images.qrc">
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="frame_2">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>64</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QFrame#frame_2{background-image: url(:/images/connect/connectFriendBanner.png);}</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>6</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelicon">
<property name="maximumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../images.qrc">:/images/hi48-app-kblogger.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="textlabelcreatforums">
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<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;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Arial'; font-size:24pt; font-weight:600; color:#ffffff;&quot;&gt;New Blog&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="forumName"/>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Description</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<widget class="QTextEdit" name="forumDesc"/>
</item>
<item row="3" column="0" colspan="3">
<widget class="QGroupBox" name="tyoeGroupBox">
<property name="title">
<string>Type:</string>
</property>
<layout class="QVBoxLayout" name="_3">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>6</number>
</property>
<item>
<widget class="QRadioButton" name="typePublic">
<property name="text">
<string>Public - Anyone can read and publish (Shared Publish Key)</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="typePrivate">
<property name="text">
<string>Restricted - Anyone can read, limited publishing (Private Publish Key)</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="typeEncrypted">
<property name="text">
<string>Private - (Private Publish Key required to view Messages)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QGroupBox" name="msgGroupBox">
<property name="title">
<string>Allowed Messages</string>
</property>
<layout class="QVBoxLayout" name="_4">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>6</number>
</property>
<item>
<widget class="QRadioButton" name="msgAuth">
<property name="text">
<string>Authenticated Messages</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="msgAnon">
<property name="text">
<string>Anonymous Messages</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="5" column="0" colspan="3">
<widget class="QGroupBox" name="groupBoxLogo">
<property name="title">
<string>Blog Logo</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" rowspan="2">
<widget class="QToolButton" name="blogLogoButton">
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">
border: 2px solid white;
border-radius: 10px;
</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/hi64-app-kblogger.png</normaloff>:/images/hi64-app-kblogger.png</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="LogoButton">
<property name="text">
<string>Add Blog Logo</string>
</property>
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/add_image24.png</normaloff>:/images/add_image24.png</iconset>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>118</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="6" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>238</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="1">
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QPushButton" name="createButton">
<property name="text">
<string>Create</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../../images.qrc"/>
<include location="../../images.qrc"/>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1,923 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QClipboard>
#include <QColorDialog>
#include <QFontComboBox>
#include <QFile>
#include <QFileInfo>
#include <QPrintDialog>
#include <QPrinter>
#include <QTextCodec>
#include <QTextDocumentWriter>
#include <QTextDocumentFragment>
#include <QMessageBox>
#include <QPrintPreviewDialog>
#include <QTextBlock>
#include "CreateBlogMsg.h"
#include "gui/msgs/textformat.h"
#include "util/misc.h"
#include <retroshare/rsblogs.h>
/** Constructor */
CreateBlogMsg::CreateBlogMsg(std::string cId ,QWidget* parent, Qt::WFlags flags)
: mBlogId(cId), QMainWindow (parent, flags)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
setupFileActions();
setupEditActions();
setupViewActions();
setupInsertActions();
setupParagraphActions();
setAcceptDrops(true);
setStartupText();
newBlogMsg();
ui.toolBar_2->addAction(ui.actionIncreasefontsize);
ui.toolBar_2->addAction(ui.actionDecreasefontsize);
ui.toolBar_2->addAction(ui.actionBlockquoute);
ui.toolBar_2->addAction(ui.actionOrderedlist);
ui.toolBar_2->addAction(ui.actionUnorderedlist);
ui.toolBar_2->addAction(ui.actionBlockquoute);
ui.toolBar_2->addAction(ui.actionCode);
ui.toolBar_2->addAction(ui.actionsplitPost);
setupTextActions();
connect(ui.actionPublish, SIGNAL(triggered()), this, SLOT(sendMsg()));
connect(ui.actionNew, SIGNAL(triggered()), this, SLOT (fileNew()));
connect(ui.actionIncreasefontsize, SIGNAL (triggered()), this, SLOT (fontSizeIncrease()));
connect(ui.actionDecreasefontsize, SIGNAL (triggered()), this, SLOT (fontSizeDecrease()));
connect(ui.actionBlockquoute, SIGNAL (triggered()), this, SLOT (blockQuote()));
connect(ui.actionCode, SIGNAL (triggered()), this, SLOT (toggleCode()));
connect(ui.actionsplitPost, SIGNAL (triggered()), this, SLOT (addPostSplitter()));
connect(ui.actionOrderedlist, SIGNAL (triggered()), this, SLOT (addOrderedList()));
connect(ui.actionUnorderedlist, SIGNAL (triggered()), this, SLOT (addUnorderedList()));
//connect(webView, SIGNAL(loadFinished(bool)),this, SLOT(updateTextEdit()));
connect( ui.msgEdit, SIGNAL( textChanged(const QString &)), this, SLOT(updateTextEdit()));
connect( ui.msgEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)),
this, SLOT(currentCharFormatChanged(QTextCharFormat)));
connect( ui.msgEdit, SIGNAL(cursorPositionChanged()),
this, SLOT(cursorPositionChanged()));
QPalette palette = QApplication::palette();
codeBackground = palette.color( QPalette::Active, QPalette::Midlight );
fontChanged(ui.msgEdit->font());
colorChanged(ui.msgEdit->textColor());
alignmentChanged(ui.msgEdit->alignment());
connect( ui.msgEdit->document(), SIGNAL(modificationChanged(bool)),
actionSave, SLOT(setEnabled(bool)));
connect( ui.msgEdit->document(), SIGNAL(modificationChanged(bool)),
this, SLOT(setWindowModified(bool)));
connect( ui.msgEdit->document(), SIGNAL(undoAvailable(bool)),
actionUndo, SLOT(setEnabled(bool)));
connect( ui.msgEdit->document(), SIGNAL(undoAvailable(bool)),
ui.actionUndo, SLOT(setEnabled(bool)));
connect( ui.msgEdit->document(), SIGNAL(redoAvailable(bool)),
actionRedo, SLOT(setEnabled(bool)));
setWindowModified( ui.msgEdit->document()->isModified());
actionSave->setEnabled( ui.msgEdit->document()->isModified());
actionUndo->setEnabled( ui.msgEdit->document()->isUndoAvailable());
ui.actionUndo->setEnabled( ui.msgEdit->document()->isUndoAvailable());
actionRedo->setEnabled( ui.msgEdit->document()->isRedoAvailable());
connect(actionUndo, SIGNAL(triggered()), ui.msgEdit, SLOT(undo()));
connect(ui.actionUndo, SIGNAL(triggered()), ui.msgEdit, SLOT(undo()));
connect(actionRedo, SIGNAL(triggered()), ui.msgEdit, SLOT(redo()));
actionCut->setEnabled(false);
actionCopy->setEnabled(false);
connect(actionCut, SIGNAL(triggered()), ui.msgEdit, SLOT(cut()));
connect(actionCopy, SIGNAL(triggered()), ui.msgEdit, SLOT(copy()));
connect(actionPaste, SIGNAL(triggered()), ui.msgEdit, SLOT(paste()));
connect(ui.msgEdit, SIGNAL(copyAvailable(bool)), actionCut, SLOT(setEnabled(bool)));
connect(ui.msgEdit, SIGNAL(copyAvailable(bool)), actionCopy, SLOT(setEnabled(bool)));
#ifndef QT_NO_CLIPBOARD
connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged()));
#endif
//defaultCharFormat
defaultCharFormat = ui.msgEdit->currentCharFormat();
const QFont defaultFont = ui.msgEdit->document()->defaultFont();
defaultCharFormat.setFont( defaultFont );
defaultCharFormat.setForeground( ui.msgEdit->currentCharFormat().foreground() );
defaultCharFormat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( 0 ) );
defaultCharFormat.setBackground( palette.color( QPalette::Active,
QPalette::Base ) );
defaultCharFormat.setProperty( TextFormat::HasCodeStyle, QVariant( false ) );
//defaultBlockFormat
defaultBlockFormat = ui.msgEdit->textCursor().blockFormat();
}
void CreateBlogMsg::cancelMsg()
{
std::cerr << "CreateBlogMsg::cancelMsg()";
std::cerr << std::endl;
close();
return;
}
void CreateBlogMsg::newBlogMsg()
{
if (!rsBlogs)
return;
BlogInfo ci;
if (!rsBlogs->getBlogInfo(mBlogId, ci))
{
return;
}
ui.channelName->setText(QString::fromStdWString(ci.blogName));
}
void CreateBlogMsg::sendMsg()
{
std::cerr << "CreateBlogMsg::sendMsg()";
std::cerr << std::endl;
/* construct message bits */
std::wstring subject = ui.subjectEdit->text().toStdWString();
std::wstring msg = ui.msgEdit->toHtml().toStdWString();
sendMessage(subject, msg);
}
void CreateBlogMsg::sendMessage(std::wstring subject, std::wstring msg)
{
std::cerr << "CreateBlogMsg::sendMessage()" << std::endl;
QString name = ui.subjectEdit->text();
if(name.isEmpty())
{ /* error message */
QMessageBox::warning(this, tr("RetroShare"),
tr("Please add a Subject"),
QMessageBox::Ok, QMessageBox::Ok);
return; //Don't add a empty Subject!!
}
else
/* rsChannels */
if (rsBlogs)
{
BlogMsgInfo msgInfo;
msgInfo.blogId = mBlogId;
msgInfo.msgId = "";
msgInfo.subject = subject;
msgInfo.msg = msg;
msgInfo.msgIdReply = "nothing";
rsBlogs->BlogMessageSend(msgInfo);
}
close();
return;
}
void CreateBlogMsg::fontSizeIncrease()
{
if ( !( ui.msgEdit->textCursor().blockFormat().hasProperty( TextFormat::HtmlHeading ) &&
ui.msgEdit->textCursor().blockFormat().intProperty( TextFormat::HtmlHeading ) ) ) {
QTextCharFormat format;
int idx = ui.msgEdit->currentCharFormat().intProperty( QTextFormat::FontSizeAdjustment );
if ( idx < 3 ) {
format.setProperty( QTextFormat::FontSizeAdjustment, QVariant( ++idx ) );
ui.msgEdit->textCursor().mergeCharFormat( format );
}
}
ui.msgEdit->setFocus( Qt::OtherFocusReason );
}
void CreateBlogMsg::fontSizeDecrease()
{
if ( !( ui.msgEdit->textCursor().blockFormat().hasProperty( TextFormat::HtmlHeading ) &&
ui.msgEdit->textCursor().blockFormat().intProperty( TextFormat::HtmlHeading ) ) ) {
QTextCharFormat format;
int idx = ui.msgEdit->currentCharFormat().intProperty( QTextFormat::FontSizeAdjustment );
if ( idx > -1 ) {
format.setProperty( QTextFormat::FontSizeAdjustment, QVariant( --idx ) );
ui.msgEdit->textCursor().mergeCharFormat( format );
}
}
ui.msgEdit->setFocus( Qt::OtherFocusReason );
}
void CreateBlogMsg::blockQuote()
{
QTextBlockFormat blockFormat = ui.msgEdit->textCursor().blockFormat();
QTextBlockFormat f;
if ( blockFormat.hasProperty( TextFormat::IsBlockQuote ) &&
blockFormat.boolProperty( TextFormat::IsBlockQuote ) ) {
f.setProperty( TextFormat::IsBlockQuote, QVariant( false ) );
f.setLeftMargin( 0 );
f.setRightMargin( 0 );
} else {
f.setProperty( TextFormat::IsBlockQuote, QVariant( true ) );
f.setLeftMargin( 40 );
f.setRightMargin( 40 );
}
ui.msgEdit->textCursor().mergeBlockFormat( f );
}
void CreateBlogMsg::toggleCode()
{
static QString preFontFamily;
QTextCharFormat charFormat = ui.msgEdit->currentCharFormat();
QTextCharFormat f;
if ( charFormat.hasProperty( TextFormat::HasCodeStyle ) &&
charFormat.boolProperty( TextFormat::HasCodeStyle ) ) {
f.setProperty( TextFormat::HasCodeStyle, QVariant( false ) );
f.setBackground( defaultCharFormat.background() );
f.setFontFamily( preFontFamily );
ui.msgEdit->textCursor().mergeCharFormat( f );
} else {
preFontFamily = ui.msgEdit->fontFamily();
f.setProperty( TextFormat::HasCodeStyle, QVariant( true ) );
f.setBackground( codeBackground );
f.setFontFamily( "Dejavu Sans Mono" );
ui.msgEdit->textCursor().mergeCharFormat( f );
}
ui.msgEdit->setFocus( Qt::OtherFocusReason );
}
void CreateBlogMsg::addPostSplitter()
{
QTextBlockFormat f = ui.msgEdit->textCursor().blockFormat();
QTextBlockFormat f1 = f;
f.setProperty( TextFormat::IsHtmlTagSign, true );
f.setProperty( QTextFormat::BlockTrailingHorizontalRulerWidth,
QTextLength( QTextLength::PercentageLength, 80 ) );
if ( ui.msgEdit->textCursor().block().text().isEmpty() ) {
ui.msgEdit->textCursor().mergeBlockFormat( f );
} else {
ui.msgEdit->textCursor().insertBlock( f );
}
ui.msgEdit->textCursor().insertBlock( f1 );
}
void CreateBlogMsg::setStartupText()
{
QString string = "<html><body><h1>HTML Previewer</h1>"
" <p>This example shows you how to use QWebView to"
" preview HTML data written in a QPlainTextEdit.</p>"
" </body></html>";
//webView->setHtml(string);
}
void CreateBlogMsg::updateTextEdit()
{
//QWebFrame *mainFrame = webView->page()->mainFrame();
QString frameText = ui.msgEdit->toHtml();
ui.plainTextEdit->setPlainText(frameText);
//QString text = plainTextEdit->toPlainText();
}
void CreateBlogMsg::textBold()
{
QTextCharFormat fmt;
fmt.setFontWeight(actionTextBold->isChecked() ? QFont::Bold : QFont::Normal);
mergeFormatOnWordOrSelection(fmt);
}
void CreateBlogMsg::textUnderline()
{
QTextCharFormat fmt;
fmt.setFontUnderline(actionTextUnderline->isChecked());
mergeFormatOnWordOrSelection(fmt);
}
void CreateBlogMsg::textItalic()
{
QTextCharFormat fmt;
fmt.setFontItalic(actionTextItalic->isChecked());
mergeFormatOnWordOrSelection(fmt);
}
void CreateBlogMsg::textAlign(QAction *a)
{
if (a == actionAlignLeft)
ui.msgEdit->setAlignment(Qt::AlignLeft | Qt::AlignAbsolute);
else if (a == actionAlignCenter)
ui.msgEdit->setAlignment(Qt::AlignHCenter | Qt::AlignAbsolute);
else if (a == actionAlignRight)
ui.msgEdit->setAlignment(Qt::AlignRight | Qt::AlignAbsolute);
else if (a == actionAlignJustify)
ui.msgEdit->setAlignment(Qt::AlignJustify | Qt::AlignAbsolute);
}
void CreateBlogMsg::alignmentChanged(Qt::Alignment a)
{
if (a & Qt::AlignLeft) {
actionAlignLeft->setChecked(true);
} else if (a & Qt::AlignHCenter) {
actionAlignCenter->setChecked(true);
} else if (a & Qt::AlignRight) {
actionAlignRight->setChecked(true);
} else if (a & Qt::AlignJustify) {
actionAlignJustify->setChecked(true);
}
}
void CreateBlogMsg::textFamily(const QString &f)
{
QTextCharFormat fmt;
fmt.setFontFamily(f);
mergeFormatOnWordOrSelection(fmt);
}
void CreateBlogMsg::textSize(const QString &p)
{
qreal pointSize = p.toFloat();
if (p.toFloat() > 0) {
QTextCharFormat fmt;
fmt.setFontPointSize(pointSize);
mergeFormatOnWordOrSelection(fmt);
}
}
void CreateBlogMsg::changeFormatType(int styleIndex )
{
ui.msgEdit->setFocus( Qt::OtherFocusReason );
QTextCursor cursor = ui.msgEdit->textCursor();
//QTextBlockFormat bformat = cursor.blockFormat();
QTextBlockFormat bformat;
QTextCharFormat cformat;
switch (styleIndex) {
default:
case 0:
bformat.setProperty( TextFormat::HtmlHeading, QVariant( 0 ) );
cformat.setFontWeight( QFont::Normal );
cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( 0 ) );
break;
case 1:
bformat.setProperty( TextFormat::HtmlHeading, QVariant( 1 ) );
cformat.setFontWeight( QFont::Bold );
cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( 3 ) );
break;
case 2:
bformat.setProperty( TextFormat::HtmlHeading, QVariant( 2 ) );
cformat.setFontWeight( QFont::Bold );
cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( 2 ) );
break;
case 3:
bformat.setProperty( TextFormat::HtmlHeading, QVariant( 3 ) );
cformat.setFontWeight( QFont::Bold );
cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( 1 ) );
break;
case 4:
bformat.setProperty( TextFormat::HtmlHeading, QVariant( 4 ) );
cformat.setFontWeight( QFont::Bold );
cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( 0 ) );
break;
case 5:
bformat.setProperty( TextFormat::HtmlHeading, QVariant( 5 ) );
cformat.setFontWeight( QFont::Bold );
cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( -1 ) );
break;
case 6:
bformat.setProperty( TextFormat::HtmlHeading, QVariant( 6 ) );
cformat.setFontWeight( QFont::Bold );
cformat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( -2 ) );
break;
}
//cformat.clearProperty( TextFormat::HasCodeStyle );
cursor.beginEditBlock();
cursor.mergeBlockFormat( bformat );
cursor.select( QTextCursor::BlockUnderCursor );
cursor.mergeCharFormat( cformat );
cursor.endEditBlock();
}
void CreateBlogMsg::textColor()
{
QColor col = QColorDialog::getColor(ui.msgEdit->textColor(), this);
if (!col.isValid())
return;
QTextCharFormat fmt;
fmt.setForeground(col);
mergeFormatOnWordOrSelection(fmt);
colorChanged(col);
}
void CreateBlogMsg::fontChanged(const QFont &f)
{
comboFont->setCurrentIndex(comboFont->findText(QFontInfo(f).family()));
comboSize->setCurrentIndex(comboSize->findText(QString::number(f.pointSize())));
actionTextBold->setChecked(f.bold());
actionTextItalic->setChecked(f.italic());
actionTextUnderline->setChecked(f.underline());
}
void CreateBlogMsg::colorChanged(const QColor &c)
{
QPixmap pix(16, 16);
pix.fill(c);
//ui.colorbtn->setIcon(pix);
actionTextColor->setIcon(pix);
}
void CreateBlogMsg::mergeFormatOnWordOrSelection(const QTextCharFormat &format)
{
QTextCursor cursor = ui.msgEdit->textCursor();
if (!cursor.hasSelection())
cursor.select(QTextCursor::WordUnderCursor);
cursor.mergeCharFormat(format);
ui.msgEdit->mergeCurrentCharFormat(format);
}
void CreateBlogMsg::currentCharFormatChanged(const QTextCharFormat &format)
{
fontChanged(format.font());
colorChanged(format.foreground().color());
}
void CreateBlogMsg::cursorPositionChanged()
{
alignmentChanged(ui.msgEdit->alignment());
}
void CreateBlogMsg::clipboardDataChanged()
{
#ifndef QT_NO_CLIPBOARD
actionPaste->setEnabled(!QApplication::clipboard()->text().isEmpty());
#endif
}
void CreateBlogMsg::addOrderedList()
{
ui.msgEdit->textCursor().createList( QTextListFormat::ListDecimal );
}
void CreateBlogMsg::addUnorderedList()
{
ui.msgEdit->textCursor().createList( QTextListFormat::ListDisc );
}
void CreateBlogMsg::setupFileActions()
{
QMenu *menu = new QMenu(tr("&File"), this);
menuBar()->addMenu(menu);
QAction *a;
a = new QAction(QIcon(":/images/textedit/filenew.png"), tr("&New"), this);
a->setShortcut(QKeySequence::New);
connect(a, SIGNAL(triggered()), this, SLOT(fileNew()));
menu->addAction(a);
a = new QAction(QIcon(":/images/textedit/fileopen.png"), tr("&Open..."), this);
a->setShortcut(QKeySequence::Open);
connect(a, SIGNAL(triggered()), this, SLOT(fileOpen()));
menu->addAction(a);
menu->addSeparator();
actionSave = a = new QAction(QIcon(":/images/textedit/filesave.png"), tr("&Save"), this);
a->setShortcut(QKeySequence::Save);
connect(a, SIGNAL(triggered()), this, SLOT(fileSave()));
a->setEnabled(false);
menu->addAction(a);
a = new QAction(tr("Save &As..."), this);
connect(a, SIGNAL(triggered()), this, SLOT(fileSaveAs()));
menu->addAction(a);
menu->addSeparator();
a = new QAction(QIcon(":/images/textedit/fileprint.png"), tr("&Print..."), this);
a->setShortcut(QKeySequence::Print);
connect(a, SIGNAL(triggered()), this, SLOT(filePrint()));
menu->addAction(a);
a = new QAction(QIcon(":/images/textedit/fileprint.png"), tr("Print Preview..."), this);
connect(a, SIGNAL(triggered()), this, SLOT(filePrintPreview()));
menu->addAction(a);
a = new QAction(QIcon(":/images/textedit/exportpdf.png"), tr("&Export PDF..."), this);
a->setShortcut(Qt::CTRL + Qt::Key_D);
connect(a, SIGNAL(triggered()), this, SLOT(filePrintPdf()));
menu->addAction(a);
menu->addSeparator();
a = new QAction(tr("&Quit"), this);
a->setShortcut(Qt::CTRL + Qt::Key_Q);
connect(a, SIGNAL(triggered()), this, SLOT(cancelMsg()));
menu->addAction(a);
}
void CreateBlogMsg::setupEditActions()
{
QMenu *menu = new QMenu(tr("&Edit"), this);
menuBar()->addMenu(menu);
QAction *a;
a = actionUndo = new QAction(QIcon(":/images/textedit/editundo.png"), tr("&Undo"), this);
a->setShortcut(QKeySequence::Undo);
menu->addAction(a);
a = actionRedo = new QAction(QIcon(":/images/textedit/editredo.png"), tr("&Redo"), this);
a->setShortcut(QKeySequence::Redo);
menu->addAction(a);
menu->addSeparator();
a = actionCut = new QAction(QIcon(":/images/textedit/editcut.png"), tr("Cu&t"), this);
a->setShortcut(QKeySequence::Cut);
menu->addAction(a);
a = actionCopy = new QAction(QIcon(":/images/textedit/editcopy.png"), tr("&Copy"), this);
a->setShortcut(QKeySequence::Copy);
menu->addAction(a);
a = actionPaste = new QAction(QIcon(":/images/textedit/editpaste.png"), tr("&Paste"), this);
a->setShortcut(QKeySequence::Paste);
menu->addAction(a);
actionPaste->setEnabled(!QApplication::clipboard()->text().isEmpty());
}
void CreateBlogMsg::setupViewActions()
{
QMenu *menu = new QMenu(tr("&View"), this);
menuBar()->addMenu(menu);
QAction *a;
}
void CreateBlogMsg::setupInsertActions()
{
QMenu *menu = new QMenu(tr("&Insert"), this);
menuBar()->addMenu(menu);
QAction *a;
a = new QAction(QIcon(""), tr("&Image"), this);
connect(a, SIGNAL(triggered()), this, SLOT(addImage()));
menu->addAction(a);
}
void CreateBlogMsg::setupParagraphActions()
{
comboStyle = new QComboBox(ui.toolBar_2);
ui.toolBar_2->addWidget(comboStyle);
comboStyle->addItem("Paragraph");
comboStyle->addItem("Heading 1");
comboStyle->addItem("Heading 2");
comboStyle->addItem("Heading 3");
comboStyle->addItem("Heading 4");
comboStyle->addItem("Heading 5");
comboStyle->addItem("Heading 6");
connect(comboStyle, SIGNAL(activated(int)),
this, SLOT(changeFormatType(int)));
}
void CreateBlogMsg::setupTextActions()
{
QMenu *menu = new QMenu(tr("F&ormat"), this);
menuBar()->addMenu(menu);
actionTextBold = new QAction(QIcon(":/images/textedit/textbold.png"),tr("&Bold"), this);
actionTextBold->setShortcut(Qt::CTRL + Qt::Key_B);
//actionTextBold->setPriority(QAction::LowPriority);
QFont bold;
bold.setBold(true);
actionTextBold->setFont(bold);
connect(actionTextBold, SIGNAL(triggered()), this, SLOT(textBold()));
ui.toolBar_2->addAction(actionTextBold);
menu->addAction(actionTextBold);
actionTextBold->setCheckable(true);
actionTextItalic = new QAction(QIcon(":/images/textedit/textitalic.png"),tr("&Italic"), this);
//actionTextItalic->setPriority(QAction::LowPriority);
actionTextItalic->setShortcut(Qt::CTRL + Qt::Key_I);
QFont italic;
italic.setItalic(true);
actionTextItalic->setFont(italic);
connect(actionTextItalic, SIGNAL(triggered()), this, SLOT(textItalic()));
ui.toolBar_2->addAction(actionTextItalic);
menu->addAction(actionTextItalic);
actionTextItalic->setCheckable(true);
actionTextUnderline = new QAction(QIcon(":/images/textedit/textunder.png"),tr("&Underline"), this);
actionTextUnderline->setShortcut(Qt::CTRL + Qt::Key_U);
//actionTextUnderline->setPriority(QAction::LowPriority);
QFont underline;
underline.setUnderline(true);
actionTextUnderline->setFont(underline);
connect(actionTextUnderline, SIGNAL(triggered()), this, SLOT(textUnderline()));
ui.toolBar_2->addAction(actionTextUnderline);
menu->addAction(actionTextUnderline);
actionTextUnderline->setCheckable(true);
menu->addSeparator();
QActionGroup *grp = new QActionGroup(this);
connect(grp, SIGNAL(triggered(QAction*)), this, SLOT(textAlign(QAction*)));
// Make sure the alignLeft is always left of the alignRight
if (QApplication::isLeftToRight()) {
actionAlignLeft = new QAction(QIcon(":/images/textedit/textleft.png"),tr("&Left"), grp);
actionAlignCenter = new QAction(QIcon(":/images/textedit/textcenter.png"), tr("C&enter"), grp);
actionAlignRight = new QAction(QIcon(":/images/textedit/textright.png"), tr("&Right"), grp);
} else {
actionAlignRight = new QAction(QIcon(":/images/textedit/textright.png"), tr("&Right"), grp);
actionAlignCenter = new QAction(QIcon(":/images/textedit/textcenter.png"), tr("C&enter"), grp);
actionAlignLeft = new QAction(QIcon(":/images/textedit/textleft.png"), tr("&Left"), grp);
}
actionAlignJustify = new QAction(QIcon(":/images/textedit/textjustify.png"), tr("&Justify"), grp);
actionAlignLeft->setShortcut(Qt::CTRL + Qt::Key_L);
actionAlignLeft->setCheckable(true);
//actionAlignLeft->setPriority(QAction::LowPriority);
actionAlignCenter->setShortcut(Qt::CTRL + Qt::Key_E);
actionAlignCenter->setCheckable(true);
//actionAlignCenter->setPriority(QAction::LowPriority);
actionAlignRight->setShortcut(Qt::CTRL + Qt::Key_R);
actionAlignRight->setCheckable(true);
//actionAlignRight->setPriority(QAction::LowPriority);
actionAlignJustify->setShortcut(Qt::CTRL + Qt::Key_J);
actionAlignJustify->setCheckable(true);
//actionAlignJustify->setPriority(QAction::LowPriority);
ui.toolBar_2->addActions(grp->actions());
menu->addActions(grp->actions());
menu->addSeparator();
QPixmap pix(16, 16);
pix.fill(Qt::black);
actionTextColor = new QAction(pix, tr("&Text Color..."), this);
connect(actionTextColor, SIGNAL(triggered()), this, SLOT(textColor()));
ui.toolBar_2->addAction(actionTextColor);
menu->addAction(actionTextColor);
menu->addAction(ui.actionOrderedlist);
menu->addAction(ui.actionUnorderedlist);
menu->addAction(ui.actionBlockquoute);
/*comboStyle = new QComboBox(ui.toolBar_2);
ui.toolBar_2->addWidget(comboStyle);
comboStyle->addItem("Paragraph");
comboStyle->addItem("Heading 1");
comboStyle->addItem("Heading 2");
comboStyle->addItem("Heading 3");
comboStyle->addItem("Heading 4");
comboStyle->addItem("Heading 5");
comboStyle->addItem("Heading 6");
connect(comboStyle, SIGNAL(activated(int)),
this, SLOT(changeFormatType(int)));*/
comboFont = new QFontComboBox(ui.toolBar_2);
ui.toolBar_2->addWidget(comboFont);
connect(comboFont, SIGNAL(activated(QString)),
this, SLOT(textFamily(QString)));
comboSize = new QComboBox(ui.toolBar_2);
comboSize->setObjectName("comboSize");
ui.toolBar_2->addWidget(comboSize);
comboSize->setEditable(true);
QFontDatabase db;
foreach(int size, db.standardSizes())
comboSize->addItem(QString::number(size));
connect(comboSize, SIGNAL(activated(QString)),
this, SLOT(textSize(QString)));
comboSize->setCurrentIndex(comboSize->findText(QString::number(QApplication::font()
.pointSize())));
}
bool CreateBlogMsg::load(const QString &f)
{
if (!QFile::exists(f))
return false;
QFile file(f);
if (!file.open(QFile::ReadOnly))
return false;
QByteArray data = file.readAll();
QTextCodec *codec = Qt::codecForHtml(data);
QString str = codec->toUnicode(data);
if (Qt::mightBeRichText(str)) {
ui.msgEdit->setHtml(str);
} else {
str = QString::fromLocal8Bit(data);
ui.msgEdit->setPlainText(str);
}
setCurrentFileName(f);
return true;
}
bool CreateBlogMsg::maybeSave()
{
if (!ui.msgEdit->document()->isModified())
return true;
if (fileName.startsWith(QLatin1String(":/")))
return true;
QMessageBox::StandardButton ret;
ret = QMessageBox::warning(this, tr("Application"),
tr("The document has been modified.\n"
"Do you want to save your changes?"),
QMessageBox::Save | QMessageBox::Discard
| QMessageBox::Cancel);
if (ret == QMessageBox::Save)
return fileSave();
else if (ret == QMessageBox::Cancel)
return false;
return true;
}
void CreateBlogMsg::fileNew()
{
if (maybeSave()) {
ui.msgEdit->clear();
setCurrentFileName(QString());
}
}
void CreateBlogMsg::fileOpen()
{
QString fn;
if (misc::getOpenFileName(this, RshareSettings::LASTDIR_BLOGS, tr("Open File..."), tr("HTML-Files (*.htm *.html);;All Files (*)"), fn))
load(fn);
}
bool CreateBlogMsg::fileSave()
{
if (fileName.isEmpty())
return fileSaveAs();
QTextDocumentWriter writer(fileName);
bool success = writer.write(ui.msgEdit->document());
if (success)
ui.msgEdit->document()->setModified(false);
return success;
}
bool CreateBlogMsg::fileSaveAs()
{
QString fn;
if (misc::getSaveFileName(this, RshareSettings::LASTDIR_BLOGS, tr("Save as..."), tr("ODF files (*.odt);;HTML-Files (*.htm *.html);;All Files (*)"), fn)) {
if (! (fn.endsWith(".odt", Qt::CaseInsensitive) || fn.endsWith(".htm", Qt::CaseInsensitive) || fn.endsWith(".html", Qt::CaseInsensitive)) )
fn += ".odt"; // default
setCurrentFileName(fn);
return fileSave();
}
return false;
}
void CreateBlogMsg::filePrint()
{
#ifndef QT_NO_PRINTER
QPrinter printer(QPrinter::HighResolution);
QPrintDialog *dlg = new QPrintDialog(&printer, this);
if (ui.msgEdit->textCursor().hasSelection())
dlg->addEnabledOption(QAbstractPrintDialog::PrintSelection);
dlg->setWindowTitle(tr("Print Document"));
if (dlg->exec() == QDialog::Accepted) {
ui.msgEdit->print(&printer);
}
delete dlg;
#endif
}
void CreateBlogMsg::filePrintPreview()
{
#ifndef QT_NO_PRINTER
QPrinter printer(QPrinter::HighResolution);
QPrintPreviewDialog preview(&printer, this);
connect(&preview, SIGNAL(paintRequested(QPrinter*)), SLOT(printPreview(QPrinter*)));
preview.exec();
#endif
}
void CreateBlogMsg::printPreview(QPrinter *printer)
{
#ifdef QT_NO_PRINTER
Q_UNUSED(printer);
#else
ui.msgEdit->print(printer);
#endif
}
void CreateBlogMsg::filePrintPdf()
{
#ifndef QT_NO_PRINTER
//! [0]
QString fileName;
if (misc::getSaveFileName(this, RshareSettings::LASTDIR_MESSAGES, tr("Export PDF"), "*.pdf", fileName)) {
if (QFileInfo(fileName).suffix().isEmpty())
fileName.append(".pdf");
QPrinter printer(QPrinter::HighResolution);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName(fileName);
ui.msgEdit->document()->print(&printer);
}
//! [0]
#endif
}
void CreateBlogMsg::setCurrentFileName(const QString &fileName)
{
this->fileName = fileName;
ui.msgEdit->document()->setModified(false);
QString shownName;
if (fileName.isEmpty())
shownName = "untitled.txt";
else
shownName = QFileInfo(fileName).fileName();
//setWindowTitle(tr("%1[*] - %2").arg(shownName).arg(tr("Rich Text")));
setWindowModified(false);
}
void CreateBlogMsg::addImage()
{
QString fileimg;
if (misc::getOpenFileName(this, RshareSettings::LASTDIR_MESSAGES, tr("Choose Image"), tr("Image Files supported (*.png *.jpeg *.jpg *.gif)"), fileimg)) {
QImage base(fileimg);
Create_New_Image_Tag(fileimg);
}
}
void CreateBlogMsg::Create_New_Image_Tag( const QString urlremoteorlocal )
{
/*if (image_extension(urlremoteorlocal)) {*/
QString subtext = QString("<p><img src=\"%1\">").arg(urlremoteorlocal);
///////////subtext.append("<br><br>Description on image.</p>");
QTextDocumentFragment fragment = QTextDocumentFragment::fromHtml(subtext);
ui.msgEdit->textCursor().insertFragment(fragment);
//emit statusMessage(QString("Image new :").arg(urlremoteorlocal));
//}
}

View File

@ -1,161 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _CREATEBLOGMSG_H
#define _CREATEBLOGMSG_H
#include <QSettings>
#include "ui_CreateBlogMsg.h"
#include <stdint.h>
class SubFileItem;
class FileInfo;
QT_FORWARD_DECLARE_CLASS(QAction)
QT_FORWARD_DECLARE_CLASS(QComboBox)
QT_FORWARD_DECLARE_CLASS(QFontComboBox)
QT_FORWARD_DECLARE_CLASS(QTextEdit)
QT_FORWARD_DECLARE_CLASS(QTextCharFormat)
QT_FORWARD_DECLARE_CLASS(QMenu)
class CreateBlogMsg : public QMainWindow
{
Q_OBJECT
public:
/** Default Constructor */
CreateBlogMsg(std::string cId, QWidget *parent = 0, Qt::WFlags flags = 0);
/** Default Destructor */
void addAttachment(std::string path);
void addAttachment(std::string hash, std::string fname, uint64_t size,
bool local, std::string srcId);
void newBlogMsg();
QPixmap picture;
QSettings setter;
void Create_New_Image_Tag( const QString urlremoteorlocal );
private slots:
void cancelMsg();
void sendMsg();
void addImage();
void fontSizeIncrease();
void fontSizeDecrease();
void blockQuote();
void toggleCode();
void addPostSplitter();
void setStartupText();
void updateTextEdit();
void fileNew();
void fileOpen();
bool fileSave();
bool fileSaveAs();
void filePrint();
void filePrintPreview();
void filePrintPdf();
void printPreview(QPrinter *);
void textBold();
void textUnderline();
void textItalic();
void textFamily(const QString &f);
void textSize(const QString &p);
void changeFormatType(int styleIndex );
void textColor();
void textAlign(QAction *a);
void addOrderedList();
void addUnorderedList();
void currentCharFormatChanged(const QTextCharFormat &format);
void cursorPositionChanged();
void clipboardDataChanged();
private:
void setupFileActions();
void setupEditActions();
void setupViewActions();
void setupInsertActions();
void setupParagraphActions();
void setupTextActions();
void setCurrentFileName(const QString &fileName);
bool load(const QString &f);
bool maybeSave();
void mergeFormatOnWordOrSelection(const QTextCharFormat &format);
void fontChanged(const QFont &f);
void colorChanged(const QColor &c);
void alignmentChanged(Qt::Alignment a);
void sendMessage(std::wstring subject, std::wstring msg);
std::string mBlogId;
QAction *actionSave,
*actionTextBold,
*actionTextUnderline,
*actionTextItalic,
*actionTextColor,
*actionAlignLeft,
*actionAlignCenter,
*actionAlignRight,
*actionAlignJustify,
*actionUndo,
*actionRedo,
*actionCut,
*actionCopy,
*actionPaste;
QComboBox *comboStyle;
QFontComboBox *comboFont;
QComboBox *comboSize;
QString fileName;
QColor codeBackground;
QTextCharFormat defaultCharFormat;
QTextBlockFormat defaultBlockFormat;
QTextCharFormat lastCharFormat;
QTextBlockFormat lastBlockFormat;
/** Qt Designer generated object */
Ui::CreateBlogMsg ui;
};
#endif

View File

@ -1,343 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CreateBlogMsg</class>
<widget class="QMainWindow" name="CreateBlogMsg">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>666</width>
<height>515</height>
</rect>
</property>
<property name="windowTitle">
<string>New Blog Post</string>
</property>
<property name="windowIcon">
<iconset resource="../../images.qrc">
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
</property>
<property name="styleSheet">
<string notr="true">QToolBar#toolBar{background-image: url(:/images/connect/connectFriendBanner.png);
}
QToolButton {
color: white;
}
QToolBar#toolBar_2{
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #FEFEFE, stop:1 #E8E8E8);
border: 1px solid #CCCCCC;}</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="tabPosition">
<enum>QTabWidget::South</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Blog Post</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_8">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Blog Post to:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="channelName">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QTabWidget" name="tabWidget_2">
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>Visual Editor</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Blog Message</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QHBoxLayout" name="_3">
<item>
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Subject :</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="subjectEdit"/>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QTextEdit" name="msgEdit"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabHtml">
<attribute name="title">
<string>Html Editor</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_10">
<item row="0" column="0">
<widget class="QPlainTextEdit" name="plainTextEdit"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>666</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QToolBar" name="toolBar">
<property name="minimumSize">
<size>
<width>0</width>
<height>32</height>
</size>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="windowTitle">
<string>toolBar</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="actionPublish"/>
<addaction name="separator"/>
<addaction name="actionNew"/>
</widget>
<widget class="QToolBar" name="toolBar_2">
<property name="windowTitle">
<string>toolBar_2</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>true</bool>
</attribute>
<addaction name="actionUndo"/>
</widget>
<action name="actionBlockquoute">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/textedit/hi22-action-format-text-blockquote.png</normaloff>:/images/textedit/hi22-action-format-text-blockquote.png</iconset>
</property>
<property name="text">
<string>blockquote</string>
</property>
</action>
<action name="actionIncreasefontsize">
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/textedit/format_font_size_more.png</normaloff>:/images/textedit/format_font_size_more.png</iconset>
</property>
<property name="text">
<string>Increase font Size</string>
</property>
</action>
<action name="actionDecreasefontsize">
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/textedit/format_font_size_less.png</normaloff>:/images/textedit/format_font_size_less.png</iconset>
</property>
<property name="text">
<string>Decrease font size</string>
</property>
</action>
<action name="actionBold">
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/textedit/textbold.png</normaloff>:/images/textedit/textbold.png</iconset>
</property>
<property name="text">
<string>Bold</string>
</property>
</action>
<action name="actionUnderline">
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/textedit/textunder.png</normaloff>:/images/textedit/textunder.png</iconset>
</property>
<property name="text">
<string>Underline</string>
</property>
</action>
<action name="actionItalic">
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/textedit/textitalic.png</normaloff>:/images/textedit/textitalic.png</iconset>
</property>
<property name="text">
<string>Italic</string>
</property>
</action>
<action name="actionPublish">
<property name="text">
<string>Publish</string>
</property>
</action>
<action name="actionNew">
<property name="text">
<string>New</string>
</property>
</action>
<action name="actionCode">
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/textedit/hi22-action-format-text-code.png</normaloff>:/images/textedit/hi22-action-format-text-code.png</iconset>
</property>
<property name="text">
<string>Code</string>
</property>
</action>
<action name="actionsplitPost">
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/textedit/hi22-action-insert-more-mark.png</normaloff>:/images/textedit/hi22-action-insert-more-mark.png</iconset>
</property>
<property name="text">
<string>splitPost</string>
</property>
</action>
<action name="actionOrderedlist">
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/textedit/format-list-ordered.png</normaloff>:/images/textedit/format-list-ordered.png</iconset>
</property>
<property name="text">
<string>Ordered List</string>
</property>
</action>
<action name="actionUnorderedlist">
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/textedit/format-list-unordered.png</normaloff>:/images/textedit/format-list-unordered.png</iconset>
</property>
<property name="text">
<string>Unordered List</string>
</property>
</action>
<action name="actionClipboard">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/textedit/editcut.png</normaloff>:/images/textedit/editcut.png</iconset>
</property>
<property name="text">
<string>Clipboard</string>
</property>
</action>
<action name="actionUndo">
<property name="icon">
<iconset resource="../../images.qrc">
<normaloff>:/images/textedit/editundo.png</normaloff>:/images/textedit/editundo.png</iconset>
</property>
<property name="text">
<string>Undo</string>
</property>
</action>
</widget>
<resources>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../../images.qrc"/>
<include location="../../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -2,7 +2,7 @@ CONFIG += qt gui uic qrc resources uitools idle bitdht
# Below is for GXS services.
# Should be disabled for releases.
#CONFIG += gxs debug
CONFIG += gxs debug
gxs {
@ -300,13 +300,7 @@ HEADERS += rshare.h \
gui/MainWindow.h \
gui/RSHumanReadableDelegate.h \
gui/AboutDialog.h \
gui/ForumsDialog.h \
gui/CreateMsgLinkDialog.h \
gui/forums/ForumDetails.h \
gui/forums/EditForumDetails.h \
gui/forums/CreateForum.h \
gui/forums/CreateForumMsg.h \
gui/forums/ForumUserNotify.h \
gui/NetworkView.h \
gui/TrustView.h \
gui/MessengerWindow.h \
@ -377,12 +371,6 @@ HEADERS += rshare.h \
gui/chat/CreateLobbyDialog.h \
gui/chat/ChatStyle.h \
gui/chat/ChatUserNotify.h \
gui/channels/CreateChannel.h \
gui/channels/ChannelDetails.h \
gui/channels/CreateChannelMsg.h \
gui/channels/EditChanDetails.h \
gui/channels/ShareKey.h \
gui/channels/ChannelUserNotify.h \
gui/connect/ConfCertDialog.h \
gui/msgs/MessageComposer.h \
gui/msgs/MessageWindow.h \
@ -403,7 +391,6 @@ HEADERS += rshare.h \
gui/settings/CryptoPage.h \
gui/settings/MessagePage.h \
gui/settings/NewTag.h \
gui/settings/ForumPage.h \
gui/settings/PluginsPage.h \
gui/settings/PluginItem.h \
gui/settings/AppearancePage.h \
@ -478,15 +465,10 @@ HEADERS += rshare.h \
gui/elastic/arrow.h \
gui/elastic/node.h \
gui/NewsFeed.h \
gui/ChannelFeed.h \
gui/feeds/FeedHolder.h \
gui/feeds/ForumNewItem.h \
gui/feeds/ForumMsgItem.h \
gui/feeds/PeerItem.h \
gui/feeds/MsgItem.h \
gui/feeds/ChatMsgItem.h \
gui/feeds/ChanNewItem.h \
gui/feeds/ChanMsgItem.h \
gui/feeds/SubFileItem.h \
gui/feeds/AttachFileItem.h \
gui/feeds/SecurityItem.h \
@ -496,8 +478,26 @@ HEADERS += rshare.h \
gui/groups/CreateGroup.h \
gui/dht/DhtWindow.h \
gui/bwctrl/BwCtrlWindow.h \
gui/channels/ShareKey.h \
gui/GetStartedDialog.h
# gui/ForumsDialog.h \
# gui/forums/ForumDetails.h \
# gui/forums/EditForumDetails.h \
# gui/forums/CreateForum.h \
# gui/forums/CreateForumMsg.h \
# gui/forums/ForumUserNotify.h \
# gui/feeds/ForumNewItem.h \
# gui/feeds/ForumMsgItem.h \
# gui/ChannelFeed.h \
# gui/feeds/ChanNewItem.h \
# gui/feeds/ChanMsgItem.h \
# gui/channels/CreateChannel.h \
# gui/channels/ChannelDetails.h \
# gui/channels/CreateChannelMsg.h \
# gui/channels/EditChanDetails.h \
# gui/channels/ChannelUserNotify.h \
# gui/settings/ForumPage.h \
FORMS += gui/StartDialog.ui \
gui/GenCertDialog.ui \
@ -508,13 +508,8 @@ FORMS += gui/StartDialog.ui \
gui/FileTransfer/TurtleRouterDialog.ui \
gui/FileTransfer/TurtleRouterStatistics.ui \
gui/FileTransfer/DetailsDialog.ui \
gui/ForumsDialog.ui \
gui/MainWindow.ui \
gui/CreateMsgLinkDialog.ui \
gui/forums/CreateForum.ui \
gui/forums/CreateForumMsg.ui \
gui/forums/ForumDetails.ui \
gui/forums/EditForumDetails.ui \
gui/NetworkView.ui \
gui/TrustView.ui \
gui/MessengerWindow.ui \
@ -532,11 +527,6 @@ FORMS += gui/StartDialog.ui \
gui/profile/ProfileWidget.ui \
gui/profile/StatusMessage.ui \
gui/profile/ProfileManager.ui \
gui/channels/CreateChannel.ui \
gui/channels/CreateChannelMsg.ui \
gui/channels/ChannelDetails.ui \
gui/channels/EditChanDetails.ui \
gui/channels/ShareKey.ui \
gui/chat/PopupChatWindow.ui \
gui/chat/PopupChatDialog.ui \
gui/chat/ChatTabWidget.ui \
@ -559,7 +549,6 @@ FORMS += gui/StartDialog.ui \
gui/settings/CryptoPage.ui \
gui/settings/MessagePage.ui \
gui/settings/NewTag.ui \
gui/settings/ForumPage.ui \
gui/settings/PluginsPage.ui \
gui/settings/AppearancePage.ui \
gui/settings/TransferPage.ui \
@ -577,14 +566,9 @@ FORMS += gui/StartDialog.ui \
gui/advsearch/AdvancedSearchDialog.ui \
gui/advsearch/expressionwidget.ui \
gui/NewsFeed.ui \
gui/ChannelFeed.ui \
gui/feeds/ForumNewItem.ui \
gui/feeds/ForumMsgItem.ui \
gui/feeds/PeerItem.ui \
gui/feeds/MsgItem.ui \
gui/feeds/ChatMsgItem.ui \
gui/feeds/ChanNewItem.ui \
gui/feeds/ChanMsgItem.ui \
gui/feeds/SubFileItem.ui \
gui/feeds/AttachFileItem.ui \
gui/feeds/SecurityItem.ui \
@ -600,8 +584,25 @@ FORMS += gui/StartDialog.ui \
gui/style/StyleDialog.ui \
gui/dht/DhtWindow.ui \
gui/bwctrl/BwCtrlWindow.ui \
gui/channels/ShareKey.ui \
gui/GetStartedDialog.ui
# gui/ForumsDialog.ui \
# gui/forums/CreateForum.ui \
# gui/forums/CreateForumMsg.ui \
# gui/forums/ForumDetails.ui \
# gui/forums/EditForumDetails.ui \
# gui/feeds/ForumNewItem.ui \
# gui/feeds/ForumMsgItem.ui \
# gui/ChannelFeed.ui \
# gui/channels/CreateChannel.ui \
# gui/channels/CreateChannelMsg.ui \
# gui/channels/ChannelDetails.ui \
# gui/channels/EditChanDetails.ui \
# gui/feeds/ChanNewItem.ui \
# gui/feeds/ChanMsgItem.ui \
# gui/settings/ForumPage.ui \
SOURCES += main.cpp \
rshare.cpp \
gui/notifyqt.cpp \
@ -613,13 +614,7 @@ SOURCES += main.cpp \
gui/graphframe.cpp \
gui/mainpagestack.cpp \
gui/MainWindow.cpp \
gui/ForumsDialog.cpp \
gui/CreateMsgLinkDialog.cpp \
gui/forums/ForumDetails.cpp \
gui/forums/EditForumDetails.cpp \
gui/forums/CreateForum.cpp \
gui/forums/CreateForumMsg.cpp \
gui/forums/ForumUserNotify.cpp \
gui/NetworkView.cpp \
gui/TrustView.cpp \
gui/MessengerWindow.cpp \
@ -678,12 +673,6 @@ SOURCES += main.cpp \
gui/profile/ProfileWidget.cpp \
gui/profile/StatusMessage.cpp \
gui/profile/ProfileManager.cpp \
gui/channels/CreateChannel.cpp \
gui/channels/CreateChannelMsg.cpp \
gui/channels/ChannelDetails.cpp \
gui/channels/EditChanDetails.cpp \
gui/channels/ShareKey.cpp \
gui/channels/ChannelUserNotify.cpp \
gui/chat/PopupChatWindow.cpp \
gui/chat/PopupChatDialog.cpp \
gui/chat/PopupDistantChatDialog.cpp \
@ -752,7 +741,6 @@ SOURCES += main.cpp \
gui/settings/CryptoPage.cpp \
gui/settings/MessagePage.cpp \
gui/settings/NewTag.cpp \
gui/settings/ForumPage.cpp \
gui/settings/PluginsPage.cpp \
gui/settings/PluginItem.cpp \
gui/settings/AppearancePage.cpp \
@ -785,15 +773,10 @@ SOURCES += main.cpp \
gui/elastic/arrow.cpp \
gui/elastic/node.cpp \
gui/NewsFeed.cpp \
gui/ChannelFeed.cpp \
gui/feeds/FeedHolder.cpp \
gui/feeds/ForumNewItem.cpp \
gui/feeds/ForumMsgItem.cpp \
gui/feeds/PeerItem.cpp \
gui/feeds/MsgItem.cpp \
gui/feeds/ChatMsgItem.cpp \
gui/feeds/ChanNewItem.cpp \
gui/feeds/ChanMsgItem.cpp \
gui/feeds/SubFileItem.cpp \
gui/feeds/AttachFileItem.cpp \
gui/feeds/SecurityItem.cpp \
@ -803,8 +786,27 @@ SOURCES += main.cpp \
gui/groups/CreateGroup.cpp \
gui/dht/DhtWindow.cpp \
gui/bwctrl/BwCtrlWindow.cpp \
gui/channels/ShareKey.cpp \
gui/GetStartedDialog.cpp
# gui/ForumsDialog.cpp \
# gui/forums/ForumDetails.cpp \
# gui/forums/EditForumDetails.cpp \
# gui/forums/CreateForum.cpp \
# gui/forums/CreateForumMsg.cpp \
# gui/forums/ForumUserNotify.cpp \
# gui/feeds/ForumNewItem.cpp \
# gui/feeds/ForumMsgItem.cpp \
# gui/ChannelFeed.cpp \
# gui/channels/CreateChannel.cpp \
# gui/channels/CreateChannelMsg.cpp \
# gui/channels/ChannelDetails.cpp \
# gui/channels/EditChanDetails.cpp \
# gui/channels/ChannelUserNotify.cpp \
# gui/feeds/ChanNewItem.cpp \
# gui/feeds/ChanMsgItem.cpp \
# gui/settings/ForumPage.cpp \
RESOURCES += gui/images.qrc lang/lang.qrc gui/help/content/content.qrc
TRANSLATIONS += \
@ -856,36 +858,36 @@ pluginmgr {
}
blogs {
DEPENDPATH += gui/unfinished \
HEADERS += gui/unfinished/blogs/BlogsDialog.h \
gui/unfinished/blogs/CreateBlog.h \
gui/unfinished/blogs/CreateBlogMsg.h \
gui/unfinished/blogs/BlogsMsgItem.h \
gui/unfinished/blogs/BlogDetails.h \
gui/feeds/BlogNewItem.h \
gui/feeds/BlogMsgItem.h \
FORMS += gui/unfinished/blogs/BlogsDialog.ui \
gui/unfinished/blogs/CreateBlog.ui \
gui/unfinished/blogs/CreateBlogMsg.ui \
gui/unfinished/blogs/BlogsMsgItem.ui \
gui/unfinished/blogs/BlogDetails.ui \
gui/feeds/BlogNewItem.ui \
gui/feeds/BlogMsgItem.ui \
SOURCES += gui/unfinished/blogs/BlogsDialog.cpp \
gui/unfinished/blogs/CreateBlog.cpp \
gui/unfinished/blogs/CreateBlogMsg.cpp \
gui/unfinished/blogs/BlogsMsgItem.cpp \
gui/unfinished/blogs/BlogDetails.cpp \
gui/feeds/BlogNewItem.cpp \
gui/feeds/BlogMsgItem.cpp \
DEFINES += BLOGS
}
#blogs {
#
#DEPENDPATH += gui/unfinished \
#
#HEADERS += gui/unfinished/blogs/BlogsDialog.h \
# gui/unfinished/blogs/CreateBlog.h \
# gui/unfinished/blogs/CreateBlogMsg.h \
# gui/unfinished/blogs/BlogsMsgItem.h \
# gui/unfinished/blogs/BlogDetails.h \
# gui/feeds/BlogNewItem.h \
# gui/feeds/BlogMsgItem.h \
#
#FORMS += gui/unfinished/blogs/BlogsDialog.ui \
# gui/unfinished/blogs/CreateBlog.ui \
# gui/unfinished/blogs/CreateBlogMsg.ui \
# gui/unfinished/blogs/BlogsMsgItem.ui \
# gui/unfinished/blogs/BlogDetails.ui \
# gui/feeds/BlogNewItem.ui \
# gui/feeds/BlogMsgItem.ui \
#
#SOURCES += gui/unfinished/blogs/BlogsDialog.cpp \
# gui/unfinished/blogs/CreateBlog.cpp \
# gui/unfinished/blogs/CreateBlogMsg.cpp \
# gui/unfinished/blogs/BlogsMsgItem.cpp \
# gui/unfinished/blogs/BlogDetails.cpp \
# gui/feeds/BlogNewItem.cpp \
# gui/feeds/BlogMsgItem.cpp \
#
#DEFINES += BLOGS
#}
# use_links {
# HEADERS += gui/AddLinksDialog.h \
@ -930,10 +932,10 @@ unfinished {
DEPENDPATH += gui/unfinished \
HEADERS += gui/unfinished/ApplicationWindow.h \
gui/unfinished/CalDialog.h \
gui/unfinished/ExampleDialog.h \
gui/unfinished/GamesDialog.h \
# gui/unfinished/CalDialog.h \
# gui/unfinished/ExampleDialog.h \
# gui/unfinished/GamesDialog.h \
# gui/unfinished/profile/ProfileView.h \
# gui/unfinished/profile/ProfileEdit.h
# gui/unfinished/StatisticDialog.h \
@ -941,10 +943,10 @@ unfinished {
# gui/unfinished/PhotoShow.h \
FORMS += gui/unfinished/ApplicationWindow.ui \
gui/unfinished/CalDialog.ui \
gui/unfinished/ExampleDialog.ui \
gui/unfinished/GamesDialog.ui \
# gui/unfinished/CalDialog.ui \
# gui/unfinished/ExampleDialog.ui \
# gui/unfinished/GamesDialog.ui \
# gui/unfinished/profile/ProfileView.ui \
# gui/unfinished/profile/ProfileEdit.ui
# gui/unfinished/StatisticDialog.ui \
@ -952,10 +954,10 @@ unfinished {
# gui/unfinished/PhotoShow.ui \
SOURCES += gui/unfinished/ApplicationWindow.cpp \
gui/unfinished/CalDialog.cpp \
gui/unfinished/ExampleDialog.cpp \
gui/unfinished/GamesDialog.cpp \
# gui/unfinished/CalDialog.cpp \
# gui/unfinished/ExampleDialog.cpp \
# gui/unfinished/GamesDialog.cpp \
# gui/unfinished/profile/ProfileView.cpp \
# gui/unfinished/profile/ProfileEdit.cpp
# gui/unfinished/StatisticDialog.cpp \