mirror of
				https://github.com/RetroShare/RetroShare.git
				synced 2025-11-03 15:29:02 -05:00 
			
		
		
		
	use for Attachments on GeneralMessage AttachFileItem
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2238 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
		
							parent
							
								
									442b8e2fb7
								
							
						
					
					
						commit
						f14f4f58d7
					
				
					 3 changed files with 17 additions and 16 deletions
				
			
		| 
						 | 
				
			
			@ -23,7 +23,7 @@
 | 
			
		|||
#include "GeneralMsgDialog.h"
 | 
			
		||||
#include "gui/feeds/FeedHolder.h"
 | 
			
		||||
 | 
			
		||||
#include "gui/feeds/SubFileItem.h"
 | 
			
		||||
#include "gui/feeds/AttachFileItem.h"
 | 
			
		||||
#include "gui/feeds/SubDestItem.h"
 | 
			
		||||
 | 
			
		||||
#include "rsiface/rstypes.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -258,28 +258,27 @@ void GeneralMsgDialog::parseRsFileListAttachments(std::string attachList)
 | 
			
		|||
 | 
			
		||||
void GeneralMsgDialog::addAttachment(std::string hash, std::string fname, uint64_t size, bool local, std::string srcId)
 | 
			
		||||
{
 | 
			
		||||
	/* add a SubFileItem to the attachment section */
 | 
			
		||||
	/* add a AttachFileItem to the attachment section */
 | 
			
		||||
	std::cerr << "GeneralMsgDialog::addAttachment()";
 | 
			
		||||
	std::cerr << std::endl;
 | 
			
		||||
 | 
			
		||||
	/* add widget in for new destination */
 | 
			
		||||
 | 
			
		||||
	uint32_t flags = SFI_TYPE_ATTACH;
 | 
			
		||||
	uint32_t flags = AFI_TYPE_ATTACH;
 | 
			
		||||
	if (local)
 | 
			
		||||
	{
 | 
			
		||||
		flags |= SFI_STATE_LOCAL;
 | 
			
		||||
		flags |= AFI_STATE_LOCAL;
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		flags |= SFI_STATE_REMOTE;
 | 
			
		||||
		flags |= AFI_STATE_REMOTE;
 | 
			
		||||
		// TMP REMOVED REMOTE ADD FOR DEMONSTRATOR
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	SubFileItem *file = new SubFileItem(hash, fname, size, flags, srcId);
 | 
			
		||||
	AttachFileItem *file = new AttachFileItem(hash, fname, size, flags, srcId);
 | 
			
		||||
 | 
			
		||||
	mAttachments.push_back(file);
 | 
			
		||||
	//QLayout *layout = fileFrame->layout();
 | 
			
		||||
	verticalLayout_2->addWidget(file);
 | 
			
		||||
 | 
			
		||||
	if (mCheckAttachment)
 | 
			
		||||
| 
						 | 
				
			
			@ -293,7 +292,7 @@ void GeneralMsgDialog::addAttachment(std::string hash, std::string fname, uint64
 | 
			
		|||
 | 
			
		||||
void GeneralMsgDialog::addExtraFile()
 | 
			
		||||
{
 | 
			
		||||
	/* add a SubFileItem to the attachment section */
 | 
			
		||||
	/* add a AttachFileItem to the attachment section */
 | 
			
		||||
	std::cerr << "GeneralMsgDialog::addExtraFile() opening file dialog";
 | 
			
		||||
	std::cerr << std::endl;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -310,7 +309,7 @@ void GeneralMsgDialog::addExtraFile()
 | 
			
		|||
 | 
			
		||||
void GeneralMsgDialog::addAttachment(std::string path)
 | 
			
		||||
{
 | 
			
		||||
	/* add a SubFileItem to the attachment section */
 | 
			
		||||
	/* add a AttachFileItem to the attachment section */
 | 
			
		||||
	std::cerr << "GeneralMsgDialog::addAttachment()";
 | 
			
		||||
	std::cerr << std::endl;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -322,10 +321,9 @@ void GeneralMsgDialog::addAttachment(std::string path)
 | 
			
		|||
	//rsFiles->ExtraFileHash(localpath, period, flags);
 | 
			
		||||
 | 
			
		||||
	/* add widget in for new destination */
 | 
			
		||||
	SubFileItem *file = new SubFileItem(path);
 | 
			
		||||
	AttachFileItem *file = new AttachFileItem(path);
 | 
			
		||||
 | 
			
		||||
	mAttachments.push_back(file);
 | 
			
		||||
	//QLayout *layout = fileFrame->layout();
 | 
			
		||||
	verticalLayout_2->addWidget(file);
 | 
			
		||||
 | 
			
		||||
	if (mCheckAttachment)
 | 
			
		||||
| 
						 | 
				
			
			@ -339,7 +337,7 @@ void GeneralMsgDialog::addAttachment(std::string path)
 | 
			
		|||
 | 
			
		||||
void GeneralMsgDialog::checkAttachmentReady()
 | 
			
		||||
{
 | 
			
		||||
	std::list<SubFileItem *>::iterator fit;
 | 
			
		||||
	std::list<AttachFileItem *>::iterator fit;
 | 
			
		||||
 | 
			
		||||
	mCheckAttachment = false;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -546,7 +544,7 @@ void GeneralMsgDialog::sendMsg()
 | 
			
		|||
	std::list<FileInfo> files;
 | 
			
		||||
 | 
			
		||||
	std::list<SubDestItem *>::iterator it;
 | 
			
		||||
	std::list<SubFileItem *>::iterator fit;
 | 
			
		||||
	std::list<AttachFileItem *>::iterator fit;
 | 
			
		||||
 | 
			
		||||
	for(fit = mAttachments.begin(); fit != mAttachments.end(); fit++)
 | 
			
		||||
	{
 | 
			
		||||
| 
						 | 
				
			
			@ -564,7 +562,7 @@ void GeneralMsgDialog::sendMsg()
 | 
			
		|||
			{
 | 
			
		||||
				if ((*fit)->ready())
 | 
			
		||||
				{
 | 
			
		||||
					(*fit)->download();
 | 
			
		||||
					//(*fit)->download();
 | 
			
		||||
				}
 | 
			
		||||
				// Skips unhashed files.
 | 
			
		||||
			}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,7 +26,7 @@
 | 
			
		|||
#include <stdint.h>
 | 
			
		||||
 | 
			
		||||
class SubDestItem;
 | 
			
		||||
class SubFileItem;
 | 
			
		||||
class AttachFileItem;
 | 
			
		||||
class FileInfo;
 | 
			
		||||
 | 
			
		||||
const uint32_t GMD_TYPE_MESSAGE_IDX = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -72,7 +72,7 @@ void sendMessage(uint32_t type, std::string grpId, std::string inReplyTo,
 | 
			
		|||
 | 
			
		||||
	/* maps of files and destinations */
 | 
			
		||||
	std::list<SubDestItem *> mDestinations;
 | 
			
		||||
	std::list<SubFileItem *> mAttachments;
 | 
			
		||||
	std::list<AttachFileItem *> mAttachments;
 | 
			
		||||
 | 
			
		||||
	bool mCheckAttachment;
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -86,6 +86,9 @@
 | 
			
		|||
       <property name="orientation">
 | 
			
		||||
        <enum>Qt::Horizontal</enum>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="sizeType">
 | 
			
		||||
        <enum>QSizePolicy::Minimum</enum>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="sizeHint" stdset="0">
 | 
			
		||||
        <size>
 | 
			
		||||
         <width>40</width>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue