2008-06-24 00:36:45 -04:00
|
|
|
/****************************************************************
|
|
|
|
* 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 "SubDestItem.h"
|
|
|
|
#include "FeedHolder.h"
|
|
|
|
|
2010-08-06 05:40:23 -04:00
|
|
|
#include <retroshare/rspeers.h>
|
|
|
|
#include <retroshare/rsforums.h>
|
|
|
|
#include <retroshare/rschannels.h>
|
2008-06-24 00:36:45 -04:00
|
|
|
|
2008-07-09 05:53:47 -04:00
|
|
|
/****
|
|
|
|
* #define DEBUG_ITEM 1
|
|
|
|
****/
|
2008-06-24 00:36:45 -04:00
|
|
|
|
|
|
|
/** Constructor */
|
2012-02-01 07:21:14 -05:00
|
|
|
SubDestItem::SubDestItem(uint32_t type, const std::string &groupId, const std::string &inReplyTo)
|
2008-06-24 00:36:45 -04:00
|
|
|
:QWidget(NULL), mType(type), mGroupId(groupId), mInReplyTo(inReplyTo)
|
|
|
|
{
|
|
|
|
/* Invoke the Qt Designer generated object setup routine */
|
|
|
|
setupUi(this);
|
|
|
|
|
2010-05-04 20:05:36 -04:00
|
|
|
setAttribute ( Qt::WA_DeleteOnClose, true );
|
|
|
|
|
2008-06-24 00:36:45 -04:00
|
|
|
connect( cancelButton, SIGNAL( clicked( void ) ), this, SLOT( cancel ( void ) ) );
|
|
|
|
|
|
|
|
updateItemStatic();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SubDestItem::updateItemStatic()
|
|
|
|
{
|
|
|
|
/* fill in */
|
|
|
|
#ifdef DEBUG_ITEM
|
|
|
|
std::cerr << "SubDestItem::updateItemStatic()";
|
|
|
|
std::cerr << std::endl;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
QString name = "Unknown";
|
|
|
|
switch(mType)
|
|
|
|
{
|
|
|
|
case FEEDHOLDER_MSG_MESSAGE:
|
|
|
|
{
|
|
|
|
typeLabel->setText("Message To: ");
|
|
|
|
if (rsPeers)
|
|
|
|
{
|
2011-07-17 19:07:29 -04:00
|
|
|
name = QString::fromUtf8(rsPeers->getPeerName(mGroupId).c_str());
|
2008-06-24 00:36:45 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FEEDHOLDER_MSG_FORUM:
|
|
|
|
{
|
|
|
|
typeLabel->setText("Forum Post To: ");
|
|
|
|
ForumInfo fi;
|
|
|
|
if ((rsForums) && (rsForums->getForumInfo(mGroupId, fi)))
|
|
|
|
{
|
|
|
|
name = QString::fromStdWString(fi.forumName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FEEDHOLDER_MSG_CHANNEL:
|
|
|
|
{
|
|
|
|
typeLabel->setText("Channel Post To: ");
|
|
|
|
ChannelInfo ci;
|
|
|
|
if ((rsChannels) && (rsChannels->getChannelInfo(mGroupId, ci)))
|
|
|
|
{
|
|
|
|
name = QString::fromStdWString(ci.channelName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FEEDHOLDER_MSG_BLOG:
|
|
|
|
{
|
|
|
|
typeLabel->setText("Blog Post");
|
|
|
|
name = "";
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
nameLabel->setText(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SubDestItem::cancel()
|
|
|
|
{
|
|
|
|
#ifdef DEBUG_ITEM
|
|
|
|
std::cerr << "SubDestItem::cancel()";
|
|
|
|
std::cerr << std::endl;
|
|
|
|
#endif
|
|
|
|
hide();
|
|
|
|
}
|
|
|
|
|