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:
defnax 2010-02-08 13:18:09 +00:00
parent 442b8e2fb7
commit f14f4f58d7
3 changed files with 17 additions and 16 deletions

View File

@ -23,7 +23,7 @@
#include "GeneralMsgDialog.h" #include "GeneralMsgDialog.h"
#include "gui/feeds/FeedHolder.h" #include "gui/feeds/FeedHolder.h"
#include "gui/feeds/SubFileItem.h" #include "gui/feeds/AttachFileItem.h"
#include "gui/feeds/SubDestItem.h" #include "gui/feeds/SubDestItem.h"
#include "rsiface/rstypes.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) 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 << "GeneralMsgDialog::addAttachment()";
std::cerr << std::endl; std::cerr << std::endl;
/* add widget in for new destination */ /* add widget in for new destination */
uint32_t flags = SFI_TYPE_ATTACH; uint32_t flags = AFI_TYPE_ATTACH;
if (local) if (local)
{ {
flags |= SFI_STATE_LOCAL; flags |= AFI_STATE_LOCAL;
} }
else else
{ {
flags |= SFI_STATE_REMOTE; flags |= AFI_STATE_REMOTE;
// TMP REMOVED REMOTE ADD FOR DEMONSTRATOR // TMP REMOVED REMOTE ADD FOR DEMONSTRATOR
return; return;
} }
SubFileItem *file = new SubFileItem(hash, fname, size, flags, srcId); AttachFileItem *file = new AttachFileItem(hash, fname, size, flags, srcId);
mAttachments.push_back(file); mAttachments.push_back(file);
//QLayout *layout = fileFrame->layout();
verticalLayout_2->addWidget(file); verticalLayout_2->addWidget(file);
if (mCheckAttachment) if (mCheckAttachment)
@ -293,7 +292,7 @@ void GeneralMsgDialog::addAttachment(std::string hash, std::string fname, uint64
void GeneralMsgDialog::addExtraFile() 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 << "GeneralMsgDialog::addExtraFile() opening file dialog";
std::cerr << std::endl; std::cerr << std::endl;
@ -310,7 +309,7 @@ void GeneralMsgDialog::addExtraFile()
void GeneralMsgDialog::addAttachment(std::string path) 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 << "GeneralMsgDialog::addAttachment()";
std::cerr << std::endl; std::cerr << std::endl;
@ -322,10 +321,9 @@ void GeneralMsgDialog::addAttachment(std::string path)
//rsFiles->ExtraFileHash(localpath, period, flags); //rsFiles->ExtraFileHash(localpath, period, flags);
/* add widget in for new destination */ /* add widget in for new destination */
SubFileItem *file = new SubFileItem(path); AttachFileItem *file = new AttachFileItem(path);
mAttachments.push_back(file); mAttachments.push_back(file);
//QLayout *layout = fileFrame->layout();
verticalLayout_2->addWidget(file); verticalLayout_2->addWidget(file);
if (mCheckAttachment) if (mCheckAttachment)
@ -339,7 +337,7 @@ void GeneralMsgDialog::addAttachment(std::string path)
void GeneralMsgDialog::checkAttachmentReady() void GeneralMsgDialog::checkAttachmentReady()
{ {
std::list<SubFileItem *>::iterator fit; std::list<AttachFileItem *>::iterator fit;
mCheckAttachment = false; mCheckAttachment = false;
@ -546,7 +544,7 @@ void GeneralMsgDialog::sendMsg()
std::list<FileInfo> files; std::list<FileInfo> files;
std::list<SubDestItem *>::iterator it; std::list<SubDestItem *>::iterator it;
std::list<SubFileItem *>::iterator fit; std::list<AttachFileItem *>::iterator fit;
for(fit = mAttachments.begin(); fit != mAttachments.end(); fit++) for(fit = mAttachments.begin(); fit != mAttachments.end(); fit++)
{ {
@ -564,7 +562,7 @@ void GeneralMsgDialog::sendMsg()
{ {
if ((*fit)->ready()) if ((*fit)->ready())
{ {
(*fit)->download(); //(*fit)->download();
} }
// Skips unhashed files. // Skips unhashed files.
} }

View File

@ -26,7 +26,7 @@
#include <stdint.h> #include <stdint.h>
class SubDestItem; class SubDestItem;
class SubFileItem; class AttachFileItem;
class FileInfo; class FileInfo;
const uint32_t GMD_TYPE_MESSAGE_IDX = 0; 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 */ /* maps of files and destinations */
std::list<SubDestItem *> mDestinations; std::list<SubDestItem *> mDestinations;
std::list<SubFileItem *> mAttachments; std::list<AttachFileItem *> mAttachments;
bool mCheckAttachment; bool mCheckAttachment;
}; };

View File

@ -86,6 +86,9 @@
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>40</width> <width>40</width>