mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 14:16:16 -04:00
* Addition of new Feeds (PeersFeed / TransferFeed / MsgFeed)
* Addition of new FeedItems (MsgItem / ChanNewItem ) * Removed CheckBoxes at the top of NewsFeed (should be in config) * Enabled subscribe/unsubscribeButtons in ChannelFeed. * Enabled ChanNewItem and MsgItem in NewsFeeds. * Remove Goto Section Button from FeedItems. * Disabled PlayMedia button - if no attachments. * Enabled Drag from Search Window (with new class SearchTreeWidget) * Enabled Drag from SharedFiles Dialog (mods to RemoteDirModel). * Enabled Drop in GeneralMsgDialog from Search/SharedFiles. * Updated Rs Interface (64 bits for filesize) * Other bits and bobs. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@635 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
56639fd1ba
commit
1f01c08de4
41 changed files with 3362 additions and 521 deletions
|
@ -92,6 +92,12 @@ void GeneralMsgDialog::dragEnterEvent(QDragEnterEvent *event)
|
|||
std::cerr << std::endl;
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
else if (event->mimeData()->hasFormat("application/x-rsfilelist"))
|
||||
{
|
||||
std::cerr << "GeneralMsgDialog::dragEnterEvent() accepting Application/x-qabs...";
|
||||
std::cerr << std::endl;
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "GeneralMsgDialog::dragEnterEvent() No PlainText/Urls";
|
||||
|
@ -101,6 +107,15 @@ void GeneralMsgDialog::dragEnterEvent(QDragEnterEvent *event)
|
|||
|
||||
void GeneralMsgDialog::dropEvent(QDropEvent *event)
|
||||
{
|
||||
if (!(Qt::CopyAction & event->possibleActions()))
|
||||
{
|
||||
std::cerr << "GeneralMsgDialog::dropEvent() Rejecting uncopyable DropAction";
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* can't do it */
|
||||
return;
|
||||
}
|
||||
|
||||
std::cerr << "GeneralMsgDialog::dropEvent() Formats";
|
||||
std::cerr << std::endl;
|
||||
QStringList formats = event->mimeData()->formats();
|
||||
|
@ -140,11 +155,121 @@ void GeneralMsgDialog::dropEvent(QDropEvent *event)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (event->mimeData()->hasFormat("application/x-rsfilelist"))
|
||||
{
|
||||
std::cerr << "GeneralMsgDialog::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->acceptProposedAction();
|
||||
event->setDropAction(Qt::CopyAction);
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void GeneralMsgDialog::parseRsFileListAttachments(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 << "GeneralMsgDialog::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);
|
||||
}
|
||||
else
|
||||
{
|
||||
// TEMP NOT ALLOWED UNTIL FT WORKING.
|
||||
//addAttachment(hash, fname, size);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Error Decode: Hash size: " << hash.size() << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GeneralMsgDialog::addAttachment(std::string hash, std::string fname, uint64_t size)
|
||||
{
|
||||
/* add a SubFileItem to the attachment section */
|
||||
std::cerr << "GeneralMsgDialog::addAttachment()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* add widget in for new destination */
|
||||
SubFileItem *file = new SubFileItem(hash, fname, size);
|
||||
|
||||
mAttachments.push_back(file);
|
||||
QLayout *layout = fileFrame->layout();
|
||||
layout->addWidget(file);
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void GeneralMsgDialog::addAttachment(std::string path)
|
||||
{
|
||||
/* add a SubFileItem to the attachment section */
|
||||
|
@ -185,6 +310,27 @@ void GeneralMsgDialog::addDestination(uint32_t type, std::string grpId, std::str
|
|||
return;
|
||||
}
|
||||
|
||||
void GeneralMsgDialog::setMsgType(uint32_t type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
default:
|
||||
case FEEDHOLDER_MSG_MESSAGE:
|
||||
typeComboBox->setCurrentIndex(GMD_TYPE_MESSAGE_IDX);
|
||||
break;
|
||||
case FEEDHOLDER_MSG_FORUM:
|
||||
typeComboBox->setCurrentIndex(GMD_TYPE_FORUM_IDX);
|
||||
break;
|
||||
case FEEDHOLDER_MSG_CHANNEL:
|
||||
typeComboBox->setCurrentIndex(GMD_TYPE_CHANNEL_IDX);
|
||||
break;
|
||||
case FEEDHOLDER_MSG_BLOG:
|
||||
typeComboBox->setCurrentIndex(GMD_TYPE_BLOG_IDX);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GeneralMsgDialog::updateGroupId()
|
||||
{
|
||||
std::cerr << "GeneralMsgDialog::updateGroupId()";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue